Potion stacks in every player inventory and the chest, not in trader stock

The chest is inventory 0x11 and already saved as JSON; stacking now applies
to all inventories below 0x12. Traders keep selling single potions.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
khallaandClaude Opus 5.5 committed 2026-10-17 01:37:48 +02:00
1 parent 13b91cdd3d
commit 3d9d864c25
3 files changed
+43 -27

No files matched your search

+10 -1
View File
@@ -42,7 +42,16 @@ constexpr size_t kInventoryGrid = 0x18;
constexpr size_t kGridCellSize = 0xc;
constexpr size_t kGridWidth = 0x115c; // u16, 0x14
constexpr size_t kGridHeight = 0x115e; // u16, 8
constexpr size_t kInventoryOwner = 0x1160; // u16: player index (heroes < 0x12)
constexpr size_t kInventoryOwner = 0x1160; // u16: = the inventory's index (measured)
// Inventories below 0x12 belong to the players (index = hero id) and the
// chest (0x11, saved with the hero as chunk 0xc6); PlaceItem / RemoveAt only
// update the hero below that. Traders use higher ones (22 measured).
constexpr uint16_t kPlayerInventoryEnd = 0x12;
constexpr uint16_t kChestInventory = 0x11;
inline bool IsPlayerInventory(const uint8_t* inventory) {
return *reinterpret_cast<const uint16_t*>(inventory + kInventoryOwner) < kPlayerInventoryEnd;
}
inline unsigned GridCells(const uint8_t* inventory) {
return *reinterpret_cast<const uint16_t*>(inventory + kGridWidth) *