Cookie Clicker Mod Menu

Adds a mod menu to Cookie Clicker for cheats and enhancements.

您需要先安裝使用者腳本管理器擴展,如 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 Mod Menu
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds a mod menu to Cookie Clicker for cheats and enhancements.
// @author       ME : )
// @match        http://orteil.dashnet.org/cookieclicker/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Wait for the game to load fully
    function waitForGame() {
        if (typeof Game !== 'undefined' && Game.ready) {
            initModMenu();
        } else {
            setTimeout(waitForGame, 1000);
        }
    }

    // Initialize the mod menu
    function initModMenu() {
        // Create a new div element for the mod menu
        const modMenu = document.createElement('div');
        modMenu.style.position = 'fixed';
        modMenu.style.top = '10px';
        modMenu.style.right = '10px';
        modMenu.style.padding = '10px';
        modMenu.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
        modMenu.style.color = 'white';
        modMenu.style.zIndex = '10000';
        modMenu.style.fontFamily = 'Arial, sans-serif';
        modMenu.style.borderRadius = '5px';

        // Add title to the mod menu
        const title = document.createElement('h2');
        title.innerText = 'Cookie Clicker Mod Menu';
        title.style.marginTop = '0';
        modMenu.appendChild(title);

        // Function to create a button
        function createButton(text, onClick) {
            const button = document.createElement('button');
            button.innerText = text;
            button.style.margin = '5px';
            button.style.padding = '5px 10px';
            button.style.border = 'none';
            button.style.borderRadius = '3px';
            button.style.cursor = 'pointer';
            button.style.backgroundColor = '#444';
            button.style.color = 'white';
            button.addEventListener('click', onClick);
            modMenu.appendChild(button);
        }

        // Function to add cookies
        function addCookies(amount) {
            Game.cookies += amount;
            Game.RefreshStore();
        }

        // Function to unlock all upgrades
        function unlockAllUpgrades() {
            Game.UpgradesById.forEach(upgrade => {
                upgrade.unlock();
            });
        }

        // Function to unlock all achievements
        function unlockAllAchievements() {
            Game.AchievementsById.forEach(achievement => {
                achievement.unlock();
            });
        }

        // Function to set cookie production speed
        function setProductionSpeed(speed) {
            Game.fps = speed;
        }

        // Function to add Golden Cookies
        function addGoldenCookies(amount) {
            for (let i = 0; i < amount; i++) {
                new Game.shimmer('golden');
            }
        }

        // Add buttons to the mod menu
        createButton('Add 1 Million Cookies', () => addCookies(1000000));
        createButton('Add 1 Billion Cookies', () => addCookies(1000000000));
        createButton('Unlock All Upgrades', unlockAllUpgrades);
        createButton('Unlock All Achievements', unlockAllAchievements);
        createButton('Set Fast Production (60 FPS)', () => setProductionSpeed(60));
        createButton('Add 10 Golden Cookies', () => addGoldenCookies(10));

        // Add the mod menu to the document body
        document.body.appendChild(modMenu);
    }

    // Start the waiting process
    waitForGame();
})();