CookieClicker

CookieClicker Extension

当前为 2016-03-15 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name           CookieClicker
// @namespace      CookieClickerExtension
// @include        http://orteil.dashnet.org/cookieclicker/
// @author         Dummbroesel
// @description    CookieClicker Extension
// @version		   1.1.0
// ==/UserScript==

document._g = false;
document._c = false;
document._o = false;
document._u = false;
document._s = false;

document._goldenCookieSpawnAndClickCHEAT;
document._clickBigCookieCHEAT;

document._products;
document._upgrades;

document._purchaseObjectCheat;
document._purchaseUpgradesCHEAT;
document._goldenCookieListenerCHEAT

document._autoPurchaseObject;
document._autoPurchaseUpgrade;

document._gcc;

document.onkeypress = function(event) {
  	console.log(event.keyCode);
    if (event.keyCode == 32) {
        document._products = document.getElementById('products').children;
        document._upgrades = document.getElementById('upgrades').children;
        document._autoPurchaseObject = function autoPurchaseObject() {
            for (i = document._products.length-1; i >= 0; i--) 
            {
                if(document._products[i].classList.contains('enabled')) { 
                    document._products[i].click();
                    return false;
                }
            }
        };
        document._autoPurchaseUpgrade = function autoPurchaseUpgrade() { 
            if(Game.UpgradesInStore.length < 1) return false;
            if(Game.UpgradesInStore.length == 1)
            {
                var _firstChild = document._upgrades[0];
                if(_firstChild.classList.contains('enabled'))
                {
                    if (Game.UpgradesInStore[0].name == "Elder Covenant" 
                        || Game.UpgradesInStore[0].name.indexOf("Ghostly biscuit") >=0 
                        || Game.UpgradesInStore[0].name.indexOf("Fool's biscuit") >=0
                        || Game.UpgradesInStore[0].name.indexOf("Lovesick biscuit") >=0
                        || Game.UpgradesInStore[0].name.indexOf("Festive biscuit") >=0
                        || Game.UpgradesInStore[0].name.indexOf("Milk selector") >=0
                        || Game.UpgradesInStore[0].name.indexOf("Golden switch [off]") >=0
                        || Game.UpgradesInStore[0].name.indexOf("Bunny biscuit") >=0) 
                    { 
                        return false;
                    }
                    _firstChild.click();
                }
            }
            if(Game.UpgradesInStore.length > 1)
            {
                for (i=0;i<document._upgrades.length;i++){
                    if(document._upgrades[i].classList.contains('enabled')) {
                        if (Game.UpgradesInStore[i].name == "Elder Covenant"
                        || Game.UpgradesInStore[i].name.indexOf("Ghostly biscuit") >=0 
                        || Game.UpgradesInStore[i].name.indexOf("Fool's biscuit") >=0
                        || Game.UpgradesInStore[i].name.indexOf("Lovesick biscuit") >=0
                        || Game.UpgradesInStore[i].name.indexOf("Festive biscuit") >=0
                        || Game.UpgradesInStore[i].name.indexOf("Milk selector") >=0
                        || Game.UpgradesInStore[i].name.indexOf("Golden switch [off]") >=0
                        || Game.UpgradesInStore[i].name.indexOf("Bunny biscuit") >=0) 
                        { 
                            
                        }
                        else {
                            document._upgrades[i].click();
                        }
                    }
                    else {
                        break;
                    }
                }
                
                //var _firstChild = document._upgrades[0];
                //var _secondChild = document._upgrades[1];
                //if(_firstChild.classList.contains('enabled'))
                //{
                //    if (Game.UpgradesInStore[0].name == "Elder Covenant" && Game.UpgradesInStore[0].basePrice == 66666666666666) 
                //    { 
                //        if(_secondChild.classList.contains('enabled'))
                //        {
                //            _secondChild.click();
                //        }
                //    } else {
                //        _firstChild.click();
                //    }
                //}
            }
        };
        document._gcc = function () {
          if (Game.goldenCookie.life > 0) Game.goldenCookie.click();
        };
        
        console.log('Initilized');
    } else if (event.keyCode == 103) {
    //g goldencookie spawn&clicker
        if(document._g) { 
            clearInterval(document._goldenCookieSpawnAndClickCHEAT);
            document._g = false;
            console.log('GoldenCookieSpawn&Clicker Deactivated');
        }
        else {
            document._goldenCookieSpawnAndClickCHEAT = setInterval("Game.goldenCookie.spawn(); Game.goldenCookie.click();", 5); 
            document._g = true;
            console.log('GoldenCookieSpawn&Clicker Activated');
        }
    } else if (event.keyCode == 99) {
    //c bigcookie clicker
        if (document._c) { clearInterval(document._clickBigCookieCHEAT); document._c = false; console.log('BigCookieClicker Deactivated'); }
        else {
            document._clickBigCookieCHEAT = setInterval("Game.ClickCookie();", 5); 
            document._c = true;
            console.log('BigCookieClicker Activated');
        }
    } else if (event.keyCode == 111) {
    //o Buildings purchaser
  		if(document._o) { 
            clearInterval(document._purchaseObjectCheat);
            document._o = false; 
            console.log('AutoObjectPurchaser Deactivated');
        }
        else{
            document._purchaseObjectCheat = setInterval('document._autoPurchaseObject()', 10);
            document._o = true;
            console.log('AutoObjectPurchaser Activated');
        }
    } else if (event.keyCode == 117) {
    //u Upgrade purchaser
        if (document._u) { 
            clearInterval(document._purchaseUpgradesCHEAT); 
            document._u = false; 
            console.log('AutoUpgradePurchaser Deactivated');
        }
        else {
            document._purchaseUpgradesCHEAT = setInterval("document._autoPurchaseUpgrade()", 10);
            document._u = true;
            console.log('AutoUpgradePurchaser Activated');
        }
    } else if(event.keyCode == 114) {
    //r Reset Game keep Achievments
      	Game.Reset(true);
    	console.log('Game successfully reset!');
	} else if (event.keyCode == 115) {
    //s GoldenCookieClicker
        if (document._s) { 
            clearInterval(document._goldenCookieListenerCHEAT); 
            document._s = false; 
            console.log('GoldenCookieClicker Deactivated');
        }
        else {
            document._goldenCookieListenerCHEAT = setInterval("document._gcc()", 1000);
            document._s = true;
            console.log('GoldenCookieClicker Activated');
        }
    } else if(event.keyCode == 113) {
    	Game.goldenCookie.spawn();
    }
}