[1.13d]Spawn item Function

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]Spawn item Function

Post by karlock » Thu Jan 24, 2019 1:29 pm

Base on https://d2mods.info/forum/viewtopic.php ... 0&p=489133

Code: Select all

ASMPTR(D2GAME, CreateRewardItem_I, 0xD2F50)

Code: Select all

__declspec (naked) UnitAny* __fastcall CreateRewardItem_Stub(DWORD pGame, UnitAny* pUnit, DWORD dwCode, int nItemLevel, int nQuality, BOOL bDrop)
{
	/*
		push bDrop
		push nQuality
		push pGame
		mov eax, dwCode
		mov edx, pUnit
		mov ecx, nItemLevel
		call D2GAME_6FC56470
	*/

	__asm
	{
		push[esp + 0x10]
		push[esp + 0x10]
		push ecx
		mov ecx, [esp + 0x10]
		mov eax, [esp + 0x14]
		call CreateRewardItem_I
		retn 0x10
	}
}

Code: Select all

CreateRewardItem_Stub(pGame, pUnit, 0x206E6972, 1, 4, 1);
How to get other itemType's code. The ring's code can be found at A1Q3 Reward which is 0x206E6972.

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

Re: [1.13d]Spawn item Function

Post by karlock » Thu Jan 24, 2019 1:38 pm


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

Re: [1.13d]Spawn item Function

Post by devurandom » Thu Jan 24, 2019 11:17 pm

same reference I use
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
thaison
Dark Alliance Beta Test
Crusader
Posts: 81
Joined: Fri Apr 03, 2015 11:59 am
Location: Viet Nam
Vietnam

Re: [1.13d]Spawn item Function

Post by thaison » Fri Jan 25, 2019 12:55 am

Code: Select all

#define REVERSE32(dw)	( ( ((dw) & 0xFF000000) >> 24 ) | ( ((dw) & 0x00FF0000) >> 8 ) | ( ((dw) & 0x0000FF00) << 8 ) | ( ((dw) & 0x000000FF) << 24 ) )
#define CODE32(sz)		REVERSE32( ( ( const unsigned long )( (sz) ) ) )
Example:

Code: Select all

CreateRewardItem_Stub(pGame, pUnit, CODE32('rin '), 1, 4, 1);

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

Re: [1.13d]Spawn item Function

Post by karlock » Fri Jan 25, 2019 3:12 am

thaison wrote:
Fri Jan 25, 2019 12:55 am

Code: Select all

#define REVERSE32(dw)	( ( ((dw) & 0xFF000000) >> 24 ) | ( ((dw) & 0x00FF0000) >> 8 ) | ( ((dw) & 0x0000FF00) << 8 ) | ( ((dw) & 0x000000FF) << 24 ) )
#define CODE32(sz)		REVERSE32( ( ( const unsigned long )( (sz) ) ) )
Example:

Code: Select all

CreateRewardItem_Stub(pGame, pUnit, CODE32('rin '), 1, 4, 1);
THANKS! :D

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

Re: [1.13d]Spawn item Function

Post by devurandom » Fri Jan 25, 2019 8:14 am

Those functions are Nefarius code, surprised that's it's not mentioned.
https://d2mods.info/forum/viewtopic.php ... &start=198
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..

Post Reply

Return to “Code Editing”