Skip to content

Instantly share code, notes, and snippets.

@ormaaj
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ormaaj/9df9738f9be581a269d5 to your computer and use it in GitHub Desktop.
Save ormaaj/9df9738f9be581a269d5 to your computer and use it in GitHub Desktop.
cookie clicker bot
"use strict";
function cookiePwn(interval) {
return setInterval(function() {
Game.ClickCookie();
if ((Game.elderWrath >= 3 || !(Game.cookieClicks % 4)) && (!Game.clickFrenzy || Game.timersEl.elderFrenzy.style.display !== "block")) {
do {
Game.goldenCookie.spawn();
} while (Game.elderWrath < 3 && Game.goldenCookie.wrath);
Game.goldenCookie.click();
Game.seasonPopup.spawn();
Game.seasonPopup.click();
Game.Notes.splice(0, Game.Notes.length);
Game.NotesById.splice(0, Game.NotesById.length); // Truncate the notes object array. Otherwise it grows forever.
Game.frenzyPower < 1 && (Game.frenzy = 0);
}
}, interval);
}
// Game.ObjectsById.forEach(function(x) { x.buy(100); })
// pwnIntervals.push(setInterval(function() { Game.wrinklers.filter(function(x) { return x.close === 1; }).forEach(function(x) { x.hp = 0; }); }, 120000))
function wrinklerPwn(interval) {
return setInterval(Game.CollectWrinklers, interval);
}
function buyAvailableUpgrades() {
Game.UpgradesInStore.slice(0).sort(function(x, y) { return x.getPrice() - y.getPrice(); }).every(function(x) {
var uid = Game.UpgradesById[x.id]; // Store button event handlers are currently bound to UpgradesById.buy()
if (uid.getPrice() > Game.cookies) {
console.log("Ran out of bling while trying to buy " + uid.name);
return false;
} else if (uid.pool !== "toggle") { // Bypass seasons and the elder covenanat / pledge
uid.buy();
}
return true;
});
}
if (typeof pwnIntervals === "undefined") {
var pwnIntervals = new Array();
} else {
while (pwnIntervals.length > 0) {
clearInterval(pwnIntervals.pop());
}
}
pwnIntervals.push(cookiePwn(4), wrinklerPwn(5000));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment