Get who unit is attacking... menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    jbrauman's Avatar Member
    Reputation
    65
    Join Date
    Dec 2007
    Posts
    72
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Get who unit is attacking...

    I was looking through the various addresses in the unit fields, and there is nothing to tell me who the unit is attacking. I wanted to get the guids of all the units who are attacking myself by looping through the object manager and getting the guid of an object if the guid of the thing it is attacking (if any) is me. This would also tell me if I am in combat or not:

    Code:
     
    if (LocalPlayer.AttackingUnits.Count != 0)
      // in combat
    else
      // not in combat
    Could someone please describe how to get the guid of who a player/mob is attacking?

    Cheers.

    Get who unit is attacking...
  2. #2
    jjaa's Avatar Contributor
    Reputation
    245
    Join Date
    Dec 2006
    Posts
    562
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [07:14:50]: UNIT_FIELD_FLAGS = 0x3A
    [07:14:50]: UNIT_FIELD_FLAGS_2 = 0x3B
    I think its in one of those

    EDIT: wait that will tell you that the unit is attacking...
    Last edited by jjaa; 01-24-2009 at 03:29 AM.

  3. #3
    schlumpf's Avatar Retired Noggit Developer

    Reputation
    755
    Join Date
    Nov 2006
    Posts
    2,759
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then check the flags and their target. If its attacking and targeting you, its attacking you.

  4. #4
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe attacking is stored in the DYNAMIC_FLAGS, as for target, just cycle through the list with UNIT_FIELD_TARGET
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  5. #5
    jbrauman's Avatar Member
    Reputation
    65
    Join Date
    Dec 2007
    Posts
    72
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for all the replies.

    Originally Posted by Robske007a View Post
    I believe attacking is stored in the DYNAMIC_FLAGS, as for target, just cycle through the list with UNIT_FIELD_TARGET
    Rob: How should I determine whether that unit is attacking by reading DYNAMIC_FLAGS? According to this:
    Code:
        /* offset:[0x0120] */    unsigned long UNIT_DYNAMIC_FLAGS;
    A ulong is stored in there. What are the possible values that this ulong could be, and how can I determine if the unit is attacking or not? Or is UNIT_DYNAMIC_FLAGS (I assume we are referring to the same address here) another structure? If so, what is the layout of this structure?

    Forgive me for being totally ignorant but currently I have no knowledge of ASM or debugging / reversing and cannot find these things out myself (bar guesswork).

  6. #6
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hehe, noticed I was wrong, it's stored in the UNIT_FIELD_FLAGS allright.

    Straight from BS's WOWXBase:

    bool CGUnit_C::IsAggro()
    {
    return ( ( GetKnownField( UNIT_FIELD_FLAGS ) >> 0x13 )&1 );
    }
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  7. #7
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by schlumpf View Post
    Then check the flags and their target. If its attacking and targeting you, its attacking you.
    Totally unnecessary and won't work in certain situations.

    Better way:
    CGUnit_C member at 0x0A38. WGUID AttackingGUID.

  8. #8
    schlumpf's Avatar Retired Noggit Developer

    Reputation
    755
    Join Date
    Nov 2006
    Posts
    2,759
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    Totally unnecessary and won't work in certain situations.

    Better way:
    CGUnit_C member at 0x0A38. WGUID AttackingGUID.
    You don't want to upload all your classes etc. somewhere so we can use all your information, eh?

    Still: When wont that work? Where are situations, where the target is different to the unit attacked? oO Or do you mean that checking two things is useless?

  9. #9
    jbrauman's Avatar Member
    Reputation
    65
    Join Date
    Dec 2007
    Posts
    72
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post
    Totally unnecessary and won't work in certain situations.

    Better way:
    CGUnit_C member at 0x0A38. WGUID AttackingGUID.
    Thanks Cypher. What structure is CGUnit_C? Unless I'm totally ignorant, you meant WGUID AttackingGUID is read from "CGUnit_C"-base + 0x0A38. However I have not come across this structure before. Was it the technical name for Unit_Fields? Or something completely different.

  10. #10
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by schlumpf View Post
    You don't want to upload all your classes etc. somewhere so we can use all your information, eh?

    Still: When wont that work? Where are situations, where the target is different to the unit attacked? oO Or do you mean that checking two things is useless?
    Why should he upload his classes?

    Besides, there may be cases where a mob targets you yet doesn't attack (none come to mind however), using UNIT_FIELD_TARGET and UNIT_FIELD_FLAGS means atleast 2 reads and a call/loop while CG_UNIT_C's AttackingGUID member will yeild you an indisputable GUID.
    Last edited by Robske; 01-24-2009 at 05:51 AM. Reason: cat message | sed 's+SPELLING+FIXES'
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  11. #11
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by schlumpf View Post
    You don't want to upload all your classes etc. somewhere so we can use all your information, eh?

    Still: When wont that work? Where are situations, where the target is different to the unit attacked? oO Or do you mean that checking two things is useless?

    Ummm..... No?

    Units can have aggro on another unit without actually targeting them. Last time I checked the target was cleared but the AttackingGUID still held true.


    Originally Posted by jbrauman View Post
    Thanks Cypher. What structure is CGUnit_C? Unless I'm totally ignorant, you meant WGUID AttackingGUID is read from "CGUnit_C"-base + 0x0A38. However I have not come across this structure before. Was it the technical name for Unit_Fields? Or something completely different.
    Not gonna bother answering you anymore if you're not gonna bother doing some of your own damn research (on crap that has been covered a billion times).

    Originally Posted by Robske007a View Post
    Why should he upload his classes?

    Besides, there may be cases where a mob targets you yet doesn't attack (none come to mind however), using UNIT_FIELD_TARGET and UNIT_FIELD_FLAGS means atleast 2 reads and a call/loop while CG_UNIT_C's AttackingGUID member will yeild you an indisputable GUID.

    Obviously because schlumpf is the center of the universe and I should immediately release all information I have on WoW just to make his life easer, regardless of the impact that would have.

    Also yes, using the unit flags and target is waste of resources and may not be 100% accurate.

  12. #12
    Xarg0's Avatar Member
    Reputation
    61
    Join Date
    Jan 2008
    Posts
    389
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Folks, if you'd search trought the older posts you'd find Cyphers WoWClasses, you could also use the WoWClasses of WoWX base, they're pretty much the same as they result from reversing the wowclasses. And if you'd look at the stickied 3.0.2 Thread you'd also find a lot of code from Cypher, if not his hole wowobjects.

    Edit: Charmander was faster than me, this time...
    I hacked 127.0.0.1

  13. #13
    schlumpf's Avatar Retired Noggit Developer

    Reputation
    755
    Join Date
    Nov 2006
    Posts
    2,759
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post

    Ummm..... No?

    Units can have aggro on another unit without actually targeting them. Last time I checked the target was cleared but the AttackingGUID still held true.

    Ah, I thought, that the flag would show if the unit is attacking, not if its has aggro.

  14. #14
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Cypher View Post

    regardless of the impact that would have.
    "How to make people curious, a guide for dummies" - By Cypher
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  15. #15
    jbrauman's Avatar Member
    Reputation
    65
    Join Date
    Dec 2007
    Posts
    72
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, I think I understand what Cyper said, let me just throw this out there, and please tell me if it is right.

    All objects in the object manager are subclasses from a "base class". I'm calling this base class WowObject. To my knowledge, the object manager never has an object with its class being WowObject. All the objects in there are subclasses of this WowObject and inherit all of WowObject's members, and they also extend WowObject depending on what class they are. This can be described programmatically like this:
    Code:
    class WowObject
    {
       ulong Guid;  // read from base+0x30
       uint Type;   // read from base+0x14
       double XPosition;   // read from base+0x7D0
       ...
    }
     
    class PlayerObject : WowObject
    {
       int Health;   // read from player unit fields + (0x17 * 4)
    int MaxHealth;   // read from player unit fields + (0x1F * 4)
    ...
    }
    class DynamicObject : WowObject
    {
       ulong Caster;
       int SpellId;
       ...
    }
     
    ...
    Which means that for every WowObject, be it a player or gameobject or dynamic object or w/e, you can get certain information from them (ie guid) in the same way, but then you can get information pertaining only to that object type (ie spell id)

    Is that about right?
    Thanks.

    Edit: I tried to implement this functionality in my current code, but apparently it turns out casting (more specifically downcasting) is quite... interesting. Instead I just put in a "WowObject.ToPlayerObject" for every subclass. Eg. I'm reading from ObjectManager, and then determining what type of object it is, and then converting it to the type of object it is and continue reading information about it (only have a couple of NPC fields done but it shows what I'm doing (actual code, lol):
    Code:
    publicvoid UpdateObjectList()
    {
    // this method will loop through every item in the object manager
    // and retrieve information about that object, then add it to the
    // objectlist.
    // make a temporary object and set the base address of it to the
    // first object in the object manager
    WowObject CurrentObject = newWowObject();
    CurrentObject.BaseAddress = ReadUInt32((IntPtr)(ObjectManagerBase + GlobalAddresses.FirstObjectOffset));
     
    // read from first object to last object in object manager
    while (CurrentObject.BaseAddress != 0)
    {
    CurrentObject.Guid = ReadUInt64((IntPtr)(CurrentObject.BaseAddress + ObjectAddresses.GuidOffset));
    CurrentObject.Type = ReadUInt32((IntPtr)(CurrentObject.BaseAddress + ObjectAddresses.TypeOffset));
    CurrentObject.XPos = ReadFloat((IntPtr)(CurrentObject.BaseAddress + ObjectAddresses.XPositionOffset));
    CurrentObject.YPos = ReadFloat((IntPtr)(CurrentObject.BaseAddress + ObjectAddresses.YPositionOffset));
    CurrentObject.ZPos = ReadFloat((IntPtr)(CurrentObject.BaseAddress + ObjectAddresses.ZPositionOffset));
    CurrentObject.Rotation = ReadFloat((IntPtr)(CurrentObject.BaseAddress + ObjectAddresses.RotationOffset));
    switch (CurrentObject.Type)
    {
    case (uint)ObjectTypes.Item:
    break;
    case (uint)ObjectTypes.Container:
    break;
    case (uint)ObjectTypes.NPC:
    NPCObject CurrentNPCObject = CurrentObject.ToNPCObject();
    CurrentNPCObject.UnitFieldsAddress = ReadUInt32((IntPtr)(CurrentNPCObject.BaseAddress + 0x8));
    CurrentNPCObject.CurrentHealth = ReadInt32((IntPtr)(CurrentNPCObject.UnitFieldsAddress + UnitFieldsOffsets.CurrentHealth));
    CurrentNPCObject.MaxHealth = ReadInt32((IntPtr)(CurrentNPCObject.UnitFieldsAddress + UnitFieldsOffsets.MaxHealth));
    // more to do
    ObjectList.Add(CurrentNPCObject.Guid, newNPCObject(CurrentNPCObject));
    // copy that into my local idictionary of wowobjects through copy constructor
    break;
    case (uint)ObjectTypes.Player:
    break;
    case (uint)ObjectTypes.GameObject:
    break;
    case (uint)ObjectTypes.DynamicObject:
    break;
    case (uint)ObjectTypes.Corpse:
    break;
    }
    // set our current object as the next object
    CurrentObject.BaseAddress = ReadUInt32((IntPtr)(CurrentObject.BaseAddress + ObjectAddresses.NextObjectOffset));
    }
    }
    
    And by the way Cypher, I understand now what you were saying, applied it and it worked. Your terminology was what put me off.


    EditEdit: Okay apparently this textbox cant understand the indentations in my code copied from Express C# so I screw it, its still kind of readable.
    Last edited by jbrauman; 01-25-2009 at 06:19 AM.

Page 1 of 2 12 LastLast

Similar Threads

  1. Get your pet to attack while stealthed.
    By advanta in forum World of Warcraft Exploits
    Replies: 2
    Last Post: 06-02-2015, 09:50 AM
  2. Never get a Dodged/Parried attack
    By newfang in forum WoW EMU Exploits & Bugs
    Replies: 4
    Last Post: 04-13-2008, 06:23 AM
  3. Replies: 5
    Last Post: 08-30-2007, 07:25 PM
  4. How to get your own city (faction) to attack you, and other players.
    By Meltoor in forum World of Warcraft Exploits
    Replies: 13
    Last Post: 08-18-2007, 10:15 PM
  5. Warriors get a huge attack power boost
    By Matt in forum World of Warcraft Exploits
    Replies: 0
    Last Post: 04-02-2006, 10:02 PM
All times are GMT -5. The time now is 06:11 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search