Last active
April 28, 2017 03:03
-
-
Save hastinbe/675c1026100d95efa57f to your computer and use it in GitHub Desktop.
Auto-sell power in Reactor Idle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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