feat(ui): D.2b inventory finish — contents grid shows full main-pack capacity
The contents grid now pads empty slot frames up to the main-pack capacity (player ItemsCapacity, default 102 per retail "up to 102 items"), so the pack reads like retail's fixed 102-slot grid you scroll through — not just the loose items. Mirrors the side-bag column padding. Three existing grid tests updated for the now-padded count; new test covers the 102-pad. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a1e7041ba8
commit
1be7e65fad
2 changed files with 36 additions and 4 deletions
|
|
@ -36,6 +36,7 @@ public sealed class InventoryController
|
|||
private const float ContentsCellPx = 32f; // gm3DItemsUI grid (192x96 = 6x3 of 32px)
|
||||
private const float BackpackCellPx = 36f; // gmBackpackUI column cells (0x100001C9/CA = 36px)
|
||||
private const int SideBagSlots = 7; // 0x100001CA is 36x252 = 7 slots
|
||||
private const int MainPackSlots = 102; // retail main-pack capacity (Wiki: "up to 102 items")
|
||||
|
||||
private readonly ClientObjectTable _objects;
|
||||
private readonly Func<uint> _playerGuid;
|
||||
|
|
@ -179,6 +180,18 @@ public sealed class InventoryController
|
|||
list.AddItem(cell);
|
||||
}
|
||||
|
||||
// Contents grid: show the FULL main-pack capacity (default 102) — occupied slots + empty
|
||||
// frames — so the pack reads like retail (a fixed 102-slot grid you scroll), not just the
|
||||
// loose items. The grid shows the SELECTED pack (default = the main pack / player); side-pack
|
||||
// contents are a container-switch (later). Capacity = the player's ItemsCapacity, else 102.
|
||||
if (_contentsGrid is not null)
|
||||
{
|
||||
int cap = _objects.Get(p)?.ItemsCapacity ?? 0;
|
||||
int slots = cap > 0 ? cap : MainPackSlots;
|
||||
while (_contentsGrid.GetNumUIItems() < slots)
|
||||
_contentsGrid.AddItem(new UiItemSlot { SpriteResolve = _contentsGrid.SpriteResolve });
|
||||
}
|
||||
|
||||
// Side-bag column: pad with empty slot frames up to the player's container capacity
|
||||
// (clamped to the 7-slot column) so it reads like retail (bags on top, empty frames
|
||||
// below) rather than one lone cell. Falls back to the full 7 slots when capacity is
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue