[v1.11b] Structure Reference

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

Post Reply
User avatar
Nefarius
Retired Admin
Cherub
Posts: 11607
Joined: Sat Jun 15, 2002 8:13 pm
Location: Where the blood forever rains
Contact:

Hand-picked

[v1.11b] Structure Reference

Post by Nefarius » Thu Oct 18, 2007 4:42 am

This should be seen as a expansion and continue of Hammerman's original undertaking of mapping out this and other structures (which is a C++ class in reality). Note that I'll over the course of the next few weeks post a fair share of my knowledge about the internals here, so if you're interested in this topic look at this post regularly for updates.

You are free to contribute as long as you abide several rules. We do not permit any form of discussion whatsoever about Client/Server communication and packet structures, neither will we allow documentation of map generation related structures here. Failure to comply to these rules will lead to a warning (and eventually banishment).

sgptDataTables (SuperGlobalPointer aka a extern variable, sizeof = likely 0xD10)
Note: gptItemTables and other data table containers are not part of this, they are seperate structures

Code: Select all

struct DataTables
  +000 - pPlayerClassTxt
  +004 - pPlayerClassLink
  +008 - pBodyLocsTxt
  +00C - pBodyLocsLink
  +010 - pStorePageTxt
  +014 - pStorePageLink
  +018 - pElemTypesTxt
  +01C - pElemTypesLink
  +020 - pHitClassTxt
  +024 - pHitClassLink
  +028 - pMonModeTxt
  +02C - pMonModeLink
  +030 - pPlrModeTxt
  +034 - pPlrModeLink
  +038 - pSkillCalcTxt
  +03C - pSkillCalcLink
  +040 - pSkillCalcCache
  +044 - nSkillCalcCache
  +048 - nSkillCalcCacheDelta
  +04C - pSkillDescCalcCache
  +050 - nSkillDescCalcCache
  +054 - nSkillDescCalcCacheDelta
  +058 - pMissCalcTxt
  +05C - pMissCalcLink
  +060 - pMissCalcCache
  +064 - nMissCalcCache
  +068 - nMissCalcCacheDelta
  +06C - pSkillCodesBin - created from the first column of skills.txt
  +070 - pSkillCodesLink
  +074 - pEventsTxt
  +078 - pEventsLink
  +07C - pCompCodesTxt
  +080 - pCompCodesLink
  +084 - nCompCodes
  +088 - pMonAiTxt
  +08C - pMonAiLink
  +090 - nMonAi
  +094 - pItemLink - the actual item text files are linked to gptItemTables
  +098 - pItemCalcCache
  +09C - nItemCalcCache
  +0A0 - nItemCalcCacheDelta
  +0A4 - pPropertiesTxt
  +0A8 - pPropertiesLink
  +0AC - nProperties
  +0B0 - pRunesLink
  +0B4 - pHireDescTxt
  +0B8 - pHireDescLink
  +0BC - pStatesTxt
  +0C0 - pStatesLink
  +0C4 - nStates
  +0C8 - pStateMaskFirst
  +0CC - pStateMaskArray[40]
  +16C - pProgressiveStates[arrSize] - list of states with progressive = true
  +170 - nProgressiveStates
  +174 - pCurseStates[arrSize] - list of states with curse = true
  +178 - nCurseStates
  +17C - pTransformStates[arrSize] - list of states with transform = true
  +180 - nTransformStates
  +184 - pActionStates[arrSize] - states with actions assigned
  +188 - nActionStates
  +18C - pColorStates[arrSize] - states that change color
  +190 - nColorStates
  +194 - pSoundCodesBin - created from the first column of sounds.txt, the rest is only found in D2Client.dll
  +198 - pSoundCodesLink
  +19C - nSoundCodes
  +1A0 - pHirelingsTxt
  +1A4 - nHirelings
  +1A8 - HireNameListStart[256] - first entry of 256 lists of hireling names
  +5A8 - HireNameListEnd[256] - last entry of 256 lists of hireling names
  +9A8 - pNpcsTxt
  +9AC - nNpcs
  +9B0 - pColorsTxt
  +9B4 - pColorsLink
  +9B8 - pTreasureClassExLink
  +9BC - pTreasureClassExTxt
  +9C0 - nTreasureClassEx
  +9C4 - pChestTreasureClassList[45]
  +A78 - pMonStatsTxt
  +A7C - pMonStatsLink
  +A80 - nMonStats
  +A84 - pMonSoundsTxt
  +A88 - pMonSoundsLink
  +A8C - nMonSounds
  +A90 - pMonStats2Txt
  +A94 - pMonStats2Link
  +A98 - nMonStats2
  +A9C - pMonPlaceTxt
  +AA0 - pMonPlaceLink
  +AA4 - nMonPlace
  +AA8 - pMonPresetTxt
  +AAC - pMonPresetActList[5] - first record for each act
  +AC0 - nMonPresetEachAct[5] - count for # of records per act
  +AD4 - pSuperUniquesTxt
  +AD8 - pSuperUniquesLink
  +ADC - nSuperUniques
  +AE0 - SuperUniqueHcIdxList[66] (66 words)
  +B64 - pMissilesTxt
  +B68 - pMissilesLink
  +B6C - nMissiles
  +B70 - pMonLvlTxt
  +B74 - nMonLvl
  +B78 - pMonSeqTxt
  +B7C - pMonSeqLink
  +B80 - nMonSeq
  +B84 - pMonSequences - created from MonSeq.txt after reading it
  +B88 - nMonSequences
  +B8C - pSkillDescTxt
  +B90 - pSkillDescLink
  +B94 - nSkillDesc
  +B98 - pSkillsTxt
  +B9C - pSkillsLink
  +BA0 - nSkills
  +BA4 - pPlayerSkillCount[arrSize] - an array of player skill counts (all words)
  +BA8 - nPlayerSkillCount
  +BAC - pPlayerSkillList[arrSize] - the skill Ids (all words)
  +BB0 - nPassiveSkillCount
  +BB4 - pPassiveSkillList[arrSize] - the skill Ids (all words)
  +BB8 - pOverlayTxt
  +BBC - pOverlayLink
  +BC0 - nOverlay
  +BC4 - pCharStatsTxt
  +BC8 - nCharStats
  +BCC - pItemStatCostTxt
  +BD0 - pItemStatCostLink
  +BD4 - nItemStatCost
  +BD8 - pOpStatNesting[arrSize]
  +BDC - nOpStatNesting
  +BE0 - pMonEquipTxt
  +BE4 - nMonEquip
  +BE8 - pPetTypesTxt
  +BEC - pPetTypesLink
  +BF0 - nPetTypes
  +BF4 - pItemTypesLink
  +BF8 - pItemTypesTxt
  +BFC - nItemTypes
  +C00 - nItemTypeNesting
  +C04 - pItemTypeNesting[arrSize]
  +C08 - pSetsLink
  +C0C - pSetsTxt
  +C10 - nSets
  +C14 - pSetItemsLink
  +C18 - pSetItemsTxt
  +C1C - nSetItems
  +C20 - pUniqueItemsLink
  +C24 - pUniqueItemsTxt
  +C28 - nUniqueItems
  +C2C - pMonPropLink
  +C30 - pMonPropTxt
  +C34 - nMonProp
  +C38 - pMonTypeLink
  +C3C - pMonTypeTxt
  +C40 - nMonType
  +C44 - pMonTypeNesting[arrSize]
  +C48 - nMonTypeNesting
  +C4C - pMonUModLink
  +C50 - pMonUModTxt
  +C54 - nMonUMod
  +C58 - pLevelsTxt
  +C5C - nLevels
  +C60 - pLvlDefsBin
  +C64 - pLvlPrestTxt
  +C68 - nLvlPrest
  +C6C - ItemStatCostStuff[2] - related to opstats, stuff column (etc)
  +C74 - pAnimTables (gptAnimTables)
  +C78 - pExperienceTxt
  +C7C - pDifficultyLevelsTxt
  +C80 - nDifficultyLevels
  +C84 - pExpFieldD2 - collision detection map
  +C88 - ExpFieldRuntimeData[10]
  +CB0 - pLvlSubExtraStuff[arrSize]
  +CB4 - nLvlSubExtraStuff
  +CB8 - pCharTemplateTxt
  +CBC - nCharTemplate
  +CC0 - pArenaTxt
  +CC4 - pLvlTypesTxt
  +CC8 - pWaypoints[arrSize]
  +CCC - nWaypoints
  +CD0 - nLvlTypes
  +CD4 - pLvlWarpTxt
  +CD8 - nLvlWarp
  +CDC - pLvlMazeTxt
  +CE0 - nLvlMaze
  +CE4 - pLvlSubTxt
  +CE8 - nLvlSub
  +CEC - pLvlSubCache[arrSize]
  +CF0 - three unused dwords here
  +CFC - pMapCache[arrSize]
  +D00 - nMapCache
  +D04 - pCubeMainTxt
  +D08 - nCubeMain
  +D0C - bWriteBinFiles (BOOL)

