Crafting stations, strongboxes and bags
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
636123e454
commit
722cf0b382
6 changed files with 182 additions and 14 deletions
|
|
@ -510,14 +510,14 @@ function skillGear(skill) {
|
|||
${others ? `<div class="swap-grid">${others}</div>` : ""}</div>`);
|
||||
}
|
||||
if (`tool_${skill}` in me.equip) {
|
||||
const id = me.equip[`tool_${skill}`], it = id && item(id);
|
||||
const id = me.equip[`tool_${skill}`], it = id && item(id), noTool = C.stations.includes(skill) ? "No station" : "No tool";
|
||||
const others = Object.keys(me.bank).filter((x) => item(x).tool === skill).sort((a, b) => item(b).speed - item(a).speed).map((x) => {
|
||||
const [s, level] = item(x).req || [], why = s && me.levels[s] < level ? `Needs ${skillOf(s).name.toLowerCase()} ${level}` : "";
|
||||
return `<button class="doll-slot swap" data-equip="${x}" ${why ? "disabled" : ""} title="${esc([`${item(x).name}: ${Math.round(item(x).speed * 100)}% faster`, why].filter(Boolean).join(" · "))}">${item(x).icon}</button>`;
|
||||
}).join("");
|
||||
cards.push(`<div class="panel gear-card">
|
||||
<span class="doll-slot ${it ? "" : "empty"}" title="${esc(it ? it.name : "No tool")}">${it ? it.icon : skillOf(skill).icon}</span>
|
||||
<div class="gear-text">${it ? `<b>${esc(it.name)}</b><span class="muted small">${Math.round(it.speed * 100)}% faster</span>` : `<span class="muted">No tool</span>`}</div>
|
||||
<span class="doll-slot ${it ? "" : "empty"}" title="${esc(it ? it.name : noTool)}">${it ? it.icon : skillOf(skill).icon}</span>
|
||||
<div class="gear-text">${it ? `<b>${esc(it.name)}</b><span class="muted small">${Math.round(it.speed * 100)}% faster</span>` : `<span class="muted">${noTool}</span>`}</div>
|
||||
${others || it ? `<div class="swap-grid">${others}${it ? `<button class="doll-slot swap off" data-unequip="tool_${skill}" title="Take it off">${glyph("cancel", "#98a1b4")}</button>` : ""}</div>` : ""}</div>`);
|
||||
}
|
||||
return cards.length ? `<div class="gear-row">${cards.join("")}</div>` : "";
|
||||
|
|
@ -731,6 +731,8 @@ function itemStats(id) {
|
|||
if (it.reagent) parts.push(it.reagent === "jewel" ? "Reagent for jewellery" : `Reagent for ${C.weights[it.reagent].name.toLowerCase()} armour`);
|
||||
if (it.jewel && !["power", "ward"].includes(it.jewel)) parts.push(jewelText(it));
|
||||
if (it.tool) parts.push(`${Math.round(it.speed * 100)}% faster ${skillOf(it.tool).name.toLowerCase()}`);
|
||||
if (it.slots) parts.push(storageText(it));
|
||||
if (it.stack) parts.push(storageText(it));
|
||||
if (it.req && it.req[1] > 1) parts.push(`needs ${skillOf(it.req[0]).name.toLowerCase()} ${it.req[1]}`);
|
||||
if (it.potion) parts.push(`${it.potion.text}, ${C.potion_charges} uses`);
|
||||
if (it.trophy) parts.push(`Trophy for stronger weapons`);
|
||||
|
|
@ -817,6 +819,26 @@ function actionCard(a) {
|
|||
|
||||
// --- bank -----------------------------------------------------------------
|
||||
|
||||
// A strongbox's extra slots or a bag's bigger stack.
|
||||
function storageText(it) {
|
||||
return it.slots ? `+${it.slots} bank slots` : `+${fmt(it.stack)} per stack`;
|
||||
}
|
||||
|
||||
// The strongbox and bag slots, each with what else you could swap in.
|
||||
function storageGear() {
|
||||
const me = S.me;
|
||||
const card = (slot, empty, outline) => {
|
||||
const id = me.equip[slot], it = id && item(id), size = (x) => x.slots || x.stack;
|
||||
const others = Object.keys(me.bank).filter((x) => item(x).slot === slot).sort((a, b) => size(item(b)) - size(item(a)))
|
||||
.map((x) => `<button class="doll-slot swap" data-equip="${x}" title="${esc(`${item(x).name}: ${storageText(item(x))}`)}">${item(x).icon}</button>`).join("");
|
||||
return `<div class="panel gear-card">
|
||||
<span class="doll-slot ${it ? "" : "empty"}" title="${esc(it ? it.name : empty)}">${it ? it.icon : glyph(outline, "#98a1b4")}</span>
|
||||
<div class="gear-text">${it ? `<b>${esc(it.name)}</b><span class="muted small">${storageText(it)}</span>` : `<span class="muted">${empty}</span>`}</div>
|
||||
${others || it ? `<div class="swap-grid">${others}${it ? `<button class="doll-slot swap off" data-unequip="${slot}" title="Take it off">${glyph("cancel", "#98a1b4")}</button>` : ""}</div>` : ""}</div>`;
|
||||
};
|
||||
return `<div class="gear-row">${card("storage", "No strongbox", "locked-chest")}${card("bag", "No bag", "shoulder-bag")}</div>`;
|
||||
}
|
||||
|
||||
function bank() {
|
||||
const me = S.me;
|
||||
const entries = Object.entries(me.bank).sort((x, y) => Object.keys(C.items).indexOf(x[0]) - Object.keys(C.items).indexOf(y[0]));
|
||||
|
|
@ -833,6 +855,7 @@ function bank() {
|
|||
</button>`).join("");
|
||||
for (let i = stacks.length; i < me.slots; i++) slots += `<div class="slot empty"></div>`;
|
||||
return `
|
||||
${storageGear()}
|
||||
<div class="bank-wrap">
|
||||
<div>
|
||||
<div class="panel">
|
||||
|
|
@ -890,7 +913,7 @@ function equipRow(id, it) {
|
|||
}
|
||||
|
||||
function equipLabel(it) {
|
||||
if (it.tool) return `Use as ${skillOf(it.tool).name.toLowerCase()} tool (${Math.round(it.speed * 100)}% faster)`;
|
||||
if (it.tool) return `Use for ${skillOf(it.tool).name.toLowerCase()} (${Math.round(it.speed * 100)}% faster)`;
|
||||
return "Equip";
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue