trugul-bot/bot.js

72 lines
1.9 KiB
JavaScript
Raw Normal View History

2015-04-07 13:42:08 -04:00
var activeTimers = [];
2015-04-06 17:01:14 -04:00
function delayClick(selector, seconds) {
2015-04-06 17:30:55 -04:00
var timer = setInterval(
2015-04-06 17:01:14 -04:00
function() {
2015-04-06 17:30:55 -04:00
if($(selector).length > 0) {
2015-04-06 17:01:14 -04:00
$(selector).get(0).click();
}
},
seconds * 1000
2015-04-06 17:30:55 -04:00
);
return timer;
2015-04-06 17:01:14 -04:00
}
2015-04-07 13:42:08 -04:00
function play() {
activeTimers.push(delayClick('#popup span button:contains("Summon Boss")', 3));
activeTimers.push(delayClick('#popup span button:contains("CONTINUE")', 3));
activeTimers.push(delayClick('#randomBossPortal a', 20));
activeTimers.push(delayClick('span[name="timeRemaining"]:contains("JOIN") a', 80));
2015-04-06 17:30:55 -04:00
var globalBossTimer = setInterval(function() {
2015-04-07 13:42:08 -04:00
if($('img[name="globalBossImg"]').is(':visible')) {
$('img[name="globalBossImg"]').get(0).click();
}
}, 1000);
var activateTimer = setInterval(function() {
if($('button:contains("Activate")')) {
$('button:contains("Activate")').get(0).click();
setTimeout(function() {
$('button:contains("Activate Item")').get(0).click();
}, 250);
}
}, 10000);
2015-04-07 16:55:11 -04:00
var scientistTimer = setInterval(function() {
if($('span[name="scientists_price"]').text() == "1 BC") {
$('button[name="hiremax_scientists"]').get(0).click();
setTimeout(function() {
$('button:contains("Yes")').get(0).click();
}, 250);
}
}, 20000);
activeTimers.push(globalBossTimer);
activeTimers.push(activateTimer);
2015-04-07 16:55:11 -04:00
activeTimers.push(scientistTimer);
2015-04-07 13:42:08 -04:00
}
function pause() {
for(var i = 0; i < activeTimers.length; i++) {
clearInterval(activeTimers[i]);
2015-04-06 17:30:55 -04:00
}
2015-04-07 13:42:08 -04:00
}
2015-04-07 15:19:27 -04:00
function botRaid(username) {
$('button:contains("Raid")').get(0).click();
$('input[name="raid_user"]').val(username);
$('button:contains("Raid!")').get(0).click();
}
2015-04-07 15:44:58 -04:00
function buySlimes() {
var slimeTimer = setInterval(function() {
$('button[name="buymax-knight"]').get(0).click();
setTimeout(function() {
$('button:contains("Yes")').get(0).click();
}, 250);
2015-04-07 15:44:58 -04:00
}, 60000);
activeTimers.push(slimeTimer);
}