Compare commits

...

3 Commits

Author SHA1 Message Date
pre-commit-ci[bot]
0c72a92c01 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v5.0.0...v6.0.0)
2025-08-11 19:04:13 +00:00
WiseDragoon
bd772e3712 Update CalculateLuckyLevels.js (#1217)
* Update CalculateLuckyLevels.js

Fixed infinite loop when currentLevel is too big

* Update CalculateLuckyLevels.js Dev build

* Update CalculateLuckyLevels.js Final build
2025-03-16 20:43:05 +01:00
Kevin Radloff
69b923de89 Show spells cast progress towards next achievement in stats 2025-03-03 20:44:43 +01:00
7 changed files with 33 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ repos:
hooks: hooks:
- id: prettier - id: prettier
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0 rev: v6.0.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
exclude: dist exclude: dist

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -33,7 +33,7 @@ export function CalculateSevenDelta(number, digitPlace) {
export default function CalculateLuckyLevels(currentLevel) { export default function CalculateLuckyLevels(currentLevel) {
const result = {}; const result = {};
let sevenCount = CountSevens(currentLevel); let sevenCount = CountSevens(currentLevel);
const numberOfDigits = String(currentLevel).length; const numberOfDigits = Math.max(Math.floor(Math.log10(Math.abs(currentLevel))), 0) + 1;
if (sevenCount >= 1) { if (sevenCount >= 1) {
result.luckyDigit = currentLevel; result.luckyDigit = currentLevel;

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; return section;
} }