Cookie Clicker Helper

Cookie Clicker Helper Menu

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Cookie Clicker Helper
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Cookie Clicker Helper Menu
// @icon         https://cdn.dashnet.org/cookieclicker/img/goldCookie.png
// @author       You
// @match        https://orteil.dashnet.org/cookieclicker/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function addCookies() {
        Game.cookies += 5000;
    }

    function resetCookies() {
        Game.cookies = 0;
    }

    function resetgame() {
        Game.HardReset(2);
    }

    function createGUI() {
        const gui = document.createElement('div');
        gui.id = 'mod-menu';
        gui.style.position = 'fixed';
        gui.style.top = '10px';
        gui.style.left = '10px';
        gui.style.zIndex = '9999';
        gui.style.background = 'rgba(0, 0, 0, 0.5)';
        gui.style.color = 'white';
        gui.style.padding = '10px';
        gui.style.borderRadius = '5px';
        gui.style.cursor = 'move';
        gui.innerHTML = `
            <div style="font-weight: bold;">Mod Menu</div>
            <button id="add-cookies-button">Add 5000 Cookies</button><br>
            <button id="reset-cookies-button">Reset Cookies</button><br>
            <button id="reset-game-button">Reset Game</button>
        `;
        document.body.appendChild(gui);

        let offsetX, offsetY;
        let dragging = false;

        gui.addEventListener('mousedown', function(e) {
            dragging = true;
            offsetX = e.clientX - gui.getBoundingClientRect().left;
            offsetY = e.clientY - gui.getBoundingClientRect().top;
        });

        document.addEventListener('mousemove', function(e) {
            if (dragging) {
                gui.style.left = (e.clientX - offsetX) + 'px';
                gui.style.top = (e.clientY - offsetY) + 'px';
            }
        });

        document.addEventListener('mouseup', function() {
            dragging = false;
        });

        const addButton = document.getElementById('add-cookies-button');
        addButton.addEventListener('click', addCookies);

        const resetButton = document.getElementById('reset-cookies-button');
        resetButton.addEventListener('click', resetCookies);

        const resetgameButton = document.getElementById('reset-game-button');
        resetgameButton.addEventListener('click', resetgame);
    }

    const checkLoaded = setInterval(function() {
        if (typeof Game !== 'undefined' && Game.ready) {
            clearInterval(checkLoaded);
            createGUI();
        }
    }, 1000);
})();