NEO-108: Use bru.sleep in Bruno helper (no setTimeout).

Bruno pre-request sandbox does not define setTimeout; pulse waits and
telegraph polls now call bru.sleep via prototype-npc-bruno-helper.
pull/147/head
VinPropane 2026-05-31 18:48:22 -04:00
parent af80b878ad
commit 05beec9644
3 changed files with 7 additions and 6 deletions

View File

@ -64,10 +64,10 @@ script:pre-request {
await axios.get(`${baseUrl}/game/world/npc-runtime-snapshot`);
await sleep(5000);
await sleep(bru, 5000);
await axios.get(`${baseUrl}/game/world/npc-runtime-snapshot`);
await sleep(2500);
await sleep(bru, 2500);
await axios.get(`${baseUrl}/game/world/npc-runtime-snapshot`);
bru.setVar("neo95CastBody", JSON.stringify(castBody));

View File

@ -47,7 +47,7 @@ script:pre-request {
{ schemaVersion: 1, targetId },
jsonHeaders,
);
await sleep(PULSE_COOLDOWN_MS);
await sleep(bru, PULSE_COOLDOWN_MS);
const castBody = {
schemaVersion: 1,
slotIndex,
@ -70,7 +70,7 @@ script:pre-request {
return;
}
if (i < 3) {
await sleep(PULSE_COOLDOWN_MS);
await sleep(bru, PULSE_COOLDOWN_MS);
}
}
throw new Error(`did not defeat ${targetId} within 4 pulses`);

View File

@ -10,8 +10,9 @@ const PROTOTYPE_NPC_ANCHORS = {
/** <c>prototype_pulse</c> catalog cooldown (seconds) — real-time Bruno waits. */
const PULSE_COOLDOWN_MS = 3200;
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
/** Bruno sandbox has no <c>setTimeout</c> — use <c>bru.sleep</c>. */
async function sleep(bru, ms) {
await bru.sleep(ms);
}
async function moveNearPrototypeNpc(baseUrl, playerId, targetId, jsonHeaders) {