Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* HoodModzV1 Cookie Clicker Menu 1.0 */
- //variables
- var CheatButton = document.createElement("div");
- var hidden = true;
- var oldNode = l("links").firstChild;
- var newNode = document.createElement("span");
- var t = document.createTextNode("Cheat");
- var clickerBotC = 0;
- var clickerBotG = 0;
- var buyBot = 0;
- var pledgeBot = 0;
- var CAmount = 0;
- var HAmount = 0;
- var BAmount = 0;
- var CClickSpeed = 5;
- var GClickSpeed = 5;
- var MFix = false;
- var HFix = false;
- var BFree = false;
- var bypass = false;
- var goldenChoice = 'any';
- var buildingChoice = 'all';
- var Flast = 1;
- var Fpow = 1;
- var SHours = 0;
- var MilkLvl = 0;
- var displayUpgradeHack = '';
- var displayAchievementHack = '';
- var ABCps;
- var ABName;
- var ABPrice;
- var ABText = '';
- var ABInterval = 250;
- var ABCurrentCps;
- var ABSelected = 0;
- var ABOptimal;
- var PTime = 0;
- var focused = false;
- var intRegex = /^\d+$/;
- Game.prefs.antilag = 1;
- Game.prefs.autoupdatemenu = 1;
- Game.prefs.protection = 1;
- //draw buttons
- CheatButton.setAttribute("id", "cheatButton");
- CheatButton.setAttribute("class", "button");
- CheatButton.setAttribute("onMouseOver", "this.style.right=\"-8px\"");
- CheatButton.setAttribute("onMouseOut", "this.style.right=\"-16px\"");
- CheatButton.style.padding = "14px 16px 10px 0px";
- CheatButton.style.top = "0px";
- CheatButton.style.right = "-16px";
- CheatButton.appendChild(t);
- l("comments").insertBefore(CheatButton, l("logButton"));
- l('cheatButton').onclick = function () {
- Game.ShowMenu('cheat');
- };
- newNode.setAttribute("id", "newNode");
- newNode.innerHTML = /*'<a class="option" style="height:16px" id="protection" onclick="Game.Toggle(\'protection\',\'protection\',\'protection:on\',\'protection:off\')">' + (Game.prefs.autoupdatemenu ? 'protection:on' : 'protection:off') + '</a> | */'<a class="option" style="height:16px" id="autoupdatemenu" onclick="Game.Toggle(\'autoupdatemenu\',\'autoupdatemenu\',\'autoupdate:on\',\'autoupdate:off\')">' + (Game.prefs.autoupdatemenu ? 'autoupdate:on' : 'autoupdate:off') + '</a> | <a class="option" style="height:16px" id="antilag" onclick="Game.Toggle(\'antilag\',\'antilag\',\'antilag:on\',\'antilag:off\')">' + (Game.prefs.antilag ? 'antilag:on' : 'antilag:off') + '</a> | <a class="option" style="height:16px" id="autosave" onclick="Game.Toggle(\'autosave\',\'autosave\',\'autosave:on\',\'autosave:off\')">' + (Game.prefs.autosave ? 'autosave:on' : 'autosave:off') + '</a> | ';
- l("links").insertBefore(newNode, oldNode);
- document.addEventListener('keydown', function (event) {
- if (event.keyCode == 80) {
- if (hidden) {
- l("cheatButton").setAttribute("hidden", "true");
- Game.ShowMenu(Game.onMenu);
- Game.Toggle('autobuy', 'autoBuy', 'Autobuy: ON', 'Autobuy: OFF');
- clearInterval(buyBot);
- BuyBot = 0;
- Game.Toggle('autoclick', 'autoClick', 'AutoClick ON', 'AutoClick OFF');
- clearInterval(clickerBotC);
- clickerBotC = 0;
- Game.Toggle('autogolden', 'autoGolden', 'AutoGolden: ON', 'AutoGolden: OFF');
- clearInterval(clickerBotG);
- clickerBotG = 0;
- } else {
- l("cheatButton").removeAttribute("hidden");
- }
- hidden = !hidden;
- }
- });
- //cheat menu
- Game.oldUpdateMenu = Game.UpdateMenu;
- Game.UpdateMenu = function () {
- var str = '';
- if (Game.onMenu != 'cheat') {
- return Game.oldUpdateMenu();
- }
- if (Game.onMenu !== '') {
- str += '<div style="position:absolute;top:8px;right:8px;cursor:pointer;font-size:16px;" onclick="Game.ShowMenu(Game.onMenu);">X</div>';
- }
- if (Game.onMenu == 'cheat') {
- str += '<div class="section">Cheat</div>' +
- '<div class="subsection">' +
- '<div class="title">Configuration</div>' +
- '<div class="listing"><a class="option" onclick="SaveConfig(0);">Save configuration</a><a class="option" onclick="LoadConfig(0);">Load Configuration</a><a class="option" onclick="SaveConfig(1);">Delete save</a><br></div>' +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Give cookies</div>' +
- '<form>' +
- '<div class="listing"><b>how many:</b> <input id="CAmount" type="number" name="CAmount" value="' + CAmount + '" step="1" min="0" onfocus="focused = true;" onblur="focused = false;"><input id="MFix" type="checkbox" name="MFix" value="MFix" onfocus="focused = true;" onblur="focused = false;"><b>fixed </b><a class="option" onclick="GetCookies();">Get cookies</a><br></div>' +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Auto-click big cookie</div>' +
- '<form>' +
- '<div class="listing"><b>interval:</b> <input id="CClickSpeed" type="range" value="' + CClickSpeed + '" min="5" max="1000" name="CClickSpeed" onchange=l("displayCClickSpeed").innerHTML=l("CClickSpeed").value step="5" style="width:250px" onfocus="focused = true;" onblur="focused = false;"> <b><span id="displayCClickSpeed">' + CClickSpeed + '</span>ms</b> ' + Game.WriteButton('autoclick', 'autoClick', 'AutoClick ON', 'AutoClick OFF', 'ClickCookie();') + '<br></div>' +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Auto-click golden cookies</div>' +
- '<form>' +
- '<div class="listing"><input id="bypass" type="checkbox" name="bypass" value="bypass" onfocus="focused = true;" onblur="focused = false;"><b>bypass time; interval:</b> <input id="GClickSpeed" type="range" value="' + GClickSpeed + '" min="5" max="1000" name="GClickSpeed" onchange=l("displayGClickSpeed").innerHTML=l("GClickSpeed").value step="5" style="width:250px" onfocus="focused = true;" onblur="focused = false;"> <b><span id="displayGClickSpeed">' + GClickSpeed + '</span>ms</b>' + Game.WriteButton('autogolden', 'autoGolden', 'AutoGolden: ON', 'AutoGolden: OFF', 'ClickGolden();') + '<br></div>' +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Spawn a golden cookie</div>' +
- '<form>' +
- '<div class="listing"><select name="goldenChoice" id="goldenChoice" value="' + goldenChoice + '" onfocus="focused = true;" onblur="focused = false;"><option value="any" id="SelectedChoice_any">Any</option><option value="clot" id="SelectedChoice_clot">Clot</option><option value="multiply cookies" id="SelectedChoice_multiply cookies">Lucky</option><option value="ruin cookies" id="SelectedChoice_ruin cookies">Ruin</option><option value="frenzy" id="SelectedChoice_frenzy">Frenzy</option><option value="blood frenzy" id="SelectedChoice_blood frenzy">Elder Frenzy</option><option value="chain cookie" id="SelectedChoice_chain cookie">Chain Cookie</option><option value="click frenzy" id="SelectedChoice_click frenzy">Click Frenzy</option><option value="blab" id="SelectedChoice_blab">Blab</option></select><a class="option" onclick="SpawnGolden();">Spawn a golden cookie</a><br></div>' +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Create a frenzy</div>' +
- '<form>' +
- '<div class="listing"><b>Last </b><input id="Flast" type="number" name="Flast" value="' + Flast + '" step="1" Style="width:50px" min="1" onfocus="focused = true;" onblur="focused = false;"><b> seconds; multiply by </b><input id="Fpow" type="number" name="Fpow" value="' + Fpow + '" step="1" Style="width:100px" min="1" onfocus="focused = true;" onblur="focused = false;"><a class="option" onclick="SpawnFrenzy();">Spawn the custom frenzy</a><br></div>' +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Change the game started value</div>' +
- '<form>' +
- '<div class="listing"><b>Game started </b><input id="SHours" type="number" name="SHours" value="' + SHours + '" step="1" min="0" onfocus="focused = true;" onblur="focused = false;"><b> hours ago </b><a class="option" onclick="SetStartDate();">Set the time</a><br></div>' +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Hack Heavenly Chips</div>' +
- '<form>' +
- '<div class="listing"><b>Amount of H.C: </b><input id="HAmount" type="number" name="HAmount" value="' + HAmount + '" step="1" min="0" onfocus="focused = true;" onblur="focused = false;"><input id="HFix" type="checkbox" name="HFix" value="HFix" onfocus="focused = true;" onblur="focused = false;"><b>fixed </b><a class="option" onclick="GetHeavenly();">Get Heavenly Chips</a></div>' +
- '</form><br></div>' +
- '<div class="subsection">' +
- '<div class="title">Set Milk level</div>' +
- '<form>' +
- '<div class="listing"><b>set Milk level: </b><input id="MilkLvl" type="number" name="MilkLvl" value="' + MilkLvl + '" step="1" Style="width:100px" min="0" onfocus="focused = true;" onblur="focused = false;"><b> % </b><a class="option" onclick="SetMilk();">Set Milk</a><br></div>' +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Upgrade Hack!</div>' +
- '<form>' +
- '<div class="listing">' + Game.WriteButton('upgradehack', 'upgradeHack', 'Upgrade Hack!: ON', 'Upgrade Hack: OFF', 'UpgradeHack();SmartUpdateMenu();') + '<a class="option" onclick="AllUpgrades();">Toggle all upgrades</a>' +
- '<br><div id="displayUpgradeHack" style="overflow-y:hidden;">' + displayUpgradeHack + '</div><br></div>' +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Hack achievements</div>' +
- '<form>' +
- '<div class="listing">' + Game.WriteButton('achievementhack', 'achievementHack', 'Hack achievements: ON', 'Hack achievements: OFF', 'AchievementHack();SmartUpdateMenu();') + '<a class="option" onclick="AllAchievements();">Toggle all achievements</a>' +
- '<br><div id="displayAchievementHack" style="overflow-y:hidden;">' + displayAchievementHack + '</div><br></div>' +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Autobuy</div>' +
- '<form>' +
- '<div class="listing">' + Game.WriteButton('autobuy', 'autoBuy', 'Autobuy: ON', 'Autobuy: OFF', 'AutoBuy();') +
- '<br><div id="displayAutoBuyText">' + ABText + '</div><br></div>' +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Hack buildings</div>' +
- '<form>' +
- '<div class="listing"><select name="buildingChoice" id="buildingChoice" value="' + buildingChoice + '" onfocus="focused = true;" onblur="focused = false;">' + SelectBuilding() + '</select><b>Amount of building: </b><input id="BAmount" type="number" name="BAmount" value="' + BAmount + '" step="1" min="0" onfocus="focused = true;" onblur="focused = false;"><input id="BFree" type="checkbox" name="BFree" value="BFree" onfocus="focused = true;" onblur="focused = false;"><b>set price to 0 </b><a class="option" onclick="GetBuilding();">Hack buildings</a><br></div>' +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Instant research</div>' +
- '<form>' +
- '<div class="listing">' + Game.WriteButton('instantsearch', 'instantSearch', 'Instant search: ON', 'Instant search: OFF', 'InstantSearch();') +
- '</form></div>' +
- '<div class="subsection">' +
- '<div class="title">Custom pledges</div>' +
- '<form>' +
- '<div class="listing"><b>how many minutes:</b> <input id="PTime" type="number" name="PTime" value="' + PTime + '" step="1" min="0" onfocus="focused = true;" onblur="focused = false;">' + Game.WriteButton('autobuypledge', 'autoBuyPledge', 'Autobuy Pledge: ON', 'Autobuy Pledge: OFF', 'ABPledge();') + '<a class="option" onclick="CustomPledge();">Custom Pledge</a><br></div>' +
- '</form></div>';
- }
- l("menu").innerHTML = str;
- l("MFix").checked = MFix;
- l("HFix").checked = HFix;
- l("BFree").checked = BFree;
- l("bypass").checked = bypass;
- l("SelectedChoice_" + goldenChoice).setAttribute("selected", "true");
- l("SelectedChoice_" + buildingChoice).setAttribute("selected", "true");
- if (Game.prefs.upgradehack) {
- UpgradeHack();
- }
- if (Game.prefs.achievementhack) {
- AchievementHack();
- }
- if (Game.prefs.autoclick && clickerBotC === 0) {
- ClickCookieFunction();
- }
- if (Game.prefs.autogolden && clickerBotG === 0) {
- ClickGoldenFunction();
- }
- if (Game.prefs.autobuy && buyBot === 0) {
- AutoBuyFunction();
- }
- };
- //modified original code
- Game.Draw = function () {
- Game.DrawBackground();
- var unit=(Math.round(Game.cookiesd)==1?' cookie':' cookies');
- if (Math.round(Game.cookiesd).toString().length>11 && !Game.mobile) unit='<br>cookies';
- var str=Beautify(Math.round(Game.cookiesd))+unit+'<div style="font-size:50%;">per second : '+Beautify(Game.cookiesPs,1)+'</div>';//display cookie amount
- l('cookies').innerHTML=str;
- l('compactCookies').innerHTML=str;
- Game.TickerDraw();
- for (var i in Game.Objects)
- {
- var me=Game.Objects[i];
- if (Game.cookies>=me.price) l('product'+me.id).className='product enabled'; else l('product'+me.id).className='product disabled';
- if (l('rowInfo'+me.id) && Game.T%5==0) l('rowInfoContent'+me.id).innerHTML='• '+me.amount+' '+(me.amount==1?me.single:me.plural)+'<br>• producing '+Beautify(me.storedTotalCps,1)+' '+(me.storedTotalCps==1?'cookie':'cookies')+' per second<br>• total : '+Beautify(me.totalCookies)+' '+(Math.floor(me.totalCookies)==1?'cookie':'cookies')+' '+me.actionName;
- }
- for (var i in Game.UpgradesInStore)
- {
- var me=Game.UpgradesInStore[i];
- if (Game.cookies>=me.basePrice) l('upgrade'+i).className='crate upgrade enabled'; else l('upgrade'+i).className='crate upgrade disabled';
- }
- if (Math.floor(Game.T % Game.fps / 2) === 0 && Game.onMenu != 'cheat' && Game.prefs.autoupdatemenu) Game.UpdateMenu();
- else if (Math.floor(Game.T % Game.fps / 2) === 0 && Game.onMenu == 'cheat' && !focused && Game.prefs.autoupdatemenu) SmartUpdateMenu();
- Game.cookieNumbersUpdate();
- Game.particlesUpdate();
- Game.drawT++;
- };
- Game.goldenCookie.choose = function () {
- if (goldenChoice == 'any') {
- var list=[];
- if (Game.goldenCookie.wrath>0) list.push('clot','multiply cookies','ruin cookies');
- else list.push('frenzy','multiply cookies');
- if (Game.goldenCookie.wrath>0 && Math.random()<0.3) list.push('blood frenzy','chain cookie');
- else if (Math.random()<0.01 && Game.cookiesEarned>=100000) list.push('chain cookie');
- if (Math.random()<0.1) list.push('click frenzy');
- if (Game.goldenCookie.last!='' && Math.random()<0.8 && list.indexOf(Game.goldenCookie.last)!=-1) list.splice(list.indexOf(Game.goldenCookie.last),1);
- if (Math.random()<0.0001) list.push('blab');
- var choice=choose(list);
- return choice;
- } else if (goldenChoice != 'any') {
- return goldenChoice;
- }
- };
- Game.Loop = function () {
- Game.catchupLogic = 0;
- Game.Logic();
- Game.catchupLogic = 1;
- Game.accumulatedDelay += ((new Date().getTime() - Game.time) - 1000 / Game.fps);
- Game.accumulatedDelay = Math.min(Game.accumulatedDelay, 1000 * 5);
- Game.time = new Date().getTime();
- while (Game.accumulatedDelay > 0) {
- if (clickerBotG !== 0 && Game.prefs.antilag && Game.accumulatedDelay > 500) {
- Game.Toggle('autogolden', 'autoGolden', 'AutoGolden: ON', 'AutoGolden: OFF');
- clearInterval(clickerBotG);
- clickerBotG = 0;
- }
- if (clickerBotC !== 0 && Game.prefs.antilag && Game.accumulatedDelay > 500) {
- Game.Toggle('autoclick', 'autoClick', 'AutoClick ON', 'AutoClick OFF');
- clearInterval(clickerBotC);
- clickerBotC = 0;
- }
- if (buyBot !== 0 && Game.prefs.antilag && Game.accumulatedDelay > 500) {
- Game.Toggle('autobuy', 'autoBuy', 'Auto_Buy: ON', 'Auto_Buy: OFF');
- clearInterval(buyBot);
- ABText = '';
- BuyBot = 0;
- }
- Game.Logic();
- Game.accumulatedDelay -= 1000 / Game.fps;
- }
- Game.catchupLogic = 0;
- Game.Draw();
- setTimeout(Game.Loop, 1000 / Game.fps);
- };
- Game.Win = function (what) {
- if (typeof what === 'string') {
- if (Game.Achievements[what]) {
- if (Game.Achievements[what].won === 0) {
- Game.Achievements[what].won = 1;
- Game.Popup('Achievement unlocked :<br>' + Game.Achievements[what].name + '<br> ');
- if (Game.Achievements[what].hide != 3) {
- Game.AchievementsOwned++;
- }
- Game.recalculateGains = 1;
- if (displayAchievementHack !== '') {
- AchievementHack();
- }
- }
- }
- } else {
- for (var i in what) {
- Game.Win(what[i]);
- }
- }
- };
- //functions
- function SmartUpdateMenu() {
- if (intRegex.test(parseInt(l("CAmount").value, 10)) || !Game.prefs.protection) {
- CAmount = parseInt(l("CAmount").value, 10);
- }
- if (intRegex.test(parseInt(l("HAmount").value, 10)) || !Game.prefs.protection) {
- HAmount = parseInt(l("HAmount").value, 10);
- }
- if (intRegex.test(parseInt(l("BAmount").value, 10)) || !Game.prefs.protection) {
- BAmount = parseInt(l("BAmount").value, 10);
- }
- if (intRegex.test(parseInt(l("PTime").value, 10)) || !Game.prefs.protection) {
- PTime = parseInt(l("PTime").value, 10);
- }
- if (intRegex.test(parseInt(l("Fpow").value, 10)) || !Game.prefs.protection) {
- Fpow = parseInt(l("Fpow").value, 10);
- }
- if (intRegex.test(parseInt(l("Flast").value, 10)) || !Game.prefs.protection) {
- Flast = parseInt(l("Flast").value, 10);
- }
- if (intRegex.test(parseInt(l("SHours").value, 10)) || !Game.prefs.protection) {
- SHours = parseInt(l("SHours").value, 10);
- }
- if (intRegex.test(parseInt(l("CClickSpeed").value, 10)) || !Game.prefs.protection) {
- CClickSpeed = parseInt(l("CClickSpeed").value, 10);
- }
- if (intRegex.test(parseInt(l("GClickSpeed").value, 10)) || !Game.prefs.protection) {
- GClickSpeed = parseInt(l("GClickSpeed").value, 10);
- }
- if (intRegex.test(parseInt(l("MilkLvl").value, 10)) || !Game.prefs.protection) {
- MilkLvl = parseInt(l("MilkLvl").value, 10);
- }
- MFix = l("MFix").checked;
- HFix = l("HFix").checked;
- BFree = l("BFree").checked;
- bypass = l("bypass").checked;
- goldenChoice = l("goldenChoice").value;
- buildingChoice = l("buildingChoice").value;
- Game.UpdateMenu();
- }
- function SaveConfig(remove) {
- SmartUpdateMenu();
- Game.WriteSave();
- if (!remove) {
- var str = '';
- str += (Game.prefs.antilag ? '1' : '0') + (Game.prefs.autoupdatemenu ? '1' : '0') + (Game.prefs.autoclick ? '1' : '0') + (Game.prefs.autogolden ? '1' : '0') + (Game.prefs.upgradehack ? '1' : '0') + (Game.prefs.achievementhack ? '1' : '0') + (Game.prefs.autobuy ? '1' : '0') + (Game.prefs.instantsearch ? '1' : '0') + (Game.prefs.autobuypledge ? '1' : '0') + (MFix ? '1' : '0') + (HFix ? '1' : '0') + (BFree ? '1' : '0') + (bypass ? '1' : '0') +
- '|';
- str += parseInt(Math.floor(CAmount), 10) + ';' + parseInt(Math.floor(BAmount), 10) + ';' + parseInt(Math.floor(HAmount), 10) + ';' + parseInt(Math.floor(PTime), 10) + ';' + parseInt(Math.floor(Fpow), 10) + ';' + parseInt(Math.floor(Flast), 10) + ';' + parseInt(Math.floor(SHours), 10) + ';' + parseInt(Math.floor(CClickSpeed), 10) + ';' + parseInt(Math.floor(GClickSpeed), 10) + ';' + parseInt(Math.floor(MilkLvl), 10) +
- '|';
- str += goldenChoice + ';' + buildingChoice;
- str = utf8_to_b64(str);
- localStorage.purecookieconfig = str;
- } else if (remove) {
- if (localStorage.purecookieconfig) {
- localStorage.removeItem("purecookieconfig");
- }
- }
- }
- function LoadConfig(auto) {
- if (localStorage.purecookieconfig) {
- var str = '';
- str = localStorage.purecookieconfig;
- str = b64_to_utf8(str);
- str = str.split('|');
- spl = str[0].split(''); //prefs
- Game.prefs.antilag = parseInt(spl[0], 10);
- Game.prefs.autoupdatemenu = parseInt(spl[1], 10);
- Game.prefs.autoclick = parseInt(spl[2], 10);
- Game.prefs.autogolden = parseInt(spl[3], 10);
- Game.prefs.upgradehack = parseInt(spl[4], 10);
- Game.prefs.achievementhack = parseInt(spl[5], 10);
- Game.prefs.autobuy = parseInt(spl[6], 10);
- Game.prefs.instantsearch = parseInt(spl[7], 10);
- Game.prefs.autobuypledge = parseInt(spl[8], 10);
- MFix = parseInt(spl[9], 10);
- HFix = parseInt(spl[10], 10);
- BFree = parseInt(spl[11], 10);
- bypass = parseInt(spl[12], 10);
- spl = str[1].split(';');
- CAmount = parseInt(spl[0], 10);
- BAmount = parseInt(spl[1], 10);
- HAmount = parseInt(spl[2], 10);
- PTime = parseInt(spl[3], 10);
- Fpow = parseInt(spl[4], 10);
- Flast = parseInt(spl[5], 10);
- SHours = parseInt(spl[6], 10);
- CClickSpeed = parseInt(spl[7], 10);
- GClickSpeed = parseInt(spl[8], 10);
- MilkLvl = parseInt(spl[9], 10);
- spl = str[2].split(';');
- goldenChoice = spl[0];
- buildingChoice = spl[1];
- } else if (!auto) {
- confirm('you can\'t load a save that don\'t exist silly :)');
- }
- Game.UpdateMenu();
- }
- function GetCookies() {
- SmartUpdateMenu();
- var toMoney = Math.abs(CAmount - Game.cookies);
- if (CAmount < Game.cookies && MFix) {
- Game.Spend(toMoney);
- } else if (CAmount > Game.cookies && MFix) {
- Game.Earn(toMoney);
- } else if (!MFix) {
- Game.Earn(CAmount);
- }
- }
- function ClickCookie() {
- SmartUpdateMenu();
- var choice = Game.prefs.autoclick;
- if (choice && clickerBotC === 0) {
- ClickCookieFunction();
- } else if (!choice) {
- clearInterval(clickerBotC);
- clickerBotC = 0;
- }
- }
- function ClickCookieFunction() {
- clickerBotC = setInterval(function () {
- Game.ClickCookie();
- }, CClickSpeed);
- }
- function ClickGolden() {
- SmartUpdateMenu();
- var choice = Game.prefs.autogolden;
- if (choice) {
- ClickGoldenFunction();
- } else if (!choice) {
- clearInterval(clickerBotG);
- clickerBotG = 0;
- }
- }
- function ClickGoldenFunction() {
- if (bypass && clickerBotG === 0) {
- clickerBotG = setInterval(function () {
- Game.goldenCookie.life = 1;
- Game.goldenCookie.click();
- }, GClickSpeed);
- } else if (!bypass && clickerBotG === 0) {
- clickerBotG = setInterval(function () {
- if (Game.goldenCookie.life > 0) {
- Game.goldenCookie.click();
- }
- }, 500);
- }
- }
- function SpawnGolden() {
- SmartUpdateMenu();
- Game.goldenCookie.maxTime = Game.goldenCookie.minTime = Game.goldenCookie.life = 0;
- }
- function SpawnFrenzy() {
- SmartUpdateMenu();
- Game.frenzy = Game.fps * Flast;
- Game.frenzyPower = Fpow;
- Game.CalculateGains();
- Game.Popup("Custom Frenzy! Cookie production x" + Fpow + " for " + Flast + " second!");
- }
- function SetStartDate() {
- SmartUpdateMenu();
- date = new Date().getTime();
- date -= SHours * 3600 * 1000;
- Game.startDate = date;
- }
- function GetHeavenly() {
- SmartUpdateMenu();
- var toGive = 0;
- if (!HFix) {
- toGive = HAmount + Game.prestige['Heavenly chips'];
- } else if (HFix) {
- toGive = HAmount;
- }
- Game.cookiesReset = (Math.pow(2 * toGive + 1, 2) - 1) * Math.pow(10, 12) / 8;
- Game.CalculatePrestige();
- }
- function SetMilk() {
- SmartUpdateMenu();
- toGive = MilkLvl * 0.01;
- Game.AchievementsOwned = toGive * 25;
- Game.CalculateGains();
- }
- function UpgradeHack() {
- var list = [];
- var choice = Game.prefs.upgradehack;
- displayUpgradeHack = '';
- for (var i in Game.Upgrades) {
- list.push(Game.Upgrades[i]);
- }
- for (var i in list) {
- var me = list[i];
- displayUpgradeHack += '<div onclick="Game.UpgradesById[' + me.id + '].toggle();UpgradeHack();SmartUpdateMenu();" class="crate upgrade' + (me.bought > 0 ? ' enabled' : '') + '" ' + Game.getTooltip(
- '<div style="min-width:200px;"><div style="float:right;"><span class="price">' + Beautify(Math.round(me.basePrice)) + '</span></div><small>[Upgrade]' + (me.bought > 0 ? ' [Purchased]' : '') + '</small><div class="name">' + me.name + '</div><div class="description">' + me.desc + '</div></div>', 0, 0, 'bottom-right') + ' style="background-position:' + (-me.icon[0] * 48 + 6) + 'px ' + (-me.icon[1] * 48 + 6) + 'px;"></div>';
- }
- focused = true;
- if (!choice) {
- focused = false;
- displayUpgradeHack = '';
- }
- }
- function AchievementHack() {
- var list = [];
- var choice = Game.prefs.achievementhack;
- displayAchievementHack = '';
- for (var i in Game.Achievements) {
- list.push(Game.Achievements[i]);
- }
- for (var i in list) {
- var me = list[i];
- displayAchievementHack += '<div onclick="ToggleAchievement(' + me.id + ');AchievementHack();SmartUpdateMenu();" class="crate achievement' + (me.won > 0 ? ' enabled' : '') + '" ' + Game.getTooltip(
- '<div style="min-width:200px;"><small>[Achievement]' + (me.won == 1 ? ' [Unlocked]' : '') + (me.hide == 3 ? ' [Shadow]' : '') + '</small><div class="name">' + me.name + '</div><div class="description">' + me.desc + '</div></div>', 0, 0, 'bottom-right') + ' style="background-position:' + (-me.icon[0] * 48 + 6) + 'px ' + (-me.icon[1] * 48 + 6) + 'px;"></div>';
- }
- focused = true;
- if (!choice) {
- focused = false;
- displayAchievementHack = '';
- }
- }
- Game.Lose = function (what) {
- if (typeof what === 'string') {
- if (Game.Achievements[what]) {
- if (Game.Achievements[what].won == 1) {
- Game.Achievements[what].won = 0;
- Game.Popup('Achievement locked :<br>' + Game.Achievements[what].name + '<br> ');
- Game.AchievementsOwned--;
- Game.recalculateGains = 1;
- }
- }
- } else {
- for (var i in what) {
- Game.Lose(what[i]);
- }
- }
- };
- function ToggleAchievement(what) {
- if (typeof what === 'number') {
- var that = Game.AchievementsById[what].name;
- if (Game.Achievements[that]) {
- if (Game.Achievements[that].won === 0) {
- Game.Win(that);
- } else {
- Game.Lose(that);
- }
- }
- }
- }
- function DisplayAutobuy() {
- var time = (ABPrice - Game.cookies) / Game.cookiesPs;
- time = time < 0 ? 0 : Beautify(time);
- ABText = "Buying " + ABName + " for " + Beautify(ABPrice) + " at " + Beautify(Math.round(ABPrice / (ABCps * Game.globalCpsMult))) + " cookies per CPS!" + "<br>This will take " + time + " seconds.";
- if (Game.onMenu == 'cheat') {
- l("displayAutoBuyText").innerHTML = ABText;
- }
- }
- function OptimalItem() {
- var cpc = Number.MAX_VALUE;
- var sel;
- for (i = Game.UpgradesInStore.length - 1; i >= 0; i--) {
- var cps1 = 0;
- var x = Game.UpgradesInStore[i].id;
- var me = Game.UpgradesById[x];
- if (x != 64 && x != 74 && x != 84 && x != 85) {
- Game.UpgradesById[x].bought = 1;
- Game.CalculateGains();
- for (j = Game.ObjectsById.length - 1; j >= 0; j--) {
- cps1 += Game.ObjectsById[j].cps() * Game.ObjectsById[j].amount;
- }
- var cps2 = cps1 * Game.globalCpsMult;
- Game.UpgradesById[x].bought = 0;
- Game.CalculateGains();
- var myCps = cps2 - ABCurrentCps;
- var cpsUpgrade = me.basePrice * (Game.cookiesPs + myCps) / myCps;
- if (cpsUpgrade < cpc && myCps >= 0.1) {
- cpc = cpsUpgrade;
- sel = me;
- ABCps = myCps;
- ABName = me.name;
- ABPrice = Math.round(me.basePrice);
- }
- }
- }
- for (i = Game.ObjectsById.length - 1; i >= 0; i--) {
- var cps1 = 0;
- var me = Game.ObjectsById[i];
- me.amount++;
- Game.CalculateGains();
- for (j = Game.ObjectsById.length - 1; j >= 0; j--) {
- cps1 += Game.ObjectsById[j].cps() * Game.ObjectsById[j].amount;
- }
- var cps2 = cps1 * Game.globalCpsMult;
- me.amount--;
- Game.CalculateGains();
- var myCps = cps2 - ABCurrentCps;
- var cpsBuilding = me.price * (Game.cookiesPs + myCps) / myCps;
- if (cpsBuilding < cpc && myCps >= 0.1) {
- cpc = cpsBuilding;
- sel = me;
- ABCps = myCps;
- ABName = me.name;
- ABPrice = Math.round(me.price);
- }
- }
- ABSelected = 1;
- ABOptimal = sel;
- }
- function AutoBuy() {
- ABInterval = 250;
- var choice = Game.prefs.autobuy;
- if (choice && buyBot === 0) {
- AutoBuyFunction();
- } else if (!choice) {
- clearInterval(buyBot);
- BuyBot = 0;
- ABText = '';
- SmartUpdateMenu();
- }
- }
- function AutoBuyFunction() {
- ABCurrentCps = Game.cookiesPs;
- buyBot = setInterval(function () {
- if (Game.cookies >= ABPrice && ABSelected == 1) {
- ABOptimal.buy();
- DisplayAutobuy();
- ABSelected = 0;
- } else if (ABSelected === 0 || ABCurrentCps != Game.cookiesPs) {
- OptimalItem();
- DisplayAutobuy();
- } else if (ABSelected == 1) {
- DisplayAutobuy();
- }
- }, ABInterval);
- }
- function GetBuilding() {
- SmartUpdateMenu();
- if (buildingChoice != 'all') {
- var me = Game.ObjectsById[buildingChoice];
- me.amount = me.bought = BAmount;
- if (BFree) {
- me.basePrice = 0;
- me.refresh();
- }
- } else if (buildingChoice == 'all') {
- for (i = 0; i < Game.Object.length; i++) {
- var me = Game.ObjectsById[i];
- me.amount = me.bought = BAmount;
- if (BFree) {
- me.basePrice = 0;
- me.refresh();
- }
- }
- }
- BOUpdate();
- Game.CalculateGains();
- Game.RebuildStore();
- }
- function SelectBuilding() {
- var text;
- for (i = 0; i < Game.Object.length; i++) {
- me = Game.ObjectsById[i];
- text += '<option value="' + i + '" id="SelectedChoice_' + i + '">' + me.name + '</option>';
- }
- return '<option value="all" id="SelectedChoice_all">All</option>' + text;
- }
- function InstantSearch() {
- SmartUpdateMenu();
- var choice = Game.prefs.instantsearch;
- if (choice) {
- Game.researchT = 0;
- Game.baseResearchTime = 0;
- } else if (!choice) {
- Game.baseResearchTime = Game.fps * 60 * 30;
- }
- }
- function CustomPledge() {
- SmartUpdateMenu();
- Game.pledgeT = Game.fps * 60 * PTime;
- Game.Lock('Elder Pledge');
- Game.elderWrath = 0;
- Game.pledges++;
- }
- function ABPledge() {
- SmartUpdateMenu();
- var choice = Game.prefs.autobuypledge;
- var toWait = (Game.pledgeT / Game.fps) * 1000;
- if (choice) {
- pledgeBot = setTimeout(function () {
- Game.UpgradesById[74].buy();
- ABPledge();
- }, toWait);
- }
- if (!choice) {
- clearTimeout(pledgeBot);
- pledgeBot = 0;
- }
- }
- function AllUpgrades() {
- SmartUpdateMenu();
- for (var i in Game.Upgrades) {
- Game.Upgrades[i].toggle();
- }
- Game.CalculateGains();
- Game.RebuildUpgrades();
- UpgradeHack();
- }
- function AllAchievements() {
- SmartUpdateMenu();
- for (var i in Game.Achievements) {
- ToggleAchievement(Game.Achievements[i].id);
- }
- Game.CalculateGains();
- AchievementHack();
- }
- function BOUpdate() {
- Game.BuildingsOwned = 0;
- for (i = 0; i < Game.Object.length; i++) {
- me = Game.ObjectsById[i];
- Game.BuildingsOwned += me.amount;
- if (me.buyFunction) {
- me.buyFunction();
- }
- if (me.drawFunction) {
- me.drawFunction();
- }
- if (me.amount >= 1 && me.id !== 0) {
- l('row' + me.id).className = 'row enabled';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement