[1.13d]UpdateClientItemStat

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

[1.13d]UpdateClientItemStat

Post by karlock » Fri Jan 25, 2019 8:35 am

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.
Last edited by karlock on Sun Jan 27, 2019 6:01 am, edited 1 time in total.

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

Hand-picked

Re: Update item stat show?

Post by Necrolis » 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.
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death
"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: 31
Joined: Mon Mar 16, 2015 1:16 pm

Re: Update item stat show?

Post by karlock » Fri Jan 25, 2019 9:50 am

But where can i get start. :roll:

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

Re: Update item stat show?

Post by karlock » Sat Jan 26, 2019 11:46 am

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

User avatar
devurandom
Forum Regular
Angel
Posts: 744
Joined: Sat Mar 07, 2015 9:07 pm
United States of America

Re: Update item stat show?

Post by devurandom » Sat Jan 26, 2019 12:18 pm

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.
Assembly Reference | 1.13d Code Edits | UVLoD | BaseMod Plugin

Fiat paper money is the most elaborate and well devised form of slavery the world has ever seen..

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

Re: Update item stat show?

Post by karlock » Sat Jan 26, 2019 3:26 pm

:roll: Interesting..

Post Reply

Return to “Code Editing”