[1.13d]Create new DescFunc for ItemStat?

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
karlock
Posts: 42
Joined: Mon Mar 16, 2015 1:16 pm

[1.13d]Create new DescFunc for ItemStat?

Post by karlock » Wed Feb 13, 2019 9:08 am

I try to make a new descfunc for a itemstat. The last stage stacks me.

The original DescFunc table located at D2CLIENT + 0x2DAD4

Copy the original table to construct new one.

Code: Select all

//new table
void* NewDescFuncTable[DESCFUNC_MAX_SIZE]
//copy from old one
std::copy(D2CLIENT_pDescFuncTable, D2CLIENT_pDescFuncTable + 28, NewDescFuncTable);
//new descfunc
NewDescFuncTable[28] = &ItemDesc29;

Code: Select all

//patch switch case size
{D2DLL_D2CLIENT, 0x2CFA7, (DWORD)DESCFUNC_MAX_SIZE, FALSE, 0x01},
//patch original using
{D2DLL_D2CLIENT, 0x2CFB7, (DWORD)NewDescFuncTable, FALSE, 0x00},
Here comes trouble. How to deal with new descfunc. It seems only asm can do it. What a mass. :(

Code: Select all

__declspec(naked) void ItemDesc29();

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:
South Africa

Hand-picked

Re: [1.13d]Create new DescFunc for ItemStat?

Post by Necrolis » Wed Feb 13, 2019 11:25 am

I found it easier to expand the table like so:

Code: Select all

/* 
	Date: Mon Aug 16 08:06:25 2010
	Author: Necrolis
	Function: ITEMSTATDESC_Build
	Address: D2Client.0x521C0
	Comments: 
*/

BOOL __fastcall ITEMSTATDESC_Build(D2UnitStrc* pItem, D2StatListStrc* pStatList, int nStat, int nParam, int nValue, wchar_t* pBuffer)
{
	switch(pRecord->nDescFunc)
	{
		case 29: return ITEMSTATDESC_AddMissile(pBuffer,nValue,nParam);
		default: return D2AddDescString(pItem,pStatList,nStat,nParam,nValue,pBuffer);
	}

	return FALSE;
}
Alternatively to have a look at what the params are that get setup and pushed when the table FN is called.
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

User avatar
karlock
Posts: 42
Joined: Mon Mar 16, 2015 1:16 pm

Re: [1.13d]Create new DescFunc for ItemStat?

Post by karlock » Wed Feb 13, 2019 3:19 pm

Necrolis wrote:
Wed Feb 13, 2019 11:25 am
I found it easier to expand the table like so:

Code: Select all

/* 
	Date: Mon Aug 16 08:06:25 2010
	Author: Necrolis
	Function: ITEMSTATDESC_Build
	Address: D2Client.0x521C0
	Comments: 
*/

BOOL __fastcall ITEMSTATDESC_Build(D2UnitStrc* pItem, D2StatListStrc* pStatList, int nStat, int nParam, int nValue, wchar_t* pBuffer)
{
	switch(pRecord->nDescFunc)
	{
		case 29: return ITEMSTATDESC_AddMissile(pBuffer,nValue,nParam);
		default: return D2AddDescString(pItem,pStatList,nStat,nParam,nValue,pBuffer);
	}

	return FALSE;
}
Alternatively to have a look at what the params are that get setup and pushed when the table FN is called.
wow! Thank you! I will try it later.

User avatar
karlock
Posts: 42
Joined: Mon Mar 16, 2015 1:16 pm

Re: [1.13d]Create new DescFunc for ItemStat?

Post by karlock » Thu Feb 14, 2019 1:28 am

Code: Select all

__declspec(naked) void ItemDesc29()
{
	__asm
	{
		mov     eax, [esp + 00h]
		mov     eax, [esp + 04h]
		mov     eax, [esp + 08h]
		mov     eax, [esp + 0Ch]
		mov     eax, [esp + 10h]
		mov     eax, [esp + 14h]
		mov     eax, [esp + 18h]
		mov     eax, [esp + 1Ch]
		mov     eax, [esp + 20h]
		mov     eax, [esp + 24h]
		mov     eax, [esp + 28h]
		mov     eax, [esp + 2Ch]
		mov     eax, [esp + 30h]
		mov     eax, [esp + 34h]
		mov     eax, [esp + 38h]
		mov     eax, [esp + 3Ch]
		mov     eax, [esp + 40h]
		mov     eax, [esp + 44h]
		mov     eax, [esp + 48h]
		mov     eax, [esp + 4Ch]
		mov     eax, [esp + 50h]
		mov     eax, [esp + 54h]
		mov     eax, [esp + 58h]
		mov     eax, [esp + 5Ch]
	}
}
Just print it! :twisted:

User avatar
karlock
Posts: 42
Joined: Mon Mar 16, 2015 1:16 pm

Re: [1.13d]Create new DescFunc for ItemStat?

Post by karlock » Wed Feb 20, 2019 8:06 am

Necrolis wrote:
Wed Feb 13, 2019 11:25 am
Alternatively to have a look at what the params are that get setup and pushed when the table FN is called.
Trial and error , quest complete. Thanks for the tips. :D

Sir, can i ask anthor question? Make character said "Impossible", "I need mana" blablabla, overhead message. I have searched the forum for this, but no one metioned it.

With https://d2mods.info/forum/viewtopic.php ... ad#p296649
But D2Client.B5820 is not for that type of overhead message, Because it should play only triggered player, not all.

Post Reply

Return to “Code Editing”