Autobuy mobs when killing random bosses

This commit is contained in:
Andrew Tomaka 2015-04-21 11:07:14 -04:00
parent 7aa64cd307
commit b3cf042912

View file

@ -1,6 +1,7 @@
var BOT_WORKER_MONEY = 1; var BOT_WORKER_MONEY = 1;
var BOT_SLIME_MONEY = 10; var BOT_SLIME_MONEY = 10;
var CHAT_LIMIT = 150; var CHAT_LIMIT = 150;
var SAFE_SOLDIER_COUNT = 50000000;
var botLoop; var botLoop;
var botGlobalBossTimer; var botGlobalBossTimer;
@ -92,6 +93,21 @@ function mainLoop() {
botFightingRandomBoss = true; botFightingRandomBoss = true;
} }
//RANDOM BOSS MOBS
if(haveSlimes(SAFE_SOLDIER_COUNT) === false && botFightRandom === true && botPurchasing === false) {
setBotToPurchasing();
clickSelector('button[name="buyx-knight"]');
botFillIn('input[name="x_amount"]', SAFE_SOLDIER_COUNT);
clickButton("Buy");
}
if(haveCreepers(SAFE_SOLDIER_COUNT) === false && botFightRandom === true && botPurchasing === false) {
setBotToPurchasing();
clickSelector('button[name="buyx-advknight"]');
botFillIn('input[name="x_amount"]', SAFE_SOLDIER_COUNT);
clickButton("Buy");
}
//GLOBAL BOSS //GLOBAL BOSS
if(globalBossRefreshing() === true && botFightingGlobalBoss === true) { if(globalBossRefreshing() === true && botFightingGlobalBoss === true) {
clearInterval(botGlobalBossTimer); clearInterval(botGlobalBossTimer);
@ -121,27 +137,23 @@ function mainLoop() {
//BUY SCIENTISTS //BUY SCIENTISTS
if(haveBossCoins(1) === true && haveCheapLabor() === true && botPurchasing === false && haveMaxWorker('capturedminion') && botSpendBossCoins === true) { if(haveBossCoins(1) === true && haveCheapLabor() === true && botPurchasing === false && haveMaxWorker('capturedminion') && botSpendBossCoins === true) {
botPurchasing = true; setBotToPurchasing();
botLastPurchase = botTimestamp();
clickSelector('button[name="hiremax_scientists"]'); clickSelector('button[name="hiremax_scientists"]');
} }
//BUY SLIMES //BUY SLIMES
if(botBuySlimes === true && haveTrillions(BOT_SLIME_MONEY) === true && botPurchasing === false) { if(botBuySlimes === true && haveTrillions(BOT_SLIME_MONEY) === true && botPurchasing === false) {
botPurchasing = true; setBotToPurchasing();
botLastPurchase = botTimestamp();
clickSelector('button[name="buymax-knight"]'); clickSelector('button[name="buymax-knight"]');
} }
//BUY WORKERS //BUY WORKERS
if(botBuyWorkers === true && haveTrillions(BOT_WORKER_MONEY) === true && haveCheapLabor() === true && botPurchasing === false) { if(botBuyWorkers === true && haveTrillions(BOT_WORKER_MONEY) === true && haveCheapLabor() === true && botPurchasing === false) {
botPurchasing = true; setBotToPurchasing();
botLastPurchase = botTimestamp();
clickSelector('button[name="buymax-' + mostEfficientWorker() + '"]'); clickSelector('button[name="buymax-' + mostEfficientWorker() + '"]');
} }
if(botBuyWorkers === true && haveCheapLabor() === true && botPurchasing === false && haveBossCoins(9) === true && botSpendBossCoins === true) { if(botBuyWorkers === true && haveCheapLabor() === true && botPurchasing === false && haveBossCoins(9) === true && botSpendBossCoins === true) {
botPurchasing = true; setBotToPurchasing();
botLastPurchase = botTimestamp();
clickSelector('button[name="buymax-capturedminion"]'); clickSelector('button[name="buymax-capturedminion"]');
} }
} }
@ -155,6 +167,19 @@ function mainLoop() {
botDetectUser(); botDetectUser();
botToggle(); botToggle();
function setBotToPurchasing() {
botPurchasing = true;
botLastPurchase = botTimestamp();
}
function haveSlimes(value) {
return convertToNumber($('tr[name="knight"] span[name="owned"]').text()) >= value;
}
function haveCreepers(value) {
return convertToNumber($('tr[name="advknight"] span[name="owned"]').text()) >= value;
}
function haveChatLines(value) { function haveChatLines(value) {
if($('#chatbox').children().length > value) { if($('#chatbox').children().length > value) {
return true; return true;
@ -225,13 +250,7 @@ function internalRaidRefreshing() {
} }
function haveSoldiers() { function haveSoldiers() {
if(convertToNumber($('tr[name="knight"]').find('span[name="owned"]').text()) == 0) { return haveSlimes(1) && haveCreepers(1);
return false;
} else if(convertToNumber($('tr[name="advknight"]').find('span[name="owned"]').text()) == 0) {
return false;
} else {
return true;
}
} }
function chatMonitor() { function chatMonitor() {