Skip to content

Instantly share code, notes, and snippets.

@thexa4
Last active May 16, 2017 13:07
Show Gist options
  • Save thexa4/2da63028a1d8007dedbd0ba9432c8345 to your computer and use it in GitHub Desktop.
Save thexa4/2da63028a1d8007dedbd0ba9432c8345 to your computer and use it in GitHub Desktop.
For use with spaceplan
// Paste in console
var clickBestThing = function(){
var things = [...document.querySelectorAll("#manufacture__container > div")].map(function(e){
var res = {e};
[...e.getElementsByTagName("span")].map(function(s){
res[s.id] = +s.innerText.replace(/[^0-9]/g, '')
})
if(e.id === "item__spudGun" || e.id === "item__potatoLauncher") res.powerGain *= 1000;
res.score = res.cost * (powerGain + res.powerGain)/res.powerGain;
// res.score = res.cost / res.powerGain;
// res.score = res.cost / res.spudGain;
res.name = e.getElementsByClassName("manufacture__name")[0].innerText;
return res
}).sort(function(a,b){return a.score - b.score})
window.things = things;
var bestThing = things[0];
if(!things[things.length-1].score) bestThing = things[things.length-1]
console.info("clicking " + bestThing.name)
for(var i = 0; i < things.length; i++) {
things[i].e.style.color="#fff";
}
things[0].e.style.color="#f00";
}
var timer = setInterval(clickBestThing, 500)
@diego898
Copy link

Thanks! How can I use this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment