try to fix
This commit is contained in:
@@ -17,15 +17,18 @@ const LOOT_TIMINGS = { 1: 300000, 2: 1200000, 3: 5400000, 4: 14400000 };
|
|||||||
// Delay = loot_option cooldown + random 30-120s human jitter.
|
// Delay = loot_option cooldown + random 30-120s human jitter.
|
||||||
// This mirrors ModernBot's pattern: run exactly when farms are ready.
|
// This mirrors ModernBot's pattern: run exactly when farms are ready.
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
function scheduleNextFarm() {
|
function scheduleNextFarm(isFirstRun = false) {
|
||||||
const option = lastKnownFarmSettings.loot_option || 1;
|
let totalMs = 15000; // 15 seconds for the first run to catch already-ready farms
|
||||||
const baseMs = LOOT_TIMINGS[option] || 300000;
|
if (!isFirstRun) {
|
||||||
const jitterMs = randInt(30000, 120000); // +30 to +120 s
|
const option = lastKnownFarmSettings.loot_option || 1;
|
||||||
const totalMs = baseMs + jitterMs;
|
const baseMs = LOOT_TIMINGS[option] || 300000;
|
||||||
log(`⏰ Next auto-farm in ${(totalMs / 60000).toFixed(1)} min (option ${option} + ${(jitterMs/1000).toFixed(0)}s jitter)`);
|
const jitterMs = randInt(30000, 120000); // +30 to +120 s
|
||||||
|
totalMs = baseMs + jitterMs;
|
||||||
|
}
|
||||||
|
log(`⏰ Next auto-farm in ${(totalMs / 60000).toFixed(1)} min`);
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await autoFarmLoop();
|
await autoFarmLoop();
|
||||||
scheduleNextFarm();
|
scheduleNextFarm(false);
|
||||||
}, totalMs);
|
}, totalMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,8 +228,8 @@ function boot() {
|
|||||||
detectCaptcha();
|
detectCaptcha();
|
||||||
setTimeout(pushState, 5000);
|
setTimeout(pushState, 5000);
|
||||||
jitterLoop(pushState, 60000, 120000); // state sync every 1–2 min
|
jitterLoop(pushState, 60000, 120000); // state sync every 1–2 min
|
||||||
jitterLoop(pollAndExecute, 8000, 18000); // command poll every 8–18 s
|
jitterLoop(pollAndExecute, 8000, 18000, 2000); // command poll every 8–18 s, but start in 2s
|
||||||
scheduleNextFarm(); // auto-farm timer-based (loot_option + 30–120s)
|
scheduleNextFarm(true); // auto-farm timer-based (loot_option + 30–120s)
|
||||||
jitterLoop(autoBootcampLoop, 720000, 1320000); // bootcamp every 12–22 min
|
jitterLoop(autoBootcampLoop, 720000, 1320000); // bootcamp every 12–22 min
|
||||||
jitterLoop(autoRuralTradeLoop, 1500000, 2700000); // rural trade every 25–45 min
|
jitterLoop(autoRuralTradeLoop, 1500000, 2700000); // rural trade every 25–45 min
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user