From ae37674bcce80bb77d0d672b79253761fc8dcc6f Mon Sep 17 00:00:00 2001 From: haunter Date: Fri, 1 May 2026 02:33:35 +0300 Subject: [PATCH] bandit fix --- bot_modules/04c_execute_bootcamp_trade.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bot_modules/04c_execute_bootcamp_trade.js b/bot_modules/04c_execute_bootcamp_trade.js index 17e06e6..1883f6b 100644 --- a/bot_modules/04c_execute_bootcamp_trade.js +++ b/bot_modules/04c_execute_bootcamp_trade.js @@ -45,7 +45,11 @@ async function autoBootcampLoop() { model = uw.MM.getModelByNameAndPlayerId('PlayerAttackSpot'); } catch (e) { return; } - if (!model) return; + // Model not loaded yet (player hasn't opened the camp UI this session) + if (!model || typeof model.getLevel?.() === 'undefined') { + log('[bootcamp] PlayerAttackSpot model not ready — skipping'); + return; + } // ── 1. Claim reward if available ────────────────────────────── try { @@ -58,7 +62,6 @@ async function autoBootcampLoop() { const stashable = reward.stashable; if (isInstant && !isFavor) { - // Use instant rewards immediately uw.gpAjax.ajaxPost('frontend_bridge', 'execute', { model_url: `PlayerAttackSpot/${player_id}`, action_name: 'useReward', @@ -88,7 +91,12 @@ async function autoBootcampLoop() { // ── 2. Attack if no cooldown ─────────────────────────────────── try { - const cooldown = model.getCooldownDuration?.() ?? 1; + // If getCooldownDuration is unavailable, skip safely + if (typeof model.getCooldownDuration !== 'function') { + log('[bootcamp] getCooldownDuration unavailable — skipping'); + return; + } + const cooldown = model.getCooldownDuration(); if (cooldown > 0) { const minRemaining = Math.round(cooldown / 60); await botLog(player_id, 'bootcamp', `Camp on cooldown — ${minRemaining} min remaining`);