Add internal tracking for raiding
This commit is contained in:
parent
83eedd0047
commit
d9fccba5ae
1 changed files with 12 additions and 1 deletions
13
bot.js
13
bot.js
|
@ -11,6 +11,7 @@ var botFightGlobal = true;
|
|||
var botFightRandom = true;
|
||||
var botRaidTarget = null;
|
||||
var botLastRandom = 0;
|
||||
var botLastRaid = 0;
|
||||
var botSleeping = false;
|
||||
|
||||
function mainLoop() {
|
||||
|
@ -20,6 +21,7 @@ function mainLoop() {
|
|||
case 'Raid report':
|
||||
var botMessage = botBuildRaidReport($('#popup div[name="content"]').text());
|
||||
console.log(botMessage);
|
||||
botLastRaid = botTimestamp();
|
||||
clickButton('CONTINUE');
|
||||
break;
|
||||
case 'SUMMON BOSS':
|
||||
|
@ -57,6 +59,7 @@ function mainLoop() {
|
|||
case 'Wait':
|
||||
case 'ACTIVITY FAILED!':
|
||||
case 'Game in progress':
|
||||
case 'User not found':
|
||||
clickButton('CONTINUE');
|
||||
break;
|
||||
default:
|
||||
|
@ -97,7 +100,7 @@ function mainLoop() {
|
|||
}
|
||||
|
||||
//RAID
|
||||
if(raidRefreshing() === false && haveRaidTarget() === true && botFightRandom === true) {
|
||||
if(raidRefreshing() === false && haveRaidTarget() === true && botFightRandom === true && internalRaidRefreshing() === false) {
|
||||
clickSelector('button[name="raid_button"]');
|
||||
botFillIn('input[name="raid_user"]', botRaidTarget);
|
||||
botRaiding = true;
|
||||
|
@ -113,6 +116,14 @@ function mainLoop() {
|
|||
|
||||
botToggle();
|
||||
|
||||
function internalRaidRefreshing() {
|
||||
if(botTimestamp() > botLastRaid + 300) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function haveSoldiers() {
|
||||
if(convertToNumber($('tr[name="knight"] > .owned').text()) == 0) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue