For
Gold, you have the formula right here:
Code: Select all
01645459 | 6905 F4CDC801 A0A50100 | IMUL EAX,DWORD PTR DS:[1C8CDF4],1A5A0 |
01645463 | 0305 18CEC801 | ADD EAX,DWORD PTR DS:[1C8CE18] |pointer
01645469 | 8945 F8 | MOV DWORD PTR SS:[EBP-8],EAX |
..
01645477 | 2B45 C4 | SUB EAX,DWORD PTR SS:[EBP-3C] |subtracts while at Cain and identifying something
0164547A | 8B4D F8 | MOV ECX,DWORD PTR SS:[EBP-8] |
0164547D | 8981 CC010000 | MOV DWORD PTR DS:[ECX+1CC],EAX |writes to Gold
Ah.. but that's just the visual value
The real one is read here:
Sneaky, sneaky
Ah.. so the formula actually reads Gold from the actual inventory object. It takes into account which slot is the object situated in your inventory. And this Gold object has an ID.
In the same function I see that the engine compares the actual level you're at with the maximum, which, as per the code, is 50 ("CMP EAX,32" up in the screenshot).
This is an iterator through all of the objects in your inventory:
Code: Select all
01626D2C | 8B55 F8 | MOV EDX,DWORD PTR SS:[EBP-8] |
01626D2F | 83C2 01 | ADD EDX,1 |
01626D32 | 8955 F8 | MOV DWORD PTR SS:[EBP-8],EDX |
01626D35 | 8B45 FC | MOV EAX,DWORD PTR SS:[EBP-4] |
01626D38 | 8B4D F8 | MOV ECX,DWORD PTR SS:[EBP-8] |
01626D3B | 3B88 FC5A0100 | CMP ECX,DWORD PTR DS:[EAX+15AFC] | A
01626D41 | 7D 5C | JGE th2.1626D9F |
01626D43 | 6955 F8 4B040000 | IMUL EDX,DWORD PTR SS:[EBP-8],44B |
01626D4A | 8B45 FC | MOV EAX,DWORD PTR SS:[EBP-4] |
01626D4D | 83BC10 822E0000 0B | CMP DWORD PTR DS:[EAX+EDX+2E82],B | B:'\v'
01626D55 | 75 46 | JNE th2.1626D9D |
01626D57 | 694D F8 4B040000 | IMUL ECX,DWORD PTR SS:[EBP-8],44B |
01626D5E | 8B55 FC | MOV EDX,DWORD PTR SS:[EBP-4] |
01626D61 | 8B840A 3E2F0000 | MOV EAX,DWORD PTR DS:[EDX+ECX+2F3E] |
01626D68 | 3B05 FC9CBE01 | CMP EAX,DWORD PTR DS:[1BE9CFC] |
01626D6E | 7E 16 | JLE th2.1626D86 |
01626D70 | 694D F8 4B040000 | IMUL ECX,DWORD PTR SS:[EBP-8],44B |
01626D77 | 8B55 FC | MOV EDX,DWORD PTR SS:[EBP-4] |
01626D7A | A1 FC9CBE01 | MOV EAX,DWORD PTR DS:[1BE9CFC] |
01626D7F | 89840A 3E2F0000 | MOV DWORD PTR DS:[EDX+ECX+2F3E],EAX |
01626D86 | 694D F8 4B040000 | IMUL ECX,DWORD PTR SS:[EBP-8],44B |
01626D8D | 8B55 FC | MOV EDX,DWORD PTR SS:[EBP-4] |
01626D90 | 8B45 EC | MOV EAX,DWORD PTR SS:[EBP-14] |
01626D93 | 03840A 3E2F0000 | ADD EAX,DWORD PTR DS:[EDX+ECX+2F3E] |
01626D9A | 8945 EC | MOV DWORD PTR SS:[EBP-14],EAX |
01626D9D | EB 8D | JMP th2.1626D2C |
01626D9F | 8B4D FC | MOV ECX,DWORD PTR SS:[EBP-4] |
I currently have 10 objects in there ([EAX+15AFC] == 0xA). The first
inventory object is located at offset 0x2E82 (or close to that; the code is checking a certain byte for 0xB, the Gold identifier); then all the rest of the objects are 0x44B apart from the first one. So an inventory item memory block is 0x44B bytes big.
Then 0xBC from 0x2E82 is the
quantity.
As far as IDs: 0xB = Gold; 0xC = Ring of <bla>; etc. - haven't identified all of them. I'm assuming you could unpack the .mpqs and get a list of them. Bottom line is I can write a Lua script that simply reads-up your inventory and displays it in CE's window
EDIT: So 0x2E82-0x1C would be the start of the first object in your inventory
Note that 'the first object' doesn't mean the object in the FIRST inventory slot. What you see on-screen isn't represented identically in memory.