Skip to content

Instantly share code, notes, and snippets.

@hastinbe
Last active April 28, 2017 03:03
Show Gist options
  • Save hastinbe/675c1026100d95efa57f to your computer and use it in GitHub Desktop.
Save hastinbe/675c1026100d95efa57f to your computer and use it in GitHub Desktop.
Auto-sell power in Reactor Idle
const DEFAULT_SELL_DELAY_IN_SECONDS = 60;
function showReactorMenu() {
$('#reactorsButton').click();
}
function selectReactor(name) {
var reactors = $('.reactorSelect');
var reactor = reactors.find('.description:contains("' + name + '")').parent();
var selectButton = reactor.children('.button');
selectButton.click();
}
function sellPower() {
$('#sellPowerButton').click();
}
function sellReactorPower(reactor) {
showReactorMenu();
selectReactor(reactor);
sellPower();
}
function stopSellingPower() {
window.clearInterval(sellPowerTimer);
}
function startSellingPower(reactors, delayInSeconds) {
if (typeof delayInSeconds === 'undefined' || delayInSeconds === null)
delayInSeconds = DEFAULT_SELL_DELAY_IN_SECONDS;
if (typeof sellPowerTimer !== 'undefined')
stopSellingPower();
sellPowerTimer = setInterval(function() {
reactors.forEach(sellReactorPower);
}, delayInSeconds * 1000);
}
var reactorsToSell = ['City', 'Metropolis'];
var sellPowerDelayInSeconds = 300;
startSellingPower(reactorsToSell, sellPowerDelayInSeconds);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment