|
/** |
|
* Auto Bulding Buyer Cookie Clicker |
|
* game found here: http://orteil.dashnet.org/cookieclicker/ |
|
*/ |
|
|
|
|
|
/** |
|
* How to in Chrome: |
|
* Open the browers and navigate to http://orteil.dashnet.org/cookieclicker/ |
|
* then pressCTRL + SHIFT + J to open the developer console. |
|
* Then pick which sections you want to use. Core MUST be ran first, then you can insert any section in any order. |
|
* If you want to enable everything then just copy and paste this entire script in. |
|
*/ |
|
|
|
/* ******************** Core ******************** */ |
|
/** |
|
* Core must be installed for any functions to work, copy and paste this into the console first. |
|
*/ |
|
function doEvent(element, type) { |
|
trigger = document.createEvent('HTMLEvents'); |
|
trigger.initEvent(type, true, true); |
|
element.dispatchEvent(trigger); |
|
} |
|
/* ******************** End Core ******************** */ |
|
|
|
/* ******************** Auto Buyer ******************** */ |
|
|
|
/** |
|
* Auto Buyer will do its best to buy the most efficient upgrade for you. |
|
*/ |
|
function autoBuyBuilding() { |
|
|
|
var i; |
|
var bestValueItem = 0; |
|
for (i = 0; i < Game.ObjectsById.length; i++) { |
|
if (Game.ObjectsById[i].locked == 1){ |
|
continue |
|
} |
|
var bestItemPrice = Game.ObjectsById[bestValueItem].storedCps / Game.ObjectsById[bestValueItem].price |
|
var itemPrice = Game.ObjectsById[i].storedCps / Game.ObjectsById[i].price |
|
if (itemPrice > bestItemPrice){ |
|
bestValueItem = i |
|
} |
|
//console.log(Game.ObjectsById[i].name + " Cost/Value: " + itemPrice ) |
|
|
|
} |
|
var bestObject = Game.ObjectsById[bestValueItem] |
|
if (Game.cookies >= bestObject.price){ |
|
console.log("Buying " + bestObject.name) |
|
Game.ObjectsById[bestValueItem].buy() |
|
} else { |
|
console.log("Waiting to buy: " + bestObject.name) |
|
} |
|
|
|
window.setTimeout(autoBuyBuilding, 500); |
|
} |
|
|
|
|
|
|
|
window.setTimeout(autoBuyBuilding, 25); |
|
|
|
/* ****************** End Auto Buyer ****************** */ |
|
|
|
|
|
|
|
|
|
/* ******************** Auto Upgrade ******************** */ |
|
/** |
|
* Auto upgrade buys any building upgrade that it can afford. |
|
* It does not do any sort of calcuation to figure out best value or if you're better off buying a building. |
|
* It will ONLY buy building upgrades. Pledge, Cookie Production multipliers, and mouse upgrades must be bought manually. |
|
*/ |
|
function autoBuyUpgrades(){ |
|
for (i = 0; i < Game.UpgradesById.length; i++) { |
|
// Have we bought it yet or not? |
|
if (Game.UpgradesById[i].bought == 1){ |
|
continue |
|
} |
|
// Can we buy it? |
|
if (Game.UpgradesById[i].canBuy() != true){ |
|
continue |
|
} |
|
// Not tied to a building, skip Pledge, Fingers, |
|
if (Game.UpgradesById[i].buildingTie == 0){ |
|
continue |
|
} |
|
if (Game.cookies >= Game.UpgradesById[i].getPrice()){ |
|
console.log("Buying " + Game.UpgradesById[i].name + ": " + i) |
|
Game.UpgradesById[i].buy() |
|
break |
|
} |
|
} |
|
window.setTimeout(autoBuyUpgrades, 500); |
|
} |
|
window.setTimeout(autoBuyUpgrades, 25); |
|
/* ****************** End Auto Upgrade ****************** */ |
|
|
|
/* ****************** Auto Gold Cookie Clicker ****************** */ |
|
|
|
function popGolden() { |
|
for (i = 0; i < Game.shimmers.length; i++) { |
|
if (Game.shimmers[i].type != "golden"){ |
|
continue |
|
} |
|
Game.shimmers[i].pop() |
|
break |
|
|
|
} |
|
window.setTimeout(popGolden, 25); |
|
} |
|
window.setTimeout(popGolden, 25); |
|
/* ****************** End Gold Cookie Clicker ****************** */ |
|
|
|
/* ****************** Auto Clicker Cookie Clicker ****************** */ |
|
|
|
function clickBig() { |
|
var element = document.getElementById("bigCookie"); |
|
if(element !== undefined) { |
|
doEvent(element, "click"); |
|
} |
|
window.setTimeout(clickBig, 25); |
|
} |
|
window.setTimeout(clickBig, 25); |
|
/* ****************** End Auto Clicker Cookie Clicker ****************** */ |