fix: show true character burden

This commit is contained in:
Erik 2026-03-13 10:04:25 +01:00
parent 7013288152
commit 26624a302b

View file

@ -1280,7 +1280,6 @@ function renderInventoryState(state) {
}); });
// 3. Separate equipped items from pack items, excluding containers from grid // 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) const packItems = new Map(); // container_id → [items] (non-container items only)
// Determine the character body container_id: items with wielded_location > 0 // Determine the character body container_id: items with wielded_location > 0
@ -1297,8 +1296,6 @@ function renderInventoryState(state) {
}); });
state.items.forEach(item => { state.items.forEach(item => {
totalBurden += (item.burden || 0);
// Skip container objects — they go in sidebar only // Skip container objects — they go in sidebar only
if (containerItemIds.has(item.item_id)) return; if (containerItemIds.has(item.item_id)) return;
@ -1378,8 +1375,12 @@ function renderInventoryState(state) {
} }
}); });
state.burdenLabel.textContent = 'Burden'; const stats = characterStats[state.characterName] || {};
state.burdenFill.style.height = '0%'; 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) // 4. Sort containers for stable sidebar order (by unsigned item_id)
containers.sort((a, b) => { containers.sort((a, b) => {