diff --git a/CookieMonster.js b/CookieMonster.js index 5f0d1fb..4151c84 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1 +1 @@ -const CM={Backup:{},Cache:{},Config:{},Data:{Config:{}},Disp:{},Footer:{},Main:{},Options:{},Sim:{},VersionMajor:"2.031",VersionMinor:"3"};CM.Cache.InitCache=function(){CM.Cache.CacheDragonAuras();CM.Cache.CacheWrinklers();CM.Cache.CacheStats();CM.Cache.CacheGoldenAndWrathCookiesMults();CM.Cache.CacheChain();CM.Cache.CacheMissingUpgrades();CM.Cache.CacheSeaSpec();CM.Cache.InitCookiesDiff();CM.Cache.CacheAvgCPS();CM.Cache.CacheIncome();CM.Cache.CacheBuildingsPrices();CM.Cache.CachePP()};CM.Cache.CacheDragonAuras=function(){CM.Cache.dragonAura=Game.dragonAura;CM.Cache.dragonAura2=Game.dragonAura2};CM.Cache.CacheWrinklers=function(){CM.Cache.WrinklersTotal=0;CM.Cache.WrinklersNormal=0;CM.Cache.WrinklersFattest=[0,null];for(let i=0;iCM.Cache.WrinklersFattest[0])CM.Cache.WrinklersFattest=[sucked,i]}}};CM.Cache.CacheStats=function(){CM.Cache.Lucky=CM.Cache.NoGoldSwitchCookiesPS*900/.15;CM.Cache.Lucky*=CM.Cache.DragonsFortuneMultAdjustment;let cpsBuffMult=CM.Cache.getCPSBuffMult();if(cpsBuffMult>0)CM.Cache.Lucky/=cpsBuffMult;else CM.Cache.Lucky=0;CM.Cache.LuckyReward=CM.Cache.GoldenCookiesMult*(CM.Cache.Lucky*.15)+13;CM.Cache.LuckyWrathReward=CM.Cache.WrathCookiesMult*(CM.Cache.Lucky*.15)+13;CM.Cache.LuckyFrenzy=CM.Cache.Lucky*7;CM.Cache.LuckyRewardFrenzy=CM.Cache.GoldenCookiesMult*(CM.Cache.LuckyFrenzy*.15)+13;CM.Cache.LuckyWrathRewardFrenzy=CM.Cache.WrathCookiesMult*(CM.Cache.LuckyFrenzy*.15)+13;CM.Cache.Conjure=CM.Cache.Lucky*2;CM.Cache.ConjureReward=CM.Cache.Conjure*.15;CM.Cache.Edifice=0;let max=0;let n=0;for(let i of Object.keys(Game.Objects)){if(Game.Objects[i].amount>max)max=Game.Objects[i].amount;if(Game.Objects[i].amount>0)n++}for(let i of Object.keys(Game.Objects)){if((Game.Objects[i].amountCM.Cache.Edifice){CM.Cache.Edifice=Game.Objects[i].price*2;CM.Cache.EdificeBuilding=i}}};CM.Cache.CacheGoldenAndWrathCookiesMults=function(){if(CM.Footer.isInitzializing){CM.Cache.GoldenCookiesMult=1;CM.Cache.WrathCookiesMult=1;CM.Cache.DragonsFortuneMultAdjustment=1}else{var goldenMult=1;var wrathMult=1;var mult=1;if(CM.Sim.Has("Green yeast digestives"))mult*=1.01;if(CM.Sim.Has("Dragon fang"))mult*=1.03;goldenMult*=1+Game.auraMult("Ancestral Metamorphosis")*.1;goldenMult*=Game.eff("goldenCookieGain");wrathMult*=1+Game.auraMult("Unholy Dominion")*.1;wrathMult*=Game.eff("wrathCookieGain");CM.Cache.GoldenCookiesMult=mult*goldenMult;CM.Cache.WrathCookiesMult=mult*wrathMult;CM.Cache.DragonsFortuneMultAdjustment=1;if(Game.shimmerTypes.golden.n===0){CM.Cache.DragonsFortuneMultAdjustment*=1+Game.auraMult("Dragon's Fortune")*1.23}}};CM.Cache.MaxChainMoni=function(digit,maxPayout,mult){let totalFromChain=0;let moni=0;let nextMoni=0;var chain=1+Math.max(0,Math.ceil(Math.log(Game.cookies)/Math.LN10)-10);while(nextMoni0)maxPayout/=cpsBuffMult;else maxPayout=0;CM.Cache.ChainReward=CM.Cache.MaxChainMoni(7,maxPayout*CM.Cache.GoldenCookiesMult,CM.Cache.GoldenCookiesMult);CM.Cache.ChainRequired=CM.Cache.ChainReward[0]*2;CM.Cache.ChainRequiredNext=CM.Cache.ChainReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainWrathReward=CM.Cache.MaxChainMoni(6,maxPayout*CM.Cache.WrathCookiesMult,CM.Cache.WrathCookiesMult);CM.Cache.ChainWrathRequired=CM.Cache.ChainWrathReward[0]*2;CM.Cache.ChainWrathRequiredNext=CM.Cache.ChainWrathReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyReward=CM.Cache.MaxChainMoni(7,maxPayout*7*CM.Cache.GoldenCookiesMult,CM.Cache.GoldenCookiesMult);CM.Cache.ChainFrenzyRequired=CM.Cache.ChainFrenzyReward[0]*2;CM.Cache.ChainFrenzyRequiredNext=CM.Cache.ChainFrenzyReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyWrathReward=CM.Cache.MaxChainMoni(6,maxPayout*7*CM.Cache.WrathCookiesMult,CM.Cache.WrathCookiesMult);CM.Cache.ChainFrenzyWrathRequired=CM.Cache.ChainFrenzyReward[0]*2;CM.Cache.ChainFrenzyWrathRequiredNext=CM.Cache.ChainFrenzyReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment};CM.Cache.CacheMissingUpgrades=function(){CM.Cache.MissingUpgrades="";CM.Cache.MissingUpgradesCookies="";CM.Cache.MissingUpgradesPrestige="";var list=[];for(let i of Object.keys(Game.Upgrades)){list.push(Game.Upgrades[i])}var sortMap=function(a,b){if(a.order>b.order)return 1;else if(a.orderthis.maxLength){this.queue.shift()}}calcAverage(timePeriod){if(timePeriod>this.maxLength)timePeriod=this.maxLength;if(timePeriod>this.queue.length)timePeriod=this.queue.length;var ret=0;for(let i=this.queue.length-1;i>=0&&i>this.queue.length-1-timePeriod;i--){ret+=this.queue[i]}return ret/timePeriod}}CM.Cache.InitCookiesDiff=function(){CM.Cache.CookiesDiff=new CMAvgQueue(CM.Disp.cookieTimes[CM.Disp.cookieTimes.length-1]);CM.Cache.WrinkDiff=new CMAvgQueue(CM.Disp.cookieTimes[CM.Disp.cookieTimes.length-1]);CM.Cache.WrinkFattestDiff=new CMAvgQueue(CM.Disp.cookieTimes[CM.Disp.cookieTimes.length-1]);CM.Cache.ChoEggDiff=new CMAvgQueue(CM.Disp.cookieTimes[CM.Disp.cookieTimes.length-1]);CM.Cache.ClicksDiff=new CMAvgQueue(CM.Disp.clickTimes[CM.Disp.clickTimes.length-1])};CM.Cache.CacheAvgCPS=function(){var currDate=Math.floor(Date.now()/1e3);if(Game.T/Game.fps%1===0){var choEggTotal=Game.cookies+CM.Cache.SellForChoEgg;if(Game.cpsSucked>0){choEggTotal+=CM.Cache.WrinklersTotal}CM.Cache.RealCookiesEarned=Math.max(Game.cookiesEarned,choEggTotal);choEggTotal*=.05;if(CM.Cache.lastDate!=-1){var timeDiff=currDate-CM.Cache.lastDate;var bankDiffAvg=Math.max(0,Game.cookies-CM.Cache.lastCookies)/timeDiff;var wrinkDiffAvg=Math.max(0,CM.Cache.WrinklersTotal-CM.Cache.lastWrinkCookies)/timeDiff;var wrinkFattestDiffAvg=Math.max(0,CM.Cache.WrinklersFattest[0]-CM.Cache.lastWrinkFattestCookies)/timeDiff;var choEggDiffAvg=Math.max(0,choEggTotal-CM.Cache.lastChoEgg)/timeDiff;var clicksDiffAvg=(Game.cookieClicks-CM.Cache.lastClicks)/timeDiff;for(let i=0;iCM.Cache.max)CM.Cache.max=CM.Cache.Objects1[i].pp}CM.Cache.mid=(CM.Cache.max-CM.Cache.min)/2+CM.Cache.min;for(let i of Object.keys(CM.Cache.Objects1)){let color="";if(CM.Cache.Objects1[i].pp===CM.Cache.min)color=CM.Disp.colorGreen;else if(CM.Cache.Objects1[i].pp===CM.Cache.max)color=CM.Disp.colorRed;else if(CM.Cache.Objects1[i].pp>CM.Cache.mid)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow;CM.Cache.Objects1[i].color=color}CM.Cache.CacheBuildingsBulkPP("Objects10");CM.Cache.CacheBuildingsBulkPP("Objects100")}else{let target=`Objects${Game.buyBulk}`;for(let i of Object.keys(CM.Cache[target])){if(Game.cookiesPs){CM.Cache[target][i].pp=Math.max(Game.Objects[i].bulkPrice-(Game.cookies+CM.Disp.GetWrinkConfigBank()),0)/Game.cookiesPs+Game.Objects[i].bulkPrice/CM.Cache[target][i].bonus}else CM.CM.Cache[target][i].pp=Game.Objects[i].bulkPrice/CM.Cache[target][i].bonus;if(CM.Cache.min===-1||CM.Cache[target][i].ppCM.Cache.max)CM.Cache.max=CM.Cache[target][i].pp}CM.Cache.mid=(CM.Cache.max-CM.Cache.min)/2+CM.Cache.min;for(let i of Object.keys(CM.Cache.Objects1)){let color="";if(CM.Cache[target][i].pp===CM.Cache.min)color=CM.Disp.colorGreen;else if(CM.Cache[target][i].pp===CM.Cache.max)color=CM.Disp.colorRed;else if(CM.Cache[target][i].pp>CM.Cache.mid)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow;CM.Cache[target][i].color=color}}};CM.Cache.CacheBuildingsBulkPP=function(target){for(let i of Object.keys(CM.Cache[target])){if(Game.cookiesPs){CM.Cache[target][i].pp=Math.max(CM.Cache[target][i].price-(Game.cookies+CM.Disp.GetWrinkConfigBank()),0)/Game.cookiesPs+CM.Cache[target][i].price/CM.Cache[target][i].bonus}else CM.Cache[target][i].pp=CM.Cache[target][i].price/CM.Cache[target][i].bonus;let color="";if(CM.Cache[target][i].pp<=0||CM.Cache[target][i].pp===Infinity)color=CM.Disp.colorGray;else if(CM.Cache[target][i].ppCM.Cache.max)color=CM.Disp.colorPurple;else if(CM.Cache[target][i].pp>CM.Cache.mid)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow;CM.Cache[target][i].color=color}};CM.Cache.CacheUpgradePP=function(){for(let i of Object.keys(CM.Cache.Upgrades)){if(Game.cookiesPs){CM.Cache.Upgrades[i].pp=Math.max(Game.Upgrades[i].getPrice()-(Game.cookies+CM.Disp.GetWrinkConfigBank()),0)/Game.cookiesPs+Game.Upgrades[i].getPrice()/CM.Cache.Upgrades[i].bonus}else CM.Cache.Upgrades[i].pp=Game.Upgrades[i].getPrice()/CM.Cache.Upgrades[i].bonus;if(isNaN(CM.Cache.Upgrades[i].pp))CM.Cache.Upgrades[i].pp=Infinity;let color="";if(CM.Cache.Upgrades[i].pp<=0||CM.Cache.Upgrades[i].pp===Infinity)color=CM.Disp.colorGray;else if(CM.Cache.Upgrades[i].ppCM.Cache.max)color=CM.Disp.colorPurple;else if(CM.Cache.Upgrades[i].pp>CM.Cache.mid)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow;CM.Cache.Upgrades[i].color=color}};CM.Cache.CentEgg=0;CM.Cache.HadBuildAura=false;CM.Cache.NoGoldSwitchCookiesPS=0;CM.Config.SaveConfig=function(){let saveString=b64_to_utf8(unescape(localStorage.getItem("CookieClickerGame")).split("!END!")[0]);let CookieMonsterSave=saveString.match(/CookieMonster.*(;|$)/);if(CookieMonsterSave!=null){let newSaveString=saveString.replace(CookieMonsterSave[0],"CookieMonster:"+CM.save());localStorage.setItem("CookieClickerGame",escape(utf8_to_b64(newSaveString)+"!END!"))}};CM.Config.LoadConfig=function(settings){if(typeof localStorage.CMConfig!="undefined"){delete localStorage.CMConfig}if(settings!=null){CM.Options=settings;var mod=false;for(let i in CM.Data.ConfigDefault){if(typeof CM.Options[i]==="undefined"){mod=true;CM.Options[i]=CM.Data.ConfigDefault[i]}else if(i!="Header"&&i!="Colors"){if(i.indexOf("SoundURL")===-1){if(!(CM.Options[i]>-1&&CM.Options[i]-1&&CM.Options[i][j]<2)){mod=true;CM.Options[i][j]=CM.Data.ConfigDefault[i][j]}}}else{for(let j in CM.Data.ConfigDefault.Colors){if(typeof CM.Options[i][j]==="undefined"||typeof CM.Options[i][j]!="string"){mod=true;CM.Options[i][j]=CM.Data.ConfigDefault[i][j]}}}}if(mod)CM.Config.SaveConfig();CM.Main.Loop();for(let i in CM.Data.ConfigDefault){if(i!="Header"&&typeof CM.Data.Config[i].func!=="undefined"){CM.Data.Config[i].func()}}}else{CM.Config.RestoreDefault()}};CM.Config.RestoreDefault=function(){CM.Config.LoadConfig(CM.Data.ConfigDefault);CM.Config.SaveConfig();Game.UpdateMenu()};CM.Config.ToggleConfig=function(config){CM.Options[config]++;if(CM.Options[config]===CM.Data.Config[config].label.length){CM.Options[config]=0;if(CM.Data.Config[config].toggle)l(CM.Config.ConfigPrefix+config).className="option off"}else l(CM.Config.ConfigPrefix+config).className="option";if(typeof CM.Data.Config[config].func!=="undefined"){CM.Data.Config[config].func()}l(CM.Config.ConfigPrefix+config).innerHTML=CM.Data.Config[config].label[CM.Options[config]];CM.Config.SaveConfig()};CM.Config.ToggleConfigVolume=function(config){if(l("slider"+config)!=null){l("slider"+config+"right").innerHTML=l("slider"+config).value+"%";CM.Options[config]=Math.round(l("slider"+config).value)}CM.Config.SaveConfig()};CM.Config.ToggleHeader=function(config){CM.Options.Header[config]++;if(CM.Options.Header[config]>1)CM.Options.Header[config]=0;CM.Config.SaveConfig()};CM.Config.CheckNotificationPermissions=function(ToggleOnOff){if(ToggleOnOff===1){let checkNotificationPromise=function(){try{Notification.requestPermission().then()}catch(e){return false}return true};if(!("Notification"in window)){console.log("This browser does not support notifications.")}else{if(checkNotificationPromise()){Notification.requestPermission().then()}else{Notification.requestPermission()}}}};CM.Config.ConfigPrefix="CMConfig";CM.Data.Fortunes=["Fortune #001","Fortune #002","Fortune #003","Fortune #004","Fortune #005","Fortune #006","Fortune #007","Fortune #008","Fortune #009","Fortune #010","Fortune #011","Fortune #012","Fortune #013","Fortune #014","Fortune #015","Fortune #016","Fortune #017","Fortune #018","Fortune #100","Fortune #101","Fortune #102","Fortune #103","Fortune #104"];CM.Data.HalloCookies=["Skull cookies","Ghost cookies","Bat cookies","Slime cookies","Pumpkin cookies","Eyeball cookies","Spider cookies"];CM.Data.ChristCookies=["Christmas tree biscuits","Snowflake biscuits","Snowman biscuits","Holly biscuits","Candy cane biscuits","Bell biscuits","Present biscuits"];CM.Data.ValCookies=["Pure heart biscuits","Ardent heart biscuits","Sour heart biscuits","Weeping heart biscuits","Golden heart biscuits","Eternal heart biscuits","Prism heart biscuits"];CM.Data.PlantDrops=["Elderwort biscuits","Bakeberry cookies","Duketater cookies","Green yeast digestives","Wheat slims","Fern tea","Ichor syrup"];CM.Data.Effects={buildingCost:"Building prices",click:"Cookies per click",cps:"Total CPS",cursorCps:"Cursor CPS",goldenCookieDur:"Golden cookie duration",goldenCookieEffDur:"Golden cookie effect duration",goldenCookieFreq:"Golden cookie frequency",goldenCookieGain:"Golden cookie gains",grandmaCps:"Grandma CPS",itemDrops:"Random item drop chance",milk:"Effect from milk",reindeerDur:"Reindeer duration",reindeerFreq:"Reindeer frequency",reindeerGain:"Reindeer gains",upgradeCost:"Upgrade prices",wrathCookieDur:"Wrath cookie duration",wrathCookieEffDur:"Wrath cookie effect duration",wrathCookieFreq:"Wrath cookie frequency",wrathCookieGain:"Wrath cookie gains",wrinklerEat:"Wrinkler ",wrinklerSpawn:"Wrinkler spawn frequency"};CM.Data.metric=["","","M","G","T","P","E","Z","Y"];CM.Data.shortScale=["","","M","B","Tr","Quadr","Quint","Sext","Sept","Oct","Non","Dec","Undec","Duodec","Tredec","Quattuordec","Quindec","Sexdec","Septendec","Octodec","Novemdec","Vigint","Unvigint","Duovigint","Trevigint","Quattuorvigint"];CM.Data.shortScaleAbbreviated=["","K","M","B","T","Qa","Qi","Sx","Sp","Oc","No","De","UDe","DDe","TDe","QaDe","QiDe","SxDe","SpDe","ODe","NDe","Vi","UVi","DVi","TVi","QaVi","QiVi","SxVi","SpVi","OVi","NVi","Tr","UTr","DTr","TTr","QaTr","QiTr","SxTr","SpTr","OTr","NTr","Qaa","UQa","DQa","TQa","QaQa","QiQa","SxQa","SpQa","OQa","NQa","Qia","UQi","DQi","TQi","QaQi","QiQi","SxQi","SpQi","OQi","NQi","Sxa","USx","DSx","TSx","QaSx","QiSx","SxSx","SpSx","OSx","NSx","Spa","USp","DSp","TSp","QaSp","QiSp","SxSp","SpSp","OSp","NSp","Oco","UOc","DOc","TOc","QaOc","QiOc","SxOc","SpOc","OOc","NOc","Noa","UNo","DNo","TNo","QaNo","QiNo","SxNo","SpNo","ONo","NNo","Ct","UCt"];CM.Data.ConfigGroups={BarsColors:"Bars/Colors",Calculation:"Calculation",Notification:"Notification",Tooltip:"Tooltips",Statistics:"Statistics",Notation:"Notation",Miscellaneous:"Miscellaneous"};CM.Data.ConfigGroupsNotification={NotificationGeneral:"General Notifications",NotificationGC:"Golden Cookie",NotificationFC:"Fortune Cookie",NotificationSea:"Season Special",NotificationGard:"Garden Tick",NotificationMagi:"Full Magic Bar",NotificationWrink:"Wrinkler",NotificationWrinkMax:"Maximum Wrinklers"};CM.Data.Config.BotBar={type:"bool",group:"BarsColors",label:["Bottom Bar OFF","Bottom Bar ON"],desc:"Building Information",toggle:true,func:function(){CM.Disp.ToggleBotBar()}};CM.Data.Config.TimerBar={type:"bool",group:"BarsColors",label:["Timer Bar OFF","Timer Bar ON"],desc:"Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy",toggle:true,func:function(){CM.Disp.ToggleTimerBar()}};CM.Data.Config.TimerBarPos={type:"bool",group:"BarsColors",label:["Timer Bar Position (Top Left)","Timer Bar Position (Bottom)"],desc:"Placement of the Timer Bar",toggle:false,func:function(){CM.Disp.ToggleTimerBarPos()}};CM.Data.Config.TimerBarOverlay={type:"bool",group:"BarsColors",label:["Timer Bar Overlay OFF","Timer Bar Overlay Only Seconds","Timer Bar Overlay Full"],desc:"Overlay on timers displaying seconds and/or percentage left",toggle:true};CM.Data.Config.SortBuildings={type:"bool",group:"BarsColors",label:["Sort Buildings: Default","Sort Buildings: PP"],desc:"Sort the display of buildings in either default order or by PP",toggle:false,func:function(){CM.Disp.UpdateBuildings()}};CM.Data.Config.SortUpgrades={type:"bool",group:"BarsColors",label:["Sort Upgrades: Default","Sort Upgrades: PP"],desc:"Sort the display of upgrades in either default order or by PP",toggle:false,func:function(){CM.Disp.UpdateUpgrades()}};CM.Data.Config.BuildColor={type:"bool",group:"BarsColors",label:["Building Colors OFF","Building Colors ON"],desc:"Color code buildings",toggle:true,func:function(){CM.Disp.UpdateBuildings()}};CM.Data.Config.BulkBuildColor={type:"bool",group:"BarsColors",label:["Bulk Building Colors (Single Building Color)","Bulk Building Colors (Calculated Bulk Color)"],desc:"Color code bulk buildings based on single buildings color or calculated bulk value color",toggle:false,func:function(){CM.Disp.UpdateBuildings()}};CM.Data.Config.ColorPPBulkMode={type:"bool",group:"BarsColors",label:["Color of PP (Compared to Single)","Color of PP (Compared to Bulk)"],desc:"Color PP-values based on comparison with single purchase or with selected bulk-buy mode",toggle:false};CM.Data.Config.UpBarColor={type:"bool",group:"BarsColors",label:["Upgrade Colors/Bar OFF","Upgrade Colors with Bar ON","Upgrade Colors without Bar ON"],desc:"Color code upgrades and optionally add a counter bar",toggle:false,func:function(){CM.Disp.ToggleUpgradeBarAndColor()}};CM.Data.Config.Colors={type:"color",group:"BarsColors",desc:{Blue:"Color Blue. Used to show better than best PP building, for Click Frenzy bar, and for various labels",Green:"Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels",Yellow:"Color Yellow. Used to show between best and worst PP buildings closer to best, for Frenzy bar, and for various labels",Orange:"Color Orange. Used to show between best and worst PP buildings closer to worst, for Next Reindeer bar, and for various labels",Red:"Color Red. Used to show worst PP building, for Clot bar, and for various labels",Purple:"Color Purple. Used to show worse than worst PP building, for Next Cookie bar, and for various labels",Gray:"Color Gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar",Pink:"Color Pink. Used for Dragonflight bar",Brown:"Color Brown. Used for Dragon Harvest bar"},func:function(){CM.Disp.UpdateColors()}};CM.Data.Config.UpgradeBarFixedPos={type:"bool",group:"BarsColors",label:["Upgrade Bar Fixed Position OFF","Upgrade Bar Fixed Position ON"],desc:"Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling",toggle:true,func:function(){CM.Disp.ToggleUpgradeBarFixedPos()}};CM.Data.Config.CalcWrink={type:"bool",group:"Calculation",label:["Calculate with Wrinklers OFF","Calculate with Wrinklers ON","Calculate with Single Fattest Wrinkler ON"],desc:"Calculate times and average Cookies Per Second with (only the single non-shiny fattest) Wrinklers",toggle:true};CM.Data.Config.CPSMode={type:"bool",group:"Calculation",label:["Current Cookies Per Second","Average Cookies Per Second"],desc:"Calculate times using current Cookies Per Second or average Cookies Per Second",toggle:false};CM.Data.Config.AvgCPSHist={type:"bool",group:"Calculation",label:["Average CPS for past 10s","Average CPS for past 15s","Average CPS for past 30s","Average CPS for past 1m","Average CPS for past 5m","Average CPS for past 10m","Average CPS for past 15m","Average CPS for past 30m"],desc:"How much time average Cookies Per Second should consider",toggle:false};CM.Data.Config.AvgClicksHist={type:"bool",group:"Calculation",label:["Average Cookie Clicks for past 1s","Average Cookie Clicks for past 5s","Average Cookie Clicks for past 10s","Average Cookie Clicks for past 15s","Average Cookie Clicks for past 30s"],desc:"How much time average Cookie Clicks should consider",toggle:false};CM.Data.Config.ToolWarnBon={type:"bool",group:"Calculation",label:["Calculate Tooltip Warning With Bonus CPS OFF","Calculate Tooltip Warning With Bonus CPS ON"],desc:"Calculate the warning with or without the bonus CPS you get from buying",toggle:true};CM.Data.Config.Title={type:"bool",group:"NotificationGeneral",label:["Title OFF","Title ON","Title Pinned Tab Highlight"],desc:'Update title with Golden Cookie/Season Popup timers; pinned tab highlight only changes the title when a Golden Cookie/Season Popup spawns; "!" means that Golden Cookie/Reindeer can spawn',toggle:true};CM.Data.Config.GeneralSound={type:"bool",group:"NotificationGeneral",label:["Consider Game Volume Setting OFF","Consider Game Volume Setting ON"],desc:'Turning this toggle to "off" makes Cookie Monster no longer consider the volume setting of the base game, allowing mod notifications to play with base game volume turned down',toggle:true};CM.Data.Config.GCNotification={type:"bool",group:"NotificationGC",label:["Notification OFF","Notification ON"],desc:"Create a notification when Golden Cookie spawns",toggle:true,func:function(){CM.Config.CheckNotificationPermissions(CM.Options.GCNotification)}};CM.Data.Config.GCFlash={type:"bool",group:"NotificationGC",label:["Flash OFF","Flash ON"],desc:"Flash screen on Golden Cookie",toggle:true};CM.Data.Config.GCSound={type:"bool",group:"NotificationGC",label:["Sound OFF","Sound ON"],desc:"Play a sound on Golden Cookie",toggle:true};CM.Data.Config.GCVolume={type:"vol",group:"NotificationGC",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.GCVolume.label[i]=i+"%"}CM.Data.Config.GCSoundURL={type:"url",group:"NotificationGC",label:"Sound URL:",desc:"URL of the sound to be played when a Golden Cookie spawns"};CM.Data.Config.FortuneNotification={type:"bool",group:"NotificationFC",label:["Notification OFF","Notification ON"],desc:"Create a notification when Fortune Cookie is on the Ticker",toggle:true,func:function(){CM.Config.CheckNotificationPermissions(CM.Options.FortuneNotification)}};CM.Data.Config.FortuneFlash={type:"bool",group:"NotificationFC",label:["Flash OFF","Flash ON"],desc:"Flash screen on Fortune Cookie",toggle:true};CM.Data.Config.FortuneSound={type:"bool",group:"NotificationFC",label:["Sound OFF","Sound ON"],desc:"Play a sound on Fortune Cookie",toggle:true};CM.Data.Config.FortuneVolume={type:"vol",group:"NotificationFC",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.FortuneVolume.label[i]=i+"%"}CM.Data.Config.FortuneSoundURL={type:"url",group:"NotificationFC",label:"Sound URL:",desc:"URL of the sound to be played when the Ticker has a Fortune Cookie"};CM.Data.Config.SeaNotification={type:"bool",group:"NotificationSea",label:["Notification OFF","Notification ON"],desc:"Create a notification on Season Popup",toggle:true,func:function(){CM.Config.CheckNotificationPermissions(CM.Options.SeaNotification)}};CM.Data.Config.SeaFlash={type:"bool",group:"NotificationSea",label:["Flash OFF","Flash ON"],desc:"Flash screen on Season Popup",toggle:true};CM.Data.Config.SeaSound={type:"bool",group:"NotificationSea",label:["Sound OFF","Sound ON"],desc:"Play a sound on Season Popup",toggle:true};CM.Data.Config.SeaVolume={type:"vol",group:"NotificationSea",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.SeaVolume.label[i]=i+"%"}CM.Data.Config.SeaSoundURL={type:"url",group:"NotificationSea",label:"Sound URL:",desc:"URL of the sound to be played when a Season Special spawns"};CM.Data.Config.GardFlash={type:"bool",group:"NotificationGard",label:["Garden Tick Flash OFF","Flash ON"],desc:"Flash screen on Garden Tick",toggle:true};CM.Data.Config.GardSound={type:"bool",group:"NotificationGard",label:["Sound OFF","Sound ON"],desc:"Play a sound on Garden Tick",toggle:true};CM.Data.Config.GardVolume={type:"vol",group:"NotificationGard",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.GardVolume.label[i]=i+"%"}CM.Data.Config.GardSoundURL={type:"url",group:"NotificationGard",label:"Garden Tick Sound URL:",desc:"URL of the sound to be played when the garden ticks"};CM.Data.Config.MagicNotification={type:"bool",group:"NotificationMagi",label:["Notification OFF","Notification ON"],desc:"Create a notification when magic reaches maximum",toggle:true,func:function(){CM.Config.CheckNotificationPermissions(CM.Options.MagicNotification)}};CM.Data.Config.MagicFlash={type:"bool",group:"NotificationMagi",label:["Flash OFF","Flash ON"],desc:"Flash screen when magic reaches maximum",toggle:true};CM.Data.Config.MagicSound={type:"bool",group:"NotificationMagi",label:["Sound OFF","Sound ON"],desc:"Play a sound when magic reaches maximum",toggle:true};CM.Data.Config.MagicVolume={type:"vol",group:"NotificationMagi",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.MagicVolume.label[i]=i+"%"}CM.Data.Config.MagicSoundURL={type:"url",group:"NotificationMagi",label:"Sound URL:",desc:"URL of the sound to be played when magic reaches maxium"};CM.Data.Config.WrinklerNotification={type:"bool",group:"NotificationWrink",label:["Notification OFF","Notification ON"],desc:"Create a notification when a Wrinkler appears",toggle:true,func:function(){CM.Config.CheckNotificationPermissions(CM.Options.WrinklerNotification)}};CM.Data.Config.WrinklerFlash={type:"bool",group:"NotificationWrink",label:["Flash OFF","Flash ON"],desc:"Flash screen when a Wrinkler appears",toggle:true};CM.Data.Config.WrinklerSound={type:"bool",group:"NotificationWrink",label:["Sound OFF","Sound ON"],desc:"Play a sound when a Wrinkler appears",toggle:true};CM.Data.Config.WrinklerVolume={type:"vol",group:"NotificationWrink",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.WrinklerVolume.label[i]=i+"%"}CM.Data.Config.WrinklerSoundURL={type:"url",group:"NotificationWrink",label:"Sound URL:",desc:"URL of the sound to be played when a Wrinkler appears"};CM.Data.Config.WrinklerMaxNotification={type:"bool",group:"NotificationWrinkMax",label:["Notification OFF","Notification ON"],desc:"Create a notification when the maximum amount of Wrinklers has appeared",toggle:true,func:function(){CM.Config.CheckNotificationPermissions(CM.Options.WrinklerMaxNotification)}};CM.Data.Config.WrinklerMaxFlash={type:"bool",group:"NotificationWrinkMax",label:["Flash OFF","Flash ON"],desc:"Flash screen when the maximum amount of Wrinklers has appeared",toggle:true};CM.Data.Config.WrinklerMaxSound={type:"bool",group:"NotificationWrinkMax",label:["Sound OFF","Sound ON"],desc:"Play a sound when the maximum amount of Wrinklers has appeared",toggle:true};CM.Data.Config.WrinklerMaxVolume={type:"vol",group:"NotificationWrinkMax",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.WrinklerMaxVolume.label[i]=i+"%"}CM.Data.Config.WrinklerMaxSoundURL={type:"url",group:"NotificationWrinkMax",label:"Sound URL:",desc:"URL of the sound to be played when the maximum amount of Wrinklers has appeared"};CM.Data.Config.TooltipBuildUpgrade={type:"bool",group:"Tooltip",label:["Building/Upgrade Tooltip Information OFF","Building/Upgrade Tooltip Information ON"],desc:"Extra information in Building/Upgrade tooltips",toggle:true};CM.Data.Config.TooltipAmor={type:"bool",group:"Tooltip",label:["Buildings Tooltip Amortization Information OFF","Buildings Tooltip Amortization Information ON"],desc:"Add amortization information to buildings tooltip",toggle:true};CM.Data.Config.ToolWarnLucky={type:"bool",group:"Tooltip",label:["Tooltip Lucky Warning OFF","Tooltip Lucky Warning ON"],desc:'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards',toggle:true};CM.Data.Config.ToolWarnLuckyFrenzy={type:"bool",group:"Tooltip",label:["Tooltip Lucky Frenzy Warning OFF","Tooltip Lucky Frenzy Warning ON"],desc:'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards',toggle:true};CM.Data.Config.ToolWarnConjure={type:"bool",group:"Tooltip",label:["Tooltip Conjure Warning OFF","Tooltip Conjure Warning ON"],desc:'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards',toggle:true};CM.Data.Config.ToolWarnConjureFrenzy={type:"bool",group:"Tooltip",label:["Tooltip Conjure Frenzy Warning OFF","Tooltip Conjure Frenzy Warning ON"],desc:'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active',toggle:true};CM.Data.Config.ToolWarnEdifice={type:"bool",group:"Tooltip",label:["Tooltip Edifice Warning OFF","Tooltip Edifice Warning ON"],desc:'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building',toggle:true};CM.Data.Config.ToolWarnPos={type:"bool",group:"Tooltip",label:["Tooltip Warning Position (Left)","Tooltip Warning Position (Bottom)"],desc:"Placement of the warning boxes",toggle:false,func:function(){CM.Disp.ToggleToolWarnPos()}};CM.Data.Config.TooltipGrim={type:"bool",group:"Tooltip",label:["Grimoire Tooltip Information OFF","Grimoire Tooltip Information ON"],desc:"Extra information in tooltip for grimoire",toggle:true};CM.Data.Config.TooltipWrink={type:"bool",group:"Tooltip",label:["Wrinkler Tooltip OFF","Wrinkler Tooltip ON"],desc:"Shows the amount of cookies a wrinkler will give when popping it",toggle:true};CM.Data.Config.TooltipLump={type:"bool",group:"Tooltip",label:["Sugar Lump Tooltip OFF","Sugar Lump Tooltip ON"],desc:"Shows the current Sugar Lump type in Sugar lump tooltip.",toggle:true};CM.Data.Config.TooltipPlots={type:"bool",group:"Tooltip",label:["Garden Plots Tooltip OFF","Garden Plots Tooltip ON"],desc:"Shows a tooltip for plants that have a cookie reward.",toggle:true};CM.Data.Config.DragonAuraInfo={type:"bool",group:"Tooltip",label:["Extra Dragon Aura Info OFF","Extra Dragon Aura Info ON"],desc:"Shows information about changes in CPS and costs in the dragon aura interface.",toggle:true};CM.Data.Config.Stats={type:"bool",group:"Statistics",label:["Statistics OFF","Statistics ON"],desc:"Extra Cookie Monster statistics!",toggle:true};CM.Data.Config.MissingUpgrades={type:"bool",group:"Statistics",label:["Missing Upgrades OFF","Missing Upgrades ON"],desc:"Shows Missing upgrades in Stats Menu. This feature can be laggy for users with a low amount of unlocked achievements.",toggle:true};CM.Data.Config.UpStats={type:"bool",group:"Statistics",label:["Statistics Update Rate (Default)","Statistics Update Rate (1s)"],desc:"Default Game rate is once every 5 seconds",toggle:false};CM.Data.Config.TimeFormat={type:"bool",group:"Statistics",label:["Time XXd, XXh, XXm, XXs","Time XX:XX:XX:XX:XX"],desc:"Change the time format",toggle:false};CM.Data.Config.DetailedTime={type:"bool",group:"Statistics",label:["Detailed Time OFF","Detailed Time ON"],desc:"Change how time is displayed in certain statistics and tooltips",toggle:true,func:function(){CM.Disp.ToggleDetailedTime()}};CM.Data.Config.GrimoireBar={type:"bool",group:"Statistics",label:["Grimoire Magic Meter Timer OFF","Grimoire Magic Meter Timer ON"],desc:"A timer on how long before the Grimoire magic meter is full",toggle:true};CM.Data.Config.Scale={type:"bool",group:"Notation",label:["Game's Setting Scale","Metric","Short Scale","Short Scale (Abbreviated)","Scientific Notation","Engineering Notation"],desc:"Change how long numbers are handled",toggle:false,func:function(){CM.Disp.RefreshScale()}};CM.Data.Config.ScaleDecimals={type:"bool",group:"Notation",label:["1 decimals","2 decimals","3 decimals"],desc:"Set the number of decimals used when applicable",toggle:false,func:function(){CM.Disp.RefreshScale()}};CM.Data.Config.ScaleSeparator={type:"bool",group:"Notation",label:[". for decimals (Standard)",". for thousands"],desc:"Set the separator used for decimals and thousands",toggle:false,func:function(){CM.Disp.RefreshScale()}};CM.Data.Config.ScaleCutoff={type:"numscale",group:"Notation",label:"Notation Cut-off Point",desc:"The number from which CookieMonster will start formatting numbers based on chosen scale. Standard is 999,999. Setting this above 999,999,999 might break certain notations.",min:1,max:999999999};CM.Data.Config.GCTimer={type:"bool",group:"Miscellaneous",label:["Golden Cookie Timer OFF","Golden Cookie Timer ON"],desc:"A timer on the Golden Cookie when it has been spawned",toggle:true,func:function(){CM.Disp.ToggleGCTimer()}};CM.Data.Config.Favicon={type:"bool",group:"Miscellaneous",label:["Favicon OFF","Favicon ON"],desc:"Update favicon with Golden/Wrath Cookie",toggle:true,func:function(){CM.Disp.UpdateFavicon()}};CM.Data.Config.WrinklerButtons={type:"bool",group:"Miscellaneous",label:["Extra Buttons OFF","Extra Buttons ON"],desc:"Show buttons for popping wrinklers at bottom of cookie section",toggle:true,func:function(){CM.Disp.UpdateWrinklerButtons()}};CM.Data.Config.BulkBuyBlock={type:"bool",group:"Miscellaneous",label:["Block Bulk Buying OFF","Block Bulk Buying ON"],desc:"Block clicking bulk buying when you can't buy all. This prevents buying 7 of a building when you are in buy-10 or buy-100 mode.",toggle:true};CM.Data.ConfigDefault={BotBar:1,TimerBar:1,TimerBarPos:0,TimerBarOverlay:2,BuildColor:1,BulkBuildColor:0,ColorPPBulkMode:0,UpBarColor:1,UpgradeBarFixedPos:1,CalcWrink:0,CPSMode:1,AvgCPSHist:3,AvgClicksHist:0,ToolWarnBon:0,Title:1,GeneralSound:1,GCNotification:0,GCFlash:1,GCSound:1,GCVolume:100,GCSoundURL:"https://freesound.org/data/previews/66/66717_931655-lq.mp3",FortuneNotification:0,FortuneFlash:1,FortuneSound:1,FortuneVolume:100,FortuneSoundURL:"https://freesound.org/data/previews/174/174027_3242494-lq.mp3",SeaNotification:0,SeaFlash:1,SeaSound:1,SeaVolume:100,SeaSoundURL:"https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3",GardFlash:1,GardSound:1,GardVolume:100,GardSoundURL:"https://freesound.org/data/previews/103/103046_861714-lq.mp3",MagicNotification:0,MagicFlash:1,MagicSound:1,MagicVolume:100,MagicSoundURL:"https://freesound.org/data/previews/221/221683_1015240-lq.mp3",WrinklerNotification:0,WrinklerFlash:1,WrinklerSound:1,WrinklerVolume:100,WrinklerSoundURL:"https://freesound.org/data/previews/124/124186_8043-lq.mp3",WrinklerMaxNotification:0,WrinklerMaxFlash:1,WrinklerMaxSound:1,WrinklerMaxVolume:100,WrinklerMaxSoundURL:"https://freesound.org/data/previews/152/152743_15663-lq.mp3",TooltipBuildUpgrade:1,TooltipAmor:0,ToolWarnLucky:1,ToolWarnLuckyFrenzy:1,ToolWarnConjure:1,ToolWarnConjureFrenzy:1,ToolWarnEdifice:1,ToolWarnPos:1,TooltipGrim:1,TooltipWrink:1,TooltipLump:1,TooltipPlots:1,DragonAuraInfo:1,Stats:1,MissingUpgrades:1,UpStats:1,TimeFormat:0,DetailedTime:1,GrimoireBar:1,Scale:2,ScaleDecimals:2,ScaleSeparator:0,ScaleCutoff:999999,Colors:{Blue:"#4bb8f0",Green:"#00ff00",Yellow:"#ffff00",Orange:"#ff7f00",Red:"#ff0000",Purple:"#ff00ff",Gray:"#b3b3b3",Pink:"#ff1493",Brown:"#8b4513"},SortBuildings:0,SortUpgrades:0,GCTimer:1,Favicon:1,WrinklerButtons:1,BulkBuyBlock:0,Header:{BarsColors:1,Calculation:1,Notification:1,NotificationGeneral:1,NotificationGC:1,NotificationFC:1,NotificationSea:1,NotificationGard:1,NotificationMagi:1,NotificationWrink:1,NotificationWrinkMax:1,Tooltip:1,Statistics:1,Notation:1,Miscellaneous:1,Lucky:1,Spells:1,Chain:1,Prestige:1,Wrink:1,Sea:1,Misc:1}};CM.Disp.GetWrinkConfigBank=function(){if(CM.Options.CalcWrink===1){return CM.Cache.WrinklersTotal}else if(CM.Options.CalcWrink===2){return CM.Cache.WrinklersFattest[0]}else{return 0}};CM.Disp.PopAllNormalWrinklers=function(){for(let i of Object.keys(Game.wrinklers)){if(Game.wrinklers[i].sucked>0&&Game.wrinklers[i].type===0){Game.wrinklers[i].hp=0}}};CM.Disp.GetCPS=function(){if(CM.Options.CPSMode){return CM.Cache.AvgCPS}else{if(CM.Options.CalcWrink===0){return Game.cookiesPs*(1-Game.cpsSucked)}else if(CM.Options.CalcWrink===1){return Game.cookiesPs*(CM.Cache.CurrWrinklerCPSMult+(1-CM.Cache.CurrWrinklerCount*.05))}else if(CM.Options.CalcWrink===2){if(Game.wrinklers[CM.Cache.WrinklersFattest[1]].type===1){return Game.cookiesPs*(CM.Cache.CurrWrinklerCPSMult*3/CM.Cache.CurrWrinklerCount+(1-CM.Cache.CurrWrinklerCount*.05))}else{return Game.cookiesPs*(CM.Cache.CurrWrinklerCPSMult/CM.Cache.CurrWrinklerCount+(1-CM.Cache.CurrWrinklerCount*.05))}}}};CM.Disp.CalculateGrimoireRefillTime=function(currentMagic,maxMagic,targetMagic){var count=0;while(currentMagic315576e4)return"XX:XX:XX:XX:XX";str+=(y<10?"0":"")+y+":";str+=(d<10?"0":"")+d+":";str+=(h<10?"0":"")+h+":";str+=(m<10?"0":"")+m+":";str+=(s<10?"0":"")+s}else{if(time>7776e5)return longFormat?"Over 9000 days!":">9000d";str+=y>0?y+(longFormat?y===1?" year":" years":"y")+", ":"";str+=d>0?d+(longFormat?d===1?" day":" days":"d")+", ":"";if(str.length>0||h>0)str+=h+(longFormat?h===1?" hour":" hours":"h")+", ";if(str.length>0||m>0)str+=m+(longFormat?m===1?" minute":" minutes":"m")+", ";str+=s+(longFormat?s===1?" second":" seconds":"s")}return str};CM.Disp.GetTimeColor=function(time){var color;var text;if(time<0){if(CM.Options.TimeFormat)text="00:00:00:00:00";else text="Done!";color=CM.Disp.colorGreen}else{text=CM.Disp.FormatTime(time);if(time>300)color=CM.Disp.colorRed;else if(time>60)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow}return{text:text,color:color}};CM.Disp.Beautify=function(num,floats,forced){var decimals=CM.Options.ScaleDecimals+1;if(CM.Options.Scale===0){return CM.Backup.Beautify(num,floats)}else if(isFinite(num)){var answer="";if(num===0){return num.toString()}else if(.001=.01&&num=.01&&num=.01&&num=1)l("CMTimerBarGCMinBar").textContent=Math.ceil((Game.shimmerTypes.golden.minTime-Game.shimmerTypes.golden.time)/Game.fps);else l("CMTimerBarGCMinBar").textContent="";if(Game.shimmerTypes.golden.minTime===Game.shimmerTypes.golden.maxTime){l("CMTimerBarGCMinBar").style.borderTopRightRadius="10px";l("CMTimerBarGCMinBar").style.borderBottomRightRadius="10px"}else{l("CMTimerBarGCMinBar").style.borderTopRightRadius="";l("CMTimerBarGCMinBar").style.borderBottomRightRadius=""}l("CMTimerBarGCBar").style.width=Math.round(Math.min(Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.minTime,Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)*maxWidthTwoBar/Game.shimmerTypes.golden.maxTime)+"px";if(CM.Options.TimerBarOverlay>=1)l("CMTimerBarGCBar").textContent=Math.ceil(Math.min(Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.minTime,Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)/Game.fps);else l("CMTimerBarGCBar").textContent="";l("CMTimerBarGCTime").textContent=Math.ceil((Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)/Game.fps);numberOfTimers++}else CM.Disp.TimerBars.CMTimerBarGC.style.display="none";if(Game.season==="christmas"&&Game.shimmerTypes.reindeer.spawned===0){CM.Disp.TimerBars.CMTimerBarRen.style.display="";l("CMTimerBarRenMinBar").style.width=Math.round(Math.max(0,Game.shimmerTypes.reindeer.minTime-Game.shimmerTypes.reindeer.time)*maxWidthTwoBar/Game.shimmerTypes.reindeer.maxTime)+"px";if(CM.Options.TimerBarOverlay>=1)l("CMTimerBarRenMinBar").textContent=Math.ceil((Game.shimmerTypes.reindeer.minTime-Game.shimmerTypes.reindeer.time)/Game.fps);else l("CMTimerBarRenMinBar").textContent="";l("CMTimerBarRenBar").style.width=Math.round(Math.min(Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.minTime,Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)*maxWidthTwoBar/Game.shimmerTypes.reindeer.maxTime)+"px";if(CM.Options.TimerBarOverlay>=1)l("CMTimerBarRenBar").textContent=Math.ceil(Math.min(Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.minTime,Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps);else l("CMTimerBarRenBar").textContent="";l("CMTimerBarRenTime").textContent=Math.ceil((Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps);numberOfTimers++}else{CM.Disp.TimerBars.CMTimerBarRen.style.display="none"}for(let i of Object.keys(CM.Disp.BuffTimerBars)){CM.Disp.BuffTimerBars[i].remove()}CM.Disp.BuffTimerBars={};for(let i of Object.keys(Game.buffs)){if(Game.buffs[i]){let timer=CM.Disp.TimerBarCreateBar(Game.buffs[i].name,Game.buffs[i].name,[{id:Game.buffs[i].name+"Bar"}]);timer.style.display="";var classColor="";if(typeof CM.Disp.buffColors[Game.buffs[i].name]!=="undefined"){classColor=CM.Disp.buffColors[Game.buffs[i].name]}else classColor=CM.Disp.colorPurple;timer.lastChild.children[1].className=CM.Disp.colorBackPre+classColor;timer.lastChild.children[1].style.color="black";if(CM.Options.TimerBarOverlay===2)timer.lastChild.children[1].textContent=Math.round(100*(Game.buffs[i].time/Game.buffs[i].maxTime))+"%";else timer.lastChild.children[1].textContent="";timer.lastChild.children[1].style.width=Math.round(Game.buffs[i].time*(maxWidthOneBar-Math.ceil(Game.buffs[i].time/Game.fps).toString().length*8)/Game.buffs[i].maxTime)+"px";timer.lastChild.children[2].textContent=Math.ceil(Game.buffs[i].time/Game.fps);numberOfTimers++;CM.Disp.BuffTimerBars[Game.buffs[i].name]=timer}}for(let i of Object.keys(CM.Disp.BuffTimerBars)){CM.Disp.TimerBar.appendChild(CM.Disp.BuffTimerBars[i])}if(numberOfTimers!=0){CM.Disp.TimerBar.style.height=numberOfTimers*12+2+"px"}if(CM.Disp.LastNumberOfTimers!=numberOfTimers){CM.Disp.LastNumberOfTimers=numberOfTimers;CM.Disp.UpdateBotTimerBarPosition()}}};CM.Disp.ToggleTimerBar=function(){if(CM.Options.TimerBar===1)CM.Disp.TimerBar.style.display="";else CM.Disp.TimerBar.style.display="none";CM.Disp.UpdateBotTimerBarPosition()};CM.Disp.ToggleTimerBarPos=function(){if(CM.Options.TimerBarPos===0){CM.Disp.TimerBar.style.width="30%";CM.Disp.TimerBar.style.bottom="";l("game").insertBefore(CM.Disp.TimerBar,l("sectionLeft"))}else{CM.Disp.TimerBar.style.width="100%";CM.Disp.TimerBar.style.bottom="0px";l("wrapper").appendChild(CM.Disp.TimerBar)}CM.Disp.UpdateBotTimerBarPosition()};CM.Disp.UpdateBotTimerBarPosition=function(){if(CM.Options.BotBar===1&&CM.Options.TimerBar===1&&CM.Options.TimerBarPos===1){CM.Disp.BotBar.style.bottom=CM.Disp.TimerBar.style.height;l("game").style.bottom=Number(CM.Disp.TimerBar.style.height.replace("px",""))+70+"px"}else if(CM.Options.BotBar===1){CM.Disp.BotBar.style.bottom="0px";l("game").style.bottom="70px"}else if(CM.Options.TimerBar===1&&CM.Options.TimerBarPos===1){l("game").style.bottom=CM.Disp.TimerBar.style.height}else{l("game").style.bottom="0px"}if(CM.Options.TimerBar===1&&CM.Options.TimerBarPos===0){l("sectionLeft").style.top=CM.Disp.TimerBar.style.height}else{l("sectionLeft").style.top=""}CM.Disp.UpdateBackground()};CM.Disp.UpdateBuildings=function(){let target=`Objects${Game.buyBulk}`;if(Game.buyMode===1){if(CM.Options.BuildColor===1){for(let i of Object.keys(CM.Cache[target])){l("productPrice"+Game.Objects[i].id).style.color=CM.Options.Colors[CM.Cache[target][i].color]}}else{for(let i of Object.keys(Game.Objects)){l("productPrice"+Game.Objects[i].id).style.removeProperty("color")}}}else if(Game.buyMode===-1){for(let i of Object.keys(CM.Cache.Objects1)){var o=Game.Objects[i];l("productPrice"+o.id).style.color="";l("productPrice"+o.id).innerHTML=Beautify(CM.Sim.BuildingSell(o,o.basePrice,o.amount,o.free,Game.buyBulk,1))}}if(Game.buyMode===1&&CM.Options.SortBuildings){let arr=Object.keys(CM.Cache[target]).map((k=>{var o=CM.Cache[target][k];o.name=k;o.id=Game.Objects[k].id;return o}));arr.sort((function(a,b){return a.pp>b.pp?1:a.pp{var o=CM.Cache.Objects1[k];o.name=k;o.id=Game.Objects[k].id;return o}));arr.sort(((a,b)=>a.id-b.id));for(let x=0;x0){var blue=0;var green=0;var yellow=0;var orange=0;var red=0;var purple=0;var gray=0;for(let i of Object.keys(Game.UpgradesInStore)){var me=Game.UpgradesInStore[i];var addedColor=false;for(let j=0;ja.pp-b.pp))}else{arr.sort(((a,b)=>a.price-b.price))}let nameChecker=function(arr,upgrade){return arr.findIndex((e=>e.name===upgrade.name))};for(let x=0;x0){if(CM.Cache.spawnedGoldenShimmer.wrath)CM.Disp.Favicon.href="https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico";else CM.Disp.Favicon.href="https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico"}else CM.Disp.Favicon.href="https://orteil.dashnet.org/cookieclicker/favicon.ico"};CM.Disp.UpdateTitle=function(){if(Game.OnAscend||CM.Options.Title===0){document.title=CM.Disp.Title}else if(CM.Options.Title===1){let addFC=false;let addSP=false;let titleGC;let titleFC;let titleSP;if(CM.Cache.spawnedGoldenShimmer){if(CM.Cache.spawnedGoldenShimmer.wrath)titleGC=`[W${Math.ceil(CM.Cache.spawnedGoldenShimmer.life/Game.fps)}]`;else titleGC=`[G${Math.ceil(CM.Cache.spawnedGoldenShimmer.life/Game.fps)}]`}else if(!Game.Has("Golden switch [off]")){titleGC=`[${Number(l("CMTimerBarGCMinBar").textContent)<0?"!":""}${Math.ceil((Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)/Game.fps)}]`}else titleGC="[GS]";if(CM.Main.lastTickerFortuneState){addFC=true;titleFC="[F]"}if(Game.season==="christmas"){addSP=true;if(CM.Main.lastSeasonPopupState)titleSP=`[R${Math.ceil(CM.Cache.seasonPopShimmer.life/Game.fps)}]`;else{titleSP=`[${Number(l("CMTimerBarRenMinBar").textContent)<0?"!":""}${Math.ceil((Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps)}]`}}let str=CM.Disp.Title;if(str.charAt(0)==="["){str=str.substring(str.lastIndexOf("]")+1)}document.title=titleGC+(addFC?titleFC:"")+(addSP?titleSP:"")+" "+str}else if(CM.Options.Title===2){let str="";let spawn=false;if(CM.Cache.spawnedGoldenShimmer){spawn=true;if(CM.Cache.spawnedGoldenShimmer.wrath)str+=`[W${Math.ceil(CM.Cache.spawnedGoldenShimmer.life/Game.fps)}]`;else str+=`[G${Math.ceil(CM.Cache.spawnedGoldenShimmer.life/Game.fps)}]`}if(CM.Main.lastTickerFortuneState){spawn=true;str+="[F]"}if(Game.season==="christmas"&&CM.Main.lastSeasonPopupState){str+=`[R${Math.ceil(CM.Cache.seasonPopShimmer.life/Game.fps)}]`;spawn=true}if(spawn)str+=" - ";let title="Cookie Clicker";if(Game.season==="fools")title="Cookie Baker";str+=title;document.title=str}};CM.Disp.CreateGCTimer=function(cookie){let GCTimer=document.createElement("div");GCTimer.id="GCTimer"+cookie.id;GCTimer.style.width="96px";GCTimer.style.height="96px";GCTimer.style.position="absolute";GCTimer.style.zIndex="10000000001";GCTimer.style.textAlign="center";GCTimer.style.lineHeight="96px";GCTimer.style.fontFamily='"Kavoon", Georgia, serif';GCTimer.style.fontSize="35px";GCTimer.style.cursor="pointer";GCTimer.style.display="block";if(CM.Options.GCTimer===0)GCTimer.style.display="none";GCTimer.style.left=cookie.l.style.left;GCTimer.style.top=cookie.l.style.top;GCTimer.onclick=function(){cookie.pop()};GCTimer.onmouseover=function(){cookie.l.style.filter="brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))";cookie.l.style.webkitFilter="brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))"};GCTimer.onmouseout=function(){cookie.l.style.filter="";cookie.l.style.webkitFilter=""};CM.Disp.GCTimers[cookie.id]=GCTimer;l("shimmers").appendChild(GCTimer)};CM.Disp.ToggleGCTimer=function(){if(CM.Options.GCTimer===1){for(let i of Object.keys(CM.Disp.GCTimers)){CM.Disp.GCTimers[i].style.display="block";CM.Disp.GCTimers[i].style.left=CM.Cache.goldenShimmersByID[i].l.style.left;CM.Disp.GCTimers[i].style.top=CM.Cache.goldenShimmersByID[i].l.style.top}}else{for(let i of Object.keys(CM.Disp.GCTimers))CM.Disp.GCTimers[i].style.display="none"}};CM.Disp.CreateSimpleTooltip=function(placeholder,text,minWidth){CM.Disp[placeholder]=document.createElement("div");var desc=document.createElement("div");desc.style.minWidth=minWidth;desc.style.marginBottom="4px";let div=document.createElement("div");div.style.textAlign="left";div.textContent=text;desc.appendChild(div);CM.Disp[placeholder].appendChild(desc)};CM.Disp.ReplaceTooltipUpgrade=function(){CM.Disp.TooltipUpgradeBackup=[];for(let i of Object.keys(Game.UpgradesInStore)){if(l("upgrade"+i).onmouseover!=null){CM.Disp.TooltipUpgradeBackup[i]=l("upgrade"+i).onmouseover;l("upgrade"+i).onmouseover=function(){if(!Game.mouseDown){Game.setOnCrate(this);Game.tooltip.dynamic=1;Game.tooltip.draw(this,(function(){return CM.Disp.Tooltip("u",`${i}`)}),"store");Game.tooltip.wobble()}}}}};CM.Disp.Tooltip=function(type,name){if(type==="b"){l("tooltip").innerHTML=Game.Objects[name].tooltip();if(CM.Options.TooltipAmor===1){var buildPrice=CM.Sim.BuildingGetPrice(Game.Objects[name],Game.Objects[name].basePrice,0,Game.Objects[name].free,Game.Objects[name].amount);var amortizeAmount=buildPrice-Game.Objects[name].totalCookies;if(amortizeAmount>0){l("tooltip").innerHTML=l("tooltip").innerHTML.split("so far").join("so far
"+Beautify(amortizeAmount)+" "+(Math.floor(amortizeAmount)===1?"cookie":"cookies")+" left to amortize ("+CM.Disp.GetTimeColor((buildPrice-Game.Objects[name].totalCookies)/(Game.Objects[name].storedTotalCps*Game.globalCpsMult)).text+")")}}if(Game.buyMode===-1){l("tooltip").innerHTML=l("tooltip").innerHTML.split(Beautify(Game.Objects[name].bulkPrice)).join(Beautify(CM.Sim.BuildingSell(Game.Objects[name],Game.Objects[name].basePrice,Game.Objects[name].amount,Game.Objects[name].free,Game.buyBulk,1)))}}else if(type==="u"){if(!Game.UpgradesInStore[name])return"";l("tooltip").innerHTML=Game.crateTooltip(Game.UpgradesInStore[name],"store")}else if(type==="s")l("tooltip").innerHTML=Game.lumpTooltip();else if(type==="g")l("tooltip").innerHTML=Game.Objects["Wizard tower"].minigame.spellTooltip(name)();else if(type==="p")l("tooltip").innerHTML=Game.ObjectsById[2].minigame.tileTooltip(name[0],name[1])();else if(type==="ha")l("tooltip").innerHTML=Game.ObjectsById[2].minigame.toolTooltip(1)();if(type==="b"&&Game.buyMode===1||type==="u"||type==="s"||type==="g"||type==="p"||type==="ha"){var area=document.createElement("div");area.id="CMTooltipArea";l("tooltip").appendChild(area)}CM.Disp.tooltipType=type;CM.Disp.tooltipName=name;CM.Disp.UpdateTooltip();return l("tooltip").innerHTML};CM.Disp.TooltipCreateTooltipBox=function(){l("tooltip").firstChild.style.paddingBottom="4px";var tooltipBox=document.createElement("div");tooltipBox.style.border="1px solid";tooltipBox.style.padding="4px";tooltipBox.style.margin="0px -4px";tooltipBox.id="CMTooltipBorder";tooltipBox.className=CM.Disp.colorTextPre+CM.Disp.colorGray;return tooltipBox};CM.Disp.TooltipCreateHeader=function(text){let div=document.createElement("div");div.style.fontWeight="bold";div.className=CM.Disp.colorTextPre+CM.Disp.colorBlue;div.textContent=text;return div};CM.Disp.TooltipCreateCalculationSection=function(tooltip){tooltip.appendChild(CM.Disp.TooltipCreateHeader("Bonus Income"));let income=document.createElement("div");income.style.marginBottom="4px";income.style.color="white";income.id="CMTooltipIncome";tooltip.appendChild(income);tooltip.appendChild(CM.Disp.TooltipCreateHeader("Bonus Cookies per Click"));tooltip.lastChild.style.display="none";var click=document.createElement("div");click.style.marginBottom="4px";click.style.color="white";click.style.display="none";click.id="CMTooltipCookiePerClick";tooltip.appendChild(click);tooltip.appendChild(CM.Disp.TooltipCreateHeader("Payback Period"));var pp=document.createElement("div");pp.style.marginBottom="4px";pp.id="CMTooltipPP";tooltip.appendChild(pp);tooltip.appendChild(CM.Disp.TooltipCreateHeader("Time Left"));var time=document.createElement("div");time.id="CMTooltipTime";tooltip.appendChild(time);if(CM.Disp.tooltipType==="b"){tooltip.appendChild(CM.Disp.TooltipCreateHeader("Production left till next achievement"));tooltip.lastChild.id="CMTooltipProductionHeader";var production=document.createElement("div");production.id="CMTooltipProduction";tooltip.appendChild(production)}};CM.Disp.TooltipCreateWarningSection=function(){CM.Disp.TooltipWarn=document.createElement("div");CM.Disp.TooltipWarn.style.position="absolute";CM.Disp.TooltipWarn.style.display="block";CM.Disp.TooltipWarn.style.left="auto";CM.Disp.TooltipWarn.style.bottom="auto";CM.Disp.TooltipWarn.id="CMDispTooltipWarningParent";var create=function(boxId,color,labelTextFront,labelTextBack,deficitId){var box=document.createElement("div");box.id=boxId;box.style.display="none";box.style.transition="opacity 0.1s ease-out";box.className=CM.Disp.colorBorderPre+color;box.style.padding="2px";box.style.background="#000 url(img/darkNoise.png)";var labelDiv=document.createElement("div");box.appendChild(labelDiv);var labelSpan=document.createElement("span");labelSpan.className=CM.Disp.colorTextPre+color;labelSpan.style.fontWeight="bold";labelSpan.textContent=labelTextFront;labelDiv.appendChild(labelSpan);labelDiv.appendChild(document.createTextNode(labelTextBack));var deficitDiv=document.createElement("div");box.appendChild(deficitDiv);var deficitSpan=document.createElement("span");deficitSpan.id=deficitId;deficitDiv.appendChild(document.createTextNode("Deficit: "));deficitDiv.appendChild(deficitSpan);return box};CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnLucky",CM.Disp.colorRed,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Lucky!"',"CMDispTooltipWarnLuckyText"));CM.Disp.TooltipWarn.firstChild.style.marginBottom="4px";CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnLuckyFrenzy",CM.Disp.colorYellow,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Lucky!" (Frenzy)',"CMDispTooltipWarnLuckyFrenzyText"));CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px";CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnConjure",CM.Disp.colorPurple,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"',"CMDispTooltipWarnConjureText"));CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px";CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnConjureFrenzy",CM.Disp.colorPurple,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)',"CMDispTooltipWarnConjureFrenzyText"));CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px";CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnEdifice",CM.Disp.colorPurple,"Warning: ",'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"',"CMDispTooltipWarnEdificeText"));return CM.Disp.TooltipWarn};CM.Disp.UpdateTooltip=function(){CM.Sim.CopyData();if(l("tooltipAnchor").style.display!="none"&&l("CMTooltipArea")){l("CMTooltipArea").innerHTML="";let tooltipBox=CM.Disp.TooltipCreateTooltipBox();l("CMTooltipArea").appendChild(tooltipBox);if(CM.Disp.tooltipType==="b"){CM.Disp.UpdateTooltipBuilding()}else if(CM.Disp.tooltipType==="u"){CM.Disp.UpdateTooltipUpgrade()}else if(CM.Disp.tooltipType==="s"){CM.Disp.UpdateTooltipSugarLump()}else if(CM.Disp.tooltipType==="g"){CM.Disp.UpdateTooltipGrimoire()}else if(CM.Disp.tooltipType==="p"){CM.Disp.UpdateTooltipGardenPlots()}else if(CM.Disp.tooltipType==="ha"){CM.Disp.UpdateTooltipHarvestAll()}CM.Disp.UpdateTooltipWarnings()}else if(l("CMTooltipArea")===null){if(l("CMDispTooltipWarningParent")!=null){l("CMDispTooltipWarningParent").remove()}}};CM.Disp.UpdateTooltipBuilding=function(){if(CM.Options.TooltipBuildUpgrade===1&&Game.buyMode===1){let tooltipBox=l("CMTooltipBorder");CM.Disp.TooltipCreateCalculationSection(tooltipBox);let target=`Objects${Game.buyBulk}`;CM.Disp.TooltipPrice=Game.Objects[CM.Disp.tooltipName].bulkPrice;CM.Disp.TooltipBonusIncome=CM.Cache[target][CM.Disp.tooltipName].bonus;if(CM.Options.TooltipBuildUpgrade===1&&Game.buyMode===1){l("CMTooltipIncome").textContent=Beautify(CM.Disp.TooltipBonusIncome,2);let increase=Math.round(CM.Disp.TooltipBonusIncome/Game.cookiesPs*1e4);if(isFinite(increase)&&increase!=0){l("CMTooltipIncome").textContent+=" ("+increase/100+"% of income)"}l("CMTooltipBorder").className=CM.Disp.colorTextPre+CM.Cache[target][CM.Disp.tooltipName].color;l("CMTooltipPP").textContent=Beautify(CM.Cache[target][CM.Disp.tooltipName].pp,2);l("CMTooltipPP").className=CM.Disp.colorTextPre+CM.Cache[target][CM.Disp.tooltipName].color;var timeColor=CM.Disp.GetTimeColor((CM.Disp.TooltipPrice-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS());l("CMTooltipTime").textContent=timeColor.text;if(timeColor.text==="Done!"&&Game.cookiesminigame.plantsById[minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0]-1].matureBase;var plantName=minigame.plantsById[minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0]-1].name;l("CMTooltipBorder").appendChild(CM.Disp.TooltipCreateHeader("Reward (Current / Maximum)"));var reward=document.createElement("div");reward.id="CMTooltipPlantReward";l("CMTooltipBorder").appendChild(reward);if(plantName==="Bakeberry"){l("CMTooltipPlantReward").textContent=(mature?CM.Disp.Beautify(Math.min(Game.cookies*.03,Game.cookiesPs*60*30)):"0")+" / "+CM.Disp.Beautify(Game.cookiesPs*60*30)}else if(plantName==="Chocoroot"||plantName==="White chocoroot"){l("CMTooltipPlantReward").textContent=(mature?CM.Disp.Beautify(Math.min(Game.cookies*.03,Game.cookiesPs*60*3)):"0")+" / "+CM.Disp.Beautify(Game.cookiesPs*60*3)}else if(plantName==="Queenbeet"){l("CMTooltipPlantReward").textContent=(mature?CM.Disp.Beautify(Math.min(Game.cookies*.04,Game.cookiesPs*60*60)):"0")+" / "+CM.Disp.Beautify(Game.cookiesPs*60*60)}else if(plantName==="Duketater"){l("CMTooltipPlantReward").textContent=(mature?CM.Disp.Beautify(Math.min(Game.cookies*.08,Game.cookiesPs*60*120)):"0")+" / "+CM.Disp.Beautify(Game.cookiesPs*60*120)}else l("CMTooltipArea").style.display="none"}else l("CMTooltipArea").style.display="none"};CM.Disp.UpdateTooltipHarvestAll=function(){let minigame=Game.Objects.Farm.minigame;if(CM.Options.TooltipLump){l("CMTooltipBorder").appendChild(CM.Disp.TooltipCreateHeader("Cookies gained from harvesting:"));let totalGain=0;let mortal=0;if(Game.keys[16]&&Game.keys[17])mortal=1;for(let y=0;y<6;y++){for(let x=0;x<6;x++){if(minigame.plot[y][x][0]>=1){let tile=minigame.plot[y][x];let me=minigame.plantsById[tile[0]-1];let plantName=me.name;let count=true;if(mortal&&me.immortal)count=false;if(tile[1]0&&me.selected){showingTooltip=true;if(CM.Disp.TooltipWrinklerBeingShown[i]===0||CM.Disp.TooltipWrinklerBeingShown[i]===undefined){var placeholder=document.createElement("div");var wrinkler=document.createElement("div");wrinkler.style.minWidth="120px";wrinkler.style.marginBottom="4px";let div=document.createElement("div");div.style.textAlign="center";div.id="CMTooltipWrinkler";wrinkler.appendChild(div);placeholder.appendChild(wrinkler);Game.tooltip.draw(this,escape(placeholder.innerHTML));CM.Disp.TooltipWrinkler=i;CM.Disp.TooltipWrinklerBeingShown[i]=1}else break}else{CM.Disp.TooltipWrinklerBeingShown[i]=0}}if(!showingTooltip){Game.tooltip.hide()}}};CM.Disp.UpdateWrinklerTooltip=function(){if(CM.Options.TooltipWrink===1&&l("CMTooltipWrinkler")!=null){var sucked=Game.wrinklers[CM.Disp.TooltipWrinkler].sucked;var toSuck=1.1;if(Game.Has("Sacrilegious corruption"))toSuck*=1.05;if(Game.wrinklers[CM.Disp.TooltipWrinkler].type===1)toSuck*=3;sucked*=toSuck;if(Game.Has("Wrinklerspawn"))sucked*=1.05;if(CM.Sim.Objects.Temple.minigameLoaded){var godLvl=Game.hasGod("scorn");if(godLvl===1)sucked*=1.15;else if(godLvl===2)sucked*=1.1;else if(godLvl===3)sucked*=1.05}l("CMTooltipWrinkler").textContent=Beautify(sucked)}};CM.Disp.AddAuraInfo=function(aura){if(CM.Options.DragonAuraInfo===1){var[bonusCPS,priceOfChange]=CM.Sim.CalculateChangeAura(aura);var timeToRecover=CM.Disp.FormatTime(priceOfChange/(bonusCPS+Game.cookiesPs));var bonusCPSPercentage=CM.Disp.Beautify(bonusCPS/Game.cookiesPs);bonusCPS=CM.Disp.Beautify(bonusCPS);l("dragonAuraInfo").style.minHeight="60px";l("dragonAuraInfo").style.margin="8px";l("dragonAuraInfo").appendChild(document.createElement("div")).className="line";let div=document.createElement("div");div.style.minWidth="200px";div.style.textAlign="center";div.textContent="Picking this aura will change CPS by "+bonusCPS+" ("+bonusCPSPercentage+"% of current CPS).";l("dragonAuraInfo").appendChild(div);let div2=document.createElement("div");div2.style.minWidth="200px";div2.style.textAlign="center";div2.textContent="It will take "+timeToRecover+" to recover the cost.";l("dragonAuraInfo").appendChild(div2)}};CM.Disp.AddDragonLevelUpTooltip=function(){if((l("specialPopup").className.match(/onScreen/)&&l("specialPopup").children[0].style.background.match(/dragon/))!=null){for(let i=0;i${CM.Cache.CostDragonUpgrade}`,"this");Game.tooltip.wobble()};l("specialPopup").children[i].onmouseout=function(){Game.tooltip.shouldHide=1}}}}};CM.Disp.AddMenu=function(){let title=function(){let div=document.createElement("div");div.className="title "+CM.Disp.colorTextPre+CM.Disp.colorBlue;div.textContent="Cookie Monster Goodies";return div};if(Game.onMenu==="prefs"){CM.Disp.AddMenuPref(title)}else if(Game.onMenu==="stats"){if(CM.Options.Stats){CM.Disp.AddMenuStats(title)}}};CM.Disp.RefreshMenu=function(){if(CM.Options.UpStats&&Game.onMenu==="stats"&&(Game.drawT-1)%(Game.fps*5)!=0&&(Game.drawT-1)%Game.fps===0)Game.UpdateMenu()};CM.Disp.AddMenuPref=function(title){var frag=document.createDocumentFragment();frag.appendChild(title());for(let group of Object.keys(CM.Data.ConfigGroups)){let groupObject=CM.Disp.CreatePrefHeader(group,CM.Data.ConfigGroups[group]);frag.appendChild(groupObject);if(CM.Options.Header[group]){if(group==="Notification"){for(let subGroup of Object.keys(CM.Data.ConfigGroupsNotification)){let subGroupObject=CM.Disp.CreatePrefHeader(subGroup,CM.Data.ConfigGroupsNotification[subGroup]);subGroupObject.style.fontSize="15px";subGroupObject.style.opacity="0.5";frag.appendChild(subGroupObject);if(CM.Options.Header[subGroup]){for(var option in CM.Data.Config){if(CM.Data.Config[option].group===subGroup)frag.appendChild(CM.Disp.CreatePrefOption(option))}}}}else{for(let option of Object.keys(CM.Data.Config)){if(CM.Data.Config[option].group===group)frag.appendChild(CM.Disp.CreatePrefOption(option))}}}}var resDef=document.createElement("div");resDef.className="listing";var resDefBut=document.createElement("a");resDefBut.className="option";resDefBut.onclick=function(){CM.Config.RestoreDefault()};resDefBut.textContent="Restore Default";resDef.appendChild(resDefBut);frag.appendChild(resDef);l("menu").childNodes[2].insertBefore(frag,l("menu").childNodes[2].childNodes[l("menu").childNodes[2].childNodes.length-1])};CM.Disp.CreatePrefHeader=function(config,text){let div=document.createElement("div");div.className="title";div.style.opacity="0.7";div.style.fontSize="17px";div.appendChild(document.createTextNode(text+" "));let span=document.createElement("span");span.style.cursor="pointer";span.style.display="inline-block";span.style.height="14px";span.style.width="14px";span.style.borderRadius="7px";span.style.textAlign="center";span.style.backgroundColor="#C0C0C0";span.style.color="black";span.style.fontSize="13px";span.style.verticalAlign="middle";span.textContent=CM.Options.Header[config]?"-":"+";span.onclick=function(){CM.Config.ToggleHeader(config);Game.UpdateMenu()};div.appendChild(span);return div};CM.Disp.CreatePrefOption=function(config){if(CM.Data.Config[config].type==="bool"){let div=document.createElement("div");div.className="listing";let a=document.createElement("a");if(CM.Data.Config[config].toggle&&CM.Options[config]===0){a.className="option off"}else{a.className="option"}a.id=CM.Config.ConfigPrefix+config;a.onclick=function(){CM.Config.ToggleConfig(config)};a.textContent=CM.Data.Config[config].label[CM.Options[config]];div.appendChild(a);let label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}else if(CM.Data.Config[config].type==="vol"){let div=document.createElement("div");div.className="listing";var volume=document.createElement("div");volume.className="sliderBox";let title=document.createElement("div");title.style.float="left";title.innerHTML=CM.Data.Config[config].desc;volume.appendChild(title);var percent=document.createElement("div");percent.id="slider"+config+"right";percent.style.float="right";percent.innerHTML=CM.Options[config]+"%";volume.appendChild(percent);var slider=document.createElement("input");slider.className="slider";slider.id="slider"+config;slider.style.clear="both";slider.type="range";slider.min="0";slider.max="100";slider.step="1";slider.value=CM.Options[config];slider.oninput=function(){CM.Config.ToggleConfigVolume(config)};slider.onchange=function(){CM.Config.ToggleConfigVolume(config)};volume.appendChild(slider);div.appendChild(volume);return div}else if(CM.Data.Config[config].type==="url"){let div=document.createElement("div");div.className="listing";let span=document.createElement("span");span.className="option";span.textContent=CM.Data.Config[config].label+" ";div.appendChild(span);let input=document.createElement("input");input.id=CM.Config.ConfigPrefix+config;input.className="option";input.type="text";input.readOnly=true;input.setAttribute("value",CM.Options[config]);input.style.width="300px";div.appendChild(input);div.appendChild(document.createTextNode(" "));let inputPrompt=document.createElement("input");inputPrompt.id=CM.Config.ConfigPrefix+config+"Prompt";inputPrompt.className="option";inputPrompt.type="text";inputPrompt.setAttribute("value",CM.Options[config]);let a=document.createElement("a");a.className="option";a.onclick=function(){Game.Prompt(inputPrompt.outerHTML,[["Save","CM.Options['"+config+"'] = l(CM.Config.ConfigPrefix + '"+config+"' + 'Prompt').value; CM.Config.SaveConfig(); Game.ClosePrompt(); Game.UpdateMenu();"],"Cancel"])};a.textContent="Edit";div.appendChild(a);let label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}else if(CM.Data.Config[config].type==="color"){let div=document.createElement("div");for(let i=0;ithis.max)console.log("TEST");CM.Options[config]=this.value;CM.Config.SaveConfig();CM.Disp.RefreshScale()};div.appendChild(input);div.appendChild(document.createTextNode(" "));let label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}};CM.Disp.ToggleDetailedTime=function(){if(CM.Options.DetailedTime===1)Game.sayTime=CM.Disp.sayTime;else Game.sayTime=CM.Backup.sayTime};CM.Disp.RefreshScale=function(){BeautifyAll();Game.RefreshStore();Game.RebuildUpgrades();CM.Disp.UpdateBotBar();CM.Disp.UpdateBuildings();CM.Disp.UpdateUpgrades()};CM.Disp.UpdateColors=function(){let str="";for(let i=0;i0){stats.appendChild(CM.Disp.CreateStatsHeader("Wrinklers","Wrink"));if(CM.Options.Header.Wrink){var popAllFrag=document.createDocumentFragment();popAllFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinklersTotal)+" / "+Beautify(CM.Cache.WrinklersNormal)+" "));var popAllA=document.createElement("a");popAllA.textContent="Pop All Normal";popAllA.className="option";popAllA.onclick=function(){CM.Disp.PopAllNormalWrinklers()};popAllFrag.appendChild(popAllA);stats.appendChild(CM.Disp.CreateStatsListing("basic","Rewards of Popping (All/Normal)",popAllFrag));var popFattestFrag=document.createDocumentFragment();popFattestFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinklersFattest[0])+" "));var popFattestA=document.createElement("a");popFattestA.textContent="Pop Single Fattest";popFattestA.className="option";popFattestA.onclick=function(){if(CM.Cache.WrinklersFattest[1])Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp=0};popFattestFrag.appendChild(popFattestA);stats.appendChild(CM.Disp.CreateStatsListing("basic","Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: "+(CM.Cache.WrinklersFattest[1]?CM.Cache.WrinklersFattest[1]:"None")+")",popFattestFrag))}}var specDisp=false;var missingHalloweenCookies=[];for(let i of Object.keys(CM.Data.HalloCookies)){if(!Game.Has(CM.Data.HalloCookies[i])){missingHalloweenCookies.push(CM.Data.HalloCookies[i]);specDisp=true}}var missingChristmasCookies=[];for(let i of Object.keys(CM.Data.ChristCookies)){if(!Game.Has(CM.Data.ChristCookies[i])){missingChristmasCookies.push(CM.Data.ChristCookies[i]);specDisp=true}}var missingValentineCookies=[];for(let i of Object.keys(CM.Data.ValCookies)){if(!Game.Has(CM.Data.ValCookies[i])){missingValentineCookies.push(CM.Data.ValCookies[i]);specDisp=true}}var missingNormalEggs=[];for(let i of Object.keys(Game.eggDrops)){if(!Game.HasUnlocked(Game.eggDrops[i])){missingNormalEggs.push(Game.eggDrops[i]);specDisp=true}}var missingRareEggs=[];for(let i of Object.keys(Game.rareEggDrops)){if(!Game.HasUnlocked(Game.rareEggDrops[i])){missingRareEggs.push(Game.rareEggDrops[i]);specDisp=true}}var missingPlantDrops=[];for(let i of Object.keys(CM.Data.PlantDrops)){if(!Game.HasUnlocked(CM.Data.PlantDrops[i])){missingPlantDrops.push(CM.Data.PlantDrops[i]);specDisp=true}}var choEgg=Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg");var centEgg=Game.Has("Century egg");if(Game.season==="christmas"||specDisp||choEgg||centEgg){stats.appendChild(CM.Disp.CreateStatsHeader("Season Specials","Sea"));if(CM.Options.Header.Sea){if(missingHalloweenCookies.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Halloween Cookies Left to Buy",CM.Disp.CreateStatsMissDisp(missingHalloweenCookies)));if(missingChristmasCookies.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Christmas Cookies Left to Buy",CM.Disp.CreateStatsMissDisp(missingChristmasCookies)));if(missingValentineCookies.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Valentine Cookies Left to Buy",CM.Disp.CreateStatsMissDisp(missingValentineCookies)));if(missingNormalEggs.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Normal Easter Eggs Left to Unlock",CM.Disp.CreateStatsMissDisp(missingNormalEggs)));if(missingRareEggs.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Rare Easter Eggs Left to Unlock",CM.Disp.CreateStatsMissDisp(missingRareEggs)));if(missingPlantDrops.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Rare Plant Drops Left to Unlock",CM.Disp.CreateStatsMissDisp(missingPlantDrops)));if(Game.season==="christmas")stats.appendChild(CM.Disp.CreateStatsListing("basic","Reindeer Reward",document.createTextNode(Beautify(CM.Cache.SeaSpec))));if(choEgg){stats.appendChild(CM.Disp.CreateStatsListing("withTooltip","Chocolate Egg Cookies",document.createTextNode(Beautify(CM.Cache.lastChoEgg)),"ChoEggTooltipPlaceholder"))}if(centEgg){stats.appendChild(CM.Disp.CreateStatsListing("basic","Century Egg Multiplier",document.createTextNode(Math.round((CM.Cache.CentEgg-1)*1e4)/100+"%")))}}}stats.appendChild(CM.Disp.CreateStatsHeader("Miscellaneous","Misc"));if(CM.Options.Header.Misc){stats.appendChild(CM.Disp.CreateStatsListing("basic","Average Cookies Per Second (Past "+(CM.Disp.cookieTimes[CM.Options.AvgCPSHist]<60?CM.Disp.cookieTimes[CM.Options.AvgCPSHist]+" seconds":CM.Disp.cookieTimes[CM.Options.AvgCPSHist]/60+(CM.Options.AvgCPSHist===3?" minute":" minutes"))+")",document.createTextNode(Beautify(CM.Cache.AvgCPS,3))));stats.appendChild(CM.Disp.CreateStatsListing("basic","Average Cookie Clicks Per Second (Past "+CM.Disp.clickTimes[CM.Options.AvgClicksHist]+(CM.Options.AvgClicksHist===0?" second":" seconds")+")",document.createTextNode(Beautify(CM.Cache.AverageClicks,1))));if(Game.Has("Fortune cookies")){var fortunes=[];for(let i of Object.keys(CM.Data.Fortunes)){if(!Game.Has(CM.Data.Fortunes[i])){fortunes.push(CM.Data.Fortunes[i])}}if(fortunes.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Fortune Upgrades Left to Buy",CM.Disp.CreateStatsMissDisp(fortunes)))}stats.appendChild(CM.Disp.CreateStatsListing("basic","Missed Golden Cookies",document.createTextNode(Beautify(Game.missedGoldenClicks))));if(Game.prefs.autosave){var timer=document.createElement("span");timer.id="CMStatsAutosaveTimer";timer.innerText=Game.sayTime(Game.fps*60-(Game.OnAscend?0:Game.T%(Game.fps*60)),4);stats.appendChild(CM.Disp.CreateStatsListing("basic","Time till autosave",timer))}}l("menu").insertBefore(stats,l("menu").childNodes[2]);if(CM.Options.MissingUpgrades){CM.Disp.AddMissingUpgrades()}};CM.Disp.CreateStatsHeader=function(text,config){let div=document.createElement("div");div.className="listing";div.style.padding="5px 16px";div.style.opacity="0.7";div.style.fontSize="17px";div.style.fontFamily='"Kavoon", Georgia, serif';div.appendChild(document.createTextNode(text+" "));let span=document.createElement("span");span.style.cursor="pointer";span.style.display="inline-block";span.style.height="14px";span.style.width="14px";span.style.borderRadius="7px";span.style.textAlign="center";span.style.backgroundColor="#C0C0C0";span.style.color="black";span.style.fontSize="13px";span.style.verticalAlign="middle";span.textContent=CM.Options.Header[config]?"-":"+";span.onclick=function(){CM.Config.ToggleHeader(config);Game.UpdateMenu()};div.appendChild(span);return div};CM.Disp.CreateStatsListing=function(type,name,text,placeholder){let div=document.createElement("div");div.className="listing";var listingName=document.createElement("b");listingName.textContent=name;div.appendChild(listingName);if(type==="withTooltip"){div.className="listing";var tooltip=document.createElement("span");tooltip.onmouseout=function(){Game.tooltip.hide()};tooltip.onmouseover=function(){Game.tooltip.draw(this,escape(CM.Disp[placeholder].innerHTML))};tooltip.style.cursor="default";tooltip.style.display="inline-block";tooltip.style.height="10px";tooltip.style.width="10px";tooltip.style.borderRadius="5px";tooltip.style.textAlign="center";tooltip.style.backgroundColor="#C0C0C0";tooltip.style.color="black";tooltip.style.fontSize="9px";tooltip.style.verticalAlign="bottom";tooltip.textContent="?";div.appendChild(tooltip);div.appendChild(document.createTextNode(" "))}div.appendChild(document.createTextNode(": "));div.appendChild(text);return div};CM.Disp.CreateStatsMissDisp=function(theMissDisp){var frag=document.createDocumentFragment();frag.appendChild(document.createTextNode(theMissDisp.length+" "));let span=document.createElement("span");span.onmouseout=function(){Game.tooltip.hide()};var placeholder=document.createElement("div");var missing=document.createElement("div");missing.style.minWidth="140px";missing.style.marginBottom="4px";let title=document.createElement("div");title.className="name";title.style.marginBottom="4px";title.style.textAlign="center";title.textContent="Missing";missing.appendChild(title);for(let i of Object.keys(theMissDisp)){let div=document.createElement("div");div.style.textAlign="center";div.appendChild(document.createTextNode(theMissDisp[i]));missing.appendChild(div)}placeholder.appendChild(missing);span.onmouseover=function(){Game.tooltip.draw(this,escape(placeholder.innerHTML))};span.style.cursor="default";span.style.display="inline-block";span.style.height="10px";span.style.width="10px";span.style.borderRadius="5px";span.style.textAlign="center";span.style.backgroundColor="#C0C0C0";span.style.color="black";span.style.fontSize="9px";span.style.verticalAlign="bottom";span.textContent="?";frag.appendChild(span);return frag};CM.Disp.CreateStatsLuckySection=function(){var goldCookTooltip=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder";var section=document.createElement("div");section.className="CMStatsLuckySection";var luckyColor=Game.cookies+CM.Disp.GetWrinkConfigBank()Missing Prestige upgrades: "+prestigeUpgradesMissing+"/"+Game.PrestigeUpgrades.length+" ("+Math.floor(prestigeUpgradesMissing/Game.PrestigeUpgrades.length*100)+"%)";title.appendChild(titlefrag);menuSection.appendChild(title);let upgrades=document.createElement("div");upgrades.className="listing crateBox";upgrades.innerHTML=CM.Cache.MissingUpgradesPrestige;menuSection.appendChild(upgrades)}else if(menuSection.children[0].innerHTML==="Upgrades"){if(CM.Cache.MissingUpgrades){let normalUpgradesMissing=CM.Cache.MissingUpgrades.match(new RegExp("div","g")||[]).length/2;let title=document.createElement("div");title.id="CMMissingUpgradesTitle";title.className="listing";let titlefrag=document.createElement("div");titlefrag.innerHTML="Missing normal upgrades: "+normalUpgradesMissing+"/"+(Game.UpgradesByPool[""].length+Game.UpgradesByPool.tech.length)+" ("+Math.floor(normalUpgradesMissing/(Game.UpgradesByPool[""].length+Game.UpgradesByPool.tech.length)*100)+"%)";title.appendChild(titlefrag);menuSection.insertBefore(title,menuSection.childNodes[3]);let upgrades=document.createElement("div");upgrades.className="listing crateBox";upgrades.innerHTML=CM.Cache.MissingUpgrades;menuSection.insertBefore(upgrades,document.getElementById("CMMissingUpgradesTitle").nextSibling)}if(CM.Cache.MissingUpgradesCookies){let cookieUpgradesMissing=CM.Cache.MissingUpgradesCookies.match(new RegExp("div","g")||[]).length/2;let title=document.createElement("div");title.id="CMMissingUpgradesCookiesTitle";title.className="listing";let titlefrag=document.createElement("div");titlefrag.innerHTML="Missing Cookie upgrades: "+cookieUpgradesMissing+"/"+Game.UpgradesByPool.cookie.length+" ("+Math.floor(cookieUpgradesMissing/Game.UpgradesByPool.cookie.length*100)+"%)";title.appendChild(titlefrag);menuSection.appendChild(title);let upgrades=document.createElement("div");upgrades.className="listing crateBox";upgrades.innerHTML=CM.Cache.MissingUpgradesCookies;menuSection.appendChild(upgrades)}}}}};CM.Disp.crateMissing=function(me){var classes="crate upgrade missing";if(me.pool==="prestige")classes+=" heavenly";var noFrame=0;if(!Game.prefs.crates)noFrame=1;if(noFrame)classes+=" noFrame";let icon=me.icon;if(me.iconFunction)icon=me.iconFunction();let tooltip=`function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;return`
\n\t
`};CM.Disp.CreateWrinklerButtons=function(){var popAllA=document.createElement("a");popAllA.id="PopAllNormalWrinklerButton";popAllA.textContent="Pop All Normal";popAllA.className="option";popAllA.onclick=function(){CM.Disp.PopAllNormalWrinklers()};l("sectionLeftExtra").children[0].append(popAllA);var popFattestA=document.createElement("a");popFattestA.id="PopFattestWrinklerButton";popFattestA.textContent="Pop Single Fattest";popFattestA.className="option";popFattestA.onclick=function(){if(CM.Cache.WrinklersFattest[1])Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp=0};l("sectionLeftExtra").children[0].append(popFattestA)};CM.Disp.UpdateWrinklerButtons=function(){if(CM.Options.WrinklerButtons){l("PopAllNormalWrinklerButton").style.display="";l("PopFattestWrinklerButton").style.display=""}else{l("PopAllNormalWrinklerButton").style.display="none";l("PopFattestWrinklerButton").style.display="none"}};CM.Disp.TooltipText=[["GoldCookTooltipPlaceholder","Calculated with Golden Switch off","200px"],["GoldCookDragonsFortuneTooltipPlaceholder","Calculated with Golden Switch off and at least one golden cookie on-screen","240px"],["PrestMaxTooltipPlaceholder","The MAX prestige is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg","320px"],["NextPrestTooltipPlaceholder","Calculated with cookies gained from wrinklers and Chocolate egg","200px"],["HeavenChipMaxTooltipPlaceholder","The MAX heavenly chips is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg","330px"],["ResetTooltipPlaceholder","The bonus income you would get from new prestige levels unlocked at 100% of its potential and from ascension achievements if you have the same buildings/upgrades after reset","370px"],["ChoEggTooltipPlaceholder","The amount of cookies you would get from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and then buying Chocolate egg","300px"]];CM.Disp.colorTextPre="CMText";CM.Disp.colorBackPre="CMBack";CM.Disp.colorBorderPre="CMBorder";CM.Disp.colorBlue="Blue";CM.Disp.colorGreen="Green";CM.Disp.colorYellow="Yellow";CM.Disp.colorOrange="Orange";CM.Disp.colorRed="Red";CM.Disp.colorPurple="Purple";CM.Disp.colorGray="Gray";CM.Disp.colorPink="Pink";CM.Disp.colorBrown="Brown";CM.Disp.colors=[CM.Disp.colorBlue,CM.Disp.colorGreen,CM.Disp.colorYellow,CM.Disp.colorOrange,CM.Disp.colorRed,CM.Disp.colorPurple,CM.Disp.colorGray,CM.Disp.colorPink,CM.Disp.colorBrown];CM.Disp.buffColors={Frenzy:CM.Disp.colorYellow,"Dragon Harvest":CM.Disp.colorBrown,"Elder frenzy":CM.Disp.colorGreen,Clot:CM.Disp.colorRed,"Click frenzy":CM.Disp.colorBlue,Dragonflight:CM.Disp.colorPink};CM.Disp.GCTimers={};CM.Disp.cookieTimes=[10,15,30,60,300,600,900,1800];CM.Disp.clickTimes=[1,5,10,15,30];CM.Disp.TooltipWrinklerBeingShown=[];CM.Disp.Title="";CM.Disp.TooltipWrinklerArea=0;CM.Disp.TooltipWrinkler=-1;CM.Main.Loop=function(){if(CM.Disp.lastAscendState!=Game.OnAscend){CM.Disp.lastAscendState=Game.OnAscend;CM.Disp.UpdateAscendState()}if(!Game.OnAscend&&Game.AscendTimer===0){if(CM.Sim.DoSims){CM.Cache.CacheIncome();CM.Cache.NoGoldSwitchCPS();CM.Cache.CacheGoldenAndWrathCookiesMults();CM.Cache.CacheStats();CM.Cache.CacheMissingUpgrades();CM.Cache.CacheChain();CM.Cache.CacheDragonCost();CM.Cache.CacheSeaSpec();CM.Cache.CacheSellForChoEgg();CM.Sim.DoSims=0}var hasBuildAura=Game.auraMult("Fierce Hoarder")>0;if(!CM.Cache.HadBuildAura&&hasBuildAura){CM.Cache.HadBuildAura=true;CM.Cache.DoRemakeBuildPrices=1}else if(CM.Cache.HadBuildAura&&!hasBuildAura){CM.Cache.HadBuildAura=false;CM.Cache.DoRemakeBuildPrices=1}if(CM.Cache.DoRemakeBuildPrices){CM.Cache.CacheBuildingsPrices();CM.Cache.DoRemakeBuildPrices=0}CM.Cache.CacheWrinklers();CM.Cache.CachePP()}CM.Main.CheckGoldenCookie();CM.Main.CheckTickerFortune();CM.Main.CheckSeasonPopup();CM.Main.CheckGardenTick();CM.Main.CheckMagicMeter();CM.Main.CheckWrinklerCount();CM.Cache.CacheCurrWrinklerCPS();CM.Cache.CacheAvgCPS()};CM.Main.DelayInit=function(){CM.Sim.InitData();CM.Cache.InitCache();CM.Disp.CreateCssArea();CM.Disp.CreateBotBar();CM.Disp.CreateTimerBar();CM.Disp.CreateUpgradeBar();CM.Disp.CreateWhiteScreen();CM.Disp.CreateFavicon();for(let i of Object.keys(CM.Disp.TooltipText)){CM.Disp.CreateSimpleTooltip(CM.Disp.TooltipText[i][0],CM.Disp.TooltipText[i][1],CM.Disp.TooltipText[i][2])}CM.Disp.CreateWrinklerButtons();CM.Main.ReplaceTooltips();CM.Main.AddWrinklerAreaDetect();CM.Main.ReplaceNative();CM.Main.ReplaceNativeGrimoire();Game.CalculateGains();CM.Config.LoadConfig();CM.Disp.lastAscendState=Game.OnAscend;if(Game.prefs.popups)Game.Popup("Cookie Monster version "+CM.VersionMajor+"."+CM.VersionMinor+" loaded!");else Game.Notify("Cookie Monster version "+CM.VersionMajor+"."+CM.VersionMinor+" loaded!","","",1,1);l("products").style.display="grid";l("storeBulk").style.gridRow="1/1";l("upgrades").style.display="flex";l("upgrades").style["flex-wrap"]="wrap";Game.Win("Third-party")};CM.Main.ReplaceNative=function(){CM.Backup.Beautify=Beautify;Beautify=CM.Disp.Beautify;CM.Backup.CalculateGains=Game.CalculateGains;eval("CM.Backup.CalculateGainsMod = "+Game.CalculateGains.toString().split("ages');").join("ages');CM.Sim.DateAges = Date.now();").split("if (Game.Has('Century").join("CM.Sim.DateCentury = Date.now();if (Game.Has('Century"));Game.CalculateGains=function(){CM.Backup.CalculateGainsMod();CM.Sim.DoSims=1};CM.Backup.tooltip={};CM.Backup.tooltip.draw=Game.tooltip.draw;eval("CM.Backup.tooltip.drawMod = "+Game.tooltip.draw.toString().split("this").join("Game.tooltip"));Game.tooltip.draw=function(from,text,origin){CM.Backup.tooltip.drawMod(from,text,origin)};CM.Backup.tooltip.update=Game.tooltip.update;eval("CM.Backup.tooltip.updateMod = "+Game.tooltip.update.toString().split("this.").join("Game.tooltip."));Game.tooltip.update=function(){CM.Backup.tooltip.updateMod();CM.Disp.UpdateTooltipLocation()};CM.Backup.UpdateWrinklers=Game.UpdateWrinklers;Game.UpdateWrinklers=function(){CM.Main.FixMouseY(CM.Backup.UpdateWrinklers)};CM.Backup.UpdateSpecial=Game.UpdateSpecial;Game.UpdateSpecial=function(){CM.Main.FixMouseY(CM.Backup.UpdateSpecial)};l("bigCookie").removeEventListener("click",Game.ClickCookie,false);l("bigCookie").addEventListener("click",(function(){CM.Main.FixMouseY(Game.ClickCookie)}),false);CM.Backup.RebuildUpgrades=Game.RebuildUpgrades;Game.RebuildUpgrades=function(){CM.Backup.RebuildUpgrades();CM.Disp.ReplaceTooltipUpgrade();Game.CalculateGains()};CM.Backup.ClickProduct=Game.ClickProduct;Game.ClickProduct=function(what){if(!CM.Options.BulkBuyBlock||Game.ObjectsById[what].bulkPrice{var coords=child.id.slice(-3);child.onmouseover=function(){Game.tooltip.dynamic=1;Game.tooltip.draw(this,(function(){return CM.Disp.Tooltip("p",[`${coords[0]}`,`${coords[2]}`])}),"this");Game.tooltip.wobble()}}))}};CM.Main.FindShimmer=function(){CM.Main.currSpawnedGoldenCookieState=0;CM.Cache.goldenShimmersByID={};for(let i of Object.keys(Game.shimmers)){CM.Cache.goldenShimmersByID[Game.shimmers[i].id]=Game.shimmers[i];if(Game.shimmers[i].spawnLead&&Game.shimmers[i].type==="golden"){CM.Cache.spawnedGoldenShimmer=Game.shimmers[i];CM.Main.currSpawnedGoldenCookieState+=1}}};CM.Main.CheckGoldenCookie=function(){CM.Main.FindShimmer();for(let i of Object.keys(CM.Disp.GCTimers)){if(typeof CM.Cache.goldenShimmersByID[i]==="undefined"){CM.Disp.GCTimers[i].parentNode.removeChild(CM.Disp.GCTimers[i]);delete CM.Disp.GCTimers[i]}}if(CM.Main.lastGoldenCookieState!=Game.shimmerTypes.golden.n){CM.Main.lastGoldenCookieState=Game.shimmerTypes.golden.n;if(CM.Main.lastGoldenCookieState){if(CM.Main.lastSpawnedGoldenCookieState0){var CurrentWrinklers=0;for(let i in Game.wrinklers){if(Game.wrinklers[i].phase===2)CurrentWrinklers++}if(CurrentWrinklers>CM.Main.lastWrinklerCount){CM.Main.lastWrinklerCount=CurrentWrinklers;if(CurrentWrinklers===Game.getWrinklersMax()&&CM.Options.WrinklerMaxFlash){CM.Disp.Flash(3,"WrinklerMaxFlash")}else{CM.Disp.Flash(3,"WrinklerFlash")}if(CurrentWrinklers===Game.getWrinklersMax()&&CM.Options.WrinklerMaxSound){CM.Disp.PlaySound(CM.Options.WrinklerMaxSoundURL,"WrinklerMaxSound","WrinklerMaxVolume")}else{CM.Disp.PlaySound(CM.Options.WrinklerSoundURL,"WrinklerSound","WrinklerVolume")}if(CurrentWrinklers===Game.getWrinklersMax()&&CM.Options.WrinklerMaxNotification){CM.Disp.Notification("WrinklerMaxNotification","Maximum Wrinklers Reached","You have reached your maximum ammount of wrinklers")}else{CM.Disp.Notification("WrinklerNotification","A Wrinkler appeared","A new wrinkler has appeared")}}else{CM.Main.lastWrinklerCount=CurrentWrinklers}}};CM.Main.AddWrinklerAreaDetect=function(){l("backgroundLeftCanvas").onmouseover=function(){CM.Disp.TooltipWrinklerArea=1};l("backgroundLeftCanvas").onmouseout=function(){CM.Disp.TooltipWrinklerArea=0;Game.tooltip.hide();for(let i of Object.keys(Game.wrinklers)){CM.Disp.TooltipWrinklerBeingShown[i]=0}}};CM.Main.FixMouseY=function(target){if(CM.Options.TimerBar===1&&CM.Options.TimerBarPos===0){var timerBarHeight=parseInt(CM.Disp.TimerBar.style.height);Game.mouseY-=timerBarHeight;target();Game.mouseY+=timerBarHeight}else{target()}};CM.Sim.BuildingGetPrice=function(build,basePrice,start,free,increase){var moni=0;for(let i=0;i0){moni+=price;start--}}return moni};CM.Sim.Has=function(what){let it=CM.Sim.Upgrades[what];if(Game.ascensionMode===1&&(it.pool==="prestige"||it.tier==="fortune"))return 0;return it?it.bought:0};CM.Sim.Win=function(what){if(CM.Sim.Achievements[what]){if(CM.Sim.Achievements[what].won===0){CM.Sim.Achievements[what].won=1;if(Game.Achievements[what].pool!="shadow")CM.Sim.AchievementsOwned++}}};CM.Sim.HasAchiev=function(what){return CM.Sim.Achievements[what]?CM.Sim.Achievements[what].won:0};CM.Sim.GetHeavenlyMultiplier=function(){let heavenlyMult=0;if(CM.Sim.Has("Heavenly chip secret"))heavenlyMult+=.05;if(CM.Sim.Has("Heavenly cookie stand"))heavenlyMult+=.2;if(CM.Sim.Has("Heavenly bakery"))heavenlyMult+=.25;if(CM.Sim.Has("Heavenly confectionery"))heavenlyMult+=.25;if(CM.Sim.Has("Heavenly key"))heavenlyMult+=.25;heavenlyMult*=1+CM.Sim.auraMult("Dragon God")*.05;if(CM.Sim.Has("Lucky digit"))heavenlyMult*=1.01;if(CM.Sim.Has("Lucky number"))heavenlyMult*=1.01;if(CM.Sim.Has("Lucky payout"))heavenlyMult*=1.01;if(CM.Sim.hasGod){let godLvl=CM.Sim.hasGod("creation");if(godLvl===1)heavenlyMult*=.7;else if(godLvl===2)heavenlyMult*=.8;else if(godLvl===3)heavenlyMult*=.9}return heavenlyMult};CM.Sim.hasAura=function(what){if(Game.dragonAuras[CM.Sim.dragonAura].name===what||Game.dragonAuras[CM.Sim.dragonAura2].name===what)return true;else return false};CM.Sim.auraMult=function(what){var n=0;if(Game.dragonAuras[CM.Sim.dragonAura].name===what||Game.dragonAuras[CM.Sim.dragonAura2].name===what)n=1;if(Game.dragonAuras[CM.Sim.dragonAura].name==="Reality Bending"||Game.dragonAuras[CM.Sim.dragonAura2].name==="Reality Bending")n+=.1;return n};CM.Sim.hasGod=function(what){if(!CM.Sim.Objects.Temple.minigameLoaded){return false}var possibleGods=CM.Sim.Objects.Temple.minigame.gods;var god=possibleGods[what];for(let i=0;i<3;i++){if(CM.Sim.Objects.Temple.minigame.slot[i]==god.id)return i+1}return false};CM.Sim.eff=function(name){if(typeof CM.Sim.effs[name]==="undefined"){CM.Sim.effs[name]=1;return CM.Sim.effs[name]}else{return CM.Sim.effs[name]}};CM.Sim.GetTieredCpsMult=function(me){let mult=1;for(let i in Game.Objects[me.name].tieredUpgrades){if(!Game.Tiers[Game.Objects[me.name].tieredUpgrades[i].tier].special&&CM.Sim.Has(Game.Objects[me.name].tieredUpgrades[i].name))mult*=2}for(let j in Game.Objects[me.name].synergies){let syn=Game.Objects[me.name].synergies[j];if(CM.Sim.Has(syn.name)){if(syn.buildingTie1.name==me.name)mult*=1+.05*CM.Sim.Objects[syn.buildingTie2.name].amount;else if(syn.buildingTie2.name==me.name)mult*=1+.001*CM.Sim.Objects[syn.buildingTie1.name].amount}}if(Game.Objects[me.name].fortune&&CM.Sim.Has(Game.Objects[me.name].fortune.name))mult*=1.07;if(Game.Objects[me.name].grandma&&CM.Sim.Has(Game.Objects[me.name].grandma.name))mult*=1+CM.Sim.Objects["Grandma"].amount*.01*(1/(Game.Objects[me.name].id-1));return mult};CM.Sim.InitialBuildingData=function(buildingName){let me=Game.Objects[buildingName];let you={};eval("you.cps = "+me.cps.toString().split("Game.Has").join("CM.Sim.Has").split("Game.hasAura").join("CM.Sim.hasAura").split("Game.Objects").join("CM.Sim.Objects").split("Game.GetTieredCpsMult").join("CM.Sim.GetTieredCpsMult").split("Game.auraMult").join("CM.Sim.auraMult").split("Game.eff").join("CM.Sim.eff"));you.baseCps=me.baseCps;you.name=me.name;return you};CM.Sim.InitUpgrade=function(upgradeName){let me=Game.Upgrades[upgradeName];let you={};you.power=me.power;if(typeof me.power==="function"){eval("me.power = "+me.power.toString().split("Game.Has").join("CM.Sim.Has").split("Game.hasGod").join("CM.Sim.hasGod"))}you.pool=me.pool;you.name=me.name;return you};CM.Sim.InitAchievement=function(achievementName){let me=Game.Achievements[achievementName];let you={};you.name=me.name;return you};CM.Sim.InitData=function(){CM.Sim.Objects=[];for(let i of Object.keys(Game.Objects)){CM.Sim.Objects[i]=CM.Sim.InitialBuildingData(i)}CM.Sim.Upgrades=[];for(let i of Object.keys(Game.Upgrades)){CM.Sim.Upgrades[i]=CM.Sim.InitUpgrade(i)}CM.Sim.Achievements=[];for(let i of Object.keys(Game.Achievements)){CM.Sim.Achievements[i]=CM.Sim.InitAchievement(i)}CM.Sim.CopyData()};CM.Sim.CopyData=function(){CM.Sim.UpgradesOwned=Game.UpgradesOwned;CM.Sim.pledges=Game.pledges;CM.Sim.AchievementsOwned=Game.AchievementsOwned;CM.Sim.heavenlyPower=Game.heavenlyPower;CM.Sim.prestige=Game.prestige;for(let i of Object.keys(Game.Objects)){let me=Game.Objects[i];let you=CM.Sim.Objects[i];if(you===undefined){you=CM.Sim.Objects[i]=CM.Sim.InitialBuildingData(i);CM.Disp.CreateBotBarBuildingColumn(i)}you.amount=me.amount;you.level=me.level;you.totalCookies=me.totalCookies;you.basePrice=me.basePrice;you.free=me.free;if(me.minigameLoaded)you.minigameLoaded=me.minigameLoaded;you.minigame=me.minigame}for(let i of Object.keys(Game.Upgrades)){let me=Game.Upgrades[i];let you=CM.Sim.Upgrades[i];if(you===undefined){you=CM.Sim.Upgrades[i]=CM.Sim.InitUpgrade(i)}you.bought=me.bought}for(let i of Object.keys(Game.Achievements)){let me=Game.Achievements[i];let you=CM.Sim.Achievements[i];if(you===undefined){you=CM.Sim.Achievements[i]=CM.Sim.InitAchievement(i)}you.won=me.won}CM.Cache.CacheDragonAuras();CM.Sim.dragonAura=CM.Cache.dragonAura;CM.Sim.dragonAura2=CM.Cache.dragonAura2};CM.Sim.CalculateGains=function(){CM.Sim.cookiesPs=0;let mult=1;let effs={};for(let i of Object.keys(Game.Objects)){if(Game.Objects[i].minigameLoaded&&Game.Objects[i].minigame.effs){let myEffs=Game.Objects[i].minigame.effs;for(let ii in myEffs){if(effs[ii])effs[ii]*=myEffs[ii];else effs[ii]=myEffs[ii]}}}CM.Sim.effs=effs;if(Game.ascensionMode!=1)mult+=parseFloat(CM.Sim.prestige)*.01*CM.Sim.heavenlyPower*CM.Sim.GetHeavenlyMultiplier();mult*=CM.Sim.eff("cps");if(CM.Sim.Has("Heralds")&&Game.ascensionMode!=1)mult*=1+.01*Game.heralds;for(let i of Object.keys(Game.cookieUpgrades)){let me=Game.cookieUpgrades[i];if(CM.Sim.Has(me.name)){if(typeof me.power==="function"){mult*=1+CM.Sim.Upgrades[me.name].power(CM.Sim.Upgrades[me.name])*.01}else mult*=1+me.power*.01}}if(CM.Sim.Has("Specialized chocolate chips"))mult*=1.01;if(CM.Sim.Has("Designer cocoa beans"))mult*=1.02;if(CM.Sim.Has("Underworld ovens"))mult*=1.03;if(CM.Sim.Has("Exotic nuts"))mult*=1.04;if(CM.Sim.Has("Arcane sugar"))mult*=1.05;if(CM.Sim.Has("Increased merriness"))mult*=1.15;if(CM.Sim.Has("Improved jolliness"))mult*=1.15;if(CM.Sim.Has("A lump of coal"))mult*=1.01;if(CM.Sim.Has("An itchy sweater"))mult*=1.01;if(CM.Sim.Has("Santa's dominion"))mult*=1.2;if(CM.Sim.Has("Fortune #100"))mult*=1.01;if(CM.Sim.Has("Fortune #101"))mult*=1.07;if(CM.Sim.Has("Dragon scale"))mult*=1.03;let buildMult=1;if(CM.Sim.hasGod){let godLvl=CM.Sim.hasGod("asceticism");if(godLvl===1)mult*=1.15;else if(godLvl===2)mult*=1.1;else if(godLvl===3)mult*=1.05;godLvl=CM.Sim.hasGod("ages");if(godLvl===1)mult*=1+.15*Math.sin(CM.Sim.DateAges/1e3/(60*60*3)*Math.PI*2);else if(godLvl===2)mult*=1+.15*Math.sin(CM.Sim.DateAges/1e3/(60*60*12)*Math.PI*2);else if(godLvl===3)mult*=1+.15*Math.sin(CM.Sim.DateAges/1e3/(60*60*24)*Math.PI*2);godLvl=CM.Sim.hasGod("decadence");if(godLvl===1)buildMult*=.93;else if(godLvl===2)buildMult*=.95;else if(godLvl===3)buildMult*=.98;godLvl=CM.Sim.hasGod("industry");if(godLvl===1)buildMult*=1.1;else if(godLvl===2)buildMult*=1.06;else if(godLvl===3)buildMult*=1.03;godLvl=CM.Sim.hasGod("labor");if(godLvl===1)buildMult*=.97;else if(godLvl===2)buildMult*=.98;else if(godLvl===3)buildMult*=.99}if(CM.Sim.Has("Santa's legacy"))mult*=1+(Game.santaLevel+1)*.03;let milkProgress=CM.Sim.AchievementsOwned/25;let milkMult=1;if(CM.Sim.Has("Santa's milk and cookies"))milkMult*=1.05;milkMult*=1+CM.Sim.auraMult("Breath of Milk")*.05;if(CM.Sim.hasGod){let godLvl=CM.Sim.hasGod("mother");if(godLvl===1)milkMult*=1.1;else if(godLvl===2)milkMult*=1.05;else if(godLvl===3)milkMult*=1.03}milkMult*=CM.Sim.eff("milk");let catMult=1;if(CM.Sim.Has("Kitten helpers"))catMult*=1+milkProgress*.1*milkMult;if(CM.Sim.Has("Kitten workers"))catMult*=1+milkProgress*.125*milkMult;if(CM.Sim.Has("Kitten engineers"))catMult*=1+milkProgress*.15*milkMult;if(CM.Sim.Has("Kitten overseers"))catMult*=1+milkProgress*.175*milkMult;if(CM.Sim.Has("Kitten managers"))catMult*=1+milkProgress*.2*milkMult;if(CM.Sim.Has("Kitten accountants"))catMult*=1+milkProgress*.2*milkMult;if(CM.Sim.Has("Kitten specialists"))catMult*=1+milkProgress*.2*milkMult;if(CM.Sim.Has("Kitten experts"))catMult*=1+milkProgress*.2*milkMult;if(CM.Sim.Has("Kitten consultants"))catMult*=1+milkProgress*.2*milkMult;if(CM.Sim.Has("Kitten assistants to the regional manager"))catMult*=1+milkProgress*.175*milkMult;if(CM.Sim.Has("Kitten marketeers"))catMult*=1+milkProgress*.15*milkMult;if(CM.Sim.Has("Kitten analysts"))catMult*=1+milkProgress*.125*milkMult;if(CM.Sim.Has("Kitten executives"))catMult*=1+milkProgress*.115*milkMult;if(CM.Sim.Has("Kitten angels"))catMult*=1+milkProgress*.1*milkMult;if(CM.Sim.Has("Fortune #103"))catMult*=1+milkProgress*.05*milkMult;for(let i of Object.keys(CM.Sim.Objects)){let me=CM.Sim.Objects[i];let storedCps=me.cps(me);if(Game.ascensionMode!=1)storedCps*=(1+me.level*.01)*buildMult;if(me.name==="Grandma"&&CM.Sim.Has("Milkhelp® lactose intolerance relief tablets"))storedCps*=1+.05*milkProgress*milkMult;CM.Sim.cookiesPs+=me.amount*storedCps}if(CM.Sim.Has('"egg"'))CM.Sim.cookiesPs+=9;mult*=catMult;let eggMult=1;if(CM.Sim.Has("Chicken egg"))eggMult*=1.01;if(CM.Sim.Has("Duck egg"))eggMult*=1.01;if(CM.Sim.Has("Turkey egg"))eggMult*=1.01;if(CM.Sim.Has("Quail egg"))eggMult*=1.01;if(CM.Sim.Has("Robin egg"))eggMult*=1.01;if(CM.Sim.Has("Ostrich egg"))eggMult*=1.01;if(CM.Sim.Has("Cassowary egg"))eggMult*=1.01;if(CM.Sim.Has("Salmon roe"))eggMult*=1.01;if(CM.Sim.Has("Frogspawn"))eggMult*=1.01;if(CM.Sim.Has("Shark egg"))eggMult*=1.01;if(CM.Sim.Has("Turtle egg"))eggMult*=1.01;if(CM.Sim.Has("Ant larva"))eggMult*=1.01;if(CM.Sim.Has("Century egg")){var day=Math.floor((CM.Sim.DateCentury-Game.startDate)/1e3/10)*10/60/60/24;day=Math.min(day,100);CM.Cache.CentEgg=1+(1-Math.pow(1-day/100,3))*.1;eggMult*=CM.Cache.CentEgg}mult*=eggMult;if(CM.Sim.Has("Sugar baking"))mult*=1+Math.min(100,Game.lumps)*.01;mult*=1+CM.Sim.auraMult("Radiant Appetite");let rawCookiesPs=CM.Sim.cookiesPs*mult;for(let i of Object.keys(Game.CpsAchievements)){if(rawCookiesPs>=Game.CpsAchievements[i].threshold)CM.Sim.Win(Game.CpsAchievements[i].name)}CM.Sim.cookiesPsRaw=rawCookiesPs;let n=Game.shimmerTypes.golden.n;let auraMult=CM.Sim.auraMult("Dragon's Fortune");for(let i=0;i=7)CM.Sim.Win("Elder");if(!CM.Sim.HasAchiev("Veteran")&&grandmas>=14)CM.Sim.Win("Veteran");let buildingsOwned=0;let mathematician=1;let base10=1;let minAmount=1e5;for(let i of Object.keys(CM.Sim.Objects)){buildingsOwned+=CM.Sim.Objects[i].amount;minAmount=Math.min(CM.Sim.Objects[i].amount,minAmount);if(!CM.Sim.HasAchiev("Mathematician")){if(CM.Sim.Objects[i].amount=1)CM.Sim.Win("One with everything");if(mathematician===1)CM.Sim.Win("Mathematician");if(base10===1)CM.Sim.Win("Base 10");if(minAmount>=100)CM.Sim.Win("Centennial");if(minAmount>=150)CM.Sim.Win("Centennial and a half");if(minAmount>=200)CM.Sim.Win("Bicentennial");if(minAmount>=250)CM.Sim.Win("Bicentennial and a half");if(minAmount>=300)CM.Sim.Win("Tricentennial");if(minAmount>=350)CM.Sim.Win("Tricentennial and a half");if(minAmount>=400)CM.Sim.Win("Quadricentennial");if(minAmount>=450)CM.Sim.Win("Quadricentennial and a half");if(minAmount>=500)CM.Sim.Win("Quincentennial");if(minAmount>=550)CM.Sim.Win("Quincentennial and a half");if(minAmount>=600)CM.Sim.Win("Sexcentennial");if(buildingsOwned>=100)CM.Sim.Win("Builder");if(buildingsOwned>=500)CM.Sim.Win("Architect");if(buildingsOwned>=1e3)CM.Sim.Win("Engineer");if(buildingsOwned>=2e3)CM.Sim.Win("Lord of Constructs");if(buildingsOwned>=4e3)CM.Sim.Win("Grand design");if(buildingsOwned>=8e3)CM.Sim.Win("Ecumenopolis");if(CM.Sim.UpgradesOwned>=20)CM.Sim.Win("Enhancer");if(CM.Sim.UpgradesOwned>=50)CM.Sim.Win("Augmenter");if(CM.Sim.UpgradesOwned>=100)CM.Sim.Win("Upgrader");if(CM.Sim.UpgradesOwned>=200)CM.Sim.Win("Lord of Progress");if(CM.Sim.UpgradesOwned>=300)CM.Sim.Win("The full picture");if(CM.Sim.UpgradesOwned>=400)CM.Sim.Win("When there's nothing left to add");if(buildingsOwned>=4e3&&CM.Sim.UpgradesOwned>=300)CM.Sim.Win("Polymath");if(buildingsOwned>=8e3&&CM.Sim.UpgradesOwned>=400)CM.Sim.Win("Renaissance baker");if(CM.Sim.Objects.Cursor.amount+CM.Sim.Objects.Grandma.amount>=777)CM.Sim.Win("The elder scrolls");let hasAllHalloCook=true;for(let i of Object.keys(CM.Data.HalloCookies)){if(!CM.Sim.Has(CM.Data.HalloCookies[i]))hasAllHalloCook=false}if(hasAllHalloCook)CM.Sim.Win("Spooky cookies");let hasAllChristCook=true;for(let i of Object.keys(CM.Data.ChristCookies)){if(!CM.Sim.Has(CM.Data.ChristCookies[i]))hasAllChristCook=false}if(hasAllChristCook)CM.Sim.Win("Let it snow");if(CM.Sim.Has("Fortune cookies")){let list=Game.Tiers.fortune.upgrades;let fortunes=0;for(let i of Object.keys(list)){if(CM.Sim.Has(list[i].name))fortunes++}if(fortunes>=list.length)CM.Sim.Win("O Fortuna")}};CM.Sim.NoGoldSwitchCPS=function(){CM.Sim.CopyData();CM.Sim.Upgrades["Golden switch [off]"].bought=0;CM.Sim.CalculateGains();return CM.Sim.cookiesPs};CM.Sim.BuyBuildingsBonusIncome=function(building,amount){CM.Sim.CopyData();let me=CM.Sim.Objects[building];me.amount+=amount;if(building==="Cursor"){if(me.amount>=1)CM.Sim.Win("Click");if(me.amount>=2)CM.Sim.Win("Double-click");if(me.amount>=50)CM.Sim.Win("Mouse wheel");if(me.amount>=100)CM.Sim.Win("Of Mice and Men");if(me.amount>=200)CM.Sim.Win("The Digital");if(me.amount>=300)CM.Sim.Win("Extreme polydactyly");if(me.amount>=400)CM.Sim.Win("Dr. T");if(me.amount>=500)CM.Sim.Win("Thumbs, phalanges, metacarpals");if(me.amount>=600)CM.Sim.Win("With her finger and her thumb");if(me.amount>=700)CM.Sim.Win("Gotta hand it to you");if(me.amount>=800)CM.Sim.Win("The devil's workshop")}else{for(let j in Game.Objects[me.name].tieredAchievs){if(me.amount>=Game.Tiers[Game.Objects[me.name].tieredAchievs[j].tier].achievUnlock)CM.Sim.Win(Game.Objects[me.name].tieredAchievs[j].name)}}var lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!=CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}return CM.Sim.cookiesPs-Game.cookiesPs};CM.Sim.BuyUpgradesBonusIncome=function(upgrade){if(Game.Upgrades[upgrade].pool==="toggle"||Game.Upgrades[upgrade].bought===0&&Game.Upgrades[upgrade].unlocked&&Game.Upgrades[upgrade].pool!="prestige"){CM.Sim.CopyData();let me=CM.Sim.Upgrades[upgrade];me.bought=1;if(Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool))CM.Sim.UpgradesOwned++;if(upgrade==="Elder Pledge"){CM.Sim.pledges++;if(CM.Sim.pledges>0)CM.Sim.Win("Elder nap");if(CM.Sim.pledges>=5)CM.Sim.Win("Elder slumber")}else if(upgrade==="Elder Covenant"){CM.Sim.Win("Elder calm")}else if(upgrade==="Prism heart biscuits"){CM.Sim.Win("Lovely cookies")}else if(upgrade==="Heavenly key"){CM.Sim.Win("Wholesome")}var lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!=CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}let diffMouseCPS=CM.Sim.mouseCps()-Game.computedMouseCps;if(diffMouseCPS){return[CM.Sim.cookiesPs-Game.cookiesPs,diffMouseCPS]}return[CM.Sim.cookiesPs-Game.cookiesPs]}else{return[]}};CM.Sim.mouseCps=function(){let add=0;if(CM.Sim.Has("Thousand fingers"))add+=.1;if(CM.Sim.Has("Million fingers"))add*=5;if(CM.Sim.Has("Billion fingers"))add*=10;if(CM.Sim.Has("Trillion fingers"))add*=20;if(CM.Sim.Has("Quadrillion fingers"))add*=20;if(CM.Sim.Has("Quintillion fingers"))add*=20;if(CM.Sim.Has("Sextillion fingers"))add*=20;if(CM.Sim.Has("Septillion fingers"))add*=20;if(CM.Sim.Has("Octillion fingers"))add*=20;if(CM.Sim.Has("Nonillion fingers"))add*=20;let num=0;for(let i of Object.keys(CM.Sim.Objects)){num+=CM.Sim.Objects[i].amount}num-=CM.Sim.Objects.Cursor.amount;add=add*num;if(CM.Sim.Has("Plastic mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Iron mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Titanium mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Adamantium mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Unobtainium mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Eludium mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Wishalloy mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Fantasteel mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Nevercrack mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Armythril mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Technobsidian mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Plasmarble mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Miraculite mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Fortune #104"))add+=CM.Sim.cookiesPs*.01;let mult=1;if(CM.Sim.Has("Santa's helpers"))mult*=1.1;if(CM.Sim.Has("Cookie egg"))mult*=1.1;if(CM.Sim.Has("Halo gloves"))mult*=1.1;if(CM.Sim.Has("Dragon claw"))mult*=1.03;if(CM.Sim.Has("Aura gloves")){mult*=1+.05*Math.min(Game.Objects.Cursor.level,CM.Sim.Has("Luminous gloves")?20:10)}mult*=CM.Sim.eff("click");if(CM.Sim.Objects.Temple.minigameLoaded){if(CM.Sim.hasGod){let godLvl=CM.Sim.hasGod("labor");if(godLvl===1)mult*=1.15;else if(godLvl===2)mult*=1.1;else if(godLvl===3)mult*=1.05}}for(let i of Object.keys(Game.buffs)){if(typeof Game.buffs[i].multClick!="undefined")mult*=Game.buffs[i].multClick}mult*=1+CM.Sim.auraMult("Dragon Cursor")*.05;let out=mult*Game.ComputeCps(1,CM.Sim.Has("Reinforced index finger")+CM.Sim.Has("Carpal tunnel prevention cream")+CM.Sim.Has("Ambidextrous"),add);out=Game.runModHookOnValue("cookiesPerClick",out);if(Game.hasBuff("Cursed finger"))out=Game.buffs["Cursed finger"].power;return out};CM.Sim.CalculateChangeAura=function(aura){CM.Sim.CopyData();var auraToBeChanged=l("promptContent").children[0].innerHTML.includes("secondary");if(auraToBeChanged)CM.Sim.dragonAura2=aura;else CM.Sim.dragonAura=aura;let price=0;if(CM.Sim.dragonAura!=CM.Cache.dragonAura||CM.Sim.dragonAura2!=CM.Cache.dragonAura2){for(let i=Game.ObjectsById.length;i>-1,--i;){if(Game.ObjectsById[i].amount>0){var highestBuilding=CM.Sim.Objects[Game.ObjectsById[i].name].name;CM.Sim.Objects[highestBuilding].amount-=1;CM.Sim.buildingsOwned-=1;price=CM.Sim.Objects[highestBuilding].basePrice*Math.pow(Game.priceIncrease,Math.max(0,CM.Sim.Objects[highestBuilding].amount-1-CM.Sim.Objects[highestBuilding].free));price=Game.modifyBuildingPrice(CM.Sim.Objects[highestBuilding],price);price=Math.ceil(price);break}}}let lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!=CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}return[CM.Sim.cookiesPs-Game.cookiesPs,price]};CM.Sim.ResetBonus=function(newHeavenlyChips){let curCPS=Game.cookiesPs;CM.Sim.CopyData();if(CM.Sim.Upgrades["Heavenly key"].bought===0){CM.Sim.Upgrades["Heavenly chip secret"].bought=1;CM.Sim.Upgrades["Heavenly cookie stand"].bought=1;CM.Sim.Upgrades["Heavenly bakery"].bought=1;CM.Sim.Upgrades["Heavenly confectionery"].bought=1;CM.Sim.Upgrades["Heavenly key"].bought=1;CM.Sim.CalculateGains();curCPS=CM.Sim.cookiesPs;CM.Sim.CopyData()}if(CM.Cache.RealCookiesEarned>=1e6)CM.Sim.Win("Sacrifice");if(CM.Cache.RealCookiesEarned>=1e9)CM.Sim.Win("Oblivion");if(CM.Cache.RealCookiesEarned>=1e12)CM.Sim.Win("From scratch");if(CM.Cache.RealCookiesEarned>=1e15)CM.Sim.Win("Nihilism");if(CM.Cache.RealCookiesEarned>=1e18)CM.Sim.Win("Dematerialize");if(CM.Cache.RealCookiesEarned>=1e21)CM.Sim.Win("Nil zero zilch");if(CM.Cache.RealCookiesEarned>=1e24)CM.Sim.Win("Transcendence");if(CM.Cache.RealCookiesEarned>=1e27)CM.Sim.Win("Obliterate");if(CM.Cache.RealCookiesEarned>=1e30)CM.Sim.Win("Negative void");if(CM.Cache.RealCookiesEarned>=1e33)CM.Sim.Win("To crumbs, you say?");if(CM.Cache.RealCookiesEarned>=1e36)CM.Sim.Win("You get nothing");if(CM.Cache.RealCookiesEarned>=1e39)CM.Sim.Win("Humble rebeginnings");if(CM.Cache.RealCookiesEarned>=1e42)CM.Sim.Win("The end of the world");if(CM.Cache.RealCookiesEarned>=1e45)CM.Sim.Win("Oh, you're back");if(CM.Cache.RealCookiesEarned>=1e48)CM.Sim.Win("Lazarus");if(CM.Cache.RealCookiesEarned>=1e51)CM.Sim.Win("Smurf account");if(CM.Cache.RealCookiesEarned>=1e54)CM.Sim.Win("If at first you don't succeed");CM.Sim.Upgrades["Heavenly chip secret"].bought=1;CM.Sim.Upgrades["Heavenly cookie stand"].bought=1;CM.Sim.Upgrades["Heavenly bakery"].bought=1;CM.Sim.Upgrades["Heavenly confectionery"].bought=1;CM.Sim.Upgrades["Heavenly key"].bought=1;CM.Sim.prestige=newHeavenlyChips;let lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!=CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}let ResetCPS=CM.Sim.cookiesPs-curCPS;CM.Sim.prestige=Game.prestige;return ResetCPS};CM.Sim.SellBuildingsForChoEgg=function(){let sellTotal=0;CM.Sim.CopyData();let buildingsToSacrifice=2;if(CM.Sim.dragonAura===5||CM.Sim.dragonAura===18){--buildingsToSacrifice}if(CM.Sim.dragonAura2===5||CM.Sim.dragonAura2===18){--buildingsToSacrifice}CM.Sim.dragonAura=5;CM.Sim.dragonAura2=18;for(let i=0;i0){highestBuilding=CM.Sim.Objects[j]}}highestBuilding.amount--;CM.Sim.buildingsOwned--}for(let i of Object.keys(CM.Sim.Objects)){let me=CM.Sim.Objects[i];sellTotal+=CM.Sim.BuildingSell(Game.Objects[me.name],Game.Objects[i].basePrice,me.amount,Game.Objects[i].free,me.amount)}return sellTotal};CM.init=function(){CM.Footer.isInitzializing=true;var proceed=true;if(Game.version!=CM.VersionMajor){proceed=confirm("Cookie Monster version "+CM.VersionMajor+"."+CM.VersionMinor+" is meant for Game version "+CM.VersionMajor+". Loading a different version may cause errors. Do you still want to load Cookie Monster?")}if(proceed){CM.Main.DelayInit();Game.registerHook("draw",CM.Disp.Draw);Game.registerHook("logic",CM.Main.Loop);CM.Footer.isInitzializing=false}};CM.save=function(){return JSON.stringify({settings:CM.Options,version:CM.VersionMajor+"."+CM.VersionMinor})};CM.load=function(str){let save=JSON.parse(str);CM.Config.LoadConfig(save.settings)};CM.Footer.AddJscolor=function(){CM.Footer.Jscolor=document.createElement("script");CM.Footer.Jscolor.type="text/javascript";CM.Footer.Jscolor.setAttribute("src","https://aktanusa.github.io/CookieMonster/jscolor/jscolor.js");document.head.appendChild(CM.Footer.Jscolor)};if(typeof CM.Footer.isInitzializing==="undefined"){CM.Footer.AddJscolor();var delay=setInterval((function(){if(typeof jscolor!=="undefined"){jscolor.init();Game.registerMod("CookieMonster",CM);clearInterval(delay)}}),500)} \ No newline at end of file +const CM={Backup:{},Cache:{},Config:{},Data:{Config:{}},Disp:{},Footer:{},Main:{},Options:{},Sim:{},VersionMajor:"2.031",VersionMinor:"3"};CM.Cache.InitCache=function(){CM.Cache.CacheDragonAuras();CM.Cache.CacheWrinklers();CM.Cache.CacheStats();CM.Cache.CacheGoldenAndWrathCookiesMults();CM.Cache.CacheChain();CM.Cache.CacheMissingUpgrades();CM.Cache.CacheSeaSpec();CM.Cache.InitCookiesDiff();CM.Cache.CacheAvgCPS();CM.Cache.CacheIncome();CM.Cache.CacheBuildingsPrices();CM.Cache.CachePP()};CM.Cache.LoopCache=function(){CM.Cache.CacheWrinklers();CM.Cache.CachePP();CM.Cache.CacheCurrWrinklerCPS();CM.Cache.CacheAvgCPS();let cookiesToNext=Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))+1)-(Game.cookiesEarned+Game.cookiesReset);CM.Cache.TimeTillNextPrestige=CM.Disp.FormatTime(cookiesToNext/CM.Cache.AvgCPS)};CM.Cache.CacheDragonAuras=function(){CM.Cache.dragonAura=Game.dragonAura;CM.Cache.dragonAura2=Game.dragonAura2};CM.Cache.CacheWrinklers=function(){CM.Cache.WrinklersTotal=0;CM.Cache.WrinklersNormal=0;CM.Cache.WrinklersFattest=[0,null];for(let i=0;iCM.Cache.WrinklersFattest[0])CM.Cache.WrinklersFattest=[sucked,i]}}};CM.Cache.CacheStats=function(){CM.Cache.Lucky=CM.Cache.NoGoldSwitchCookiesPS*900/.15;CM.Cache.Lucky*=CM.Cache.DragonsFortuneMultAdjustment;let cpsBuffMult=CM.Cache.getCPSBuffMult();if(cpsBuffMult>0)CM.Cache.Lucky/=cpsBuffMult;else CM.Cache.Lucky=0;CM.Cache.LuckyReward=CM.Cache.GoldenCookiesMult*(CM.Cache.Lucky*.15)+13;CM.Cache.LuckyWrathReward=CM.Cache.WrathCookiesMult*(CM.Cache.Lucky*.15)+13;CM.Cache.LuckyFrenzy=CM.Cache.Lucky*7;CM.Cache.LuckyRewardFrenzy=CM.Cache.GoldenCookiesMult*(CM.Cache.LuckyFrenzy*.15)+13;CM.Cache.LuckyWrathRewardFrenzy=CM.Cache.WrathCookiesMult*(CM.Cache.LuckyFrenzy*.15)+13;CM.Cache.Conjure=CM.Cache.Lucky*2;CM.Cache.ConjureReward=CM.Cache.Conjure*.15;CM.Cache.Edifice=0;let max=0;let n=0;for(let i of Object.keys(Game.Objects)){if(Game.Objects[i].amount>max)max=Game.Objects[i].amount;if(Game.Objects[i].amount>0)n++}for(let i of Object.keys(Game.Objects)){if((Game.Objects[i].amountCM.Cache.Edifice){CM.Cache.Edifice=Game.Objects[i].price*2;CM.Cache.EdificeBuilding=i}}};CM.Cache.CacheGoldenAndWrathCookiesMults=function(){if(CM.Footer.isInitzializing){CM.Cache.GoldenCookiesMult=1;CM.Cache.WrathCookiesMult=1;CM.Cache.DragonsFortuneMultAdjustment=1}else{let goldenMult=1;let wrathMult=1;let mult=1;if(CM.Sim.Has("Green yeast digestives"))mult*=1.01;if(CM.Sim.Has("Dragon fang"))mult*=1.03;goldenMult*=1+Game.auraMult("Ancestral Metamorphosis")*.1;goldenMult*=Game.eff("goldenCookieGain");wrathMult*=1+Game.auraMult("Unholy Dominion")*.1;wrathMult*=Game.eff("wrathCookieGain");CM.Cache.GoldenCookiesMult=mult*goldenMult;CM.Cache.WrathCookiesMult=mult*wrathMult;CM.Cache.DragonsFortuneMultAdjustment=1;if(Game.shimmerTypes.golden.n===0){CM.Cache.DragonsFortuneMultAdjustment*=1+Game.auraMult("Dragon's Fortune")*1.23}}};CM.Cache.MaxChainCookieReward=function(digit,maxPayout,mult){let totalFromChain=0;let moni=0;let nextMoni=0;let chain=1+Math.max(0,Math.ceil(Math.log(Game.cookies)/Math.LN10)-10);while(nextMoni0)maxPayout/=cpsBuffMult;else maxPayout=0;CM.Cache.ChainReward=CM.Cache.MaxChainCookieReward(7,maxPayout*CM.Cache.GoldenCookiesMult,CM.Cache.GoldenCookiesMult);CM.Cache.ChainRequired=CM.Cache.ChainReward[0]*2;CM.Cache.ChainRequiredNext=CM.Cache.ChainReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout*CM.Cache.WrathCookiesMult,CM.Cache.WrathCookiesMult);CM.Cache.ChainWrathRequired=CM.Cache.ChainWrathReward[0]*2;CM.Cache.ChainWrathRequiredNext=CM.Cache.ChainWrathReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyReward=CM.Cache.MaxChainCookieReward(7,maxPayout*7*CM.Cache.GoldenCookiesMult,CM.Cache.GoldenCookiesMult);CM.Cache.ChainFrenzyRequired=CM.Cache.ChainFrenzyReward[0]*2;CM.Cache.ChainFrenzyRequiredNext=CM.Cache.ChainFrenzyReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout*7*CM.Cache.WrathCookiesMult,CM.Cache.WrathCookiesMult);CM.Cache.ChainFrenzyWrathRequired=CM.Cache.ChainFrenzyReward[0]*2;CM.Cache.ChainFrenzyWrathRequiredNext=CM.Cache.ChainFrenzyReward[1]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment};CM.Cache.CacheMissingUpgrades=function(){CM.Cache.MissingUpgrades="";CM.Cache.MissingUpgradesCookies="";CM.Cache.MissingUpgradesPrestige="";let list=[];for(let i of Object.keys(Game.Upgrades)){list.push(Game.Upgrades[i])}let sortMap=function(a,b){if(a.order>b.order)return 1;else if(a.orderthis.maxLength){this.queue.shift()}}calcAverage(timePeriod){if(timePeriod>this.maxLength)timePeriod=this.maxLength;if(timePeriod>this.queue.length)timePeriod=this.queue.length;let ret=0;for(let i=this.queue.length-1;i>=0&&i>this.queue.length-1-timePeriod;i--){ret+=this.queue[i]}return ret/timePeriod}}CM.Cache.InitCookiesDiff=function(){CM.Cache.CookiesDiff=new CMAvgQueue(CM.Disp.cookieTimes[CM.Disp.cookieTimes.length-1]);CM.Cache.WrinkDiff=new CMAvgQueue(CM.Disp.cookieTimes[CM.Disp.cookieTimes.length-1]);CM.Cache.WrinkFattestDiff=new CMAvgQueue(CM.Disp.cookieTimes[CM.Disp.cookieTimes.length-1]);CM.Cache.ChoEggDiff=new CMAvgQueue(CM.Disp.cookieTimes[CM.Disp.cookieTimes.length-1]);CM.Cache.ClicksDiff=new CMAvgQueue(CM.Disp.clickTimes[CM.Disp.clickTimes.length-1])};CM.Cache.CacheAvgCPS=function(){let currDate=Math.floor(Date.now()/1e3);if(Game.T/Game.fps%1===0){let choEggTotal=Game.cookies+CM.Cache.SellForChoEgg;if(Game.cpsSucked>0)choEggTotal+=CM.Cache.WrinklersTotal;CM.Cache.RealCookiesEarned=Math.max(Game.cookiesEarned,choEggTotal);choEggTotal*=.05;let timeDiff=currDate-CM.Cache.lastDate;let bankDiffAvg=Math.max(0,Game.cookies-CM.Cache.lastCookies)/timeDiff;let wrinkDiffAvg=Math.max(0,CM.Cache.WrinklersTotal-CM.Cache.lastWrinkCookies)/timeDiff;let wrinkFattestDiffAvg=Math.max(0,CM.Cache.WrinklersFattest[0]-CM.Cache.lastWrinkFattestCookies)/timeDiff;let choEggDiffAvg=Math.max(0,choEggTotal-CM.Cache.lastChoEgg)/timeDiff;let clicksDiffAvg=(Game.cookieClicks-CM.Cache.lastClicks)/timeDiff;for(let i=0;iCM.Cache.max)CM.Cache.max=CM.Cache.Objects1[i].pp}CM.Cache.mid=(CM.Cache.max-CM.Cache.min)/2+CM.Cache.min;for(let i of Object.keys(CM.Cache.Objects1)){let color="";if(CM.Cache.Objects1[i].pp===CM.Cache.min)color=CM.Disp.colorGreen;else if(CM.Cache.Objects1[i].pp===CM.Cache.max)color=CM.Disp.colorRed;else if(CM.Cache.Objects1[i].pp>CM.Cache.mid)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow;CM.Cache.Objects1[i].color=color}CM.Cache.CacheBuildingsBulkPP("Objects10");CM.Cache.CacheBuildingsBulkPP("Objects100")}else{let target=`Objects${Game.buyBulk}`;for(let i of Object.keys(CM.Cache[target])){if(Game.cookiesPs){CM.Cache[target][i].pp=Math.max(Game.Objects[i].bulkPrice-(Game.cookies+CM.Disp.GetWrinkConfigBank()),0)/Game.cookiesPs+Game.Objects[i].bulkPrice/CM.Cache[target][i].bonus}else CM.CM.Cache[target][i].pp=Game.Objects[i].bulkPrice/CM.Cache[target][i].bonus;if(CM.Cache.min===-1||CM.Cache[target][i].ppCM.Cache.max)CM.Cache.max=CM.Cache[target][i].pp}CM.Cache.mid=(CM.Cache.max-CM.Cache.min)/2+CM.Cache.min;for(let i of Object.keys(CM.Cache.Objects1)){let color="";if(CM.Cache[target][i].pp===CM.Cache.min)color=CM.Disp.colorGreen;else if(CM.Cache[target][i].pp===CM.Cache.max)color=CM.Disp.colorRed;else if(CM.Cache[target][i].pp>CM.Cache.mid)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow;CM.Cache[target][i].color=color}}};CM.Cache.CacheBuildingsBulkPP=function(target){for(let i of Object.keys(CM.Cache[target])){if(Game.cookiesPs){CM.Cache[target][i].pp=Math.max(CM.Cache[target][i].price-(Game.cookies+CM.Disp.GetWrinkConfigBank()),0)/Game.cookiesPs+CM.Cache[target][i].price/CM.Cache[target][i].bonus}else CM.Cache[target][i].pp=CM.Cache[target][i].price/CM.Cache[target][i].bonus;let color="";if(CM.Cache[target][i].pp<=0||CM.Cache[target][i].pp===Infinity)color=CM.Disp.colorGray;else if(CM.Cache[target][i].ppCM.Cache.max)color=CM.Disp.colorPurple;else if(CM.Cache[target][i].pp>CM.Cache.mid)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow;CM.Cache[target][i].color=color}};CM.Cache.CacheUpgradePP=function(){for(let i of Object.keys(CM.Cache.Upgrades)){if(Game.cookiesPs){CM.Cache.Upgrades[i].pp=Math.max(Game.Upgrades[i].getPrice()-(Game.cookies+CM.Disp.GetWrinkConfigBank()),0)/Game.cookiesPs+Game.Upgrades[i].getPrice()/CM.Cache.Upgrades[i].bonus}else CM.Cache.Upgrades[i].pp=Game.Upgrades[i].getPrice()/CM.Cache.Upgrades[i].bonus;if(isNaN(CM.Cache.Upgrades[i].pp))CM.Cache.Upgrades[i].pp=Infinity;let color="";if(CM.Cache.Upgrades[i].pp<=0||CM.Cache.Upgrades[i].pp===Infinity)color=CM.Disp.colorGray;else if(CM.Cache.Upgrades[i].ppCM.Cache.max)color=CM.Disp.colorPurple;else if(CM.Cache.Upgrades[i].pp>CM.Cache.mid)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow;CM.Cache.Upgrades[i].color=color}};CM.Cache.CentEgg=0;CM.Cache.HadBuildAura=false;CM.Cache.NoGoldSwitchCookiesPS=0;CM.Config.SaveConfig=function(){let saveString=b64_to_utf8(unescape(localStorage.getItem("CookieClickerGame")).split("!END!")[0]);let CookieMonsterSave=saveString.match(/CookieMonster.*(;|$)/);if(CookieMonsterSave!=null){let newSaveString=saveString.replace(CookieMonsterSave[0],"CookieMonster:"+CM.save());localStorage.setItem("CookieClickerGame",escape(utf8_to_b64(newSaveString)+"!END!"))}};CM.Config.LoadConfig=function(settings){if(typeof localStorage.CMConfig!="undefined"){delete localStorage.CMConfig}if(settings!=null){CM.Options=settings;let mod=false;for(let i in CM.Data.ConfigDefault){if(typeof CM.Options[i]==="undefined"){mod=true;CM.Options[i]=CM.Data.ConfigDefault[i]}else if(i!="Header"&&i!="Colors"){if(i.indexOf("SoundURL")===-1){if(!(CM.Options[i]>-1&&CM.Options[i]-1&&CM.Options[i][j]<2)){mod=true;CM.Options[i][j]=CM.Data.ConfigDefault[i][j]}}}else{for(let j in CM.Data.ConfigDefault.Colors){if(typeof CM.Options[i][j]==="undefined"||typeof CM.Options[i][j]!="string"){mod=true;CM.Options[i][j]=CM.Data.ConfigDefault[i][j]}}}}if(mod)CM.Config.SaveConfig();CM.Main.Loop();for(let i in CM.Data.ConfigDefault){if(i!="Header"&&typeof CM.Data.Config[i].func!=="undefined"){CM.Data.Config[i].func()}}}else{CM.Config.RestoreDefault()}};CM.Config.RestoreDefault=function(){CM.Config.LoadConfig(CM.Data.ConfigDefault);CM.Config.SaveConfig();Game.UpdateMenu()};CM.Config.ToggleConfig=function(config){CM.Options[config]++;if(CM.Options[config]===CM.Data.Config[config].label.length){CM.Options[config]=0;if(CM.Data.Config[config].toggle)l(CM.Config.ConfigPrefix+config).className="option off"}else l(CM.Config.ConfigPrefix+config).className="option";if(typeof CM.Data.Config[config].func!=="undefined"){CM.Data.Config[config].func()}l(CM.Config.ConfigPrefix+config).innerHTML=CM.Data.Config[config].label[CM.Options[config]];CM.Config.SaveConfig()};CM.Config.ToggleConfigVolume=function(config){if(l("slider"+config)!=null){l("slider"+config+"right").innerHTML=l("slider"+config).value+"%";CM.Options[config]=Math.round(l("slider"+config).value)}CM.Config.SaveConfig()};CM.Config.ToggleHeader=function(config){CM.Options.Header[config]++;if(CM.Options.Header[config]>1)CM.Options.Header[config]=0;CM.Config.SaveConfig()};CM.Config.CheckNotificationPermissions=function(ToggleOnOff){if(ToggleOnOff===1){let checkNotificationPromise=function(){try{Notification.requestPermission().then()}catch(e){return false}return true};if(!("Notification"in window)){console.log("This browser does not support notifications.")}else{if(checkNotificationPromise()){Notification.requestPermission().then()}else{Notification.requestPermission()}}}};CM.Config.ConfigPrefix="CMConfig";CM.Data.Fortunes=["Fortune #001","Fortune #002","Fortune #003","Fortune #004","Fortune #005","Fortune #006","Fortune #007","Fortune #008","Fortune #009","Fortune #010","Fortune #011","Fortune #012","Fortune #013","Fortune #014","Fortune #015","Fortune #016","Fortune #017","Fortune #018","Fortune #100","Fortune #101","Fortune #102","Fortune #103","Fortune #104"];CM.Data.HalloCookies=["Skull cookies","Ghost cookies","Bat cookies","Slime cookies","Pumpkin cookies","Eyeball cookies","Spider cookies"];CM.Data.ChristCookies=["Christmas tree biscuits","Snowflake biscuits","Snowman biscuits","Holly biscuits","Candy cane biscuits","Bell biscuits","Present biscuits"];CM.Data.ValCookies=["Pure heart biscuits","Ardent heart biscuits","Sour heart biscuits","Weeping heart biscuits","Golden heart biscuits","Eternal heart biscuits","Prism heart biscuits"];CM.Data.PlantDrops=["Elderwort biscuits","Bakeberry cookies","Duketater cookies","Green yeast digestives","Wheat slims","Fern tea","Ichor syrup"];CM.Data.Effects={buildingCost:"Building prices",click:"Cookies per click",cps:"Total CPS",cursorCps:"Cursor CPS",goldenCookieDur:"Golden cookie duration",goldenCookieEffDur:"Golden cookie effect duration",goldenCookieFreq:"Golden cookie frequency",goldenCookieGain:"Golden cookie gains",grandmaCps:"Grandma CPS",itemDrops:"Random item drop chance",milk:"Effect from milk",reindeerDur:"Reindeer duration",reindeerFreq:"Reindeer frequency",reindeerGain:"Reindeer gains",upgradeCost:"Upgrade prices",wrathCookieDur:"Wrath cookie duration",wrathCookieEffDur:"Wrath cookie effect duration",wrathCookieFreq:"Wrath cookie frequency",wrathCookieGain:"Wrath cookie gains",wrinklerEat:"Wrinkler ",wrinklerSpawn:"Wrinkler spawn frequency"};CM.Data.metric=["","","M","G","T","P","E","Z","Y"];CM.Data.shortScale=["","","M","B","Tr","Quadr","Quint","Sext","Sept","Oct","Non","Dec","Undec","Duodec","Tredec","Quattuordec","Quindec","Sexdec","Septendec","Octodec","Novemdec","Vigint","Unvigint","Duovigint","Trevigint","Quattuorvigint"];CM.Data.shortScaleAbbreviated=["","K","M","B","T","Qa","Qi","Sx","Sp","Oc","No","De","UDe","DDe","TDe","QaDe","QiDe","SxDe","SpDe","ODe","NDe","Vi","UVi","DVi","TVi","QaVi","QiVi","SxVi","SpVi","OVi","NVi","Tr","UTr","DTr","TTr","QaTr","QiTr","SxTr","SpTr","OTr","NTr","Qaa","UQa","DQa","TQa","QaQa","QiQa","SxQa","SpQa","OQa","NQa","Qia","UQi","DQi","TQi","QaQi","QiQi","SxQi","SpQi","OQi","NQi","Sxa","USx","DSx","TSx","QaSx","QiSx","SxSx","SpSx","OSx","NSx","Spa","USp","DSp","TSp","QaSp","QiSp","SxSp","SpSp","OSp","NSp","Oco","UOc","DOc","TOc","QaOc","QiOc","SxOc","SpOc","OOc","NOc","Noa","UNo","DNo","TNo","QaNo","QiNo","SxNo","SpNo","ONo","NNo","Ct","UCt"];CM.Data.ConfigGroups={BarsColors:"Bars/Colors",Calculation:"Calculation",Notification:"Notification",Tooltip:"Tooltips and additional insights",Statistics:"Statistics",Notation:"Notation",Miscellaneous:"Miscellaneous"};CM.Data.ConfigGroupsNotification={NotificationGeneral:"General Notifications",NotificationGC:"Golden Cookie",NotificationFC:"Fortune Cookie",NotificationSea:"Season Special",NotificationGard:"Garden Tick",NotificationMagi:"Full Magic Bar",NotificationWrink:"Wrinkler",NotificationWrinkMax:"Maximum Wrinklers"};CM.Data.Config.BotBar={type:"bool",group:"BarsColors",label:["Bottom Bar OFF","Bottom Bar ON"],desc:"Building Information",toggle:true,func:function(){CM.Disp.ToggleBotBar()}};CM.Data.Config.TimerBar={type:"bool",group:"BarsColors",label:["Timer Bar OFF","Timer Bar ON"],desc:"Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy",toggle:true,func:function(){CM.Disp.ToggleTimerBar()}};CM.Data.Config.TimerBarPos={type:"bool",group:"BarsColors",label:["Timer Bar Position (Top Left)","Timer Bar Position (Bottom)"],desc:"Placement of the Timer Bar",toggle:false,func:function(){CM.Disp.ToggleTimerBarPos()}};CM.Data.Config.TimerBarOverlay={type:"bool",group:"BarsColors",label:["Timer Bar Overlay OFF","Timer Bar Overlay Only Seconds","Timer Bar Overlay Full"],desc:"Overlay on timers displaying seconds and/or percentage left",toggle:true};CM.Data.Config.SortBuildings={type:"bool",group:"BarsColors",label:["Sort Buildings: Default","Sort Buildings: PP"],desc:"Sort the display of buildings in either default order or by PP",toggle:false,func:function(){CM.Disp.UpdateBuildings()}};CM.Data.Config.SortUpgrades={type:"bool",group:"BarsColors",label:["Sort Upgrades: Default","Sort Upgrades: PP"],desc:"Sort the display of upgrades in either default order or by PP",toggle:false,func:function(){CM.Disp.UpdateUpgrades()}};CM.Data.Config.BuildColor={type:"bool",group:"BarsColors",label:["Building Colors OFF","Building Colors ON"],desc:"Color code buildings",toggle:true,func:function(){CM.Disp.UpdateBuildings()}};CM.Data.Config.BulkBuildColor={type:"bool",group:"BarsColors",label:["Bulk Building Colors (Single Building Color)","Bulk Building Colors (Calculated Bulk Color)"],desc:"Color code bulk buildings based on single buildings color or calculated bulk value color",toggle:false,func:function(){CM.Disp.UpdateBuildings()}};CM.Data.Config.ColorPPBulkMode={type:"bool",group:"BarsColors",label:["Color of PP (Compared to Single)","Color of PP (Compared to Bulk)"],desc:"Color PP-values based on comparison with single purchase or with selected bulk-buy mode",toggle:false};CM.Data.Config.UpBarColor={type:"bool",group:"BarsColors",label:["Upgrade Colors/Bar OFF","Upgrade Colors with Bar ON","Upgrade Colors without Bar ON"],desc:"Color code upgrades and optionally add a counter bar",toggle:false,func:function(){CM.Disp.ToggleUpgradeBarAndColor()}};CM.Data.Config.Colors={type:"color",group:"BarsColors",desc:{Blue:"Color Blue. Used to show better than best PP building, for Click Frenzy bar, and for various labels",Green:"Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels",Yellow:"Color Yellow. Used to show between best and worst PP buildings closer to best, for Frenzy bar, and for various labels",Orange:"Color Orange. Used to show between best and worst PP buildings closer to worst, for Next Reindeer bar, and for various labels",Red:"Color Red. Used to show worst PP building, for Clot bar, and for various labels",Purple:"Color Purple. Used to show worse than worst PP building, for Next Cookie bar, and for various labels",Gray:"Color Gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar",Pink:"Color Pink. Used for Dragonflight bar",Brown:"Color Brown. Used for Dragon Harvest bar"},func:function(){CM.Disp.UpdateColors()}};CM.Data.Config.UpgradeBarFixedPos={type:"bool",group:"BarsColors",label:["Upgrade Bar Fixed Position OFF","Upgrade Bar Fixed Position ON"],desc:"Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling",toggle:true,func:function(){CM.Disp.ToggleUpgradeBarFixedPos()}};CM.Data.Config.CalcWrink={type:"bool",group:"Calculation",label:["Calculate with Wrinklers OFF","Calculate with Wrinklers ON","Calculate with Single Fattest Wrinkler ON"],desc:"Calculate times and average Cookies Per Second with (only the single non-shiny fattest) Wrinklers",toggle:true};CM.Data.Config.CPSMode={type:"bool",group:"Calculation",label:["Current Cookies Per Second","Average Cookies Per Second"],desc:"Calculate times using current Cookies Per Second or average Cookies Per Second",toggle:false};CM.Data.Config.AvgCPSHist={type:"bool",group:"Calculation",label:["Average CPS for past 10s","Average CPS for past 15s","Average CPS for past 30s","Average CPS for past 1m","Average CPS for past 5m","Average CPS for past 10m","Average CPS for past 15m","Average CPS for past 30m"],desc:"How much time average Cookies Per Second should consider",toggle:false};CM.Data.Config.AvgClicksHist={type:"bool",group:"Calculation",label:["Average Cookie Clicks for past 1s","Average Cookie Clicks for past 5s","Average Cookie Clicks for past 10s","Average Cookie Clicks for past 15s","Average Cookie Clicks for past 30s"],desc:"How much time average Cookie Clicks should consider",toggle:false};CM.Data.Config.ToolWarnBon={type:"bool",group:"Calculation",label:["Calculate Tooltip Warning With Bonus CPS OFF","Calculate Tooltip Warning With Bonus CPS ON"],desc:"Calculate the warning with or without the bonus CPS you get from buying",toggle:true};CM.Data.Config.Title={type:"bool",group:"NotificationGeneral",label:["Title OFF","Title ON","Title Pinned Tab Highlight"],desc:'Update title with Golden Cookie/Season Popup timers; pinned tab highlight only changes the title when a Golden Cookie/Season Popup spawns; "!" means that Golden Cookie/Reindeer can spawn',toggle:true};CM.Data.Config.GeneralSound={type:"bool",group:"NotificationGeneral",label:["Consider Game Volume Setting OFF","Consider Game Volume Setting ON"],desc:'Turning this toggle to "off" makes Cookie Monster no longer consider the volume setting of the base game, allowing mod notifications to play with base game volume turned down',toggle:true};CM.Data.Config.GCNotification={type:"bool",group:"NotificationGC",label:["Notification OFF","Notification ON"],desc:"Create a notification when Golden Cookie spawns",toggle:true,func:function(){CM.Config.CheckNotificationPermissions(CM.Options.GCNotification)}};CM.Data.Config.GCFlash={type:"bool",group:"NotificationGC",label:["Flash OFF","Flash ON"],desc:"Flash screen on Golden Cookie",toggle:true};CM.Data.Config.GCSound={type:"bool",group:"NotificationGC",label:["Sound OFF","Sound ON"],desc:"Play a sound on Golden Cookie",toggle:true};CM.Data.Config.GCVolume={type:"vol",group:"NotificationGC",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.GCVolume.label[i]=i+"%"}CM.Data.Config.GCSoundURL={type:"url",group:"NotificationGC",label:"Sound URL:",desc:"URL of the sound to be played when a Golden Cookie spawns"};CM.Data.Config.FortuneNotification={type:"bool",group:"NotificationFC",label:["Notification OFF","Notification ON"],desc:"Create a notification when Fortune Cookie is on the Ticker",toggle:true,func:function(){CM.Config.CheckNotificationPermissions(CM.Options.FortuneNotification)}};CM.Data.Config.FortuneFlash={type:"bool",group:"NotificationFC",label:["Flash OFF","Flash ON"],desc:"Flash screen on Fortune Cookie",toggle:true};CM.Data.Config.FortuneSound={type:"bool",group:"NotificationFC",label:["Sound OFF","Sound ON"],desc:"Play a sound on Fortune Cookie",toggle:true};CM.Data.Config.FortuneVolume={type:"vol",group:"NotificationFC",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.FortuneVolume.label[i]=i+"%"}CM.Data.Config.FortuneSoundURL={type:"url",group:"NotificationFC",label:"Sound URL:",desc:"URL of the sound to be played when the Ticker has a Fortune Cookie"};CM.Data.Config.SeaNotification={type:"bool",group:"NotificationSea",label:["Notification OFF","Notification ON"],desc:"Create a notification on Season Popup",toggle:true,func:function(){CM.Config.CheckNotificationPermissions(CM.Options.SeaNotification)}};CM.Data.Config.SeaFlash={type:"bool",group:"NotificationSea",label:["Flash OFF","Flash ON"],desc:"Flash screen on Season Popup",toggle:true};CM.Data.Config.SeaSound={type:"bool",group:"NotificationSea",label:["Sound OFF","Sound ON"],desc:"Play a sound on Season Popup",toggle:true};CM.Data.Config.SeaVolume={type:"vol",group:"NotificationSea",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.SeaVolume.label[i]=i+"%"}CM.Data.Config.SeaSoundURL={type:"url",group:"NotificationSea",label:"Sound URL:",desc:"URL of the sound to be played when a Season Special spawns"};CM.Data.Config.GardFlash={type:"bool",group:"NotificationGard",label:["Garden Tick Flash OFF","Flash ON"],desc:"Flash screen on Garden Tick",toggle:true};CM.Data.Config.GardSound={type:"bool",group:"NotificationGard",label:["Sound OFF","Sound ON"],desc:"Play a sound on Garden Tick",toggle:true};CM.Data.Config.GardVolume={type:"vol",group:"NotificationGard",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.GardVolume.label[i]=i+"%"}CM.Data.Config.GardSoundURL={type:"url",group:"NotificationGard",label:"Garden Tick Sound URL:",desc:"URL of the sound to be played when the garden ticks"};CM.Data.Config.MagicNotification={type:"bool",group:"NotificationMagi",label:["Notification OFF","Notification ON"],desc:"Create a notification when magic reaches maximum",toggle:true,func:function(){CM.Config.CheckNotificationPermissions(CM.Options.MagicNotification)}};CM.Data.Config.MagicFlash={type:"bool",group:"NotificationMagi",label:["Flash OFF","Flash ON"],desc:"Flash screen when magic reaches maximum",toggle:true};CM.Data.Config.MagicSound={type:"bool",group:"NotificationMagi",label:["Sound OFF","Sound ON"],desc:"Play a sound when magic reaches maximum",toggle:true};CM.Data.Config.MagicVolume={type:"vol",group:"NotificationMagi",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.MagicVolume.label[i]=i+"%"}CM.Data.Config.MagicSoundURL={type:"url",group:"NotificationMagi",label:"Sound URL:",desc:"URL of the sound to be played when magic reaches maxium"};CM.Data.Config.WrinklerNotification={type:"bool",group:"NotificationWrink",label:["Notification OFF","Notification ON"],desc:"Create a notification when a Wrinkler appears",toggle:true,func:function(){CM.Config.CheckNotificationPermissions(CM.Options.WrinklerNotification)}};CM.Data.Config.WrinklerFlash={type:"bool",group:"NotificationWrink",label:["Flash OFF","Flash ON"],desc:"Flash screen when a Wrinkler appears",toggle:true};CM.Data.Config.WrinklerSound={type:"bool",group:"NotificationWrink",label:["Sound OFF","Sound ON"],desc:"Play a sound when a Wrinkler appears",toggle:true};CM.Data.Config.WrinklerVolume={type:"vol",group:"NotificationWrink",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.WrinklerVolume.label[i]=i+"%"}CM.Data.Config.WrinklerSoundURL={type:"url",group:"NotificationWrink",label:"Sound URL:",desc:"URL of the sound to be played when a Wrinkler appears"};CM.Data.Config.WrinklerMaxNotification={type:"bool",group:"NotificationWrinkMax",label:["Notification OFF","Notification ON"],desc:"Create a notification when the maximum amount of Wrinklers has appeared",toggle:true,func:function(){CM.Config.CheckNotificationPermissions(CM.Options.WrinklerMaxNotification)}};CM.Data.Config.WrinklerMaxFlash={type:"bool",group:"NotificationWrinkMax",label:["Flash OFF","Flash ON"],desc:"Flash screen when the maximum amount of Wrinklers has appeared",toggle:true};CM.Data.Config.WrinklerMaxSound={type:"bool",group:"NotificationWrinkMax",label:["Sound OFF","Sound ON"],desc:"Play a sound when the maximum amount of Wrinklers has appeared",toggle:true};CM.Data.Config.WrinklerMaxVolume={type:"vol",group:"NotificationWrinkMax",label:[],desc:"Volume"};for(let i=0;i<101;i++){CM.Data.Config.WrinklerMaxVolume.label[i]=i+"%"}CM.Data.Config.WrinklerMaxSoundURL={type:"url",group:"NotificationWrinkMax",label:"Sound URL:",desc:"URL of the sound to be played when the maximum amount of Wrinklers has appeared"};CM.Data.Config.TooltipBuildUpgrade={type:"bool",group:"Tooltip",label:["Building/Upgrade Tooltip Information OFF","Building/Upgrade Tooltip Information ON"],desc:"Extra information in Building/Upgrade tooltips",toggle:true};CM.Data.Config.TooltipAmor={type:"bool",group:"Tooltip",label:["Buildings Tooltip Amortization Information OFF","Buildings Tooltip Amortization Information ON"],desc:"Add amortization information to buildings tooltip",toggle:true};CM.Data.Config.ToolWarnLucky={type:"bool",group:"Tooltip",label:["Tooltip Lucky Warning OFF","Tooltip Lucky Warning ON"],desc:'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards',toggle:true};CM.Data.Config.ToolWarnLuckyFrenzy={type:"bool",group:"Tooltip",label:["Tooltip Lucky Frenzy Warning OFF","Tooltip Lucky Frenzy Warning ON"],desc:'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards',toggle:true};CM.Data.Config.ToolWarnConjure={type:"bool",group:"Tooltip",label:["Tooltip Conjure Warning OFF","Tooltip Conjure Warning ON"],desc:'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards',toggle:true};CM.Data.Config.ToolWarnConjureFrenzy={type:"bool",group:"Tooltip",label:["Tooltip Conjure Frenzy Warning OFF","Tooltip Conjure Frenzy Warning ON"],desc:'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active',toggle:true};CM.Data.Config.ToolWarnEdifice={type:"bool",group:"Tooltip",label:["Tooltip Edifice Warning OFF","Tooltip Edifice Warning ON"],desc:'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building',toggle:true};CM.Data.Config.ToolWarnPos={type:"bool",group:"Tooltip",label:["Tooltip Warning Position (Left)","Tooltip Warning Position (Bottom)"],desc:"Placement of the warning boxes",toggle:false,func:function(){CM.Disp.ToggleToolWarnPos()}};CM.Data.Config.TooltipGrim={type:"bool",group:"Tooltip",label:["Grimoire Tooltip Information OFF","Grimoire Tooltip Information ON"],desc:"Extra information in tooltip for grimoire",toggle:true};CM.Data.Config.TooltipWrink={type:"bool",group:"Tooltip",label:["Wrinkler Tooltip OFF","Wrinkler Tooltip ON"],desc:"Shows the amount of cookies a wrinkler will give when popping it",toggle:true};CM.Data.Config.TooltipLump={type:"bool",group:"Tooltip",label:["Sugar Lump Tooltip OFF","Sugar Lump Tooltip ON"],desc:"Shows the current Sugar Lump type in Sugar lump tooltip.",toggle:true};CM.Data.Config.TooltipPlots={type:"bool",group:"Tooltip",label:["Garden Plots Tooltip OFF","Garden Plots Tooltip ON"],desc:"Shows a tooltip for plants that have a cookie reward.",toggle:true};CM.Data.Config.DragonAuraInfo={type:"bool",group:"Tooltip",label:["Extra Dragon Aura Info OFF","Extra Dragon Aura Info ON"],desc:"Shows information about changes in CPS and costs in the dragon aura interface.",toggle:true};CM.Data.Config.TooltipAscendButton={type:"bool",group:"Tooltip",label:["Show Time Left Ascend Tooltip OFF","Show Time Left Ascend Tooltip ON"],desc:"Shows the time left in the ascend tooltip until next heavenly cookie.",toggle:true};CM.Data.Config.Stats={type:"bool",group:"Statistics",label:["Statistics OFF","Statistics ON"],desc:"Extra Cookie Monster statistics!",toggle:true};CM.Data.Config.MissingUpgrades={type:"bool",group:"Statistics",label:["Missing Upgrades OFF","Missing Upgrades ON"],desc:"Shows Missing upgrades in Stats Menu. This feature can be laggy for users with a low amount of unlocked achievements.",toggle:true};CM.Data.Config.UpStats={type:"bool",group:"Statistics",label:["Statistics Update Rate (Default)","Statistics Update Rate (1s)"],desc:"Default Game rate is once every 5 seconds",toggle:false};CM.Data.Config.TimeFormat={type:"bool",group:"Statistics",label:["Time XXd, XXh, XXm, XXs","Time XX:XX:XX:XX:XX"],desc:"Change the time format",toggle:false};CM.Data.Config.DetailedTime={type:"bool",group:"Statistics",label:["Detailed Time OFF","Detailed Time ON"],desc:"Change how time is displayed in certain statistics and tooltips",toggle:true,func:function(){CM.Disp.ToggleDetailedTime()}};CM.Data.Config.GrimoireBar={type:"bool",group:"Statistics",label:["Grimoire Magic Meter Timer OFF","Grimoire Magic Meter Timer ON"],desc:"A timer on how long before the Grimoire magic meter is full",toggle:true};CM.Data.Config.Scale={type:"bool",group:"Notation",label:["Game's Setting Scale","Metric","Short Scale","Short Scale (Abbreviated)","Scientific Notation","Engineering Notation"],desc:"Change how long numbers are handled",toggle:false,func:function(){CM.Disp.RefreshScale()}};CM.Data.Config.ScaleDecimals={type:"bool",group:"Notation",label:["1 decimals","2 decimals","3 decimals"],desc:"Set the number of decimals used when applicable",toggle:false,func:function(){CM.Disp.RefreshScale()}};CM.Data.Config.ScaleSeparator={type:"bool",group:"Notation",label:[". for decimals (Standard)",". for thousands"],desc:"Set the separator used for decimals and thousands",toggle:false,func:function(){CM.Disp.RefreshScale()}};CM.Data.Config.ScaleCutoff={type:"numscale",group:"Notation",label:"Notation Cut-off Point",desc:"The number from which CookieMonster will start formatting numbers based on chosen scale. Standard is 999,999. Setting this above 999,999,999 might break certain notations.",min:1,max:999999999};CM.Data.Config.GCTimer={type:"bool",group:"Miscellaneous",label:["Golden Cookie Timer OFF","Golden Cookie Timer ON"],desc:"A timer on the Golden Cookie when it has been spawned",toggle:true,func:function(){CM.Disp.ToggleGCTimer()}};CM.Data.Config.Favicon={type:"bool",group:"Miscellaneous",label:["Favicon OFF","Favicon ON"],desc:"Update favicon with Golden/Wrath Cookie",toggle:true,func:function(){CM.Disp.UpdateFavicon()}};CM.Data.Config.WrinklerButtons={type:"bool",group:"Miscellaneous",label:["Extra Buttons OFF","Extra Buttons ON"],desc:"Show buttons for popping wrinklers at bottom of cookie section",toggle:true,func:function(){CM.Disp.UpdateWrinklerButtons()}};CM.Data.Config.BulkBuyBlock={type:"bool",group:"Miscellaneous",label:["Block Bulk Buying OFF","Block Bulk Buying ON"],desc:"Block clicking bulk buying when you can't buy all. This prevents buying 7 of a building when you are in buy-10 or buy-100 mode.",toggle:true};CM.Data.ConfigDefault={BotBar:1,TimerBar:1,TimerBarPos:0,TimerBarOverlay:2,BuildColor:1,BulkBuildColor:0,ColorPPBulkMode:0,UpBarColor:1,UpgradeBarFixedPos:1,CalcWrink:0,CPSMode:1,AvgCPSHist:3,AvgClicksHist:0,ToolWarnBon:0,Title:1,GeneralSound:1,GCNotification:0,GCFlash:1,GCSound:1,GCVolume:100,GCSoundURL:"https://freesound.org/data/previews/66/66717_931655-lq.mp3",FortuneNotification:0,FortuneFlash:1,FortuneSound:1,FortuneVolume:100,FortuneSoundURL:"https://freesound.org/data/previews/174/174027_3242494-lq.mp3",SeaNotification:0,SeaFlash:1,SeaSound:1,SeaVolume:100,SeaSoundURL:"https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3",GardFlash:1,GardSound:1,GardVolume:100,GardSoundURL:"https://freesound.org/data/previews/103/103046_861714-lq.mp3",MagicNotification:0,MagicFlash:1,MagicSound:1,MagicVolume:100,MagicSoundURL:"https://freesound.org/data/previews/221/221683_1015240-lq.mp3",WrinklerNotification:0,WrinklerFlash:1,WrinklerSound:1,WrinklerVolume:100,WrinklerSoundURL:"https://freesound.org/data/previews/124/124186_8043-lq.mp3",WrinklerMaxNotification:0,WrinklerMaxFlash:1,WrinklerMaxSound:1,WrinklerMaxVolume:100,WrinklerMaxSoundURL:"https://freesound.org/data/previews/152/152743_15663-lq.mp3",TooltipBuildUpgrade:1,TooltipAmor:0,ToolWarnLucky:1,ToolWarnLuckyFrenzy:1,ToolWarnConjure:1,ToolWarnConjureFrenzy:1,ToolWarnEdifice:1,ToolWarnPos:1,TooltipGrim:1,TooltipWrink:1,TooltipLump:1,TooltipPlots:1,DragonAuraInfo:1,TooltipAscendButton:1,Stats:1,MissingUpgrades:1,UpStats:1,TimeFormat:0,DetailedTime:1,GrimoireBar:1,Scale:2,ScaleDecimals:2,ScaleSeparator:0,ScaleCutoff:999999,Colors:{Blue:"#4bb8f0",Green:"#00ff00",Yellow:"#ffff00",Orange:"#ff7f00",Red:"#ff0000",Purple:"#ff00ff",Gray:"#b3b3b3",Pink:"#ff1493",Brown:"#8b4513"},SortBuildings:0,SortUpgrades:0,GCTimer:1,Favicon:1,WrinklerButtons:1,BulkBuyBlock:0,Header:{BarsColors:1,Calculation:1,Notification:1,NotificationGeneral:1,NotificationGC:1,NotificationFC:1,NotificationSea:1,NotificationGard:1,NotificationMagi:1,NotificationWrink:1,NotificationWrinkMax:1,Tooltip:1,Statistics:1,Notation:1,Miscellaneous:1,Lucky:1,Spells:1,Chain:1,Prestige:1,Wrink:1,Sea:1,Misc:1}};CM.Disp.GetWrinkConfigBank=function(){if(CM.Options.CalcWrink===1){return CM.Cache.WrinklersTotal}else if(CM.Options.CalcWrink===2){return CM.Cache.WrinklersFattest[0]}else{return 0}};CM.Disp.PopAllNormalWrinklers=function(){for(let i of Object.keys(Game.wrinklers)){if(Game.wrinklers[i].sucked>0&&Game.wrinklers[i].type===0){Game.wrinklers[i].hp=0}}};CM.Disp.GetCPS=function(){if(CM.Options.CPSMode){return CM.Cache.AvgCPS}else{if(CM.Options.CalcWrink===0){return Game.cookiesPs*(1-Game.cpsSucked)}else if(CM.Options.CalcWrink===1){return Game.cookiesPs*(CM.Cache.CurrWrinklerCPSMult+(1-CM.Cache.CurrWrinklerCount*.05))}else if(CM.Options.CalcWrink===2){if(Game.wrinklers[CM.Cache.WrinklersFattest[1]].type===1){return Game.cookiesPs*(CM.Cache.CurrWrinklerCPSMult*3/CM.Cache.CurrWrinklerCount+(1-CM.Cache.CurrWrinklerCount*.05))}else{return Game.cookiesPs*(CM.Cache.CurrWrinklerCPSMult/CM.Cache.CurrWrinklerCount+(1-CM.Cache.CurrWrinklerCount*.05))}}}};CM.Disp.CalculateGrimoireRefillTime=function(currentMagic,maxMagic,targetMagic){let count=0;while(currentMagic315576e4)return"XX:XX:XX:XX:XX";str+=(y<10?"0":"")+y+":";str+=(d<10?"0":"")+d+":";str+=(h<10?"0":"")+h+":";str+=(m<10?"0":"")+m+":";str+=(s<10?"0":"")+s}else{if(time>7776e5)return longFormat?"Over 9000 days!":">9000d";str+=y>0?y+(longFormat?y===1?" year":" years":"y")+", ":"";str+=d>0?d+(longFormat?d===1?" day":" days":"d")+", ":"";if(str.length>0||h>0)str+=h+(longFormat?h===1?" hour":" hours":"h")+", ";if(str.length>0||m>0)str+=m+(longFormat?m===1?" minute":" minutes":"m")+", ";str+=s+(longFormat?s===1?" second":" seconds":"s")}return str};CM.Disp.GetTimeColor=function(time){let color;let text;if(time<0){if(CM.Options.TimeFormat)text="00:00:00:00:00";else text="Done!";color=CM.Disp.colorGreen}else{text=CM.Disp.FormatTime(time);if(time>300)color=CM.Disp.colorRed;else if(time>60)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow}return{text:text,color:color}};CM.Disp.Beautify=function(num,floats,forced){let decimals=CM.Options.ScaleDecimals+1;if(CM.Options.Scale===0){return CM.Backup.Beautify(num,floats)}else if(isFinite(num)){let answer="";if(num===0){return num.toString()}else if(.001=.01&&num=.01&&num=.01&&num=1)l("CMTimerBarGCMinBar").textContent=Math.ceil((Game.shimmerTypes.golden.minTime-Game.shimmerTypes.golden.time)/Game.fps);else l("CMTimerBarGCMinBar").textContent="";if(Game.shimmerTypes.golden.minTime===Game.shimmerTypes.golden.maxTime){l("CMTimerBarGCMinBar").style.borderTopRightRadius="10px";l("CMTimerBarGCMinBar").style.borderBottomRightRadius="10px"}else{l("CMTimerBarGCMinBar").style.borderTopRightRadius="";l("CMTimerBarGCMinBar").style.borderBottomRightRadius=""}l("CMTimerBarGCBar").style.width=Math.round(Math.min(Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.minTime,Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)*maxWidthTwoBar/Game.shimmerTypes.golden.maxTime)+"px";if(CM.Options.TimerBarOverlay>=1)l("CMTimerBarGCBar").textContent=Math.ceil(Math.min(Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.minTime,Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)/Game.fps);else l("CMTimerBarGCBar").textContent="";l("CMTimerBarGCTime").textContent=Math.ceil((Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)/Game.fps);numberOfTimers++}else CM.Disp.TimerBars.CMTimerBarGC.style.display="none";if(Game.season==="christmas"&&Game.shimmerTypes.reindeer.spawned===0){CM.Disp.TimerBars.CMTimerBarRen.style.display="";l("CMTimerBarRenMinBar").style.width=Math.round(Math.max(0,Game.shimmerTypes.reindeer.minTime-Game.shimmerTypes.reindeer.time)*maxWidthTwoBar/Game.shimmerTypes.reindeer.maxTime)+"px";if(CM.Options.TimerBarOverlay>=1)l("CMTimerBarRenMinBar").textContent=Math.ceil((Game.shimmerTypes.reindeer.minTime-Game.shimmerTypes.reindeer.time)/Game.fps);else l("CMTimerBarRenMinBar").textContent="";l("CMTimerBarRenBar").style.width=Math.round(Math.min(Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.minTime,Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)*maxWidthTwoBar/Game.shimmerTypes.reindeer.maxTime)+"px";if(CM.Options.TimerBarOverlay>=1)l("CMTimerBarRenBar").textContent=Math.ceil(Math.min(Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.minTime,Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps);else l("CMTimerBarRenBar").textContent="";l("CMTimerBarRenTime").textContent=Math.ceil((Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps);numberOfTimers++}else{CM.Disp.TimerBars.CMTimerBarRen.style.display="none"}for(let i of Object.keys(CM.Disp.BuffTimerBars)){CM.Disp.BuffTimerBars[i].remove()}CM.Disp.BuffTimerBars={};for(let i of Object.keys(Game.buffs)){if(Game.buffs[i]){let timer=CM.Disp.TimerBarCreateBar(Game.buffs[i].name,Game.buffs[i].name,[{id:Game.buffs[i].name+"Bar"}]);timer.style.display="";let classColor="";if(typeof CM.Disp.buffColors[Game.buffs[i].name]!=="undefined"){classColor=CM.Disp.buffColors[Game.buffs[i].name]}else classColor=CM.Disp.colorPurple;timer.lastChild.children[1].className=CM.Disp.colorBackPre+classColor;timer.lastChild.children[1].style.color="black";if(CM.Options.TimerBarOverlay===2)timer.lastChild.children[1].textContent=Math.round(100*(Game.buffs[i].time/Game.buffs[i].maxTime))+"%";else timer.lastChild.children[1].textContent="";timer.lastChild.children[1].style.width=Math.round(Game.buffs[i].time*(maxWidthOneBar-Math.ceil(Game.buffs[i].time/Game.fps).toString().length*8)/Game.buffs[i].maxTime)+"px";timer.lastChild.children[2].textContent=Math.ceil(Game.buffs[i].time/Game.fps);numberOfTimers++;CM.Disp.BuffTimerBars[Game.buffs[i].name]=timer}}for(let i of Object.keys(CM.Disp.BuffTimerBars)){CM.Disp.TimerBar.appendChild(CM.Disp.BuffTimerBars[i])}if(numberOfTimers!=0){CM.Disp.TimerBar.style.height=numberOfTimers*12+2+"px"}if(CM.Disp.LastNumberOfTimers!=numberOfTimers){CM.Disp.LastNumberOfTimers=numberOfTimers;CM.Disp.UpdateBotTimerBarPosition()}}};CM.Disp.ToggleTimerBar=function(){if(CM.Options.TimerBar===1)CM.Disp.TimerBar.style.display="";else CM.Disp.TimerBar.style.display="none";CM.Disp.UpdateBotTimerBarPosition()};CM.Disp.ToggleTimerBarPos=function(){if(CM.Options.TimerBarPos===0){CM.Disp.TimerBar.style.width="30%";CM.Disp.TimerBar.style.bottom="";l("game").insertBefore(CM.Disp.TimerBar,l("sectionLeft"))}else{CM.Disp.TimerBar.style.width="100%";CM.Disp.TimerBar.style.bottom="0px";l("wrapper").appendChild(CM.Disp.TimerBar)}CM.Disp.UpdateBotTimerBarPosition()};CM.Disp.UpdateBotTimerBarPosition=function(){if(CM.Options.BotBar===1&&CM.Options.TimerBar===1&&CM.Options.TimerBarPos===1){CM.Disp.BotBar.style.bottom=CM.Disp.TimerBar.style.height;l("game").style.bottom=Number(CM.Disp.TimerBar.style.height.replace("px",""))+70+"px"}else if(CM.Options.BotBar===1){CM.Disp.BotBar.style.bottom="0px";l("game").style.bottom="70px"}else if(CM.Options.TimerBar===1&&CM.Options.TimerBarPos===1){l("game").style.bottom=CM.Disp.TimerBar.style.height}else{l("game").style.bottom="0px"}if(CM.Options.TimerBar===1&&CM.Options.TimerBarPos===0){l("sectionLeft").style.top=CM.Disp.TimerBar.style.height}else{l("sectionLeft").style.top=""}CM.Disp.UpdateBackground()};CM.Disp.UpdateBuildings=function(){let target=`Objects${Game.buyBulk}`;if(Game.buyMode===1){if(CM.Options.BuildColor===1){for(let i of Object.keys(CM.Cache[target])){l("productPrice"+Game.Objects[i].id).style.color=CM.Options.Colors[CM.Cache[target][i].color]}}else{for(let i of Object.keys(Game.Objects)){l("productPrice"+Game.Objects[i].id).style.removeProperty("color")}}}else if(Game.buyMode===-1){for(let i of Object.keys(CM.Cache.Objects1)){let o=Game.Objects[i];l("productPrice"+o.id).style.color="";l("productPrice"+o.id).innerHTML=Beautify(CM.Sim.BuildingSell(o,o.basePrice,o.amount,o.free,Game.buyBulk,1))}}if(Game.buyMode===1&&CM.Options.SortBuildings){let arr=Object.keys(CM.Cache[target]).map((k=>{let o=CM.Cache[target][k];o.name=k;o.id=Game.Objects[k].id;return o}));arr.sort((function(a,b){return a.pp>b.pp?1:a.pp{let o=CM.Cache.Objects1[k];o.name=k;o.id=Game.Objects[k].id;return o}));arr.sort(((a,b)=>a.id-b.id));for(let x=0;x0){let blue=0;let green=0;let yellow=0;let orange=0;let red=0;let purple=0;let gray=0;for(let i of Object.keys(Game.UpgradesInStore)){let me=Game.UpgradesInStore[i];let addedColor=false;for(let j=0;ja.pp-b.pp))}else{arr.sort(((a,b)=>a.price-b.price))}let nameChecker=function(arr,upgrade){return arr.findIndex((e=>e.name===upgrade.name))};for(let x=0;x0){if(CM.Cache.spawnedGoldenShimmer.wrath)CM.Disp.Favicon.href="https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico";else CM.Disp.Favicon.href="https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico"}else CM.Disp.Favicon.href="https://orteil.dashnet.org/cookieclicker/favicon.ico"};CM.Disp.UpdateTitle=function(){if(Game.OnAscend||CM.Options.Title===0){document.title=CM.Disp.Title}else if(CM.Options.Title===1){let addFC=false;let addSP=false;let titleGC;let titleFC;let titleSP;if(CM.Cache.spawnedGoldenShimmer){if(CM.Cache.spawnedGoldenShimmer.wrath)titleGC=`[W${Math.ceil(CM.Cache.spawnedGoldenShimmer.life/Game.fps)}]`;else titleGC=`[G${Math.ceil(CM.Cache.spawnedGoldenShimmer.life/Game.fps)}]`}else if(!Game.Has("Golden switch [off]")){titleGC=`[${Number(l("CMTimerBarGCMinBar").textContent)<0?"!":""}${Math.ceil((Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)/Game.fps)}]`}else titleGC="[GS]";if(CM.Main.lastTickerFortuneState){addFC=true;titleFC="[F]"}if(Game.season==="christmas"){addSP=true;if(CM.Main.lastSeasonPopupState)titleSP=`[R${Math.ceil(CM.Cache.seasonPopShimmer.life/Game.fps)}]`;else{titleSP=`[${Number(l("CMTimerBarRenMinBar").textContent)<0?"!":""}${Math.ceil((Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps)}]`}}let str=CM.Disp.Title;if(str.charAt(0)==="["){str=str.substring(str.lastIndexOf("]")+1)}document.title=titleGC+(addFC?titleFC:"")+(addSP?titleSP:"")+" "+str}else if(CM.Options.Title===2){let str="";let spawn=false;if(CM.Cache.spawnedGoldenShimmer){spawn=true;if(CM.Cache.spawnedGoldenShimmer.wrath)str+=`[W${Math.ceil(CM.Cache.spawnedGoldenShimmer.life/Game.fps)}]`;else str+=`[G${Math.ceil(CM.Cache.spawnedGoldenShimmer.life/Game.fps)}]`}if(CM.Main.lastTickerFortuneState){spawn=true;str+="[F]"}if(Game.season==="christmas"&&CM.Main.lastSeasonPopupState){str+=`[R${Math.ceil(CM.Cache.seasonPopShimmer.life/Game.fps)}]`;spawn=true}if(spawn)str+=" - ";let title="Cookie Clicker";if(Game.season==="fools")title="Cookie Baker";str+=title;document.title=str}};CM.Disp.CreateGCTimer=function(cookie){let GCTimer=document.createElement("div");GCTimer.id="GCTimer"+cookie.id;GCTimer.style.width="96px";GCTimer.style.height="96px";GCTimer.style.position="absolute";GCTimer.style.zIndex="10000000001";GCTimer.style.textAlign="center";GCTimer.style.lineHeight="96px";GCTimer.style.fontFamily='"Kavoon", Georgia, serif';GCTimer.style.fontSize="35px";GCTimer.style.cursor="pointer";GCTimer.style.display="block";if(CM.Options.GCTimer===0)GCTimer.style.display="none";GCTimer.style.left=cookie.l.style.left;GCTimer.style.top=cookie.l.style.top;GCTimer.onclick=function(){cookie.pop()};GCTimer.onmouseover=function(){cookie.l.style.filter="brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))";cookie.l.style.webkitFilter="brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))"};GCTimer.onmouseout=function(){cookie.l.style.filter="";cookie.l.style.webkitFilter=""};CM.Disp.GCTimers[cookie.id]=GCTimer;l("shimmers").appendChild(GCTimer)};CM.Disp.ToggleGCTimer=function(){if(CM.Options.GCTimer===1){for(let i of Object.keys(CM.Disp.GCTimers)){CM.Disp.GCTimers[i].style.display="block";CM.Disp.GCTimers[i].style.left=CM.Cache.goldenShimmersByID[i].l.style.left;CM.Disp.GCTimers[i].style.top=CM.Cache.goldenShimmersByID[i].l.style.top}}else{for(let i of Object.keys(CM.Disp.GCTimers))CM.Disp.GCTimers[i].style.display="none"}};CM.Disp.CreateSimpleTooltip=function(placeholder,text,minWidth){CM.Disp[placeholder]=document.createElement("div");let desc=document.createElement("div");desc.style.minWidth=minWidth;desc.style.marginBottom="4px";let div=document.createElement("div");div.style.textAlign="left";div.textContent=text;desc.appendChild(div);CM.Disp[placeholder].appendChild(desc)};CM.Disp.ReplaceTooltipUpgrade=function(){CM.Disp.TooltipUpgradeBackup=[];for(let i of Object.keys(Game.UpgradesInStore)){if(l("upgrade"+i).onmouseover!=null){CM.Disp.TooltipUpgradeBackup[i]=l("upgrade"+i).onmouseover;l("upgrade"+i).onmouseover=function(){if(!Game.mouseDown){Game.setOnCrate(this);Game.tooltip.dynamic=1;Game.tooltip.draw(this,(function(){return CM.Disp.Tooltip("u",`${i}`)}),"store");Game.tooltip.wobble()}}}}};CM.Disp.Tooltip=function(type,name){if(type==="b"){l("tooltip").innerHTML=Game.Objects[name].tooltip();if(CM.Options.TooltipAmor===1){let buildPrice=CM.Sim.BuildingGetPrice(Game.Objects[name],Game.Objects[name].basePrice,0,Game.Objects[name].free,Game.Objects[name].amount);let amortizeAmount=buildPrice-Game.Objects[name].totalCookies;if(amortizeAmount>0){l("tooltip").innerHTML=l("tooltip").innerHTML.split("so far").join("so far
"+Beautify(amortizeAmount)+" "+(Math.floor(amortizeAmount)===1?"cookie":"cookies")+" left to amortize ("+CM.Disp.GetTimeColor((buildPrice-Game.Objects[name].totalCookies)/(Game.Objects[name].storedTotalCps*Game.globalCpsMult)).text+")")}}if(Game.buyMode===-1){l("tooltip").innerHTML=l("tooltip").innerHTML.split(Beautify(Game.Objects[name].bulkPrice)).join(Beautify(CM.Sim.BuildingSell(Game.Objects[name],Game.Objects[name].basePrice,Game.Objects[name].amount,Game.Objects[name].free,Game.buyBulk,1)))}}else if(type==="u"){if(!Game.UpgradesInStore[name])return"";l("tooltip").innerHTML=Game.crateTooltip(Game.UpgradesInStore[name],"store")}else if(type==="s")l("tooltip").innerHTML=Game.lumpTooltip();else if(type==="g")l("tooltip").innerHTML=Game.Objects["Wizard tower"].minigame.spellTooltip(name)();else if(type==="p")l("tooltip").innerHTML=Game.ObjectsById[2].minigame.tileTooltip(name[0],name[1])();else if(type==="ha")l("tooltip").innerHTML=Game.ObjectsById[2].minigame.toolTooltip(1)();if(type==="b"&&Game.buyMode===1||type==="u"||type==="s"||type==="g"||type==="p"||type==="ha"){let area=document.createElement("div");area.id="CMTooltipArea";l("tooltip").appendChild(area)}CM.Disp.tooltipType=type;CM.Disp.tooltipName=name;CM.Disp.UpdateTooltip();return l("tooltip").innerHTML};CM.Disp.TooltipCreateTooltipBox=function(){l("tooltip").firstChild.style.paddingBottom="4px";let tooltipBox=document.createElement("div");tooltipBox.style.border="1px solid";tooltipBox.style.padding="4px";tooltipBox.style.margin="0px -4px";tooltipBox.id="CMTooltipBorder";tooltipBox.className=CM.Disp.colorTextPre+CM.Disp.colorGray;return tooltipBox};CM.Disp.TooltipCreateHeader=function(text){let div=document.createElement("div");div.style.fontWeight="bold";div.className=CM.Disp.colorTextPre+CM.Disp.colorBlue;div.textContent=text;return div};CM.Disp.TooltipCreateCalculationSection=function(tooltip){tooltip.appendChild(CM.Disp.TooltipCreateHeader("Bonus Income"));let income=document.createElement("div");income.style.marginBottom="4px";income.style.color="white";income.id="CMTooltipIncome";tooltip.appendChild(income);tooltip.appendChild(CM.Disp.TooltipCreateHeader("Bonus Cookies per Click"));tooltip.lastChild.style.display="none";let click=document.createElement("div");click.style.marginBottom="4px";click.style.color="white";click.style.display="none";click.id="CMTooltipCookiePerClick";tooltip.appendChild(click);tooltip.appendChild(CM.Disp.TooltipCreateHeader("Payback Period"));let pp=document.createElement("div");pp.style.marginBottom="4px";pp.id="CMTooltipPP";tooltip.appendChild(pp);tooltip.appendChild(CM.Disp.TooltipCreateHeader("Time Left"));let time=document.createElement("div");time.id="CMTooltipTime";tooltip.appendChild(time);if(CM.Disp.tooltipType==="b"){tooltip.appendChild(CM.Disp.TooltipCreateHeader("Production left till next achievement"));tooltip.lastChild.id="CMTooltipProductionHeader";let production=document.createElement("div");production.id="CMTooltipProduction";tooltip.appendChild(production)}};CM.Disp.TooltipCreateWarningSection=function(){CM.Disp.TooltipWarn=document.createElement("div");CM.Disp.TooltipWarn.style.position="absolute";CM.Disp.TooltipWarn.style.display="block";CM.Disp.TooltipWarn.style.left="auto";CM.Disp.TooltipWarn.style.bottom="auto";CM.Disp.TooltipWarn.id="CMDispTooltipWarningParent";let create=function(boxId,color,labelTextFront,labelTextBack,deficitId){let box=document.createElement("div");box.id=boxId;box.style.display="none";box.style.transition="opacity 0.1s ease-out";box.className=CM.Disp.colorBorderPre+color;box.style.padding="2px";box.style.background="#000 url(img/darkNoise.png)";let labelDiv=document.createElement("div");box.appendChild(labelDiv);let labelSpan=document.createElement("span");labelSpan.className=CM.Disp.colorTextPre+color;labelSpan.style.fontWeight="bold";labelSpan.textContent=labelTextFront;labelDiv.appendChild(labelSpan);labelDiv.appendChild(document.createTextNode(labelTextBack));let deficitDiv=document.createElement("div");box.appendChild(deficitDiv);let deficitSpan=document.createElement("span");deficitSpan.id=deficitId;deficitDiv.appendChild(document.createTextNode("Deficit: "));deficitDiv.appendChild(deficitSpan);return box};CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnLucky",CM.Disp.colorRed,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Lucky!"',"CMDispTooltipWarnLuckyText"));CM.Disp.TooltipWarn.firstChild.style.marginBottom="4px";CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnLuckyFrenzy",CM.Disp.colorYellow,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Lucky!" (Frenzy)',"CMDispTooltipWarnLuckyFrenzyText"));CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px";CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnConjure",CM.Disp.colorPurple,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"',"CMDispTooltipWarnConjureText"));CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px";CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnConjureFrenzy",CM.Disp.colorPurple,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)',"CMDispTooltipWarnConjureFrenzyText"));CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px";CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnEdifice",CM.Disp.colorPurple,"Warning: ",'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"',"CMDispTooltipWarnEdificeText"));return CM.Disp.TooltipWarn};CM.Disp.UpdateTooltip=function(){CM.Sim.CopyData();if(l("tooltipAnchor").style.display!="none"&&l("CMTooltipArea")){l("CMTooltipArea").innerHTML="";let tooltipBox=CM.Disp.TooltipCreateTooltipBox();l("CMTooltipArea").appendChild(tooltipBox);if(CM.Disp.tooltipType==="b"){CM.Disp.UpdateTooltipBuilding()}else if(CM.Disp.tooltipType==="u"){CM.Disp.UpdateTooltipUpgrade()}else if(CM.Disp.tooltipType==="s"){CM.Disp.UpdateTooltipSugarLump()}else if(CM.Disp.tooltipType==="g"){CM.Disp.UpdateTooltipGrimoire()}else if(CM.Disp.tooltipType==="p"){CM.Disp.UpdateTooltipGardenPlots()}else if(CM.Disp.tooltipType==="ha"){CM.Disp.UpdateTooltipHarvestAll()}CM.Disp.UpdateTooltipWarnings()}else if(l("CMTooltipArea")===null){if(l("CMDispTooltipWarningParent")!=null){l("CMDispTooltipWarningParent").remove()}}};CM.Disp.UpdateTooltipBuilding=function(){if(CM.Options.TooltipBuildUpgrade===1&&Game.buyMode===1){let tooltipBox=l("CMTooltipBorder");CM.Disp.TooltipCreateCalculationSection(tooltipBox);let target=`Objects${Game.buyBulk}`;CM.Disp.TooltipPrice=Game.Objects[CM.Disp.tooltipName].bulkPrice;CM.Disp.TooltipBonusIncome=CM.Cache[target][CM.Disp.tooltipName].bonus;if(CM.Options.TooltipBuildUpgrade===1&&Game.buyMode===1){l("CMTooltipIncome").textContent=Beautify(CM.Disp.TooltipBonusIncome,2);let increase=Math.round(CM.Disp.TooltipBonusIncome/Game.cookiesPs*1e4);if(isFinite(increase)&&increase!=0){l("CMTooltipIncome").textContent+=" ("+increase/100+"% of income)"}l("CMTooltipBorder").className=CM.Disp.colorTextPre+CM.Cache[target][CM.Disp.tooltipName].color;l("CMTooltipPP").textContent=Beautify(CM.Cache[target][CM.Disp.tooltipName].pp,2);l("CMTooltipPP").className=CM.Disp.colorTextPre+CM.Cache[target][CM.Disp.tooltipName].color;let timeColor=CM.Disp.GetTimeColor((CM.Disp.TooltipPrice-(Game.cookies+CM.Disp.GetWrinkConfigBank()))/CM.Disp.GetCPS());l("CMTooltipTime").textContent=timeColor.text;if(timeColor.text==="Done!"&&Game.cookiesminigame.plantsById[minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0]-1].matureBase;let plantName=minigame.plantsById[minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0]-1].name;l("CMTooltipBorder").appendChild(CM.Disp.TooltipCreateHeader("Reward (Current / Maximum)"));let reward=document.createElement("div");reward.id="CMTooltipPlantReward";l("CMTooltipBorder").appendChild(reward);if(plantName==="Bakeberry"){l("CMTooltipPlantReward").textContent=(mature?CM.Disp.Beautify(Math.min(Game.cookies*.03,Game.cookiesPs*60*30)):"0")+" / "+CM.Disp.Beautify(Game.cookiesPs*60*30)}else if(plantName==="Chocoroot"||plantName==="White chocoroot"){l("CMTooltipPlantReward").textContent=(mature?CM.Disp.Beautify(Math.min(Game.cookies*.03,Game.cookiesPs*60*3)):"0")+" / "+CM.Disp.Beautify(Game.cookiesPs*60*3)}else if(plantName==="Queenbeet"){l("CMTooltipPlantReward").textContent=(mature?CM.Disp.Beautify(Math.min(Game.cookies*.04,Game.cookiesPs*60*60)):"0")+" / "+CM.Disp.Beautify(Game.cookiesPs*60*60)}else if(plantName==="Duketater"){l("CMTooltipPlantReward").textContent=(mature?CM.Disp.Beautify(Math.min(Game.cookies*.08,Game.cookiesPs*60*120)):"0")+" / "+CM.Disp.Beautify(Game.cookiesPs*60*120)}else l("CMTooltipArea").style.display="none"}else l("CMTooltipArea").style.display="none"};CM.Disp.UpdateTooltipHarvestAll=function(){let minigame=Game.Objects.Farm.minigame;if(CM.Options.TooltipLump){l("CMTooltipBorder").appendChild(CM.Disp.TooltipCreateHeader("Cookies gained from harvesting:"));let totalGain=0;let mortal=0;if(Game.keys[16]&&Game.keys[17])mortal=1;for(let y=0;y<6;y++){for(let x=0;x<6;x++){if(minigame.plot[y][x][0]>=1){let tile=minigame.plot[y][x];let me=minigame.plantsById[tile[0]-1];let plantName=me.name;let count=true;if(mortal&&me.immortal)count=false;if(tile[1]0&&me.selected){showingTooltip=true;if(CM.Disp.TooltipWrinklerBeingShown[i]===0||CM.Disp.TooltipWrinklerBeingShown[i]===undefined){let placeholder=document.createElement("div");let wrinkler=document.createElement("div");wrinkler.style.minWidth="120px";wrinkler.style.marginBottom="4px";let div=document.createElement("div");div.style.textAlign="center";div.id="CMTooltipWrinkler";wrinkler.appendChild(div);placeholder.appendChild(wrinkler);Game.tooltip.draw(this,escape(placeholder.innerHTML));CM.Disp.TooltipWrinkler=i;CM.Disp.TooltipWrinklerBeingShown[i]=1}else break}else{CM.Disp.TooltipWrinklerBeingShown[i]=0}}if(!showingTooltip){Game.tooltip.hide()}}};CM.Disp.UpdateWrinklerTooltip=function(){if(CM.Options.TooltipWrink===1&&l("CMTooltipWrinkler")!=null){let sucked=Game.wrinklers[CM.Disp.TooltipWrinkler].sucked;let toSuck=1.1;if(Game.Has("Sacrilegious corruption"))toSuck*=1.05;if(Game.wrinklers[CM.Disp.TooltipWrinkler].type===1)toSuck*=3;sucked*=toSuck;if(Game.Has("Wrinklerspawn"))sucked*=1.05;if(CM.Sim.Objects.Temple.minigameLoaded){let godLvl=Game.hasGod("scorn");if(godLvl===1)sucked*=1.15;else if(godLvl===2)sucked*=1.1;else if(godLvl===3)sucked*=1.05}l("CMTooltipWrinkler").textContent=Beautify(sucked)}};CM.Disp.AddAuraInfo=function(aura){if(CM.Options.DragonAuraInfo===1){let[bonusCPS,priceOfChange]=CM.Sim.CalculateChangeAura(aura);let timeToRecover=CM.Disp.FormatTime(priceOfChange/(bonusCPS+Game.cookiesPs));let bonusCPSPercentage=CM.Disp.Beautify(bonusCPS/Game.cookiesPs);bonusCPS=CM.Disp.Beautify(bonusCPS);l("dragonAuraInfo").style.minHeight="60px";l("dragonAuraInfo").style.margin="8px";l("dragonAuraInfo").appendChild(document.createElement("div")).className="line";let div=document.createElement("div");div.style.minWidth="200px";div.style.textAlign="center";div.textContent="Picking this aura will change CPS by "+bonusCPS+" ("+bonusCPSPercentage+"% of current CPS).";l("dragonAuraInfo").appendChild(div);let div2=document.createElement("div");div2.style.minWidth="200px";div2.style.textAlign="center";div2.textContent="It will take "+timeToRecover+" to recover the cost.";l("dragonAuraInfo").appendChild(div2)}};CM.Disp.AddDragonLevelUpTooltip=function(){if((l("specialPopup").className.match(/onScreen/)&&l("specialPopup").children[0].style.background.match(/dragon/))!=null){for(let i=0;i${CM.Cache.CostDragonUpgrade}`,"this");Game.tooltip.wobble()};l("specialPopup").children[i].onmouseout=function(){Game.tooltip.shouldHide=1}}}}};CM.Disp.AddMenu=function(){let title=function(){let div=document.createElement("div");div.className="title "+CM.Disp.colorTextPre+CM.Disp.colorBlue;div.textContent="Cookie Monster Goodies";return div};if(Game.onMenu==="prefs"){CM.Disp.AddMenuPref(title)}else if(Game.onMenu==="stats"){if(CM.Options.Stats){CM.Disp.AddMenuStats(title)}}};CM.Disp.RefreshMenu=function(){if(CM.Options.UpStats&&Game.onMenu==="stats"&&(Game.drawT-1)%(Game.fps*5)!=0&&(Game.drawT-1)%Game.fps===0)Game.UpdateMenu()};CM.Disp.AddMenuPref=function(title){let frag=document.createDocumentFragment();frag.appendChild(title());for(let group of Object.keys(CM.Data.ConfigGroups)){let groupObject=CM.Disp.CreatePrefHeader(group,CM.Data.ConfigGroups[group]);frag.appendChild(groupObject);if(CM.Options.Header[group]){if(group==="Notification"){for(let subGroup of Object.keys(CM.Data.ConfigGroupsNotification)){let subGroupObject=CM.Disp.CreatePrefHeader(subGroup,CM.Data.ConfigGroupsNotification[subGroup]);subGroupObject.style.fontSize="15px";subGroupObject.style.opacity="0.5";frag.appendChild(subGroupObject);if(CM.Options.Header[subGroup]){for(let option in CM.Data.Config){if(CM.Data.Config[option].group===subGroup)frag.appendChild(CM.Disp.CreatePrefOption(option))}}}}else{for(let option of Object.keys(CM.Data.Config)){if(CM.Data.Config[option].group===group)frag.appendChild(CM.Disp.CreatePrefOption(option))}}}}let resDef=document.createElement("div");resDef.className="listing";let resDefBut=document.createElement("a");resDefBut.className="option";resDefBut.onclick=function(){CM.Config.RestoreDefault()};resDefBut.textContent="Restore Default";resDef.appendChild(resDefBut);frag.appendChild(resDef);l("menu").childNodes[2].insertBefore(frag,l("menu").childNodes[2].childNodes[l("menu").childNodes[2].childNodes.length-1])};CM.Disp.CreatePrefHeader=function(config,text){let div=document.createElement("div");div.className="title";div.style.opacity="0.7";div.style.fontSize="17px";div.appendChild(document.createTextNode(text+" "));let span=document.createElement("span");span.style.cursor="pointer";span.style.display="inline-block";span.style.height="14px";span.style.width="14px";span.style.borderRadius="7px";span.style.textAlign="center";span.style.backgroundColor="#C0C0C0";span.style.color="black";span.style.fontSize="13px";span.style.verticalAlign="middle";span.textContent=CM.Options.Header[config]?"-":"+";span.onclick=function(){CM.Config.ToggleHeader(config);Game.UpdateMenu()};div.appendChild(span);return div};CM.Disp.CreatePrefOption=function(config){if(CM.Data.Config[config].type==="bool"){let div=document.createElement("div");div.className="listing";let a=document.createElement("a");if(CM.Data.Config[config].toggle&&CM.Options[config]===0){a.className="option off"}else{a.className="option"}a.id=CM.Config.ConfigPrefix+config;a.onclick=function(){CM.Config.ToggleConfig(config)};a.textContent=CM.Data.Config[config].label[CM.Options[config]];div.appendChild(a);let label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}else if(CM.Data.Config[config].type==="vol"){let div=document.createElement("div");div.className="listing";let volume=document.createElement("div");volume.className="sliderBox";let title=document.createElement("div");title.style.float="left";title.innerHTML=CM.Data.Config[config].desc;volume.appendChild(title);let percent=document.createElement("div");percent.id="slider"+config+"right";percent.style.float="right";percent.innerHTML=CM.Options[config]+"%";volume.appendChild(percent);let slider=document.createElement("input");slider.className="slider";slider.id="slider"+config;slider.style.clear="both";slider.type="range";slider.min="0";slider.max="100";slider.step="1";slider.value=CM.Options[config];slider.oninput=function(){CM.Config.ToggleConfigVolume(config)};slider.onchange=function(){CM.Config.ToggleConfigVolume(config)};volume.appendChild(slider);div.appendChild(volume);return div}else if(CM.Data.Config[config].type==="url"){let div=document.createElement("div");div.className="listing";let span=document.createElement("span");span.className="option";span.textContent=CM.Data.Config[config].label+" ";div.appendChild(span);let input=document.createElement("input");input.id=CM.Config.ConfigPrefix+config;input.className="option";input.type="text";input.readOnly=true;input.setAttribute("value",CM.Options[config]);input.style.width="300px";div.appendChild(input);div.appendChild(document.createTextNode(" "));let inputPrompt=document.createElement("input");inputPrompt.id=CM.Config.ConfigPrefix+config+"Prompt";inputPrompt.className="option";inputPrompt.type="text";inputPrompt.setAttribute("value",CM.Options[config]);let a=document.createElement("a");a.className="option";a.onclick=function(){Game.Prompt(inputPrompt.outerHTML,[["Save","CM.Options['"+config+"'] = l(CM.Config.ConfigPrefix + '"+config+"' + 'Prompt').value; CM.Config.SaveConfig(); Game.ClosePrompt(); Game.UpdateMenu();"],"Cancel"])};a.textContent="Edit";div.appendChild(a);let label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}else if(CM.Data.Config[config].type==="color"){let div=document.createElement("div");for(let i=0;ithis.max)console.log("TEST");CM.Options[config]=this.value;CM.Config.SaveConfig();CM.Disp.RefreshScale()};div.appendChild(input);div.appendChild(document.createTextNode(" "));let label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}};CM.Disp.ToggleDetailedTime=function(){if(CM.Options.DetailedTime===1)Game.sayTime=CM.Disp.sayTime;else Game.sayTime=CM.Backup.sayTime};CM.Disp.RefreshScale=function(){BeautifyAll();Game.RefreshStore();Game.RebuildUpgrades();CM.Disp.UpdateBotBar();CM.Disp.UpdateBuildings();CM.Disp.UpdateUpgrades()};CM.Disp.UpdateColors=function(){let str="";for(let i=0;i0){stats.appendChild(CM.Disp.CreateStatsHeader("Wrinklers","Wrink"));if(CM.Options.Header.Wrink){let popAllFrag=document.createDocumentFragment();popAllFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinklersTotal)+" / "+Beautify(CM.Cache.WrinklersNormal)+" "));let popAllA=document.createElement("a");popAllA.textContent="Pop All Normal";popAllA.className="option";popAllA.onclick=function(){CM.Disp.PopAllNormalWrinklers()};popAllFrag.appendChild(popAllA);stats.appendChild(CM.Disp.CreateStatsListing("basic","Rewards of Popping (All/Normal)",popAllFrag));let popFattestFrag=document.createDocumentFragment();popFattestFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinklersFattest[0])+" "));let popFattestA=document.createElement("a");popFattestA.textContent="Pop Single Fattest";popFattestA.className="option";popFattestA.onclick=function(){if(CM.Cache.WrinklersFattest[1])Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp=0};popFattestFrag.appendChild(popFattestA);stats.appendChild(CM.Disp.CreateStatsListing("basic","Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: "+(CM.Cache.WrinklersFattest[1]?CM.Cache.WrinklersFattest[1]:"None")+")",popFattestFrag))}}let specDisp=false;let missingHalloweenCookies=[];for(let i of Object.keys(CM.Data.HalloCookies)){if(!Game.Has(CM.Data.HalloCookies[i])){missingHalloweenCookies.push(CM.Data.HalloCookies[i]);specDisp=true}}let missingChristmasCookies=[];for(let i of Object.keys(CM.Data.ChristCookies)){if(!Game.Has(CM.Data.ChristCookies[i])){missingChristmasCookies.push(CM.Data.ChristCookies[i]);specDisp=true}}let missingValentineCookies=[];for(let i of Object.keys(CM.Data.ValCookies)){if(!Game.Has(CM.Data.ValCookies[i])){missingValentineCookies.push(CM.Data.ValCookies[i]);specDisp=true}}let missingNormalEggs=[];for(let i of Object.keys(Game.eggDrops)){if(!Game.HasUnlocked(Game.eggDrops[i])){missingNormalEggs.push(Game.eggDrops[i]);specDisp=true}}let missingRareEggs=[];for(let i of Object.keys(Game.rareEggDrops)){if(!Game.HasUnlocked(Game.rareEggDrops[i])){missingRareEggs.push(Game.rareEggDrops[i]);specDisp=true}}let missingPlantDrops=[];for(let i of Object.keys(CM.Data.PlantDrops)){if(!Game.HasUnlocked(CM.Data.PlantDrops[i])){missingPlantDrops.push(CM.Data.PlantDrops[i]);specDisp=true}}let choEgg=Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg");let centEgg=Game.Has("Century egg");if(Game.season==="christmas"||specDisp||choEgg||centEgg){stats.appendChild(CM.Disp.CreateStatsHeader("Season Specials","Sea"));if(CM.Options.Header.Sea){if(missingHalloweenCookies.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Halloween Cookies Left to Buy",CM.Disp.CreateStatsMissDisp(missingHalloweenCookies)));if(missingChristmasCookies.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Christmas Cookies Left to Buy",CM.Disp.CreateStatsMissDisp(missingChristmasCookies)));if(missingValentineCookies.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Valentine Cookies Left to Buy",CM.Disp.CreateStatsMissDisp(missingValentineCookies)));if(missingNormalEggs.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Normal Easter Eggs Left to Unlock",CM.Disp.CreateStatsMissDisp(missingNormalEggs)));if(missingRareEggs.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Rare Easter Eggs Left to Unlock",CM.Disp.CreateStatsMissDisp(missingRareEggs)));if(missingPlantDrops.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Rare Plant Drops Left to Unlock",CM.Disp.CreateStatsMissDisp(missingPlantDrops)));if(Game.season==="christmas")stats.appendChild(CM.Disp.CreateStatsListing("basic","Reindeer Reward",document.createTextNode(Beautify(CM.Cache.SeaSpec))));if(choEgg){stats.appendChild(CM.Disp.CreateStatsListing("withTooltip","Chocolate Egg Cookies",document.createTextNode(Beautify(CM.Cache.lastChoEgg)),"ChoEggTooltipPlaceholder"))}if(centEgg){stats.appendChild(CM.Disp.CreateStatsListing("basic","Century Egg Multiplier",document.createTextNode(Math.round((CM.Cache.CentEgg-1)*1e4)/100+"%")))}}}stats.appendChild(CM.Disp.CreateStatsHeader("Miscellaneous","Misc"));if(CM.Options.Header.Misc){stats.appendChild(CM.Disp.CreateStatsListing("basic","Average Cookies Per Second (Past "+(CM.Disp.cookieTimes[CM.Options.AvgCPSHist]<60?CM.Disp.cookieTimes[CM.Options.AvgCPSHist]+" seconds":CM.Disp.cookieTimes[CM.Options.AvgCPSHist]/60+(CM.Options.AvgCPSHist===3?" minute":" minutes"))+")",document.createTextNode(Beautify(CM.Cache.AvgCPS,3))));stats.appendChild(CM.Disp.CreateStatsListing("basic","Average Cookie Clicks Per Second (Past "+CM.Disp.clickTimes[CM.Options.AvgClicksHist]+(CM.Options.AvgClicksHist===0?" second":" seconds")+")",document.createTextNode(Beautify(CM.Cache.AverageClicks,1))));if(Game.Has("Fortune cookies")){let fortunes=[];for(let i of Object.keys(CM.Data.Fortunes)){if(!Game.Has(CM.Data.Fortunes[i])){fortunes.push(CM.Data.Fortunes[i])}}if(fortunes.length!=0)stats.appendChild(CM.Disp.CreateStatsListing("basic","Fortune Upgrades Left to Buy",CM.Disp.CreateStatsMissDisp(fortunes)))}stats.appendChild(CM.Disp.CreateStatsListing("basic","Missed Golden Cookies",document.createTextNode(Beautify(Game.missedGoldenClicks))));if(Game.prefs.autosave){let timer=document.createElement("span");timer.id="CMStatsAutosaveTimer";timer.innerText=Game.sayTime(Game.fps*60-(Game.OnAscend?0:Game.T%(Game.fps*60)),4);stats.appendChild(CM.Disp.CreateStatsListing("basic","Time till autosave",timer))}}l("menu").insertBefore(stats,l("menu").childNodes[2]);if(CM.Options.MissingUpgrades){CM.Disp.AddMissingUpgrades()}};CM.Disp.CreateStatsHeader=function(text,config){let div=document.createElement("div");div.className="listing";div.style.padding="5px 16px";div.style.opacity="0.7";div.style.fontSize="17px";div.style.fontFamily='"Kavoon", Georgia, serif';div.appendChild(document.createTextNode(text+" "));let span=document.createElement("span");span.style.cursor="pointer";span.style.display="inline-block";span.style.height="14px";span.style.width="14px";span.style.borderRadius="7px";span.style.textAlign="center";span.style.backgroundColor="#C0C0C0";span.style.color="black";span.style.fontSize="13px";span.style.verticalAlign="middle";span.textContent=CM.Options.Header[config]?"-":"+";span.onclick=function(){CM.Config.ToggleHeader(config);Game.UpdateMenu()};div.appendChild(span);return div};CM.Disp.CreateStatsListing=function(type,name,text,placeholder){let div=document.createElement("div");div.className="listing";let listingName=document.createElement("b");listingName.textContent=name;div.appendChild(listingName);if(type==="withTooltip"){div.className="listing";let tooltip=document.createElement("span");tooltip.onmouseout=function(){Game.tooltip.hide()};tooltip.onmouseover=function(){Game.tooltip.draw(this,escape(CM.Disp[placeholder].innerHTML))};tooltip.style.cursor="default";tooltip.style.display="inline-block";tooltip.style.height="10px";tooltip.style.width="10px";tooltip.style.borderRadius="5px";tooltip.style.textAlign="center";tooltip.style.backgroundColor="#C0C0C0";tooltip.style.color="black";tooltip.style.fontSize="9px";tooltip.style.verticalAlign="bottom";tooltip.textContent="?";div.appendChild(tooltip);div.appendChild(document.createTextNode(" "))}div.appendChild(document.createTextNode(": "));div.appendChild(text);return div};CM.Disp.CreateStatsMissDisp=function(theMissDisp){let frag=document.createDocumentFragment();frag.appendChild(document.createTextNode(theMissDisp.length+" "));let span=document.createElement("span");span.onmouseout=function(){Game.tooltip.hide()};let placeholder=document.createElement("div");let missing=document.createElement("div");missing.style.minWidth="140px";missing.style.marginBottom="4px";let title=document.createElement("div");title.className="name";title.style.marginBottom="4px";title.style.textAlign="center";title.textContent="Missing";missing.appendChild(title);for(let i of Object.keys(theMissDisp)){let div=document.createElement("div");div.style.textAlign="center";div.appendChild(document.createTextNode(theMissDisp[i]));missing.appendChild(div)}placeholder.appendChild(missing);span.onmouseover=function(){Game.tooltip.draw(this,escape(placeholder.innerHTML))};span.style.cursor="default";span.style.display="inline-block";span.style.height="10px";span.style.width="10px";span.style.borderRadius="5px";span.style.textAlign="center";span.style.backgroundColor="#C0C0C0";span.style.color="black";span.style.fontSize="9px";span.style.verticalAlign="bottom";span.textContent="?";frag.appendChild(span);return frag};CM.Disp.CreateStatsLuckySection=function(){let goldCookTooltip=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder";let section=document.createElement("div");section.className="CMStatsLuckySection";let luckyColor=Game.cookies+CM.Disp.GetWrinkConfigBank()Missing Prestige upgrades: "+prestigeUpgradesMissing+"/"+Game.PrestigeUpgrades.length+" ("+Math.floor(prestigeUpgradesMissing/Game.PrestigeUpgrades.length*100)+"%)";title.appendChild(titlefrag);menuSection.appendChild(title);let upgrades=document.createElement("div");upgrades.className="listing crateBox";upgrades.innerHTML=CM.Cache.MissingUpgradesPrestige;menuSection.appendChild(upgrades)}else if(menuSection.children[0].innerHTML==="Upgrades"){if(CM.Cache.MissingUpgrades){let normalUpgradesMissing=CM.Cache.MissingUpgrades.match(new RegExp("div","g")||[]).length/2;let title=document.createElement("div");title.id="CMMissingUpgradesTitle";title.className="listing";let titlefrag=document.createElement("div");titlefrag.innerHTML="Missing normal upgrades: "+normalUpgradesMissing+"/"+(Game.UpgradesByPool[""].length+Game.UpgradesByPool.tech.length)+" ("+Math.floor(normalUpgradesMissing/(Game.UpgradesByPool[""].length+Game.UpgradesByPool.tech.length)*100)+"%)";title.appendChild(titlefrag);menuSection.insertBefore(title,menuSection.childNodes[3]);let upgrades=document.createElement("div");upgrades.className="listing crateBox";upgrades.innerHTML=CM.Cache.MissingUpgrades;menuSection.insertBefore(upgrades,document.getElementById("CMMissingUpgradesTitle").nextSibling)}if(CM.Cache.MissingUpgradesCookies){let cookieUpgradesMissing=CM.Cache.MissingUpgradesCookies.match(new RegExp("div","g")||[]).length/2;let title=document.createElement("div");title.id="CMMissingUpgradesCookiesTitle";title.className="listing";let titlefrag=document.createElement("div");titlefrag.innerHTML="Missing Cookie upgrades: "+cookieUpgradesMissing+"/"+Game.UpgradesByPool.cookie.length+" ("+Math.floor(cookieUpgradesMissing/Game.UpgradesByPool.cookie.length*100)+"%)";title.appendChild(titlefrag);menuSection.appendChild(title);let upgrades=document.createElement("div");upgrades.className="listing crateBox";upgrades.innerHTML=CM.Cache.MissingUpgradesCookies;menuSection.appendChild(upgrades)}}}}};CM.Disp.crateMissing=function(me){let classes="crate upgrade missing";if(me.pool==="prestige")classes+=" heavenly";let noFrame=0;if(!Game.prefs.crates)noFrame=1;if(noFrame)classes+=" noFrame";let icon=me.icon;if(me.iconFunction)icon=me.iconFunction();let tooltip=`function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;return`
\n\t
`};CM.Disp.CreateWrinklerButtons=function(){let popAllA=document.createElement("a");popAllA.id="PopAllNormalWrinklerButton";popAllA.textContent="Pop All Normal";popAllA.className="option";popAllA.onclick=function(){CM.Disp.PopAllNormalWrinklers()};l("sectionLeftExtra").children[0].append(popAllA);let popFattestA=document.createElement("a");popFattestA.id="PopFattestWrinklerButton";popFattestA.textContent="Pop Single Fattest";popFattestA.className="option";popFattestA.onclick=function(){if(CM.Cache.WrinklersFattest[1])Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp=0};l("sectionLeftExtra").children[0].append(popFattestA)};CM.Disp.UpdateWrinklerButtons=function(){if(CM.Options.WrinklerButtons){l("PopAllNormalWrinklerButton").style.display="";l("PopFattestWrinklerButton").style.display=""}else{l("PopAllNormalWrinklerButton").style.display="none";l("PopFattestWrinklerButton").style.display="none"}};CM.Disp.TooltipText=[["GoldCookTooltipPlaceholder","Calculated with Golden Switch off","200px"],["GoldCookDragonsFortuneTooltipPlaceholder","Calculated with Golden Switch off and at least one golden cookie on-screen","240px"],["PrestMaxTooltipPlaceholder","The MAX prestige is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg","320px"],["NextPrestTooltipPlaceholder","Calculated with cookies gained from wrinklers and Chocolate egg","200px"],["HeavenChipMaxTooltipPlaceholder","The MAX heavenly chips is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg","330px"],["ResetTooltipPlaceholder","The bonus income you would get from new prestige levels unlocked at 100% of its potential and from ascension achievements if you have the same buildings/upgrades after reset","370px"],["ChoEggTooltipPlaceholder","The amount of cookies you would get from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and then buying Chocolate egg","300px"]];CM.Disp.colorTextPre="CMText";CM.Disp.colorBackPre="CMBack";CM.Disp.colorBorderPre="CMBorder";CM.Disp.colorBlue="Blue";CM.Disp.colorGreen="Green";CM.Disp.colorYellow="Yellow";CM.Disp.colorOrange="Orange";CM.Disp.colorRed="Red";CM.Disp.colorPurple="Purple";CM.Disp.colorGray="Gray";CM.Disp.colorPink="Pink";CM.Disp.colorBrown="Brown";CM.Disp.colors=[CM.Disp.colorBlue,CM.Disp.colorGreen,CM.Disp.colorYellow,CM.Disp.colorOrange,CM.Disp.colorRed,CM.Disp.colorPurple,CM.Disp.colorGray,CM.Disp.colorPink,CM.Disp.colorBrown];CM.Disp.buffColors={Frenzy:CM.Disp.colorYellow,"Dragon Harvest":CM.Disp.colorBrown,"Elder frenzy":CM.Disp.colorGreen,Clot:CM.Disp.colorRed,"Click frenzy":CM.Disp.colorBlue,Dragonflight:CM.Disp.colorPink};CM.Disp.GCTimers={};CM.Disp.cookieTimes=[10,15,30,60,300,600,900,1800];CM.Disp.clickTimes=[1,5,10,15,30];CM.Disp.TooltipWrinklerBeingShown=[];CM.Disp.TooltipWrinklerArea=0;CM.Disp.TooltipWrinkler=-1;CM.Disp.Title="";CM.Main.Loop=function(){if(CM.Disp.lastAscendState!=Game.OnAscend){CM.Disp.lastAscendState=Game.OnAscend;CM.Disp.UpdateAscendState()}if(!Game.OnAscend&&Game.AscendTimer===0){if(CM.Sim.DoSims){CM.Cache.CacheIncome();CM.Cache.NoGoldSwitchCPS();CM.Cache.CacheGoldenAndWrathCookiesMults();CM.Cache.CacheStats();CM.Cache.CacheMissingUpgrades();CM.Cache.CacheChain();CM.Cache.CacheDragonCost();CM.Cache.CacheSeaSpec();CM.Cache.CacheSellForChoEgg();CM.Sim.DoSims=0}let hasBuildAura=Game.auraMult("Fierce Hoarder")>0;if(!CM.Cache.HadBuildAura&&hasBuildAura){CM.Cache.HadBuildAura=true;CM.Cache.DoRemakeBuildPrices=1}else if(CM.Cache.HadBuildAura&&!hasBuildAura){CM.Cache.HadBuildAura=false;CM.Cache.DoRemakeBuildPrices=1}if(CM.Cache.DoRemakeBuildPrices){CM.Cache.CacheBuildingsPrices();CM.Cache.DoRemakeBuildPrices=0}CM.Cache.LoopCache();CM.Main.CheckGoldenCookie();CM.Main.CheckTickerFortune();CM.Main.CheckSeasonPopup();CM.Main.CheckGardenTick();CM.Main.CheckMagicMeter();CM.Main.CheckWrinklerCount()}};CM.Main.DelayInit=function(){CM.Sim.InitData();CM.Cache.InitCache();CM.Disp.CreateCssArea();CM.Disp.CreateBotBar();CM.Disp.CreateTimerBar();CM.Disp.CreateUpgradeBar();CM.Disp.CreateWhiteScreen();CM.Disp.CreateFavicon();for(let i of Object.keys(CM.Disp.TooltipText)){CM.Disp.CreateSimpleTooltip(CM.Disp.TooltipText[i][0],CM.Disp.TooltipText[i][1],CM.Disp.TooltipText[i][2])}CM.Disp.CreateWrinklerButtons();CM.Disp.UpdateBuildingUpgradeStyle();CM.Main.ReplaceTooltips();CM.Main.AddWrinklerAreaDetect();CM.Main.ReplaceNative();CM.Main.ReplaceNativeGrimoire();Game.CalculateGains();CM.Config.LoadConfig();CM.Disp.lastAscendState=Game.OnAscend;if(Game.prefs.popups)Game.Popup("Cookie Monster version "+CM.VersionMajor+"."+CM.VersionMinor+" loaded!");else Game.Notify("Cookie Monster version "+CM.VersionMajor+"."+CM.VersionMinor+" loaded!","","",1,1);Game.Win("Third-party")};CM.Main.ReplaceNative=function(){CM.Backup.Beautify=Beautify;Beautify=CM.Disp.Beautify;CM.Backup.CalculateGains=Game.CalculateGains;eval("CM.Backup.CalculateGainsMod = "+Game.CalculateGains.toString().split("ages');").join("ages');CM.Sim.DateAges = Date.now();").split("if (Game.Has('Century").join("CM.Sim.DateCentury = Date.now();if (Game.Has('Century"));Game.CalculateGains=function(){CM.Backup.CalculateGainsMod();CM.Sim.DoSims=1};CM.Backup.tooltip={};CM.Backup.tooltip.draw=Game.tooltip.draw;eval("CM.Backup.tooltip.drawMod = "+Game.tooltip.draw.toString().split("this").join("Game.tooltip"));Game.tooltip.draw=function(from,text,origin){CM.Backup.tooltip.drawMod(from,text,origin)};CM.Backup.tooltip.update=Game.tooltip.update;eval("CM.Backup.tooltip.updateMod = "+Game.tooltip.update.toString().split("this.").join("Game.tooltip."));Game.tooltip.update=function(){CM.Backup.tooltip.updateMod();CM.Disp.UpdateTooltipLocation()};CM.Backup.UpdateWrinklers=Game.UpdateWrinklers;Game.UpdateWrinklers=function(){CM.Main.FixMouseY(CM.Backup.UpdateWrinklers)};CM.Backup.UpdateSpecial=Game.UpdateSpecial;Game.UpdateSpecial=function(){CM.Main.FixMouseY(CM.Backup.UpdateSpecial)};l("bigCookie").removeEventListener("click",Game.ClickCookie,false);l("bigCookie").addEventListener("click",(function(){CM.Main.FixMouseY(Game.ClickCookie)}),false);CM.Backup.RebuildUpgrades=Game.RebuildUpgrades;Game.RebuildUpgrades=function(){CM.Backup.RebuildUpgrades();CM.Disp.ReplaceTooltipUpgrade();Game.CalculateGains()};CM.Backup.ClickProduct=Game.ClickProduct;Game.ClickProduct=function(what){if(!CM.Options.BulkBuyBlock||Game.ObjectsById[what].bulkPrice for the next level.
';").join("` more cookies for the next level.
${CM.Options.TooltipAscendButton ? `
You need ${CM.Cache.TimeTillNextPrestige} for the next level.
` : ``}`;"));Game.Logic=function(){CM.Backup.LogicMod();CM.Disp.UpdateTitle()}};CM.Main.ReplaceNativeGrimoire=function(){CM.Main.ReplaceNativeGrimoireLaunch();CM.Main.ReplaceNativeGrimoireDraw()};CM.Main.ReplaceNativeGrimoireLaunch=function(){if(!CM.Main.HasReplaceNativeGrimoireLaunch&&Game.Objects["Wizard tower"].minigameLoaded){let minigame=Game.Objects["Wizard tower"].minigame;CM.Backup.GrimoireLaunch=minigame.launch;eval("CM.Backup.GrimoireLaunchMod = "+minigame.launch.toString().split("=this").join("= Game.Objects['Wizard tower'].minigame"));Game.Objects["Wizard tower"].minigame.launch=function(){CM.Backup.GrimoireLaunchMod();CM.Main.ReplaceTooltipGrimoire();CM.HasReplaceNativeGrimoireDraw=false;CM.Main.ReplaceNativeGrimoireDraw()};CM.Main.HasReplaceNativeGrimoireLaunch=true}};CM.Main.ReplaceNativeGrimoireDraw=function(){if(!CM.Main.HasReplaceNativeGrimoireDraw&&Game.Objects["Wizard tower"].minigameLoaded){let minigame=Game.Objects["Wizard tower"].minigame;CM.Backup.GrimoireDraw=minigame.draw;Game.Objects["Wizard tower"].minigame.draw=function(){CM.Backup.GrimoireDraw();if(CM.Options.GrimoireBar===1&&minigame.magic{let coords=child.id.slice(-3);child.onmouseover=function(){Game.tooltip.dynamic=1;Game.tooltip.draw(this,(function(){return CM.Disp.Tooltip("p",[`${coords[0]}`,`${coords[2]}`])}),"this");Game.tooltip.wobble()}}))}};CM.Main.FindShimmer=function(){CM.Main.currSpawnedGoldenCookieState=0;CM.Cache.goldenShimmersByID={};for(let i of Object.keys(Game.shimmers)){CM.Cache.goldenShimmersByID[Game.shimmers[i].id]=Game.shimmers[i];if(Game.shimmers[i].spawnLead&&Game.shimmers[i].type==="golden"){CM.Cache.spawnedGoldenShimmer=Game.shimmers[i];CM.Main.currSpawnedGoldenCookieState+=1}}};CM.Main.CheckGoldenCookie=function(){CM.Main.FindShimmer();for(let i of Object.keys(CM.Disp.GCTimers)){if(typeof CM.Cache.goldenShimmersByID[i]==="undefined"){CM.Disp.GCTimers[i].parentNode.removeChild(CM.Disp.GCTimers[i]);delete CM.Disp.GCTimers[i]}}if(CM.Main.lastGoldenCookieState!=Game.shimmerTypes.golden.n){CM.Main.lastGoldenCookieState=Game.shimmerTypes.golden.n;if(CM.Main.lastGoldenCookieState){if(CM.Main.lastSpawnedGoldenCookieState0){let CurrentWrinklers=0;for(let i in Game.wrinklers){if(Game.wrinklers[i].phase===2)CurrentWrinklers++}if(CurrentWrinklers>CM.Main.lastWrinklerCount){CM.Main.lastWrinklerCount=CurrentWrinklers;if(CurrentWrinklers===Game.getWrinklersMax()&&CM.Options.WrinklerMaxFlash){CM.Disp.Flash(3,"WrinklerMaxFlash")}else{CM.Disp.Flash(3,"WrinklerFlash")}if(CurrentWrinklers===Game.getWrinklersMax()&&CM.Options.WrinklerMaxSound){CM.Disp.PlaySound(CM.Options.WrinklerMaxSoundURL,"WrinklerMaxSound","WrinklerMaxVolume")}else{CM.Disp.PlaySound(CM.Options.WrinklerSoundURL,"WrinklerSound","WrinklerVolume")}if(CurrentWrinklers===Game.getWrinklersMax()&&CM.Options.WrinklerMaxNotification){CM.Disp.Notification("WrinklerMaxNotification","Maximum Wrinklers Reached","You have reached your maximum ammount of wrinklers")}else{CM.Disp.Notification("WrinklerNotification","A Wrinkler appeared","A new wrinkler has appeared")}}else{CM.Main.lastWrinklerCount=CurrentWrinklers}}};CM.Main.AddWrinklerAreaDetect=function(){l("backgroundLeftCanvas").onmouseover=function(){CM.Disp.TooltipWrinklerArea=1};l("backgroundLeftCanvas").onmouseout=function(){CM.Disp.TooltipWrinklerArea=0;Game.tooltip.hide();for(let i of Object.keys(Game.wrinklers)){CM.Disp.TooltipWrinklerBeingShown[i]=0}}};CM.Main.FixMouseY=function(target){if(CM.Options.TimerBar===1&&CM.Options.TimerBarPos===0){let timerBarHeight=parseInt(CM.Disp.TimerBar.style.height);Game.mouseY-=timerBarHeight;target();Game.mouseY+=timerBarHeight}else{target()}};CM.Sim.BuildingGetPrice=function(build,basePrice,start,free,increase){let moni=0;for(let i=0;i0){moni+=price;start--}}return moni};CM.Sim.Has=function(what){let it=CM.Sim.Upgrades[what];if(Game.ascensionMode===1&&(it.pool==="prestige"||it.tier==="fortune"))return 0;return it?it.bought:0};CM.Sim.Win=function(what){if(CM.Sim.Achievements[what]){if(CM.Sim.Achievements[what].won===0){CM.Sim.Achievements[what].won=1;if(Game.Achievements[what].pool!="shadow")CM.Sim.AchievementsOwned++}}};CM.Sim.HasAchiev=function(what){return CM.Sim.Achievements[what]?CM.Sim.Achievements[what].won:0};CM.Sim.GetHeavenlyMultiplier=function(){let heavenlyMult=0;if(CM.Sim.Has("Heavenly chip secret"))heavenlyMult+=.05;if(CM.Sim.Has("Heavenly cookie stand"))heavenlyMult+=.2;if(CM.Sim.Has("Heavenly bakery"))heavenlyMult+=.25;if(CM.Sim.Has("Heavenly confectionery"))heavenlyMult+=.25;if(CM.Sim.Has("Heavenly key"))heavenlyMult+=.25;heavenlyMult*=1+CM.Sim.auraMult("Dragon God")*.05;if(CM.Sim.Has("Lucky digit"))heavenlyMult*=1.01;if(CM.Sim.Has("Lucky number"))heavenlyMult*=1.01;if(CM.Sim.Has("Lucky payout"))heavenlyMult*=1.01;if(CM.Sim.hasGod){let godLvl=CM.Sim.hasGod("creation");if(godLvl===1)heavenlyMult*=.7;else if(godLvl===2)heavenlyMult*=.8;else if(godLvl===3)heavenlyMult*=.9}return heavenlyMult};CM.Sim.hasAura=function(what){if(Game.dragonAuras[CM.Sim.dragonAura].name===what||Game.dragonAuras[CM.Sim.dragonAura2].name===what)return true;else return false};CM.Sim.auraMult=function(what){let n=0;if(Game.dragonAuras[CM.Sim.dragonAura].name===what||Game.dragonAuras[CM.Sim.dragonAura2].name===what)n=1;if(Game.dragonAuras[CM.Sim.dragonAura].name==="Reality Bending"||Game.dragonAuras[CM.Sim.dragonAura2].name==="Reality Bending")n+=.1;return n};CM.Sim.hasGod=function(what){if(!CM.Sim.Objects.Temple.minigameLoaded){return false}let possibleGods=CM.Sim.Objects.Temple.minigame.gods;let god=possibleGods[what];for(let i=0;i<3;i++){if(CM.Sim.Objects.Temple.minigame.slot[i]==god.id)return i+1}return false};CM.Sim.eff=function(name){if(typeof CM.Sim.effs[name]==="undefined"){CM.Sim.effs[name]=1;return CM.Sim.effs[name]}else{return CM.Sim.effs[name]}};CM.Sim.GetTieredCpsMult=function(me){let mult=1;for(let i in Game.Objects[me.name].tieredUpgrades){if(!Game.Tiers[Game.Objects[me.name].tieredUpgrades[i].tier].special&&CM.Sim.Has(Game.Objects[me.name].tieredUpgrades[i].name))mult*=2}for(let j in Game.Objects[me.name].synergies){let syn=Game.Objects[me.name].synergies[j];if(CM.Sim.Has(syn.name)){if(syn.buildingTie1.name==me.name)mult*=1+.05*CM.Sim.Objects[syn.buildingTie2.name].amount;else if(syn.buildingTie2.name==me.name)mult*=1+.001*CM.Sim.Objects[syn.buildingTie1.name].amount}}if(Game.Objects[me.name].fortune&&CM.Sim.Has(Game.Objects[me.name].fortune.name))mult*=1.07;if(Game.Objects[me.name].grandma&&CM.Sim.Has(Game.Objects[me.name].grandma.name))mult*=1+CM.Sim.Objects["Grandma"].amount*.01*(1/(Game.Objects[me.name].id-1));return mult};CM.Sim.InitialBuildingData=function(buildingName){let me=Game.Objects[buildingName];let you={};eval("you.cps = "+me.cps.toString().split("Game.Has").join("CM.Sim.Has").split("Game.hasAura").join("CM.Sim.hasAura").split("Game.Objects").join("CM.Sim.Objects").split("Game.GetTieredCpsMult").join("CM.Sim.GetTieredCpsMult").split("Game.auraMult").join("CM.Sim.auraMult").split("Game.eff").join("CM.Sim.eff"));you.baseCps=me.baseCps;you.name=me.name;return you};CM.Sim.InitUpgrade=function(upgradeName){let me=Game.Upgrades[upgradeName];let you={};you.power=me.power;if(typeof me.power==="function"){eval("me.power = "+me.power.toString().split("Game.Has").join("CM.Sim.Has").split("Game.hasGod").join("CM.Sim.hasGod"))}you.pool=me.pool;you.name=me.name;return you};CM.Sim.InitAchievement=function(achievementName){let me=Game.Achievements[achievementName];let you={};you.name=me.name;return you};CM.Sim.InitData=function(){CM.Sim.Objects=[];for(let i of Object.keys(Game.Objects)){CM.Sim.Objects[i]=CM.Sim.InitialBuildingData(i)}CM.Sim.Upgrades=[];for(let i of Object.keys(Game.Upgrades)){CM.Sim.Upgrades[i]=CM.Sim.InitUpgrade(i)}CM.Sim.Achievements=[];for(let i of Object.keys(Game.Achievements)){CM.Sim.Achievements[i]=CM.Sim.InitAchievement(i)}CM.Sim.CopyData()};CM.Sim.CopyData=function(){CM.Sim.UpgradesOwned=Game.UpgradesOwned;CM.Sim.pledges=Game.pledges;CM.Sim.AchievementsOwned=Game.AchievementsOwned;CM.Sim.heavenlyPower=Game.heavenlyPower;CM.Sim.prestige=Game.prestige;for(let i of Object.keys(Game.Objects)){let me=Game.Objects[i];let you=CM.Sim.Objects[i];if(you===undefined){you=CM.Sim.Objects[i]=CM.Sim.InitialBuildingData(i);CM.Disp.CreateBotBarBuildingColumn(i)}you.amount=me.amount;you.level=me.level;you.totalCookies=me.totalCookies;you.basePrice=me.basePrice;you.free=me.free;if(me.minigameLoaded)you.minigameLoaded=me.minigameLoaded;you.minigame=me.minigame}for(let i of Object.keys(Game.Upgrades)){let me=Game.Upgrades[i];let you=CM.Sim.Upgrades[i];if(you===undefined){you=CM.Sim.Upgrades[i]=CM.Sim.InitUpgrade(i)}you.bought=me.bought}for(let i of Object.keys(Game.Achievements)){let me=Game.Achievements[i];let you=CM.Sim.Achievements[i];if(you===undefined){you=CM.Sim.Achievements[i]=CM.Sim.InitAchievement(i)}you.won=me.won}CM.Cache.CacheDragonAuras();CM.Sim.dragonAura=CM.Cache.dragonAura;CM.Sim.dragonAura2=CM.Cache.dragonAura2};CM.Sim.CalculateGains=function(){CM.Sim.cookiesPs=0;let mult=1;let effs={};for(let i of Object.keys(Game.Objects)){if(Game.Objects[i].minigameLoaded&&Game.Objects[i].minigame.effs){let myEffs=Game.Objects[i].minigame.effs;for(let ii in myEffs){if(effs[ii])effs[ii]*=myEffs[ii];else effs[ii]=myEffs[ii]}}}CM.Sim.effs=effs;if(Game.ascensionMode!=1)mult+=parseFloat(CM.Sim.prestige)*.01*CM.Sim.heavenlyPower*CM.Sim.GetHeavenlyMultiplier();mult*=CM.Sim.eff("cps");if(CM.Sim.Has("Heralds")&&Game.ascensionMode!=1)mult*=1+.01*Game.heralds;for(let i of Object.keys(Game.cookieUpgrades)){let me=Game.cookieUpgrades[i];if(CM.Sim.Has(me.name)){if(typeof me.power==="function"){mult*=1+CM.Sim.Upgrades[me.name].power(CM.Sim.Upgrades[me.name])*.01}else mult*=1+me.power*.01}}if(CM.Sim.Has("Specialized chocolate chips"))mult*=1.01;if(CM.Sim.Has("Designer cocoa beans"))mult*=1.02;if(CM.Sim.Has("Underworld ovens"))mult*=1.03;if(CM.Sim.Has("Exotic nuts"))mult*=1.04;if(CM.Sim.Has("Arcane sugar"))mult*=1.05;if(CM.Sim.Has("Increased merriness"))mult*=1.15;if(CM.Sim.Has("Improved jolliness"))mult*=1.15;if(CM.Sim.Has("A lump of coal"))mult*=1.01;if(CM.Sim.Has("An itchy sweater"))mult*=1.01;if(CM.Sim.Has("Santa's dominion"))mult*=1.2;if(CM.Sim.Has("Fortune #100"))mult*=1.01;if(CM.Sim.Has("Fortune #101"))mult*=1.07;if(CM.Sim.Has("Dragon scale"))mult*=1.03;let buildMult=1;if(CM.Sim.hasGod){let godLvl=CM.Sim.hasGod("asceticism");if(godLvl===1)mult*=1.15;else if(godLvl===2)mult*=1.1;else if(godLvl===3)mult*=1.05;godLvl=CM.Sim.hasGod("ages");if(godLvl===1)mult*=1+.15*Math.sin(CM.Sim.DateAges/1e3/(60*60*3)*Math.PI*2);else if(godLvl===2)mult*=1+.15*Math.sin(CM.Sim.DateAges/1e3/(60*60*12)*Math.PI*2);else if(godLvl===3)mult*=1+.15*Math.sin(CM.Sim.DateAges/1e3/(60*60*24)*Math.PI*2);godLvl=CM.Sim.hasGod("decadence");if(godLvl===1)buildMult*=.93;else if(godLvl===2)buildMult*=.95;else if(godLvl===3)buildMult*=.98;godLvl=CM.Sim.hasGod("industry");if(godLvl===1)buildMult*=1.1;else if(godLvl===2)buildMult*=1.06;else if(godLvl===3)buildMult*=1.03;godLvl=CM.Sim.hasGod("labor");if(godLvl===1)buildMult*=.97;else if(godLvl===2)buildMult*=.98;else if(godLvl===3)buildMult*=.99}if(CM.Sim.Has("Santa's legacy"))mult*=1+(Game.santaLevel+1)*.03;let milkProgress=CM.Sim.AchievementsOwned/25;let milkMult=1;if(CM.Sim.Has("Santa's milk and cookies"))milkMult*=1.05;milkMult*=1+CM.Sim.auraMult("Breath of Milk")*.05;if(CM.Sim.hasGod){let godLvl=CM.Sim.hasGod("mother");if(godLvl===1)milkMult*=1.1;else if(godLvl===2)milkMult*=1.05;else if(godLvl===3)milkMult*=1.03}milkMult*=CM.Sim.eff("milk");let catMult=1;if(CM.Sim.Has("Kitten helpers"))catMult*=1+milkProgress*.1*milkMult;if(CM.Sim.Has("Kitten workers"))catMult*=1+milkProgress*.125*milkMult;if(CM.Sim.Has("Kitten engineers"))catMult*=1+milkProgress*.15*milkMult;if(CM.Sim.Has("Kitten overseers"))catMult*=1+milkProgress*.175*milkMult;if(CM.Sim.Has("Kitten managers"))catMult*=1+milkProgress*.2*milkMult;if(CM.Sim.Has("Kitten accountants"))catMult*=1+milkProgress*.2*milkMult;if(CM.Sim.Has("Kitten specialists"))catMult*=1+milkProgress*.2*milkMult;if(CM.Sim.Has("Kitten experts"))catMult*=1+milkProgress*.2*milkMult;if(CM.Sim.Has("Kitten consultants"))catMult*=1+milkProgress*.2*milkMult;if(CM.Sim.Has("Kitten assistants to the regional manager"))catMult*=1+milkProgress*.175*milkMult;if(CM.Sim.Has("Kitten marketeers"))catMult*=1+milkProgress*.15*milkMult;if(CM.Sim.Has("Kitten analysts"))catMult*=1+milkProgress*.125*milkMult;if(CM.Sim.Has("Kitten executives"))catMult*=1+milkProgress*.115*milkMult;if(CM.Sim.Has("Kitten angels"))catMult*=1+milkProgress*.1*milkMult;if(CM.Sim.Has("Fortune #103"))catMult*=1+milkProgress*.05*milkMult;for(let i of Object.keys(CM.Sim.Objects)){let me=CM.Sim.Objects[i];let storedCps=me.cps(me);if(Game.ascensionMode!=1)storedCps*=(1+me.level*.01)*buildMult;if(me.name==="Grandma"&&CM.Sim.Has("Milkhelp® lactose intolerance relief tablets"))storedCps*=1+.05*milkProgress*milkMult;CM.Sim.cookiesPs+=me.amount*storedCps}if(CM.Sim.Has('"egg"'))CM.Sim.cookiesPs+=9;mult*=catMult;let eggMult=1;if(CM.Sim.Has("Chicken egg"))eggMult*=1.01;if(CM.Sim.Has("Duck egg"))eggMult*=1.01;if(CM.Sim.Has("Turkey egg"))eggMult*=1.01;if(CM.Sim.Has("Quail egg"))eggMult*=1.01;if(CM.Sim.Has("Robin egg"))eggMult*=1.01;if(CM.Sim.Has("Ostrich egg"))eggMult*=1.01;if(CM.Sim.Has("Cassowary egg"))eggMult*=1.01;if(CM.Sim.Has("Salmon roe"))eggMult*=1.01;if(CM.Sim.Has("Frogspawn"))eggMult*=1.01;if(CM.Sim.Has("Shark egg"))eggMult*=1.01;if(CM.Sim.Has("Turtle egg"))eggMult*=1.01;if(CM.Sim.Has("Ant larva"))eggMult*=1.01;if(CM.Sim.Has("Century egg")){let day=Math.floor((CM.Sim.DateCentury-Game.startDate)/1e3/10)*10/60/60/24;day=Math.min(day,100);CM.Cache.CentEgg=1+(1-Math.pow(1-day/100,3))*.1;eggMult*=CM.Cache.CentEgg}mult*=eggMult;if(CM.Sim.Has("Sugar baking"))mult*=1+Math.min(100,Game.lumps)*.01;mult*=1+CM.Sim.auraMult("Radiant Appetite");let rawCookiesPs=CM.Sim.cookiesPs*mult;for(let i of Object.keys(Game.CpsAchievements)){if(rawCookiesPs>=Game.CpsAchievements[i].threshold)CM.Sim.Win(Game.CpsAchievements[i].name)}CM.Sim.cookiesPsRaw=rawCookiesPs;let n=Game.shimmerTypes.golden.n;let auraMult=CM.Sim.auraMult("Dragon's Fortune");for(let i=0;i=7)CM.Sim.Win("Elder");if(!CM.Sim.HasAchiev("Veteran")&&grandmas>=14)CM.Sim.Win("Veteran");let buildingsOwned=0;let mathematician=1;let base10=1;let minAmount=1e5;for(let i of Object.keys(CM.Sim.Objects)){buildingsOwned+=CM.Sim.Objects[i].amount;minAmount=Math.min(CM.Sim.Objects[i].amount,minAmount);if(!CM.Sim.HasAchiev("Mathematician")){if(CM.Sim.Objects[i].amount=1)CM.Sim.Win("One with everything");if(mathematician===1)CM.Sim.Win("Mathematician");if(base10===1)CM.Sim.Win("Base 10");if(minAmount>=100)CM.Sim.Win("Centennial");if(minAmount>=150)CM.Sim.Win("Centennial and a half");if(minAmount>=200)CM.Sim.Win("Bicentennial");if(minAmount>=250)CM.Sim.Win("Bicentennial and a half");if(minAmount>=300)CM.Sim.Win("Tricentennial");if(minAmount>=350)CM.Sim.Win("Tricentennial and a half");if(minAmount>=400)CM.Sim.Win("Quadricentennial");if(minAmount>=450)CM.Sim.Win("Quadricentennial and a half");if(minAmount>=500)CM.Sim.Win("Quincentennial");if(minAmount>=550)CM.Sim.Win("Quincentennial and a half");if(minAmount>=600)CM.Sim.Win("Sexcentennial");if(buildingsOwned>=100)CM.Sim.Win("Builder");if(buildingsOwned>=500)CM.Sim.Win("Architect");if(buildingsOwned>=1e3)CM.Sim.Win("Engineer");if(buildingsOwned>=2e3)CM.Sim.Win("Lord of Constructs");if(buildingsOwned>=4e3)CM.Sim.Win("Grand design");if(buildingsOwned>=8e3)CM.Sim.Win("Ecumenopolis");if(CM.Sim.UpgradesOwned>=20)CM.Sim.Win("Enhancer");if(CM.Sim.UpgradesOwned>=50)CM.Sim.Win("Augmenter");if(CM.Sim.UpgradesOwned>=100)CM.Sim.Win("Upgrader");if(CM.Sim.UpgradesOwned>=200)CM.Sim.Win("Lord of Progress");if(CM.Sim.UpgradesOwned>=300)CM.Sim.Win("The full picture");if(CM.Sim.UpgradesOwned>=400)CM.Sim.Win("When there's nothing left to add");if(buildingsOwned>=4e3&&CM.Sim.UpgradesOwned>=300)CM.Sim.Win("Polymath");if(buildingsOwned>=8e3&&CM.Sim.UpgradesOwned>=400)CM.Sim.Win("Renaissance baker");if(CM.Sim.Objects.Cursor.amount+CM.Sim.Objects.Grandma.amount>=777)CM.Sim.Win("The elder scrolls");let hasAllHalloCook=true;for(let i of Object.keys(CM.Data.HalloCookies)){if(!CM.Sim.Has(CM.Data.HalloCookies[i]))hasAllHalloCook=false}if(hasAllHalloCook)CM.Sim.Win("Spooky cookies");let hasAllChristCook=true;for(let i of Object.keys(CM.Data.ChristCookies)){if(!CM.Sim.Has(CM.Data.ChristCookies[i]))hasAllChristCook=false}if(hasAllChristCook)CM.Sim.Win("Let it snow");if(CM.Sim.Has("Fortune cookies")){let list=Game.Tiers.fortune.upgrades;let fortunes=0;for(let i of Object.keys(list)){if(CM.Sim.Has(list[i].name))fortunes++}if(fortunes>=list.length)CM.Sim.Win("O Fortuna")}};CM.Sim.NoGoldSwitchCPS=function(){CM.Sim.CopyData();CM.Sim.Upgrades["Golden switch [off]"].bought=0;CM.Sim.CalculateGains();return CM.Sim.cookiesPs};CM.Sim.BuyBuildingsBonusIncome=function(building,amount){CM.Sim.CopyData();let me=CM.Sim.Objects[building];me.amount+=amount;if(building==="Cursor"){if(me.amount>=1)CM.Sim.Win("Click");if(me.amount>=2)CM.Sim.Win("Double-click");if(me.amount>=50)CM.Sim.Win("Mouse wheel");if(me.amount>=100)CM.Sim.Win("Of Mice and Men");if(me.amount>=200)CM.Sim.Win("The Digital");if(me.amount>=300)CM.Sim.Win("Extreme polydactyly");if(me.amount>=400)CM.Sim.Win("Dr. T");if(me.amount>=500)CM.Sim.Win("Thumbs, phalanges, metacarpals");if(me.amount>=600)CM.Sim.Win("With her finger and her thumb");if(me.amount>=700)CM.Sim.Win("Gotta hand it to you");if(me.amount>=800)CM.Sim.Win("The devil's workshop")}else{for(let j in Game.Objects[me.name].tieredAchievs){if(me.amount>=Game.Tiers[Game.Objects[me.name].tieredAchievs[j].tier].achievUnlock)CM.Sim.Win(Game.Objects[me.name].tieredAchievs[j].name)}}let lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!=CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}return CM.Sim.cookiesPs-Game.cookiesPs};CM.Sim.BuyUpgradesBonusIncome=function(upgrade){if(Game.Upgrades[upgrade].pool==="toggle"||Game.Upgrades[upgrade].bought===0&&Game.Upgrades[upgrade].unlocked&&Game.Upgrades[upgrade].pool!="prestige"){CM.Sim.CopyData();let me=CM.Sim.Upgrades[upgrade];me.bought=1;if(Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool))CM.Sim.UpgradesOwned++;if(upgrade==="Elder Pledge"){CM.Sim.pledges++;if(CM.Sim.pledges>0)CM.Sim.Win("Elder nap");if(CM.Sim.pledges>=5)CM.Sim.Win("Elder slumber")}else if(upgrade==="Elder Covenant"){CM.Sim.Win("Elder calm")}else if(upgrade==="Prism heart biscuits"){CM.Sim.Win("Lovely cookies")}else if(upgrade==="Heavenly key"){CM.Sim.Win("Wholesome")}let lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!=CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}let diffMouseCPS=CM.Sim.mouseCps()-Game.computedMouseCps;if(diffMouseCPS){return[CM.Sim.cookiesPs-Game.cookiesPs,diffMouseCPS]}return[CM.Sim.cookiesPs-Game.cookiesPs]}else{return[]}};CM.Sim.mouseCps=function(){let add=0;if(CM.Sim.Has("Thousand fingers"))add+=.1;if(CM.Sim.Has("Million fingers"))add*=5;if(CM.Sim.Has("Billion fingers"))add*=10;if(CM.Sim.Has("Trillion fingers"))add*=20;if(CM.Sim.Has("Quadrillion fingers"))add*=20;if(CM.Sim.Has("Quintillion fingers"))add*=20;if(CM.Sim.Has("Sextillion fingers"))add*=20;if(CM.Sim.Has("Septillion fingers"))add*=20;if(CM.Sim.Has("Octillion fingers"))add*=20;if(CM.Sim.Has("Nonillion fingers"))add*=20;let num=0;for(let i of Object.keys(CM.Sim.Objects)){num+=CM.Sim.Objects[i].amount}num-=CM.Sim.Objects.Cursor.amount;add=add*num;if(CM.Sim.Has("Plastic mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Iron mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Titanium mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Adamantium mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Unobtainium mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Eludium mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Wishalloy mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Fantasteel mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Nevercrack mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Armythril mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Technobsidian mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Plasmarble mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Miraculite mouse"))add+=CM.Sim.cookiesPs*.01;if(CM.Sim.Has("Fortune #104"))add+=CM.Sim.cookiesPs*.01;let mult=1;if(CM.Sim.Has("Santa's helpers"))mult*=1.1;if(CM.Sim.Has("Cookie egg"))mult*=1.1;if(CM.Sim.Has("Halo gloves"))mult*=1.1;if(CM.Sim.Has("Dragon claw"))mult*=1.03;if(CM.Sim.Has("Aura gloves")){mult*=1+.05*Math.min(Game.Objects.Cursor.level,CM.Sim.Has("Luminous gloves")?20:10)}mult*=CM.Sim.eff("click");if(CM.Sim.Objects.Temple.minigameLoaded){if(CM.Sim.hasGod){let godLvl=CM.Sim.hasGod("labor");if(godLvl===1)mult*=1.15;else if(godLvl===2)mult*=1.1;else if(godLvl===3)mult*=1.05}}for(let i of Object.keys(Game.buffs)){if(typeof Game.buffs[i].multClick!="undefined")mult*=Game.buffs[i].multClick}mult*=1+CM.Sim.auraMult("Dragon Cursor")*.05;let out=mult*Game.ComputeCps(1,CM.Sim.Has("Reinforced index finger")+CM.Sim.Has("Carpal tunnel prevention cream")+CM.Sim.Has("Ambidextrous"),add);out=Game.runModHookOnValue("cookiesPerClick",out);if(Game.hasBuff("Cursed finger"))out=Game.buffs["Cursed finger"].power;return out};CM.Sim.CalculateChangeAura=function(aura){CM.Sim.CopyData();let auraToBeChanged=l("promptContent").children[0].innerHTML.includes("secondary");if(auraToBeChanged)CM.Sim.dragonAura2=aura;else CM.Sim.dragonAura=aura;let price=0;if(CM.Sim.dragonAura!=CM.Cache.dragonAura||CM.Sim.dragonAura2!=CM.Cache.dragonAura2){for(let i=Game.ObjectsById.length;i>-1,--i;){if(Game.ObjectsById[i].amount>0){let highestBuilding=CM.Sim.Objects[Game.ObjectsById[i].name].name;CM.Sim.Objects[highestBuilding].amount-=1;CM.Sim.buildingsOwned-=1;price=CM.Sim.Objects[highestBuilding].basePrice*Math.pow(Game.priceIncrease,Math.max(0,CM.Sim.Objects[highestBuilding].amount-1-CM.Sim.Objects[highestBuilding].free));price=Game.modifyBuildingPrice(CM.Sim.Objects[highestBuilding],price);price=Math.ceil(price);break}}}let lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!=CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}return[CM.Sim.cookiesPs-Game.cookiesPs,price]};CM.Sim.ResetBonus=function(newHeavenlyChips){let curCPS=Game.cookiesPs;CM.Sim.CopyData();if(CM.Sim.Upgrades["Heavenly key"].bought===0){CM.Sim.Upgrades["Heavenly chip secret"].bought=1;CM.Sim.Upgrades["Heavenly cookie stand"].bought=1;CM.Sim.Upgrades["Heavenly bakery"].bought=1;CM.Sim.Upgrades["Heavenly confectionery"].bought=1;CM.Sim.Upgrades["Heavenly key"].bought=1;CM.Sim.CalculateGains();curCPS=CM.Sim.cookiesPs;CM.Sim.CopyData()}if(CM.Cache.RealCookiesEarned>=1e6)CM.Sim.Win("Sacrifice");if(CM.Cache.RealCookiesEarned>=1e9)CM.Sim.Win("Oblivion");if(CM.Cache.RealCookiesEarned>=1e12)CM.Sim.Win("From scratch");if(CM.Cache.RealCookiesEarned>=1e15)CM.Sim.Win("Nihilism");if(CM.Cache.RealCookiesEarned>=1e18)CM.Sim.Win("Dematerialize");if(CM.Cache.RealCookiesEarned>=1e21)CM.Sim.Win("Nil zero zilch");if(CM.Cache.RealCookiesEarned>=1e24)CM.Sim.Win("Transcendence");if(CM.Cache.RealCookiesEarned>=1e27)CM.Sim.Win("Obliterate");if(CM.Cache.RealCookiesEarned>=1e30)CM.Sim.Win("Negative void");if(CM.Cache.RealCookiesEarned>=1e33)CM.Sim.Win("To crumbs, you say?");if(CM.Cache.RealCookiesEarned>=1e36)CM.Sim.Win("You get nothing");if(CM.Cache.RealCookiesEarned>=1e39)CM.Sim.Win("Humble rebeginnings");if(CM.Cache.RealCookiesEarned>=1e42)CM.Sim.Win("The end of the world");if(CM.Cache.RealCookiesEarned>=1e45)CM.Sim.Win("Oh, you're back");if(CM.Cache.RealCookiesEarned>=1e48)CM.Sim.Win("Lazarus");if(CM.Cache.RealCookiesEarned>=1e51)CM.Sim.Win("Smurf account");if(CM.Cache.RealCookiesEarned>=1e54)CM.Sim.Win("If at first you don't succeed");CM.Sim.Upgrades["Heavenly chip secret"].bought=1;CM.Sim.Upgrades["Heavenly cookie stand"].bought=1;CM.Sim.Upgrades["Heavenly bakery"].bought=1;CM.Sim.Upgrades["Heavenly confectionery"].bought=1;CM.Sim.Upgrades["Heavenly key"].bought=1;CM.Sim.prestige=newHeavenlyChips;let lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!=CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}let ResetCPS=CM.Sim.cookiesPs-curCPS;CM.Sim.prestige=Game.prestige;return ResetCPS};CM.Sim.SellBuildingsForChoEgg=function(){let sellTotal=0;CM.Sim.CopyData();let buildingsToSacrifice=2;if(CM.Sim.dragonAura===5||CM.Sim.dragonAura===18){--buildingsToSacrifice}if(CM.Sim.dragonAura2===5||CM.Sim.dragonAura2===18){--buildingsToSacrifice}CM.Sim.dragonAura=5;CM.Sim.dragonAura2=18;for(let i=0;i0){highestBuilding=CM.Sim.Objects[j]}}highestBuilding.amount--;CM.Sim.buildingsOwned--}for(let i of Object.keys(CM.Sim.Objects)){let me=CM.Sim.Objects[i];sellTotal+=CM.Sim.BuildingSell(Game.Objects[me.name],Game.Objects[i].basePrice,me.amount,Game.Objects[i].free,me.amount)}return sellTotal};CM.init=function(){CM.Footer.isInitzializing=true;let proceed=true;if(Game.version!=CM.VersionMajor){proceed=confirm("Cookie Monster version "+CM.VersionMajor+"."+CM.VersionMinor+" is meant for Game version "+CM.VersionMajor+". Loading a different version may cause errors. Do you still want to load Cookie Monster?")}if(proceed){CM.Main.DelayInit();Game.registerHook("draw",CM.Disp.Draw);Game.registerHook("logic",CM.Main.Loop);CM.Footer.isInitzializing=false}};CM.save=function(){return JSON.stringify({settings:CM.Options,version:CM.VersionMajor+"."+CM.VersionMinor})};CM.load=function(str){let save=JSON.parse(str);CM.Config.LoadConfig(save.settings)};CM.Footer.AddJscolor=function(){CM.Footer.Jscolor=document.createElement("script");CM.Footer.Jscolor.type="text/javascript";CM.Footer.Jscolor.setAttribute("src","https://aktanusa.github.io/CookieMonster/jscolor/jscolor.js");document.head.appendChild(CM.Footer.Jscolor)};if(typeof CM.Footer.isInitzializing==="undefined"){CM.Footer.AddJscolor();let delay=setInterval((function(){if(typeof jscolor!=="undefined"){jscolor.init();Game.registerMod("CookieMonster",CM);clearInterval(delay)}}),500)} \ No newline at end of file diff --git a/src/Cache.js b/src/Cache.js index e6521dd..dfd331f 100644 --- a/src/Cache.js +++ b/src/Cache.js @@ -25,6 +25,27 @@ CM.Cache.InitCache = function() { CM.Cache.CachePP(); }; +/** + * This functions caches variables that are needed every loop + * It is called by CM.Main.Loop() + * @global {string} CM.Cache.TimeTillNextPrestige Time requried till next prestige level + */ +CM.Cache.LoopCache = function() { + // Update Wrinkler Bank + CM.Cache.CacheWrinklers(); + + // Calculate PP + CM.Cache.CachePP(); + + // Cache average CPS + CM.Cache.CacheCurrWrinklerCPS(); + CM.Cache.CacheAvgCPS(); + + let cookiesToNext = Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + 1) - (Game.cookiesEarned + Game.cookiesReset); + CM.Cache.TimeTillNextPrestige = CM.Disp.FormatTime(cookiesToNext / CM.Cache.AvgCPS); +}; + + /******** * Section: Functions related to Dragon Auras */ @@ -45,7 +66,7 @@ CM.Cache.CacheDragonAuras = function() { /** * This functions caches data related to Wrinklers - * It is called by CM.Main.Loop() and CM.Cache.InitCache() + * It is called by CM.Cache.LoopCache() and CM.Cache.InitCache() * @global {number} CM.Cache.WrinklersTotal The cookies of all wrinklers * @global {number} CM.Cache.WrinklersNormal The cookies of all normal wrinklers * @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest non-shiny wrinkler @@ -55,14 +76,14 @@ CM.Cache.CacheWrinklers = function() { CM.Cache.WrinklersNormal = 0; CM.Cache.WrinklersFattest = [0, null]; for (let i = 0; i < Game.wrinklers.length; i++) { - var sucked = Game.wrinklers[i].sucked; - var toSuck = 1.1; + let sucked = Game.wrinklers[i].sucked; + let toSuck = 1.1; if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05; if (Game.wrinklers[i].type==1) toSuck *= 3; // Shiny wrinklers sucked *= toSuck; if (Game.Has('Wrinklerspawn')) sucked *= 1.05; if (CM.Sim.Objects.Temple.minigameLoaded) { - var godLvl = Game.hasGod('scorn'); + let godLvl = Game.hasGod('scorn'); if (godLvl === 1) sucked *= 1.15; else if (godLvl === 2) sucked *= 1.1; else if (godLvl === 3) sucked *= 1.05; @@ -79,7 +100,7 @@ CM.Cache.CacheWrinklers = function() { * Section: Functions related to Caching stats */ /** - * This functions caches variables related to the stats apge + * This functions caches variables related to the stats page * It is called by CM.Main.Loop() upon changes to cps and CM.Cache.InitCache() * @global {number} CM.Cache.Lucky Cookies required for max Lucky * @global {number} CM.Cache.LuckyReward Reward for max normal Lucky @@ -125,7 +146,7 @@ CM.Cache.CacheStats = function() { /** * This functions calculates the multipliers of Golden and Wrath cookie rewards - * It is mostly used by CM.Cache.MaxChainMoni() and CM.Cache.CacheChain() + * It is mostly used by CM.Cache.MaxChainCookieReward() and CM.Cache.CacheChain() * It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.CacheChain() * @param {number} CM.Cache.GoldenCookiesMult Multiplier for golden cookies * @param {number} CM.Cache.WrathCookiesMult Multiplier for wrath cookies @@ -137,9 +158,9 @@ CM.Cache.CacheGoldenAndWrathCookiesMults = function() { CM.Cache.WrathCookiesMult = 1; CM.Cache.DragonsFortuneMultAdjustment = 1; } else { - var goldenMult = 1; - var wrathMult = 1; - var mult = 1; + let goldenMult = 1; + let wrathMult = 1; + let mult = 1; // Factor auras and upgrade in mults if (CM.Sim.Has('Green yeast digestives')) mult *= 1.01; @@ -166,21 +187,21 @@ CM.Cache.CacheGoldenAndWrathCookiesMults = function() { }; /** - * This functions calculates the max possible payout + * This functions calculates the max possible payout given a set of variables * It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.CacheChain() * @param {number} digit Number of Golden Cookies in chain * @param {number} maxPayout Maximum payout * @param {number} mult Multiplier * @returns [{number, number}] Total cookies earned, and cookies needed for next level */ -CM.Cache.MaxChainMoni = function(digit, maxPayout, mult) { +CM.Cache.MaxChainCookieReward = function(digit, maxPayout, mult) { let totalFromChain = 0; let moni = 0; let nextMoni = 0; - var chain = 1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10); + let chain = 1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10); while (nextMoni < maxPayout) { moni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain) * digit * mult), maxPayout)); - // TODO: Calculate Cookies or cps needed for next level of chain + // TODO: Calculate Cookies or cps needed for next level of chain. Related to issue #580 nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain + 1) * digit * mult), maxPayout)); totalFromChain += moni; chain++; @@ -211,20 +232,21 @@ CM.Cache.CacheChain = function() { if (cpsBuffMult > 0) maxPayout /= cpsBuffMult; else maxPayout = 0; - CM.Cache.ChainReward = CM.Cache.MaxChainMoni(7, maxPayout * CM.Cache.GoldenCookiesMult, CM.Cache.GoldenCookiesMult); - // TODO: All "required" variables are incorrect. Perhaps something to do with going over the required amount during the chain + CM.Cache.ChainReward = CM.Cache.MaxChainCookieReward(7, maxPayout * CM.Cache.GoldenCookiesMult, CM.Cache.GoldenCookiesMult); + // TODO: All "required" variables are incorrect. Perhaps something to do with going over the required amount during the chain. + // See issue #580 on the Github CM.Cache.ChainRequired = CM.Cache.ChainReward[0] * 2; CM.Cache.ChainRequiredNext = CM.Cache.ChainReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment; - CM.Cache.ChainWrathReward = CM.Cache.MaxChainMoni(6, maxPayout * CM.Cache.WrathCookiesMult, CM.Cache.WrathCookiesMult); + CM.Cache.ChainWrathReward = CM.Cache.MaxChainCookieReward(6, maxPayout * CM.Cache.WrathCookiesMult, CM.Cache.WrathCookiesMult); CM.Cache.ChainWrathRequired = CM.Cache.ChainWrathReward[0] * 2; CM.Cache.ChainWrathRequiredNext = CM.Cache.ChainWrathReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment; - CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7 * CM.Cache.GoldenCookiesMult, CM.Cache.GoldenCookiesMult); + CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainCookieReward(7, maxPayout * 7 * CM.Cache.GoldenCookiesMult, CM.Cache.GoldenCookiesMult); CM.Cache.ChainFrenzyRequired = CM.Cache.ChainFrenzyReward[0] * 2; CM.Cache.ChainFrenzyRequiredNext = CM.Cache.ChainFrenzyReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment; - CM.Cache.ChainFrenzyWrathReward = CM.Cache.MaxChainMoni(6, maxPayout * 7 * CM.Cache.WrathCookiesMult, CM.Cache.WrathCookiesMult); + CM.Cache.ChainFrenzyWrathReward = CM.Cache.MaxChainCookieReward(6, maxPayout * 7 * CM.Cache.WrathCookiesMult, CM.Cache.WrathCookiesMult); CM.Cache.ChainFrenzyWrathRequired = CM.Cache.ChainFrenzyReward[0] * 2; CM.Cache.ChainFrenzyWrathRequiredNext = CM.Cache.ChainFrenzyReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment; }; @@ -240,12 +262,12 @@ CM.Cache.CacheMissingUpgrades = function() { CM.Cache.MissingUpgrades = ""; CM.Cache.MissingUpgradesCookies = ""; CM.Cache.MissingUpgradesPrestige = ""; - var list = []; + let list = []; //sort the upgrades for (let i of Object.keys(Game.Upgrades)) { list.push(Game.Upgrades[i]); } - var sortMap = function(a, b) { + let sortMap = function(a, b) { if (a.order>b.order) return 1; else if (a.order this.maxLength) timePeriod = this.maxLength; if (timePeriod > this.queue.length) timePeriod = this.queue.length; - var ret = 0; + let ret = 0; for (let i = this.queue.length - 1; i >= 0 && i > this.queue.length - 1 - timePeriod; i--) { ret += this.queue[i]; } @@ -330,39 +356,37 @@ CM.Cache.InitCookiesDiff = function() { /** * This functions caches two variables related average CPS and Clicks - * It is called by CM.Main.Loop() - * TODO: Check if this can be made more concise + * It is called by CM.Cache.LoopCache() * @global {number} CM.Cache.RealCookiesEarned Cookies earned including the Chocolate Egg * @global {number} CM.Cache.AvgCPS Average cookies over time-period as defined by AvgCPSHist * @global {number} CM.Cache.AverageClicks Average cookies from clicking over time-period as defined by AvgClicksHist * @global {number} CM.Cache.AvgCPSChoEgg Average cookies from combination of normal CPS and average Chocolate Cookie CPS */ CM.Cache.CacheAvgCPS = function() { - var currDate = Math.floor(Date.now() / 1000); + let currDate = Math.floor(Date.now() / 1000); // Only calculate every new second if ((Game.T / Game.fps) % 1 === 0) { - var choEggTotal = Game.cookies + CM.Cache.SellForChoEgg; - if (Game.cpsSucked > 0) { - choEggTotal += CM.Cache.WrinklersTotal; - } + let choEggTotal = Game.cookies + CM.Cache.SellForChoEgg; + if (Game.cpsSucked > 0) choEggTotal += CM.Cache.WrinklersTotal; CM.Cache.RealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal); choEggTotal *= 0.05; - if (CM.Cache.lastDate != -1) { - var timeDiff = currDate - CM.Cache.lastDate; - var bankDiffAvg = Math.max(0, (Game.cookies - CM.Cache.lastCookies)) / timeDiff; - var wrinkDiffAvg = Math.max(0, (CM.Cache.WrinklersTotal - CM.Cache.lastWrinkCookies)) / timeDiff; - var wrinkFattestDiffAvg = Math.max(0, (CM.Cache.WrinklersFattest[0] - CM.Cache.lastWrinkFattestCookies)) / timeDiff; - var choEggDiffAvg = Math.max(0,(choEggTotal - CM.Cache.lastChoEgg)) / timeDiff; - var clicksDiffAvg = (Game.cookieClicks - CM.Cache.lastClicks) / timeDiff; - for (let i = 0; i < timeDiff; i++) { - CM.Cache.CookiesDiff.addLatest(bankDiffAvg); - CM.Cache.WrinkDiff.addLatest(wrinkDiffAvg); - CM.Cache.WrinkFattestDiff.addLatest(wrinkFattestDiffAvg); - CM.Cache.ChoEggDiff.addLatest(choEggDiffAvg); - CM.Cache.ClicksDiff.addLatest(clicksDiffAvg); - } + // Add recent gains to AvgQueue's + let timeDiff = currDate - CM.Cache.lastDate; + let bankDiffAvg = Math.max(0, (Game.cookies - CM.Cache.lastCookies)) / timeDiff; + let wrinkDiffAvg = Math.max(0, (CM.Cache.WrinklersTotal - CM.Cache.lastWrinkCookies)) / timeDiff; + let wrinkFattestDiffAvg = Math.max(0, (CM.Cache.WrinklersFattest[0] - CM.Cache.lastWrinkFattestCookies)) / timeDiff; + let choEggDiffAvg = Math.max(0,(choEggTotal - CM.Cache.lastChoEgg)) / timeDiff; + let clicksDiffAvg = (Game.cookieClicks - CM.Cache.lastClicks) / timeDiff; + for (let i = 0; i < timeDiff; i++) { + CM.Cache.CookiesDiff.addLatest(bankDiffAvg); + CM.Cache.WrinkDiff.addLatest(wrinkDiffAvg); + CM.Cache.WrinkFattestDiff.addLatest(wrinkFattestDiffAvg); + CM.Cache.ChoEggDiff.addLatest(choEggDiffAvg); + CM.Cache.ClicksDiff.addLatest(clicksDiffAvg); } + + // Store current data for next loop CM.Cache.lastDate = currDate; CM.Cache.lastCookies = Game.cookies; CM.Cache.lastWrinkCookies = CM.Cache.WrinklersTotal; @@ -370,18 +394,17 @@ CM.Cache.CacheAvgCPS = function() { CM.Cache.lastChoEgg = choEggTotal; CM.Cache.lastClicks = Game.cookieClicks; - var cpsLength = CM.Disp.cookieTimes[CM.Options.AvgCPSHist]; - + // Get average gain over period of cpsLength seconds + let cpsLength = CM.Disp.cookieTimes[CM.Options.AvgCPSHist]; CM.Cache.AverageGainBank = CM.Cache.CookiesDiff.calcAverage(cpsLength); CM.Cache.AverageGainWrink = CM.Cache.WrinkDiff.calcAverage(cpsLength); CM.Cache.AverageGainWrinkFattest = CM.Cache.WrinkFattestDiff.calcAverage(cpsLength); CM.Cache.AverageGainChoEgg = CM.Cache.ChoEggDiff.calcAverage(cpsLength); - CM.Cache.AvgCPS = CM.Cache.AverageGainBank; if (CM.Options.CalcWrink === 1) CM.Cache.AvgCPS += CM.Cache.AverageGainWrink; if (CM.Options.CalcWrink === 2) CM.Cache.AvgCPS += CM.Cache.AverageGainWrinkFattest; - var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); + let choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); if (choEgg || CM.Options.CalcWrink === 0) { CM.Cache.AvgCPSWithChoEgg = CM.Cache.AverageGainBank + CM.Cache.AverageGainWrink + (choEgg ? CM.Cache.AverageGainChoEgg : 0); @@ -398,13 +421,13 @@ CM.Cache.CacheAvgCPS = function() { * @global {number} CM.Cache.SellForChoEgg Total cookies to be gained from selling Chocolate egg */ CM.Cache.CacheSellForChoEgg = function() { - var sellTotal = 0; + let sellTotal = 0; // Compute cookies earned by selling stock market goods if (Game.Objects.Bank.minigameLoaded) { - var marketGoods = Game.Objects.Bank.minigame.goods; - var goodsVal = 0; + let marketGoods = Game.Objects.Bank.minigame.goods; + let goodsVal = 0; for (let i of Object.keys(marketGoods)) { - var marketGood = marketGoods[i]; + let marketGood = marketGoods[i]; goodsVal += marketGood.stock * marketGood.val; } sellTotal += goodsVal * Game.cookiesPsRawHighest; @@ -416,7 +439,7 @@ CM.Cache.CacheSellForChoEgg = function() { /** * This functions caches the current Wrinkler CPS multiplier - * It is called by CM.Main.Loop(). Variables are mostly used by CM.Disp.GetCPS(). + * It is called by CM.Cache.LoopCache(). Variables are mostly used by CM.Disp.GetCPS(). * @global {number} CM.Cache.CurrWrinklerCount Current number of wrinklers * @global {number} CM.Cache.CurrWrinklerCPSMult Current multiplier of CPS because of wrinklers (excluding their negative sucking effect) */ @@ -428,7 +451,7 @@ CM.Cache.CacheCurrWrinklerCPS = function() { } let godMult = 1; if (CM.Sim.Objects.Temple.minigameLoaded) { - var godLvl = Game.hasGod('scorn'); + let godLvl = Game.hasGod('scorn'); if (godLvl === 1) godMult *= 1.15; else if (godLvl === 2) godMult *= 1.1; else if (godLvl === 3) godMult *= 1.05; @@ -443,7 +466,7 @@ CM.Cache.CacheCurrWrinklerCPS = function() { * @returns {number} mult The multiplier */ CM.Cache.getCPSBuffMult = function() { - var mult = 1; + let mult = 1; for (let i of Object.keys(Game.buffs)) { if (typeof Game.buffs[i].multCpS != 'undefined') mult *= Game.buffs[i].multCpS; } @@ -474,8 +497,8 @@ CM.Cache.NoGoldSwitchCPS = function() { CM.Cache.CacheDragonCost = function() { if (CM.Cache.lastDragonLevel != Game.dragonLevel || CM.Sim.DoSims) { if (Game.dragonLevel < 25 && Game.dragonLevels[Game.dragonLevel].buy.toString().includes("sacrifice")) { - var target = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1]; - var amount = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/sacrifice\((.*?)\)/)[1]; + let target = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1]; + let amount = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/sacrifice\((.*?)\)/)[1]; if (target != "i") { target = target.replaceAll("'", ""); if (Game.Objects[target].amount < amount) { @@ -588,7 +611,7 @@ CM.Cache.CacheBuildingsPrices = function() { /** * This functions caches the PP of each building and upgrade and stores it in the cache - * It is called by CM.Main.Loop() and CM.Cache.InitCache() + * It is called by CM.Cache.LoopCache() and CM.Cache.InitCache() */ CM.Cache.CachePP = function() { CM.Cache.CacheBuildingsPP(); diff --git a/src/Config.js b/src/Config.js index f36f689..ddf3484 100644 --- a/src/Config.js +++ b/src/Config.js @@ -33,7 +33,7 @@ CM.Config.LoadConfig = function(settings) { CM.Options = settings; // Check values - var mod = false; + let mod = false; for (let i in CM.Data.ConfigDefault) { if (typeof CM.Options[i] === 'undefined') { mod = true; diff --git a/src/Data.js b/src/Data.js index c047ed9..3498dc5 100644 --- a/src/Data.js +++ b/src/Data.js @@ -86,7 +86,7 @@ CM.Data.ConfigGroups = { BarsColors: "Bars/Colors", Calculation: "Calculation", Notification: "Notification", - Tooltip: "Tooltips", + Tooltip: "Tooltips and additional insights", Statistics: "Statistics", Notation: "Notation", Miscellaneous: "Miscellaneous" @@ -223,6 +223,7 @@ CM.Data.Config.TooltipWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler CM.Data.Config.TooltipLump = {type: 'bool', group: 'Tooltip', label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true}; CM.Data.Config.TooltipPlots = {type: 'bool', group: 'Tooltip', label: ['Garden Plots Tooltip OFF', 'Garden Plots Tooltip ON'], desc: 'Shows a tooltip for plants that have a cookie reward.', toggle: true}; CM.Data.Config.DragonAuraInfo = {type: 'bool', group: 'Tooltip', label: ['Extra Dragon Aura Info OFF', 'Extra Dragon Aura Info ON'], desc: 'Shows information about changes in CPS and costs in the dragon aura interface.', toggle: true}; +CM.Data.Config.TooltipAscendButton = {type: 'bool', group: 'Tooltip', label: ['Show Time Left Ascend Tooltip OFF', 'Show Time Left Ascend Tooltip ON'], desc: 'Shows the time left in the ascend tooltip until next heavenly cookie.', toggle: true}; // Statistics CM.Data.Config.Stats = {type: 'bool', group: 'Statistics', label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true}; @@ -313,6 +314,7 @@ CM.Data.ConfigDefault = { TooltipLump: 1, TooltipPlots: 1, DragonAuraInfo: 1, + TooltipAscendButton: 1, Stats: 1, MissingUpgrades: 1, UpStats: 1, diff --git a/src/Disp.js b/src/Disp.js index 847cc68..658d2e0 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -71,7 +71,7 @@ CM.Disp.GetCPS = function() { * @returns {number} count / Game.fps The time it takes to reach targetMagic */ CM.Disp.CalculateGrimoireRefillTime = function(currentMagic, maxMagic, targetMagic) { - var count = 0; + let count = 0; while (currentMagic < targetMagic) { currentMagic += Math.max(0.002, Math.pow(currentMagic / Math.max(maxMagic, 100), 0.5)) * 0.002; count++; @@ -82,42 +82,23 @@ CM.Disp.CalculateGrimoireRefillTime = function(currentMagic, maxMagic, targetMag /** * This function returns Name and Color as object for sugar lump type that is given as input param. * It is called by CM.Disp.UpdateTooltipSugarLump() - * TODO: Can't this be done with a normal array in Data.js? Or as variable-array at end of this file? * @param {string} type Sugar Lump Type. * @returns {{string}, {string}} text, color An array containing the text and display-color of the sugar lump */ CM.Disp.GetLumpColor = function(type) { - var name = ""; - var color = ""; - - switch (type) { - case 0: - name = "Normal"; - color = CM.Disp.colorGray; - break; - case 1: - name = "Bifurcated"; - color = CM.Disp.colorGreen; - break; - case 2: - name = "Golden"; - color = CM.Disp.colorYellow; - break; - case 3: - name = "Meaty"; - color = CM.Disp.colorOrange; - break; - case 4: - name = "Caramelized"; - color = CM.Disp.colorPurple; - break; - default: - name = "Unknown Sugar Lump"; - color = CM.Disp.colorRed; - break; - } - - return {text: name, color: color}; + if (type === 0) { + return {text: "Normal", color: CM.Disp.colorGray}; + } else if (type === 1) { + return {text: "Bifurcated", color: CM.Disp.colorGreen}; + } else if (type === 2) { + return {text: "Golden", color: CM.Disp.colorYellow}; + } else if (type === 3) { + return {text: "Meaty", color: CM.Disp.colorOrange}; + } else if (type === 4) { + return {text: "Caramelized", color: CM.Disp.colorPurple}; + } else { + return {text: "Unknown Sugar Lump", color: CM.Disp.colorRed}; + } }; /******** @@ -132,11 +113,11 @@ CM.Disp.GetLumpColor = function(type) { CM.Disp.FormatTime = function(time, longFormat) { if (time === Infinity) return time; time = Math.ceil(time); - var y = Math.floor(time / 31557600); - var d = Math.floor(time % 31557600 / 86400); - var h = Math.floor(time % 86400 / 3600); - var m = Math.floor(time % 3600 / 60); - var s = Math.floor(time % 60); + let y = Math.floor(time / 31557600); + let d = Math.floor(time % 31557600 / 86400); + let h = Math.floor(time % 86400 / 3600); + let m = Math.floor(time % 3600 / 60); + let s = Math.floor(time % 60); let str = ''; if (CM.Options.TimeFormat) { if (time > 3155760000) return 'XX:XX:XX:XX:XX'; @@ -162,8 +143,8 @@ CM.Disp.FormatTime = function(time, longFormat) { * @returns {{string, string}} {text, color} Both the formatted time and color as strings in an array */ CM.Disp.GetTimeColor = function(time) { - var color; - var text; + let color; + let text; if (time < 0) { if (CM.Options.TimeFormat) text = '00:00:00:00:00'; else text = 'Done!'; @@ -186,12 +167,12 @@ CM.Disp.GetTimeColor = function(time) { * @returns {string} Formatted number */ CM.Disp.Beautify = function(num, floats, forced) { - var decimals = CM.Options.ScaleDecimals + 1; + let decimals = CM.Options.ScaleDecimals + 1; if (CM.Options.Scale === 0) { return CM.Backup.Beautify(num, floats); } else if (isFinite(num)) { - var answer = ''; + let answer = ''; if (num === 0) { return num.toString(); } @@ -266,7 +247,7 @@ CM.Disp.UpdateAscendState = function() { if (Game.OnAscend) { l('game').style.bottom = '0px'; if (CM.Options.BotBar === 1) CM.Disp.BotBar.style.display = 'none'; - if (CM.Options.TimerBar === 1) CM.Disp.f.style.display = 'none'; + if (CM.Options.TimerBar === 1) CM.Disp.TimerBar.style.display = 'none'; } else { CM.Disp.ToggleBotBar(); @@ -286,6 +267,18 @@ CM.Disp.CreateCssArea = function() { document.head.appendChild(CM.Disp.Css); }; +/** + * This function updates the style of the building and upgrade sections to make these sortable + * It is called by CM.Main.DelayInit() + */ +CM.Disp.UpdateBuildingUpgradeStyle = function() { + l("products").style.display = "grid"; + l("storeBulk").style.gridRow = "1/1"; + + l("upgrades").style.display = "flex"; + l("upgrades").style["flex-wrap"] = "wrap"; +}; + /** * This function sets the size of the background of the full game and the left column * depending on whether certain abrs are activated @@ -308,7 +301,7 @@ CM.Disp.Draw = function () { (Game.prefs.autosave && Game.drawT % 10 === 0) && // with autosave ON and every 10 ticks (Game.onMenu === 'stats' && CM.Options.Stats) // while being on the stats menu only ) { - var timer = document.getElementById('CMStatsAutosaveTimer'); + let timer = document.getElementById('CMStatsAutosaveTimer'); if (timer) { timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4); } @@ -367,36 +360,32 @@ CM.Disp.CreateBotBar = function() { CM.Disp.BotBar.style.position = 'absolute'; CM.Disp.BotBar.style.display = 'none'; CM.Disp.BotBar.style.backgroundColor = '#262224'; - // This is old code for very old browsersand should not be needed anymore - //CM.Disp.BotBar.style.backgroundImage = '-moz-linear-gradient(top, #4d4548, #000000)'; - //CM.Disp.BotBar.style.backgroundImage = '-o-linear-gradient(top, #4d4548, #000000)'; - //CM.Disp.BotBar.style.backgroundImage = '-webkit-linear-gradient(top, #4d4548, #000000)'; CM.Disp.BotBar.style.backgroundImage = 'linear-gradient(to bottom, #4d4548, #000000)'; CM.Disp.BotBar.style.borderTop = '1px solid black'; CM.Disp.BotBar.style.overflow = 'auto'; CM.Disp.BotBar.style.textShadow = '-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black'; - var table = CM.Disp.BotBar.appendChild(document.createElement('table')); + let table = CM.Disp.BotBar.appendChild(document.createElement('table')); table.style.width = '100%'; table.style.textAlign = 'center'; table.style.whiteSpace = 'nowrap'; - var tbody = table.appendChild(document.createElement('tbody')); + let tbody = table.appendChild(document.createElement('tbody')); - var firstCol = function(text, color) { - var td = document.createElement('td'); + let firstCol = function(text, color) { + let td = document.createElement('td'); td.style.textAlign = 'right'; td.className = CM.Disp.colorTextPre + color; td.textContent = text; return td; }; - var type = tbody.appendChild(document.createElement('tr')); + let type = tbody.appendChild(document.createElement('tr')); type.style.fontWeight = 'bold'; type.appendChild(firstCol('CM ' + CM.VersionMajor + '.' + CM.VersionMinor, CM.Disp.colorYellow)); - var bonus = tbody.appendChild(document.createElement('tr')); + let bonus = tbody.appendChild(document.createElement('tr')); bonus.appendChild(firstCol('Bonus Income', CM.Disp.colorBlue)); - var pp = tbody.appendChild(document.createElement('tr')); + let pp = tbody.appendChild(document.createElement('tr')); pp.appendChild(firstCol('Payback Period', CM.Disp.colorBlue)); - var time = tbody.appendChild(document.createElement('tr')); + let time = tbody.appendChild(document.createElement('tr')); time.appendChild(firstCol('Time Left', CM.Disp.colorBlue)); for (let i of Object.keys(Game.Objects)) { @@ -412,7 +401,7 @@ CM.Disp.CreateBotBar = function() { */ CM.Disp.UpdateBotBar = function() { if (CM.Options.BotBar === 1 && CM.Cache.Objects1) { - var count = 0; + let count = 0; for (let i of Object.keys(CM.Cache.Objects1)) { let target = `Objects${Game.buyBulk}` count++; @@ -420,7 +409,7 @@ CM.Disp.UpdateBotBar = function() { CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache[target][i].bonus, 2); CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache[target][i].color; CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache[target][i].pp, 2); - var timeColor = CM.Disp.GetTimeColor((Game.Objects[i].bulkPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()); + let timeColor = CM.Disp.GetTimeColor((Game.Objects[i].bulkPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()); CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[count].className = CM.Disp.colorTextPre + timeColor.color; if (timeColor.text === "Done!" && Game.cookies < Game.Objects[i].bulkPrice) { CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[count].textContent = timeColor.text + " (with Wrink)"; @@ -442,13 +431,13 @@ CM.Disp.CreateBotBarBuildingColumn = function(buildingName) { return; // CreateBotBar will call this function again } - var type = CM.Disp.BotBar.firstChild.firstChild.childNodes[0]; - var bonus = CM.Disp.BotBar.firstChild.firstChild.childNodes[1]; - var pp = CM.Disp.BotBar.firstChild.firstChild.childNodes[2]; - var time = CM.Disp.BotBar.firstChild.firstChild.childNodes[3]; + let type = CM.Disp.BotBar.firstChild.firstChild.childNodes[0]; + let bonus = CM.Disp.BotBar.firstChild.firstChild.childNodes[1]; + let pp = CM.Disp.BotBar.firstChild.firstChild.childNodes[2]; + let time = CM.Disp.BotBar.firstChild.firstChild.childNodes[3]; let i = buildingName; - var header = type.appendChild(document.createElement('td')); + let header = type.appendChild(document.createElement('td')); header.appendChild(document.createTextNode((i.indexOf(' ') != -1 ? i.substring(0, i.indexOf(' ')) : i) + ' (')); let span = header.appendChild(document.createElement('span')); @@ -521,7 +510,7 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) { div.style.right = '0px'; div.style.bottom = '0px'; - var type = document.createElement('span'); + let type = document.createElement('span'); type.style.display = 'inline-block'; type.style.textAlign = 'right'; type.style.fontSize = "10px"; @@ -532,7 +521,7 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) { div.appendChild(type); for (let i = 0; i < bars.length; i++) { - var colorBar = document.createElement('span'); + let colorBar = document.createElement('span'); colorBar.id = bars[i].id; colorBar.style.display = 'inline-block'; colorBar.style.height = '10px'; @@ -548,7 +537,7 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) { div.appendChild(colorBar); } - var timer = document.createElement('span'); + let timer = document.createElement('span'); timer.id = id + 'Time'; timer.style.marginLeft = '5px'; timer.style.verticalAlign = 'text-top'; @@ -566,10 +555,10 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) { CM.Disp.UpdateTimerBar = function() { if (CM.Options.TimerBar === 1) { // label width: 113, timer width: 30, div margin: 20 - var maxWidthTwoBar = CM.Disp.TimerBar.offsetWidth - 163; + let maxWidthTwoBar = CM.Disp.TimerBar.offsetWidth - 163; // label width: 113, div margin: 20, calculate timer width at runtime - var maxWidthOneBar = CM.Disp.TimerBar.offsetWidth - 133; - var numberOfTimers = 0; + let maxWidthOneBar = CM.Disp.TimerBar.offsetWidth - 133; + let numberOfTimers = 0; // Regulates visibility of Golden Cookie timer if (Game.shimmerTypes.golden.spawned === 0 && !Game.Has('Golden switch [off]')) { @@ -618,7 +607,7 @@ CM.Disp.UpdateTimerBar = function() { if (Game.buffs[i]) { let timer = CM.Disp.TimerBarCreateBar(Game.buffs[i].name, Game.buffs[i].name, [{id: Game.buffs[i].name + 'Bar'}]); timer.style.display = ''; - var classColor = ''; + let classColor = ''; // Gives specific timers specific colors if (typeof CM.Disp.buffColors[Game.buffs[i].name] !== 'undefined') { classColor = CM.Disp.buffColors[Game.buffs[i].name]; @@ -733,7 +722,7 @@ CM.Disp.UpdateBuildings = function() { } else if (Game.buyMode === -1) { for (let i of Object.keys(CM.Cache.Objects1)) { - var o = Game.Objects[i]; + let o = Game.Objects[i]; l('productPrice' + o.id).style.color = ''; /* * Fix sell price displayed in the object in the store. @@ -753,7 +742,7 @@ CM.Disp.UpdateBuildings = function() { if (Game.buyMode === 1 && CM.Options.SortBuildings) { let arr = Object.keys(CM.Cache[target]).map(k => { - var o = CM.Cache[target][k]; + let o = CM.Cache[target][k]; o.name = k; o.id = Game.Objects[k].id; return o; @@ -767,7 +756,7 @@ CM.Disp.UpdateBuildings = function() { } else { let arr = Object.keys(CM.Cache.Objects1).map(k => { - var o = CM.Cache.Objects1[k]; + let o = CM.Cache.Objects1[k]; o.name = k; o.id = Game.Objects[k].id; return o; @@ -788,17 +777,17 @@ CM.Disp.UpdateBuildings = function() { CM.Disp.UpdateUpgrades = function() { // This counts the amount of upgrades for each pp group and updates the Upgrade Bar if (CM.Options.UpBarColor > 0) { - var blue = 0; - var green = 0; - var yellow = 0; - var orange = 0; - var red = 0; - var purple = 0; - var gray = 0; + let blue = 0; + let green = 0; + let yellow = 0; + let orange = 0; + let red = 0; + let purple = 0; + let gray = 0; for (let i of Object.keys(Game.UpgradesInStore)) { - var me = Game.UpgradesInStore[i]; - var addedColor = false; + let me = Game.UpgradesInStore[i]; + let addedColor = false; for (let j = 0; j < l('upgrade' + i).childNodes.length; j++) { if (l('upgrade' + i).childNodes[j].className.indexOf(CM.Disp.colorBackPre) != -1) { l('upgrade' + i).childNodes[j].className = CM.Disp.colorBackPre + CM.Cache.Upgrades[me.name].color; @@ -835,7 +824,7 @@ CM.Disp.UpdateUpgrades = function() { // This regulates sorting of upgrades let arr = []; for (let x = 0; x < Game.UpgradesInStore.length; x++){ - var o = {}; + let o = {}; o.name = Game.UpgradesInStore[x].name; o.price = Game.UpgradesInStore[x].basePrice; o.pp = CM.Cache.Upgrades[o.name].pp; @@ -908,11 +897,11 @@ CM.Disp.CreateUpgradeBar = function() { CM.Disp.UpgradeBar.style.zIndex = '21'; CM.Disp.UpgradeBar.onmouseout = function() { Game.tooltip.hide(); }; - var placeholder = document.createElement('div'); + let placeholder = document.createElement('div'); placeholder.appendChild(CM.Disp.CreateUpgradeBarLegend()); CM.Disp.UpgradeBar.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');}; - var upgradeNumber = function(id, color) { + let upgradeNumber = function(id, color) { let span = document.createElement('span'); span.id = id; span.className = CM.Disp.colorTextPre + color; @@ -937,7 +926,7 @@ CM.Disp.CreateUpgradeBar = function() { * @returns {object} legend The legend-object to be added */ CM.Disp.CreateUpgradeBarLegend = function() { - var legend = document.createElement('div'); + let legend = document.createElement('div'); legend.style.minWidth = '330px'; legend.style.marginBottom = '4px'; let title = document.createElement('div'); @@ -946,7 +935,7 @@ CM.Disp.CreateUpgradeBarLegend = function() { title.textContent = 'Legend'; legend.appendChild(title); - var legendLine = function(color, text) { + let legendLine = function(color, text) { let div = document.createElement('div'); div.style.verticalAlign = 'middle'; let span = document.createElement('span'); @@ -1025,7 +1014,7 @@ CM.Disp.Flash = function(mode, config) { CM.Disp.PlaySound = function(url, sndConfig, volConfig) { // The arguments check makes the sound not play upon initialization of the mod if (CM.Options[sndConfig] === 1 && CM.Footer.isInitzializing === false) { - var sound = new realAudio(url); + let sound = new realAudio(url); if (CM.Options.GeneralSound) sound.volume = (CM.Options[volConfig] / 100) * (Game.volume / 100); else sound.volume = (CM.Options[volConfig] / 100); sound.play(); @@ -1042,7 +1031,7 @@ CM.Disp.PlaySound = function(url, sndConfig, volConfig) { CM.Disp.Notification = function(notifyConfig, title, message) { // The arguments check makes the sound not play upon initialization of the mod if (CM.Options[notifyConfig] === 1 && document.visibilityState === 'hidden' && CM.Footer.isInitzializing === false) { - var CookieIcon = 'https://orteil.dashnet.org/cookieclicker/favicon.ico'; + let CookieIcon = 'https://orteil.dashnet.org/cookieclicker/favicon.ico'; new Notification(title, {body: message, badge: CookieIcon}); } }; @@ -1205,7 +1194,7 @@ CM.Disp.ToggleGCTimer = function() { */ CM.Disp.CreateSimpleTooltip = function(placeholder, text, minWidth) { CM.Disp[placeholder] = document.createElement('div'); - var desc = document.createElement('div'); + let desc = document.createElement('div'); desc.style.minWidth = minWidth; desc.style.marginBottom = '4px'; let div = document.createElement('div'); @@ -1242,8 +1231,8 @@ CM.Disp.Tooltip = function(type, name) { l('tooltip').innerHTML = Game.Objects[name].tooltip(); // Adds amortization info to the list of info per building if (CM.Options.TooltipAmor === 1) { - var buildPrice = CM.Sim.BuildingGetPrice(Game.Objects[name], Game.Objects[name].basePrice, 0, Game.Objects[name].free, Game.Objects[name].amount); - var amortizeAmount = buildPrice - Game.Objects[name].totalCookies; + let buildPrice = CM.Sim.BuildingGetPrice(Game.Objects[name], Game.Objects[name].basePrice, 0, Game.Objects[name].free, Game.Objects[name].amount); + let amortizeAmount = buildPrice - Game.Objects[name].totalCookies; if (amortizeAmount > 0) { l('tooltip').innerHTML = l('tooltip').innerHTML .split('so far') @@ -1273,7 +1262,7 @@ CM.Disp.Tooltip = function(type, name) { // Adds area for extra tooltip-sections if ((type === 'b' && Game.buyMode === 1) || type === 'u' || type === 's' || type === 'g' || type === 'p' || type === 'ha') { - var area = document.createElement('div'); + let area = document.createElement('div'); area.id = 'CMTooltipArea'; l('tooltip').appendChild(area); } @@ -1294,7 +1283,7 @@ CM.Disp.Tooltip = function(type, name) { */ CM.Disp.TooltipCreateTooltipBox = function() { l('tooltip').firstChild.style.paddingBottom = '4px'; // Sets padding on base-tooltip - var tooltipBox = document.createElement('div'); + let tooltipBox = document.createElement('div'); tooltipBox.style.border = '1px solid'; tooltipBox.style.padding = '4px'; tooltipBox.style.margin = '0px -4px'; @@ -1333,7 +1322,7 @@ CM.Disp.TooltipCreateCalculationSection = function(tooltip) { tooltip.appendChild(CM.Disp.TooltipCreateHeader('Bonus Cookies per Click')); tooltip.lastChild.style.display = "none"; - var click = document.createElement('div'); + let click = document.createElement('div'); click.style.marginBottom = '4px'; click.style.color = 'white'; click.style.display = "none"; @@ -1341,20 +1330,20 @@ CM.Disp.TooltipCreateCalculationSection = function(tooltip) { tooltip.appendChild(click); tooltip.appendChild(CM.Disp.TooltipCreateHeader('Payback Period')); - var pp = document.createElement('div'); + let pp = document.createElement('div'); pp.style.marginBottom = '4px'; pp.id = 'CMTooltipPP'; tooltip.appendChild(pp); tooltip.appendChild(CM.Disp.TooltipCreateHeader('Time Left')); - var time = document.createElement('div'); + let time = document.createElement('div'); time.id = 'CMTooltipTime'; tooltip.appendChild(time); if (CM.Disp.tooltipType === 'b') { tooltip.appendChild(CM.Disp.TooltipCreateHeader('Production left till next achievement')); tooltip.lastChild.id = 'CMTooltipProductionHeader'; // Assign a id in order to hid when no achiev's are left - var production = document.createElement('div'); + let production = document.createElement('div'); production.id = 'CMTooltipProduction'; tooltip.appendChild(production); } @@ -1374,25 +1363,25 @@ CM.Disp.TooltipCreateWarningSection = function() { CM.Disp.TooltipWarn.style.bottom = 'auto'; CM.Disp.TooltipWarn.id = "CMDispTooltipWarningParent"; - var create = function(boxId, color, labelTextFront, labelTextBack, deficitId) { - var box = document.createElement('div'); + let create = function(boxId, color, labelTextFront, labelTextBack, deficitId) { + let box = document.createElement('div'); box.id = boxId; box.style.display = 'none'; box.style.transition = 'opacity 0.1s ease-out'; box.className = CM.Disp.colorBorderPre + color; box.style.padding = '2px'; box.style.background = '#000 url(img/darkNoise.png)'; - var labelDiv = document.createElement('div'); + let labelDiv = document.createElement('div'); box.appendChild(labelDiv); - var labelSpan = document.createElement('span'); + let labelSpan = document.createElement('span'); labelSpan.className = CM.Disp.colorTextPre + color; labelSpan.style.fontWeight = 'bold'; labelSpan.textContent = labelTextFront; labelDiv.appendChild(labelSpan); labelDiv.appendChild(document.createTextNode(labelTextBack)); - var deficitDiv = document.createElement('div'); + let deficitDiv = document.createElement('div'); box.appendChild(deficitDiv); - var deficitSpan = document.createElement('span'); + let deficitSpan = document.createElement('span'); deficitSpan.id = deficitId; deficitDiv.appendChild(document.createTextNode('Deficit: ')); deficitDiv.appendChild(deficitSpan); @@ -1474,7 +1463,7 @@ CM.Disp.UpdateTooltipBuilding = function() { l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color; l('CMTooltipPP').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].pp, 2); l('CMTooltipPP').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color; - var timeColor = CM.Disp.GetTimeColor((CM.Disp.TooltipPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()); + let timeColor = CM.Disp.GetTimeColor((CM.Disp.TooltipPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()); l('CMTooltipTime').textContent = timeColor.text; if (timeColor.text === "Done!" && Game.cookies < CM.Cache[target][CM.Disp.tooltipName].price) { l('CMTooltipTime').textContent = timeColor.text + " (with Wrink)"; @@ -1535,7 +1524,7 @@ CM.Disp.UpdateTooltipUpgrade = function() { l('CMTooltipPP').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].pp, 2); l('CMTooltipPP').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color; } - var timeColor = CM.Disp.GetTimeColor((CM.Disp.TooltipPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()); + let timeColor = CM.Disp.GetTimeColor((CM.Disp.TooltipPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()); l('CMTooltipTime').textContent = timeColor.text; if (timeColor.text === "Done!" && Game.cookies < Game.UpgradesInStore[CM.Disp.tooltipName].getPrice()) { l('CMTooltipTime').textContent = timeColor.text + " (with Wrink)"; @@ -1547,7 +1536,7 @@ CM.Disp.UpdateTooltipUpgrade = function() { if (Game.UpgradesInStore[CM.Disp.tooltipName].name === "Chocolate egg") { l('CMTooltipBorder').lastChild.style.marginBottom = '4px'; l('CMTooltipBorder').appendChild(CM.Disp.TooltipCreateHeader('Cookies to be gained (Currently/Max)')); - var chocolate = document.createElement('div'); + let chocolate = document.createElement('div'); chocolate.style.color = 'white'; chocolate.textContent = CM.Disp.Beautify(Game.cookies * 0.05) + " / " + CM.Disp.Beautify(CM.Cache.lastChoEgg); l('CMTooltipBorder').appendChild(chocolate); @@ -1567,10 +1556,10 @@ CM.Disp.UpdateTooltipSugarLump = function() { tooltipBox.appendChild(CM.Disp.TooltipCreateHeader('Current Sugar Lump')); - var lumpType = document.createElement('div'); + let lumpType = document.createElement('div'); lumpType.id = 'CMTooltipTime'; tooltipBox.appendChild(lumpType); - var lumpColor = CM.Disp.GetLumpColor(Game.lumpCurrentType); + let lumpColor = CM.Disp.GetLumpColor(Game.lumpCurrentType); lumpType.textContent = lumpColor.text; lumpType.className = CM.Disp.colorTextPre + lumpColor.color; } @@ -1583,28 +1572,28 @@ CM.Disp.UpdateTooltipSugarLump = function() { * It adds to the additional information to l('CMTooltipArea') */ CM.Disp.UpdateTooltipGrimoire = function() { - var minigame = Game.Objects['Wizard tower'].minigame; - var spellCost = minigame.getSpellCost(minigame.spellsById[CM.Disp.tooltipName]); + let minigame = Game.Objects['Wizard tower'].minigame; + let spellCost = minigame.getSpellCost(minigame.spellsById[CM.Disp.tooltipName]); if (CM.Options.TooltipGrim === 1 && spellCost <= minigame.magicM) { let tooltipBox = l('CMTooltipBorder'); // Time left till enough magic for spell tooltipBox.appendChild(CM.Disp.TooltipCreateHeader('Time Left')); - var time = document.createElement('div'); + let time = document.createElement('div'); time.id = 'CMTooltipTime'; tooltipBox.appendChild(time); - var timeColor = CM.Disp.GetTimeColor(CM.Disp.CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost)); + let timeColor = CM.Disp.GetTimeColor(CM.Disp.CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost)); time.textContent = timeColor.text; time.className = CM.Disp.colorTextPre + timeColor.color; // Time left untill magic spent is recovered if (spellCost <= minigame.magic) { tooltipBox.appendChild(CM.Disp.TooltipCreateHeader('Recover Time')); - var recover = document.createElement('div'); + let recover = document.createElement('div'); recover.id = 'CMTooltipRecover'; tooltipBox.appendChild(recover); - var recoverColor = CM.Disp.GetTimeColor(CM.Disp.CalculateGrimoireRefillTime(Math.max(0, minigame.magic - spellCost), minigame.magicM, minigame.magic)); + let recoverColor = CM.Disp.GetTimeColor(CM.Disp.CalculateGrimoireRefillTime(Math.max(0, minigame.magic - spellCost), minigame.magicM, minigame.magic)); recover.textContent = recoverColor.text; recover.className = CM.Disp.colorTextPre + recoverColor.color; } @@ -1612,17 +1601,17 @@ CM.Disp.UpdateTooltipGrimoire = function() { // Extra information on cookies gained when spell is Conjure Baked Goods (Name === 0) if (CM.Disp.tooltipName === 0) { tooltipBox.appendChild(CM.Disp.TooltipCreateHeader('Cookies to be gained/lost')); - var conjure = document.createElement('div'); + let conjure = document.createElement('div'); conjure.id = 'CMTooltipConjure'; tooltipBox.appendChild(conjure); - var reward = document.createElement('span'); + let reward = document.createElement('span'); reward.style.color = "#33FF00"; reward.textContent = Beautify(Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 30), 2); conjure.appendChild(reward); - var seperator = document.createElement('span'); + let seperator = document.createElement('span'); seperator.textContent = ' / '; conjure.appendChild(seperator); - var loss = document.createElement('span'); + let loss = document.createElement('span'); loss.style.color = "red"; loss.textContent = Beautify((CM.Cache.NoGoldSwitchCookiesPS * 60 * 15), 2); conjure.appendChild(loss); @@ -1639,12 +1628,12 @@ CM.Disp.UpdateTooltipGrimoire = function() { * It adds to the additional information to l('CMTooltipArea') */ CM.Disp.UpdateTooltipGardenPlots = function() { - var minigame = Game.Objects.Farm.minigame; + let minigame = Game.Objects.Farm.minigame; if (CM.Options.TooltipLump && minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] != 0) { - var mature = minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][1] > minigame.plantsById[minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] - 1].matureBase; - var plantName = minigame.plantsById[minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] - 1].name; + let mature = minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][1] > minigame.plantsById[minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] - 1].matureBase; + let plantName = minigame.plantsById[minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] - 1].name; l('CMTooltipBorder').appendChild(CM.Disp.TooltipCreateHeader('Reward (Current / Maximum)')); - var reward = document.createElement('div'); + let reward = document.createElement('div'); reward.id = 'CMTooltipPlantReward'; l('CMTooltipBorder').appendChild(reward); if (plantName === "Bakeberry") { @@ -1723,10 +1712,10 @@ CM.Disp.UpdateTooltipWarnings = function() { CM.Disp.TooltipWarn.style.width = (l('tooltip').offsetWidth - 6) + 'px'; - var amount = (Game.cookies + CM.Disp.GetWrinkConfigBank()) - CM.Disp.TooltipPrice; - var limitLucky = CM.Cache.Lucky; + let amount = (Game.cookies + CM.Disp.GetWrinkConfigBank()) - CM.Disp.TooltipPrice; + let limitLucky = CM.Cache.Lucky; if (CM.Options.ToolWarnBon === 1) { - var bonusNoFren = CM.Disp.TooltipBonusIncome; + let bonusNoFren = CM.Disp.TooltipBonusIncome; bonusNoFren /= CM.Cache.getCPSBuffMult(); limitLucky += ((bonusNoFren * 60 * 15) / 0.15); } @@ -1749,7 +1738,7 @@ CM.Disp.UpdateTooltipWarnings = function() { else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none'; if (CM.Options.ToolWarnConjure === 1) { - var limitConjure = limitLucky * 2; + let limitConjure = limitLucky * 2; if ((amount < limitConjure) && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) { l('CMDispTooltipWarnConjure').style.display = ''; l('CMDispTooltipWarnConjureText').textContent = Beautify(limitConjure - amount) + ' (' + CM.Disp.FormatTime((limitConjure - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')'; @@ -1758,7 +1747,7 @@ CM.Disp.UpdateTooltipWarnings = function() { else l('CMDispTooltipWarnConjure').style.display = 'none'; if (CM.Options.ToolWarnConjureFrenzy === 1) { - var limitConjureFrenzy = limitLucky * 2 * 7; + let limitConjureFrenzy = limitLucky * 2 * 7; if ((amount < limitConjureFrenzy) && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) { l('CMDispTooltipWarnConjureFrenzy').style.display = ''; l('CMDispTooltipWarnConjureFrenzyText').textContent = Beautify(limitConjureFrenzy - amount) + ' (' + CM.Disp.FormatTime((limitConjureFrenzy - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')'; @@ -1787,7 +1776,7 @@ CM.Disp.UpdateTooltipWarnings = function() { */ CM.Disp.UpdateTooltipLocation = function() { if (Game.tooltip.origin === 'store') { - var warnOffset = 0; + let warnOffset = 0; if (CM.Options.ToolWarnLucky === 1 && CM.Options.ToolWarnPos === 1 && typeof CM.Disp.TooltipWarn != "undefined") { warnOffset = CM.Disp.TooltipWarn.clientHeight - 4; } @@ -1822,18 +1811,18 @@ CM.Disp.ToggleToolWarnPos = function() { /** * This function checks and create a tooltip for the wrinklers * It is called by CM.Disp.Draw() - * TODO: Change this code to be the same as other tooltips. (i.d., create tooltip with type "w") + * As wrinklers are not appended to the DOM we us a different system than for other tooltips */ CM.Disp.CheckWrinklerTooltip = function() { if (CM.Options.TooltipWrink === 1 && CM.Disp.TooltipWrinklerArea === 1) { // Latter is set by CM.Main.AddWrinklerAreaDetect - var showingTooltip = false; + let showingTooltip = false; for (let i of Object.keys(Game.wrinklers)) { - var me = Game.wrinklers[i]; + let me = Game.wrinklers[i]; if (me.phase > 0 && me.selected) { showingTooltip = true; if (CM.Disp.TooltipWrinklerBeingShown[i] === 0 || CM.Disp.TooltipWrinklerBeingShown[i] === undefined) { - var placeholder = document.createElement('div'); - var wrinkler = document.createElement('div'); + let placeholder = document.createElement('div'); + let wrinkler = document.createElement('div'); wrinkler.style.minWidth = '120px'; wrinkler.style.marginBottom = '4px'; let div = document.createElement('div'); @@ -1860,18 +1849,18 @@ CM.Disp.CheckWrinklerTooltip = function() { /** * This function updates the amount to be displayed by the wrinkler tooltip created by CM.Disp.CheckWrinklerTooltip() * It is called by CM.Disp.Draw() - * TODO: Change this code to be the same as other tooltips. Fit this into CM.Disp.UpdateTooltip() + * As wrinklers are not appended to the DOM we us a different system than for other tooltips */ CM.Disp.UpdateWrinklerTooltip = function() { if (CM.Options.TooltipWrink === 1 && l('CMTooltipWrinkler') != null) { - var sucked = Game.wrinklers[CM.Disp.TooltipWrinkler].sucked; - var toSuck = 1.1; + let sucked = Game.wrinklers[CM.Disp.TooltipWrinkler].sucked; + let toSuck = 1.1; if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05; if (Game.wrinklers[CM.Disp.TooltipWrinkler].type === 1) toSuck *= 3; // Shiny wrinklers sucked *= toSuck; if (Game.Has('Wrinklerspawn')) sucked *= 1.05; if (CM.Sim.Objects.Temple.minigameLoaded) { - var godLvl = Game.hasGod('scorn'); + let godLvl = Game.hasGod('scorn'); if (godLvl === 1) sucked *= 1.15; else if (godLvl === 2) sucked *= 1.1; else if (godLvl === 3) sucked *= 1.05; @@ -1890,9 +1879,9 @@ CM.Disp.UpdateWrinklerTooltip = function() { */ CM.Disp.AddAuraInfo = function(aura) { if (CM.Options.DragonAuraInfo === 1) { - var [bonusCPS, priceOfChange] = CM.Sim.CalculateChangeAura(aura); - var timeToRecover = CM.Disp.FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs)); - var bonusCPSPercentage = CM.Disp.Beautify(bonusCPS / Game.cookiesPs); + let [bonusCPS, priceOfChange] = CM.Sim.CalculateChangeAura(aura); + let timeToRecover = CM.Disp.FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs)); + let bonusCPSPercentage = CM.Disp.Beautify(bonusCPS / Game.cookiesPs); bonusCPS = CM.Disp.Beautify(bonusCPS); l('dragonAuraInfo').style.minHeight = "60px"; @@ -1969,7 +1958,7 @@ CM.Disp.RefreshMenu = function() { * @param {function} title A function that returns the title of CookieMonster pre-styled */ CM.Disp.AddMenuPref = function(title) { - var frag = document.createDocumentFragment(); + let frag = document.createDocumentFragment(); frag.appendChild(title()); for (let group of Object.keys(CM.Data.ConfigGroups)) { @@ -1984,7 +1973,7 @@ CM.Disp.AddMenuPref = function(title) { subGroupObject.style.opacity = "0.5"; frag.appendChild(subGroupObject); if (CM.Options.Header[subGroup]) { - for (var option in CM.Data.Config) { + for (let option in CM.Data.Config) { if (CM.Data.Config[option].group === subGroup) frag.appendChild(CM.Disp.CreatePrefOption(option)); } } @@ -1997,9 +1986,9 @@ CM.Disp.AddMenuPref = function(title) { } } - var resDef = document.createElement('div'); + let resDef = document.createElement('div'); resDef.className = 'listing'; - var resDefBut = document.createElement('a'); + let resDefBut = document.createElement('a'); resDefBut.className = 'option'; resDefBut.onclick = function() {CM.Config.RestoreDefault();}; resDefBut.textContent = 'Restore Default'; @@ -2069,18 +2058,18 @@ CM.Disp.CreatePrefOption = function(config) { else if (CM.Data.Config[config].type === "vol") { let div = document.createElement('div'); div.className = 'listing'; - var volume = document.createElement('div'); + let volume = document.createElement('div'); volume.className = 'sliderBox'; let title = document.createElement('div'); title.style.float = "left"; title.innerHTML = CM.Data.Config[config].desc; volume.appendChild(title); - var percent = document.createElement('div'); + let percent = document.createElement('div'); percent.id = "slider" + config + "right"; percent.style.float = "right"; percent.innerHTML = CM.Options[config] + "%"; volume.appendChild(percent); - var slider = document.createElement('input'); + let slider = document.createElement('input'); slider.className = "slider"; slider.id = "slider" + config; slider.style.clear = "both"; @@ -2224,7 +2213,7 @@ CM.Disp.UpdateColors = function() { * @param {function} title A function that returns the title of CookieMonster pre-styled */ CM.Disp.AddMenuStats = function(title) { - var stats = document.createElement('div'); + let stats = document.createElement('div'); stats.className = 'subsection'; stats.appendChild(title()); @@ -2251,17 +2240,17 @@ CM.Disp.AddMenuStats = function(title) { if (Game.cpsSucked > 0) { stats.appendChild(CM.Disp.CreateStatsHeader('Wrinklers', 'Wrink')); if (CM.Options.Header.Wrink) { - var popAllFrag = document.createDocumentFragment(); + let popAllFrag = document.createDocumentFragment(); popAllFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinklersTotal) + ' / ' + Beautify(CM.Cache.WrinklersNormal) + ' ')); - var popAllA = document.createElement('a'); + let popAllA = document.createElement('a'); popAllA.textContent = 'Pop All Normal'; popAllA.className = 'option'; popAllA.onclick = function() { CM.Disp.PopAllNormalWrinklers(); }; popAllFrag.appendChild(popAllA); stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping (All/Normal)', popAllFrag)); - var popFattestFrag = document.createDocumentFragment(); + let popFattestFrag = document.createDocumentFragment(); popFattestFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinklersFattest[0]) + ' ')); - var popFattestA = document.createElement('a'); + let popFattestA = document.createElement('a'); popFattestA.textContent = 'Pop Single Fattest'; popFattestA.className = 'option'; popFattestA.onclick = function() {if (CM.Cache.WrinklersFattest[1]) Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; }; @@ -2271,51 +2260,51 @@ CM.Disp.AddMenuStats = function(title) { } - var specDisp = false; - var missingHalloweenCookies = []; + let specDisp = false; + let missingHalloweenCookies = []; for (let i of Object.keys(CM.Data.HalloCookies)) { if (!Game.Has(CM.Data.HalloCookies[i])) { missingHalloweenCookies.push(CM.Data.HalloCookies[i]); specDisp = true; } } - var missingChristmasCookies = []; + let missingChristmasCookies = []; for (let i of Object.keys(CM.Data.ChristCookies)) { if (!Game.Has(CM.Data.ChristCookies[i])) { missingChristmasCookies.push(CM.Data.ChristCookies[i]); specDisp = true; } } - var missingValentineCookies = []; + let missingValentineCookies = []; for (let i of Object.keys(CM.Data.ValCookies)) { if (!Game.Has(CM.Data.ValCookies[i])) { missingValentineCookies.push(CM.Data.ValCookies[i]); specDisp = true; } } - var missingNormalEggs = []; + let missingNormalEggs = []; for (let i of Object.keys(Game.eggDrops)) { if (!Game.HasUnlocked(Game.eggDrops[i])) { missingNormalEggs.push(Game.eggDrops[i]); specDisp = true; } } - var missingRareEggs = []; + let missingRareEggs = []; for (let i of Object.keys(Game.rareEggDrops)) { if (!Game.HasUnlocked(Game.rareEggDrops[i])) { missingRareEggs.push(Game.rareEggDrops[i]); specDisp = true; } } - var missingPlantDrops = []; + let missingPlantDrops = []; for (let i of Object.keys(CM.Data.PlantDrops)) { if (!Game.HasUnlocked(CM.Data.PlantDrops[i])) { missingPlantDrops.push(CM.Data.PlantDrops[i]); specDisp = true; } } - var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); - var centEgg = Game.Has('Century egg'); + let choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); + let centEgg = Game.Has('Century egg'); if (Game.season === 'christmas' || specDisp || choEgg || centEgg) { stats.appendChild(CM.Disp.CreateStatsHeader('Season Specials', 'Sea')); @@ -2345,7 +2334,7 @@ CM.Disp.AddMenuStats = function(title) { )); stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Average Cookie Clicks Per Second (Past ' + CM.Disp.clickTimes[CM.Options.AvgClicksHist] + (CM.Options.AvgClicksHist === 0 ? ' second' : ' seconds') + ')', document.createTextNode(Beautify(CM.Cache.AverageClicks, 1)))); if (Game.Has('Fortune cookies')) { - var fortunes = []; + let fortunes = []; for (let i of Object.keys(CM.Data.Fortunes)) { if (!Game.Has(CM.Data.Fortunes[i])) { fortunes.push(CM.Data.Fortunes[i]); @@ -2355,7 +2344,7 @@ CM.Disp.AddMenuStats = function(title) { } stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Missed Golden Cookies', document.createTextNode(Beautify(Game.missedGoldenClicks)))); if (Game.prefs.autosave) { - var timer = document.createElement('span'); + let timer = document.createElement('span'); timer.id = 'CMStatsAutosaveTimer'; timer.innerText = Game.sayTime(Game.fps * 60 - (Game.OnAscend ? 0 : (Game.T % (Game.fps * 60))), 4); stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Time till autosave', timer)); @@ -2414,13 +2403,13 @@ CM.Disp.CreateStatsListing = function(type, name, text, placeholder) { let div = document.createElement('div'); div.className = 'listing'; - var listingName = document.createElement('b'); + let listingName = document.createElement('b'); listingName.textContent = name; div.appendChild(listingName); if (type === "withTooltip") { div.className = 'listing'; - var tooltip = document.createElement('span'); + let tooltip = document.createElement('span'); tooltip.onmouseout = function() { Game.tooltip.hide(); }; tooltip.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp[placeholder].innerHTML));}; tooltip.style.cursor = 'default'; @@ -2448,12 +2437,12 @@ CM.Disp.CreateStatsListing = function(type, name, text, placeholder) { * @returns {object} frag The tooltip object */ CM.Disp.CreateStatsMissDisp = function(theMissDisp) { - var frag = document.createDocumentFragment(); + let frag = document.createDocumentFragment(); frag.appendChild(document.createTextNode(theMissDisp.length + ' ')); let span = document.createElement('span'); span.onmouseout = function() { Game.tooltip.hide(); }; - var placeholder = document.createElement('div'); - var missing = document.createElement('div'); + let placeholder = document.createElement('div'); + let missing = document.createElement('div'); missing.style.minWidth = '140px'; missing.style.marginBottom = '4px'; let title = document.createElement('div'); @@ -2491,58 +2480,58 @@ CM.Disp.CreateStatsMissDisp = function(theMissDisp) { */ CM.Disp.CreateStatsLuckySection = function() { // This sets which tooltip to display for certain stats - var goldCookTooltip = Game.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder'; + let goldCookTooltip = Game.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder'; - var section = document.createElement('div'); + let section = document.createElement('div'); section.className = 'CMStatsLuckySection'; - var luckyColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Lucky) ? CM.Disp.colorRed : CM.Disp.colorGreen; - var luckyTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Lucky) ? CM.Disp.FormatTime((CM.Cache.Lucky - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; - var luckyReqFrag = document.createDocumentFragment(); - var luckyReqSpan = document.createElement('span'); + let luckyColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Lucky) ? CM.Disp.colorRed : CM.Disp.colorGreen; + let luckyTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Lucky) ? CM.Disp.FormatTime((CM.Cache.Lucky - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + let luckyReqFrag = document.createDocumentFragment(); + let luckyReqSpan = document.createElement('span'); luckyReqSpan.style.fontWeight = 'bold'; luckyReqSpan.className = CM.Disp.colorTextPre + luckyColor; luckyReqSpan.textContent = Beautify(CM.Cache.Lucky); luckyReqFrag.appendChild(luckyReqSpan); if (luckyTime != '') { - var luckyReqSmall = document.createElement('small'); + let luckyReqSmall = document.createElement('small'); luckyReqSmall.textContent = ' (' + luckyTime + ')'; luckyReqFrag.appendChild(luckyReqSmall); } section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Lucky!" Cookies Required', luckyReqFrag, goldCookTooltip)); - var luckyColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.LuckyFrenzy) ? CM.Disp.colorRed : CM.Disp.colorGreen; - var luckyTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.LuckyFrenzy) ? CM.Disp.FormatTime((CM.Cache.LuckyFrenzy - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; - var luckyReqFrenFrag = document.createDocumentFragment(); - var luckyReqFrenSpan = document.createElement('span'); + let luckyColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.LuckyFrenzy) ? CM.Disp.colorRed : CM.Disp.colorGreen; + let luckyTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.LuckyFrenzy) ? CM.Disp.FormatTime((CM.Cache.LuckyFrenzy - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + let luckyReqFrenFrag = document.createDocumentFragment(); + let luckyReqFrenSpan = document.createElement('span'); luckyReqFrenSpan.style.fontWeight = 'bold'; luckyReqFrenSpan.className = CM.Disp.colorTextPre + luckyColorFrenzy; luckyReqFrenSpan.textContent = Beautify(CM.Cache.LuckyFrenzy); luckyReqFrenFrag.appendChild(luckyReqFrenSpan); if (luckyTimeFrenzy != '') { - var luckyReqFrenSmall = document.createElement('small'); + let luckyReqFrenSmall = document.createElement('small'); luckyReqFrenSmall.textContent = ' (' + luckyTimeFrenzy + ')'; luckyReqFrenFrag.appendChild(luckyReqFrenSmall); } section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Lucky!" Cookies Required (Frenzy)', luckyReqFrenFrag, goldCookTooltip)); - var luckySplit = CM.Cache.LuckyReward != CM.Cache.LuckyWrathReward; + let luckySplit = CM.Cache.LuckyReward != CM.Cache.LuckyWrathReward; - var luckyRewardMaxSpan = document.createElement('span'); + let luckyRewardMaxSpan = document.createElement('span'); luckyRewardMaxSpan.style.fontWeight = 'bold'; luckyRewardMaxSpan.className = CM.Disp.colorTextPre + CM.Cache.LuckyReward; luckyRewardMaxSpan.textContent = Beautify(CM.Cache.LuckyReward) + (luckySplit ? (' / ' + Beautify(CM.Cache.LuckyWrathReward)) : ''); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Lucky!" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : ''), luckyRewardMaxSpan, goldCookTooltip)); - var luckyRewardFrenzyMaxSpan = document.createElement('span'); + let luckyRewardFrenzyMaxSpan = document.createElement('span'); luckyRewardFrenzyMaxSpan.style.fontWeight = 'bold'; luckyRewardFrenzyMaxSpan.className = CM.Disp.colorTextPre + luckyRewardFrenzyMaxSpan; luckyRewardFrenzyMaxSpan.textContent = Beautify(CM.Cache.LuckyRewardFrenzy) + (luckySplit ? (' / ' + Beautify(CM.Cache.LuckyWrathRewardFrenzy)) : ''); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Lucky!" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : ''), luckyRewardFrenzyMaxSpan , goldCookTooltip)); - var luckyCurBase = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 15) + 13; - var luckyCurSpan = document.createElement('span'); + let luckyCurBase = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 15) + 13; + let luckyCurSpan = document.createElement('span'); luckyCurSpan.style.fontWeight = 'bold'; luckyCurSpan.className = CM.Disp.colorTextPre + luckyCurSpan; luckyCurSpan.textContent = Beautify(CM.Cache.GoldenCookiesMult * luckyCurBase) + (luckySplit ? (' / ' + Beautify(CM.Cache.WrathCookiesMult * luckyCurBase)) : ''); @@ -2556,66 +2545,66 @@ CM.Disp.CreateStatsLuckySection = function() { */ CM.Disp.CreateStatsChainSection = function() { // This sets which tooltip to display for certain stats - var goldCookTooltip = Game.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder'; + let goldCookTooltip = Game.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder'; - var section = document.createElement('div'); + let section = document.createElement('div'); section.className = 'CMStatsChainSection'; - var chainColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen; - var chainTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainRequired) ? CM.Disp.FormatTime((CM.Cache.ChainRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; - var chainReqFrag = document.createDocumentFragment(); - var chainReqSpan = document.createElement('span'); + let chainColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen; + let chainTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainRequired) ? CM.Disp.FormatTime((CM.Cache.ChainRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + let chainReqFrag = document.createDocumentFragment(); + let chainReqSpan = document.createElement('span'); chainReqSpan.style.fontWeight = 'bold'; chainReqSpan.className = CM.Disp.colorTextPre + chainColor; chainReqSpan.textContent = Beautify(CM.Cache.ChainRequired); chainReqFrag.appendChild(chainReqSpan); if (chainTime != '') { - var chainReqSmall = document.createElement('small'); + let chainReqSmall = document.createElement('small'); chainReqSmall.textContent = ' (' + chainTime + ')'; chainReqFrag.appendChild(chainReqSmall); } section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required', chainReqFrag, goldCookTooltip)); - var chainWrathColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrathRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen; - var chainWrathTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrathRequired) ? CM.Disp.FormatTime((CM.Cache.ChainWrathRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; - var chainWrathReqFrag = document.createDocumentFragment(); - var chainWrathReqSpan = document.createElement('span'); + let chainWrathColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrathRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen; + let chainWrathTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrathRequired) ? CM.Disp.FormatTime((CM.Cache.ChainWrathRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + let chainWrathReqFrag = document.createDocumentFragment(); + let chainWrathReqSpan = document.createElement('span'); chainWrathReqSpan.style.fontWeight = 'bold'; chainWrathReqSpan.className = CM.Disp.colorTextPre + chainWrathColor; chainWrathReqSpan.textContent = Beautify(CM.Cache.ChainWrathRequired); chainWrathReqFrag.appendChild(chainWrathReqSpan); if (chainWrathTime != '') { - var chainWrathReqSmall = document.createElement('small'); + let chainWrathReqSmall = document.createElement('small'); chainWrathReqSmall.textContent = ' (' + chainWrathTime + ')'; chainWrathReqFrag.appendChild(chainWrathReqSmall); } section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Wrath)', chainWrathReqFrag, goldCookTooltip)); - var chainColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen; - var chainTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyRequired) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzyRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; - var chainReqFrenFrag = document.createDocumentFragment(); - var chainReqFrenSpan = document.createElement('span'); + let chainColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen; + let chainTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyRequired) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzyRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + let chainReqFrenFrag = document.createDocumentFragment(); + let chainReqFrenSpan = document.createElement('span'); chainReqFrenSpan.style.fontWeight = 'bold'; chainReqFrenSpan.className = CM.Disp.colorTextPre + chainColorFrenzy; chainReqFrenSpan.textContent = Beautify(CM.Cache.ChainFrenzyRequired); chainReqFrenFrag.appendChild(chainReqFrenSpan); if (chainTimeFrenzy != '') { - var chainReqFrenSmall = document.createElement('small'); + let chainReqFrenSmall = document.createElement('small'); chainReqFrenSmall.textContent = ' (' + chainTimeFrenzy + ')'; chainReqFrenFrag.appendChild(chainReqFrenSmall); } section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Frenzy)', chainReqFrenFrag, goldCookTooltip)); - var chainWrathColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrathRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen; - var chainWrathTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrathRequired) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzyWrathRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; - var chainWrathReqFrenFrag = document.createDocumentFragment(); - var chainWrathReqFrenSpan = document.createElement('span'); + let chainWrathColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrathRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen; + let chainWrathTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrathRequired) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzyWrathRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + let chainWrathReqFrenFrag = document.createDocumentFragment(); + let chainWrathReqFrenSpan = document.createElement('span'); chainWrathReqFrenSpan.style.fontWeight = 'bold'; chainWrathReqFrenSpan.className = CM.Disp.colorTextPre + chainWrathColorFrenzy; chainWrathReqFrenSpan.textContent = Beautify(CM.Cache.ChainFrenzyWrathRequired); chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSpan); if (chainWrathTimeFrenzy != '') { - var chainWrathReqFrenSmall = document.createElement('small'); + let chainWrathReqFrenSmall = document.createElement('small'); chainWrathReqFrenSmall.textContent = ' (' + chainWrathTimeFrenzy + ')'; chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSmall); } @@ -2625,10 +2614,9 @@ CM.Disp.CreateStatsChainSection = function() { section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode((Beautify(CM.Cache.ChainFrenzyReward[0]) + ' / ' + Beautify(CM.Cache.ChainFrenzyWrathReward[0]))), goldCookTooltip)); - // TODO: Place MaxChainMoni function into CM.Cache.RemakeChain and create global variables to store it - var chainCurMax = Math.min(CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 60 * 6, (Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.5); - var chainCur = CM.Cache.MaxChainMoni(7, chainCurMax, CM.Cache.GoldenCookiesMult)[0]; - var chainCurWrath = CM.Cache.MaxChainMoni(6, chainCurMax, CM.Cache.WrathCookiesMult)[0]; + let chainCurMax = Math.min(CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 60 * 6, (Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.5); + let chainCur = CM.Cache.MaxChainCookieReward(7, chainCurMax, CM.Cache.GoldenCookiesMult)[0]; + let chainCurWrath = CM.Cache.MaxChainCookieReward(6, chainCurMax, CM.Cache.WrathCookiesMult)[0]; section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (CUR) (Golden / Wrath)', document.createTextNode((Beautify(chainCur) + ' / ' + Beautify(chainCurWrath))), goldCookTooltip)); return section; }; @@ -2638,38 +2626,38 @@ CM.Disp.CreateStatsChainSection = function() { * @returns {object} section The object contating the Spells section */ CM.Disp.CreateStatsSpellsSection = function() { - var section = document.createElement('div'); + let section = document.createElement('div'); section.className = 'CMStatsSpellsSection'; - var conjureColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure) ? CM.Disp.colorRed : CM.Disp.colorGreen; - var conjureTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure) ? CM.Disp.FormatTime((CM.Cache.Conjure - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + let conjureColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure) ? CM.Disp.colorRed : CM.Disp.colorGreen; + let conjureTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure) ? CM.Disp.FormatTime((CM.Cache.Conjure - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; - var conjureReqFrag = document.createDocumentFragment(); - var conjureReqSpan = document.createElement('span'); + let conjureReqFrag = document.createDocumentFragment(); + let conjureReqSpan = document.createElement('span'); conjureReqSpan.style.fontWeight = 'bold'; conjureReqSpan.className = CM.Disp.colorTextPre + conjureColor; conjureReqSpan.textContent = Beautify(CM.Cache.Conjure); conjureReqFrag.appendChild(conjureReqSpan); if (conjureTime != '') { - var conjureReqSmall = document.createElement('small'); + let conjureReqSmall = document.createElement('small'); conjureReqSmall.textContent = ' (' + conjureTime + ')'; conjureReqFrag.appendChild(conjureReqSmall); } section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Conjure Baked Goods" Cookies Required', conjureReqFrag, 'GoldCookTooltipPlaceholder')); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Conjure Baked Goods" Reward (MAX)', document.createTextNode(CM.Disp.Beautify(CM.Cache.ConjureReward)), 'GoldCookTooltipPlaceholder')); - var conjureFrenzyColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.colorRed : CM.Disp.colorGreen; - var conjureFrenzyCur = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 30); - var conjureFrenzyTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.FormatTime((CM.Cache.Conjure * 7 - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + let conjureFrenzyColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.colorRed : CM.Disp.colorGreen; + let conjureFrenzyCur = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 30); + let conjureFrenzyTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.FormatTime((CM.Cache.Conjure * 7 - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; - var conjureFrenzyReqFrag = document.createDocumentFragment(); - var conjureFrenzyReqSpan = document.createElement('span'); + let conjureFrenzyReqFrag = document.createDocumentFragment(); + let conjureFrenzyReqSpan = document.createElement('span'); conjureFrenzyReqSpan.style.fontWeight = 'bold'; conjureFrenzyReqSpan.className = CM.Disp.colorTextPre + conjureFrenzyColor; conjureFrenzyReqSpan.textContent = Beautify(CM.Cache.Conjure * 7); conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSpan); if (conjureFrenzyTime != '') { - var conjureFrenzyReqSmall = document.createElement('small'); + let conjureFrenzyReqSmall = document.createElement('small'); conjureFrenzyReqSmall.textContent = ' (' + conjureFrenzyTime + ')'; conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSmall); } @@ -2687,64 +2675,64 @@ CM.Disp.CreateStatsSpellsSection = function() { * @returns {object} section The object contating the Prestige section */ CM.Disp.CreateStatsPrestigeSection = function() { - var section = document.createElement('div'); + let section = document.createElement('div'); section.className = 'CMStatsPrestigeSection'; - var possiblePresMax = Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned + + let possiblePresMax = Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinklersTotal + (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CM.Cache.lastChoEgg : 0))); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'Prestige Level (CUR / MAX)', document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePresMax)), 'PrestMaxTooltipPlaceholder')); - var neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinklersTotal + ((Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CM.Cache.lastChoEgg : 0) ? CM.Cache.lastChoEgg : 0)); - var cookiesNextFrag = document.createDocumentFragment(); + let neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinklersTotal + ((Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CM.Cache.lastChoEgg : 0) ? CM.Cache.lastChoEgg : 0)); + let cookiesNextFrag = document.createDocumentFragment(); cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook))); - var cookiesNextSmall = document.createElement('small'); + let cookiesNextSmall = document.createElement('small'); cookiesNextSmall.textContent = ' (' + (CM.Disp.FormatTime(neededCook / CM.Cache.AvgCPSWithChoEgg, 1)) + ')'; cookiesNextFrag.appendChild(cookiesNextSmall); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'Cookies To Next Level', cookiesNextFrag, 'NextPrestTooltipPlaceholder')); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'Heavenly Chips (CUR / MAX)', document.createTextNode(Beautify(Game.heavenlyChips) + ' / ' + Beautify((possiblePresMax - Game.prestige) + Game.heavenlyChips)), 'HeavenChipMaxTooltipPlaceholder')); - var resetBonus = CM.Sim.ResetBonus(possiblePresMax); - var resetFrag = document.createDocumentFragment(); + let resetBonus = CM.Sim.ResetBonus(possiblePresMax); + let resetFrag = document.createDocumentFragment(); resetFrag.appendChild(document.createTextNode(Beautify(resetBonus))); let increase = Math.round(resetBonus / Game.cookiesPs * 10000); if (isFinite(increase) && increase != 0) { - var resetSmall = document.createElement('small'); + let resetSmall = document.createElement('small'); resetSmall.textContent = ' (' + (increase / 100) + '% of income)'; resetFrag.appendChild(resetSmall); } section.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'Reset Bonus Income', resetFrag, 'ResetTooltipPlaceholder')); - var currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset)); - var willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); - var willGet = willHave - currentPrestige; + let currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset)); + let willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); + let willGet = willHave - currentPrestige; if (!Game.Has('Lucky digit')) { - var delta7 = 7 - (willHave % 10); + let delta7 = 7 - (willHave % 10); if (delta7 < 0) delta7 += 10; - var next7Reset = willGet + delta7; - var next7Total = willHave + delta7; - var frag7 = document.createDocumentFragment(); + let next7Reset = willGet + delta7; + let next7Total = willHave + delta7; + let frag7 = document.createDocumentFragment(); frag7.appendChild(document.createTextNode(next7Total.toLocaleString() + " / " + next7Reset.toLocaleString() + " (+" + delta7 + ")")); section.appendChild(CM.Disp.CreateStatsListing("basic", 'Next "Lucky Digit" (total / reset)', frag7)); } if (!Game.Has('Lucky number')) { - var delta777 = 777 - (willHave % 1000); + let delta777 = 777 - (willHave % 1000); if (delta777 < 0) delta777 += 1000; - var next777Reset = willGet + delta777; - var next777Total = willHave + delta777; - var frag777 = document.createDocumentFragment(); + let next777Reset = willGet + delta777; + let next777Total = willHave + delta777; + let frag777 = document.createDocumentFragment(); frag777.appendChild(document.createTextNode(next777Total.toLocaleString() + " / " + next777Reset.toLocaleString() + " (+" + delta777 + ")")); section.appendChild(CM.Disp.CreateStatsListing("basic", 'Next "Lucky Number" (total / reset)', frag777)); } if (!Game.Has('Lucky payout')) { - var delta777777 = 777777 - (willHave % 1000000); + let delta777777 = 777777 - (willHave % 1000000); if (delta777777 < 0) delta777777 += 1000000; - var next777777Reset = willGet + delta777777; - var next777777Total = willHave + delta777777; - var frag777777 = document.createDocumentFragment(); + let next777777Reset = willGet + delta777777; + let next777777Total = willHave + delta777777; + let frag777777 = document.createDocumentFragment(); frag777777.appendChild(document.createTextNode(next777777Total.toLocaleString() + " / " + next777777Reset.toLocaleString() + " (+" + delta777777 + ")")); section.appendChild(CM.Disp.CreateStatsListing("basic", 'Next "Lucky Payout" (total / reset)', frag777777)); } @@ -2815,10 +2803,10 @@ CM.Disp.AddMissingUpgrades = function() { * @returns {string} ? The HTML string that creates the icon. */ CM.Disp.crateMissing = function(me) { - var classes = 'crate upgrade missing'; + let classes = 'crate upgrade missing'; if (me.pool === 'prestige') classes+=' heavenly'; - var noFrame = 0; + let noFrame = 0; if (!Game.prefs.crates) noFrame = 1; if (noFrame) classes += ' noFrame'; @@ -2839,13 +2827,13 @@ CM.Disp.crateMissing = function(me) { * It is called by CM.Main.DelayInit() */ CM.Disp.CreateWrinklerButtons = function() { - var popAllA = document.createElement('a'); + let popAllA = document.createElement('a'); popAllA.id = "PopAllNormalWrinklerButton"; popAllA.textContent = 'Pop All Normal'; popAllA.className = 'option'; popAllA.onclick = function() { CM.Disp.PopAllNormalWrinklers(); }; l('sectionLeftExtra').children[0].append(popAllA); - var popFattestA = document.createElement('a'); + let popFattestA = document.createElement('a'); popFattestA.id = "PopFattestWrinklerButton"; popFattestA.textContent = 'Pop Single Fattest'; popFattestA.className = 'option'; @@ -2921,28 +2909,28 @@ CM.Disp.buffColors = {'Frenzy': CM.Disp.colorYellow, 'Dragon Harvest': CM.Disp.c CM.Disp.GCTimers = {}; /** - * These lists are used in the stats page to show + * These arrays are used in the stats page to show * average cookies per {CM.Disp.cookieTimes/CM.Disp.clickTimes} seconds */ CM.Disp.cookieTimes = [10, 15, 30, 60, 300, 600, 900, 1800]; CM.Disp.clickTimes = [1, 5, 10, 15, 30]; /** - * This lists is used to store whether a Wrinkler tooltip is being shown or not + * This array is used to store whether a Wrinkler tooltip is being shown or not * [i] = 1 means tooltip is being shown, [i] = 0 means hidden * It is used by CM.Disp.CheckWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect() */ CM.Disp.TooltipWrinklerBeingShown = []; /** - * Used to store the number of cookies to be displayed in the tab-title - */ -CM.Disp.Title = ''; - -/** - * These are variables with base-values that get initalized when initliazing CookieMonster - * TODO: See if these can be removed or moved + * These are variables used by the functions that create tooltips for wrinklers + * See CM.Disp.CheckWrinklerTooltip(), CM.Disp.UpdateWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect() */ CM.Disp.TooltipWrinklerArea = 0; CM.Disp.TooltipWrinkler = -1; + +/** + * Used to store the number of cookies to be displayed in the tab-title + */ +CM.Disp.Title = ''; diff --git a/src/Footer.js b/src/Footer.js index cdebdae..fb774c9 100644 --- a/src/Footer.js +++ b/src/Footer.js @@ -13,7 +13,7 @@ */ CM.init = function() { CM.Footer.isInitzializing = true - var proceed = true; + let proceed = true; if (Game.version != CM.VersionMajor) { proceed = confirm('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' is meant for Game version ' + CM.VersionMajor + '. Loading a different version may cause errors. Do you still want to load Cookie Monster?'); } @@ -67,7 +67,7 @@ CM.Footer.AddJscolor = function() { */ if (typeof CM.Footer.isInitzializing === 'undefined') { CM.Footer.AddJscolor(); - var delay = setInterval(function() { + let delay = setInterval(function() { if (typeof jscolor !== 'undefined') { jscolor.init(); Game.registerMod('CookieMonster', CM); diff --git a/src/Main.js b/src/Main.js index 5e4ba97..b8b952c 100644 --- a/src/Main.js +++ b/src/Main.js @@ -33,7 +33,7 @@ CM.Main.Loop = function() { } // Check for aura change to recalculate buildings prices - var hasBuildAura = Game.auraMult('Fierce Hoarder') > 0; + let hasBuildAura = Game.auraMult('Fierce Hoarder') > 0; if (!CM.Cache.HadBuildAura && hasBuildAura) { CM.Cache.HadBuildAura = true; CM.Cache.DoRemakeBuildPrices = 1; @@ -48,24 +48,16 @@ CM.Main.Loop = function() { CM.Cache.DoRemakeBuildPrices = 0; } - // Update Wrinkler Bank - CM.Cache.CacheWrinklers(); + CM.Cache.LoopCache(); - // Calculate PP - CM.Cache.CachePP(); + // Check all changing minigames and game-states + CM.Main.CheckGoldenCookie(); + CM.Main.CheckTickerFortune(); + CM.Main.CheckSeasonPopup(); + CM.Main.CheckGardenTick(); + CM.Main.CheckMagicMeter(); + CM.Main.CheckWrinklerCount(); } - - // Check all changing minigames and game-states - CM.Main.CheckGoldenCookie(); - CM.Main.CheckTickerFortune(); - CM.Main.CheckSeasonPopup(); - CM.Main.CheckGardenTick(); - CM.Main.CheckMagicMeter(); - CM.Main.CheckWrinklerCount(); - - // Cache average CPS - CM.Cache.CacheCurrWrinklerCPS(); - CM.Cache.CacheAvgCPS(); }; /** @@ -87,6 +79,7 @@ CM.Main.DelayInit = function() { CM.Disp.CreateSimpleTooltip(CM.Disp.TooltipText[i][0], CM.Disp.TooltipText[i][1], CM.Disp.TooltipText[i][2]); } CM.Disp.CreateWrinklerButtons(); + CM.Disp.UpdateBuildingUpgradeStyle(); CM.Main.ReplaceTooltips(); CM.Main.AddWrinklerAreaDetect(); @@ -101,14 +94,6 @@ CM.Main.DelayInit = function() { if (Game.prefs.popups) Game.Popup('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' loaded!'); else Game.Notify('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' loaded!', '', '', 1, 1); - // TODO: given the architecture of your code, you probably want these lines somewhere else, - // but I stuck them here for convenience - l("products").style.display = "grid"; - l("storeBulk").style.gridRow = "1/1"; - - l("upgrades").style.display = "flex"; - l("upgrades").style["flex-wrap"] = "wrap"; - Game.Win('Third-party'); }; @@ -209,9 +194,12 @@ CM.Main.ReplaceNative = function() { if (isNaN(time) || time <= 0) return CM.Backup.sayTime(time, detail); else return CM.Disp.FormatTime(time / Game.fps, 1); }; - + + // Since the Ascend Tooltip is not actually a tooltip we need to add our additional info here... CM.Backup.Logic = Game.Logic; - eval('CM.Backup.LogicMod = ' + Game.Logic.toString().split('document.title').join('CM.Disp.Title')); + eval('CM.Backup.LogicMod = ' + Game.Logic.toString() + .split('document.title').join('CM.Disp.Title') + .split("' more cookies for the next level.
';").join("` more cookies for the next level.
${CM.Options.TooltipAscendButton ? `
You need ${CM.Cache.TimeTillNextPrestige} for the next level.
` : ``}`;")); Game.Logic = function() { CM.Backup.LogicMod(); // Update Title @@ -234,7 +222,7 @@ CM.Main.ReplaceNativeGrimoire = function() { */ CM.Main.ReplaceNativeGrimoireLaunch = function() { if (!CM.Main.HasReplaceNativeGrimoireLaunch && Game.Objects['Wizard tower'].minigameLoaded) { - var minigame = Game.Objects['Wizard tower'].minigame; + let minigame = Game.Objects['Wizard tower'].minigame; CM.Backup.GrimoireLaunch = minigame.launch; eval('CM.Backup.GrimoireLaunchMod = ' + minigame.launch.toString().split('=this').join('= Game.Objects[\'Wizard tower\'].minigame')); Game.Objects['Wizard tower'].minigame.launch = function() { @@ -253,7 +241,7 @@ CM.Main.ReplaceNativeGrimoireLaunch = function() { */ CM.Main.ReplaceNativeGrimoireDraw = function() { if (!CM.Main.HasReplaceNativeGrimoireDraw && Game.Objects['Wizard tower'].minigameLoaded) { - var minigame = Game.Objects['Wizard tower'].minigame; + let minigame = Game.Objects['Wizard tower'].minigame; CM.Backup.GrimoireDraw = minigame.draw; Game.Objects['Wizard tower'].minigame.draw = function() { CM.Backup.GrimoireDraw(); @@ -274,7 +262,7 @@ CM.Main.ReplaceNativeGrimoireDraw = function() { */ CM.Main.ReplaceTooltips = function() { CM.Main.ReplaceTooltipBuild(); - CM.Main.ReplaceTooltipLump(); + CM.Main.ReplaceTooltipLump(); // Replace Tooltips of Minigames. Nesting it in LoadMinigames makes sure to replace them even if // they were not loaded initially @@ -299,7 +287,7 @@ CM.Main.ReplaceTooltips = function() { CM.Main.ReplaceTooltipBuild = function() { CM.Main.TooltipBuildBackup = []; for (let i of Object.keys(Game.Objects)) { - var me = Game.Objects[i]; + let me = Game.Objects[i]; if (l('product' + me.id).onmouseover != null) { CM.Main.TooltipBuildBackup[i] = l('product' + me.id).onmouseover; eval('l(\'product\' + me.id).onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'b\', \'' + i + '\');}, \'store\'); Game.tooltip.wobble();}'); @@ -307,6 +295,18 @@ CM.Main.ReplaceTooltipBuild = function() { } }; +/** + * This function replaces the original .onmouseover functions of sugar lumps so that it calls CM.Disp.Tooltip() + * CM.Disp.Tooltip() sets the tooltip type to 's' + * It is called by CM.Main.ReplaceTooltips() + */ +CM.Main.ReplaceTooltipLump = function() { + if (Game.canLumps()) { + CM.Main.TooltipLumpBackup = l('lumps').onmouseover; + eval('l(\'lumps\').onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'s\', \'Lump\');}, \'this\'); Game.tooltip.wobble();}'); + } +}; + /** * This function replaces the original .onmouseover functions of the Grimoire minigame so that it calls CM.Disp.Tooltip() * CM.Disp.Tooltip() sets the tooltip type to 'g' @@ -324,18 +324,6 @@ CM.Main.ReplaceTooltipGrimoire = function() { } }; -/** - * This function replaces the original .onmouseover functions of sugar lumps so that it calls CM.Disp.Tooltip() - * CM.Disp.Tooltip() sets the tooltip type to 's' - * It is called by CM.Main.ReplaceTooltips() - */ -CM.Main.ReplaceTooltipLump = function() { - if (Game.canLumps()) { - CM.Main.TooltipLumpBackup = l('lumps').onmouseover; - eval('l(\'lumps\').onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'s\', \'Lump\');}, \'this\'); Game.tooltip.wobble();}'); - } -}; - /** * This function replaces the original .onmouseover functions of all garden plants so that it calls CM.Disp.Tooltip() * CM.Disp.Tooltip() sets the tooltip type to 'p' @@ -345,7 +333,7 @@ CM.Main.ReplaceTooltipGarden = function() { if (Game.Objects.Farm.minigameLoaded) { l('gardenTool-1').onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('ha', 'HarvestAllButton');}, 'this'); Game.tooltip.wobble();}; Array.from(l('gardenPlot').children).forEach((child) => { - var coords = child.id.slice(-3,); + let coords = child.id.slice(-3,); child.onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('p', [`${coords[0]}`,`${coords[2]}`]);}, 'this'); Game.tooltip.wobble();}; }); } @@ -465,7 +453,7 @@ CM.Main.CheckGardenTick = function() { */ CM.Main.CheckMagicMeter = function() { if (Game.Objects['Wizard tower'].minigameLoaded && CM.Options.GrimoireBar === 1) { - var minigame = Game.Objects['Wizard tower'].minigame; + let minigame = Game.Objects['Wizard tower'].minigame; if (minigame.magic < minigame.magicM) CM.Main.lastMagicBarFull = false; else if (!CM.Main.lastMagicBarFull) { CM.Main.lastMagicBarFull = true; @@ -482,7 +470,7 @@ CM.Main.CheckMagicMeter = function() { */ CM.Main.CheckWrinklerCount = function() { if (Game.elderWrath > 0) { - var CurrentWrinklers = 0; + let CurrentWrinklers = 0; for (let i in Game.wrinklers) { if (Game.wrinklers[i].phase === 2) CurrentWrinklers++; } @@ -512,8 +500,7 @@ CM.Main.CheckWrinklerCount = function() { /** * This function creates .onmouseover/out events that determine if the mouse is hovering-over a Wrinkler * It is called by CM.Main.DelayInit - * TODO: The system for displaying wrinklers should ideally use a similar system as other tooltips - * Thus, writing a CM.Main.ReplaceTooltipWrinkler function etc. + * As wrinklers are not appended to the DOM we us a different system than for other tooltips */ CM.Main.AddWrinklerAreaDetect = function() { l('backgroundLeftCanvas').onmouseover = function() {CM.Disp.TooltipWrinklerArea = 1;}; @@ -536,7 +523,7 @@ CM.Main.AddWrinklerAreaDetect = function() { */ CM.Main.FixMouseY = function(target) { if (CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) { - var timerBarHeight = parseInt(CM.Disp.TimerBar.style.height); + let timerBarHeight = parseInt(CM.Disp.TimerBar.style.height); Game.mouseY -= timerBarHeight; target(); Game.mouseY += timerBarHeight; diff --git a/src/Sim.js b/src/Sim.js index 8f199f4..7f59496 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -17,7 +17,7 @@ * @returns {number} moni Total price */ CM.Sim.BuildingGetPrice = function(build, basePrice, start, free, increase) { - var moni = 0; + let moni = 0; for (let i = 0; i < increase; i++) { let price = basePrice * Math.pow(Game.priceIncrease, Math.max(0, start - free)); price = Game.modifyBuildingPrice(build, price); @@ -84,14 +84,14 @@ CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, noSim) { // Calculate money gains from selling buildings // If noSim is set, use Game methods to compute price instead of Sim ones. noSim = typeof noSim === "undefined" ? 0 : noSim; - var moni = 0; + let moni = 0; if (amount === -1) amount = start; if (!amount) amount = Game.buyBulk; for (let i = 0; i < amount; i++) { let price = basePrice * Math.pow(Game.priceIncrease, Math.max(0, start - free)); price = noSim ? Game.modifyBuildingPrice(build, price) : CM.Sim.modifyBuildingPrice(build, price); price = Math.ceil(price); - var giveBack = noSim ? build.getSellMultiplier() : CM.Sim.getSellMultiplier(); + let giveBack = noSim ? build.getSellMultiplier() : CM.Sim.getSellMultiplier(); price = Math.floor(price * giveBack); if (start > 0) { moni += price; @@ -192,7 +192,7 @@ CM.Sim.hasAura = function(what) { * @returns {number} The multiplier */ CM.Sim.auraMult = function(what) { - var n = 0; + let n = 0; if (Game.dragonAuras[CM.Sim.dragonAura].name === what || Game.dragonAuras[CM.Sim.dragonAura2].name === what) n = 1; if (Game.dragonAuras[CM.Sim.dragonAura].name === 'Reality Bending' || Game.dragonAuras[CM.Sim.dragonAura2].name === 'Reality Bending') @@ -211,8 +211,8 @@ CM.Sim.hasGod = function(what) { if (!CM.Sim.Objects.Temple.minigameLoaded) { return false; } - var possibleGods = CM.Sim.Objects.Temple.minigame.gods; - var god=possibleGods[what]; + let possibleGods = CM.Sim.Objects.Temple.minigame.gods; + let god=possibleGods[what]; for (let i=0;i<3;i++) { if (CM.Sim.Objects.Temple.minigame.slot[i]==god.id) return (i+1); @@ -559,7 +559,7 @@ CM.Sim.CalculateGains = function() { if (CM.Sim.Has('Ant larva')) eggMult *= 1.01; if (CM.Sim.Has('Century egg')) { // The boost increases a little every day, with diminishing returns up to +10% on the 100th day - var day = Math.floor((CM.Sim.DateCentury - Game.startDate) / 1000 / 10) * 10 / 60 / 60 / 24; + let day = Math.floor((CM.Sim.DateCentury - Game.startDate) / 1000 / 10) * 10 / 60 / 60 / 24; day = Math.min(day, 100); // Sets a Cache value to be displayed in the Stats page, could be moved... CM.Cache.CentEgg = 1 + (1 - Math.pow(1 - day / 100, 3)) * 0.1; @@ -748,7 +748,7 @@ CM.Sim.BuyBuildingsBonusIncome = function(building, amount) { } } - var lastAchievementsOwned = CM.Sim.AchievementsOwned; + let lastAchievementsOwned = CM.Sim.AchievementsOwned; CM.Sim.CalculateGains(); @@ -789,7 +789,7 @@ CM.Sim.BuyUpgradesBonusIncome = function(upgrade) { CM.Sim.Win('Wholesome'); } - var lastAchievementsOwned = CM.Sim.AchievementsOwned; + let lastAchievementsOwned = CM.Sim.AchievementsOwned; CM.Sim.CalculateGains(); @@ -900,7 +900,7 @@ CM.Sim.CalculateChangeAura = function(aura) { CM.Sim.CopyData(); // Check if aura being changed is first or second aura - var auraToBeChanged = l('promptContent').children[0].innerHTML.includes("secondary"); + let auraToBeChanged = l('promptContent').children[0].innerHTML.includes("secondary"); if (auraToBeChanged) CM.Sim.dragonAura2 = aura; else CM.Sim.dragonAura = aura; @@ -909,7 +909,7 @@ CM.Sim.CalculateChangeAura = function(aura) { if (CM.Sim.dragonAura != CM.Cache.dragonAura || CM.Sim.dragonAura2 != CM.Cache.dragonAura2) { for (let i = Game.ObjectsById.length; i > -1, --i;) { if (Game.ObjectsById[i].amount > 0) { - var highestBuilding = CM.Sim.Objects[Game.ObjectsById[i].name].name; + let highestBuilding = CM.Sim.Objects[Game.ObjectsById[i].name].name; CM.Sim.Objects[highestBuilding].amount -=1; CM.Sim.buildingsOwned -= 1; price = CM.Sim.Objects[highestBuilding].basePrice * Math.pow(Game.priceIncrease, Math.max(0, CM.Sim.Objects[highestBuilding].amount - 1 -CM.Sim.Objects[highestBuilding].free)); @@ -1029,7 +1029,7 @@ CM.Sim.SellBuildingsForChoEgg = function() { // Sacrifice highest buildings for the aura switch for (let i = 0; i < buildingsToSacrifice; ++i) { - var highestBuilding = 0; + let highestBuilding = 0; for (let j in CM.Sim.Objects) { if (CM.Sim.Objects[j].amount > 0) { highestBuilding = CM.Sim.Objects[j];