[HACK] Getting player class and race menu

User Tag List

Results 1 to 10 of 10
  1. #1
    fvicaria's Avatar Active Member
    Reputation
    29
    Join Date
    Jan 2009
    Posts
    55
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [HACK] Getting player class and race

    Hi guys,
    I have been trying to get this to work but I keep getting the same value no matter which class or race I have logged.

    Code:
                    
    
            public string PlayerClass
            {        
                get
                {
                    var uclass = _blackMagic.ReadByte(_blackMagic.ReadUInt(_playerPtr + _offsets.Player.DescriptorOffset) + _offsets.UnitFields.UnitFieldsBytes0);
                    return Enum.GetName(typeof (WoWClass), uclass);
                }
            }
    Hopefully the intention of the code is clear but feel free to ask if you don't understand something.


    Cheers!

    [HACK] Getting player class and race
  2. #2
    Xelper's Avatar ★ Elder ★
    Reputation
    1024
    Join Date
    Mar 2007
    Posts
    860
    Thanks G/R
    0/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Might help if you post the offsets you are using. It also doesn't look like you are adding the BaseAddress of WoW. I just use the offset for the player's class and name because I have no use in my app for a full blown object manager... but this might help lead you in the right direction:

    public static uint PlayerClass = 0x9BE835;

    Code:
    
            public static string GetPlayerClass()
            {
                byte[] objLevel = Memory.ReadBytes(BaseAddress() + clsOffsets.PlayerClass,2);
                uint myClass = objLevel[0];
                
                switch (myClass)
                {
                    case 1:
                        return "WARRIOR";
                    case 2:
                        return "PALADIN";
                    case 3:
                        return "HUNTER";
                    case 4:
                        return "ROGUE";
                    case 5:
                        return "PRIEST";
                    case 6:
                        return "DEATHKNIGHT";
                    case 7:
                        return "SHAMAN";
                    case 8:
                        return "MAGE";
                    case 9:
                        return "WARLOCK";
                    case 11:
                        return "DRUID";
                    default:
                        return "";
                }
            }
    
            public static uint BaseAddress()
            {
                return (uint)Memory.MainModule.BaseAddress;
            }

  3. #3
    Require's Avatar Sergeant
    Reputation
    2
    Join Date
    Dec 2011
    Posts
    40
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Xelper View Post
    Might help if you post the offsets you are using. It also doesn't look like you are adding the BaseAddress of WoW. I just use the offset for the player's class and name because I have no use in my app for a full blown object manager... but this might help lead you in the right direction:

    public static uint PlayerClass = 0x9BE835;

    Code:
    
            public static string GetPlayerClass()
            {
                byte[] objLevel = Memory.ReadBytes(BaseAddress() + clsOffsets.PlayerClass,2);
                uint myClass = objLevel[0];
                
                switch (myClass)
                {
                    case 1:
                        return "WARRIOR";
                    case 2:
                        return "PALADIN";
                    case 3:
                        return "HUNTER";
                    case 4:
                        return "ROGUE";
                    case 5:
                        return "PRIEST";
                    case 6:
                        return "DEATHKNIGHT";
                    case 7:
                        return "SHAMAN";
                    case 8:
                        return "MAGE";
                    case 9:
                        return "WARLOCK";
                    case 11:
                        return "DRUID";
                    default:
                        return "";
                }
            }
    
            public static uint BaseAddress()
            {
                return (uint)Memory.MainModule.BaseAddress;
            }
    Xelper,

    I recently started out with memory reading and this helped me a lot.. big thanks. Still one question remains though. When should I use a player's base address and when do I need a WoW address?
    +rep for your help

  4. #4
    Xelper's Avatar ★ Elder ★
    Reputation
    1024
    Join Date
    Mar 2007
    Posts
    860
    Thanks G/R
    0/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    An offset is the distance from WoW's base address that X is located.

    When you do a memory read it starts at "0" and adds the offsets you specified. So just as an example, lets say that WoW's address space starts at "1000.".. you had another application that starts at "500" and goes to "999" Lets call it Notepad. Lets say you have an offset of "700" that represents the players name.

    If you do a ReadString(700, 24) (24 being the length).. you would be reading from Notepad's address space. The information you would want is actually at WoW + 700. So you do ReadString(1000 + 700, 24).

    The PlayerBase you are speaking of is just the "offset" of the player object within the object manager. To read from WoW's memory you always need to know the base address of WoW and the offset of whatever you are looking for. I hope that made sense, good luck.
    Last edited by Xelper; 01-02-2012 at 05:07 PM.

  5. #5
    fvicaria's Avatar Active Member
    Reputation
    29
    Join Date
    Jan 2009
    Posts
    55
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Xelper View Post
    Might help if you post the offsets you are using. It also doesn't look like you are adding the BaseAddress of WoW. I just use the offset for the player's class and name because I have no use in my app for a full blown object manager... but this might help lead you in the right direction:

    public static uint PlayerClass = 0x9BE835;

    Code:
    
            public static string GetPlayerClass()
            {
                byte[] objLevel = Memory.ReadBytes(BaseAddress() + clsOffsets.PlayerClass,2);
                uint myClass = objLevel[0];
                
                switch (myClass)
                {
                    case 1:
                        return "WARRIOR";
                    case 2:
                        return "PALADIN";
                    case 3:
                        return "HUNTER";
                    case 4:
                        return "ROGUE";
                    case 5:
                        return "PRIEST";
                    case 6:
                        return "DEATHKNIGHT";
                    case 7:
                        return "SHAMAN";
                    case 8:
                        return "MAGE";
                    case 9:
                        return "WARLOCK";
                    case 11:
                        return "DRUID";
                    default:
                        return "";
                }
            }
    
            public static uint BaseAddress()
            {
                return (uint)Memory.MainModule.BaseAddress;
            }


    Hi Xelper,

    Great stuff!

    It's one of those things that when you hit your eyes on something different that you know it works you immediately know what's wrong with yours.

    I don't like using statics very much so I try to avoid them as much as possible (reduces my work after updates :P)

    Here is my fixed version:

    Code:
    var classAndRace = _blackMagic.ReadBytes(_blackMagic.ReadUInt(_playerPtr + _offsets.Player.DescriptorOffset) + _offsets.UnitFields.UnitFieldsBytes0,2);

    With this I get both in one goal.

    Thanks for the help
    If you ever need anything feel free to pm me.

    +rep

  6. #6
    Require's Avatar Sergeant
    Reputation
    2
    Join Date
    Dec 2011
    Posts
    40
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Xelper View Post
    An offset is the distance from WoW's base address that X is located.

    When you do a memory read it starts at "0" and adds the offsets you specified. So just as an example, lets say that WoW's address space starts at "1000.".. you had another application that starts at "500" and goes to "999" Lets call it Notepad. Lets say you have an offset of "700" that represents the players name.

    If you do a ReadString(700, 24) (24 being the length).. you would be reading from Notepad's address space. The information you would want is actually at WoW + 700. So you do ReadString(1000 + 700, 24).

    The PlayerBase you are speaking of is just the "offset" of the player object within the object manager. To read from WoW's memory you always need to know the base address of WoW and the offset of whatever you are looking for. I hope that made sense, good luck.
    Xelper,

    This actually made a lot of sense. Finally know the basics now and the reason why offsets are used. But how are you able to determine the length? in your case 24.
    Thanks for your great help!
    Last edited by Require; 01-03-2012 at 04:51 AM.

  7. #7
    miceiken's Avatar Contributor Authenticator enabled
    Reputation
    208
    Join Date
    Dec 2007
    Posts
    401
    Thanks G/R
    7/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Length isn't really something to worry about, just read until you get \0 and it will be the end of the string. Usually people just enter some random number that they think will cover all scenarios.

  8. #8
    Xelper's Avatar ★ Elder ★
    Reputation
    1024
    Join Date
    Mar 2007
    Posts
    860
    Thanks G/R
    0/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
            public static string GetPlayerName()
            {
                return ReadUTF8String(BaseAddress() + clsOffsets.PlayerName, 30);
            }
    
    
            public static string ReadUTF8String(uint dwAddress, int Size)
            {
                byte[] buffer = Memory.ReadBytes(dwAddress, Size);
                if (buffer == null)
                {
                    return string.Empty;
                }
                return StringFromBytes(buffer);
            }
    
    
            public static string StringFromBytes(byte[] myBuffer)
            {
                System.Text.Encoding encoding = System.Text.Encoding.UTF8;
                string myString = encoding.GetString(myBuffer, 0, myBuffer.Length);
    
    
                if (myString.IndexOf("\0") != -1)
                {
                    myString = myString.Remove(myString.IndexOf("\0"), myString.Length - myString.IndexOf("\0"));
                }
                return myString;
            }

  9. #9
    xyzhacker's Avatar Sergeant
    Reputation
    1
    Join Date
    Feb 2011
    Posts
    63
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, could use this for bot developing.

  10. #10
    gononono64's Avatar Contributor
    Reputation
    100
    Join Date
    Jul 2009
    Posts
    85
    Thanks G/R
    1/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dont forget there are many threads that will help u understand how wow memory reading really works. Like this one for example:
    http://www.ownedcore.com/forums/worl...ete-newbs.html ([Guide] How to make a Wow bot for complete newbs!)
    Hi! My name is Devon and I’m an alcoholic. Moving on…
    https://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-bots-programs/wow-memory-editing/319172-guide-how-make-wow-bot-complete-newbs.html

Similar Threads

  1. Best Class and race for PvP?
    By Emuchild in forum WoW PvP & Battlegrounds
    Replies: 147
    Last Post: 02-15-2011, 09:02 AM
  2. The Ultimate Class and Race
    By dheuigerg in forum World of Warcraft General
    Replies: 4
    Last Post: 05-24-2008, 12:41 PM
  3. [How to] Choosing your class and Race!
    By galathius in forum World of Warcraft Guides
    Replies: 17
    Last Post: 10-30-2007, 11:59 AM
  4. Which class and race?
    By kangaxx4 in forum World of Warcraft General
    Replies: 15
    Last Post: 10-02-2007, 05:42 AM
  5. Favourite Class and Race
    By Simy in forum World of Warcraft General
    Replies: 13
    Last Post: 07-12-2006, 08:55 PM
All times are GMT -5. The time now is 07:58 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