function Start_Cookie_Monster(){if($("#cookie_monster_bar").length!=0){alert("Cookie Monster "+version+"\n\nCookie Monster is already loaded, silly!");return false}else{$("#topBar").css("display","none");$("#tooltip").css("margin-top","32px");$("#tooltip").css("pointer-events","none");$("#cookies").css("background","rgba(0,0,0,0.75)");$("#cookies").css("border-top","1px solid black");$("#cookies").css("border-bottom","1px solid black");$("#goldenCookie").css("cssText",""+"z-index: 1000001 !important;");$("#game").css("cssText",""+"-webkit-touch-callout: none;"+"-webkit-user-select: none;"+"-khtml-user-select: none;"+"-moz-user-select: none;"+"-ms-user-select: none;"+"-o-user-select: none;"+"user-select: none;"+"top: 0px;"+"bottom: 57px;"+"");$("#storeTitle").css("cssText",""+"font-size: 18px;"+"padding: 4px 8px 2px 8px;"+"border-bottom: 1px solid black;"+"");$("#storeTitle").after(''+''+''+''+''+''+''+"
000000
");$("body").append('');$("body").append('');$("body").append('');$("#sectionLeft").append('');$("link").each(function(){if($(this).attr("href")=="img/favicon.ico"){$(this).attr("id","cm_favicon")}});Make_Table();Save_Tooltips();Update_Game_Scripts();Load_Settings();Set_Up_Tooltips();Main_Loop();Game.Popup('Cookie Monster '+version+" Loaded!")}}function Main_Loop(){Update_Table();Update_Tooltips("all");Do_Emphasize();Manage_Buffs();loops++;if(loops==1){Game.RebuildStore()}setTimeout(function(){Main_Loop()},settings[3])}function Fav_Icon_Spinner(e){if(e>6){e=1}if(gc_avail=="(G) "){$("#cm_favicon").attr("href","http://frozenelm.com/cookiemonster/images/cm_gc_"+e+".png");e++;setTimeout(function(){Fav_Icon_Spinner(e)},250)}else{$("#cm_favicon").attr("href","http://orteil.dashnet.org/cookieclicker/img/favicon.ico")}}function Load_Settings(){settings=[1,1,1,1e3,1,1,1,1,0,1,1,1,1];if(typeof Storage!=="undefined"){if(localStorage.FlashScreen!=undefined){settings[0]=localStorage.FlashScreen}else{localStorage.FlashScreen=1;settings[0]=1}if(localStorage.CookieTimer!=undefined){settings[1]=localStorage.CookieTimer}else{localStorage.CookieTimer=1;settings[1]=1}if(localStorage.BuffBars!=undefined){settings[2]=localStorage.BuffBars}else{localStorage.BuffBars=1;settings[2]=1}if(localStorage.Refresh!=undefined){settings[3]=localStorage.Refresh}else{localStorage.Refresh=1e3;settings[3]=1e3}if(localStorage.CookieCD!=undefined){settings[4]=localStorage.CookieCD}else{localStorage.CookieCD=1;settings[4]=1}if(localStorage.CMBar!=undefined){settings[5]=localStorage.CMBar}else{localStorage.CMBar=1;settings[5]=1}if(localStorage.ColoredPrices!=undefined){settings[6]=localStorage.ColoredPrices}else{localStorage.ColoredPrices=1;settings[6]=1}if(localStorage.ShortNumbers!=undefined){settings[7]=localStorage.ShortNumbers}else{localStorage.ShortNumbers=1;settings[7]=1}if(localStorage.CookieSound!=undefined){settings[8]=localStorage.CookieSound}else{localStorage.CookieSound=0;settings[8]=0}if(localStorage.UpdateTitle!=undefined){settings[9]=localStorage.UpdateTitle}else{localStorage.UpdateTitle=1;settings[9]=1}if(localStorage.LuckyAlert!=undefined){settings[10]=localStorage.LuckyAlert}else{localStorage.LuckyAlert=1;settings[10]=1}if(localStorage.UpgradeIcons!=undefined){settings[11]=localStorage.UpgradeIcons}else{localStorage.UpgradeIcons=1;settings[11]=1}if(localStorage.UpgradeDisplay!=undefined){settings[12]=localStorage.UpgradeDisplay}else{localStorage.UpgradeDisplay=1;settings[12]=1}}Show_Hide_CM_Bar()}function Save_Settings(){if(typeof Storage!=="undefined"){localStorage.FlashScreen=settings[0];localStorage.CookieTimer=settings[1];localStorage.BuffBars=settings[2];localStorage.Refresh=settings[3];localStorage.CookieCD=settings[4];localStorage.CMBar=settings[5];localStorage.ColoredPrices=settings[6];localStorage.ShortNumbers=settings[7];localStorage.CookieSound=settings[8];localStorage.UpdateTitle=settings[9];localStorage.LuckyAlert=settings[10];localStorage.UpgradeIcons=settings[11];localStorage.UpgradeDisplay=settings[12]}else{}Show_Hide_CM_Bar()}function Show_Hide_CM_Bar(){if(settings[5]==0){$("#cookie_monster_bar").css("display","none");$("#game").css("bottom","0px")}else{$("#cookie_monster_bar").css("display","");$("#game").css("bottom","57px")}}function Update_Game_Scripts(){Game.Logic=new Function("",Game.Logic.toString().replace(".title=",".title=gc_avail+").replace(/^function[^{]+{/i,"").replace(/}[^}]*$/i,""));var e="\n\n'
'+"+'\'
Cookie Monster Goodies
\'+'+"'
\"Lucky!\" Cookies Required: ' + CM_Lucky('reg', false) + '
'+"+"'
\"Lucky!\" Cookies Required (Frenzy): ' + CM_Lucky('frenzy', false) + '
'+"+"'
\"Lucky!\" Reward (MAX): ' + CM_Lucky_Reward('max') + '
'+"+"'
\"Lucky!\" Reward (MAX) (Frenzy): ' + CM_Lucky_Reward('max_frenzy') + '
'+"+"'
\"Lucky!\" Reward (CUR): ' + CM_Lucky_Reward('cur') + '
'+"+"'
Heavenly Chips (MAX): ' + CM_Heavenly_Chip('max') + '
'+"+"'
Heavenly Chips (CUR): ' + CM_Heavenly_Chip('cur') + '
'+"+"'
Cookies To Next Chip: ' + CM_Heavenly_Chip('next') + '
'+"+"'
Time To Next Chip: ' + CM_Heavenly_Chip('time') + '
'+"+"'
'+";Game.UpdateMenu=new Function("",Game.UpdateMenu.toString().replace("Statistics'+","Statistics'+"+e).replace(/^function[^{]+{/i,"").replace(/}[^}]*$/i,""));var t="\n'
'+"+'\'
Cookie Monster Settings
\'+'+'\'
Flash Screen \' + CM_Option_State(0) + \'
\'+'+'\'
Cookie Timer \' + CM_Option_State(1) + \'
\'+'+'\'
Cookie Sound \' + CM_Option_State(8) + \'
\'+'+'\'
Next Cookie Timer \' + CM_Option_State(4) + \'
\'+'+'\'
Update Title \' + CM_Option_State(9) + \'
\'+'+'\'
Buff Bars \' + CM_Option_State(2) + \'
\'+'+'\'
Bottom Bar \' + CM_Option_State(5) + \'
\'+'+'\'
Colored Prices \' + CM_Option_State(6) + \'
\'+'+'\'
Upgrade Icons \' + CM_Option_State(11) + \'
\'+'+'\'
Short Numbers \' + CM_Short_Numbers() + \'
\'+'+'\'
Upgrade Display (\' + CM_Upgrade_Display() + \')
\'+'+'\'
Lucky Alert (\' + CM_Lucky_Alert() + \')
\'+'+'\'
Refresh Rate (\' + CM_Refresh() + \' fps)
\'+'+"'
'+";Game.UpdateMenu=new Function("",Game.UpdateMenu.toString().replace("OFF')+''+","OFF')+''+"+t).replace("startDate=Game.sayTime(date.getTime()/1000*Game.fps,2);","startDate = formatTime(((new Date).getTime() - Game.startDate) / 1000, '');").replace(/^function[^{]+{/i,"").replace(/}[^}]*$/i,""));var n="\n"+"var cm_id = from.id;"+'\nif(cm_id == "") { cm_id = $(from).parents(".product").prop("id"); }'+'\nif(cm_id == "product5" || cm_id == "product6" || cm_id == "product7" || cm_id == "product8" || cm_id == "product9") { y -= 100; }'+'\nif(cm_id == "product8" || cm_id == "product9") { y -= 13; }'+'\nif(cm_id == "product9" && settings[7] == 0) { y -= 13; }'+"\n";Game.tooltip.draw=new Function("from,text,x,y,origin",Game.tooltip.draw.toString().replace("implemented');}","implemented');}"+n).replace("this.on=1;","this.on=1;\nUpdate_Tooltips('all');").replace(/^function[^{]+{/i,"").replace(/}[^}]*$/i,""));Game.Reset=new Function("bypass",Game.Reset.toString().replace("Game.researchT=0;","Game.researchT=0;\n$('#cookie_monster_timer_bars_div').text('');").replace(/^function[^{]+{/i,"").replace(/}[^}]*$/i,""));Game.LoadSave=new Function("data",Game.LoadSave.toString().replace("Game.Popup('Game loaded');","Game.Popup('Game loaded');\n$('#cookie_monster_timer_bars_div').text('');").replace(/^function[^{]+{/i,"").replace(/}[^}]*$/i,""));Game.RebuildStore=new Function("",Game.RebuildStore.toString().replace("l('products').innerHTML=str;","l('products').innerHTML=str;\nUpdate_Tooltips('ob');").replace(/^function[^{]+{/i,"").replace(/}[^}]*$/i,""));Game.Draw=new Function("",Game.Draw.toString().replace("Beautify(Math.round(Game.cookiesd))","formatNumB(Game.cookiesd)").replace(/^function[^{]+{/i,"").replace(/}[^}]*$/i,""));var r="return formatNum(what);";Beautify=new Function("what,floats",Beautify.toString().replace("var str='';",r+"\nvar str='';").replace(/^function[^{]+{/i,"").replace(/}[^}]*$/i,""))}function CM_Heavenly_Chip(e){var t=cookies_to_h_chips(Game.cookiesReset+Game.cookiesEarned);var n=cookies_to_h_chips(Game.cookiesReset+Game.cookiesEarned+sell_out);var r=cookies_to_h_chips(Game.cookiesReset);var i=h_chips_to_cookies(t+1)-(Game.cookiesReset+Game.cookiesEarned);var s=h_chips_to_cookies(n+1)-(Game.cookiesReset+Game.cookiesEarned+sell_out);if(e=="max"){return formatNum(t)+" ("+formatNum(t*2)+"%)"}if(e=="max_sell_out"){return formatNum(n)+" ("+formatNum(n*2)+"%)"}if(e=="cur"){return formatNum(r)+" ("+formatNum(r*2)+"%)"}if(e=="next"){return formatNum(Math.round(i))}if(e=="next_sell_out"){return formatNum(Math.round(s))}if(e=="time"){return formatTime(Math.round(i/Game.cookiesPs),"")}}function cookies_to_h_chips(e){return Math.floor(Math.sqrt(2.5*Math.pow(10,11)+2*e)/Math.pow(10,6)-.5)}function h_chips_to_cookies(e){return 5*Math.pow(10,11)*e*(e+1)}function CM_Upgrade_Display(){switch(settings[12]*1){case 1:return"Normal";case 2:return"All";case 0:return"None";default:return"Normal"}}function CM_Short_Numbers(){switch(settings[7]*1){case 1:return"ON (A)";case 2:return"ON (B)";case 0:return"OFF";default:return"OFF"}}function CM_Lucky_Alert(){switch(settings[10]*1){case 1:return"Both";case 2:return"Icons";case 3:return"Notes";case 0:return"Off";default:return"Both"}}function CM_Refresh(){switch(settings[3]*1){case 1e3:return"1";case 500:return"2";case 250:return"4";case 100:return"10";case 33:return"30";default:return"1"}}function CM_Option_State(e){if(settings[e]==0){return"OFF"}return"ON"}function CM_Option_Toggle(e){e=$(e);var t=e.text();switch(t){case"Flash Screen ON":settings[0]=0;e.text("Flash Screen OFF");break;case"Flash Screen OFF":settings[0]=1;e.text("Flash Screen ON");break;case"Cookie Sound ON":settings[8]=0;e.text("Cookie Sound OFF");break;case"Cookie Sound OFF":settings[8]=1;e.text("Cookie Sound ON");break;case"Cookie Timer ON":settings[1]=0;e.text("Cookie Timer OFF");break;case"Cookie Timer OFF":settings[1]=1;e.text("Cookie Timer ON");break;case"Next Cookie Timer ON":settings[4]=0;e.text("Next Cookie Timer OFF");break;case"Next Cookie Timer OFF":settings[4]=1;e.text("Next Cookie Timer ON");break;case"Update Title ON":settings[9]=0;e.text("Update Title OFF");break;case"Update Title OFF":settings[9]=1;e.text("Update Title ON");break;case"Buff Bars ON":settings[2]=0;e.text("Buff Bars OFF");break;case"Buff Bars OFF":settings[2]=1;e.text("Buff Bars ON");break;case"Bottom Bar ON":settings[5]=0;e.text("Bottom Bar OFF");break;case"Bottom Bar OFF":settings[5]=1;e.text("Bottom Bar ON");break;case"Colored Prices ON":settings[6]=0;e.text("Colored Prices OFF");Update_Tooltips("ob");break;case"Colored Prices OFF":settings[6]=1;e.text("Colored Prices ON");Update_Tooltips("ob");break;case"Upgrade Icons ON":settings[11]=0;e.text("Upgrade Icons OFF");Game.RebuildUpgrades();break;case"Upgrade Icons OFF":settings[11]=1;e.text("Upgrade Icons ON");Game.RebuildUpgrades();break;case"Upgrade Display (All)":settings[12]=0;e.text("Upgrade Display (None)");Update_Upgrade_Display();break;case"Upgrade Display (None)":settings[12]=1;e.text("Upgrade Display (Normal)");Update_Upgrade_Display();break;case"Upgrade Display (Normal)":settings[12]=2;e.text("Upgrade Display (All)");Update_Upgrade_Display();break;case"Short Numbers ON (B)":settings[7]=0;e.text("Short Numbers OFF");Game.RebuildStore();Game.RebuildUpgrades();Update_Table();break;case"Short Numbers OFF":settings[7]=1;e.text("Short Numbers ON (A)");Game.RebuildStore();Game.RebuildUpgrades();Update_Table();break;case"Short Numbers ON (A)":settings[7]=2;e.text("Short Numbers ON (B)");Game.RebuildStore();Game.RebuildUpgrades();Update_Table();break;case"Lucky Alert (Both)":settings[10]=2;e.text("Lucky Alert (Icons)");break;case"Lucky Alert (Icons)":settings[10]=3;e.text("Lucky Alert (Notes)");break;case"Lucky Alert (Notes)":settings[10]=0;e.text("Lucky Alert (Off)");break;case"Lucky Alert (Off)":settings[10]=1;e.text("Lucky Alert (Both)");break;case"Refresh Rate (1 fps)":settings[3]=500;e.text("Refresh Rate (2 fps)");break;case"Refresh Rate (2 fps)":settings[3]=250;e.text("Refresh Rate (4 fps)");break;case"Refresh Rate (4 fps)":settings[3]=100;e.text("Refresh Rate (10 fps)");break;case"Refresh Rate (10 fps)":settings[3]=33;e.text("Refresh Rate (30 fps)");break;case"Refresh Rate (30 fps)":settings[3]=1e3;e.text("Refresh Rate (1 fps)");break}Save_Settings()}function Update_Upgrade_Display(){var e=$("#upgrades");switch(settings[12]*1){case 1:e.css("cssText","");break;case 2:e.css("cssText","height: auto !important;");break;case 0:e.css("cssText","height: 0px !important;");break}}function CM_Lucky(e,t){var n=Game.cookiesPs;if(Game.frenzy>0){n=n/Game.frenzyPower}if(e=="frenzy"){n=n*7}var r=Math.round((n*1200+13)/.1);if(!t){if(r<=Game.cookies){r=''+formatNum(r)+""}else{r=formatNum(r)}}return r}function CM_Lucky_Reward(e){var t=Game.cookiesPs;if(Game.frenzy>0&&e!="cur"){t=t/Game.frenzyPower}if(e=="max_frenzy"){t=t*7}var n=new Array(Math.round(t*1200+13),Math.round(Game.cookies*.1+13));if(e=="max"||e=="max_frenzy"){if(Math.round((t*1200+13)/.1)>Game.cookies){return formatNum(n[0])}}return formatNum(Math.min.apply(Math,n))}function Save_Tooltips(){Game.UpgradesById.forEach(function(e,t){tooltips[t]=e.desc});Game.ObjectsById.forEach(function(e,t){building_tooltips[t]=e.desc})}function Set_Up_Tooltips(){var e=false;Game.UpgradesById.forEach(function(t,n){for(var r=0;rtwice as efficient.")!=-1){return true}break;case 2:if(!up.bought&&up.desc.indexOf("The mouse and cursors gain")!=-1){return true}break;case 3:if(!up.bought&&up.name=="Forwards from grandma"){return true}break;case 4:if(!up.bought&&up.desc.indexOf("Grandmas are twice as efficient.")!=-1){return true}break;case 5:if(!up.bought&&up.name=="Cheap hoes"){return true}break;case 6:if(!up.bought&&up.desc.indexOf("Farms are twice as efficient.")!=-1){return true}break;case 7:if(!up.bought&&up.name=="Sturdier conveyor belts"){return true}break;case 8:if(!up.bought&&up.desc.indexOf("Factories are twice as efficient.")!=-1){return true}break;case 9:if(!up.bought&&up.name=="Sugar gas"){return true}break;case 10:if(!up.bought&&up.desc.indexOf("Mines are twice as efficient.")!=-1){return true}break;case 11:if(!up.bought&&up.name=="Vanilla nebulae"){return true}break;case 12:if(!up.bought&&up.desc.indexOf("Shipments are twice as efficient.")!=-1){return true}break;case 13:if(!up.bought&&up.name=="Antimony"){return true}break;case 14:if(!up.bought&&up.desc.indexOf("Alchemy labs are twice as efficient.")!=-1){return true}break;case 15:if(!up.bought&&up.name=="Ancient tablet"){return true}break;case 16:if(!up.bought&&up.desc.indexOf("Portals are twice as efficient.")!=-1){return true}break;case 17:if(!up.bought&&up.name=="Flux capacitors"){return true}break;case 18:if(!up.bought&&up.desc.indexOf("Time machines are twice as efficient.")!=-1){return true}break;case 19:if(!up.bought&&up.desc.indexOf("the more milk you have")!=-1){return true}break;case 20:if(!up.bought&&up.desc.indexOf("Cookie production multiplier +")!=-1){return true}break;case 21:if(!up.bought&&up.desc.indexOf("for each 50 grandmas")!=-1){return true}break;case 22:if(!up.bought&&up.desc.indexOf("for each 20 portals")!=-1){return true}break;case 23:if(!up.bought&&up.name=="Elder Pledge"){return true}break;case 24:if(!up.bought&&up.name=="Elder Covenant"){return true}break;case 25:if(!up.bought&&up.name=="Sacrificial rolling pins"){return true}break;case 26:if(!up.bought&&up.desc.indexOf("Golden cookie")!=-1){return true}break;case 27:if(!up.bought&&up.desc.indexOf("Clicking gains +1% of your CpS.")!=-1){return true}break;case 28:if(!up.bought&&up.desc.indexOf("Grandmas are 4 times as efficient.")!=-1){return true}break;case 29:if(!up.bought&&up.desc.indexOf("Antimatter condensers are twice as efficient.")!=-1){return true}break;case 30:if(!up.bought&&up.name=="Sugar bosons"){return true}break;case 31:if(!up.bought&&up.name=="Revoke Elder Covenant"){return true}break;case 32:if(!up.bought&&up.desc.indexOf("heavenly chips")!=-1){return true}break}return false}function Manage_Tooltip(e,t,n,r){var i=0;var s=0;switch(e){case 0:i=_bam("The mouse and cursors",.1,0);break;case 1:i=_bte(0);break;case 2:i=_mcg(t);break;case 3:i=_bam("Grandmas",.3,1);break;case 4:i=_bte(1);if(_lgt(t)){s++}break;case 5:i=_bam("Farms",.5,2);break;case 6:i=_bte(2);break;case 7:i=_bam("Factories",4,3);break;case 8:i=_bte(3);break;case 9:i=_bam("Mines",10,4);break;case 10:i=_bte(4);break;case 11:i=_bam("Shipments",30,5);break;case 12:i=_bte(5);break;case 13:i=_bam("Alchemy labs",100,6);break;case 14:i=_bte(6);break;case 15:i=_bam("Portals",1666,7);break;case 16:i=_bte(7);break;case 17:i=_bam("Time machines",9876,8);break;case 18:i=_bte(8);break;case 21:i=_gpg();break;case 22:i=_gpp();break;case 23:s+=_cha("Elder nap");if(Game.pledges==4){s+=_cha("Elder slumber")}break;case 24:s+=_cha("Elder calm");break;case 28:i=_fte(1);break;case 29:i=_bte(9);break;case 30:i=_bam("Antimatter condensers",99999,9);break;case 32:i=_dhc(s,t,i);if(_lhc(t)){s+=_cha("Wholesome")}break}if(Game.UpgradesOwned==19){s+=_cha("Enhancer")}if(Game.UpgradesOwned==49){s+=_cha("Augmenter")}if(Game.UpgradesOwned==99){s+=_cha("Upgrader")}i+=Get_Achi_Worth(s,t,i,0);if(r){return i}return tooltips[t]+Colorize(i,t,n)}function _dhc(e,t,n){var r=Game.UpgradesById[t];var i=r.desc.indexOf("")+3;var s=r.desc.indexOf("%");var o=r.desc.substr(i,s-i)*1;var u=Get_Achi_Worth(e,t,n,Game.prestige["Heavenly chips"]*2*(o/100));return u-Game.cookiesPs}function _lhc(e){if(Game.UpgradesById[e].name=="Heavenly key"){return true}return false}function _cpc(){return Game.mouseCps()*.01*usr_clk}function _lgt(e){if(_cha("Elder")==1&&Game.UpgradesById[e].name.indexOf(" grandmas")!=-1){var t=new Array;var n=new Array;Game.UpgradesById.forEach(function(e,r){if(e.bought&&e.name.indexOf(" grandmas")!=-1){t.push(r)}else if(!e.bought&&e.name.indexOf(" grandmas")!=-1){n.push(r)}});if(n.length==1&&n[0]==e){return true}}return false}function _cha(e){var t=0;Game.AchievementsById.forEach(function(n,r){if(!n.won&&n.name==e){t=1}});return t}function _gpp(){var e=1;Game.UpgradesById.forEach(function(t,n){if(t.bought&&t.desc.indexOf("Grandmas are twice as efficient.")!=-1){e=e*2}if(t.bought&&t.desc.indexOf("Grandmas are 4 times as efficient.")!=-1){e=e*4}});return Game.ObjectsById[7].amount*.05*e*Game.ObjectsById[1].amount*Game.globalCpsMult}function _gpg(){var e=1;Game.UpgradesById.forEach(function(t,n){if(t.bought&&t.desc.indexOf("Grandmas are twice as efficient.")!=-1){e=e*2}if(t.bought&&t.desc.indexOf("Grandmas are 4 times as efficient.")!=-1){e=e*4}});return Game.ObjectsById[1].amount*.02*e*Game.ObjectsById[1].amount*Game.globalCpsMult}function _mcg(e){var t=Game.UpgradesById[e].desc;var n=31;if(t.indexOf(" another ")!=-1){n+=8}var r=t.substr(n,t.indexOf("<",n)-n)*1;return r*(Game.BuildingsOwned-Game.ObjectsById[0].amount)*Game.ObjectsById[0].amount*Game.globalCpsMult}function _bte(e){return Game.ObjectsById[e].storedTotalCps*Game.globalCpsMult}function _fte(e){return Game.ObjectsById[e].storedTotalCps*3*Game.globalCpsMult}function _bam(e,t,n){var r=1;Game.UpgradesById.forEach(function(t,n){if(t.bought&&t.desc.indexOf(e+" are twice as efficient.")!=-1){r=r*2}if(t.bought&&t.desc.indexOf(e+" are 4 times as efficient.")!=-1){r=r*4}});return t*r*Game.ObjectsById[n].amount*Game.globalCpsMult}function _inc(e){var t=0;Game.AchievementsById.forEach(function(n,r){var i=n.desc.replace(/,/g,"");if(!n.won&&i.indexOf(" per second.")!=-1){if(e>=i.substr(8,i.indexOf("",8)-8)*1){t++}}});return t}function Get_Achi_Worth(e,t,n,r){var i=0;var s=Calc_Heavenly_Mult();if(r!=0){s=r}var o=0;var u=new Array(0,0,0,0);var a=Game.milkProgress;var f=Get_Frenzy_Mult();Game.UpgradesById.forEach(function(e,n){var r=e.desc.replace("[Research]
","");if(e.bought&&r.indexOf("Cookie production multiplier +")!=-1){s+=r.substr(33,r.indexOf("%",33)-33)*1}if(!e.bought&&r.indexOf("Cookie production multiplier +")!=-1&&e.id==t){o+=r.substr(33,r.indexOf("%",33)-33)*1}if(e.bought&&e.name=="Kitten helpers"){u[0]=.05}if(e.bought&&e.name=="Kitten workers"){u[1]=.1}if(e.bought&&e.name=="Kitten engineers"){u[2]=.2}if(e.bought&&e.name=="Kitten overseers"){u[3]=.2}});var l=100+s;l=l*(1+u[0]*a);l=l*(1+u[1]*a);l=l*(1+u[2]*a);l=l*(1+u[3]*a);var c=n;var h=(Game.cookiesPs+c)/Game.globalCpsMult*(l/100)*f;a+=e*.04;l=100+s+o;l=l*(1+u[0]*a);l=l*(1+u[1]*a);l=l*(1+u[2]*a);l=l*(1+u[3]*a);var p=0;switch(Game.UpgradesById[t].name){case"Kitten helpers":p=.05;break;case"Kitten workers":p=.1;break;case"Kitten engineers":p=.2;break;case"Kitten overseers":p=.2;break}l=l*(1+p*a);i=(Game.cookiesPs+c)/Game.globalCpsMult*(l/100)*f-h;var d=_inc(i+h);if(d>0){a+=d*.04;l=100+s+o;l=l*(1+u[0]*a);l=l*(1+u[1]*a);l=l*(1+u[2]*a);l=l*(1+u[3]*a);l=l*(1+p*a);i=(Game.cookiesPs+c)/Game.globalCpsMult*(l/100)*f-h}if(r!=0){i=(Game.cookiesPs+c)/Game.globalCpsMult*(l/100)*f}if(Game.Has("Elder Covenant")){i*=.95}return i}function Calc_Heavenly_Mult(){var e=Game.prestige["Heavenly chips"]*2;var t=0;if(Game.Has("Heavenly chip secret")){t+=.05}if(Game.Has("Heavenly cookie stand")){t+=.2}if(Game.Has("Heavenly bakery")){t+=.25}if(Game.Has("Heavenly confectionery")){t+=.25}if(Game.Has("Heavenly key")){t+=.25}return e*t}function Get_Frenzy_Mult(){if(Game.frenzy>0){return Game.frenzyPower}return 1}function Manage_Building_Tooltip(e){var t=e.id;var n=new Array(CM_Lucky("reg",true),CM_Lucky("frenzy",true));var r=new Array("none","none");var s=new Array("","");var o=new Array(0,0);if(Game.cookies-e.price