#Gamble Refresh
1 messages · Page 1 of 1 (latest)
the vendor unit ID is stored in a global variable on d2client here:
VARPTR(D2CLIENT, RecentInteractId, DWORD, 0x11971D)
The address is for 1.13c
from the unit ID, you can get pVendor using this:
int nVendorId = *p_D2CLIENT_RecentInteractId;
UnitAny* pVendor = D2CLIENT_GetUnitFromTypeAndGUID_STUB(nVendorId & 0x7F, nVendorId, p_D2CLIENT_UnitTable + 0x80, UNIT_MONSTER);
and the getunit function is this:
__declspec(naked) UnitAny* __stdcall D2CLIENT_GetUnitFromTypeAndGUID_STUB(int nUnitTableOffset, int nUnitGUID, UnitAny** pUnitTable, int nUnitType)
{
__asm
{
push ECX
push EDX
mov EAX, [esp + 12] // nUnitTableOffset
mov ECX, [esp + 16] // nUnitGUID
mov EDX, [esp + 20] // pUnitTable
push[esp + 24] // nUnitType
call D2CLIENT_GetUnitFromTypeAndGUID // 0xA4E20
pop EDX
pop ECX
retn 16
}
}
thank you
p_D2CLIENT_UnitTable <==where is this address?
VARPTR(D2CLIENT, UnitTable, UnitAny*, 0x10A608);
and "// nUnitType
call D2CLIENT_GetUnitFromTypeAndGUID " this D2CLIENT_GetUnitFromTypeAndGUID have some problam?
not sure what you mean
I defend is right?:
#define D2CLIENT_GetUnitFromTypeAndGUID(nUnitTableOffset, nUnitGUID, pUnitTable, nUnitType) ((UnitAny *)D2CLIENT_GetUnitFromTypeAndGUID_STUB(nUnitTableOffset, nUnitGUID, pUnitTable, nUnitType))
How can I defind the "D2CLIENT_GetUnitFromTypeAndGUID"?
ASMPTR(D2CLIENT, GetUnitFromTypeAndGUID,0xA4E20)
like this?
I think when D2CLIENT_ShopInventoryCleanUp then need call other CODE can refresh the Gamble?
because when I call D2CLIENT_ShopInventoryCleanUp the GHeed shop items will gone.
Maybe My "ShopInventoryCleanUp" defind was wrong?
FUNCPTR(D2CLIENT, ShopInventoryCleanUp, void __fastcall, (UnitAny* pVendor), 0x460A0)
How can I hook the "__usercall"?
I find out my reason.I need code the sever side too.Thank you.
Sorry, I was sleeping but yes ASMPTR(D2CLIENT, GetUnitFromTypeAndGUID,0xA4E20) would be correct. My example is using the D2Template format
It's OK,How do I judge in the gamble shop?
Thank you.I got this. now I have another questions:
How do I judge I open the gamble shop?
you need to check the ui variable for the NPC shop and there is a global var on the client if you are in the gamble screen:
#define UI_NPCSHOP 0x0C
VARPTR(D2CLIENT, IsInGambleScreen, DWORD, 0x1197A8)
__declspec(naked) int __stdcall D2CLIENT_GetUIVar_STUB(int nUIVar)
{
__asm
{
mov EAX, [esp + 4] // nUIVar
call D2CLIENT_GetUIVar // 0xBE400
retn 4
}
}
if (D2CLIENT_GetUIVar_STUB(UI_NPCSHOP) && *p_D2CLIENT_IsInGambleScreen)
{
// we are in the gamble screen
}
there are packets for opening a dialogue/trade with a vendor and I followed the packet logic through the disassembler and that global variable is set 1 when you successfully open gamble window and set to 0 when you close it