fix(v2): pack capacity from enhanced_properties.ItemSlots_Decal
The inventory service doesn't return items_capacity directly — it's in enhanced_properties.ItemSlots_Decal. Updated normalizer to read from there. Also defaults to 24 (standard AC pack size) with || instead of ?? to catch 0/undefined/null. Removed debug console.logs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8e77274316
commit
bd8ad863d1
3 changed files with 16 additions and 20 deletions
|
|
@ -16,7 +16,7 @@ function normalizeItem(raw: any): any {
|
|||
object_class: raw.object_class ?? raw.ObjectClass ?? 0,
|
||||
current_wielded_location: raw.current_wielded_location ?? v(raw.CurrentWieldedLocation) ?? v(Number(iv['10'])) ?? 0,
|
||||
container_id: raw.container_id ?? raw.ContainerId ?? 0,
|
||||
items_capacity: raw.items_capacity ?? v(raw.ItemsCapacity) ?? v(Number(iv['6'])) ?? undefined,
|
||||
items_capacity: raw.items_capacity ?? v(raw.ItemsCapacity) ?? v(Number(iv['6'])) ?? raw.enhanced_properties?.ItemSlots_Decal ?? undefined,
|
||||
value: raw.value ?? v(raw.Value) ?? v(Number(iv['19'])) ?? 0,
|
||||
burden: raw.burden ?? v(raw.Burden) ?? v(Number(iv['5'])) ?? 0,
|
||||
armor_level: raw.armor_level ?? v(raw.ArmorLevel),
|
||||
|
|
@ -246,10 +246,6 @@ export const InventoryWindow: React.FC<Props> = ({ id, charName, zIndex }) => {
|
|||
packItems.get(cid)!.push(item);
|
||||
}
|
||||
});
|
||||
// Debug: log pack mapping
|
||||
console.log('[INV DEBUG] containers:', containers.map((c: any) => ({ id: c.item_id, name: c.name })));
|
||||
console.log('[INV DEBUG] packItems keys:', [...packItems.keys()]);
|
||||
console.log('[INV DEBUG] packItems sizes:', [...packItems.entries()].map(([k, v]) => `${k}: ${v.length}`));
|
||||
return { equippedMap, containers, packItems };
|
||||
}, [items]);
|
||||
|
||||
|
|
@ -344,7 +340,7 @@ export const InventoryWindow: React.FC<Props> = ({ id, charName, zIndex }) => {
|
|||
const cid = c.item_id;
|
||||
// Count items directly from normalized items array instead of relying on packItems map
|
||||
const childCount = items.filter((i: any) => i.container_id === cid && i.item_id !== cid).length;
|
||||
const cap = c.items_capacity ?? 24;
|
||||
const cap = c.items_capacity || 24;
|
||||
const pct = cap > 0 ? Math.min(100, (childCount / cap) * 100) : 0;
|
||||
return <PackIcon key={cid} iconSrc={`/icons/${iconHex(c.icon)}.png`} isActive={activePack === cid}
|
||||
fillPct={pct}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -5,7 +5,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Mosswart Overlord v2</title>
|
||||
<link rel="icon" type="image/png" href="/icons/7735.png" />
|
||||
<script type="module" crossorigin src="/v2/assets/index-Cr-mAy3C.js"></script>
|
||||
<script type="module" crossorigin src="/v2/assets/index-BsSx0FFr.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/v2/assets/index-DrsM2PEe.css">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue