From 26624a302b58175750fb4b9553e28074cf1ca8c8 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 13 Mar 2026 10:04:25 +0100 Subject: [PATCH] fix: show true character burden --- static/script.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/static/script.js b/static/script.js index 543e2839..2cc79d07 100644 --- a/static/script.js +++ b/static/script.js @@ -1280,7 +1280,6 @@ function renderInventoryState(state) { }); // 3. Separate equipped items from pack items, excluding containers from grid - let totalBurden = 0; const packItems = new Map(); // container_id → [items] (non-container items only) // Determine the character body container_id: items with wielded_location > 0 @@ -1297,8 +1296,6 @@ function renderInventoryState(state) { }); state.items.forEach(item => { - totalBurden += (item.burden || 0); - // Skip container objects — they go in sidebar only if (containerItemIds.has(item.item_id)) return; @@ -1378,8 +1375,12 @@ function renderInventoryState(state) { } }); - state.burdenLabel.textContent = 'Burden'; - state.burdenFill.style.height = '0%'; + const stats = characterStats[state.characterName] || {}; + const burden = Number(stats.burden || 0); + const burdenUnits = Number(stats.burden_units || 0); + const burdenPct = burdenUnits > 0 ? Math.max(0, Math.min(100, (burden / burdenUnits) * 100)) : 0; + state.burdenLabel.textContent = burdenUnits > 0 ? `${burden}/${burdenUnits}` : `${burden}`; + state.burdenFill.style.height = `${burdenPct}%`; // 4. Sort containers for stable sidebar order (by unsigned item_id) containers.sort((a, b) => {