Read NPCObject Name. menu

Shout-Out

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    fusspawn's Avatar Member
    Reputation
    5
    Join Date
    May 2008
    Posts
    54
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Read NPCObject Name.

    Hi There,

    Im trying to work on my bot framework, things are going awesome, untill i try and query the name of an NPCObject.

    for the most part my method returns a empty string "";

    but on a rare occasion it returns what i can only assume is some kind of texture name.

    What im after is the Screen name of the mob. ie "Kobold worker" or "Infected Wolf" rather than "InfectedWolfSkin2" or some other unrelated name.

    my method.

    Code:
            uint UnitNameoffset1 = 0x968;
            uint UnitNameoffset2 = 0x5c;
            public string Name
            {
                get
                {
                    try
                    {
                        uint a = MemoryUtils.Reader.ReadUInt(BaseAddress + UnitNameoffset1);
                        uint b = MemoryUtils.Reader.ReadUInt(a + UnitNameoffset2);
                        return MemoryUtils.ReadUTF8String(b, 0x60); // dont think anything is larger than 60 chars?
                    }
                    catch (Exception E)
                    {
                        return "UNKNOWN";
                    }
                }
            }
    ReadUTF8String

    Code:
            public static string ReadUTF8String(uint Address, int Length)
            {
    
                byte[] buffer = Reader.ReadBytes(Address, Length);
    
                string ret = Encoding.UTF8.GetString(buffer);
    
                if (ret.IndexOf('\0') != -1)
                {
                    ret = ret.Remove(ret.IndexOf('\0'));
                }
    
                return ret;
            }
    is this how i would go about doing this or am i just going mad?

    Read NPCObject Name.
  2. #2
    fusspawn's Avatar Member
    Reputation
    5
    Join Date
    May 2008
    Posts
    54
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Would like to note, Never has this returned the NPC name? and i think those are the latest offsets. (at least it never fails a read call and returns "Unknown")

  3. #3
    JuJuBoSc's Avatar Banned for scamming CoreCoins Purchaser
    Reputation
    1019
    Join Date
    May 2007
    Posts
    922
    Thanks G/R
    1/3
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Almost correct ^^

    Code:
                UnitName1 = 0x964,                  // 3.3.2
                UnitName2 = 0x5C,                   // 3.3.2

  4. #4
    fusspawn's Avatar Member
    Reputation
    5
    Join Date
    May 2008
    Posts
    54
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lame. Oh well not at home to test this but ill chuck ya rep if i can

  5. #5
    EmilyStrange's Avatar Active Member
    Reputation
    34
    Join Date
    Jul 2009
    Posts
    125
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code that I use to read a unit's name:

    Code:
    public sealed class UnitOffset
    {
        public const uint Name = 0x005C;
        public const uint X = 0x0798;
        public const uint Y = 0x079C;
        public const uint Z = 0x07A0;
        public const uint Rotation = 0x07A8;
        public const uint StringTable = 0x0964;
        public const uint CastingSpellID = 0x0A60;
        public const uint ChannelingSpellID = 0x0A80;
    }
    
    public string GetName()
    {
        uint unitStringTablePtr = m_gameClient.MemoryEditor.ReadUInt(m_baseAddress + UnitOffset.StringTable);
        uint unitNamePtr = m_gameClient.MemoryEditor.ReadUInt(unitStringTablePtr + UnitOffset.Name);
        return m_gameClient.MemoryEditor.ReadASCIIString(unitNamePtr, WarcraftGameClient.MAX_STRING_LENGTH);
    }

  6. #6
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by EmilyStrange View Post
    Code that I use to read a unit's name:

    Code:
    public sealed class UnitOffset
    {
        public const uint Name = 0x005C;
        public const uint X = 0x0798;
        public const uint Y = 0x079C;
        public const uint Z = 0x07A0;
        public const uint Rotation = 0x07A8;
        public const uint StringTable = 0x0964;
        public const uint CastingSpellID = 0x0A60;
        public const uint ChannelingSpellID = 0x0A80;
    }
    
    public string GetName()
    {
        uint unitStringTablePtr = m_gameClient.MemoryEditor.ReadUInt(m_baseAddress + UnitOffset.StringTable);
        uint unitNamePtr = m_gameClient.MemoryEditor.ReadUInt(unitStringTablePtr + UnitOffset.Name);
        return m_gameClient.MemoryEditor.ReadASCIIString(unitNamePtr, WarcraftGameClient.MAX_STRING_LENGTH);
    }
    This "StringTable", as you call it, is in fact just the cached information about the creature. It's the same as you get when you call DbCreatureCache_GetInfoBlockById.

    Code:
    struct CreatureCacheEntry
    {
      byte Unk[4];
      char *SubName;
      char *IconName;
      DWORD TypeFlags;
      DWORD TypeID;
      DWORD FamilyID;
      DWORD Rank;
      DWORD GroupID;
      DWORD GroupID2;
      DWORD SpellDataID;
      DWORD ModelID1;
      DWORD ModelID2;
      DWORD ModelID3;
      float TexOriginX;
      float TexOriginY;
      byte RacialLeader;
      DWORD QuestItems[6];
      DWORD MovementID;
      char *Names[4];
    };
    Credits to Apoc for showing me the cache-unpack functions.
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  7. #7
    fusspawn's Avatar Member
    Reputation
    5
    Join Date
    May 2008
    Posts
    54
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by MaiN View Post
    This "StringTable", as you call it, is in fact just the cached information about the creature. It's the same as you get when you call DbCreatureCache_GetInfoBlockById.

    Code:
    struct CreatureCacheEntry
    {
      byte Unk[4];
      char *SubName;
      char *IconName;
      DWORD TypeFlags;
      DWORD TypeID;
      DWORD FamilyID;
      DWORD Rank;
      DWORD GroupID;
      DWORD GroupID2;
      DWORD SpellDataID;
      DWORD ModelID1;
      DWORD ModelID2;
      DWORD ModelID3;
      float TexOriginX;
      float TexOriginY;
      byte RacialLeader;
      DWORD QuestItems[6];
      DWORD MovementID;
      char *Names[4];
    };
    Credits to Apoc for showing me the cache-unpack functions.
    Awesome, I ask one thing, and learn another, Thanks MaiN.

  8. #8
    EmilyStrange's Avatar Active Member
    Reputation
    34
    Join Date
    Jul 2009
    Posts
    125
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by MaiN View Post
    This "StringTable", as you call it, is in fact just the cached information about the creature. It's the same as you get when you call DbCreatureCache_GetInfoBlockById.
    Thanks for that info. Not sure why I originally called the entry "StringTable" because as you rightly point out, it is obviously not. Time to refactor that constant name.

  9. #9
    ruzzichella's Avatar Private
    Reputation
    1
    Join Date
    Feb 2010
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how can i find the base address of an npc?

  10. #10
    SinnerG's Avatar Member
    Reputation
    6
    Join Date
    Aug 2006
    Posts
    78
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Btw, use Resharper (not free though) to refactor stuff fast

  11. #11
    Danne206's Avatar Contributor
    Reputation
    183
    Join Date
    Jan 2008
    Posts
    717
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by ruzzichella View Post
    how can i find the base address of an npc?
    Search.
    http://www.mmowned.com/forums/wow-me...e-objects.html
    Might have something you'd like.
    Dahnniel [DOT] s [AT] gmail [DOT] com

  12. #12
    XTZGZoReX's Avatar Active Member
    Reputation
    32
    Join Date
    Apr 2008
    Posts
    173
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @MaiN:

    Code:
    struct CreatureCache
    {
      int Id;
      char *SubName;
      char *IconName;
      int TypeFlags;
      int Type;
      int Family;
      int Rank;
      int KillCredit1;
      int KillCredit2;
      int DisplayId1;
      int DisplayId2;
      int DisplayId3;
      int DisplayId4;
      float HpModifier;
      float MpModifier;
      char RacialLeader[4];
      int QuestItem[6];
      int MovementId;
      char Name[4][1024];
      char SubName[1024];
      char IconName[1024];
    };
    That's the structure last I checked. I think yours is pre-3.1.x?

    Anyway, just re-checked again, seems to comply with 3.3.2.

  13. #13
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by XTZGZoReX View Post
    @MaiN:

    Code:
    struct CreatureCache
    {
      int Id;
      char *SubName;
      char *IconName;
      int TypeFlags;
      int Type;
      int Family;
      int Rank;
      int KillCredit1;
      int KillCredit2;
      int DisplayId1;
      int DisplayId2;
      int DisplayId3;
      int DisplayId4;
      float HpModifier;
      float MpModifier;
      char RacialLeader[4];
      int QuestItem[6];
      int MovementId;
      char Name[4][1024];
      char SubName[1024];
      char IconName[1024];
    };
    That's the structure last I checked. I think yours is pre-3.1.x?

    Anyway, just re-checked again, seems to comply with 3.3.2.
    Code:
    void __thiscall DbCreatureCache_Unpack(CreatureCacheEntry *this, CDataStore *data)
    {
      char **currentName; // ebx@1
      CreatureCacheEntry *_this; // edi@1
      CDataStore *_data; // esi@1
      void *subName; // eax@8
      void *v7; // eax@10
      DWORD *v8; // ebx@12
      char stringBuffer[1024]; // [sp+Ch] [bp-404h]@4
      int v11; // [sp+40Ch] [bp-4h]@1
    
      _data = data;
      _this = this;
      currentName = this->Names;
      v11 = 4;
      do
      {
        if ( *currentName )
          SMemFree(*currentName, (int)".\\CreatureStats.cpp", 47, 0);
        CDataStore__GetString(_data, stringBuffer, 0x400u);
        if ( stringBuffer[0] )
          *currentName = AllocateString(stringBuffer, ".\\CreatureStats.cpp", 50);
        else
          *currentName = 0;
        ++currentName;
      }
      while ( v11-- != 1 );
      subName = _this->SubName;
      if ( subName )
        SMemFree(subName, (int)".\\CreatureStats.cpp", 54, 0);
      CDataStore__GetString(_data, stringBuffer, 0x400u);
      _this->SubName = AllocateString(stringBuffer, ".\\CreatureStats.cpp", 56);
      v7 = _this->IconName;
      if ( v7 )
        SMemFree(v7, (int)".\\CreatureStats.cpp", 57, 0);
      CDataStore__GetString(_data, stringBuffer, 0x400u);
      _this->IconName = AllocateString(stringBuffer, ".\\CreatureStats.cpp", 59);
      CDataStore__GetDWORD(_data, &_this->TypeFlags);
      CDataStore__GetDWORD(_data, &_this->TypeID);
      CDataStore__GetDWORD(_data, &_this->FamilyID);
      CDataStore__GetDWORD(_data, &_this->Rank);
      CDataStore__GetDWORD(_data, &_this->GroupID);
      CDataStore__GetDWORD(_data, &_this->GroupID2);
      CDataStore__GetDWORD(_data, &_this->SpellDataID);
      CDataStore__GetDWORD(_data, &_this->ModelID1);
      CDataStore__GetDWORD(_data, &_this->ModelID2);
      CDataStore__GetDWORD(_data, &_this->ModelID3);
      CDataStore_GetFloat(_data, &_this->TexOriginX);
      CDataStore_GetFloat(_data, &_this->TexOriginY);
      CDataStore__GetChar(_data, (unsigned __int8 *)&data->vtable + 3);
      v8 = _this->QuestItems;
      _this->RacialLeader = BYTE3(data->vtable) != 0;
      v11 = 6;
      do
      {
        CDataStore__GetDWORD(_data, v8);
        ++v8;
      }
      while ( v11-- != 1 );
      CDataStore__GetDWORD(_data, &_this->MovementID);
    }
    So no, yours is wrong. It hasn't changed.

    EDIT: To clarify, you're right about the health/mana modifiers.
    Last edited by MaiN; 03-12-2010 at 06:24 PM.
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  14. #14
    TOM_RUS's Avatar Legendary
    Reputation
    914
    Join Date
    May 2008
    Posts
    699
    Thanks G/R
    0/52
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by MaiN View Post
    So no, yours is wrong. It hasn't changed.

    EDIT: To clarify, you're right about the health/mana modifiers.
    You are wrong.

    Code:
    CDataStore *__thiscall DbCreatureCache_Unpack(CreatureCache *this, CDataStore *cds)
    {
      void **_name; // ebx@1
      CreatureCache *_this; // edi@1
      CDataStore *_cds; // esi@1
      void *v6; // eax@8
      void *v7; // eax@10
      int questItems; // ebx@12
      char string[1024]; // [sp+Ch] [bp-404h]@4
      int counter; // [sp+40Ch] [bp-4h]@1
    
      _cds = cds;
      _this = this;
      _name = this->Name;
      counter = 4;
      do
      {
          if ( *_name )
              SMemFree(*_name, ".\\CreatureStats.cpp", 47, 0);
          CDataStore__GetString(_cds, string, 0x400u);
          if ( string[0] )
              *_name = AllocString(string, ".\\CreatureStats.cpp", 0x32u);
          else
              *_name = 0;
          ++_name;
      }
      while ( counter-- != 1 );
      v6 = _this->SubNamePtr;
      if ( v6 )
          SMemFree(v6, ".\\CreatureStats.cpp", 54, 0);
      CDataStore__GetString(_cds, string, 0x400u);
      _this->SubNamePtr = AllocString(string, ".\\CreatureStats.cpp", 0x38u);
      v7 = _this->IconNamePtr;
      if ( v7 )
          SMemFree(v7, ".\\CreatureStats.cpp", 57, 0);
      CDataStore__GetString(_cds, string, 0x400u);
      _this->IconNamePtr = AllocString(string, ".\\CreatureStats.cpp", 0x3Bu);
      CDataStore__GetInt32(_cds, &_this->TypeFlags);
      CDataStore__GetInt32(_cds, &_this->Type);
      CDataStore__GetInt32(_cds, &_this->Family);
      CDataStore__GetInt32(_cds, &_this->Rank);
      CDataStore__GetInt32(_cds, &_this->KillCredit1);
      CDataStore__GetInt32(_cds, &_this->KillCredit2);
      CDataStore__GetInt32(_cds, &_this->DisplayId1);
      CDataStore__GetInt32(_cds, &_this->DisplayId2);
      CDataStore__GetInt32(_cds, &_this->DisplayId3);
      CDataStore__GetInt32(_cds, &_this->DisplayId4);
      CDataStore__GetFloat(_cds, &_this->HpModifier);
      CDataStore__GetFloat(_cds, &_this->MpModifier);
      CDataStore__GetInt8(_cds, (&cds->vTable + 3));
      questItems = _this->QuestItem;
      _this->RacialLeader[0] = BYTE3(cds->vTable) != 0;
      counter = 6;
      do
      {
          CDataStore__GetInt32(_cds, questItems);
          questItems += 4;
      }
      while ( counter-- != 1 );
      return CDataStore__GetInt32(_cds, &_this->MovementId);
    }

  15. #15
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by TOM_RUS View Post
    You are wrong.

    Code:
    CDataStore *__thiscall DbCreatureCache_Unpack(CreatureCache *this, CDataStore *cds)
    {
      void **_name; // ebx@1
      CreatureCache *_this; // edi@1
      CDataStore *_cds; // esi@1
      void *v6; // eax@8
      void *v7; // eax@10
      int questItems; // ebx@12
      char string[1024]; // [sp+Ch] [bp-404h]@4
      int counter; // [sp+40Ch] [bp-4h]@1
    
      _cds = cds;
      _this = this;
      _name = this->Name;
      counter = 4;
      do
      {
          if ( *_name )
              SMemFree(*_name, ".\\CreatureStats.cpp", 47, 0);
          CDataStore__GetString(_cds, string, 0x400u);
          if ( string[0] )
              *_name = AllocString(string, ".\\CreatureStats.cpp", 0x32u);
          else
              *_name = 0;
          ++_name;
      }
      while ( counter-- != 1 );
      v6 = _this->SubNamePtr;
      if ( v6 )
          SMemFree(v6, ".\\CreatureStats.cpp", 54, 0);
      CDataStore__GetString(_cds, string, 0x400u);
      _this->SubNamePtr = AllocString(string, ".\\CreatureStats.cpp", 0x38u);
      v7 = _this->IconNamePtr;
      if ( v7 )
          SMemFree(v7, ".\\CreatureStats.cpp", 57, 0);
      CDataStore__GetString(_cds, string, 0x400u);
      _this->IconNamePtr = AllocString(string, ".\\CreatureStats.cpp", 0x3Bu);
      CDataStore__GetInt32(_cds, &_this->TypeFlags);
      CDataStore__GetInt32(_cds, &_this->Type);
      CDataStore__GetInt32(_cds, &_this->Family);
      CDataStore__GetInt32(_cds, &_this->Rank);
      CDataStore__GetInt32(_cds, &_this->KillCredit1);
      CDataStore__GetInt32(_cds, &_this->KillCredit2);
      CDataStore__GetInt32(_cds, &_this->DisplayId1);
      CDataStore__GetInt32(_cds, &_this->DisplayId2);
      CDataStore__GetInt32(_cds, &_this->DisplayId3);
      CDataStore__GetInt32(_cds, &_this->DisplayId4);
      CDataStore__GetFloat(_cds, &_this->HpModifier);
      CDataStore__GetFloat(_cds, &_this->MpModifier);
      CDataStore__GetInt8(_cds, (&cds->vTable + 3));
      questItems = _this->QuestItem;
      _this->RacialLeader[0] = BYTE3(cds->vTable) != 0;
      counter = 6;
      do
      {
          CDataStore__GetInt32(_cds, questItems);
          questItems += 4;
      }
      while ( counter-- != 1 );
      return CDataStore__GetInt32(_cds, &_this->MovementId);
    }
    What am I wrong about? I don't see anything in your analysis of the function that proves me wrong.
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

Page 1 of 2 12 LastLast

Similar Threads

  1. [Mac][3.2] Finding the object list & reading object names
    By flukes1 in forum WoW Memory Editing
    Replies: 12
    Last Post: 09-22-2009, 09:47 PM
  2. 3.1.1 Reading Unit Names
    By tanis2000 in forum WoW Memory Editing
    Replies: 9
    Last Post: 05-28-2009, 11:12 AM
  3. Reading unit name
    By miceiken in forum WoW Memory Editing
    Replies: 10
    Last Post: 04-08-2009, 10:15 PM
  4. [?] Reading Object Name
    By Smarter in forum WoW Memory Editing
    Replies: 4
    Last Post: 04-03-2009, 08:03 PM
  5. Can you read player names out of process?
    By sweeper18 in forum WoW Memory Editing
    Replies: 10
    Last Post: 07-06-2008, 08:54 PM
All times are GMT -5. The time now is 07:17 AM. 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