GustavoHMA 15 Report post Posted February 10, 2017 @V3ct0r @KONG @Wrexor @Billy @Totoka Could anyone help me with assembly code or C++ dll injection to be able to count the items from a specific slot using Lua? Something like: CheckBagSlotItem(role, itemid, slotid) Thanks to all who can help. Quote Share this post Link to post Share on other sites
MonkeyCode 453 Report post Posted February 10, 2017 inline int lua_GetItemQuantity(lua_State *pLS) { bool bSuccess = true; int nParaNum = lua_gettop(pLS); if (nParaNum != 1) { bSuccess = false; goto End; } SItemGrid *pSItem = (SItemGrid*)lua_touserdata(pLS, 1); if (!pSItem) { bSuccess = false; goto End; } End: if (bSuccess) lua_pushnumber(pLS, pSItem->sNum); else lua_pushnumber(pLS, 0); return 1; } If C++ injection, would need to know the structures and mem layout of SItemGrid. Then, I think with asm it is abit easier. 1 Quote Share this post Link to post Share on other sites
GustavoHMA 15 Report post Posted February 10, 2017 (edited) 2 hours ago, KONG said: If C++ injection, would need to know the structures and mem layout of SItemGrid. How can I make these structures for version 1.36? Edited February 10, 2017 by GustavoHMA Quote Share this post Link to post Share on other sites
MonkeyCode 453 Report post Posted February 11, 2017 1.36 SItemGrid.h typedef struct SItemGrid { short dontCare; short sNum; } SItemGrid; LuaAddy: static int(*lua_gettop)(lua_State *L) = (int(*)(lua_State *L))0x00576FD0; static void*(*lua_touserdata)(lua_State *L, int) = (void* (*)(lua_State *L, int))0x005775F0; static void(*lua_pushnil)(lua_State *L) = (void(*)(lua_State *L))0x005776D0; + Register the Lua function + Compile and Inject Usage: local item = GetChaItem(role, 2, slot) -- -1 < slot < 48 local itemQty = GetItemQuantity(item) 1 Quote Share this post Link to post Share on other sites
GustavoHMA 15 Report post Posted February 11, 2017 Thank you very much @KONG, I'll see if I can. Quote Share this post Link to post Share on other sites