MQ2Utilities.cpp:
Code: Select all
PCONTENTS GetItemContentsBySlotID(DWORD dwSlotID)
{
int InvSlot=-1;
int SubSlot=-1;
if(dwSlotID>=0 && dwSlotID<NUM_INV_SLOTS) InvSlot=dwSlotID;
else if(dwSlotID>=262 && dwSlotID<342) {
InvSlot=23+(dwSlotID-262)/10;
SubSlot=(dwSlotID-1)%10;
}
if(InvSlot>=0 && InvSlot<NUM_INV_SLOTS) {
if(PCONTENTS iSlot=GetCharInfo2()->InventoryArray[InvSlot]) {
if(SubSlot<0) return iSlot;
if(PCONTENTS sSlot=GetCharInfo2()->InventoryArray[InvSlot]->Contents[SubSlot]) return sSlot;
}
}
return NULL;
}Code: Select all
SubSlot=(dwSlotID-2)%10


