Project-Diablo-2 / BH

A modified version of slashdiablo's BH for Project Diablo 2
GNU Affero General Public License v3.0
24 stars 20 forks source link

SlotPixelHeight Issue: INT_DIVIDEBY_ZERO crash #34

Closed croboy closed 4 months ago

croboy commented 8 months ago

Hello :)

I just wanted to ask, are these Pointers correct for PD2 1.13c? FUNCPTR(D2CLIENT, LeftClickItem, void __stdcall, (UnitAny pPlayer, Inventory pInventory, int x, int y, DWORD dwClickType, InventoryLayout* pLayout, DWORD Location), 0x96AA0, 0x9AFF0) // 1.12

VARPTR(D2CLIENT, InventoryLayout, InventoryLayout*, 0x10B3E0, 0x1016F0)

I'm trying to use D2CLIENT_LeftClickItem to click on an item in my Inventory, but keep getting an error INT_DIVIDEBY_ZERO crash. When I printed the values, it looks like SlotPixelHeight is returning zero? Here are the values returned from printing: SlotPixelWidth = 46 SlotPixelHeight = 0

Not sure what I'm doing wrong, would appreciate any help. This how I am using the command: (coordX and coordY are both zero to try and click the very first item in the top left of inventory) //////////////////////////////////////////////////////////// UnitAny pUnit = D2CLIENT_GetPlayerUnit(); InventoryLayout pLayout = (InventoryLayout)p_D2CLIENT_InventoryLayout; Inventory pPlayerInventory = pUnit->pInventory;

int x = pLayout->Left + coordX pLayout->SlotPixelWidth + 10; int y = pLayout->Top + coordY pLayout->SlotPixelHeight + 10;

*p_D2CLIENT_CursorHoverX = x;
*p_D2CLIENT_CursorHoverY = y;
PrintText(0, "Inventory X: %i", x);
PrintText(0, "Inventory Y: %i", y);

D2CLIENT_LeftClickItem(pUnit, pPlayerInventory, x, y, nClickType, pLayout, 0); /////////////////////////////////////////////////////////////

I just want to be able to LeftClickItem in my Inventory. Would really appreciate any help :)

Thanks heaps

croboy commented 8 months ago

Feel free to reach me on Discord: neddles