Skip to content

Instantly share code, notes, and snippets.

@alexwilson
Last active September 24, 2020 07:24
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 alexwilson/6cc63d7f08f4d0ac24a69be89aa5e97b to your computer and use it in GitHub Desktop.
Save alexwilson/6cc63d7f08f4d0ac24a69be89aa5e97b to your computer and use it in GitHub Desktop.
Alex's Bakery - A Cooke Clicker autoclicker, using its official API

Alex's Bakery

What is this?**

In short, an auto-clicker for cookie-clicker.

How do I use this?**

This is bookmarklet friendly! You can drag & drop the following link into your bookmarks, or alternatively, directly into the game: Bookmarklet

Alternatively copy the below code, and save it as a bookmark.

javascript:(function() {
    Game.LoadMod("https://gistcdn.githack.com/alexwilson/6cc63d7f08f4d0ac24a69be89aa5e97b/raw/alex's%20bakery.js");
}());

License

MIT

/**
* A very, very rudimentary auto-clicker for Cookie Clicker.
* For instructions, see README.md
*
* @license MIT
*/
class AlexsBakery {
/**
* @param {Game} The main Cookie Clicker game option.
*/
constructor(game) {
this._game = game;
}
/**
* Start all timers.
*/
start() {
this._clickCookies = setInterval(this.click.bind(this), 1);
this._clickGoldenCookies = setInterval(this.clickGoldenCookies.bind(this), 250);
}
/**
* Stop all timers.
*/
stop() {
clearInterval(this._clickCookies);
clearInterval(this._clickGoldenCookies);
}
/**
* Click the main cookie.
*/
click() {
this._game.ClickCookie();
}
/**
* Click all available golden cookies.
* Filters out golden cookies.
*/
clickGoldenCookies() {
this._game.shimmers
.filter(shimmer => shimmer.type == "golden" && shimmer.wrath == 0)
.forEach(shimmer => shimmer.pop())
}
}
if (window.Game) {
window.alexsBakery = new AlexsBakery(window.Game)
window.alexsBakery.start();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment