From e3b70c1e3a20c7198f1385f86667f9b2bd76ccbc Mon Sep 17 00:00:00 2001 From: rope Date: Sun, 18 Oct 2026 14:44:48 +0100 Subject: [PATCH] Town square costs read have / need Co-Authored-By: Claude Opus 5.5 --- static/app.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/static/app.js b/static/app.js index 74f826b..17ae8b2 100644 --- a/static/app.js +++ b/static/app.js @@ -281,6 +281,11 @@ function itemChip(id, qty, have) { return `${item(id).icon} ${fmt(qty)}${have !== undefined ? ` / ${fmt(have)}` : ""}`; } +// Progress towards a building cost: "have / need". +function costChip(icon, name, need, have) { + return `${icon} ${fmt(have)} / ${fmt(need)}`; +} + // --- skill pages ---------------------------------------------------------- function skillPage(id) { @@ -439,8 +444,8 @@ function town() { for (const [key, b] of Object.entries(city.buildings)) { const spec = C.buildings[key]; const cost = b.cost ? Object.entries(b.cost).map(([id, q]) => id === "gold" - ? `🪙 ${fmt(q)} / ${fmt(city.treasury)}` - : itemChip(id, q, city.stockpile[id] || 0)).join("") : ""; + ? costChip("🪙", "Gold", q, city.treasury) + : costChip(item(id).icon, item(id).name, q, city.stockpile[id] || 0)).join("") : ""; const label = b.damaged ? "Repair" : `Build level ${b.level + 1}`; html += `
${spec.icon}