Work orders: gather straight into the order
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5809be59de
commit
450abc9be9
4 changed files with 79 additions and 19 deletions
|
|
@ -2760,13 +2760,15 @@ function orderSlots(o) {
|
|||
}).join("");
|
||||
}
|
||||
|
||||
// A materials order: gather it right here. A fight opens its card instead, odds and all.
|
||||
// A materials order: gather for it right here, straight into the order. 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 (S.me.action?.order === o.id || a.enemy && 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");
|
||||
const why = S.me.levels[o.skill] < o.level ? `Needs ${skillOf(o.skill).name.toLowerCase()} ${o.level}` : S.me.blocked[a.id];
|
||||
return `<button class="btn primary" data-order-work="${o.id}" data-via="${a.id}" ${why ? `disabled title="${esc(why)}"` : `title="${esc(a.name)} → order"`}>Gather</button>`;
|
||||
}
|
||||
|
||||
function orderCard(o) {
|
||||
|
|
@ -2814,7 +2816,7 @@ function orderCard(o) {
|
|||
${o.kind === "craft" ? `<div class="ro-slots">${orderSlots(o)}</div>` : ""}
|
||||
${Object.keys(o.earned || {}).length ? `<div class="small muted">🤝 ${Object.entries(o.earned).map(([uid, n]) => `${esc(playerName(uid))} ${fmt(n)}`).join(", ")}</div>` : ""}
|
||||
${favoured.length ? `<div class="small muted">${FAVOUR} ${favoured.map(([uid, n]) => `${esc(playerName(uid))} ${fmt(Math.round(n))}`).join(", ")}</div>` : ""}
|
||||
${crafting.length ? `<div class="small muted" title="Crafting now">${skill.icon} ${crafting.map((p) => esc(p.name)).join(", ")}</div>` : ""}
|
||||
${crafting.length ? `<div class="small muted" title="${o.kind === "gather" ? "Gathering" : "Crafting"} now">${skill.icon} ${crafting.map((p) => esc(p.name)).join(", ")}</div>` : ""}
|
||||
${progress}
|
||||
<div class="foot">${o.reward || !o.city ? `<span class="item-chip ro-reward">${COIN} ${reward}</span>` : ""}${favour}${status}<span class="btns">${buttons}</span></div>
|
||||
</div>`;
|
||||
|
|
@ -3463,7 +3465,7 @@ document.addEventListener("click", (e) => {
|
|||
return api("/api/order", body).then((state) => { draft = null; orderTab = "yours"; accept(state); }).catch((err) => toast(err.message, "bad"));
|
||||
}
|
||||
if (d.otab) { orderTab = d.otab; return render(); }
|
||||
if (d.orderWork) return act("/api/order/work", { id: Number(d.orderWork) });
|
||||
if (d.orderWork) return act("/api/order/work", { id: Number(d.orderWork), via: d.via || null });
|
||||
if (d.orderDrop) return act("/api/order/drop", { id: Number(d.orderDrop) });
|
||||
if (d.orderDeliver) return act("/api/order/deliver", { id: Number(d.orderDeliver) });
|
||||
if (d.orderCancel) return act("/api/order/cancel", { id: Number(d.orderCancel) });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue