Jump to content

Snippets C# codes for Fight Classes


Recommended Posts

Check if character/target have or not buff/debuff by spell id:

Use condition type "C Sharp Code" with Value:

wManager.Wow.ObjectManager.ObjectManager.Me.HaveBuff(69369)
  • Replace "69369" by your buff/debuff ID.
  • Replace "Me" by "Target" to check buff/debuff on current target (you can also replace "Me" by "Pet" to check on the pet).
  • Add "!" before this code to check if not have (de)buff ( http://www.tutorialspoint.com/csharp/csharp_logical_operators.htm ).
  • To get list of player/target (de)buff id, you can go to tab "Tools" > "Development Tools" > (if you want check your target (de)buff select npc in game) > click on "Player/target buff/debuff".
Link to post
Share on other sites

Check if character/target buff/debuff stack count by spell id:

Use condition type "C Sharp Code" with Value:

wManager.Wow.ObjectManager.ObjectManager.Me.BuffStack(44544) >= 1
  • Replace "44544" by your buff/debuff ID.
  • Replace "Me" by "Target" to check buff/debuff on current target (you can also replace "Me" by "Pet" to check on the pet).
  • ">= 1" check if stack count is "Bigger or Equal at 1", you can replace "1" by required stack count. You can also replace ">=" by "<=" to check if "Smaller or Equal", or by "==" to check if "Equal" - http://www.tutorialspoint.com/csharp/csharp_relational_operators.htm ).
  • To get list of player/target (de)buff id, you can go to tab "Tools" > "Development Tools" > (if you want check your target (de)buff select npc in game) > click on "Player/target buff/debuff".
Link to post
Share on other sites

Check character/target buff/debuff time left by spell id:

Use condition type "C Sharp Code" with Value:

wManager.Wow.ObjectManager.ObjectManager.Me.BuffTimeLeft(new List<uint> { 69369 }) >= 1000
  • Replace "69369" by your buff/debuff ID.
  • Replace "Me" by "Target" to check buff/debuff on current target (you can also replace "Me" by "Pet" to check on the pet).
  • ">= 1000" check if time left is "Bigger or Equal at 1000 millisecond", you can replace "1000" by required time left in millisacond. You can also replace ">=" by "<=" to check if "Smaller or Equal", or by "==" to check if "Equal" - http://www.tutorialspoint.com/csharp/csharp_relational_operators.htm ).
  • To get list of player/target (de)buff id, you can go to tab "Tools" > "Development Tools" > (if you want check your target (de)buff select npc in game) > click on "Player/target buff/debuff".
Link to post
Share on other sites
  • Droidz pinned this topic
  • 1 year later...
On 8/7/2016 at 12:30 PM, Droidz said:

Check character/target buff/debuff time left by spell id:

Use condition type "C Sharp Code" with Value:

wManager.Wow.ObjectManager.ObjectManager.Me.BuffTimeLeft(new List<uint> { 69369 }) >= 1000
  • Replace "69369" by your buff/debuff ID.
  • Replace "Me" by "Target" to check buff/debuff on current target (you can also replace "Me" by "Pet" to check on the pet).
  • ">= 1000" check if time left is "Bigger or Equal at 1000 millisecond", you can replace "1000" by required time left in millisacond. You can also replace ">=" by "<=" to check if "Smaller or Equal", or by "==" to check if "Equal" - http://www.tutorialspoint.com/csharp/csharp_relational_operators.htm ).
  • To get list of player/target (de)buff id, you can go to tab "Tools" > "Development Tools" > (if you want check your target (de)buff select npc in game) > click on "Player/target buff/debuff".

If I use this, the time left is always zero. The development Tools output also shows:

PLAYER Buff/Debuff:

Retribution Aura: ID=7294, Stack=1, TimeLeft=0 ms, Owner=0
Blessing of Might: ID=19834, Stack=1, TimeLeft=0 ms, Owner=0
Seal of the Crusader: ID=20162, Stack=1, TimeLeft=0 ms, Owner=0

Link to post
Share on other sites
3 hours ago, DrSeltsam said:

If I use this, the time left is always zero. The development Tools output also shows:

PLAYER Buff/Debuff:

Retribution Aura: ID=7294, Stack=1, TimeLeft=0 ms, Owner=0
Blessing of Might: ID=19834, Stack=1, TimeLeft=0 ms, Owner=0
Seal of the Crusader: ID=20162, Stack=1, TimeLeft=0 ms, Owner=0

Funny I recently came back after a couple of months off and had to remove the TimeLeft check in my cc because it would always be 0. Thought the bug was on my side. Using vanilla.

Link to post
Share on other sites
  • 9 months later...
1 hour ago, someshit said:

need to calculate number of opponents within 8 yards of current target. any tips?

if(ObjectManager.GetWoWUnitAttackables().Any(x=> x.Position.DistanceTo(ObjectManager.Me.Position) < 20))
{
    MovementManager.StopMove();
    Fight.StartFight(ObjectManager.GetWoWUnitAttackables().OrderBy(x => x.Position.DistanceTo(ObjectManager.Me.Position)).FirstOrDefault().Guid);
}

 

Link to post
Share on other sites
  • 1 year later...

WoWUnit Extension "IsAutoAttacking" (WOTLK)

        /// <summary>
        /// Gets the flag if the unit is auto attacking.
        /// </summary>
        /// <returns>Returns true if the unit is auto attacking, otherwise false.</returns>
        public static bool IsAutoAttacking(this WoWUnit instance)
        {
            // Read
            bool result = Memory.WowMemory.Memory.ReadBoolean(address: instance.GetBaseAddress + (uint)0xA20);

            // Return
            return result;
        }

I'm not sure about the other extension offsets.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...