Add auto raiding

This commit is contained in:
Andrew Tomaka 2015-04-09 13:14:00 -04:00
parent 19c898fe85
commit 03f7dce1c9

49
bot.js
View file

@ -1,10 +1,12 @@
var botLoop; var botLoop;
var botPaused = true; var botPaused = true;
var botPurchasing = false; var botPurchasing = false;
var botRaiding = false;
var botFightingRandomBoss = false; var botFightingRandomBoss = false;
var botFightingGlobalBoss = false; var botFightingGlobalBoss = false;
var botBuySlimes = false; var botBuySlimes = false;
var botTickActivity = false; var botTickActivity = false;
var botRaidTarget = null;
var botGlobalBossTimer; var botGlobalBossTimer;
function mainLoop() { function mainLoop() {
@ -33,12 +35,21 @@ function mainLoop() {
clickButton('No'); clickButton('No');
} }
break; break;
case 'Raid':
if(botRaiding) {
clickButton('Raid!');
botRaiding = false;
} else {
clickButton('Nevermind');
}
break;
case 'WHOOPS!': case 'WHOOPS!':
case 'BATTLE REPORT': case 'BATTLE REPORT':
case 'Battle Report': case 'Battle Report':
case 'ACTIVITY PASSED!': case 'ACTIVITY PASSED!':
case 'SCENARIO #1': case 'SCENARIO #1':
case 'Lobby Closed': case 'Lobby closed':
case 'Wait':
clickButton('CONTINUE'); clickButton('CONTINUE');
break; break;
default: default:
@ -80,6 +91,14 @@ function mainLoop() {
botTickActivity = true; botTickActivity = true;
} }
//RAID
if(raidRefreshing() === false && haveRaidTarget() === true && botTickActivity === false) {
clickSelector('button[name="raid_button"]');
botFillIn('input[name="raid_user"]', botRaidTarget);
botTickActivity = true;
botRaiding = true;
}
//BUY SLIMES //BUY SLIMES
if(botBuySlimes === true && haveTrillions(10) && botTickActivity === false) { if(botBuySlimes === true && haveTrillions(10) && botTickActivity === false) {
botPurchasing = true; botPurchasing = true;
@ -90,6 +109,26 @@ function mainLoop() {
botToggle(); botToggle();
function botFillIn(selector, text) {
$(selector).val(text);
}
function raidRefreshing() {
if($('span[name="raidtime"]').text().trim() == "") {
return false;
} else {
return true;
}
}
function haveRaidTarget() {
if(botRaidTarget == null) {
return false;
} else {
return true;
}
}
function botBuildRaidReport(message) { function botBuildRaidReport(message) {
var botRaidUser; var botRaidUser;
if(/You.? were raided by (.*?).? /.exec(message)) { if(/You.? were raided by (.*?).? /.exec(message)) {
@ -190,3 +229,11 @@ function botToggleSlimes() {
botBuySlimes = true; botBuySlimes = true;
} }
} }
function botSetTarget(username) {
botRaidTarget = username;
}
function botClearTarget() {
botRaidTarget = null;
}