From 933fbed1830a3d574d994aa00fb8f6d4ea0f6b34 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 15 Apr 2015 19:10:08 -0400 Subject: [PATCH 1/3] Try to stop purchasing on whoops! --- public/bot.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/bot.js b/public/bot.js index 17b9a12..b1152d1 100644 --- a/public/bot.js +++ b/public/bot.js @@ -61,6 +61,7 @@ function mainLoop() { } break; case 'WHOOPS!': + botPurchasing = false; case 'BATTLE REPORT': case 'Battle Report': case 'ACTIVITY PASSED!': From 611f5250d49acac0ca0623d25e4a30e37346b7de Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 15 Apr 2015 19:18:23 -0400 Subject: [PATCH 2/3] Fix for botPurchasing bug --- public/bot.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/public/bot.js b/public/bot.js index b1152d1..bba8075 100644 --- a/public/bot.js +++ b/public/bot.js @@ -61,7 +61,6 @@ function mainLoop() { } break; case 'WHOOPS!': - botPurchasing = false; case 'BATTLE REPORT': case 'Battle Report': case 'ACTIVITY PASSED!': @@ -105,7 +104,7 @@ function mainLoop() { } //BUY SCIENTISTS - if(haveBossCoins() && haveCheapLabor() && botPurchasing === false && haveMaxRBMinion()) { + if(haveBossCoins(1) && haveCheapLabor() && botPurchasing === false && haveMaxRBMinion()) { botPurchasing = true; clickSelector('button[name="hiremax_scientists"]'); } @@ -128,7 +127,7 @@ function mainLoop() { botPurchasing = true; clickSelector('button[name="buymax-' + mostEfficientWorker() + '"]'); } - if(botBuyWorkers === true && haveCheapLabor() === true && botPurchasing === false && haveBossCoins()) { + if(botBuyWorkers === true && haveCheapLabor() === true && botPurchasing === false && haveBossCoins(9)) { botPurchasing = true; clickSelector('button[name="buymax-capturedminion"]'); } @@ -295,8 +294,8 @@ function trillions(number) { return number * 1000000000000; } -function haveBossCoins() { - if($('#bc_display').text() != 0) { +function haveBossCoins(value) { + if(convertToNumber($('#bc_display').text()) >= value) { return true; } else { return false; From cc24c7f029504ea8c35b12e2eb8221a53a7eee36 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 15 Apr 2015 21:27:34 -0400 Subject: [PATCH 3/3] 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"]'); } }