Check for max workers when purchasing
This commit is contained in:
parent
cb57d54508
commit
468e23c856
1 changed files with 12 additions and 12 deletions
|
@ -81,10 +81,10 @@ function mainLoop() {
|
||||||
//RANDOM BOSS
|
//RANDOM BOSS
|
||||||
if(randomBossRefreshing() === true && botFightingRandomBoss === true && botFightingGlobalBoss === false) {
|
if(randomBossRefreshing() === true && botFightingRandomBoss === true && botFightingGlobalBoss === false) {
|
||||||
botFightingRandomBoss = false;
|
botFightingRandomBoss = false;
|
||||||
} else if(randomBossRefreshing() === false && botFightingRandomBoss === false && botFightRandom === true && haveSoldiers()) {
|
} else if(randomBossRefreshing() === false && botFightingRandomBoss === false && botFightRandom === true && haveSoldiers() === true) {
|
||||||
clickSelector('#randomBossPortal a');
|
clickSelector('#randomBossPortal a');
|
||||||
botFightingRandomBoss = true;
|
botFightingRandomBoss = true;
|
||||||
} else if(botTimestamp() > botLastRandom + 180 && botFightRandom === true && haveSoldiers()) {
|
} else if(botTimestamp() > botLastRandom + 180 && botFightRandom === true && haveSoldiers() === true) {
|
||||||
clickSelector('#randomBossPortal a');
|
clickSelector('#randomBossPortal a');
|
||||||
botFightingRandomBoss = true;
|
botFightingRandomBoss = true;
|
||||||
}
|
}
|
||||||
|
@ -117,26 +117,26 @@ function mainLoop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//BUY SCIENTISTS
|
//BUY SCIENTISTS
|
||||||
if(haveBossCoins(1) && haveCheapLabor() && botPurchasing === false && haveMaxRBMinion()) {
|
if(haveBossCoins(1) === true && haveCheapLabor() === true && botPurchasing === false && haveMaxWorker('capturedminion')) {
|
||||||
botPurchasing = true;
|
botPurchasing = true;
|
||||||
botLastPurchase = botTimestamp();
|
botLastPurchase = botTimestamp();
|
||||||
clickSelector('button[name="hiremax_scientists"]');
|
clickSelector('button[name="hiremax_scientists"]');
|
||||||
}
|
}
|
||||||
|
|
||||||
//BUY SLIMES
|
//BUY SLIMES
|
||||||
if(botBuySlimes === true && haveTrillions(BOT_SLIME_MONEY) && botPurchasing === false) {
|
if(botBuySlimes === true && haveTrillions(BOT_SLIME_MONEY) === true && botPurchasing === false) {
|
||||||
botPurchasing = true;
|
botPurchasing = true;
|
||||||
botLastPurchase = botTimestamp();
|
botLastPurchase = botTimestamp();
|
||||||
clickSelector('button[name="buymax-knight"]');
|
clickSelector('button[name="buymax-knight"]');
|
||||||
}
|
}
|
||||||
|
|
||||||
//BUY WORKERS
|
//BUY WORKERS
|
||||||
if(botBuyWorkers === true && haveTrillions(BOT_WORKER_MONEY) && haveCheapLabor() === true && botPurchasing === false) {
|
if(botBuyWorkers === true && haveTrillions(BOT_WORKER_MONEY) === true && haveCheapLabor() === true && botPurchasing === false) {
|
||||||
botPurchasing = true;
|
botPurchasing = true;
|
||||||
botLastPurchase = botTimestamp();
|
botLastPurchase = botTimestamp();
|
||||||
clickSelector('button[name="buymax-' + mostEfficientWorker() + '"]');
|
clickSelector('button[name="buymax-' + mostEfficientWorker() + '"]');
|
||||||
}
|
}
|
||||||
if(botBuyWorkers === true && haveCheapLabor() === true && botPurchasing === false && haveBossCoins(9)) {
|
if(botBuyWorkers === true && haveCheapLabor() === true && botPurchasing === false && haveBossCoins(9) === true) {
|
||||||
botPurchasing = true;
|
botPurchasing = true;
|
||||||
botLastPurchase = botTimestamp();
|
botLastPurchase = botTimestamp();
|
||||||
clickSelector('button[name="buymax-capturedminion"]');
|
clickSelector('button[name="buymax-capturedminion"]');
|
||||||
|
@ -147,12 +147,12 @@ function mainLoop() {
|
||||||
botDetectUser();
|
botDetectUser();
|
||||||
botToggle();
|
botToggle();
|
||||||
|
|
||||||
function haveMaxRBMinion() {
|
function haveMaxWorker(type) {
|
||||||
var rb = $('tr[name="capturedminion"]').find('span[name="owned"]').text();
|
var worker = $('tr[name="' + type + '"]').find('span[name="owned"]').text();
|
||||||
rb = rb.replace(/\s+/g, '');
|
worker = worker.replace(/\s+/g, '');
|
||||||
var rbA = rb.split('/');
|
var workerArray = worker.split('/');
|
||||||
|
|
||||||
return convertToNumber(rbA[0]) == convertToNumber(rbA[1]);
|
return convertToNumber(workerArray[0]) == convertToNumber(workerArray[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function botDetectUser() {
|
function botDetectUser() {
|
||||||
|
@ -190,7 +190,7 @@ function mostEfficientWorker() {
|
||||||
var opm = convertToNumber(workersTable.find('span[name="opm"]').text());
|
var opm = convertToNumber(workersTable.find('span[name="opm"]').text());
|
||||||
var value = opm / price;
|
var value = opm / price;
|
||||||
|
|
||||||
if(bestValueWorker == null || bestValue < value) {
|
if(bestValueWorker == null || bestValue < value && haveMaxWorker(workersTable.attr('name')) === false) {
|
||||||
bestValueWorker = workersTable.attr('name');
|
bestValueWorker = workersTable.attr('name');
|
||||||
bestValue = value;
|
bestValue = value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue