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
parent
af80b878ad
commit
05beec9644
|
|
@ -64,10 +64,10 @@ script:pre-request {
|
||||||
|
|
||||||
await axios.get(`${baseUrl}/game/world/npc-runtime-snapshot`);
|
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 axios.get(`${baseUrl}/game/world/npc-runtime-snapshot`);
|
||||||
|
|
||||||
await sleep(2500);
|
await sleep(bru, 2500);
|
||||||
await axios.get(`${baseUrl}/game/world/npc-runtime-snapshot`);
|
await axios.get(`${baseUrl}/game/world/npc-runtime-snapshot`);
|
||||||
|
|
||||||
bru.setVar("neo95CastBody", JSON.stringify(castBody));
|
bru.setVar("neo95CastBody", JSON.stringify(castBody));
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ script:pre-request {
|
||||||
{ schemaVersion: 1, targetId },
|
{ schemaVersion: 1, targetId },
|
||||||
jsonHeaders,
|
jsonHeaders,
|
||||||
);
|
);
|
||||||
await sleep(PULSE_COOLDOWN_MS);
|
await sleep(bru, PULSE_COOLDOWN_MS);
|
||||||
const castBody = {
|
const castBody = {
|
||||||
schemaVersion: 1,
|
schemaVersion: 1,
|
||||||
slotIndex,
|
slotIndex,
|
||||||
|
|
@ -70,7 +70,7 @@ script:pre-request {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (i < 3) {
|
if (i < 3) {
|
||||||
await sleep(PULSE_COOLDOWN_MS);
|
await sleep(bru, PULSE_COOLDOWN_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new Error(`did not defeat ${targetId} within 4 pulses`);
|
throw new Error(`did not defeat ${targetId} within 4 pulses`);
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,9 @@ const PROTOTYPE_NPC_ANCHORS = {
|
||||||
/** <c>prototype_pulse</c> catalog cooldown (seconds) — real-time Bruno waits. */
|
/** <c>prototype_pulse</c> catalog cooldown (seconds) — real-time Bruno waits. */
|
||||||
const PULSE_COOLDOWN_MS = 3200;
|
const PULSE_COOLDOWN_MS = 3200;
|
||||||
|
|
||||||
function sleep(ms) {
|
/** Bruno sandbox has no <c>setTimeout</c> — use <c>bru.sleep</c>. */
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
async function sleep(bru, ms) {
|
||||||
|
await bru.sleep(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function moveNearPrototypeNpc(baseUrl, playerId, targetId, jsonHeaders) {
|
async function moveNearPrototypeNpc(baseUrl, playerId, targetId, jsonHeaders) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue