[Guide-kind of] How I handle objects. menu

Shout-Out

User Tag List

Page 3 of 6 FirstFirst 123456 LastLast
Results 31 to 45 of 80
  1. #31
    Shynd's Avatar Contributor
    Reputation
    97
    Join Date
    May 2008
    Posts
    393
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to read some more of the threads in this forum, then.

    [Guide-kind of] How I handle objects.
  2. #32
    opulent's Avatar Member
    Reputation
    5
    Join Date
    Apr 2009
    Posts
    29
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I used this guide to get started and I found it extremely helpful. I translated some of it into C++ (albeit very poorly) and I'm pasting it here jic someone would like to toy around with it.

    All credit goes to the OP - Jbrauman. Offsets are for 3.0.9

    C++ Code for ObjectManager:
    Code:
    class oManager
    {
    public:
        oManager()
        {
            Memory::AddDebugPrivileges(); //Required as no instance of the class has been made.
            LoadAddresses();
        }
    
        void LoadAddresses()
        {
            DWORD  clientConnection = Memory::Read<DWORD>(0x11CB310); //Get Client Connection:
            objectManagerBase = Memory::Read<DWORD>(clientConnection + 0x28A4);
            localGuid = Memory::Read<INT64>(objectManagerBase + 0xC0); //Object manager base + localGUID offset
        }
    
    
        list<oNpc> oNpcList;
        list<oGame> oGameList;
        list<oPlayer> oPlayerList;
    
    
        void PopulateLists()
        {
            oNpcList.erase(oNpcList.begin(), oNpcList.end());
            oGameList.erase(oGameList.begin(), oGameList.end());
            oPlayerList.erase(oPlayerList.begin(), oPlayerList.end());
    
            WowObject CurrentObject = WowObject(Memory::Read<DWORD>(objectManagerBase + firstObjectOffset));
    
            while (CurrentObject.baseAddress != 0 && CurrentObject.baseAddress % 2 == 0)
            {
                if (CurrentObject.GetType() == 3)  // a npc
                    oNpcList.push_back(oNpc(CurrentObject.baseAddress));
                if (CurrentObject.GetType() == 4) // a player
                    oPlayerList.push_back(oPlayer(CurrentObject.baseAddress));
                if (CurrentObject.GetType() == 5) // a gameobject
                    oGameList.push_back(oGame(CurrentObject.baseAddress));
    
                DWORD CurrentBase = CurrentObject.baseAddress;
                CurrentObject = WowObject(Memory::Read<DWORD>(CurrentBase + nextObjectOffset));
            }
        }
    
        void populatePlayer()
        {
            //DWORD constPlayerBase = Memory::Read<DWORD>(Memory::Read<DWORD>(Memory::Read<DWORD>(0x127F13C) + 0x30) + 0x28);
            DWORD oFirst = Memory::Read<DWORD>(objectManagerBase + firstObjectOffset);
            DWORD oThis = oFirst;
            INT64 oGuid = NULL;
            while (oGuid != localGuid)
            {
                oGuid = Memory::Read<INT64>(oThis + 0x30);
                if (oGuid == localGuid)
                {
                    //This is where your player will be!!
                }
                oFirst = oThis;
                oThis = Memory::Read<DWORD>(oFirst + nextObjectOffset);
            }
        }
    
    
    private:
        const static DWORD firstObjectOffset = 0xAC;      // offset from the object manager to the first object
        const static DWORD nextObjectOffset = 0x3C;       // offset from one object to the next
        DWORD objectManagerBase;                          // the address off the object manager
        INT64 localGuid;                                  // the local guid.
    
    };
    C++ Code for the other Objects
    *Note that string names don't function due to my lack of skill.

    Code:
    class WowObject
    {
    public:
    
        WowObject(DWORD baseAddress)
        {
            this -> baseAddress = baseAddress;
            RefreshFields();
        }
    
        void RefreshFields()
        {
            SetDescriptorFields();
            SetType();
            SetGuid();
            SetXPosition();
            SetYPosition();
            SetZPosition();
            SetRotation();
        }
        void SetDescriptorFields()
        {
            this -> descriptorFields = Memory::Read<DWORD>(baseAddress + descriptorFieldsOffset);
        }
        int GetDescriptorFields()
        {
            return descriptorFields;
        }
        void SetType()
        {
            this -> type = Memory::Read<int>(baseAddress + typeOffset);
        }
        int GetType()
        {
            return type;
        }
        void SetGuid()
        {
            this -> guid = Memory::Read<INT64>(baseAddress + guidOffset);
        }
        INT64 GetGuid()
        {
            return guid;
        }
        virtual void SetXPosition()
        {
            this -> xPosition = Memory::Read<float>(baseAddress + xPositionOffset);
        }
        float GetXPosition()
        {
            return xPosition;
        }
        virtual void SetYPosition()
        {
            this -> yPosition = Memory::Read<float>(baseAddress + yPositionOffset);
        }
        float GetYPosition()
        {
            return yPosition;
        }
        virtual void SetZPosition()
        {
            this -> zPosition = Memory::Read<float>(baseAddress + zPositionOffset);
        }
        float GetZPosition()
        {
            return zPosition;
        }
        void SetRotation()
        {
            this -> rotation =  Memory::Read<float>(baseAddress + rotationOffset);
        }
        float GetRotation()
        {
            return rotation;
        }
    
        DWORD baseAddress;
        DWORD descriptorFields;
        float zPosition,
        yPosition,
        xPosition,
        rotation;
        INT64 guid;
        int	 type;
    
    
    protected:
        const static DWORD guidOffset = 0x30;
        const static DWORD nextObjectOffset = 0x3C;
        const static DWORD typeOffset = 0x14;
        const static DWORD xPositionOffset = 0x7D0;
        const static DWORD yPositionOffset = 0x7D4;
        const static DWORD zPositionOffset = 0x7D8;
        const static DWORD rotationOffset = 0x7DC;
        descriptorFieldsOffset = 0x08;
    };
    
    
    
    class Creature : public WowObject
    {
    public:
    
        Creature(DWORD baseAddress) : WowObject(baseAddress)
        {
            this -> baseAddress = baseAddress;
            RefreshFields();
        }
        void RefreshFields()
        {
            SetTargetGuid();
            SetLevel();
            SetCurrentHealth();
            SetMaxHealth();
            SetHealthPercent();
            SetCurrentMana();
            SetMaxMana();
            SetPitch();
        }
    
        void SetPitch()
        {
            this -> pitch = Memory::Read<float>(Memory::Read<DWORD>(baseAddress + 0x110) + 0x20);
        }
        float GetPitch()
        {
            return this -> pitch;
        }
        void SetTargetGuid()
        {
            this -> targetGuid = Memory::Read<INT64>(descriptorFields + targetGuidOffset);
        }
        INT64 GetTargetGuid()
        {
            return this -> targetGuid;
        }
        void SetLevel()
        {
            this -> level = Memory::Read<int>(descriptorFields + levelOffset);
        }
        int GetLevel()
        {
            return this -> level;
        }
        void SetCurrentHealth()
        {
            this -> currentHealth = Memory::Read<int>(descriptorFields + currentHealthOffset);
        }
        int GetCurrentHealth()
        {
            return this -> currentHealth;
        }
        void SetMaxHealth()
        {
            this -> maxHealth = Memory::Read<int>(descriptorFields + maxHealthOffset);
        }
        int GetMaxHealth()
        {
            return this -> maxHealth;
        }
        void SetCurrentMana()
        {
            this -> currentMana = Memory::Read<int>(descriptorFields + currentManaOffset);
        }
        int GetCurrentMana()
        {
            return this -> currentMana;
        }
        void SetMaxMana()
        {
            this -> maxMana = Memory::Read<int>(descriptorFields + maxManaOffset);
        }
        int GetMaxMana()
        {
            return this -> maxMana;
        }
        void SetHealthPercent()
        {
            double percentage = static_cast<double>(currentHealth) / static_cast<double>(maxHealth);
            percentage = percentage * 100;
            this -> healthPercent = static_cast<int>(floor(percentage));
        }
        int GetHealthPercent()
        {
            return this -> healthPercent;
        }
        virtual void SetName()
        {
    
        }
    
    
        //Other Public Identifiers:
        INT64 targetGuid;
        int level;
        int maxHealth;
        int currentHealth;
        int healthPercent;
        int currentMana;
        int maxMana;
        float pitch;
        string name;
    
    
    protected:
        const static DWORD levelOffset = 0x35 * 4;
        const static DWORD currentHealthOffset = 0x17 * 4;
        const static DWORD maxHealthOffset = 0x1F * 4;
        const static DWORD currentManaOffset = 0x18 * 4;
        const static DWORD maxManaOffset = 0x20 * 4;
        const static DWORD targetGuidOffset = 0x12 * 4;
    
    };
    
    
    
    
    class oPlayer : public Creature
    {
    public:
        oPlayer(DWORD baseAddress) : Creature(baseAddress)
        {
            RefreshFields();
        }
        void RefreshFields()
        {
            SetCurrentRage();
            SetCurrentEnergy();
            SetMaxEnergy();
        }
        void SetCurrentRage()
        {
            int rageTemp = Memory::Read<int>(descriptorFields + currentRageOffset);
            this -> currentRage = static_cast<int>(floor(static_cast<double>(rageTemp) / 10));
        }
        int GetCurrentRage()
        {
            return this -> currentRage;
        }
        int GetMaxRage()
        {
            return 100;
        }
        void SetCurrentEnergy()
        {
            this -> currentEnergy = Memory::Read<int>(descriptorFields + currentEnergyOffset);
        }
        int GetCurrentEnergy()
        {
            return this -> currentEnergy;
        }
        void SetMaxEnergy()
        {
            this -> maxEnergy = Memory::Read<int>(descriptorFields + maxEnergyOffset);
        }
        int GetMaxEnergy()
        {
            return this -> maxEnergy;
        }
        void SetName()
        {
    
        }
    
    
        //Other Public Identifiers
        int maxEnergy;
        int currentEnergy;
        int maxRage;
        int currentRage;
    
    
    protected:
        const static DWORD currentRageOffset = 0x19 * 4;
        const static DWORD currentEnergyOffset = 0x1B * 4;
        const static DWORD maxEnergyOffset = 0x23 * 4;
    
    };
    
    
    class oNpc : public Creature
    {
    public:
        oNpc(DWORD baseAddress) : Creature(baseAddress)
        {
            RefreshFields();
        }
        void RefreshFields()
        {
            SetName();
            SetAttackingGuid();
            SetSummonedBy();
        }
        void SetName()
        {
           
        }
        string GetName()
        {
         
        }
        void SetAttackingGuid()
        {
            this -> attackingGuid = Memory::Read<INT64>(baseAddress + attackingGuidOffset);
        }
        INT64 GetAttackingGuid()
        {
            return this -> attackingGuid;
        }
        void SetSummonedBy()
        {
            this -> summonedBy = Memory::Read<INT64>(descriptorFields + summonedByOffset);
        }
        INT64 GetSummonedBy()
        {
            return this -> summonedBy;
        }
        /*int GetAggroRadius(CreatureObject LocalPlayer)
        {
            // if they are the same level as us, the aggro radius is roughly 20 yards
            int AggroRadius = 20;
            // aggro radius varies with level difference at a rate of roughly 1 yard/level
            if (LocalPlayer.Level > Level)
                AggroRadius -= (int)BotControl.DifferenceBetween(LocalPlayer.Level, Level);
            if (LocalPlayer.Level < Level)
                AggroRadius += (int)BotControl.DifferenceBetween(LocalPlayer.Level, Level);
            if (AggroRadius < 5)
                AggroRadius = 5;
            AggroRadius += 3; // give us a bit of leeway
            return AggroRadius;
        }*/
    
        //Other Public Identifiers
        INT64 summonedBy;
        INT64 attackingGuid;
      
    
    protected:
        const static INT64 summonedByOffset = 0xE * 4;
        const static INT64 attackingGuidOffset = 0x0A38;
    
    };
    
    
    class oGame : public WowObject
    {
    public:
        oGame(DWORD baseAddress) : WowObject(baseAddress)
        {
        }
        void SetName()
        {
        
        }
        string GetName()
        {
           
        }
        void SetXPosition()
        {
            this -> xPosition = Memory::Read<float>(descriptorFields + gameObject_XPositionOffset);
        }
        void SetYPosition()
        {
            this -> yPosition = Memory::Read<float>(descriptorFields + gameObject_YPositionOffset);
        }
        void SetZPosition()
        {
            this -> zPosition = Memory::Read<float>(descriptorFields + gameObject_ZPositionOffset);
        }
        void SetDisplayId()
        {
            this -> displayId = Memory::Read<int>(descriptorFields + displayIdOffset);
        }
        int GetDisplayId()
        {
            return this -> displayId;
        }
    
        string name;
    
    protected:
        const static DWORD gameObject_XPositionOffset = 0x10 * 4;
        const static DWORD gameObject_YPositionOffset = 0x11 * 4;
        const static DWORD gameObject_ZPositionOffset = 0x12 * 4;
        const static DWORD displayIdOffset = 0x8 * 4;
    
    private:
        int displayId;
    };
    
    
    class oDynamic : public WowObject
    {
    public:
        oDynamic(DWORD baseAddress) : WowObject(baseAddress)
        {
        }
        void SetXPosition()
        {
            this -> xPosition = Memory::Read<float>(descriptorFields + dynamicObject_XPositionOffset);
        }
        void SetYPosition()
        {
            this -> yPosition = Memory::Read<float>(descriptorFields + dynamicObject_YPositionOffset);
        }
        void SetZPosition()
        {
            this -> zPosition = Memory::Read<float>(descriptorFields + dynamicObject_ZPositionOffset);
        }
    protected:
        const static DWORD dynamicObject_XPositionOffset = 0xB * 4;
        const static DWORD dynamicObject_YPositionOffset = 0xC * 4;
        const static DWORD dynamicObject_ZPositionOffset = 0xD * 4;
    };
    It's messy, I wanted to keep members private but ended up getting extremely sloppy and throwing them into the public. Easy fixed Copy/Pasta in any case.


    Below:
    I included these functions in the object manager calling them immediately after populating the lists. This makes a very basic object dumper (Without names).

    Code:
    void PrintoNpcToScreen(list<oNpc> oNpcList)
    {
        list<oNpc>::iterator i;
    
        for (i = oNpcList.begin(); i != oNpcList.end(); i++)
        {
            cout << "Name: " << (*i).name;
            cout << "  Type: " << (*i).type << "\n";
            cout << "x: " << (*i).xPosition << " y: " << (*i).yPosition << " z: " << (*i).zPosition << "\n";
            cout << endl;
        }
    }
    
    void PrintoGameToScreen(list<oGame> oGameList)
    {
        list<oGame>::iterator i;
    
        for (i = oGameList.begin(); i != oGameList.end(); i++)
        {
            cout << "Name: " << (*i).name;
            cout << "  Type: " << (*i).type << "\n";
            cout << "x: " << (*i).xPosition << " y: " << (*i).yPosition << " z: " << (*i).zPosition << "\n";
            cout << endl;
        }
    }
    
    void PrintoPlayerToScreen(list<oPlayer> oPlayerList)
    {
        list<oPlayer>::iterator i;
    
        for (i = oPlayerList.begin(); i != oPlayerList.end(); i++)
        {
            cout << "Name: " << (*i).name;
            cout << "  Type: " << (*i).type << "\n";
            cout << "x: " << (*i).xPosition << " y: " << (*i).yPosition << " z: " << (*i).zPosition << "\n";
            cout << endl;
        }
    }
    i know this is sloppy code and all criticism is welcome. I hope this can still be of use to somebody.

    Again. All credit goes to the OP.
    Last edited by opulent; 05-09-2009 at 12:43 PM.

  3. #33
    YetiHunter's Avatar Member
    Reputation
    6
    Join Date
    Aug 2006
    Posts
    57
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks. i wanted to port this to c++ ... this gives a nice base

  4. #34
    dekz's Avatar Member
    Reputation
    5
    Join Date
    Jan 2008
    Posts
    37
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    good guide man, a lot of effort put into this. +Rep

  5. #35
    Azzie2k8's Avatar Member
    Reputation
    11
    Join Date
    Apr 2009
    Posts
    190
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does this really work for you opulent ?
    My visual studio is throwing errors at me because of it.
    it seems that it does not recognize the constructor ... or something...

    Code:
        list<oNpc> oNpcList;
        list<oGame> oGameList;
        list<oPlayer> oPlayerList;

  6. #36
    asmodei's Avatar Member
    Reputation
    1
    Join Date
    Apr 2009
    Posts
    19
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Azzie2k8 View Post
    Does this really work for you opulent ?
    My visual studio is throwing errors at me because of it.
    it seems that it does not recognize the constructor ... or something...

    Code:
        list<oNpc> oNpcList;
        list<oGame> oGameList;
        list<oPlayer> oPlayerList;
    Should be List with a capital "L", and you'll need a using statement for System.Collections.Generic. What exactly is the error you get?

  7. #37
    Azzie2k8's Avatar Member
    Reputation
    11
    Join Date
    Apr 2009
    Posts
    190
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by asmodei View Post
    Should be List with a capital "L", and you'll need a using statement for System.Collections.Generic. What exactly is the error you get?
    memory.h(522) : error C2143: syntax error : missing ';' before '<'
    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    error C2238: unexpected token(s) preceding ';'
    just edited the capital L.

    does not work yet. I guess it doesn't accept the classes as type ?

  8. #38
    asmodei's Avatar Member
    Reputation
    1
    Join Date
    Apr 2009
    Posts
    19
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Azzie2k8 View Post
    just edited the capital L.

    does not work yet. I guess it doesn't accept the classes as type ?
    Wow, my mistake, I only took a glance and thought you were writing C#.

  9. #39
    Azzie2k8's Avatar Member
    Reputation
    11
    Join Date
    Apr 2009
    Posts
    190
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by asmodei View Post
    Wow, my mistake, I only took a glance and thought you were writing C#.
    nope its cpp.

    anyone ?

  10. #40
    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)
    Code:
    #include <list>
    typedef std::list<fnameStruct> LISTSTRUCT;
    LISTSTRUCT listStruct;
    LISTSTRUCT::iterator i;
    I guess, you don't use the standard namespace.

  11. #41
    Azzie2k8's Avatar Member
    Reputation
    11
    Join Date
    Apr 2009
    Posts
    190
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by schlumpf View Post
    Code:
    #include <list>
    typedef std::list<fnameStruct> LISTSTRUCT;
    LISTSTRUCT listStruct;
    LISTSTRUCT::iterator i;
    I guess, you don't use the standard namespace.
    Code:
    using namespace std;
    this is right after my includes...if you meant that

  12. #42
    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)
    Hm .

  13. #43
    Azzie2k8's Avatar Member
    Reputation
    11
    Join Date
    Apr 2009
    Posts
    190
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by schlumpf View Post
    Hm .
    okay I think I found the problem I have to overwrite the list class so it accepts my objects ...

    stupid me. Sorry I didn't get your point

    I just used std::list<type> this time. +rep for you my country neighbour ^^
    Last edited by Azzie2k8; 05-12-2009 at 03:46 PM.

  14. #44
    deCutter's Avatar Member
    Reputation
    5
    Join Date
    Apr 2009
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Really helpful guide, thanks.
    But still i cant understand, what is this one for?
    Code:
            public float Pitch
            {
                get { return ObjectManager.WowReader.ReadFloat((IntPtr)(ObjectManager.WowReader.ReadUInt32((IntPtr)(baseAddress + 0x110)) + 0x20)); }
            }

  15. #45
    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 deCutter View Post
    Really helpful guide, thanks.
    But still i cant understand, what is this one for?
    Code:
            public float Pitch
            {
                get { return ObjectManager.WowReader.ReadFloat((IntPtr)(ObjectManager.WowReader.ReadUInt32((IntPtr)(baseAddress + 0x110)) + 0x20)); }
            }
    I believe baseAddress + 0x110 used to point to movement related structure. One of that structures members was the pitch of the player at 0x20

    If you don't know what pitch is... go google a picture
    "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

Page 3 of 6 FirstFirst 123456 LastLast

Similar Threads

  1. [Guide] How I handle log files!
    By Viano in forum Programming
    Replies: 0
    Last Post: 01-09-2010, 03:36 PM
  2. [Guide]How to build Objects in your server [EASY FAST STEPS]
    By matafakas in forum WoW EMU Guides & Tutorials
    Replies: 26
    Last Post: 03-07-2009, 01:48 PM
  3. [Guide] How to handle beggers
    By manowarlock in forum World of Warcraft Guides
    Replies: 23
    Last Post: 11-08-2008, 09:55 PM
All times are GMT -5. The time now is 10:31 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search