I FOUND THE SLOT NUMBERS!
The clue was when I saw in some functions on the rumes of magic wiki (eg. GetBagItemInfo()) they list the slot numbers from 1-257 (I don't know why it accepts 257). So I thought "maybe the slot numbers 1-256 are saved as 0-255 (ie. 00-ff).
So when I minus'ed 1 from the values I was looking for I found it.
So here it is.
It's a static list of byte values starting at 0x9C87A0.
So to get the BagId for the 5th bag slot you would get the value from the 5th address which is 0x9C87A4 and add 1 to it.
So the way it could work is self.BagSlot[slotNumber].SlotNumber can now go back to equaling slotNumber. So when you update an item, you are actually updating the bag slot.
In CPawn:update() you just need to get the BagId first then work out the Address as usual. Very little else has to change. Actually it's so small a job I think I'll do it myself.
Here it is. Initial tests shows everything working. Can someone else please double check it. To save you the trouble, here is a bit of code I wrote to print out some inventory info
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
repeat
inventory:update()
for i = 1,60 do
printf( i .. " " .. inventory.BagSlot[i].SlotNumber .. " " .. inventory.BagSlot[i].BagId .. " " .. tostring(inventory.BagSlot[i].Name) .. "\n")
end
player:sleep()
until false
</onLoad>
</waypoints>