Show spells cast progress towards next achievement in stats

This commit is contained in:
Kevin Radloff
2025-02-26 20:48:06 -05:00
committed by Daniël van Noord
parent 4e6c828f8b
commit 69b923de89
5 changed files with 31 additions and 4 deletions

View File

@@ -437,6 +437,33 @@ export function SpellsSection() {
),
);
}
const { minigame } = Game.Objects['Wizard tower'];
const spellsCast = minigame.spellsCastTotal;
const spellsNeeded = (function (val) {
switch (true) {
case val < 9:
return 9 - val;
case val < 99:
return 99 - val;
case val < 999:
return 999 - val;
default:
return 'NA';
}
})(spellsCast);
section.appendChild(
StatsListing(
'basic',
'Spells cast',
spellsCast < 999
? document.createTextNode(
`Next achievement in ${spellsNeeded}, current total: ${Beautify(spellsCast)}`,
)
: document.createTextNode(`No new achievement, current total: ${Beautify(spellsCast)}`),
),
);
return section;
}