pGame (sizeof = 0x1DF4)

Code: Select all

class Game
  +0018 - pCriticalSection (see MSDN please)
  +001C - pMemPool - not used, always NULL
  +006A - GameType - whenever this is single player (etc)
  +006D - DifficultyLevel
         0 = NORMAL
         1 = NIGHTMARE
         2 = HELL
  +0070 - bExpansion
         0 = CLASSIC
         1 = EXPANSION
  +0074 - GameType - similar to +06A, this seams to be more related to ladder vs. non ladder (single player is ladder)
  +0078 - ItemFormat (word)
         0 = LEGACY
         1 = CLASSIC
         101 = EXPANSION
  +007C - InitSeed
  +0080 - ObjSeed - seed used for object spawning
  +0084 - InitSeed (another instance, dunno why)
  +0088 - pClientList - (pClient structure of last player that entered the game)
  +008C - nClients
  +0090 - nUnits[eType] - array of 6 counters, one for each unit type, this is the next GUID used too
  +00A8 - GameFrame - the current frame of the game, used for timers (buff duration etc)
  +00B8 - pTimerQueue - a queue of all current active and inactive timers
  +00BC - pDrlgAct[5]
  +00D0 - GameSeed (inlined structure)
    +000 - loSeed
    +004 - hiSeed
  +00D8 - pDrlgRoomList[5]
  +00EC - MonSeed - seed used for monster spawning
  +00F0 - pMonsterRegion[1024] - one pointer for each of the 1024 possible levels
  +10F0 - pObjectControl - a controller holding all object region structs
  +10F4 - pQuestControl - a controller holding all quest info
  +10F8 - pUnitNodes[10] - ten lists of unit node lists, this is used by the AI target seeking code (and other stuff)
  +1120 - pUnitList[eType][128] - 5 lists of 128 lists of units (see pUnit documentation), second index is GUID & 127, BEWARE: since ever, missiles are array #4 and items are array #3 (so type3=index4 and type4=index3)
  +1B20 - pTileList - a list for all VisTile units
  +1B24 - UniqueFlags[128] - 128 DWORDS worth of flags that control if a unique item got spawned [room for 4096]
  +1D24 - pNpcControl - a controller holding all npc info (like store inventories, merc list)
  +1D28 - pArenaControl - a controller for arena stuff, functional and also used in game init
    +00 - nAlternateStartTown
    +08 - dwGameType (when type = 2, use nAlternateStartTown instead of normal town level Id for game start)
  +1D2C - pPartyControl - a controller for all party related stuff
  +1D30 - BossFlags[64] - 64 bytes for handling 512 super unique monsters (if they were spawned etc)
  +1D70 - MonModeData[17] - related to monsters changing mode
  +1DB4 - nMonModeData - counter related to the above
  +1DC4 - nSyncTimer - used to sync events
  +1DE8 - bUberBaal - killed uber baal
  +1DEC - bUberDiablo - killed uber diablo
  +1DF0 - bUberMephisto - killed uber mephisto

pTimerQueue (sizeof = 0xA20)
pTimerList (sizeof = 0x7088)
pTimer (sizeof = 0x30)

Code: Select all

struct TimerList
  +001C - pTimerList[600] - allocated in realtime
    +000 - TimerType - the type of the timer, this varies between unit types (byte)
    +002 - TimerIdx - used as index in function table, unique for each unit type (word) (IIRC, has been a while)
    +004 - queueNo - which queue this timer belongs to (byte)
    +008 - pUnit - the unit the timer is assigned to
    +00C - GUID - the global unique identifier of the unit the list is assigned to
    +010 - eType - the unit type of the unit this timer is assigned to
    +018 - pPreviousTimer - the previous timer overall
    +01C - pNextTimer - the next timer overall
    +020 - pPreviousTimerOnUnit - the previous timer assigned to this unit
    +024 - pNextTimerOnUnit - the next timer assigned to this unit
    +028 - pTimerList - the timer list this timer belongs to (IIRC, or the first timer assigned to the unit, need to verify)
    +02C - fpTimerFunction(); - function called when the timer ends (void * __fastcall)(pGame,pUnit);
  +7080 - pFirstTimerList - points to self
  +7084 - pNextTimerList - unknown whenever it actually points to another TimerList, always NULL

struct TimerQueue
  +000 - queueNo - this is controls the current timer list to dispatch, see below how this is calculated
  +004 - pActiveTimersByType[eType][256] - 5 lists of 256 lists timers for each unit type that are currently active (none for tiles)
  +504 - pDispatchedTimersByType[eType][256] - 5 lists of 256 lists of finished timers, that can be repurposed
  +A04 - pTimerListByType[eType] - five list of active timers for each unit type (exact relation to other lists not known yet)
  +A1C - pTimerList

How the game calculates the queueNo

Code: Select all

int queueNo = pGame->CurrentFrame & 0x8000003F;
if (queueNo < 0) {
    queueNo = ((queueNo - 1) & 0xFFFFFFC0) + 1;
}

pNpcControl (sizeof = 0x14)
pNpc (sizeof = 0x44)
pItemList (sizeof = 0x10)
pItemRecord (sizeof = 0xC)

Code: Select all

struct NpcControl
 +000 - nNpcs - how many elements the dynamic array contains
 +004 - pNpc[arrSize] - a pointer to a dynamic array of Npc structures
   +000 - npcNo - hcIdx from MonStats.txt
   +004 - pInventory - the inventory of the npc (what they can sell, regular pInventory class)
   +00C - bGambleBool - a boolean related to gamble
   +021 - bHirelingBool - a boolean related to having hirelings
   +023 - bNormalShopBool - a boolean related to normal shops
   +028 - GetTickCount - tick count from last time the items were generated
   +02C - ItemList (called pSUnitProxy by Blizzard)
      +000 - pItemRecord[arrSize] - dynamic array built from Items.txt (you know what I mean)
        +000 - NormalMin
        +001 - NormalMax
        +002 - MagicMin
        +003 - MagicMax
        +004 - ItemCode
        +008 - MagicLevel
      +004 - nItems - the size of the dynamic array
      +008 - pPermStoreItemCodes - a dynamic array of PermStoreItem codes for this Npc (built from Items.txt)
      +00C - nPermStoreItems - the size of the dynamic array
 +008 - ShopSeed (inline structure)
   +000 - loSeed
   +004 - hiSeed

pUnit (sizeof = 0xF4)

Code: Select all

