bandit fix
This commit is contained in:
@@ -45,7 +45,11 @@ async function autoBootcampLoop() {
|
|||||||
model = uw.MM.getModelByNameAndPlayerId('PlayerAttackSpot');
|
model = uw.MM.getModelByNameAndPlayerId('PlayerAttackSpot');
|
||||||
} catch (e) { return; }
|
} 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 ──────────────────────────────
|
// ── 1. Claim reward if available ──────────────────────────────
|
||||||
try {
|
try {
|
||||||
@@ -58,7 +62,6 @@ async function autoBootcampLoop() {
|
|||||||
const stashable = reward.stashable;
|
const stashable = reward.stashable;
|
||||||
|
|
||||||
if (isInstant && !isFavor) {
|
if (isInstant && !isFavor) {
|
||||||
// Use instant rewards immediately
|
|
||||||
uw.gpAjax.ajaxPost('frontend_bridge', 'execute', {
|
uw.gpAjax.ajaxPost('frontend_bridge', 'execute', {
|
||||||
model_url: `PlayerAttackSpot/${player_id}`,
|
model_url: `PlayerAttackSpot/${player_id}`,
|
||||||
action_name: 'useReward',
|
action_name: 'useReward',
|
||||||
@@ -88,7 +91,12 @@ async function autoBootcampLoop() {
|
|||||||
|
|
||||||
// ── 2. Attack if no cooldown ───────────────────────────────────
|
// ── 2. Attack if no cooldown ───────────────────────────────────
|
||||||
try {
|
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) {
|
if (cooldown > 0) {
|
||||||
const minRemaining = Math.round(cooldown / 60);
|
const minRemaining = Math.round(cooldown / 60);
|
||||||
await botLog(player_id, 'bootcamp', `Camp on cooldown — ${minRemaining} min remaining`);
|
await botLog(player_id, 'bootcamp', `Camp on cooldown — ${minRemaining} min remaining`);
|
||||||
|
|||||||
Reference in New Issue
Block a user