Cookie Clicker Hack

Infinity cookies, infinity chips, autoclicker, autocookies (you should have 1 cookie).

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Cookie Clicker Hack
// @namespace    -
// @version      0.1
// @description  Infinity cookies, infinity chips, autoclicker, autocookies (you should have 1 cookie).
// @author       Nudo#3310
// @match        *://orteil.dashnet.org/cookieclicker/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=dashnet.org
// @grant        none
// ==/UserScript==

setTimeout(() => {
    (function() {
        const Script = {}

        Script.togglers = {
            autoClicker: false,
            addCookies: false,
            infinityCookies: false,
            infinityChips: false
        }

        Script.elements = {
            bigCookie: document.getElementById("bigCookie"),
            topBar: document.getElementById("topBar")
        }

        Script.clearTopBar = function() {
            this.elements.topBar.innerHTML = ""
        }

        Script.clearTopBar()

        Script.addButtonToTopBar = function(text, callback) {
            const container = document.createElement("div")
            const b = document.createElement("b")

            b.style.fontWeight = "bold"
            container.style.cursor = "pointer"

            b.innerHTML = text

            container.appendChild(b)

            this.elements.topBar.appendChild(container)

            container.addEventListener("click", () => {
                callback(b)
            })
        }

        Script.clickToCookie = function() {
            window.Game.ClickCookie()
        }

        Script.addCookies = function() {
            window.Game.cookies += window.Game.cookies * 2
        }

        Script.infinityCookies = function() {
            window.Game.cookies = Number.MAX_VALUE
        }

        Script.infinityChips = function() {
            window.Game.heavenlyChips = Number.MAX_VALUE
        }

        Script.addButtonToTopBar("Auto Clicker", (b) => {
            Script.togglers.autoClicker = !Script.togglers.autoClicker

            if (Script.togglers.autoClicker) {
                b.style.color = "#fff"

                Script.autoClickerInterval = setInterval(() => {
                    Script.clickToCookie()
                })
            } else if (Script.autoClickerInterval) {
                b.style.color = ""

                clearInterval(Script.autoClickerInterval)
            }
        })

        Script.addButtonToTopBar("Add Cookies", (b) => {
            Script.togglers.addCookies = !Script.togglers.addCookies

            if (Script.togglers.addCookies) {
                b.style.color = "#fff"

                Script.addCookiesInterval = setInterval(() => {
                    Script.addCookies()
                })
            } else if (Script.addCookiesInterval) {
                b.style.color = ""

                clearInterval(Script.addCookiesInterval)
            }
        })

        Script.addButtonToTopBar("Infinity Cookies", (b) => {
            Script.togglers.infinityCookies = !Script.togglers.infinityCookies

            if (Script.togglers.infinityCookies) {
                b.style.color = "#fff"

                Script.infinityCookiesInterval = setInterval(() => {
                    Script.infinityCookies()
                })
            } else if (Script.infinityCookiesInterval) {
                b.style.color = ""

                clearInterval(Script.infinityCookiesInterval)
            }
        })

        Script.addButtonToTopBar("Infinity Chips", (b) => {
            Script.togglers.infinityChips = !Script.togglers.infinityChips

            if (Script.togglers.infinityChips) {
                b.style.color = "#fff"

                Script.infinityChipsInterval = setInterval(() => {
                    Script.infinityChips()
                })
            } else if (Script.infinityChipsInterval) {
                b.style.color = ""

                clearInterval(Script.infinityChipsInterval)
            }
        })
    })()
}, 5000)