Work orders: craft your own
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5606267df5
commit
4eb23fc009
3 changed files with 37 additions and 15 deletions
|
|
@ -2508,7 +2508,7 @@ function orderNews(state) {
|
|||
toast(`📜 ${o.city ? "🏘️ " : ""}${item(o.item).name}${o.qty > 1 ? ` ×${fmt(o.qty)}` : ""}${o.reward || !o.city ? ` · ${fmt(o.reward)} gold` : ""}`, "level");
|
||||
}
|
||||
const was = deliveredSeen[o.id];
|
||||
if (o.by === uid && !o.city && was !== undefined && o.delivered > was) toast(`📦 ${item(o.item).name} ×${fmt(o.delivered - was)}`, "good");
|
||||
if (o.by === uid && !o.city && o.claimed !== uid && was !== undefined && o.delivered > was) toast(`📦 ${item(o.item).name} ×${fmt(o.delivered - was)}`, "good");
|
||||
const got = (o.earned || {})[uid] || 0, had = earnedSeen[o.id];
|
||||
if (had !== undefined && got > had) toast(`🤝 ${item(o.item).name} · +${fmt(got - had)} gold`, "good");
|
||||
// Favour from your reagents in someone else's make: your own makes show in the summary.
|
||||
|
|
@ -2572,13 +2572,13 @@ function orderCard(o) {
|
|||
? ` · ${Object.entries(o.from).map(([uid, n]) => `${esc(playerName(uid))} ${fmt(n)}`).join(", ")}` : ""}</div>
|
||||
<div class="bar"><span style="width:${o.delivered / o.qty * 100}%"></span></div>` : "";
|
||||
let buttons = "", status = "";
|
||||
// Your city order is still yours to cancel, and anyone's to fill: you too.
|
||||
const cancel = mine && o.city ? `<button class="btn danger" data-order-cancel="${o.id}">Cancel</button>` : "";
|
||||
// Your order is still yours to cancel while you (or, on a city order, anyone) fill it.
|
||||
const cancel = mine ? `<button class="btn danger" data-order-cancel="${o.id}">Cancel</button>` : "";
|
||||
if (o.status !== "open") {
|
||||
status = `<span class="tag ${o.status === "done" ? "good" : ""}">${{ done: "Done", cancelled: "Cancelled", expired: "Expired" }[o.status]}</span>`;
|
||||
if (mine && !o.held) buttons = `<button class="btn" data-order-remove="${o.id}">Remove</button>`;
|
||||
} else if (mine && !o.city) {
|
||||
buttons = `<button class="btn danger" data-order-cancel="${o.id}">Cancel</button>`;
|
||||
} else if (mine && !o.city && (o.kind === "gather" || short || o.claimed && o.claimed !== S.uid)) {
|
||||
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>`;
|
||||
|
|
@ -2590,7 +2590,7 @@ function orderCard(o) {
|
|||
const why = short ? `Needs ${skill.name.toLowerCase()} ${o.level}` : S.me.blocked[o.action] && !working
|
||||
&& !S.me.blocked[o.action].startsWith("Out of") ? S.me.blocked[o.action] : "";
|
||||
buttons = `${cancel}${o.claimed === S.uid || o.city && working ? `<button class="btn" data-order-drop="${o.id}">Drop</button>` : ""}
|
||||
${have ? `<button class="btn" data-order-deliver="${o.id}">Deliver ${fmt(Math.min(have, left))}</button>` : ""}
|
||||
${have && (!mine || o.city) ? `<button class="btn" data-order-deliver="${o.id}">Deliver ${fmt(Math.min(have, left))}</button>` : ""}
|
||||
${working ? `<span class="tag gold">Crafting</span>` : `<button class="btn primary" data-order-work="${o.id}" ${why ? `disabled title="${esc(why)}"` : ""}>Craft</button>`}`;
|
||||
}
|
||||
const reward = o.kind === "gather" ? `${fmt(Math.round(o.reward / o.qty))} each` : fmt(o.reward);
|
||||
|
|
@ -2625,9 +2625,8 @@ function orderPicker(list) {
|
|||
const q = (d.search || "").trim().toLowerCase();
|
||||
const shown = q ? actions.filter(([id]) => item(id).name.toLowerCase().includes(q))
|
||||
: inSkill.filter(([, a]) => !groups.length || a.group === d.group);
|
||||
const others = S.players.filter((p) => p.id !== S.uid || d.city); // a city order you can make yourself
|
||||
const tiles = shown.sort((x, y) => x[1].level - y[1].level).map(([id, a]) => {
|
||||
const makers = others.filter((p) => p.levels[a.skill] >= a.level).length;
|
||||
const makers = S.players.filter((p) => p.levels[a.skill] >= a.level).length;
|
||||
const tip = `${item(id).name} · ${skillOf(a.skill).name} ${a.level}${d.kind === "craft" ? ` · 👥 ${makers}` : ""}`;
|
||||
return `<button class="doll-slot swap pick ${d.item === id ? "on" : ""} ${d.kind === "craft" && !makers ? "nobody" : ""}" data-draft-item="${id}" title="${esc(tip)}">
|
||||
${item(id).icon}<span class="pick-name">${esc(item(id).name)}${d.kind === "craft" ? ` <span class="muted">👥 ${makers}</span>` : ""}</span><span class="pick-lvl">${a.level}</span></button>`;
|
||||
|
|
@ -2650,7 +2649,7 @@ function orderComposer() {
|
|||
let slots = "", maker = "";
|
||||
const a = d.item && C.actions.find((x) => x.id === list[d.item]);
|
||||
if (a) {
|
||||
const smiths = S.players.filter((p) => (p.id !== S.uid || d.city) && p.levels[a.skill] >= a.level).length;
|
||||
const smiths = S.players.filter((p) => p.levels[a.skill] >= a.level).length;
|
||||
maker = `<div class="small muted" title="${esc(`${skillOf(a.skill).name} ${a.level} · ${smiths} can make it`)}">${skillOf(a.skill).icon} ${a.level} · 👥 ${smiths}</div>`;
|
||||
if (d.kind === "craft") {
|
||||
const runs = Math.ceil(d.qty / a.outputs[d.item]), ins = runInputs(a);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue