Masonry joins Construction; smith hardware; homesteader plots
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f4b2bb1320
commit
e825518c5e
6 changed files with 258 additions and 72 deletions
|
|
@ -277,7 +277,7 @@ function topbar() {
|
|||
if (!S.me) title = "Welcome to Guildhall";
|
||||
let chips = "";
|
||||
if (S.me?.action) {
|
||||
const action = C.actions.find((a) => a.id === S.me.action.id);
|
||||
const action = C.actions.find((a) => a.id === (S.me.action.growing || S.me.action.id));
|
||||
chips += `<button class="chip act" data-nav="skill:${action.skill}">${skillOf(action.skill).icon} <span class="label">${esc(action.name)}</span><span class="bar mini"><span data-progress></span></span></button>`;
|
||||
} else if (S.me) {
|
||||
chips += `<span class="chip muted">Idle${S.me.stopped ? ` · ${esc(S.me.stopped)}` : ""}</span>`;
|
||||
|
|
@ -343,6 +343,7 @@ function skillPage(id) {
|
|||
if (id === "prayer") html += prayerPanel();
|
||||
if (id === "construction") html += S.city.construction ? siteBanner()
|
||||
: `<div class="panel muted">Nothing is being built right now. Fund a building on the Town square and its site opens here.</div>`;
|
||||
if (id === "farming" && me.cls === "homesteader") html += plotsPanel();
|
||||
html += potionPanel(id);
|
||||
if (`tool_${id}` in me.equip) html += toolPanel(id);
|
||||
if (id === "reconnaissance") html += `<div class="panel small muted">Reconnaissance on a coming threat raises its intel. Each level takes more than the last, a bigger band takes longer to read, and the sharpest news (the exact day and their camp) only comes in the last hours before they strike. The spymaster's guild adds to every point and gathers some on its own. The council & threats page shows the progress.</div>`;
|
||||
|
|
@ -375,6 +376,16 @@ function isLocked(a) {
|
|||
return Boolean(why && (why.startsWith("Needs") || why.startsWith("Only")));
|
||||
}
|
||||
|
||||
// A homesteader's two plots: one crop 30% faster, or two crops sharing a 20% faster pace.
|
||||
function plotsPanel() {
|
||||
const a = S.me.action, farming = a && C.actions.find((x) => x.id === a.id)?.skill === "farming";
|
||||
const name = (id) => esc(C.actions.find((x) => x.id === id).name);
|
||||
const status = !farming ? `<span class="muted">Start a crop to plant your first plot.</span>`
|
||||
: a.plot2 ? `Plot 1: <b>${name(a.id)}</b> · Plot 2: <b>${name(a.plot2)}</b> <span class="muted">· harvests alternate, together 20% faster than one crop</span>`
|
||||
: `Plot 1: <b>${name(a.id)}</b> · Plot 2: <span class="muted">empty, so you're focused: 30% faster. Use "Plot 2" on another crop to grow both.</span>`;
|
||||
return `<div class="panel tool-panel"><span>🌱 ${status}</span></div>`;
|
||||
}
|
||||
|
||||
// The skill's active potion, or the ones in the bank that could be drunk for it.
|
||||
function potionPanel(skill) {
|
||||
const me = S.me;
|
||||
|
|
@ -476,6 +487,10 @@ function itemStats(id) {
|
|||
function actionCard(a) {
|
||||
const me = S.me;
|
||||
const active = me.action?.id === a.id;
|
||||
const second = me.action?.plot2 === a.id; // a homesteader's second plot
|
||||
const growingNow = me.action?.growing === a.id;
|
||||
const canPlot = me.cls === "homesteader" && a.skill === "farming" && !a.special && !active && !second
|
||||
&& me.action && C.actions.find((x) => x.id === me.action.id)?.skill === "farming" && !me.action.left;
|
||||
const why = me.blocked[a.id];
|
||||
const locked = isLocked(a);
|
||||
const out = Object.keys(a.outputs)[0];
|
||||
|
|
@ -516,19 +531,22 @@ function actionCard(a) {
|
|||
const made = Object.keys(a.outputs).map(itemStats).filter(Boolean);
|
||||
if (made.length) extra += `<div class="small makes">${made.join(" · ")}</div>`;
|
||||
return `
|
||||
<div class="action ${active ? "active" : ""} ${locked ? "locked" : ""}">
|
||||
<div class="action ${active || second ? "active" : ""} ${locked ? "locked" : ""}">
|
||||
<div class="top"><div class="ico">${icon}</div><div>
|
||||
<div class="name">${esc(a.name)}</div>
|
||||
<div class="sub">Level ${a.level} · ${dur(time)} · ${a.xp} XP</div>
|
||||
</div></div>
|
||||
${io ? `<div class="io">${io}</div>` : ""}
|
||||
${extra}
|
||||
${active ? `<div class="bar thick"><span data-progress></span></div>` : ""}
|
||||
${me.action?.plot2 && (active || second) ? `<div class="small muted">Plot ${active ? 1 : 2}${growingNow ? " · growing now" : " · next"}</div>` : ""}
|
||||
${growingNow ? `<div class="bar thick"><span data-progress></span></div>` : ""}
|
||||
${active && me.action.left ? `<div class="small muted">Just one${me.action.resume ? `, then back to ${esc(C.actions.find((x) => x.id === me.action.resume).name.toLowerCase())}` : ""}</div>` : ""}
|
||||
<div class="foot">
|
||||
<span class="why">${!active && why ? esc(why) : ""}</span>
|
||||
${active ? `<button class="btn danger" data-stop>Stop</button>`
|
||||
<span class="why">${!active && !second && why ? esc(why) : ""}</span>
|
||||
${second ? `<button class="btn" data-plot="">Clear plot 2</button>`
|
||||
: active ? `<button class="btn danger" data-stop>Stop</button>`
|
||||
: `<span class="btns"><button class="btn" data-once="${a.id}" ${why ? "disabled" : ""} title="Do this once, then go back to what you were doing">${"difficulty" in a ? "Fight once" : Object.keys(a.outputs).length ? "Make one" : "Once"}</button>
|
||||
${canPlot ? `<button class="btn" data-plot="${a.id}" ${why ? "disabled" : ""} title="Grow this in your second plot as well">Plot 2</button>` : ""}
|
||||
<button class="btn primary" data-start="${a.id}" ${why ? "disabled" : ""}>Start</button></span>`}
|
||||
</div>
|
||||
</div>`;
|
||||
|
|
@ -1093,6 +1111,7 @@ document.addEventListener("click", (e) => {
|
|||
if (d.unequip) return act("/api/equip", { slot: d.unequip });
|
||||
if (d.fund) return act("/api/fund", { building: d.fund, item: d.item, source: d.source, qty: "all" });
|
||||
if (d.install) return act("/api/install", { fitting: d.install, source: d.source });
|
||||
if ("plot" in d) return act("/api/plot", { id: d.plot || null });
|
||||
if (d.garrison) return act("/api/garrison", { join: d.garrison === "1" });
|
||||
if (d.perk) return act("/api/perk", { perk: d.perk });
|
||||
if (d.favour) return act("/api/favour", { kind: d.favour });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue