Page 1 of 1

[1.13d]UpdateClientItemStat

Posted: Fri Jan 25, 2019 8:35 am
by karlock
with 1.13d, D2COMMON 0x5A0B0 to modify item stat.
The stat has been changed, but no text change. But drop the item, and pick it up, then the stat is changed.

According to https://d2mods.info/forum/viewtopic.php ... 7&p=487017

Code: Select all

ASMPTR(D2GAME, UpdateClientItemStat_I, 0xDCCC0)
__declspec (naked) void __fastcall UpdateClientItemStat_Stub(DWORD ptClient, UnitAny* ptItem, BOOL bSetStat, short nStat, int nValue)
{
	_asm
	{
		push[esp + 0x0C] //nValue
		push[esp + 0x0C] //nStat
		push[esp + 0x0C] //bool
		push ecx //pItem
		mov eax, edx //pClient
		call UpdateClientItemStat_I
		retn 0x0C
	}
}

D2COMMON_SetUnitStat(pItem, D2CStat::STATS_QUANTITY, 10, 0);
UpdateClientItemStat_Stub(ptUnit->ptPlayerData->ptClient, pItem, TRUE, D2CStat::STATS_QUANTITY, 10);

I have called the function , but nothing happens. Those stackable potions works, but not perfect. :-|

EDIT:Fix Code.

Re: Update item stat show?

Posted: Fri Jan 25, 2019 9:21 am
by Necrolis
You need to resync the item to the client; generally its best to hijack the code that updates qty and dur and allow it to work with all stats (you need to modify the client and server functions). In vanilla they discard any stat that isn't qty and dur, which is why calling that func doesn't work.

Re: Update item stat show?

Posted: Fri Jan 25, 2019 9:50 am
by karlock
But where can i get start. :roll:

Re: Update item stat show?

Posted: Sat Jan 26, 2019 11:46 am
by karlock
Necrolis wrote:
Fri Jan 25, 2019 9:21 am
You need to resync the item to the client; generally its best to hijack the code that updates qty and dur and allow it to work with all stats (you need to modify the client and server functions). In vanilla they discard any stat that isn't qty and dur, which is why calling that func doesn't work.
Sorry, I use ptGame as a ptClient...Correct is ptUnit->ptPlayerData->ptClient..But I will check that part try to find out other stats update.

So, Diablo 2 is a online game, but it runs a local server? 8-O

Re: Update item stat show?

Posted: Sat Jan 26, 2019 12:18 pm
by devurandom
karlock wrote:
Sat Jan 26, 2019 11:46 am
So, Diablo 2 is a online game, but it runs a local server? 8-O
Yes, even in single player mode. D2Game.dll is server and D2Client is the client.
Communication is packet based.

Re: Update item stat show?

Posted: Sat Jan 26, 2019 3:26 pm
by karlock
:roll: Interesting..