Work orders: gather button on material orders

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-11-04 22:03:15 +00:00
parent 70ecc54606
commit c5b0c490cd
2 changed files with 17 additions and 4 deletions

View file

@ -7787,6 +7787,9 @@ ORDER_RECIPES, ORDER_RAW = _order_sources()
# What changed, shown on the Patch notes page. Newest first; every shipped change adds a
# line here (new / balance / fix), and a new release a new entry on top.
PATCH_NOTES = [
{"date": "2026-11-04", "title": "Work orders", "notes": [
("new", "Work orders: Gather button on material orders. Fight-only materials link to the fight."),
]},
{"date": "2026-11-04", "title": "Roster", "notes": [
("new", "Roster table shows each player's town."),
]},

View file

@ -901,11 +901,11 @@ function queueRow() {
// Start, or while a make runs: After Q sets what comes once it and the queue are done,
// and on that one, Skip Q drops them and starts it now.
function startButton(a, size, why) {
function startButton(a, size, why, start = "Start") {
const making = S.me.action?.left, after = making && S.me.action.resume === a.id;
const [label, title] = !making ? ["Start", ""] : after ? ["Skip Q", "Skip queue: drop the make and queue, start this now"]
const [label, title] = !making ? [start, ""] : after ? ["Skip Q", "Skip queue: drop the make and queue, start this now"]
: ["After Q", "After queue: do this once the make and queue are done"];
return `<button class="btn ${size} primary" data-start="${a.id}" ${after ? "data-skip" : ""} ${why ? "disabled" : ""} ${title ? `title="${title}"` : ""}>${label}</button>`;
return `<button class="btn ${size} primary" data-start="${a.id}" ${after ? "data-skip" : ""} ${why ? "disabled" : ""} ${why || title ? `title="${esc(why || title)}"` : ""}>${label}</button>`;
}
// The recipe you're after, under the top bar on every page: have / need for each input.
@ -2746,6 +2746,15 @@ function orderSlots(o) {
}).join("");
}
// A materials order: gather it right here. A fight opens its card instead, odds and all.
function gatherButton(o) {
const a = sourceOf(o.item);
if (!a) return "";
if (S.me.action?.id === a.id) return `<span class="tag gold">${a.enemy ? "Fighting" : "Gathering"}</span>`;
if (a.enemy) return `<button class="btn primary"${goto(o.item)} title="${esc(a.name)}">Fight</button>`;
return startButton(a, "", S.me.blocked[a.id], "Gather");
}
function orderCard(o) {
const it = item(o.item), mine = o.by === S.uid, skill = skillOf(o.skill);
const short = S.me.levels[o.skill] < o.level, have = S.me.bank[o.item] || 0, left = o.qty - o.delivered;
@ -2763,7 +2772,8 @@ function orderCard(o) {
buttons = cancel;
if (o.claimed) status = `<span class="tag">${esc(playerName(o.claimed))}</span>`;
} else if (o.kind === "gather") {
buttons = `${cancel}<button class="btn primary" data-order-deliver="${o.id}" ${have ? "" : "disabled"}>Deliver ${fmt(Math.min(have, left))}</button>`;
const gather = gatherButton(o);
buttons = `${cancel}${have || !gather ? `<button class="btn ${gather ? "" : "primary"}" data-order-deliver="${o.id}" ${have ? "" : "disabled"}>Deliver ${fmt(Math.min(have, left))}</button>` : ""}${gather}`;
} else if (o.claimed && o.claimed !== S.uid) {
status = `<span class="tag">${esc(playerName(o.claimed))}</span>`;
buttons = cancel;