From cc24c7f029504ea8c35b12e2eb8221a53a7eee36 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 15 Apr 2015 21:27:34 -0400 Subject: [PATCH] Fix botPurchasing stuck true issue --- public/bot.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/public/bot.js b/public/bot.js index bba8075..ae39d11 100644 --- a/public/bot.js +++ b/public/bot.js @@ -15,6 +15,7 @@ var botFightRandom = true; var botRaidTarget = null; var botLastRandom = 0; var botLastRaid = 0; +var botLastPurchase = 0; var botSleeping = false; var botUser = null; @@ -103,12 +104,6 @@ function mainLoop() { clickSelector('button:contains("Activate")'); } - //BUY SCIENTISTS - if(haveBossCoins(1) && haveCheapLabor() && botPurchasing === false && haveMaxRBMinion()) { - botPurchasing = true; - clickSelector('button[name="hiremax_scientists"]'); - } - //RAID if(raidRefreshing() === false && haveRaidTarget() === true && internalRaidRefreshing() === false) { clickSelector('button[name="raid_button"]'); @@ -116,19 +111,34 @@ function mainLoop() { botRaiding = true; } + //PURCHASES + if(botTimestamp() > botLastPurchase + 5 && botPurchasing === true) { + botPurchasing = false; + } + + //BUY SCIENTISTS + if(haveBossCoins(1) && haveCheapLabor() && botPurchasing === false && haveMaxRBMinion()) { + botPurchasing = true; + botLastPurchase = botTimestamp(); + clickSelector('button[name="hiremax_scientists"]'); + } + //BUY SLIMES if(botBuySlimes === true && haveTrillions(BOT_SLIME_MONEY) && botPurchasing === false) { botPurchasing = true; + botLastPurchase = botTimestamp(); clickSelector('button[name="buymax-knight"]'); } //BUY WORKERS if(botBuyWorkers === true && haveTrillions(BOT_WORKER_MONEY) && haveCheapLabor() === true && botPurchasing === false) { botPurchasing = true; + botLastPurchase = botTimestamp(); clickSelector('button[name="buymax-' + mostEfficientWorker() + '"]'); } if(botBuyWorkers === true && haveCheapLabor() === true && botPurchasing === false && haveBossCoins(9)) { botPurchasing = true; + botLastPurchase = botTimestamp(); clickSelector('button[name="buymax-capturedminion"]'); } }