feat(net): #13 register PD trailer inventory+equipped in ItemRepository
After PlayerDescription is dispatched, the Inventory and Equipped lists produced by the parser are now fed into ItemRepository via AddOrUpdate + MoveItem so inventory/paperdoll panels see items after login. Acceptance test PlayerDescription_RegistersInventoryEntries_InItemRepository confirms ItemCount goes 0→2 for a synthetic PD with two inventory entries. 282 Net.Tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
58095d8d4b
commit
078919cc18
2 changed files with 82 additions and 0 deletions
|
|
@ -395,6 +395,41 @@ public static class GameEventWiring
|
|||
if (dumpPd)
|
||||
Console.WriteLine($"vitals: PD-ench spell={ench.SpellId} layer={ench.Layer} bucket={ench.Bucket} key={ench.StatModKey} val={ench.StatModValue}");
|
||||
}
|
||||
|
||||
// Issue #13 — register inventory entries with ItemRepository so
|
||||
// panels (inventory, paperdoll, hotbars) light up after login.
|
||||
// Equipped entries share the same ObjectId as inventory entries
|
||||
// (an equipped item is also in inventory) — register both, but
|
||||
// the equipped record carries the slot mask which we surface via
|
||||
// MoveItem so paperdoll can render.
|
||||
foreach (var inv in p.Value.Inventory)
|
||||
{
|
||||
if (items.GetItem(inv.Guid) is null)
|
||||
{
|
||||
items.AddOrUpdate(new ItemInstance
|
||||
{
|
||||
ObjectId = inv.Guid,
|
||||
WeenieClassId = inv.ContainerType,
|
||||
});
|
||||
}
|
||||
}
|
||||
foreach (var eq in p.Value.Equipped)
|
||||
{
|
||||
if (items.GetItem(eq.Guid) is null)
|
||||
{
|
||||
items.AddOrUpdate(new ItemInstance
|
||||
{
|
||||
ObjectId = eq.Guid,
|
||||
WeenieClassId = 0,
|
||||
});
|
||||
}
|
||||
// Reflect the equip slot — paperdoll uses CurrentlyEquippedLocation.
|
||||
items.MoveItem(
|
||||
itemId: eq.Guid,
|
||||
newContainerId: 0,
|
||||
newSlot: -1,
|
||||
newEquipLocation: (EquipMask)eq.EquipLocation);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue