fix: eggs, pets, minigames, themes, HQ facts and more

- egg stands sell an egg again; a bought egg hatches and is named at once
- pets whose bits name no pet the game has no longer stop loading
- the adopt-a-pet gift path opens with nothing adopted yet
- Spider Zapper and Wind Rider start with their players: spiders can be
  shot, and Wind Rider is played; Spider Zapper's waves are answered
- Phantom's Treasure can be left from its title screen and level choice
- the Touch Pool's fact window always closes
- the last key in Return of the Phantoms lies where it can be reached
- the Alpha HQ's bios and relics open and close
- a land animal in water (and a sea one on land) is drawn when it stands
- a seasonal theme's room has today's shops in it (lib/themerooms.js)
- the Forgotten Archive sells its own stock, not unfinished pieces
- custom items whose def is gone stay out of trade lists
- the captcha is always shown, and tried again when it fails
- builds 85
This commit is contained in:
Burrowdev committed 2026-10-24 01:57:49 +03:00
1 parent c7efda7030
commit 4355994253
19 files changed
+4891 -28

No files matched your search

+37 -9
View File
@@ -41,12 +41,15 @@ window.captcha = (() => {
return loading;
};
// `options`: {appearance} ("interaction-only" by default: seen only when
// cloudflare wants a click), {onAnswer(token)}.
// `options`: {appearance} ("always" by default: hidden till cloudflare
// wanted a click, it was taken for one that never showed), {onAnswer(token)}.
const MAX_RETRIES = 2; // a widget that errs is started again this often first
const mount = (element, action, options = {}) => {
let widget = null;
let answer = null; // a token, "" when none could be had, null while waiting
let waiting = [];
let retries = 0;
let starting = false;
const settle = value => {
answer = value;
if (value && options.onAnswer) {
@@ -57,22 +60,38 @@ window.captcha = (() => {
}
waiting = [];
};
if (siteKey) {
const start = () => {
if (!siteKey || starting || widget !== null) {
return;
}
starting = true;
load().then(turnstile => {
starting = false;
try {
widget = turnstile.render(element, {
sitekey: siteKey,
action,
theme: "dark",
appearance: options.appearance || "interaction-only",
callback: settle,
appearance: options.appearance || "always",
callback: value => {
retries = 0;
settle(value);
},
"expired-callback": () => {
answer = null;
},
// its code is cloudflare's (110200: this site's name is not on the widget)
// its code is cloudflare's (110200: this site's name is not on
// the widget). many pass with a second go: it is had first.
"error-callback": code => {
console.log(`captcha error ${code}`);
if (retries < MAX_RETRIES) {
retries++;
answer = null;
setTimeout(() => window.turnstile.reset(widget), 1000 * retries);
return true;
}
settle("");
return true;
},
});
}
@@ -80,20 +99,29 @@ window.captcha = (() => {
console.log(`captcha could not start: ${err.message}`);
settle("");
}
}, () => settle(""));
}
}, () => {
starting = false;
settle("");
});
};
start();
return {
on: Boolean(siteKey),
answer: () => {
if (!siteKey) {
return Promise.resolve(undefined);
}
// one that could not load is tried again when an answer is wanted
if (answer === "" && widget === null) {
answer = null;
start();
}
return answer !== null ? Promise.resolve(answer) : new Promise(resolve => waiting.push(resolve));
},
// (a widget that never loaded keeps its "" so nothing waits on it)
reset: () => {
if (widget !== null) {
answer = null;
retries = 0;
window.turnstile.reset(widget);
}
},