This thread is meant to document various function tables used by the game.
Credits are due to various users here @The Phrozenkeep
This table contains receptor functions for D2GS packets sent by the clients to the server.
Don't know what the field labeled as BOOL b does. I believe it may be related to hack detection, although I'm pretty sure it's not used outside of realm.
Code: Select all
struct
{
int (__fastcall* D2GsClt2SrvPacket_t)(D2GameStrc* pGame, D2UnitStrc* pUnit, void* pPacket, int nPacketSize);
BOOL b;
};
D2GS Server->Client Packets (D2Client.0xDDE60)
This table contains the receptor functions for D2GS packets sent by the server to the client.
A size of -1 in the the nPacketSize field means the packet has variable size
Code: Select all
struct
{
void (__fastcall* D2GsSrv2CltPacket_t)(void* pPacket);
int nPacketSize;
void (__fastcall* D2GsSrv2CltPacketEx_t)(D2UnitStrc* pUnit, void* pPacket)
};
Skills SrvStFunc (D2Game.0x107338)
This table contains the skills SrvStFunc functions.
Code: Select all
struct
{
int (__fastcall* D2SkillSrvStFunc_t)(D2GameStrc* pGame, D2UnitStrc* pUnit, int nSkill, int nSkillLevel);
};
Skills SrvDoFunc (D2Game.0x1074A8)
This table contains the skills SrvDoFunc functions.
Code: Select all
struct
{
int (__fastcall* D2SkillSrvDoFunc_t)(D2GameStrc* pGame, D2UnitStrc* pUnit, int nSkill, int nSkillLevel);
};
Skills CltStFunc (D2Client.0xDE928)
This table contains the skills CltStFunc functions.
Code: Select all
struct
{
int (__fastcall* D2SkillCltStFunc_t)(D2UnitStrc* pUnit, int nSkill, int nSkillLevel);
};
Skills CltDoFunc (D2Client.0xDEA48)
This table contains the skills CltDoFunc functions.
Code: Select all
struct
{
int (__fastcall* D2SkillCltDoFunc_t)(D2UnitStrc* pUnit, int nSkill, int nSkillLevel);
};
Objects Server Init (D2Game.0x10E050)
This table contains object init functions (InitFn in Objects.txt)
Code: Select all
struct D2ObjInitFnStrc
{
D2GameStrc* pGame; //0x00
D2UnitStrc* pObject; //0x04
D2RoomStrc* pRoom; //0x08
D2ObjDataStrc* pObjData; //0x0C
D2ObjectsTXT* pObjectRecord; //0x10
int nX; //0x14
int nY; //0x18
};
struct
{
int (__fastcall* D2ObjInit_t)(D2ObjInitFnStrc* pInitFn);
};
Objects Server Operate (D2Game.0x107BB8)
This table contains objects operating functions (OperateFn in Objects.txt)
Code: Select all
struct D2ObjOperateFnStrc
{
D2GameStrc* pGame; //0x00
D2UnitStrc* pObject; //0x04
D2UnitStrc* pPlayer; //0x08
D2ObjDataStrc* pObjData; //0x0C
int nObjectClass; //0x10
};
struct
{
int (__fastcall* D2ObjOperate_t)(D2ObjOperateFnStrc* pOperateFn);
};
********************************************************************
Items Spell Functions (D2Game.0x107238)
This table contains item spell functions (pSpell column from Armor/Misc/Weapons.txt)
On the second callback, the return value defines whether the item is destroyed or not (0 = no, 1 = yes)
Code: Select all
struct
{
int (__fastcall* D2ItemSpellInit_t)(D2GameStrc* pGame, D2UnitStrc* pUnit, D2UnitStrc* pItem, D2UnitStrc* pTarget, int nX, int nY, int nSkill);
int (__fastcall* D2ItemSpell_t)(D2GameStrc* pGame, D2UnitStrc* pUnit, D2UnitStrc* pItem, D2UnitStrc* pTarget, int nX, int nY, int nSkill);
};
Event Functions (D2Game.0x1077A8)
This table is used both by skills and item stats.
In the case of items it's used for ItemEventFuncs, and for skills it's used by various things in skills.txt
The prototype args are polymorphic.
Code: Select all
struct
{
union
{
int (__fastcall* D2ItemEventFunc)(D2GameStrc* pGame, int nEvent, D2UnitStrc* pUnit, D2UnitStrc* pTarget, D2DamageStrc* pDamage, DWORD dwStat, DWORD dwArg);
int (__fastcall* D2SkillEventFunc)(D2GameStrc* pGame, int nEvent, D2UnitStrc* pUnit, D2UnitStrc* pTarget, D2DamageStrc* pDamage, int nSkill, int nSkillLevel);
};
};
Item Properties Functions (D2Common.0x9B0C8)
This table contains functions used to handle item properties. More information can be found here
Code: Select all
struct
{
int (__fastcall* D2PropFunc_t)(int nPropType, D2UnitStrc* pSrcUnit, D2UnitStrc* pUnit, D2PropertyStrc* pProp, int nSet, int nStat, int nParam, int nPrevValue, int nState, DWORD dwListFlags, DWORD dw0);
};
Cube Special Outputs (D2Game.0xFA5E8)
This table contains functions for special cube outputs, like the cow level portal.
However only one entry is used in single player. (The functions for uber trist aren't available, they just return 0)
Code: Select all
struct
{
int (__fastcall* D2CubeOutput_t)(D2GameStrc* pGame, D2UnitStrc* pUnit);
};
Missiles SrvDoFunc Functions (D2Game.0x10D970)
This table contains missiles SrvDoFunc functions (pSrvDoFunc field in Missiles.txt)
Code: Select all
struct
{
void (__fastcall* D2MslSrvDoFunc_t)(D2GameStrc* pGame, D2UnitStrc* pMissile);
};
Missiles SrvHitFunc Functions (D2Game.0x10DA48)
This table contains missiles SrvHitFunc functions (pSrvHitFunc field in Missiles.txt)
Code: Select all
struct
{
int (__fastcall* D2MslSrvHitFunc_t)(D2GameStrc* pGame, D2UnitStrc* pMissile, D2UnitStrc* pTarget);
};
Missiles SrvDmgFunc Functions (D2Game.0x10DB68)
This table contains missiles SrvDmgFunc functions (pSrvDmgFunc field in Missiles.txt)
Code: Select all
struct
{
void (__fastcall* D2MslSrvDmgFunc_t)(D2GameStrc* pGame, D2UnitStrc* pMissile, D2UnitStrc* pTarget, D2DamageStrc* pDamage);
};
Missiles CltDoFunc Functions (D2Client.0xDD8A0)
This table contains missiles CltDoFunc functions (pCltDoFunc field in Missiles.txt)
Code: Select all
struct
{
void (__fastcall* D2MslCltDoFunc_t)(D2UnitStrc* pMissile);
};
Missiles CltHitFunc Functions (D2Client.0xDDA10)
This table contains missiles CltHitFunc functions (pCltHitFunc field in Missiles.txt)
Code: Select all
struct
{
int (__fastcall* D2MslCltHitFunc_t)(D2UnitStrc* pMissile, D2UnitStrc* pTarget);
};