class Unit
  +000 - eType
          0 = PLAYER
          1 = MONSTER
          2 = OBJECT
          3 = MISSILE
          4 = ITEM
          5 = VIS_TILE
  +004 - eClass
          unitclass,thehcIdxfromthesefiles
          PlrClass.txt
          MonStats.txt
          Objects.txt
          Missiles.tx
          Items.txt(Weapons+Armor+Misc)
          LvlWarps.txt
  +008 - pMemPool - not used, always NULL (pGame+1C is always NULL)
  +00C - GUID - global unique identifier that links a server side unit to a client side unit
  +010 - eMode
          modeindexfrom
          PlrMode.txt
          MonMode.txt
          ObjMode.txt
          Missiles, Items and VisTiles have their own modes (for missiles this holds the collision type)
          eItemModes
            3=onthefloor
  +014 - pUnitData (union of 5 classes)
            pPlayerData
            pMonsterData
            pObjectData
            pMissileData
            pItemData
            Note, there is no pTileData
  +018 - actNo (byte)
  +01C - pDrlgAct
  +020 - seed (inline structure)
    +000 - loSeed
    +004 - hiSeed
  +028 - dwInitSeed
  +02C - pPath (union of 2 classes)
            pStaticPath (Objects, VisTiles, Items)
            pDynamicPath (Players, Monsters, Missiles)
  +030 - pSeqMode (holds a pointer to skill sequence)
  +034 - nSeqFrameCount (frame * 256, count for sequence)
  +038 - nSeqFrame (frame * 256 remaining for sequence)
  +03C - AnimSpeed (32Bit)
  +040 - eSeqMode (holds current anim mode of sequence)
  +044 - CurrentFrame (frame * 256 remaining for animation)
  +048 - FrameCount (frame * 256)
  +04C - AnimSpeed (16Bit) (word)
  +04E - bActionFrame (1 byte) - exact purpose not known to me
  +050 - pAnimData - ptr to the record for current *.COF file in AnimData.d2
  +054 - pGfxData
    +030 - pGfxDrawOffsets
      +00 - DrawFlags
      +04 - x_pos
      +08 - y_pos
      +0C - z_pos
      +10 - x_offset
      +14 - y_offset
      +18 - z_offset
      +1C - x_offset_2
      +20 - y_offset_2
      +24 - z_offset_2
      +28 - x_offset_3
      +2C - y_offset_3
      +30 - z_offset_3
    +038 - nPalShiftIndex
  +058 - pGfxData (another copy of pGfxData - didn't check what the second is used for)
  +05C - pStatListEx
  +060 - pInventory
  - serverside -
      +064 - InteractGUID - global unique identifier of the other unit participating in interaction
      +068 - eInteractType - the unit type of the other unit participating in interaction
      +06C - bInteracting - boolean set to true when interatcing
  - clientside -
      +064 - pLightMap
      +068 - dwStartLightRadius
      +06C - nPl2ShiftIndex
  +06E - UpdateType (word)
  +070 - pUpdateUnit - this is a pointer to self, used when updating the unit
  +074 - pQuestRecord - for quest monsters (etc)
  +078 - bSparkyChest - boolean used only for sparky chests, to get the extra drop (byte)
  +07C - pTimerArgs - arguments to pass to timer
  - serverside -
      +080 - pGame
  - clientside -
      +080 - dwSoundSync - used by summons and ambient stuff
  +090 - pEvent - this is a queue of events to execute (chance to cast skills for example)
  +094 - eOwnerType - unit type of missile or minion owner (also used by portals)
  +098 - OwnerGUID - global unique identifier of minion or missile owner (also used by portals)
  +0A4 - pHoverText - hovering text controller (such as the shrine message)
  +0A8 - pSkills - controller holding a list of all skills the unit has (pointers to pSkill)
  +0AC - pCombat - a queue of attacks to execute
  +0B0 - dwHitClass - the hitclass for the last hit suffered
  +0B8 - DropCode - used only by book shelves in vanilla IIRC, item code of what to drop
  +0C4 - UnitFlags - UnitFlags (qword)
  +0D0 - Node Index - originally said to be client Id, but this is used together with pGame -> pNodeList IIRC
  +0D4 - GetTickCount - used only by client units for overlays
  - serverside -
      +0D8 - GetTickCount - used only by doors
  - clientside -
      +0D8 - pParticleStream
  +0DC - pTimer - a queue of timers assigned to this unit
  +0E4 - pPrevUnit - previous unit in the unit-type list (the last unit is linked to pGame -> pUnitList[eType][GUID&127]
  +0E8 - pPrevUnitInRoom - the previous unit in the current room
  +0EC - pMsgFirst
  +0F0 - pMsgLast

pStatListEx (sizeof = 0x64)

Code: Select all

class StatListEx
  +000 - pMemPool - always NULL
  +008 - eOwnerType
  +00C - OwnerGUID
  +010 - ListFlags
  +024 - BaseStats structure (inline, see under pStatList for details)
  +02C - pLastList - pointer to the last pStatList of the StatListEx owner (aka item owner in case list ex belongs to item)
  +034 - pStatListEx - pointer to owner StatListEx (if this one is owned by a item, this points to the item owners list)
  +038 - pNextListEx - next StatListEx
  +03C - pMyLastList (statlist)
  +040 - pMyStats (statlist)
  +044 - pUnit (list owner)
  +048 - FullStats (inline stats struct, see below)
  +050 - ModStats (inline stats struct, see below)
  +058 - StatFlags[] (pointer to array)
  +05C - fCallback (function to call by SetStat, AddStat when a fcallback stat changes)
  +060 - pGame (on server)
pStatList (sizeof = 0x40)

Code: Select all

class StatList
  +000 - pMemPool - always NULL, as for other structures
  +004 - pUnit - the unit to which the list is attached
  +008 - eOwnerType - the unit type of whatever unit created the statlist (spell caster etc)
  +00C - OwnerGUID - the global unique identifier of whatever unit created the statlist
  +010 - ListFlags (32 flags)
  +014 - stateNo - Id of the state this statlist is linked to (for buffs, curses etc)
  +018 - ExpireFrame - the frame at which the state expires (end of duration for skill)
  +01C - skillNo - Id of the skill that created the stat list
  +020 - sLvl - level of the skill that created the stat list
  +024 - Stats structure (inline)
    +000 - pStat[arrSize] - dynamic array of stat structures
      +000 - hiStatId (param)
      +002 - loStatId (statNo from ItemStatCost.txt)
      +004 - value
    +004 - statCount (size of the array)
    +008 - sizeInBits
  +02C - pPrevList - previous list on this unit
  +030 - pNextList - next list on this unit
  +034 - pPrevious - previous list overall
  +038 - fpStatExpires(); - function to call when the list is removed (void * __fastcall)(pUnit,stateNo,BOOL);
  +03C - pNext - next list overall

Monster and Ai structures

pMonsterData (sizeof = 0x60)
pAiParams (sizeof = 0x24)
pAiGeneral (sizeof = 0x40)
pMinionList (sizeof = 0x8)
pAiTickArgs (sizeof = 0x24)
pAiCmd (sizeof = 0x1C)

Code: Select all

class MonsterData
  +000 - pMonStats - record in monstats.txt
  +004 - Components[16] - bytes holding the component Ids for each component;
      Order: HD, TR, LG, RA, LA, RH, LH, SH, S1, S2, S3, S4, S5, S6, S7, S8
  +014 - NameSeed
  +016 - TypeFlags
  	0x00000001 - MONTYPE_OTHER (set for some champs, uniques)
      0x00000002 - MONTYPE_SUPERUNIQUE
      0x00000004 - MONTYPE_CHAMPION
      0x00000008 - MONTYPE_UNIQUE
      0x00000010 - MONTYPE_MINION
      0x00000020 - MONTYPE_POSSESSED
      0x00000040 - MONTYPE_GHOSTLY
      0x00000080 - MONTYPE_MULTISHOT
  +017 - eLastMode
  +018 - dwDuriel - set only for duriel
  +01C - MonUModList[9] - nine bytes holding the Ids for each MonUMod assigned to the unit
  +026 - bossNo - hcIdx from superuniques.txt for superuniques (word)
  +028 - pAiGeneral
  - server side - 
      +02C - pAiParams
  - client side -
      +02C - szMonName (ptr to wchar_t string, 300 chars long)
  +030 - this holds a third monster ai structure I didn't analyse yet
  +040 - dwNecroPet - set for necro pets
  +050 - pVision - this may be polymorphic, the way this is used seams to depend on the monster type, used in LOS evaluation
  +054 - AiState - this is used to tell monsters what special state has been set, this tells them they just got attacked etc
  +058 - lvlNo - the Id from levels.txt of the level they got spawned in (used to access pGame -> pMonsterRegion[...])
  +05C - SummonerFlags - byte used only by the summoner
 
struct AiTickArgs
  +000 - pAiGeneral
  +008 - pTarget - the unit the Ai picked as the target
  +014 - Distance - the distance in steps to the target (not subtiles)
  +018 - bEngaged - BOOL that is TRUE when the unit is within melee range of it's target
  +020 - pMonStats - record in MonStats.txt for the monster
  +024 - pMonStats2 - record in MonStats2.txt for the monster

struct AiCmd
  +000 - pNextCmd
  +004 - pPrevCmd
  +008 - nCmdArgs[5]

struct MinionList
  +000 - GUID - global unique identifier of the minion
  +004 - pNextMinion - next element in the minion list
  
struct AiParams
  +004 - fpAiFunction(); - the primary ai function, like for pAiGeneral
  +008 - AiFlags16 - 16 bit version of ai flags
  +018 - dwMoveMethod - this is the method used for movement (flee, approach, circle etc) (cleared after move-end)
  +01C - nMoveSpeedBonus - bonus to movement speed (cleared after move-end)
  +020 - nSteps - number of steps to walk when moving (cleared after move-end)
  
struct AiGeneral
  +000 - SpecialState - stuff like terror, confusion goes here
  +004 - fpAiFunction(); - the primary ai function to call (void * __fastcall)(pGame,pUnit,pAiTickArgs);
  +008 - AiFlags
  +00C - OwnerGUID - the global unique identifier of the boss or minion owner
  +010 - eOwnerType - the unit type of the boss or minion owner
  +014 - dwArgs[3] - three dwords holding custom data used by ai func to store counters (etc)
  +020 - pCmdCurrent
  +024 - pCmdLast
  +028 - pGame
  +02C - OwnerGUID - the same as +008
  +030 - eOwnerType - the same as +00C
  +034 - pMinionList - list of all minions, for boss units (SetBoss in MonStats, Unique, SuperUnique etc)
  +03C - eTrapNo - used by shadows for summoning traps (so they stick to one type usually)



pInventory (sizeof = 0x40)
pItemData (sizeof = 0x74)

Code: Select all

class Inventory
  +000 - dwInvStamp - always, 0x1020304, used to verify the inventory is valid
  +004 - pMemPool - always NULL, not used
  +008 - pOwnerUnit - pUnit of the inventory owner
  +00C - pFirstItem - pUnit of the first item in the inventory
  +014 - pInvInfo - list of pointers to equipped gear
  +018 - nInvInfo - count for above
  +01C - WeaponGUID
  +020 - pInvOwnerItem - points to self on items that aren't placed into sockets
  +024 - OwnerGUID - GUID of the inventory owner
  +028 - nFilledSockets
  +034 - pFirstCorpse - ptr to first corpse structure
  +03C - NextCorpseGUID

class ItemData
  +000 - qualityNo;
      0 - QUALITY_INVALID
      1 - QUALITY_LOW
      2 - QUALITY_NORMAL
      3 - QUALITY_SUPERIOR
      4 - QUALITY_MAGIC
      5 - QUALITY_SET
      6 - QUALITY_RARE
      7 - QUALITY_UNIQUE
      8 - QUALITY_CRAFTED
      9 - QUALITY_TAMPERED
  +004 - ItemSeed
     +000 - LoSeed
     +004 - HiSeed
  +00C - OwnerGUID (-1 when not owned by player, otherwise equal to player GUID [IIRC])
  +010 - FingerPrint - this is the initial spawning seed
  +014 - CommandFlags - I've not seen how this is used myself yet
  +018 - ItemFlags - for more flags look at the original topic by Kingpin
     0x00000010 - ITEMFLAG_IDENTIFIED
     0x00000800 - ITEMFLAG_SOCKETED
     0x00008000 - ITEMFLAG_NAMED (for ears, personalized items etc)
     0x00020000 - ITEMFLAG_INEXPENSIVE (always costs 1 for repair / sell)
     0x00200000 - ITEMFLAG_COMPACTSAVE
     0x00400000 - ITEMFLAG_ETHEREAL
     0x04000000 - ITEMFLAG_RUNEWORD
  +024 - ActionStamp - seams to be changed every time an action is done with the item
  +028 - FileIndex - index from data files
      UniqueItems.txt, SetItems.txt, QualityItems.txt, LowQualityItems.txt (etc)
  +02C - iLvl
  +030 - ItemFormat - read from pGame -> ItemFormat (word) on creation
  +032 - RarePrefix (word)
  +034 - RareSuffix (word)
  +036 - AutoPrefix (word)
  +038 - MagicPrefix[3] (words)
  +03E - MagicSuffix[3] (words)
  +044 - BodyLoc (byte) - Id from BodyLocs.txt, note this field isn't always cleared, use D2Common.#11003 instead of checking this
  +045 - InvPage (byte) - set to -1 when equipped
      0 = INVPAGE_INVENTORY
      3 = INVPAGE_HORADRIC_CUBE
      4 = INVPAGE_STASH
  +048 - EarLevel (byte)
  +049 - InvGfxIdx (byte) - for itemtypes with VarInvGfx
  +04A - szPlayerName[16] - used for Ears and Personalized items
  +05C - pNodeOwnerInventory - for socketed items this points to the inventory of the parent item
  +064 - pNextSocketedItem - item filling the next socket, if pNodeOwnerInventory is set
  +068 - nNodePosition
  +069 - nNodePositionOther

pMissileData (sizeof = 0x34)

Code: Select all

class MissileData
  +008 - ActivateFrame (word) - Activate column from Missiles.txt
  +00A - sLvl (word)
  +00C - skillNo (word)
  +00E - TotalFrames - the number of frames before the missile vanishes from Missiles.txt
  +010 - CurrentFrame - the current traveling frame
  +014 - MissileFlags - this depends on the missile functions used
  +018 - eOwnerType - unit type of the missile owner
  +01C - OwnerGUID - global unique identifier of the missile owner
  +020 - eUnitType - unit type of a target, for homing missiles
  +024 - UnitGUID - global unique identifier of a target, for homing missiles
  +028 - HomeStatus - for homing missiles like Guided Arrow
  +02C - CoordShort (32 bit coord structure, normally this is 64 bit)
     +000 - xPos
     +002 - yPos
pCellFile (sizeof = dynamic)
DT1 and DCC files are the same format as DC6 after being read by the game (aka in case of DCC decompressed also).

pCellContext (sizeof = 0x48)
Most of the stuff within this is only rarely used, and I didn't get to deeply analyse it yet
A cell context is what we'd normally call a instance of a sprite, storing the current direction and frame to draw

Code: Select all

struct CellFile
  +000 - version
  +004 - pxWidth
  +008 - pxHeight
  +010 - nDirs
  +014 - nFrames
  +018 - pFramePixelData[arrSize] --- raw data for frames
 
struct CellContext
  +004 - dirNo (0-63, other values asplode even when file has more dirs)
  +008 - pCellFile
  +044 - frameNo

pDamage (sizeof = 0x70)

Code: Select all

struct Damage
  +000 - HitFlags
     0x00000001 - HITFLAG_SRCDAMAGE_MISSILE
     0x00000002 - HITFLAG_SUCCESSFUL_CRITICAL_HIT
     0x00000010 - HITFLAG_FRIENDLY_FIRE
     0x00000020 - HITFLAG_SRCDAMAGE_MELEE
     0x00000100 - HITFLAG_BYPASS_UNDEAD
     0x00000200 - HITFLAG_BYPASS_DEMONS
     0x00000400 - HITFLAG_BYPASS_BEASTS
  +004 - ResultFlags (word)
     0x00000001 - RESULTFLAG_HIT
     0x00000002 - RESULTFLAG_DEATH
     0x00000004 - RESULTFLAG_GETHIT
     0x00000008 - RESULTFLAG_KNOCKBACK
     0x00000010 - RESULTFLAG_BLOCK
     0x00000020 - RESULTFLAG_DISALLOW_EVENTS
     0x00000100 - RESULTFLAG_DODGE
     0x00000200 - RESULTFLAG_AVOID
     0x00002000 - RESULTFLAG_SOFTHIT
     0x00008000 - RESULTFLAG_WEAPONBLOCK
  +008 - PhysicalDamage
  +00C - EnhancedDamagePercent
  +010 - FireDamage
  +014 - BurnDamage
  +018 - BurnLength
  +01C - LightningDamage
  +020 - MagicDamage
  +024 - ColdDamage
  +028 - PoisonDamage
  +02C - PoisonLength
  +030 - ColdLength
  +034 - FreezeLength
  +038 - LifeSteal
  +03C - ManaSteal
  +040 - StaminaSteal
  +044 - StunLength
  +048 - AbsorbedLife - amount of life absorbed via absorb stats
  +04C - DamageTotal - sum of Physical, Fire, Lightning, Magic, Cold, Poison (and LifeSteal when attack done by monster)
  +054 - PiercePct - chance to pierce target for missiles
  +058 - DamageRate - column from Missiles.txt
  +060 - HitClass
  +064 - HitClassActiveSet - bool
  +065 - eType - for skills that convert physical damage to element (not missiles)
  +068 - eConvPercent
Last edited by Nefarius on Sat Sep 13, 2008 1:28 am, edited 25 times in total.
''(...) The game can basically be considered unhackable. '' - Blizzard Entertainment (30th May 2000)
Black Omen Productions | MetalStorm: Progress Report | Screenshots

User avatar
CorniI
Dark Alliance Beta Test
Champion of the Light
Posts: 371
Joined: Wed Apr 12, 2006 9:02 am

Post by CorniI » Tue Aug 12, 2008 6:17 pm

Hi,
Can you please check the
struct AiTickArgs
+000 - pAiParams
I'm pretty sure that +000 is pAiGeneral in your terms... (obtained form 1.10, but there's no reason that this is different in 1.11b)
Linux is like a Wigwam - NO Windows, no Gates and Apache inside

User avatar
Nefarius
Retired Admin
Cherub
Posts: 11607
Joined: Sat Jun 15, 2002 8:13 pm
Location: Where the blood forever rains
Contact:

Hand-picked

Re: [v1.11b] Structure Reference

Post by Nefarius » Tue Aug 12, 2008 7:35 pm

Yes it is pAiGeneral, no need to check, the topic was just outdated ;).

Theres a ton of new info I have gathered about the majority of structs, inc. a ton of that elusive client gfx stuff, but I don't have time atm to update this.
Last edited by Nefarius on Tue Aug 12, 2008 7:38 pm, edited 1 time in total.
''(...) The game can basically be considered unhackable. '' - Blizzard Entertainment (30th May 2000)
Black Omen Productions | MetalStorm: Progress Report | Screenshots

User avatar
kingpin
Senior Admin
Cherub
Posts: 10905
Joined: Sat Jan 11, 2003 12:51 pm
Contact:
Sweden

Hand-picked

Re: [v1.11b] Structure Reference

Post by kingpin » Mon Oct 13, 2008 3:32 pm

+016 - TypeFlags
0x00000001 - MONTYPE_OTHER (set for some champs, uniques)
0x00000002 - MONTYPE_SUPERUNIQUE
0x00000004 - MONTYPE_CHAMPION
0x00000008 - MONTYPE_UNIQUE
0x00000010 - MONTYPE_MINION
0x00000020 - MONTYPE_POSSESSED
0x00000040 - MONTYPE_GHOSTLY
0x00000080 - MONTYPE_MULTISHOT
Are you sure your TypeFlags is correct? As in 1.10 those is different. The field is BYTE so in any case shouldn't be listed as DWORD field :)

1.10 TypeFlags:

0x00 = regular Monster
0x09 = Unique
0x0B = Superunique
0x0D = Champion, Berserker, Fanatic
0x10 = Minion
0x2D = Possessed
0x4D = Ghostly
Last edited by kingpin on Mon Oct 13, 2008 3:43 pm, edited 3 times in total.

User avatar
Nefarius
Retired Admin
Cherub
Posts: 11607
Joined: Sat Jun 15, 2002 8:13 pm
Location: Where the blood forever rains
Contact:

Hand-picked

Re: [v1.11b] Structure Reference

Post by Nefarius » Mon Oct 13, 2008 3:49 pm

You've merged the bit flags, the bits have individual meanings and are individually checked by code.
''(...) The game can basically be considered unhackable. '' - Blizzard Entertainment (30th May 2000)
Black Omen Productions | MetalStorm: Progress Report | Screenshots

User avatar
kingpin
Senior Admin
Cherub
Posts: 10905
Joined: Sat Jan 11, 2003 12:51 pm
Contact:
Sweden

Hand-picked

Re: [v1.11b] Structure Reference

Post by kingpin » Mon Oct 13, 2008 5:04 pm

Nefarius";p="403614" wrote:You've merged the bit flags, the bits have individual meanings and are individually checked by code.
I think you in that case could update the info abit.

As the way you wrote it. It look like the single flag itself is enough to make the monster a GHOSTLY (then the GHOSTLY flag itself only tells it will use a faded appearence on client side).

The flags I got for different Type of mob is the correct flags set for them. This was what I was after as I needed a way to check them individual what type they was :)

Post Reply

Return to “Code Editing”