Recipe inputs show have / need

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-20 19:49:30 +01:00
parent 8dd33cbb40
commit 0d33e09799
2 changed files with 10 additions and 1 deletions

8
CLAUDE.md Normal file
View file

@ -0,0 +1,8 @@
# Guildhall
## UI rules
- Every requirement/progress ratio is **have / need** (e.g. `0 / 1` when one is
needed and none is held) — recipe inputs, building costs, order slots, gold,
tooltips, server messages. Never `need / have`.
- In-game text is terse: icons and numbers over prose, details in tooltips.

View file

@ -400,9 +400,10 @@ function pageHtml() {
return ({ town, council, orders, board, roster, bank }[page] || town)();
}
// Recipe input as "have / need"; without `have`, just the quantity.
function itemChip(id, qty, have) {
const short = have !== undefined && have < qty;
return `<span class="item-chip ${short ? "short" : ""}" title="${esc([item(id).name, itemStats(id)].filter(Boolean).join(": "))}">${item(id).icon} ${fmt(qty)}${have !== undefined ? ` <span class="have">/ ${fmt(have)}</span>` : ""}</span>`;
return `<span class="item-chip ${short ? "short" : ""}" title="${esc([item(id).name, itemStats(id)].filter(Boolean).join(": "))}">${item(id).icon} ${have !== undefined ? `${fmt(have)} <span class="have">/ ${fmt(qty)}</span>` : fmt(qty)}</span>`;
}
// Progress towards a building cost: "have / need".