From 08faf9f1983cf9683e7d2551c15f1d9d2c045427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Wed, 24 Feb 2021 00:14:14 +0100 Subject: [PATCH 1/3] Made prelimenary switch to airbnb-base --- .eslintrc.js | 72 +- CookieMonster.js | 2 +- package-lock.json | 1415 +++++++++++++++++++++++++++++++- package.json | 8 +- src/Cache.js | 286 ++++--- src/Config.js | 104 ++- src/Data.js | 555 ++++++++----- src/Disp.js | 1993 +++++++++++++++++++++------------------------ src/Footer.js | 80 +- src/Header.js | 27 +- src/Main.js | 225 +++-- src/Sim.js | 377 +++++---- 12 files changed, 3310 insertions(+), 1834 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 5f96f5b..04c37e1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,26 +1,50 @@ module.exports = { - "env": { - "browser": true, - "es2021": true - }, - "globals": { - "module": "readonly", - "Game": "writable", - "l": "readonly", - "b64_to_utf8": "readonly", - "utf8_to_b64": "readonly", - "Beautify": "writable", - "realAudio": "readonly", - "JSColor": "readonly", - "jscolor": "readonly", - "BeautifyAll": "readonly", - "CM": "writable", - "unsafeWindow": "readonly", - }, - "extends": "eslint:recommended", - "parserOptions": { - "ecmaVersion": 12 - }, - "rules": { - } + env: { + browser: true, + es2021: true, + }, + globals: { + module: 'readonly', + Game: 'writable', + l: 'readonly', + b64_to_utf8: 'readonly', + utf8_to_b64: 'readonly', + Beautify: 'writable', + realAudio: 'readonly', + JSColor: 'readonly', + jscolor: 'readonly', + BeautifyAll: 'readonly', + CM: 'writable', + unsafeWindow: 'readonly', + }, + extends: 'airbnb-base', + parserOptions: { + ecmaVersion: 12, + }, + rules: { + indent: ['error', 'tab'], + 'no-tabs': 'off', + 'max-len': 'off', + 'no-param-reassign': 'off', + 'no-plusplus': 'off', + 'no-new-func': 'off', + 'no-eval': 'off', + 'no-restricted-properties': 'off', + 'no-restricted-syntax': 'off', + 'no-mixed-operators': 'off', + 'prefer-destructuring': 'off', + 'func-names': 'off', + 'no-use-before-define': 'off', + 'no-console': 'off', + 'no-nested-ternary': 'off', + 'object-shorthand': 'off', + 'no-else-return': 'off', + 'prefer-arrow-callback': 'off', + 'no-new': 'off', + 'no-alert': 'off', + 'new-cap': 'off', + 'no-restricted-globals': 'off', + 'no-template-curly-in-string': 'off', + radix: 'off', + }, }; diff --git a/CookieMonster.js b/CookieMonster.js index 07856ef..42af996 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:"4"};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.HeavenlyChipsDiff=new CMAvgQueue(5);CM.Cache.CacheHeavenlyChipsPS;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();CM.Cache.CacheHeavenlyChipsPS();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.Disp.GetCPS())};class CMAvgQueue{constructor(maxLength){this.maxLength=maxLength;this.queue=[]}addLatest(newValue){if(this.queue.push(newValue)>this.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.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 nextRequired=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.ChainMaxReward=CM.Cache.MaxChainCookieReward(7,maxPayout,CM.Cache.GoldenCookiesMult);CM.Cache.ChainRequired=CM.Cache.ChainMaxReward[1]*2/CM.Cache.GoldenCookiesMult;CM.Cache.ChainRequiredNext=CM.Cache.ChainMaxReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainMaxWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout,CM.Cache.WrathCookiesMult);CM.Cache.ChainWrathRequired=CM.Cache.ChainMaxWrathReward[1]*2/CM.Cache.WrathCookiesMult;CM.Cache.ChainWrathRequiredNext=CM.Cache.ChainMaxWrathReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyMaxReward=CM.Cache.MaxChainCookieReward(7,maxPayout*7,CM.Cache.GoldenCookiesMult);CM.Cache.ChainFrenzyRequired=CM.Cache.ChainFrenzyMaxReward[1]*2/CM.Cache.GoldenCookiesMult;CM.Cache.ChainFrenzyRequiredNext=CM.Cache.ChainFrenzyMaxReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyMaxWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout*7,CM.Cache.WrathCookiesMult);CM.Cache.ChainFrenzyWrathRequired=CM.Cache.ChainFrenzyMaxWrathReward[1]*2/CM.Cache.WrathCookiesMult;CM.Cache.ChainFrenzyWrathRequiredNext=CM.Cache.ChainFrenzyMaxWrathReward[2]/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.order0)choEggTotal+=CM.Cache.WrinklersTotal;CM.Cache.RealCookiesEarned=Math.max(Game.cookiesEarned,choEggTotal);choEggTotal*=.05;let timeDiff=currDate-CM.Cache.lastCPSCheck;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)color=CM.Disp.colorPurple;else if(me.pp>CM.Cache.mid)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow;if(Number(CM.Options.PPSecondsLowerLimit)!==0){if(price/CM.Disp.GetCPS()0)color=CM.Disp.colorRed}return color};CM.Cache.CacheBuildingsPP=function(){CM.Cache.min=Infinity;CM.Cache.max=1;CM.Cache.ArrayOfPPs=[];if(typeof CM.Options.PPExcludeTop==="undefined")CM.Options.PPExcludeTop=0;if(CM.Options.ColorPPBulkMode===0){for(let i of Object.keys(CM.Cache.Objects1)){if(Game.cookiesPs){CM.Cache.Objects1[i].pp=Math.max(Game.Objects[i].getPrice()-(Game.cookies+CM.Disp.GetWrinkConfigBank()),0)/Game.cookiesPs+Game.Objects[i].getPrice()/CM.Cache.Objects1[i].bonus}else CM.Cache.Objects1[i].pp=Game.Objects[i].getPrice()/CM.Cache.Objects1[i].bonus;CM.Cache.ArrayOfPPs.push([CM.Cache.Objects1[i].pp,Game.Objects[i].getPrice()])}CM.Cache.ArrayOfPPs.sort(((a,b)=>a[0]-b[0]));if(CM.Options.PPOnlyConsiderBuyable){while(CM.Cache.ArrayOfPPs[0][1]>Game.cookies){if(CM.Cache.ArrayOfPPs.length===1){break}CM.Cache.ArrayOfPPs.shift()}}CM.Cache.min=CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop][0];CM.Cache.max=CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length-1][0];CM.Cache.mid=(CM.Cache.max-CM.Cache.min)/2+CM.Cache.min;for(let i of Object.keys(CM.Cache.Objects1)){CM.Cache.Objects1[i].color=CM.Cache.ColourOfPP(CM.Cache.Objects1[i],Game.Objects[i].getPrice());for(let j=0;ja[0]-b[0]));if(CM.Options.PPOnlyConsiderBuyable){while(CM.Cache.ArrayOfPPs[0][1]>Game.cookies){if(CM.Cache.ArrayOfPPs.length===1){break}CM.Cache.ArrayOfPPs.shift()}}CM.Cache.min=CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop][0];CM.Cache.max=CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length-1][0];CM.Cache.mid=(CM.Cache.max-CM.Cache.min)/2+CM.Cache.min;for(let i of Object.keys(CM.Cache.Objects1)){CM.Cache[target][i].color=CM.Cache.ColourOfPP(CM.Cache[target][i],Game.Objects[i].bulkPrice);for(let j=0;j-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.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.ColorPPBulkMode={type:"bool",group:"Calculation",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,func:function(){CM.Cache.CachePP()}};CM.Data.Config.PPExcludeTop={type:"bool",group:"Calculation",label:["Don't Ignore Any","Ignore 1st Best","Ignore 1st and 2nd Best","Ignore 1st, 2nd and 3rd Best"],desc:"Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values",toggle:true};CM.Data.Config.PPSecondsLowerLimit={type:"numscale",group:"Calculation",label:"Lower limit for PP (in seconds): ",desc:'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option',min:0,max:Infinity};CM.Data.Config.PPOnlyConsiderBuyable={type:"bool",group:"Calculation",label:["Don't Ignore Non-Buyable","Ignore Non-Buyable"],desc:"Makes CookieMonster label buildings and upgrades you can't buy right now red, useful in those situations where you just want to spend your full bank 'most optimally'",toggle:true};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.ToolWarnUser={type:"numscale",group:"Tooltip",label:"Tooltip Warning At x times CPS: ",desc:"Use this to show a customized warning if buying it will put the bank under the amount equal to value times cps; setting to 0 disables the function altogether",min:0,max:Infinity};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 Extra Info Ascend Tooltip OFF","Show Extra Info Ascend Tooltip ON"],desc:"Shows additional info in the ascend tooltip",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.HeavenlyChipsTarget={type:"numscale",group:"Statistics",label:"Heavenly Chips Target: ",desc:'Use this to set a Heavenly Chips target that will be counted towards in the "prestige" statsistics sections',min:1,max:Infinity};CM.Data.Config.ShowMissedGC={type:"bool",group:"Statistics",label:["Missed GC OFF","Missed GC ON"],desc:"Show a stat in the statistics screen that counts how many Golden Cookies you have missed",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,UpBarColor:1,UpgradeBarFixedPos:1,CalcWrink:0,CPSMode:1,AvgCPSHist:3,AvgClicksHist:0,ColorPPBulkMode:1,PPExcludeTop:0,PPSecondsLowerLimit:0,PPOnlyConsiderBuyable: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,ToolWarnUser:0,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,HeavenlyChipsTarget:1,ShowMissedGC: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,Chain:1,Spells:1,Garden:1,Prestige:1,Wrink:1,Sea:1,Misc:1,InfoTab:1}};CM.Data.ModDescription=`
\nCookie Monster\noffers a wide range of tools and statistics to enhance your game experience.\nIt is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.
\nProgess on new updates and all previous release notes can be found on the GitHub page linked above!\n
\n`;CM.Data.LatestReleaseNotes=`
\nThe latest update (v 2.031.4) has introduced the following features:\n- A new warning and stat for Conjure Baked Goods in combination with Frenzy has been added
\n- User can now set a custom tooltip warning ("x times cps") in the settings
\n- Garden plots with plants that give cookies on harvest now display a tooltip with current and maximum reward
\n- The Harvest All button in the Garden now has a tooltip displaying the current reward
\n- The Ascend button can now display additional info (this can be turned off in the settings)
\n- The statistics page now displays the Heavenly Chips per second
\n- The statistics page now displays the CPS needed for the next level in Chain Cookies
\n- You can now set a Heavenly Chips target in the settings which will be counted down to in the statistics page
\n- The color picker in the settings has been updated to its latest version
\n- The overlay of seconds/percentage of timers is now toggle able and more readable
\n- You can now toggle to disable bulk-buying from buying less than the selected amount (i.e., buying 7 of a building by pressing the buy 10 when you don't have enough for 10)
\n- CookieMonster now uses the Modding API provided by the base game
\n- There is a new option that allows the decoupling of the base game volume setting and the volumes of sounds created by the mod
\n- The tab title now displays a "!" if a Golden Cookie or Reindeer can spawn
\n- PP calculation can now be set to: 1) Exclude the 1st, 2nd or 3rd most optimal building (if you never want to buy that it), 2) Always consider optimal buildings that cost below "xx seconds of CPS" (toggleable in the settings), 3) Ignore any building or upgrade that is not purchasable at the moment
\n
\nThis update fixes the following bugs:
\n- Minigames with enhanced tooltips will now also show these if the minigames were not loaded when CookieMonster was loaded
\n- Sound, Flashes and Notifications will no longer play when the mod is initializing
\n- The color picker should now update its display consistently
\n- Fixed some typo's
\n- Fixed a game breaking bug when the player had not purchased any upgrades
\n- Fixed a number of console errors thrown by CM
\n- Fixed the integration with mods that provide additional content, they should now no longer break CookieMonster
\n- The Timer bar will now disappear correctly when the Golden Switch has been activated
\n- Fixed errors in the calculation of the Chain Cookies and Wrinkler stats
\n
\n`;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 CM.Disp.colors.indexOf(a.color)>CM.Disp.colors.indexOf(b.color)?1:CM.Disp.colors.indexOf(a.color){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;jCM.Disp.colors.indexOf(a.color)-CM.Disp.colors.indexOf(b.color)))}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"));if(Game.Objects["Wizard tower"].minigameLoaded){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"))}CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px";CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnUser",CM.Disp.colorRed,"Warning: ",`Purchase of this item will put you under the number of Cookies equal to ${CM.Options.ToolWarnUser} seconds of CPS`,"CMDispTooltipWarnUserText"));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){if(amount0&&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=document.createElement("div");title.className="title";if(Game.onMenu==="prefs"){title.textContent="Cookie Monster Settings";CM.Disp.AddMenuPref(title)}else if(Game.onMenu==="stats"){if(CM.Options.Stats){title.textContent="Cookie Monster Statistics";CM.Disp.AddMenuStats(title)}}else if(Game.onMenu==="log"){title.textContent="Cookie Monster ";CM.Disp.AddMenuInfo(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]!==null?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.Disp.GetCPS(),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)))}if(CM.Options.ShowMissedGC){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="title";div.style.padding="0px 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";div.appendChild(document.createTextNode(" "));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(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()0){section.appendChild(CM.Disp.CreateStatsListing("basic","Heavenly Chips To Target Set In Settings (CUR)",document.createTextNode(Beautify(CookiesTillTarget))));section.appendChild(CM.Disp.CreateStatsListing("basic","Time To Target (CUR, Current 5 Second Average)",document.createTextNode(CM.Disp.FormatTime(CookiesTillTarget/CM.Cache.HCPerSecond))))}}let resetBonus=CM.Sim.ResetBonus(possiblePresMax);let resetFrag=document.createDocumentFragment();resetFrag.appendChild(document.createTextNode(Beautify(resetBonus)));let increase=Math.round(resetBonus/Game.cookiesPs*1e4);if(isFinite(increase)&&increase!=0){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"));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")){let delta7=7-willHave%10;if(delta7<0)delta7+=10;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")){let delta777=777-willHave%1e3;if(delta777<0)delta777+=1e3;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")){let delta777777=777777-willHave%1e6;if(delta777777<0)delta777777+=1e6;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))}return section};CM.Disp.AddMissingUpgrades=function(){for(let menuSection of l("menu").children){if(menuSection.children[0]){if(menuSection.children[0].innerHTML==="Prestige"&&CM.Cache.MissingUpgradesPrestige){let prestigeUpgradesMissing=CM.Cache.MissingUpgradesPrestige.match(new RegExp("div","g")||[]).length/2;let title=document.createElement("div");title.id="CMMissingUpgradesPrestigeTitle";title.className="listing";let titlefrag=document.createElement("div");titlefrag.innerHTML="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.AddMenuInfo=function(title){let info=document.createElement("div");info.className="subsection";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.InfoTab?"-":"+";span.onclick=function(){CM.Config.ToggleHeader("InfoTab");Game.UpdateMenu()};title.appendChild(span);info.appendChild(title);if(CM.Options.Header.InfoTab){let description=document.createElement("div");description.innerHTML=CM.Data.ModDescription;info.appendChild(description);let notes=document.createElement("div");notes.innerHTML=CM.Data.LatestReleaseNotes;info.appendChild(notes)}let menu=l("menu").children[1];menu.insertBefore(info,menu.children[1])};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"],["ChainNextLevelPlaceholder","Cheated cookies might break this formula","250px"]];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.colorGray,CM.Disp.colorBlue,CM.Disp.colorGreen,CM.Disp.colorYellow,CM.Disp.colorOrange,CM.Disp.colorRed,CM.Disp.colorPurple,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.Main.LastModCount!=Object.keys(Game.mods).length){CM.Sim.CreateSimFunctions();CM.Sim.InitData();CM.Cache.InitCache();CM.Main.LastModCount=Object.keys(Game.mods).length}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.CreateSimFunctions();CM.Sim.InitData();CM.Cache.InitCache();CM.Main.LastModCount=Object.keys(Game.mods).length;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 ? `
It takes ${CM.Cache.TimeTillNextPrestige} to reach the next level and you are making ${Beautify(CM.Cache.HCPerSecond, 2)} chips on average in the last 5 seconds.
` : ``}`;")}`)();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.ReplaceFunction=function(funcToBeReplaced){return funcToBeReplaced.toString().split("Game.Upgrades[").join("CM.Sim.Upgrades[").split("Game.Achievements").join("CM.Sim.Achievements").split("Game.Has").join("CM.Sim.Has").split("Game.dragonAura]").join("CM.Sim.dragonAura]").split("Game.dragonAura2]").join("CM.Sim.dragonAura2]").split("Game.auraMult").join("CM.Sim.auraMult").split("Game.hasGod").join("CM.Sim.hasGod").split("M.gods[what]").join("CM.Sim.Objects.Temple.minigame.gods[what]").split("M.slot[i]").join("CM.Sim.Objects.Temple.minigame.slot[i]").split("Game.effs").join("CM.Sim.effs").split("Game.Objects").join("CM.Sim.Objects").split("Game.GetTieredCpsMult").join("CM.Sim.GetTieredCpsMult").split("Game.eff").join("CM.Sim.eff")};CM.Sim.CreateSimFunctions=function(){CM.Sim.Has=new Function(`return ${CM.Sim.ReplaceFunction(Game.Has)}`)();CM.Sim.HasAchiev=new Function(`return ${CM.Sim.ReplaceFunction(Game.HasAchiev)}`)();CM.Sim.hasAura=new Function(`return ${CM.Sim.ReplaceFunction(Game.hasAura)}`)();if(Game.hasGod)CM.Sim.hasGod=new Function(`return ${CM.Sim.ReplaceFunction(Game.hasGod)}`)();CM.Sim.GetHeavenlyMultiplier=new Function(`return ${CM.Sim.ReplaceFunction(Game.GetHeavenlyMultiplier)}`)();CM.Sim.auraMult=new Function(`return ${CM.Sim.ReplaceFunction(Game.auraMult)}`)();CM.Sim.eff=new Function(`return ${CM.Sim.ReplaceFunction(Game.eff)}`)();CM.Sim.GetTieredCpsMult=new Function(`return ${CM.Sim.ReplaceFunction(Game.GetTieredCpsMult)}`)()};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.InitialBuildingData=function(buildingName){let me=Game.Objects[buildingName];let you={};you.cps=new Function(`return ${CM.Sim.ReplaceFunction(me.cps)}`)();you.baseCps=me.baseCps;you.name=me.name;you.tieredUpgrades=me.tieredUpgrades;you.synergies=me.synergies;you.fortune=me.fortune;you.grandma=me.grandma;you.baseCPS=me.baseCps;you.id=me.id;you.vanilla=me.vanilla;return you};CM.Sim.InitUpgrade=function(upgradeName){let me=Game.Upgrades[upgradeName];let you={};you.power=me.power;if(typeof me.power==="function"){me.power=new Function(`return ${CM.Sim.ReplaceFunction(me.power)}`)()}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);if(save.version!==CM.VersionMajor+"."+CM.VersionMinor){if(Game.prefs.popups)Game.Popup("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!");else Game.Notify("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!","","",0,1)}};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 +const CM={Backup:{},Cache:{},Config:{},Data:{Config:{}},Disp:{},Footer:{},Main:{},Options:{},Sim:{},VersionMajor:"2.031",VersionMinor:"4"};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.HeavenlyChipsDiff=new CMAvgQueue(5);CM.Cache.CacheHeavenlyChipsPS();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();CM.Cache.CacheHeavenlyChipsPS();const cookiesToNext=Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))+1)-(Game.cookiesEarned+Game.cookiesReset);CM.Cache.TimeTillNextPrestige=CM.Disp.FormatTime(cookiesToNext/CM.Disp.GetCPS())};class CMAvgQueue{constructor(maxLength){this.maxLength=maxLength;this.queue=[]}addLatest(newValue){if(this.queue.push(newValue)>this.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.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;const 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(const 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(const 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 nextRequired=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.ChainMaxReward=CM.Cache.MaxChainCookieReward(7,maxPayout,CM.Cache.GoldenCookiesMult);CM.Cache.ChainRequired=CM.Cache.ChainMaxReward[1]*2/CM.Cache.GoldenCookiesMult;CM.Cache.ChainRequiredNext=CM.Cache.ChainMaxReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainMaxWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout,CM.Cache.WrathCookiesMult);CM.Cache.ChainWrathRequired=CM.Cache.ChainMaxWrathReward[1]*2/CM.Cache.WrathCookiesMult;CM.Cache.ChainWrathRequiredNext=CM.Cache.ChainMaxWrathReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyMaxReward=CM.Cache.MaxChainCookieReward(7,maxPayout*7,CM.Cache.GoldenCookiesMult);CM.Cache.ChainFrenzyRequired=CM.Cache.ChainFrenzyMaxReward[1]*2/CM.Cache.GoldenCookiesMult;CM.Cache.ChainFrenzyRequiredNext=CM.Cache.ChainFrenzyMaxReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyMaxWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout*7,CM.Cache.WrathCookiesMult);CM.Cache.ChainFrenzyWrathRequired=CM.Cache.ChainFrenzyMaxWrathReward[1]*2/CM.Cache.WrathCookiesMult;CM.Cache.ChainFrenzyWrathRequiredNext=CM.Cache.ChainFrenzyMaxWrathReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment};CM.Cache.CacheMissingUpgrades=function(){CM.Cache.MissingUpgrades="";CM.Cache.MissingUpgradesCookies="";CM.Cache.MissingUpgradesPrestige="";const list=[];for(const i of Object.keys(Game.Upgrades)){list.push(Game.Upgrades[i])}const sortMap=function(a,b){if(a.order>b.order)return 1;else if(a.order0)choEggTotal+=CM.Cache.WrinklersTotal;CM.Cache.RealCookiesEarned=Math.max(Game.cookiesEarned,choEggTotal);choEggTotal*=.05;const timeDiff=currDate-CM.Cache.lastCPSCheck;const bankDiffAvg=Math.max(0,Game.cookies-CM.Cache.lastCookies)/timeDiff;const wrinkDiffAvg=Math.max(0,CM.Cache.WrinklersTotal-CM.Cache.lastWrinkCookies)/timeDiff;const wrinkFattestDiffAvg=Math.max(0,CM.Cache.WrinklersFattest[0]-CM.Cache.lastWrinkFattestCookies)/timeDiff;const choEggDiffAvg=Math.max(0,choEggTotal-CM.Cache.lastChoEgg)/timeDiff;const clicksDiffAvg=(Game.cookieClicks-CM.Cache.lastClicks)/timeDiff;for(let i=0;iCM.Cache.max)color=CM.Disp.colorPurple;else if(me.pp>CM.Cache.mid)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow;if(Number(CM.Options.PPSecondsLowerLimit)!==0){if(price/CM.Disp.GetCPS()0)color=CM.Disp.colorRed}return color};CM.Cache.CacheBuildingsPP=function(){CM.Cache.min=Infinity;CM.Cache.max=1;CM.Cache.ArrayOfPPs=[];if(typeof CM.Options.PPExcludeTop==="undefined")CM.Options.PPExcludeTop=0;if(CM.Options.ColorPPBulkMode===0){for(const i of Object.keys(CM.Cache.Objects1)){if(Game.cookiesPs){CM.Cache.Objects1[i].pp=Math.max(Game.Objects[i].getPrice()-(Game.cookies+CM.Disp.GetWrinkConfigBank()),0)/Game.cookiesPs+Game.Objects[i].getPrice()/CM.Cache.Objects1[i].bonus}else CM.Cache.Objects1[i].pp=Game.Objects[i].getPrice()/CM.Cache.Objects1[i].bonus;CM.Cache.ArrayOfPPs.push([CM.Cache.Objects1[i].pp,Game.Objects[i].getPrice()])}CM.Cache.ArrayOfPPs.sort(((a,b)=>a[0]-b[0]));if(CM.Options.PPOnlyConsiderBuyable){while(CM.Cache.ArrayOfPPs[0][1]>Game.cookies){if(CM.Cache.ArrayOfPPs.length===1){break}CM.Cache.ArrayOfPPs.shift()}}CM.Cache.min=CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop][0];CM.Cache.max=CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length-1][0];CM.Cache.mid=(CM.Cache.max-CM.Cache.min)/2+CM.Cache.min;for(const i of Object.keys(CM.Cache.Objects1)){CM.Cache.Objects1[i].color=CM.Cache.ColourOfPP(CM.Cache.Objects1[i],Game.Objects[i].getPrice());for(let j=0;ja[0]-b[0]));if(CM.Options.PPOnlyConsiderBuyable){while(CM.Cache.ArrayOfPPs[0][1]>Game.cookies){if(CM.Cache.ArrayOfPPs.length===1){break}CM.Cache.ArrayOfPPs.shift()}}CM.Cache.min=CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop][0];CM.Cache.max=CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length-1][0];CM.Cache.mid=(CM.Cache.max-CM.Cache.min)/2+CM.Cache.min;for(const i of Object.keys(CM.Cache.Objects1)){CM.Cache[target][i].color=CM.Cache.ColourOfPP(CM.Cache[target][i],Game.Objects[i].bulkPrice);for(let j=0;j-1&&CM.Options[i]-1&&CM.Options[i][j]<2)){mod=true;CM.Options[i][j]=CM.Data.ConfigDefault[i][j]}}}else{for(const 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(const 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){const 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.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.ColorPPBulkMode={type:"bool",group:"Calculation",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,func:function(){CM.Cache.CachePP()}};CM.Data.Config.PPExcludeTop={type:"bool",group:"Calculation",label:["Don't Ignore Any","Ignore 1st Best","Ignore 1st and 2nd Best","Ignore 1st, 2nd and 3rd Best"],desc:"Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values",toggle:true};CM.Data.Config.PPSecondsLowerLimit={type:"numscale",group:"Calculation",label:"Lower limit for PP (in seconds): ",desc:'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option',min:0,max:Infinity};CM.Data.Config.PPOnlyConsiderBuyable={type:"bool",group:"Calculation",label:["Don't Ignore Non-Buyable","Ignore Non-Buyable"],desc:"Makes CookieMonster label buildings and upgrades you can't buy right now red, useful in those situations where you just want to spend your full bank 'most optimally'",toggle:true};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.ToolWarnUser={type:"numscale",group:"Tooltip",label:"Tooltip Warning At x times CPS: ",desc:"Use this to show a customized warning if buying it will put the bank under the amount equal to value times cps; setting to 0 disables the function altogether",min:0,max:Infinity};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 Extra Info Ascend Tooltip OFF","Show Extra Info Ascend Tooltip ON"],desc:"Shows additional info in the ascend tooltip",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.HeavenlyChipsTarget={type:"numscale",group:"Statistics",label:"Heavenly Chips Target: ",desc:'Use this to set a Heavenly Chips target that will be counted towards in the "prestige" statsistics sections',min:1,max:Infinity};CM.Data.Config.ShowMissedGC={type:"bool",group:"Statistics",label:["Missed GC OFF","Missed GC ON"],desc:"Show a stat in the statistics screen that counts how many Golden Cookies you have missed",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,UpBarColor:1,UpgradeBarFixedPos:1,CalcWrink:0,CPSMode:1,AvgCPSHist:3,AvgClicksHist:0,ColorPPBulkMode:1,PPExcludeTop:0,PPSecondsLowerLimit:0,PPOnlyConsiderBuyable: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,ToolWarnUser:0,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,HeavenlyChipsTarget:1,ShowMissedGC: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,Chain:1,Spells:1,Garden:1,Prestige:1,Wrink:1,Sea:1,Misc:1,InfoTab:1}};CM.Data.ModDescription=`
\nCookie Monster\noffers a wide range of tools and statistics to enhance your game experience.\nIt is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.
\nProgess on new updates and all previous release notes can be found on the GitHub page linked above!\n
\n`;CM.Data.LatestReleaseNotes=`
\nThe latest update (v 2.031.4) has introduced the following features:\n- A new warning and stat for Conjure Baked Goods in combination with Frenzy has been added
\n- User can now set a custom tooltip warning ("x times cps") in the settings
\n- Garden plots with plants that give cookies on harvest now display a tooltip with current and maximum reward
\n- The Harvest All button in the Garden now has a tooltip displaying the current reward
\n- The Ascend button can now display additional info (this can be turned off in the settings)
\n- The statistics page now displays the Heavenly Chips per second
\n- The statistics page now displays the CPS needed for the next level in Chain Cookies
\n- You can now set a Heavenly Chips target in the settings which will be counted down to in the statistics page
\n- The color picker in the settings has been updated to its latest version
\n- The overlay of seconds/percentage of timers is now toggle able and more readable
\n- You can now toggle to disable bulk-buying from buying less than the selected amount (i.e., buying 7 of a building by pressing the buy 10 when you don't have enough for 10)
\n- CookieMonster now uses the Modding API provided by the base game
\n- There is a new option that allows the decoupling of the base game volume setting and the volumes of sounds created by the mod
\n- The tab title now displays a "!" if a Golden Cookie or Reindeer can spawn
\n- PP calculation can now be set to: 1) Exclude the 1st, 2nd or 3rd most optimal building (if you never want to buy that it), 2) Always consider optimal buildings that cost below "xx seconds of CPS" (toggleable in the settings), 3) Ignore any building or upgrade that is not purchasable at the moment
\n
\nThis update fixes the following bugs:
\n- Minigames with enhanced tooltips will now also show these if the minigames were not loaded when CookieMonster was loaded
\n- Sound, Flashes and Notifications will no longer play when the mod is initializing
\n- The color picker should now update its display consistently
\n- Fixed some typo's
\n- Fixed a game breaking bug when the player had not purchased any upgrades
\n- Fixed a number of console errors thrown by CM
\n- Fixed the integration with mods that provide additional content, they should now no longer break CookieMonster
\n- The Timer bar will now disappear correctly when the Golden Switch has been activated
\n- Fixed errors in the calculation of the Chain Cookies and Wrinkler stats
\n
\n`;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(const 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&&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){const decimals=CM.Options.ScaleDecimals+1;if(CM.Options.Scale===0){return CM.Backup.Beautify(num,floats)}else if(Number.isFinite(num)){let answer="";if(num===0){return num.toString()}else if(num>.001&&num=.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(const i of Object.keys(CM.Disp.BuffTimerBars)){CM.Disp.BuffTimerBars[i].remove()}CM.Disp.BuffTimerBars={};for(const i of Object.keys(Game.buffs)){if(Game.buffs[i]){const 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(const 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(){const target=`Objects${Game.buyBulk}`;if(Game.buyMode===1){if(CM.Options.BuildColor===1){for(const 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(const i of Object.keys(Game.Objects)){l(`productPrice${Game.Objects[i].id}`).style.removeProperty("color")}}}else if(Game.buyMode===-1){for(const i of Object.keys(CM.Cache.Objects1)){const 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){const arr=Object.keys(CM.Cache[target]).map((k=>{const o=CM.Cache[target][k];o.name=k;o.id=Game.Objects[k].id;return o}));arr.sort((function(a,b){return CM.Disp.colors.indexOf(a.color)>CM.Disp.colors.indexOf(b.color)?1:CM.Disp.colors.indexOf(a.color){const 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(const i of Object.keys(Game.UpgradesInStore)){const me=Game.UpgradesInStore[i];let addedColor=false;for(let j=0;jCM.Disp.colors.indexOf(a.color)-CM.Disp.colors.indexOf(b.color)))}else{arr.sort(((a,b)=>a.price-b.price))}const nameChecker=function(arr2,upgrade){return arr2.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){const 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(const 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(const 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");const desc=document.createElement("div");desc.style.minWidth=minWidth;desc.style.marginBottom="4px";const 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(const 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){const buildPrice=CM.Sim.BuildingGetPrice(Game.Objects[name],Game.Objects[name].basePrice,0,Game.Objects[name].free,Game.Objects[name].amount);const 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"){const 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";const 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){const 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"));const 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";const 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"));const pp=document.createElement("div");pp.style.marginBottom="4px";pp.id="CMTooltipPP";tooltip.appendChild(pp);tooltip.appendChild(CM.Disp.TooltipCreateHeader("Time Left"));const 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";const 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";const create=function(boxId,color,labelTextFront,labelTextBack,deficitId){const 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)";const labelDiv=document.createElement("div");box.appendChild(labelDiv);const 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));const deficitDiv=document.createElement("div");box.appendChild(deficitDiv);const 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"));if(Game.Objects["Wizard tower"].minigameLoaded){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"))}CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px";CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnUser",CM.Disp.colorRed,"Warning: ",`Purchase of this item will put you under the number of Cookies equal to ${CM.Options.ToolWarnUser} seconds of CPS`,"CMDispTooltipWarnUserText"));return CM.Disp.TooltipWarn};CM.Disp.UpdateTooltip=function(){CM.Sim.CopyData();if(l("tooltipAnchor").style.display!=="none"&&l("CMTooltipArea")){l("CMTooltipArea").innerHTML="";const 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){const tooltipBox=l("CMTooltipBorder");CM.Disp.TooltipCreateCalculationSection(tooltipBox);const 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);const increase=Math.round(CM.Disp.TooltipBonusIncome/Game.cookiesPs*1e4);if(Number.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;const 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;const 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)"));const 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(){const 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){const tile=minigame.plot[y][x];const me=minigame.plantsById[tile[0]-1];const plantName=me.name;let count=true;if(mortal&&me.immortal)count=false;if(tile[1]0){if(amount0&&me.selected){showingTooltip=true;if(CM.Disp.TooltipWrinklerBeingShown[i]===0||CM.Disp.TooltipWrinklerBeingShown[i]===undefined){const placeholder=document.createElement("div");const wrinkler=document.createElement("div");wrinkler.style.minWidth="120px";wrinkler.style.marginBottom="4px";const 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){const 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){const[bonusCPS,priceOfChange]=CM.Sim.CalculateChangeAura(aura);const timeToRecover=CM.Disp.FormatTime(priceOfChange/(bonusCPS+Game.cookiesPs));const bonusCPSPercentage=CM.Disp.Beautify(bonusCPS/Game.cookiesPs);l("dragonAuraInfo").style.minHeight="60px";l("dragonAuraInfo").style.margin="8px";l("dragonAuraInfo").appendChild(document.createElement("div")).className="line";const div=document.createElement("div");div.style.minWidth="200px";div.style.textAlign="center";div.textContent=`Picking this aura will change CPS by ${CM.Disp.Beautify(bonusCPS)} (${bonusCPSPercentage}% of current CPS).`;l("dragonAuraInfo").appendChild(div);const 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(){const title=document.createElement("div");title.className="title";if(Game.onMenu==="prefs"){title.textContent="Cookie Monster Settings";CM.Disp.AddMenuPref(title)}else if(Game.onMenu==="stats"){if(CM.Options.Stats){title.textContent="Cookie Monster Statistics";CM.Disp.AddMenuStats(title)}}else if(Game.onMenu==="log"){title.textContent="Cookie Monster ";CM.Disp.AddMenuInfo(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){const frag=document.createDocumentFragment();frag.appendChild(title);for(const group of Object.keys(CM.Data.ConfigGroups)){const groupObject=CM.Disp.CreatePrefHeader(group,CM.Data.ConfigGroups[group]);frag.appendChild(groupObject);if(CM.Options.Header[group]){if(group==="Notification"){for(const subGroup of Object.keys(CM.Data.ConfigGroupsNotification)){const 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(const option in CM.Data.Config){if(CM.Data.Config[option].group===subGroup)frag.appendChild(CM.Disp.CreatePrefOption(option))}}}}else{for(const option of Object.keys(CM.Data.Config)){if(CM.Data.Config[option].group===group)frag.appendChild(CM.Disp.CreatePrefOption(option))}}}}const resDef=document.createElement("div");resDef.className="listing";const 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){const div=document.createElement("div");div.className="title";div.style.opacity="0.7";div.style.fontSize="17px";div.appendChild(document.createTextNode(`${text} `));const 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){const div=document.createElement("div");div.className="listing";if(CM.Data.Config[config].type==="bool"){const 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);const label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}else if(CM.Data.Config[config].type==="vol"){const volume=document.createElement("div");volume.className="sliderBox";const title=document.createElement("div");title.style.float="left";title.innerHTML=CM.Data.Config[config].desc;volume.appendChild(title);const percent=document.createElement("div");percent.id=`slider${config}right`;percent.style.float="right";percent.innerHTML=`${CM.Options[config]}%`;volume.appendChild(percent);const 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"){const span=document.createElement("span");span.className="option";span.textContent=`${CM.Data.Config[config].label} `;div.appendChild(span);const 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(" "));const inputPrompt=document.createElement("input");inputPrompt.id=`${CM.Config.ConfigPrefix+config}Prompt`;inputPrompt.className="option";inputPrompt.type="text";inputPrompt.setAttribute("value",CM.Options[config]);const 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);const label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}else if(CM.Data.Config[config].type==="color"){div.className="";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(" "));const label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}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){const popAllFrag=document.createDocumentFragment();popAllFrag.appendChild(document.createTextNode(`${Beautify(CM.Cache.WrinklersTotal)} / ${Beautify(CM.Cache.WrinklersNormal)} `));const 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));const popFattestFrag=document.createDocumentFragment();popFattestFrag.appendChild(document.createTextNode(`${Beautify(CM.Cache.WrinklersFattest[0])} `));const 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]!==null?CM.Cache.WrinklersFattest[1]:"None"})`,popFattestFrag))}}let specDisp=false;const missingHalloweenCookies=[];for(const i of Object.keys(CM.Data.HalloCookies)){if(!Game.Has(CM.Data.HalloCookies[i])){missingHalloweenCookies.push(CM.Data.HalloCookies[i]);specDisp=true}}const missingChristmasCookies=[];for(const i of Object.keys(CM.Data.ChristCookies)){if(!Game.Has(CM.Data.ChristCookies[i])){missingChristmasCookies.push(CM.Data.ChristCookies[i]);specDisp=true}}const missingValentineCookies=[];for(const i of Object.keys(CM.Data.ValCookies)){if(!Game.Has(CM.Data.ValCookies[i])){missingValentineCookies.push(CM.Data.ValCookies[i]);specDisp=true}}const missingNormalEggs=[];for(const i of Object.keys(Game.eggDrops)){if(!Game.HasUnlocked(Game.eggDrops[i])){missingNormalEggs.push(Game.eggDrops[i]);specDisp=true}}const missingRareEggs=[];for(const i of Object.keys(Game.rareEggDrops)){if(!Game.HasUnlocked(Game.rareEggDrops[i])){missingRareEggs.push(Game.rareEggDrops[i]);specDisp=true}}const missingPlantDrops=[];for(const i of Object.keys(CM.Data.PlantDrops)){if(!Game.HasUnlocked(CM.Data.PlantDrops[i])){missingPlantDrops.push(CM.Data.PlantDrops[i]);specDisp=true}}const choEgg=Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg");const 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.Disp.GetCPS(),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")){const fortunes=[];for(const 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)))}if(CM.Options.ShowMissedGC){stats.appendChild(CM.Disp.CreateStatsListing("basic","Missed Golden Cookies",document.createTextNode(Beautify(Game.missedGoldenClicks))))}if(Game.prefs.autosave){const 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){const div=document.createElement("div");div.className="title";div.style.padding="0px 16px";div.style.opacity="0.7";div.style.fontSize="17px";div.style.fontFamily='"Kavoon", Georgia, serif';div.appendChild(document.createTextNode(`${text} `));const 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){const div=document.createElement("div");div.className="listing";const listingName=document.createElement("b");listingName.textContent=name;div.appendChild(listingName);if(type==="withTooltip"){div.className="listing";div.appendChild(document.createTextNode(" "));const 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(text);return div};CM.Disp.CreateStatsMissDisp=function(theMissDisp){const frag=document.createDocumentFragment();frag.appendChild(document.createTextNode(`${theMissDisp.length} `));const span=document.createElement("span");span.onmouseout=function(){Game.tooltip.hide()};const placeholder=document.createElement("div");const missing=document.createElement("div");missing.style.minWidth="140px";missing.style.marginBottom="4px";const title=document.createElement("div");title.className="name";title.style.marginBottom="4px";title.style.textAlign="center";title.textContent="Missing";missing.appendChild(title);for(const i of Object.keys(theMissDisp)){const 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(){const goldCookTooltip=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder";const section=document.createElement("div");section.className="CMStatsLuckySection";const luckyColor=Game.cookies+CM.Disp.GetWrinkConfigBank()0){section.appendChild(CM.Disp.CreateStatsListing("basic","Heavenly Chips To Target Set In Settings (CUR)",document.createTextNode(Beautify(CookiesTillTarget))));section.appendChild(CM.Disp.CreateStatsListing("basic","Time To Target (CUR, Current 5 Second Average)",document.createTextNode(CM.Disp.FormatTime(CookiesTillTarget/CM.Cache.HCPerSecond))))}}const resetBonus=CM.Sim.ResetBonus(possiblePresMax);const resetFrag=document.createDocumentFragment();resetFrag.appendChild(document.createTextNode(Beautify(resetBonus)));const increase=Math.round(resetBonus/Game.cookiesPs*1e4);if(isFinite(increase)&&increase!==0){const resetSmall=document.createElement("small");resetSmall.textContent=` (${increase/100}% of income)`;resetFrag.appendChild(resetSmall)}section.appendChild(CM.Disp.CreateStatsListing("withTooltip","Reset Bonus Income",resetFrag,"ResetTooltipPlaceholder"));const currentPrestige=Math.floor(Game.HowMuchPrestige(Game.cookiesReset));const willHave=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned));const willGet=willHave-currentPrestige;if(!Game.Has("Lucky digit")){let delta7=7-willHave%10;if(delta7<0)delta7+=10;const next7Reset=willGet+delta7;const next7Total=willHave+delta7;const 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")){let delta777=777-willHave%1e3;if(delta777<0)delta777+=1e3;const next777Reset=willGet+delta777;const next777Total=willHave+delta777;const 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")){let delta777777=777777-willHave%1e6;if(delta777777<0)delta777777+=1e6;const next777777Reset=willGet+delta777777;const next777777Total=willHave+delta777777;const frag777777=document.createDocumentFragment();frag777777.appendChild(document.createTextNode(`${next777777Total.toLocaleString()} / ${next777777Reset.toLocaleString()} (+${delta777777})`));section.appendChild(CM.Disp.CreateStatsListing("basic",'Next "Lucky Payout" (total / reset)',frag777777))}return section};CM.Disp.AddMissingUpgrades=function(){for(const menuSection of l("menu").children){if(menuSection.children[0]){if(menuSection.children[0].innerHTML==="Prestige"&&CM.Cache.MissingUpgradesPrestige){const prestigeUpgradesMissing=CM.Cache.MissingUpgradesPrestige.match(new RegExp("div","g")||[]).length/2;const title=document.createElement("div");title.id="CMMissingUpgradesPrestigeTitle";title.className="listing";const titlefrag=document.createElement("div");titlefrag.innerHTML=`Missing Prestige upgrades: ${prestigeUpgradesMissing}/${Game.PrestigeUpgrades.length} (${Math.floor(prestigeUpgradesMissing/Game.PrestigeUpgrades.length*100)}%)`;title.appendChild(titlefrag);menuSection.appendChild(title);const 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){const normalUpgradesMissing=CM.Cache.MissingUpgrades.match(new RegExp("div","g")||[]).length/2;const title=document.createElement("div");title.id="CMMissingUpgradesTitle";title.className="listing";const 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]);const upgrades=document.createElement("div");upgrades.className="listing crateBox";upgrades.innerHTML=CM.Cache.MissingUpgrades;menuSection.insertBefore(upgrades,document.getElementById("CMMissingUpgradesTitle").nextSibling)}if(CM.Cache.MissingUpgradesCookies){const cookieUpgradesMissing=CM.Cache.MissingUpgradesCookies.match(new RegExp("div","g")||[]).length/2;const title=document.createElement("div");title.id="CMMissingUpgradesCookiesTitle";title.className="listing";const 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);const 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();const tooltip=`function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;return`
\n\t
`};CM.Disp.AddMenuInfo=function(title){const info=document.createElement("div");info.className="subsection";const 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.InfoTab?"-":"+";span.onclick=function(){CM.Config.ToggleHeader("InfoTab");Game.UpdateMenu()};title.appendChild(span);info.appendChild(title);if(CM.Options.Header.InfoTab){const description=document.createElement("div");description.innerHTML=CM.Data.ModDescription;info.appendChild(description);const notes=document.createElement("div");notes.innerHTML=CM.Data.LatestReleaseNotes;info.appendChild(notes)}const menu=l("menu").children[1];menu.insertBefore(info,menu.children[1])};CM.Disp.CreateWrinklerButtons=function(){const 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);const 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"],["ChainNextLevelPlaceholder","Cheated cookies might break this formula","250px"]];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.colorGray,CM.Disp.colorBlue,CM.Disp.colorGreen,CM.Disp.colorYellow,CM.Disp.colorOrange,CM.Disp.colorRed,CM.Disp.colorPurple,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.Main.LastModCount!==Object.keys(Game.mods).length){CM.Sim.CreateSimFunctions();CM.Sim.InitData();CM.Cache.InitCache();CM.Main.LastModCount=Object.keys(Game.mods).length}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}const 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.CreateSimFunctions();CM.Sim.InitData();CM.Cache.InitCache();CM.Main.LastModCount=Object.keys(Game.mods).length;CM.Disp.CreateCssArea();CM.Disp.CreateBotBar();CM.Disp.CreateTimerBar();CM.Disp.CreateUpgradeBar();CM.Disp.CreateWhiteScreen();CM.Disp.CreateFavicon();for(const 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 ? `
It takes ${CM.Cache.TimeTillNextPrestige} to reach the next level and you are making ${Beautify(CM.Cache.HCPerSecond, 2)} chips on average in the last 5 seconds.
` : ``}`;")}`)();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){const 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){const 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{const 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(const 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(const 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(const 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(const 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){const 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.ReplaceFunction=function(funcToBeReplaced){return funcToBeReplaced.toString().split("Game.Upgrades[").join("CM.Sim.Upgrades[").split("Game.Achievements").join("CM.Sim.Achievements").split("Game.Has").join("CM.Sim.Has").split("Game.dragonAura]").join("CM.Sim.dragonAura]").split("Game.dragonAura2]").join("CM.Sim.dragonAura2]").split("Game.auraMult").join("CM.Sim.auraMult").split("Game.hasGod").join("CM.Sim.hasGod").split("M.gods[what]").join("CM.Sim.Objects.Temple.minigame.gods[what]").split("M.slot[i]").join("CM.Sim.Objects.Temple.minigame.slot[i]").split("Game.effs").join("CM.Sim.effs").split("Game.Objects").join("CM.Sim.Objects").split("Game.GetTieredCpsMult").join("CM.Sim.GetTieredCpsMult").split("Game.eff").join("CM.Sim.eff")};CM.Sim.CreateSimFunctions=function(){CM.Sim.Has=new Function(`return ${CM.Sim.ReplaceFunction(Game.Has)}`)();CM.Sim.HasAchiev=new Function(`return ${CM.Sim.ReplaceFunction(Game.HasAchiev)}`)();CM.Sim.hasAura=new Function(`return ${CM.Sim.ReplaceFunction(Game.hasAura)}`)();if(Game.hasGod)CM.Sim.hasGod=new Function(`return ${CM.Sim.ReplaceFunction(Game.hasGod)}`)();CM.Sim.GetHeavenlyMultiplier=new Function(`return ${CM.Sim.ReplaceFunction(Game.GetHeavenlyMultiplier)}`)();CM.Sim.auraMult=new Function(`return ${CM.Sim.ReplaceFunction(Game.auraMult)}`)();CM.Sim.eff=new Function(`return ${CM.Sim.ReplaceFunction(Game.eff)}`)();CM.Sim.GetTieredCpsMult=new Function(`return ${CM.Sim.ReplaceFunction(Game.GetTieredCpsMult)}`)()};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.InitialBuildingData=function(buildingName){const me=Game.Objects[buildingName];const you={};you.cps=new Function(`return ${CM.Sim.ReplaceFunction(me.cps)}`)();you.baseCps=me.baseCps;you.name=me.name;you.tieredUpgrades=me.tieredUpgrades;you.synergies=me.synergies;you.fortune=me.fortune;you.grandma=me.grandma;you.baseCPS=me.baseCps;you.id=me.id;you.vanilla=me.vanilla;return you};CM.Sim.InitUpgrade=function(upgradeName){const me=Game.Upgrades[upgradeName];const you={};you.power=me.power;if(typeof me.power==="function"){me.power=new Function(`return ${CM.Sim.ReplaceFunction(me.power)}`)()}you.pool=me.pool;you.name=me.name;return you};CM.Sim.InitAchievement=function(achievementName){const me=Game.Achievements[achievementName];const you={};you.name=me.name;return you};CM.Sim.InitData=function(){CM.Sim.Objects=[];for(const i of Object.keys(Game.Objects)){CM.Sim.Objects[i]=CM.Sim.InitialBuildingData(i)}CM.Sim.Upgrades=[];for(const i of Object.keys(Game.Upgrades)){CM.Sim.Upgrades[i]=CM.Sim.InitUpgrade(i)}CM.Sim.Achievements=[];for(const 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(const i of Object.keys(Game.Objects)){const me=Game.Objects[i];let you=CM.Sim.Objects[i];if(you===undefined){CM.Sim.Objects[i]=CM.Sim.InitialBuildingData(i);you=CM.Sim.Objects[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(const i of Object.keys(Game.Upgrades)){const me=Game.Upgrades[i];let you=CM.Sim.Upgrades[i];if(you===undefined){CM.Sim.Upgrades[i]=CM.Sim.InitUpgrade(i);you=CM.Sim.Upgrades[i]}you.bought=me.bought}for(const i of Object.keys(Game.Achievements)){const me=Game.Achievements[i];let you=CM.Sim.Achievements[i];if(you===undefined){CM.Sim.Achievements[i]=CM.Sim.InitAchievement(i);you=CM.Sim.Achievements[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;const effs={};for(const i of Object.keys(Game.Objects)){if(Game.Objects[i].minigameLoaded&&Game.Objects[i].minigame.effs){const myEffs=Game.Objects[i].minigame.effs;for(const 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(const i of Object.keys(Game.cookieUpgrades)){const 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;const 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){const 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(const i of Object.keys(CM.Sim.Objects)){const 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");const rawCookiesPs=CM.Sim.cookiesPs*mult;for(const i of Object.keys(Game.CpsAchievements)){if(rawCookiesPs>=Game.CpsAchievements[i].threshold)CM.Sim.Win(Game.CpsAchievements[i].name)}CM.Sim.cookiesPsRaw=rawCookiesPs;const n=Game.shimmerTypes.golden.n;const 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(const 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(const 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(const 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")){const list=Game.Tiers.fortune.upgrades;let fortunes=0;for(const 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();const 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(const 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)}}}const 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();const 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")}const lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!==CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}const 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(const i of Object.keys(CM.Sim.Objects)){num+=CM.Sim.Objects[i].amount}num-=CM.Sim.Objects.Cursor.amount;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){const 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(const 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();const 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){const 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}}}const 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;const lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!==CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}const 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(const i of Object.keys(CM.Sim.Objects)){const 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!==Number(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){const save=JSON.parse(str);CM.Config.LoadConfig(save.settings);if(save.version!==`${CM.VersionMajor}.${CM.VersionMinor}`){if(Game.prefs.popups)Game.Popup("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!");else Game.Notify("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!","","",0,1)}};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();const 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/package-lock.json b/package-lock.json index e70b3c9..236edb4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,17 @@ { - "name": "cookie-monster", + "name": "cookiemonster-mod", "version": "2.031.4", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "cookie-monster", + "name": "cookiemonster-mod", "version": "2.031.4", "license": "MIT", "devDependencies": { "eslint": "^7.19.0", + "eslint-config-airbnb-base": "^14.2.1", + "eslint-plugin-import": "^2.22.1", "terser": "^5.6.0-beta" } }, @@ -122,6 +124,12 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, "node_modules/acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -201,6 +209,42 @@ "sprintf-js": "~1.0.2" } }, + "node_modules/array-includes": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.3.tgz", + "integrity": "sha512-gcem1KlBU7c9rB+Rq8/3PPKsK2kjqeEBa3bD5kkQo4nYlOHQCJqIJFqBXDEfwaRuYTT4E+FxA9xez7Gf/e3Q7A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.2", + "get-intrinsic": "^1.1.1", + "is-string": "^1.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", + "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -232,6 +276,19 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -287,6 +344,21 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "node_modules/confusing-browser-globals": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz", + "integrity": "sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA==", + "dev": true + }, + "node_modules/contains-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", + "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -324,6 +396,18 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "node_modules/define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "dependencies": { + "object-keys": "^1.0.12" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -354,6 +438,60 @@ "node": ">=8.6" } }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-abstract": { + "version": "1.18.0-next.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.2.tgz", + "integrity": "sha512-Ih4ZMFHEtZupnUh6497zEL4y2+w8+1ljnCyaTa+adcoafI1GOvMwFlDjBLfWR7y9VLfrjRJe9ocuHY1PSR9jjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.1", + "object-inspect": "^1.9.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.3", + "string.prototype.trimstart": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -417,6 +555,132 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-config-airbnb-base": { + "version": "14.2.1", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz", + "integrity": "sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==", + "dev": true, + "dependencies": { + "confusing-browser-globals": "^1.0.10", + "object.assign": "^4.1.2", + "object.entries": "^1.1.2" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "eslint": "^5.16.0 || ^6.8.0 || ^7.2.0", + "eslint-plugin-import": "^2.22.1" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz", + "integrity": "sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA==", + "dev": true, + "dependencies": { + "debug": "^2.6.9", + "resolve": "^1.13.1" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/eslint-module-utils": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", + "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==", + "dev": true, + "dependencies": { + "debug": "^2.6.9", + "pkg-dir": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/eslint-module-utils/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/eslint-plugin-import": { + "version": "2.22.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", + "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.1", + "array.prototype.flat": "^1.2.3", + "contains-path": "^0.1.0", + "debug": "^2.6.9", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.4", + "eslint-module-utils": "^2.6.0", + "has": "^1.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.1", + "read-pkg-up": "^2.0.0", + "resolve": "^1.17.0", + "tsconfig-paths": "^3.9.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "dev": true, + "dependencies": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, "node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -589,6 +853,18 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/flat-cache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", @@ -614,12 +890,32 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "node_modules/functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -667,6 +963,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -676,6 +990,24 @@ "node": ">=8" } }, + "node_modules/has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hosted-git-info": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "dev": true + }, "node_modules/ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -726,6 +1058,48 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "node_modules/is-callable": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", + "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -756,6 +1130,67 @@ "node": ">=0.10.0" } }, + "node_modules/is-negative-zero": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", + "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-regex": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz", + "integrity": "sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-symbols": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -793,6 +1228,18 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, + "node_modules/json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -806,6 +1253,34 @@ "node": ">= 0.8.0" } }, + "node_modules/load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/lodash": { "version": "4.17.20", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", @@ -836,6 +1311,12 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -848,6 +1329,96 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/object-inspect": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", + "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.entries": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.3.tgz", + "integrity": "sha512-ym7h7OZebNS96hn5IJeyUmaWhaSM4SVtAPPfNLQEI2MYWCO2egsITb9nab2+i/Pwibx+R0mtn+ltKJXRSeTMGg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1", + "has": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.values": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.3.tgz", + "integrity": "sha512-nkF6PfDB9alkOUxpf1HNm/QlkeW3SReqL5WXeBLpEJJnlPSvRaDQpW3gQTksTN3fgJX4hL42RzKyOin6ff3tyw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.2", + "has": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -874,6 +1445,39 @@ "node": ">= 0.8.0" } }, + "node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -886,6 +1490,27 @@ "node": ">=6" } }, + "node_modules/parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "dependencies": { + "error-ex": "^1.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -904,6 +1529,45 @@ "node": ">=8" } }, + "node_modules/path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "node_modules/path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "dependencies": { + "pify": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "dependencies": { + "find-up": "^2.1.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -931,6 +1595,33 @@ "node": ">=6" } }, + "node_modules/read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "dependencies": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "dependencies": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/regexpp": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", @@ -952,6 +1643,19 @@ "node": ">=0.10.0" } }, + "node_modules/resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "dependencies": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -1057,6 +1761,38 @@ "node": ">=0.10.0" } }, + "node_modules/spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", + "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==", + "dev": true + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -1077,6 +1813,32 @@ "node": ">=8" } }, + "node_modules/string.prototype.trimend": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz", + "integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz", + "integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", @@ -1089,6 +1851,15 @@ "node": ">=8" } }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -1173,6 +1944,18 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, + "node_modules/tsconfig-paths": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", + "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -1209,6 +1992,16 @@ "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", "dev": true }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -1343,6 +2136,12 @@ "strip-json-comments": "^3.1.1" } }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, "acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -1398,6 +2197,30 @@ "sprintf-js": "~1.0.2" } }, + "array-includes": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.3.tgz", + "integrity": "sha512-gcem1KlBU7c9rB+Rq8/3PPKsK2kjqeEBa3bD5kkQo4nYlOHQCJqIJFqBXDEfwaRuYTT4E+FxA9xez7Gf/e3Q7A==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.2", + "get-intrinsic": "^1.1.1", + "is-string": "^1.0.5" + } + }, + "array.prototype.flat": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", + "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1" + } + }, "astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -1426,6 +2249,16 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -1469,6 +2302,18 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "confusing-browser-globals": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz", + "integrity": "sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA==", + "dev": true + }, + "contains-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", + "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "dev": true + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -1495,6 +2340,15 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, "doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -1519,6 +2373,48 @@ "ansi-colors": "^4.1.1" } }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es-abstract": { + "version": "1.18.0-next.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.2.tgz", + "integrity": "sha512-Ih4ZMFHEtZupnUh6497zEL4y2+w8+1ljnCyaTa+adcoafI1GOvMwFlDjBLfWR7y9VLfrjRJe9ocuHY1PSR9jjw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.1", + "object-inspect": "^1.9.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.3", + "string.prototype.trimstart": "^1.0.3" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -1570,6 +2466,119 @@ "v8-compile-cache": "^2.0.3" } }, + "eslint-config-airbnb-base": { + "version": "14.2.1", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz", + "integrity": "sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==", + "dev": true, + "requires": { + "confusing-browser-globals": "^1.0.10", + "object.assign": "^4.1.2", + "object.entries": "^1.1.2" + } + }, + "eslint-import-resolver-node": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz", + "integrity": "sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA==", + "dev": true, + "requires": { + "debug": "^2.6.9", + "resolve": "^1.13.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "eslint-module-utils": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", + "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==", + "dev": true, + "requires": { + "debug": "^2.6.9", + "pkg-dir": "^2.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "eslint-plugin-import": { + "version": "2.22.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", + "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", + "dev": true, + "requires": { + "array-includes": "^3.1.1", + "array.prototype.flat": "^1.2.3", + "contains-path": "^0.1.0", + "debug": "^2.6.9", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.4", + "eslint-module-utils": "^2.6.0", + "has": "^1.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.1", + "read-pkg-up": "^2.0.0", + "resolve": "^1.17.0", + "tsconfig-paths": "^3.9.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -1701,6 +2710,15 @@ "flat-cache": "^3.0.4" } }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, "flat-cache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", @@ -1723,12 +2741,29 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -1761,12 +2796,39 @@ "type-fest": "^0.8.1" } }, + "graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + }, + "hosted-git-info": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "dev": true + }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -1805,6 +2867,33 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-callable": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", + "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==", + "dev": true + }, + "is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -1826,6 +2915,43 @@ "is-extglob": "^2.1.1" } }, + "is-negative-zero": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", + "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "dev": true + }, + "is-regex": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz", + "integrity": "sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-symbols": "^1.0.1" + } + }, + "is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "dev": true + }, + "is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -1860,6 +2986,15 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, "levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -1870,6 +3005,28 @@ "type-check": "~0.4.0" } }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, "lodash": { "version": "4.17.20", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", @@ -1894,6 +3051,12 @@ "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -1906,6 +3069,74 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "object-inspect": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", + "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "object.entries": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.3.tgz", + "integrity": "sha512-ym7h7OZebNS96hn5IJeyUmaWhaSM4SVtAPPfNLQEI2MYWCO2egsITb9nab2+i/Pwibx+R0mtn+ltKJXRSeTMGg==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1", + "has": "^1.0.3" + } + }, + "object.values": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.3.tgz", + "integrity": "sha512-nkF6PfDB9alkOUxpf1HNm/QlkeW3SReqL5WXeBLpEJJnlPSvRaDQpW3gQTksTN3fgJX4hL42RzKyOin6ff3tyw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.2", + "has": "^1.0.3" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -1929,6 +3160,30 @@ "word-wrap": "^1.2.3" } }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -1938,6 +3193,21 @@ "callsites": "^3.0.0" } }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -1950,6 +3220,36 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + } + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -1968,6 +3268,27 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + } + }, "regexpp": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", @@ -1980,6 +3301,16 @@ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -2054,6 +3385,38 @@ } } }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", + "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==", + "dev": true + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -2071,6 +3434,26 @@ "strip-ansi": "^6.0.0" } }, + "string.prototype.trimend": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz", + "integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + } + }, + "string.prototype.trimstart": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz", + "integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + } + }, "strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", @@ -2080,6 +3463,12 @@ "ansi-regex": "^5.0.0" } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -2144,6 +3533,18 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, + "tsconfig-paths": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", + "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + } + }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -2174,6 +3575,16 @@ "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", "dev": true }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 8a9c654..e040392 100644 --- a/package.json +++ b/package.json @@ -39,13 +39,15 @@ "homepage": "https://github.com/Aktanusa/CookieMonster#readme", "devDependencies": { "eslint": "^7.19.0", + "eslint-config-airbnb-base": "^14.2.1", + "eslint-plugin-import": "^2.22.1", "terser": "^5.6.0-beta" }, "ccrepo": { "icon": [ - 10, - 0 + 10, + 0 ], "name": "Cookie Monster" - } + } } diff --git a/src/Cache.js b/src/Cache.js index cc5a0f0..c7d6f40 100644 --- a/src/Cache.js +++ b/src/Cache.js @@ -1,8 +1,8 @@ -/********* +/** * Cache * - *********/ + */ -/******** +/** * Section: General Cache related functions */ /** @@ -10,7 +10,7 @@ * The declaration follows the structure of the CM.Cache.js file * It is called by CM.Main.DelayInit */ -CM.Cache.InitCache = function() { +CM.Cache.InitCache = function () { CM.Cache.CacheDragonAuras(); CM.Cache.CacheWrinklers(); CM.Cache.CacheStats(); @@ -20,11 +20,11 @@ CM.Cache.InitCache = function() { CM.Cache.CacheSeaSpec(); CM.Cache.InitCookiesDiff(); CM.Cache.HeavenlyChipsDiff = new CMAvgQueue(5); // Used by CM.Cache.CacheHeavenlyChipsPS() - CM.Cache.CacheHeavenlyChipsPS + CM.Cache.CacheHeavenlyChipsPS(); CM.Cache.CacheAvgCPS(); CM.Cache.CacheIncome(); CM.Cache.CacheBuildingsPrices(); - CM.Cache.CachePP(); + CM.Cache.CachePP(); }; /** @@ -32,7 +32,7 @@ CM.Cache.InitCache = function() { * It is called by CM.Main.Loop() * @global {string} CM.Cache.TimeTillNextPrestige Time requried till next prestige level */ -CM.Cache.LoopCache = function() { +CM.Cache.LoopCache = function () { // Update Wrinkler Bank CM.Cache.CacheWrinklers(); @@ -41,12 +41,11 @@ CM.Cache.LoopCache = function() { CM.Cache.CacheAvgCPS(); CM.Cache.CacheHeavenlyChipsPS(); - let cookiesToNext = Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + 1) - (Game.cookiesEarned + Game.cookiesReset); + const cookiesToNext = Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + 1) - (Game.cookiesEarned + Game.cookiesReset); CM.Cache.TimeTillNextPrestige = CM.Disp.FormatTime(cookiesToNext / CM.Disp.GetCPS()); }; - -/******** +/** * Section: Helper functions */ /** @@ -63,7 +62,7 @@ class CMAvgQueue { this.queue = []; } - addLatest (newValue) { + addLatest(newValue) { if (this.queue.push(newValue) > this.maxLength) { this.queue.shift(); } @@ -74,7 +73,7 @@ class CMAvgQueue { * @param {number} timePeriod The period in seconds to computer average over * @returns {number} ret The average */ - calcAverage (timePeriod) { + calcAverage(timePeriod) { if (timePeriod > this.maxLength) timePeriod = this.maxLength; if (timePeriod > this.queue.length) timePeriod = this.queue.length; let ret = 0; @@ -85,7 +84,7 @@ class CMAvgQueue { } } -/******** +/** * Section: Functions related to Dragon Auras */ /** @@ -95,12 +94,12 @@ class CMAvgQueue { * @global {number} CM.Cache.dragonAura The number of the first (right) Aura * @global {number} CM.Cache.dragonAura2 The number of the second (left) Aura */ -CM.Cache.CacheDragonAuras = function() { +CM.Cache.CacheDragonAuras = function () { CM.Cache.dragonAura = Game.dragonAura; CM.Cache.dragonAura2 = Game.dragonAura2; }; -/******** +/** * Section: Functions related to Wrinklers */ /** @@ -110,7 +109,7 @@ CM.Cache.CacheDragonAuras = function() { * @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 */ -CM.Cache.CacheWrinklers = function() { +CM.Cache.CacheWrinklers = function () { CM.Cache.WrinklersTotal = 0; CM.Cache.WrinklersNormal = 0; CM.Cache.WrinklersFattest = [0, null]; @@ -118,11 +117,11 @@ CM.Cache.CacheWrinklers = function() { 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 + 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) { - let godLvl = Game.hasGod('scorn'); + const godLvl = Game.hasGod('scorn'); if (godLvl === 1) sucked *= 1.15; else if (godLvl === 2) sucked *= 1.1; else if (godLvl === 3) sucked *= 1.05; @@ -135,7 +134,7 @@ CM.Cache.CacheWrinklers = function() { } }; -/******** +/** * Section: Functions related to Caching stats */ /** @@ -152,10 +151,10 @@ CM.Cache.CacheWrinklers = function() { * @global {number} CM.Cache.Edifice Cookies required for most expensive building through Spontaneous Edifice * @global {string} CM.Cache.EdificeBuilding Name of most expensive building possible with Spontaneous Edifice */ -CM.Cache.CacheStats = function() { +CM.Cache.CacheStats = function () { CM.Cache.Lucky = (CM.Cache.NoGoldSwitchCookiesPS * 900) / 0.15; CM.Cache.Lucky *= CM.Cache.DragonsFortuneMultAdjustment; - let cpsBuffMult = CM.Cache.getCPSBuffMult(); + const 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 * 0.15) + 13; @@ -169,14 +168,14 @@ CM.Cache.CacheStats = function() { CM.Cache.Edifice = 0; let max = 0; let n = 0; - for (let i of Object.keys(Game.Objects)) { + for (const 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].amount < max || n === 1) && - Game.Objects[i].amount < 400 && - Game.Objects[i].price * 2 > CM.Cache.Edifice) { + for (const i of Object.keys(Game.Objects)) { + if ((Game.Objects[i].amount < max || n === 1) + && Game.Objects[i].amount < 400 + && Game.Objects[i].price * 2 > CM.Cache.Edifice) { CM.Cache.Edifice = Game.Objects[i].price * 2; CM.Cache.EdificeBuilding = i; } @@ -191,7 +190,7 @@ CM.Cache.CacheStats = function() { * @param {number} CM.Cache.WrathCookiesMult Multiplier for wrath cookies * @param {number} CM.Cache.DragonsFortuneMultAdjustment Multiplier for dragon fortune + active golden cookie */ -CM.Cache.CacheGoldenAndWrathCookiesMults = function() { +CM.Cache.CacheGoldenAndWrathCookiesMults = function () { if (CM.Footer.isInitzializing) { CM.Cache.GoldenCookiesMult = 1; CM.Cache.WrathCookiesMult = 1; @@ -233,17 +232,16 @@ CM.Cache.CacheGoldenAndWrathCookiesMults = function() { * @param {number} mult Multiplier * @returns [{number, number, number}] Total cookies earned, cookie needed for this and next level */ -CM.Cache.MaxChainCookieReward = function(digit, maxPayout, mult) { +CM.Cache.MaxChainCookieReward = function (digit, maxPayout, mult) { let totalFromChain = 0; let moni = 0; let nextMoni = 0; let nextRequired = 0; 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 * mult)); - // TODO: Calculate Cookies or cps needed for next level of chain. See issue #29 - nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain + 1) * digit * mult), maxPayout * mult)); - nextRequired = Math.floor(1 / 9 * Math.pow(10, chain + 1) * digit * mult); + moni = Math.max(digit, Math.min(Math.floor(1 / 9 * 10 ** chain * digit * mult), maxPayout * mult)); + nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * 10 ** (chain + 1) * digit * mult), maxPayout * mult)); + nextRequired = Math.floor(1 / 9 * 10 ** (chain + 1) * digit * mult); totalFromChain += moni; chain++; } @@ -266,12 +264,12 @@ CM.Cache.MaxChainCookieReward = function(digit, maxPayout, mult) { * @global {number} CM.Cache.ChainFrenzyWrathRequired Cookies needed for maximum reward for wrath frenzy chain * @global {number} CM.Cache.ChainFrenzyWrathRequiredNext Total cookies needed for next level for wrath frenzy chain */ -CM.Cache.CacheChain = function() { +CM.Cache.CacheChain = function () { let maxPayout = CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6 * CM.Cache.DragonsFortuneMultAdjustment; // Removes effect of Frenzy etc. - let cpsBuffMult = CM.Cache.getCPSBuffMult(); + const cpsBuffMult = CM.Cache.getCPSBuffMult(); if (cpsBuffMult > 0) maxPayout /= cpsBuffMult; - else maxPayout = 0; + else maxPayout = 0; CM.Cache.ChainMaxReward = CM.Cache.MaxChainCookieReward(7, maxPayout, CM.Cache.GoldenCookiesMult); CM.Cache.ChainRequired = CM.Cache.ChainMaxReward[1] * 2 / CM.Cache.GoldenCookiesMult; @@ -297,32 +295,32 @@ CM.Cache.CacheChain = function() { * @global {string} CM.Cache.MissingUpgradesCookies String containig the HTML to create the "crates" for missing cookie upgrades * @global {string} CM.Cache.MissingUpgradesPrestige String containig the HTML to create the "crates" for missing prestige upgrades */ -CM.Cache.CacheMissingUpgrades = function() { - CM.Cache.MissingUpgrades = ""; - CM.Cache.MissingUpgradesCookies = ""; - CM.Cache.MissingUpgradesPrestige = ""; - let list = []; - //sort the upgrades - for (let i of Object.keys(Game.Upgrades)) { +CM.Cache.CacheMissingUpgrades = function () { + CM.Cache.MissingUpgrades = ''; + CM.Cache.MissingUpgradesCookies = ''; + CM.Cache.MissingUpgradesPrestige = ''; + const list = []; + // sort the upgrades + for (const 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.order b.order) return 1; + else if (a.order < b.order) return -1; + return 0; }; list.sort(sortMap); - for (let i of Object.keys(list)) { - let me = list[i]; - + for (const i of Object.keys(list)) { + const me = list[i]; + if (me.bought === 0) { let str = ''; str += CM.Disp.crateMissing(me); if (me.pool === 'prestige') CM.Cache.MissingUpgradesPrestige += str; else if (me.pool === 'cookie') CM.Cache.MissingUpgradesCookies += str; - else if (me.pool != 'toggle' && me.pool != 'unused' && me.pool != 'debug') CM.Cache.MissingUpgrades += str; + else if (me.pool !== 'toggle' && me.pool !== 'unused' && me.pool !== 'debug') CM.Cache.MissingUpgrades += str; } } }; @@ -332,7 +330,7 @@ CM.Cache.CacheMissingUpgrades = function() { * It is called by CM.Main.Loop() and CM.Cache.InitCache() * @global {number} CM.Cache.SeaSpec The reward for popping a reindeer */ -CM.Cache.CacheSeaSpec = function() { +CM.Cache.CacheSeaSpec = function () { if (Game.season === 'christmas') { let val = Game.cookiesPs * 60; if (Game.hasBuff('Elder frenzy')) val *= 0.5; @@ -347,39 +345,39 @@ CM.Cache.CacheSeaSpec = function() { * It is called by CM.Cache.LoopCache() * @global {number} CM.Cache.HCPerSecond The Heavenly Chips per second in the last five seconds */ -CM.Cache.CacheHeavenlyChipsPS = function() { +CM.Cache.CacheHeavenlyChipsPS = function () { CM.Cache.HCPerSecond = 0; // Mainly there to not throw errors during initialization - let currDate = Math.floor(Date.now() / 1000); + const currDate = Math.floor(Date.now() / 1000); // Only calculate every new second if ((Game.T / Game.fps) % 1 === 0) { - let chipsOwned = Game.HowMuchPrestige(Game.cookiesReset); - let ascendNowToOwn = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); - let ascendNowToGet = ascendNowToOwn - Math.floor(chipsOwned); - + const chipsOwned = Game.HowMuchPrestige(Game.cookiesReset); + const ascendNowToOwn = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); + const ascendNowToGet = ascendNowToOwn - Math.floor(chipsOwned); + // Add recent gains to AvgQueue's - let timeDiff = currDate - CM.Cache.lastHeavenlyCheck; - let heavenlyChipsDiffAvg = Math.max(0, (ascendNowToGet - CM.Cache.lastHeavenlyChips)) / timeDiff; + const timeDiff = currDate - CM.Cache.lastHeavenlyCheck; + const heavenlyChipsDiffAvg = Math.max(0, (ascendNowToGet - CM.Cache.lastHeavenlyChips)) / timeDiff; for (let i = 0; i < timeDiff; i++) { CM.Cache.HeavenlyChipsDiff.addLatest(heavenlyChipsDiffAvg); } - // Store current data for next loop + // Store current data for next loop CM.Cache.lastHeavenlyCheck = currDate; CM.Cache.lastHeavenlyChips = ascendNowToGet; // Get average gain over period of 5 seconds CM.Cache.HCPerSecond = CM.Cache.HeavenlyChipsDiff.calcAverage(5); } -} +}; -/******** +/** * Section: Functions related to caching CPS */ /** * This functions caches creates the CMAvgQueue used by CM.Cache.CacheAvgCPS() to calculate CPS * Called by CM.Cache.InitCache() */ -CM.Cache.InitCookiesDiff = function() { +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]); @@ -395,8 +393,8 @@ CM.Cache.InitCookiesDiff = function() { * @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() { - let currDate = Math.floor(Date.now() / 1000); +CM.Cache.CacheAvgCPS = function () { + const currDate = Math.floor(Date.now() / 1000); // Only calculate every new second if ((Game.T / Game.fps) % 1 === 0) { let choEggTotal = Game.cookies + CM.Cache.SellForChoEgg; @@ -405,12 +403,12 @@ CM.Cache.CacheAvgCPS = function() { choEggTotal *= 0.05; // Add recent gains to AvgQueue's - let timeDiff = currDate - CM.Cache.lastCPSCheck; - 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; + const timeDiff = currDate - CM.Cache.lastCPSCheck; + const bankDiffAvg = Math.max(0, (Game.cookies - CM.Cache.lastCookies)) / timeDiff; + const wrinkDiffAvg = Math.max(0, (CM.Cache.WrinklersTotal - CM.Cache.lastWrinkCookies)) / timeDiff; + const wrinkFattestDiffAvg = Math.max(0, (CM.Cache.WrinklersFattest[0] - CM.Cache.lastWrinkFattestCookies)) / timeDiff; + const choEggDiffAvg = Math.max(0, (choEggTotal - CM.Cache.lastChoEgg)) / timeDiff; + const clicksDiffAvg = (Game.cookieClicks - CM.Cache.lastClicks) / timeDiff; for (let i = 0; i < timeDiff; i++) { CM.Cache.CookiesDiff.addLatest(bankDiffAvg); CM.Cache.WrinkDiff.addLatest(wrinkDiffAvg); @@ -419,7 +417,7 @@ CM.Cache.CacheAvgCPS = function() { CM.Cache.ClicksDiff.addLatest(clicksDiffAvg); } - // Store current data for next loop + // Store current data for next loop CM.Cache.lastCPSCheck = currDate; CM.Cache.lastCookies = Game.cookies; CM.Cache.lastWrinkCookies = CM.Cache.WrinklersTotal; @@ -428,7 +426,7 @@ CM.Cache.CacheAvgCPS = function() { CM.Cache.lastClicks = Game.cookieClicks; // Get average gain over period of cpsLength seconds - let cpsLength = CM.Disp.cookieTimes[CM.Options.AvgCPSHist]; + const 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); @@ -437,14 +435,13 @@ CM.Cache.CacheAvgCPS = function() { if (CM.Options.CalcWrink === 1) CM.Cache.AvgCPS += CM.Cache.AverageGainWrink; if (CM.Options.CalcWrink === 2) CM.Cache.AvgCPS += CM.Cache.AverageGainWrinkFattest; - let choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); + const 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); - } - else CM.Cache.AvgCPSWithChoEgg = CM.Cache.AvgCPS; + } else CM.Cache.AvgCPSWithChoEgg = CM.Cache.AvgCPS; - CM.Cache.AverageClicks = CM.Cache.ClicksDiff.calcAverage(CM.Disp.clickTimes[CM.Options.AvgClicksHist]); + CM.Cache.AverageClicks = CM.Cache.ClicksDiff.calcAverage(CM.Disp.clickTimes[CM.Options.AvgClicksHist]); } }; @@ -453,14 +450,14 @@ CM.Cache.CacheAvgCPS = function() { * It is called by CM.Main.Loop() * @global {number} CM.Cache.SellForChoEgg Total cookies to be gained from selling Chocolate egg */ -CM.Cache.CacheSellForChoEgg = function() { +CM.Cache.CacheSellForChoEgg = function () { let sellTotal = 0; // Compute cookies earned by selling stock market goods if (Game.Objects.Bank.minigameLoaded) { - let marketGoods = Game.Objects.Bank.minigame.goods; + const marketGoods = Game.Objects.Bank.minigame.goods; let goodsVal = 0; - for (let i of Object.keys(marketGoods)) { - let marketGood = marketGoods[i]; + for (const i of Object.keys(marketGoods)) { + const marketGood = marketGoods[i]; goodsVal += marketGood.stock * marketGood.val; } sellTotal += goodsVal * Game.cookiesPsRawHighest; @@ -476,15 +473,15 @@ CM.Cache.CacheSellForChoEgg = function() { * @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) */ -CM.Cache.CacheCurrWrinklerCPS = function() { +CM.Cache.CacheCurrWrinklerCPS = function () { CM.Cache.CurrWrinklerCPSMult = 0; let count = 0; - for (let i in Game.wrinklers) { + for (const i in Game.wrinklers) { if (Game.wrinklers[i].phase === 2) count++; } let godMult = 1; if (CM.Sim.Objects.Temple.minigameLoaded) { - let godLvl = Game.hasGod('scorn'); + const godLvl = Game.hasGod('scorn'); if (godLvl === 1) godMult *= 1.15; else if (godLvl === 2) godMult *= 1.1; else if (godLvl === 3) godMult *= 1.05; @@ -498,10 +495,10 @@ CM.Cache.CacheCurrWrinklerCPS = function() { * It is called by CM.Sim.CalculateGains(), CM.Disp.UpdateTooltipWarnings(), CM.Cache.CacheStats() and CM.Cache.CacheChain() * @returns {number} mult The multiplier */ -CM.Cache.getCPSBuffMult = function() { +CM.Cache.getCPSBuffMult = function () { let mult = 1; - for (let i of Object.keys(Game.buffs)) { - if (typeof Game.buffs[i].multCpS != 'undefined') mult *= Game.buffs[i].multCpS; + for (const i of Object.keys(Game.buffs)) { + if (typeof Game.buffs[i].multCpS !== 'undefined') mult *= Game.buffs[i].multCpS; } return mult; }; @@ -511,14 +508,13 @@ CM.Cache.getCPSBuffMult = function() { * If so it CM.Sim.Win()'s them and the caller function will know to recall CM.Sim.CalculateGains() * It is called at the end of any functions that simulates certain behaviour */ -CM.Cache.NoGoldSwitchCPS = function() { +CM.Cache.NoGoldSwitchCPS = function () { if (Game.Has('Golden switch [off]')) { CM.Cache.NoGoldSwitchCookiesPS = CM.Sim.NoGoldSwitchCPS(); - } - else CM.Cache.NoGoldSwitchCookiesPS = Game.cookiesPs; + } else CM.Cache.NoGoldSwitchCookiesPS = Game.cookiesPs; }; -/******** +/** * Section: Functions related to "Specials" (Dragon and Santa) */ /** @@ -527,48 +523,45 @@ CM.Cache.NoGoldSwitchCPS = function() { * @global {number} CM.Cache.lastDragonLevel The last cached dragon level * @global {string} CM.Cache.CostDragonUpgrade The Beautified cost of the next upgrade */ -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")) { +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')) { 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("'", ""); + const amount = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/sacrifice\((.*?)\)/)[1]; + if (target !== 'i') { + target = target.replaceAll("'", ''); if (Game.Objects[target].amount < amount) { - CM.Cache.CostDragonUpgrade = "Not enough buildings to sell"; - } - else { + CM.Cache.CostDragonUpgrade = 'Not enough buildings to sell'; + } else { let cost = 0; CM.Sim.CopyData(); for (let i = 0; i < amount; i++) { - let price = CM.Sim.Objects[target].basePrice * Math.pow(Game.priceIncrease, Math.max(0, CM.Sim.Objects[target].amount - 1 - CM.Sim.Objects[target].free)); + let price = CM.Sim.Objects[target].basePrice * Game.priceIncrease ** Math.max(0, CM.Sim.Objects[target].amount - 1 - CM.Sim.Objects[target].free); price = Game.modifyBuildingPrice(CM.Sim.Objects[target], price); price = Math.ceil(price); cost += price; CM.Sim.Objects[target].amount--; } - CM.Cache.CostDragonUpgrade = "Cost to rebuy: " + CM.Disp.Beautify(cost); + CM.Cache.CostDragonUpgrade = `Cost to rebuy: ${CM.Disp.Beautify(cost)}`; } - } - else { + } else { let cost = 0; CM.Sim.CopyData(); - for (let j of Object.keys(Game.Objects)) { + for (const j of Object.keys(Game.Objects)) { target = j; if (Game.Objects[target].amount < amount) { - CM.Cache.CostDragonUpgrade = "Not enough buildings to sell"; + CM.Cache.CostDragonUpgrade = 'Not enough buildings to sell'; break; - } - else { + } else { for (let i = 0; i < amount; i++) { - let price = CM.Sim.Objects[target].basePrice * Math.pow(Game.priceIncrease, Math.max(0, CM.Sim.Objects[target].amount - 1 - CM.Sim.Objects[target].free)); + let price = CM.Sim.Objects[target].basePrice * Game.priceIncrease ** Math.max(0, CM.Sim.Objects[target].amount - 1 - CM.Sim.Objects[target].free); price = Game.modifyBuildingPrice(CM.Sim.Objects[target], price); price = Math.ceil(price); cost += price; CM.Sim.Objects[target].amount--; } } - CM.Cache.CostDragonUpgrade = "Cost to rebuy: " + CM.Disp.Beautify(cost); + CM.Cache.CostDragonUpgrade = `Cost to rebuy: ${CM.Disp.Beautify(cost)}`; } } } @@ -576,14 +569,14 @@ CM.Cache.CacheDragonCost = function() { } }; -/******** +/** * Section: Functions related to caching income */ /** * This functions caches the income gain of each building and upgrade and stores it in the cache * It is called by CM.Main.Loop() and CM.Cache.InitCache() */ -CM.Cache.CacheIncome = function() { +CM.Cache.CacheIncome = function () { // Simulate Building Buys for 1, 10 and 100 amount CM.Cache.CacheBuildingIncome(1, 'Objects1'); CM.Cache.CacheBuildingIncome(10, 'Objects10'); @@ -599,54 +592,54 @@ CM.Cache.CacheIncome = function() { * @param {amount} amount Amount to be bought * @parem {string} target The target Cache object ("Objects1", "Objects10" or "Objects100") */ -CM.Cache.CacheBuildingIncome = function(amount, target) { +CM.Cache.CacheBuildingIncome = function (amount, target) { CM.Cache[target] = []; - for (let i of Object.keys(Game.Objects)) { + for (const i of Object.keys(Game.Objects)) { CM.Cache[target][i] = {}; CM.Cache[target][i].bonus = CM.Sim.BuyBuildingsBonusIncome(i, amount); - if (amount != 1) { + if (amount !== 1) { CM.Cache.DoRemakeBuildPrices = 1; } } -} +}; /** * This functions starts the calculation/simulation of the bonus income of upgrades * It is called by CM.Cache.CacheIncome() */ -CM.Cache.CacheUpgradeIncome = function() { +CM.Cache.CacheUpgradeIncome = function () { CM.Cache.Upgrades = []; - for (let i of Object.keys(Game.Upgrades)) { - let bonusIncome = CM.Sim.BuyUpgradesBonusIncome(i); + for (const i of Object.keys(Game.Upgrades)) { + const bonusIncome = CM.Sim.BuyUpgradesBonusIncome(i); CM.Cache.Upgrades[i] = {}; if (bonusIncome[0]) CM.Cache.Upgrades[i].bonus = bonusIncome[0]; if (bonusIncome[1]) CM.Cache.Upgrades[i].bonusMouse = bonusIncome[1]; } -} +}; -/******** +/** * Section: Functions related to caching prices */ /** * This functions caches the price of each building and stores it in the cache * It is called by CM.Main.Loop() and CM.Cache.InitCache() */ -CM.Cache.CacheBuildingsPrices = function() { - for (let i of Object.keys(Game.Objects)) { +CM.Cache.CacheBuildingsPrices = function () { + for (const i of Object.keys(Game.Objects)) { CM.Cache.Objects1[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 1); CM.Cache.Objects10[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 10); CM.Cache.Objects100[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 100); } }; -/******** +/** * Section: Functions related to caching PP */ /** * This functions caches the PP of each building and upgrade and stores it in the cache * It is called by CM.Cache.LoopCache() and CM.Cache.InitCache() */ -CM.Cache.CachePP = function() { +CM.Cache.CachePP = function () { CM.Cache.CacheBuildingsPP(); CM.Cache.CacheUpgradePP(); }; @@ -658,7 +651,7 @@ CM.Cache.CachePP = function() { * @params {number} price The price of the object * @returns {string} color The colour assosciated with the pp value */ -CM.Cache.ColourOfPP = function(me, price) { +CM.Cache.ColourOfPP = function (me, price) { let color = ''; // Colour based on PP if (me.pp <= 0 || me.pp === Infinity) color = CM.Disp.colorGray; @@ -671,28 +664,28 @@ CM.Cache.ColourOfPP = function(me, price) { // Colour based on price in terms of CPS if (Number(CM.Options.PPSecondsLowerLimit) !== 0) { - if (price / CM.Disp.GetCPS() < Number(CM.Options.PPSecondsLowerLimit)) color = CM.Disp.colorBlue + if (price / CM.Disp.GetCPS() < Number(CM.Options.PPSecondsLowerLimit)) color = CM.Disp.colorBlue; } // Colour based on being able to purchase if (CM.Options.PPOnlyConsiderBuyable) { if (price - Game.cookies > 0) color = CM.Disp.colorRed; } - return color + return color; }; /** * This functions caches the PP of each building it saves all date in CM.Cache.Objects... * It is called by CM.Cache.CachePP() */ -CM.Cache.CacheBuildingsPP = function() { +CM.Cache.CacheBuildingsPP = function () { CM.Cache.min = Infinity; CM.Cache.max = 1; CM.Cache.ArrayOfPPs = []; - if (typeof CM.Options.PPExcludeTop === "undefined") CM.Options.PPExcludeTop = 0; // Otherwise breaks during initialization + if (typeof CM.Options.PPExcludeTop === 'undefined') CM.Options.PPExcludeTop = 0; // Otherwise breaks during initialization // Calculate PP and colors when compared to purchase of optimal building in single-purchase mode if (CM.Options.ColorPPBulkMode === 0) { - for (let i of Object.keys(CM.Cache.Objects1)) { + for (const i of Object.keys(CM.Cache.Objects1)) { if (Game.cookiesPs) { CM.Cache.Objects1[i].pp = (Math.max(Game.Objects[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus); } else CM.Cache.Objects1[i].pp = (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus); @@ -705,13 +698,13 @@ CM.Cache.CacheBuildingsPP = function() { if (CM.Cache.ArrayOfPPs.length === 1) { break; } - CM.Cache.ArrayOfPPs.shift() + CM.Cache.ArrayOfPPs.shift(); } } CM.Cache.min = CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop][0]; CM.Cache.max = CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length - 1][0]; CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min; - for (let i of Object.keys(CM.Cache.Objects1)) { + for (const i of Object.keys(CM.Cache.Objects1)) { CM.Cache.Objects1[i].color = CM.Cache.ColourOfPP(CM.Cache.Objects1[i], Game.Objects[i].getPrice()); // Colour based on excluding certain top-buildings for (let j = 0; j < CM.Options.PPExcludeTop; j++) { @@ -721,15 +714,14 @@ CM.Cache.CacheBuildingsPP = function() { // Calculate PP of bulk-buy modes CM.Cache.CacheBuildingsBulkPP('Objects10'); CM.Cache.CacheBuildingsBulkPP('Objects100'); - } - // Calculate PP and colors when compared to purchase of selected bulk mode - else { - let target = `Objects${Game.buyBulk}` - for (let i of Object.keys(CM.Cache[target])) { + } else { + // Calculate PP and colors when compared to purchase of selected bulk mode + const target = `Objects${Game.buyBulk}`; + for (const 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.Cache[target][i].pp = (Game.Objects[i].bulkPrice / CM.Cache[target][i].bonus); - CM.Cache.ArrayOfPPs.push([CM.Cache[target][i].pp, Game.Objects[i].bulkPrice]) + CM.Cache.ArrayOfPPs.push([CM.Cache[target][i].pp, Game.Objects[i].bulkPrice]); } // Set CM.Cache.min to best non-excluded buidliung CM.Cache.ArrayOfPPs.sort((a, b) => a[0] - b[0]); @@ -738,14 +730,14 @@ CM.Cache.CacheBuildingsPP = function() { if (CM.Cache.ArrayOfPPs.length === 1) { break; } - CM.Cache.ArrayOfPPs.shift() + CM.Cache.ArrayOfPPs.shift(); } } CM.Cache.min = CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop][0]; CM.Cache.max = CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length - 1][0]; CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min; - for (let i of Object.keys(CM.Cache.Objects1)) { + for (const i of Object.keys(CM.Cache.Objects1)) { CM.Cache[target][i].color = CM.Cache.ColourOfPP(CM.Cache[target][i], Game.Objects[i].bulkPrice); // Colour based on excluding certain top-buildings for (let j = 0; j < CM.Options.PPExcludeTop; j++) { @@ -760,8 +752,8 @@ CM.Cache.CacheBuildingsPP = function() { * It saves all date in CM.Cache.Objects... * It is called by CM.Cache.CacheBuildingsPP() */ -CM.Cache.CacheBuildingsBulkPP = function(target) { - for (let i of Object.keys(CM.Cache[target])) { +CM.Cache.CacheBuildingsBulkPP = function (target) { + for (const 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); @@ -774,18 +766,18 @@ CM.Cache.CacheBuildingsBulkPP = function(target) { * This functions caches the PP of each building it saves all date in CM.Cache.Upgrades * It is called by CM.Cache.CachePP() */ -CM.Cache.CacheUpgradePP = function() { - for (let i of Object.keys(CM.Cache.Upgrades)) { +CM.Cache.CacheUpgradePP = function () { + for (const 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; + if (Number.isNaN(CM.Cache.Upgrades[i].pp)) CM.Cache.Upgrades[i].pp = Infinity; CM.Cache.Upgrades[i].color = CM.Cache.ColourOfPP(CM.Cache.Upgrades[i], Game.Upgrades[i].getPrice()); } }; -/******** +/** * Section: Cached variables */ /** diff --git a/src/Config.js b/src/Config.js index ddf3484..4ddf0bb 100644 --- a/src/Config.js +++ b/src/Config.js @@ -1,22 +1,22 @@ -/********** +/** * Config * - **********/ + */ -/******** +/** * Section: Functions related to saving, loading and restoring configs */ /** * This function saves the config of CookieMonster without saving any of the other save-data * This allows saving in between the autosave intervals - * It is called by CM.Config.LoadConfig(), CM.Config.RestoreDefault(), CM.Config.ToggleConfig(), + * It is called by CM.Config.LoadConfig(), CM.Config.RestoreDefault(), CM.Config.ToggleConfig(), * CM.ToggleConfigVolume() and changes in options with type "url", "color" or "numscale" */ -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.SaveConfig = function () { + const saveString = b64_to_utf8(unescape(localStorage.getItem('CookieClickerGame')).split('!END!')[0]); + const CookieMonsterSave = saveString.match(/CookieMonster.*(;|$)/); + if (CookieMonsterSave !== null) { + const newSaveString = saveString.replace(CookieMonsterSave[0], `CookieMonster:${CM.save()}`); + localStorage.setItem('CookieClickerGame', escape(`${utf8_to_b64(newSaveString)}!END!`)); } }; @@ -24,46 +24,40 @@ CM.Config.SaveConfig = function() { * This function loads the config of CookieMonster saved in localStorage and loads it into CM.Options * It is called by CM.Main.DelayInit() and CM.Config.RestoreDefault() */ -CM.Config.LoadConfig = function(settings) { +CM.Config.LoadConfig = function (settings) { // This removes cookies left from earlier versions of CookieMonster - if (typeof localStorage.CMConfig != "undefined") { + if (typeof localStorage.CMConfig !== 'undefined') { delete localStorage.CMConfig; } - if (settings != null) { + if (settings !== undefined) { CM.Options = settings; // Check values let mod = false; - for (let i in CM.Data.ConfigDefault) { + for (const 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') { + } else if (i !== 'Header' && i !== 'Colors') { if (i.indexOf('SoundURL') === -1) { if (!(CM.Options[i] > -1 && CM.Options[i] < CM.Data.Config[i].label.length)) { mod = true; CM.Options[i] = CM.Data.ConfigDefault[i]; } + } else if (typeof CM.Options[i] !== 'string') { // Sound URLs + mod = true; + CM.Options[i] = CM.Data.ConfigDefault[i]; } - else { // Sound URLs - if (typeof CM.Options[i] != 'string') { - mod = true; - CM.Options[i] = CM.Data.ConfigDefault[i]; - } - } - } - else if (i === 'Header') { - for (let j in CM.Data.ConfigDefault.Header) { + } else if (i === 'Header') { + for (const j in CM.Data.ConfigDefault.Header) { if (typeof CM.Options[i][j] === 'undefined' || !(CM.Options[i][j] > -1 && CM.Options[i][j] < 2)) { mod = true; CM.Options[i][j] = CM.Data.ConfigDefault[i][j]; } } - } - else { // Colors - for (let j in CM.Data.ConfigDefault.Colors) { - if (typeof CM.Options[i][j] === 'undefined' || typeof CM.Options[i][j] != 'string') { + } else { // Colors + for (const 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]; } @@ -72,13 +66,12 @@ CM.Config.LoadConfig = function(settings) { } if (mod) CM.Config.SaveConfig(); CM.Main.Loop(); // Do loop once - for (let i in CM.Data.ConfigDefault) { - if (i != 'Header' && typeof CM.Data.Config[i].func !== 'undefined') { + for (const i in CM.Data.ConfigDefault) { + if (i !== 'Header' && typeof CM.Data.Config[i].func !== 'undefined') { CM.Data.Config[i].func(); } } - } - else { // Default values + } else { // Default values CM.Config.RestoreDefault(); } }; @@ -87,13 +80,13 @@ CM.Config.LoadConfig = function(settings) { * This function reloads and resaves the default config as stored in CM.Data.ConfigDefault * It is called by resDefBut.onclick loaded in the options page or by CM.Config.LoadConfig if no localStorage is found */ -CM.Config.RestoreDefault = function() { +CM.Config.RestoreDefault = function () { CM.Config.LoadConfig(CM.Data.ConfigDefault); CM.Config.SaveConfig(); Game.UpdateMenu(); }; -/******** +/** * Section: Functions related to toggling or changing configs */ /** @@ -101,14 +94,13 @@ CM.Config.RestoreDefault = function() { * It is called by the onclick event of options of the "bool" type * @param {string} config The name of the option */ -CM.Config.ToggleConfig = function(config) { +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'; + } else l(CM.Config.ConfigPrefix + config).className = 'option'; if (typeof CM.Data.Config[config].func !== 'undefined') { CM.Data.Config[config].func(); @@ -123,11 +115,11 @@ CM.Config.ToggleConfig = function(config) { * It is called by the oninput and onchange event of "vol" type options * @param {string} config The name of the option */ -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.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(); }; @@ -136,13 +128,13 @@ CM.Config.ToggleConfigVolume = function(config) { * It is called by the onclick event of the +/- next to headers * @param {string} config The name of the header */ -CM.Config.ToggleHeader = function(config) { +CM.Config.ToggleHeader = function (config) { CM.Options.Header[config]++; if (CM.Options.Header[config] > 1) CM.Options.Header[config] = 0; CM.Config.SaveConfig(); }; -/******** +/** * Section: Functions related to notifications */ /** @@ -151,13 +143,13 @@ CM.Config.ToggleHeader = function(config) { * Note that most browsers will stop asking if the user has ignored the prompt around 6 times * @param {number} ToggleOnOff A number indicating whether the option has been turned off (0) or on (1) */ -CM.Config.CheckNotificationPermissions = function(ToggleOnOff) { +CM.Config.CheckNotificationPermissions = function (ToggleOnOff) { if (ToggleOnOff === 1) { // Check if browser support Promise version of Notification Permissions - let checkNotificationPromise = function () { + const checkNotificationPromise = function () { try { Notification.requestPermission().then(); - } catch(e) { + } catch (e) { return false; } return true; @@ -165,20 +157,16 @@ CM.Config.CheckNotificationPermissions = function(ToggleOnOff) { // Check if the browser supports notifications and which type if (!('Notification' in window)) { - console.log("This browser does not support notifications."); - } - else { - if(checkNotificationPromise()) { - Notification.requestPermission().then(); - } - else { - Notification.requestPermission(); - } + console.log('This browser does not support notifications.'); + } else if (checkNotificationPromise()) { + Notification.requestPermission().then(); + } else { + Notification.requestPermission(); } } }; -/******** +/** * Section: Variables used in Config functions */ /** diff --git a/src/Data.js b/src/Data.js index bb87751..2bd27d6 100644 --- a/src/Data.js +++ b/src/Data.js @@ -1,109 +1,109 @@ -/******** +/** * Data * - ********/ + */ -/******** +/** * Section: Data used in the stats page to show not yet purchased updates. See CM.Disp.CreateStatsMissDisp() */ 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' + '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']; -/******** +/** * Section: All possible effects plants and other items can have with an explanation */ 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" + 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', }; -/******** +/** * Section: Data for the various scales used by CookieMonster */ 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.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']; -/******** +/** * Section: Two array's containing all Config groups and their to-be displayed title */ CM.Data.ConfigGroups = { - BarsColors: "Bars/Colors", - Calculation: "Calculation", - Notification: "Notification", - Tooltip: "Tooltips and additional insights", - Statistics: "Statistics", - Notation: "Notation", - Miscellaneous: "Miscellaneous" + 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", + NotificationGeneral: 'General Notifications', + NotificationGC: 'Golden Cookie', + NotificationFC: 'Fortune Cookie', + NotificationSea: 'Season Special', + NotificationGard: 'Garden Tick', + NotificationMagi: 'Full Magic Bar', + NotificationWrink: 'Wrinkler', + NotificationWrinkMax: 'Maximum Wrinklers', }; -/******** +/** * Section: An array (CM.Data.Config) containing all Config options and an array of default settings */ /** @@ -117,140 +117,313 @@ CM.Data.ConfigGroupsNotification = { * @item {function} func A function to be called when the option is toggled */ // Barscolors -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.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.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.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.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();}}; // Calculation -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.ColorPPBulkMode = {type: 'bool', group: 'Calculation', 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, func: function () {CM.Cache.CachePP();}}; -CM.Data.Config.PPExcludeTop = {type: 'bool', group: 'Calculation', label: ["Don't Ignore Any", 'Ignore 1st Best', 'Ignore 1st and 2nd Best', 'Ignore 1st, 2nd and 3rd Best'], desc: 'Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values', toggle: true}; -CM.Data.Config.PPSecondsLowerLimit = {type: 'numscale', group: 'Calculation', label: 'Lower limit for PP (in seconds): ', desc: 'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option', min: 0, max: Infinity}; -CM.Data.Config.PPOnlyConsiderBuyable = {type: 'bool', group: 'Calculation', label: ["Don't Ignore Non-Buyable", 'Ignore Non-Buyable'], desc: "Makes CookieMonster label buildings and upgrades you can't buy right now red, useful in those situations where you just want to spend your full bank 'most optimally'", toggle: true}; -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.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.ColorPPBulkMode = { + type: 'bool', group: 'Calculation', 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, func: function () { CM.Cache.CachePP(); }, +}; +CM.Data.Config.PPExcludeTop = { + type: 'bool', group: 'Calculation', label: ["Don't Ignore Any", 'Ignore 1st Best', 'Ignore 1st and 2nd Best', 'Ignore 1st, 2nd and 3rd Best'], desc: 'Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values', toggle: true, +}; +CM.Data.Config.PPSecondsLowerLimit = { + type: 'numscale', group: 'Calculation', label: 'Lower limit for PP (in seconds): ', desc: 'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option', min: 0, max: Infinity, +}; +CM.Data.Config.PPOnlyConsiderBuyable = { + type: 'bool', group: 'Calculation', label: ["Don't Ignore Non-Buyable", 'Ignore Non-Buyable'], desc: "Makes CookieMonster label buildings and upgrades you can't buy right now red, useful in those situations where you just want to spend your full bank 'most optimally'", toggle: true, +}; +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, +}; // Notification -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'}; +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.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'}; +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.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'}; +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.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'}; +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.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'}; +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.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'}; +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.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'}; +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.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.WrinklerMaxSoundURL = { + type: 'url', group: 'NotificationWrinkMax', label: 'Sound URL:', desc: 'URL of the sound to be played when the maximum amount of Wrinklers has appeared', +}; // Tooltip -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.ToolWarnUser = {type: 'numscale', group: 'Tooltip', label: 'Tooltip Warning At x times CPS: ', desc: 'Use this to show a customized warning if buying it will put the bank under the amount equal to value times cps; setting to 0 disables the function altogether', min: 0, max: Infinity}; -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 Extra Info Ascend Tooltip OFF', 'Show Extra Info Ascend Tooltip ON'], desc: 'Shows additional info in the ascend tooltip', toggle: true}; +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.ToolWarnUser = { + type: 'numscale', group: 'Tooltip', label: 'Tooltip Warning At x times CPS: ', desc: 'Use this to show a customized warning if buying it will put the bank under the amount equal to value times cps; setting to 0 disables the function altogether', min: 0, max: Infinity, +}; +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 Extra Info Ascend Tooltip OFF', 'Show Extra Info Ascend Tooltip ON'], desc: 'Shows additional info in the ascend tooltip', toggle: true, +}; // Statistics -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.HeavenlyChipsTarget = {type: 'numscale', group: 'Statistics', label: 'Heavenly Chips Target: ', desc: 'Use this to set a Heavenly Chips target that will be counted towards in the "prestige" statsistics sections', min: 1, max: Infinity}; -CM.Data.Config.ShowMissedGC = {type: 'bool', group: 'Statistics', label: ['Missed GC OFF', 'Missed GC ON'], desc: 'Show a stat in the statistics screen that counts how many Golden Cookies you have missed', 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.HeavenlyChipsTarget = { + type: 'numscale', group: 'Statistics', label: 'Heavenly Chips Target: ', desc: 'Use this to set a Heavenly Chips target that will be counted towards in the "prestige" statsistics sections', min: 1, max: Infinity, +}; +CM.Data.Config.ShowMissedGC = { + type: 'bool', group: 'Statistics', label: ['Missed GC OFF', 'Missed GC ON'], desc: 'Show a stat in the statistics screen that counts how many Golden Cookies you have missed', toggle: true, +}; // Notation -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.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, +}; // Miscellaneous -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.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, +}; /** * This array describes all default settings @@ -319,7 +492,7 @@ CM.Data.ConfigDefault = { ToolWarnEdifice: 1, ToolWarnUser: 0, ToolWarnPos: 1, - TooltipGrim:1, + TooltipGrim: 1, TooltipWrink: 1, TooltipLump: 1, TooltipPlots: 1, @@ -337,14 +510,18 @@ CM.Data.ConfigDefault = { 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'}, + 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, Chain: 1, Spells: 1, Garden: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1, InfoTab: 1}, + 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, Chain: 1, Spells: 1, Garden: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1, InfoTab: 1, + }, }; /** @@ -357,7 +534,7 @@ offers a wide range of tools and statistics to enhance your game experience. It is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.
Progess on new updates and all previous release notes can be found on the GitHub page linked above! -` +`; CM.Data.LatestReleaseNotes = `
The latest update (v 2.031.4) has introduced the following features:
@@ -388,4 +565,4 @@ CM.Data.LatestReleaseNotes = `
- The Timer bar will now disappear correctly when the Golden Switch has been activated
- Fixed errors in the calculation of the Chain Cookies and Wrinkler stats
-` \ No newline at end of file +`; diff --git a/src/Disp.js b/src/Disp.js index 82e51b2..730d39a 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1,35 +1,36 @@ -/******** +/** * Disp * - ********/ + */ -/******** +/** * Please make sure to annotate your code correctly using JSDoc. - * Only put functions related to graphics and displays in this file. + * Only put functions related to graphics and displays in this file. * All calculations and data should preferrably be put in other files. */ -/******** +/** * Section: Auxilirary functions used by other functions */ /** - * This function returns the total amount stored in the Wrinkler Bank + * This function returns the total amount stored in the Wrinkler Bank * as calculated by CM.Cache.CacheWrinklers() if CM.Options.CalcWrink is set * @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinklersTotal) */ -CM.Disp.GetWrinkConfigBank = function() { +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;} + return CM.Cache.WrinklersTotal; + } else if (CM.Options.CalcWrink === 2) { + return CM.Cache.WrinklersFattest[0]; + } else { + return 0; + } }; /** - * This function pops all normal wrinklers + * This function pops all normal wrinklers * It is called by a click of the 'pop all' button created by CM.Disp.AddMenuStats() */ -CM.Disp.PopAllNormalWrinklers = function() { - for (let i of Object.keys(Game.wrinklers)) { +CM.Disp.PopAllNormalWrinklers = function () { + for (const i of Object.keys(Game.wrinklers)) { if (Game.wrinklers[i].sucked > 0 && Game.wrinklers[i].type === 0) { Game.wrinklers[i].hp = 0; } @@ -40,25 +41,17 @@ CM.Disp.PopAllNormalWrinklers = function() { * This function returns the cps as either current or average CPS depending on CM.Options.CPSMode * @returns {number} The average or current cps */ -CM.Disp.GetCPS = function() { +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 * 0.05))); - } - else if (CM.Options.CalcWrink === 2) { - // Check if fattest is shiny - if (Game.wrinklers[CM.Cache.WrinklersFattest[1]].type === 1) { - return Game.cookiesPs * ((CM.Cache.CurrWrinklerCPSMult * 3 / CM.Cache.CurrWrinklerCount) + (1 - (CM.Cache.CurrWrinklerCount * 0.05))); - } - else { - return Game.cookiesPs * ((CM.Cache.CurrWrinklerCPSMult / CM.Cache.CurrWrinklerCount) + (1 - (CM.Cache.CurrWrinklerCount * 0.05))); - } - } + 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 * 0.05))); + } else if (CM.Options.CalcWrink === 2 && Game.wrinklers[CM.Cache.WrinklersFattest[1]].type === 1) { + return Game.cookiesPs * ((CM.Cache.CurrWrinklerCPSMult * 3 / CM.Cache.CurrWrinklerCount) + (1 - (CM.Cache.CurrWrinklerCount * 0.05))); + } else { + return Game.cookiesPs * ((CM.Cache.CurrWrinklerCPSMult / CM.Cache.CurrWrinklerCount) + (1 - (CM.Cache.CurrWrinklerCount * 0.05))); } }; @@ -70,10 +63,10 @@ CM.Disp.GetCPS = function() { * @param {number} targetMagic The target magic level * @returns {number} count / Game.fps The time it takes to reach targetMagic */ -CM.Disp.CalculateGrimoireRefillTime = function(currentMagic, maxMagic, targetMagic) { +CM.Disp.CalculateGrimoireRefillTime = function (currentMagic, maxMagic, targetMagic) { let count = 0; while (currentMagic < targetMagic) { - currentMagic += Math.max(0.002, Math.pow(currentMagic / Math.max(maxMagic, 100), 0.5)) * 0.002; + currentMagic += Math.max(0.002, (currentMagic / Math.max(maxMagic, 100)) ** 0.5) * 0.002; count++; } return count / Game.fps; @@ -85,23 +78,23 @@ CM.Disp.CalculateGrimoireRefillTime = function(currentMagic, maxMagic, targetMag * @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) { +CM.Disp.GetLumpColor = function (type) { if (type === 0) { - return {text: "Normal", color: CM.Disp.colorGray}; + return { text: 'Normal', color: CM.Disp.colorGray }; } else if (type === 1) { - return {text: "Bifurcated", color: CM.Disp.colorGreen}; + return { text: 'Bifurcated', color: CM.Disp.colorGreen }; } else if (type === 2) { - return {text: "Golden", color: CM.Disp.colorYellow}; + return { text: 'Golden', color: CM.Disp.colorYellow }; } else if (type === 3) { - return {text: "Meaty", color: CM.Disp.colorOrange}; + return { text: 'Meaty', color: CM.Disp.colorOrange }; } else if (type === 4) { - return {text: "Caramelized", color: CM.Disp.colorPurple}; + return { text: 'Caramelized', color: CM.Disp.colorPurple }; } else { - return {text: "Unknown Sugar Lump", color: CM.Disp.colorRed}; - } + return { text: 'Unknown Sugar Lump', color: CM.Disp.colorRed }; + } }; -/******** +/** * Section: General functions to format or beautify strings */ /** @@ -110,28 +103,28 @@ CM.Disp.GetLumpColor = function(type) { * @param {number} longFormat 1 or 0 * @returns {string} Formatted time */ -CM.Disp.FormatTime = function(time, longFormat) { +CM.Disp.FormatTime = function (time, longFormat) { if (time === Infinity) return time; time = Math.ceil(time); - 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); + const y = Math.floor(time / 31557600); + const d = Math.floor(time % 31557600 / 86400); + const h = Math.floor(time % 86400 / 3600); + const m = Math.floor(time % 3600 / 60); + const s = Math.floor(time % 60); let str = ''; if (CM.Options.TimeFormat) { if (time > 3155760000) 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 += `${(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 > 777600000) 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 += (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; @@ -142,21 +135,20 @@ CM.Disp.FormatTime = function(time, longFormat) { * @param {number} time Time to be coloured * @returns {{string, string}} {text, color} Both the formatted time and color as strings in an array */ -CM.Disp.GetTimeColor = function(time) { +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 { + } 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; + 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}; + return { text, color }; }; /** @@ -166,90 +158,73 @@ CM.Disp.GetTimeColor = function(time) { * @param {number} forced Used to force (type 3) in certains cases * @returns {string} Formatted number */ -CM.Disp.Beautify = function(num, floats, forced) { - let decimals = CM.Options.ScaleDecimals + 1; +CM.Disp.Beautify = function (num, floats, forced) { + const decimals = CM.Options.ScaleDecimals + 1; if (CM.Options.Scale === 0) { return CM.Backup.Beautify(num, floats); - } - else if (isFinite(num)) { + } else if (Number.isFinite(num)) { let answer = ''; if (num === 0) { return num.toString(); - } - else if (0.001 < num && num < CM.Options.ScaleCutoff) { + } else if (num > 0.001 && num < CM.Options.ScaleCutoff) { answer = num.toFixed(2); if (CM.Options.ScaleSeparator) answer = answer.toLocaleString('nl'); for (let i = 0; i < 3; i++) { - if (answer[answer.length - 1] === "0" || answer[answer.length - 1] === ".") answer = answer.slice(0, -1); + if (answer[answer.length - 1] === '0' || answer[answer.length - 1] === '.') answer = answer.slice(0, -1); } return answer; - } - else if (CM.Options.Scale === 4 && !forced || forced === 4) { // Scientific notation, 123456789 => 1.235E+8 - answer = num.toExponential(decimals).toString().replace("e", "E"); - } - else { - let exponential = num.toExponential().toString(); - let AmountOfTenPowerThree = Math.floor(exponential.slice(exponential.indexOf("e") + 1) / 3); - answer = (num / Number("1e" + (AmountOfTenPowerThree * 3))).toFixed(decimals); + } else if (CM.Options.Scale === 4 && !forced || forced === 4) { // Scientific notation, 123456789 => 1.235E+8 + answer = num.toExponential(decimals).toString().replace('e', 'E'); + } else { + const exponential = num.toExponential().toString(); + const AmountOfTenPowerThree = Math.floor(exponential.slice(exponential.indexOf('e') + 1) / 3); + answer = (num / Number(`1e${AmountOfTenPowerThree * 3}`)).toFixed(decimals); // answer is now "xxx.xx" (e.g., 123456789 would be 123.46) if (CM.Options.Scale === 1 && !forced || forced === 1) { // Metric scale, 123456789 => 123.457 M - if (num >= 0.01 && num < Number("1e" + CM.Data.metric.length * 3)) { - answer += ' ' + CM.Data.metric[AmountOfTenPowerThree]; - } - // If number is too large or little, revert to scientific notation - else answer = CM.Disp.Beautify(num, 0, 4); - } - else if (CM.Options.Scale === 2 && !forced || forced === 2) { // Short scale, 123456789 => 123.457 M - if (num >= 0.01 && num < Number("1e" + CM.Data.shortScale.length * 3)) { - answer += ' ' + CM.Data.shortScale[AmountOfTenPowerThree]; - } - // If number is too large or little, revert to scientific notation - else answer = CM.Disp.Beautify(num, 0, 4); - } - else if (CM.Options.Scale === 3 && !forced || forced === 3) { // Short scale, 123456789 => 123.457 M - if (num >= 0.01 && num < Number("1e" + CM.Data.shortScaleAbbreviated.length * 3)) { - answer += ' ' + CM.Data.shortScaleAbbreviated[AmountOfTenPowerThree]; - } - // If number is too large or little, revert to scientific notation - else answer = CM.Disp.Beautify(num, 0, 4); - } - else if (CM.Options.Scale === 5 && !forced || forced === 5) { // Engineering notation, 123456789 => 123.457E+6 - answer += 'E' + AmountOfTenPowerThree * 3; + if (num >= 0.01 && num < Number(`1e${CM.Data.metric.length * 3}`)) { + answer += ` ${CM.Data.metric[AmountOfTenPowerThree]}`; + } else answer = CM.Disp.Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation + } else if (CM.Options.Scale === 2 && !forced || forced === 2) { // Short scale, 123456789 => 123.457 M + if (num >= 0.01 && num < Number(`1e${CM.Data.shortScale.length * 3}`)) { + answer += ` ${CM.Data.shortScale[AmountOfTenPowerThree]}`; + } else answer = CM.Disp.Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation + } else if (CM.Options.Scale === 3 && !forced || forced === 3) { // Short scale, 123456789 => 123.457 M + if (num >= 0.01 && num < Number(`1e${CM.Data.shortScaleAbbreviated.length * 3}`)) { + answer += ` ${CM.Data.shortScaleAbbreviated[AmountOfTenPowerThree]}`; + } else answer = CM.Disp.Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation + } else if (CM.Options.Scale === 5 && !forced || forced === 5) { // Engineering notation, 123456789 => 123.457E+6 + answer += `E${AmountOfTenPowerThree * 3}`; } } if (answer === '') { - console.log("Could not beautify number with CM.Disp.Beautify: " + num); - answer = CM.Backup.Beautify(num, floats); + console.log(`Could not beautify number with CM.Disp.Beautify: ${num}`); + answer = CM.Backup.Beautify(num, floats); } if (CM.Options.ScaleSeparator) answer = answer.replace('.', ','); return answer; - } - else if (num === Infinity) { - return "Infinity"; - } - else if (typeof num === "undefined") { + } else if (num === Infinity) { + return 'Infinity'; + } else if (typeof num === 'undefined') { return 0; - } - else { - console.log("Could not beautify number with CM.Disp.Beautify: " + num); + } else { + console.log(`Could not beautify number with CM.Disp.Beautify: ${num}`); return CM.Backup.Beautify(num, floats); } }; -/******** +/** * Section: General functions related to display, drawing and initialization of the page */ /** * This function disables and shows the bars created by CookieMonster when the game is "ascending" * It is called by CM.Disp.Draw() */ -CM.Disp.UpdateAscendState = function() { +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.TimerBar.style.display = 'none'; - } - else { + } else { CM.Disp.ToggleBotBar(); CM.Disp.ToggleTimerBar(); } @@ -260,7 +235,7 @@ CM.Disp.UpdateAscendState = function() { * This function creates a CSS style that stores certain standard CSS classes used by CookieMonster * It is called by CM.Main.DelayInit() */ -CM.Disp.CreateCssArea = function() { +CM.Disp.CreateCssArea = function () { CM.Disp.Css = document.createElement('style'); CM.Disp.Css.type = 'text/css'; @@ -271,12 +246,12 @@ CM.Disp.CreateCssArea = function() { * 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"; +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"; + l('upgrades').style.display = 'flex'; + l('upgrades').style['flex-wrap'] = 'wrap'; }; /** @@ -284,7 +259,7 @@ CM.Disp.UpdateBuildingUpgradeStyle = function() { * depending on whether certain abrs are activated * It is called by CM.Disp.UpdateAscendState() and CM.Disp.UpdateBotTimerBarPosition() */ -CM.Disp.UpdateBackground = function() { +CM.Disp.UpdateBackground = function () { Game.Background.canvas.width = Game.Background.canvas.parentNode.offsetWidth; Game.Background.canvas.height = Game.Background.canvas.parentNode.offsetHeight; Game.LeftBackground.canvas.width = Game.LeftBackground.canvas.parentNode.offsetWidth; @@ -298,10 +273,10 @@ CM.Disp.UpdateBackground = function() { CM.Disp.Draw = function () { // Draw autosave timer in stats menu, this must be done here to make it count down correctly if ( - (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 + (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 ) { - let timer = document.getElementById('CMStatsAutosaveTimer'); + const timer = document.getElementById('CMStatsAutosaveTimer'); if (timer) { timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4); } @@ -328,21 +303,20 @@ CM.Disp.Draw = function () { CM.Disp.RefreshMenu(); }; -/******** +/** * Section: Functions related to the Bottom Bar */ /** * This function toggle the bottom bar * It is called by CM.Disp.UpdateAscendState() and a change in CM.Options.BotBar */ -CM.Disp.ToggleBotBar = function() { +CM.Disp.ToggleBotBar = function () { if (CM.Options.BotBar === 1) { CM.Disp.BotBar.style.display = ''; if (!CM.Footer.isInitzializing) { CM.Disp.UpdateBotBar(); } - } - else { + } else { CM.Disp.BotBar.style.display = 'none'; } CM.Disp.UpdateBotTimerBarPosition(); @@ -352,7 +326,7 @@ CM.Disp.ToggleBotBar = function() { * This function creates the bottom bar and appends it to l('wrapper') * It is called by CM.Main.DelayInit and a change in CM.Options.BotBar */ -CM.Disp.CreateBotBar = function() { +CM.Disp.CreateBotBar = function () { CM.Disp.BotBar = document.createElement('div'); CM.Disp.BotBar.id = 'CMBotBar'; CM.Disp.BotBar.style.height = '69px'; @@ -365,30 +339,30 @@ CM.Disp.CreateBotBar = function() { CM.Disp.BotBar.style.overflow = 'auto'; CM.Disp.BotBar.style.textShadow = '-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black'; - let table = CM.Disp.BotBar.appendChild(document.createElement('table')); + const table = CM.Disp.BotBar.appendChild(document.createElement('table')); table.style.width = '100%'; table.style.textAlign = 'center'; table.style.whiteSpace = 'nowrap'; - let tbody = table.appendChild(document.createElement('tbody')); + const tbody = table.appendChild(document.createElement('tbody')); - let firstCol = function(text, color) { - let td = document.createElement('td'); + const firstCol = function (text, color) { + const td = document.createElement('td'); td.style.textAlign = 'right'; td.className = CM.Disp.colorTextPre + color; td.textContent = text; return td; }; - let type = tbody.appendChild(document.createElement('tr')); + const type = tbody.appendChild(document.createElement('tr')); type.style.fontWeight = 'bold'; - type.appendChild(firstCol('CM ' + CM.VersionMajor + '.' + CM.VersionMinor, CM.Disp.colorYellow)); - let bonus = tbody.appendChild(document.createElement('tr')); + type.appendChild(firstCol(`CM ${CM.VersionMajor}.${CM.VersionMinor}`, CM.Disp.colorYellow)); + const bonus = tbody.appendChild(document.createElement('tr')); bonus.appendChild(firstCol('Bonus Income', CM.Disp.colorBlue)); - let pp = tbody.appendChild(document.createElement('tr')); + const pp = tbody.appendChild(document.createElement('tr')); pp.appendChild(firstCol('Payback Period', CM.Disp.colorBlue)); - let time = tbody.appendChild(document.createElement('tr')); + const time = tbody.appendChild(document.createElement('tr')); time.appendChild(firstCol('Time Left', CM.Disp.colorBlue)); - for (let i of Object.keys(Game.Objects)) { + for (const i of Object.keys(Game.Objects)) { CM.Disp.CreateBotBarBuildingColumn(i); } @@ -399,22 +373,21 @@ CM.Disp.CreateBotBar = function() { * This function updates the bonus-, pp-, and time-rows in the the bottom bar * It is called by CM.Disp.Draw() */ -CM.Disp.UpdateBotBar = function() { +CM.Disp.UpdateBotBar = function () { if (CM.Options.BotBar === 1 && CM.Cache.Objects1) { let count = 0; - for (let i of Object.keys(CM.Cache.Objects1)) { - let target = `Objects${Game.buyBulk}` + for (const i of Object.keys(CM.Cache.Objects1)) { + const target = `Objects${Game.buyBulk}`; count++; CM.Disp.BotBar.firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount; 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); - let timeColor = CM.Disp.GetTimeColor((Game.Objects[i].bulkPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()); + const 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)"; - } - else CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[count].textContent = timeColor.text; + if (timeColor.text === 'Done!' && Game.cookies < Game.Objects[i].bulkPrice) { + CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[count].textContent = `${timeColor.text} (with Wrink)`; + } else CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[count].textContent = timeColor.text; } } }; @@ -425,22 +398,22 @@ CM.Disp.UpdateBotBar = function() { * and also in CM.Sim.CopyData if a new building (added by another mod) is discovered. * @param {string} buildingName Objectname to be added (e.g., "Cursor") */ -CM.Disp.CreateBotBarBuildingColumn = function(buildingName) { - if(!CM.Disp.BotBar) { +CM.Disp.CreateBotBarBuildingColumn = function (buildingName) { + if (!CM.Disp.BotBar) { CM.Disp.CreateBotBar(); return; // CreateBotBar will call this function again } - 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]; + const type = CM.Disp.BotBar.firstChild.firstChild.childNodes[0]; + const bonus = CM.Disp.BotBar.firstChild.firstChild.childNodes[1]; + const pp = CM.Disp.BotBar.firstChild.firstChild.childNodes[2]; + const time = CM.Disp.BotBar.firstChild.firstChild.childNodes[3]; - let i = buildingName; - let header = type.appendChild(document.createElement('td')); - header.appendChild(document.createTextNode((i.indexOf(' ') != -1 ? i.substring(0, i.indexOf(' ')) : i) + ' (')); + const i = buildingName; + const 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')); + const span = header.appendChild(document.createElement('span')); span.className = CM.Disp.colorTextPre + CM.Disp.colorBlue; header.appendChild(document.createTextNode(')')); @@ -449,14 +422,14 @@ CM.Disp.CreateBotBarBuildingColumn = function(buildingName) { time.appendChild(document.createElement('td')); }; -/******** - * Section: Functions related to the Timer Bar +/** + * Section: Functions related to the Timer Bar /** * This function creates the TimerBar and appends it to l('wrapper') * It is called by CM.Main.DelayInit() */ -CM.Disp.CreateTimerBar = function() { +CM.Disp.CreateTimerBar = function () { CM.Disp.TimerBar = document.createElement('div'); CM.Disp.TimerBar.id = 'CMTimerBar'; CM.Disp.TimerBar.style.position = 'absolute'; @@ -470,18 +443,16 @@ CM.Disp.CreateTimerBar = function() { CM.Disp.BuffTimerBars = {}; // Create standard Golden Cookie bar - CM.Disp.TimerBars.CMTimerBarGC = CM.Disp.TimerBarCreateBar('CMTimerBarGC', - 'Next Cookie', - [{id: 'CMTimerBarGCMinBar', color: CM.Disp.colorGray}, {id: 'CMTimerBarGCBar', color: CM.Disp.colorPurple}] - ); + CM.Disp.TimerBars.CMTimerBarGC = CM.Disp.TimerBarCreateBar('CMTimerBarGC', + 'Next Cookie', + [{ id: 'CMTimerBarGCMinBar', color: CM.Disp.colorGray }, { id: 'CMTimerBarGCBar', color: CM.Disp.colorPurple }]); CM.Disp.TimerBar.appendChild(CM.Disp.TimerBars.CMTimerBarGC); // Create standard Reindeer bar - CM.Disp.TimerBars. CMTimerBarRen = CM.Disp.TimerBarCreateBar('CMTimerBarRen', - 'Next Reindeer', - [{id: 'CMTimerBarRenMinBar', color: CM.Disp.colorGray}, {id: 'CMTimerBarRenBar', color: CM.Disp.colorOrange}] - ); - CM.Disp.TimerBar.appendChild(CM.Disp.TimerBars. CMTimerBarRen); + CM.Disp.TimerBars.CMTimerBarRen = CM.Disp.TimerBarCreateBar('CMTimerBarRen', + 'Next Reindeer', + [{ id: 'CMTimerBarRenMinBar', color: CM.Disp.colorGray }, { id: 'CMTimerBarRenBar', color: CM.Disp.colorOrange }]); + CM.Disp.TimerBar.appendChild(CM.Disp.TimerBars.CMTimerBarRen); l('wrapper').appendChild(CM.Disp.TimerBar); }; @@ -493,14 +464,14 @@ CM.Disp.CreateTimerBar = function() { * @param {string} name The title of the timer * @param [{{string}, {string}}, ...] bars ([id, color]) The id and colours of individual parts of the timer */ -CM.Disp.TimerBarCreateBar = function(id, name, bars) { - let timerBar = document.createElement('div'); +CM.Disp.TimerBarCreateBar = function (id, name, bars) { + const timerBar = document.createElement('div'); timerBar.id = 'CMTimerBar'; timerBar.style.height = '12px'; timerBar.style.margin = '0px 10px'; timerBar.style.position = 'relative'; - let div = document.createElement('div'); + const div = document.createElement('div'); div.style.width = '100%'; div.style.height = '10px'; div.style.margin = 'auto'; @@ -510,10 +481,10 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) { div.style.right = '0px'; div.style.bottom = '0px'; - let type = document.createElement('span'); + const type = document.createElement('span'); type.style.display = 'inline-block'; type.style.textAlign = 'right'; - type.style.fontSize = "10px"; + type.style.fontSize = '10px'; type.style.width = '108px'; type.style.marginRight = '5px'; type.style.verticalAlign = 'text-top'; @@ -521,12 +492,12 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) { div.appendChild(type); for (let i = 0; i < bars.length; i++) { - let colorBar = document.createElement('span'); + const colorBar = document.createElement('span'); colorBar.id = bars[i].id; colorBar.style.display = 'inline-block'; colorBar.style.height = '10px'; - colorBar.style.verticalAlign = "text-top"; - colorBar.style.textAlign="center"; + colorBar.style.verticalAlign = 'text-top'; + colorBar.style.textAlign = 'center'; if (bars.length - 1 === i) { colorBar.style.borderTopRightRadius = '10px'; colorBar.style.borderBottomRightRadius = '10px'; @@ -537,12 +508,12 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) { div.appendChild(colorBar); } - let timer = document.createElement('span'); - timer.id = id + 'Time'; + const timer = document.createElement('span'); + timer.id = `${id}Time`; timer.style.marginLeft = '5px'; timer.style.verticalAlign = 'text-top'; div.appendChild(timer); - + timerBar.appendChild(div); return timerBar; @@ -552,85 +523,81 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) { * This function updates indivudual timers in the timer bar * It is called by CM.Disp.Draw() */ -CM.Disp.UpdateTimerBar = function() { +CM.Disp.UpdateTimerBar = function () { if (CM.Options.TimerBar === 1) { // label width: 113, timer width: 30, div margin: 20 - let maxWidthTwoBar = CM.Disp.TimerBar.offsetWidth - 163; + const maxWidthTwoBar = CM.Disp.TimerBar.offsetWidth - 163; // label width: 113, div margin: 20, calculate timer width at runtime - let maxWidthOneBar = CM.Disp.TimerBar.offsetWidth - 133; + const 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]')) { CM.Disp.TimerBars.CMTimerBarGC.style.display = ''; - l('CMTimerBarGCMinBar').style.width = Math.round(Math.max(0, Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) * maxWidthTwoBar / Game.shimmerTypes.golden.maxTime) + 'px'; - if (CM.Options.TimerBarOverlay >= 1) l('CMTimerBarGCMinBar').textContent = Math.ceil((Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time)/ Game.fps); - else l('CMTimerBarGCMinBar').textContent = ""; + l('CMTimerBarGCMinBar').style.width = `${Math.round(Math.max(0, Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) * maxWidthTwoBar / Game.shimmerTypes.golden.maxTime)}px`; + if (CM.Options.TimerBarOverlay >= 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 { + } 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('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'; + } else CM.Disp.TimerBars.CMTimerBarGC.style.display = 'none'; // Regulates visibility of Reindeer timer 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 = ""; + 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'; + } else { + CM.Disp.TimerBars.CMTimerBarRen.style.display = 'none'; } // On every frame all buff-timers are deleted and re-created - for (let i of Object.keys(CM.Disp.BuffTimerBars)) { + for (const i of Object.keys(CM.Disp.BuffTimerBars)) { CM.Disp.BuffTimerBars[i].remove(); } CM.Disp.BuffTimerBars = {}; - for (let i of Object.keys(Game.buffs)) { + for (const 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'}]); + const timer = CM.Disp.TimerBarCreateBar(Game.buffs[i].name, Game.buffs[i].name, [{ id: `${Game.buffs[i].name}Bar` }]); timer.style.display = ''; 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]; - } - else classColor = CM.Disp.colorPurple; + } 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[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)) { + for (const 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 (numberOfTimers !== 0) { + CM.Disp.TimerBar.style.height = `${numberOfTimers * 12 + 2}px`; } - if (CM.Disp.LastNumberOfTimers != numberOfTimers) { + if (CM.Disp.LastNumberOfTimers !== numberOfTimers) { CM.Disp.LastNumberOfTimers = numberOfTimers; CM.Disp.UpdateBotTimerBarPosition(); } @@ -641,7 +608,7 @@ CM.Disp.UpdateTimerBar = function() { * This function changes the visibility of the timer bar * It is called by CM.Disp.UpdateAscendState() or a change in CM.Options.TimerBar */ -CM.Disp.ToggleTimerBar = function() { +CM.Disp.ToggleTimerBar = function () { if (CM.Options.TimerBar === 1) CM.Disp.TimerBar.style.display = ''; else CM.Disp.TimerBar.style.display = 'none'; CM.Disp.UpdateBotTimerBarPosition(); @@ -651,13 +618,12 @@ CM.Disp.ToggleTimerBar = function() { * This function changes the position of the timer bar * It is called by a change in CM.Options.TimerBarPos */ -CM.Disp.ToggleTimerBarPos = function() { +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 { + } else { CM.Disp.TimerBar.style.width = '100%'; CM.Disp.TimerBar.style.bottom = '0px'; l('wrapper').appendChild(CM.Disp.TimerBar); @@ -665,40 +631,36 @@ CM.Disp.ToggleTimerBarPos = function() { CM.Disp.UpdateBotTimerBarPosition(); }; -/******** +/** * Section: Functions related to the both the bottom and timer bar /** * This function changes the position of both the bottom and timer bar * It is called by CM.Disp.ToggleTimerBar(), CM.Disp.ToggleTimerBarPos() and CM.Disp.ToggleBotBar() */ -CM.Disp.UpdateBotTimerBarPosition = function() { +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) { + 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) { + } else if (CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 1) { l('game').style.bottom = CM.Disp.TimerBar.style.height; - } - else { // No bars + } else { // No bars l('game').style.bottom = '0px'; } if (CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) { l('sectionLeft').style.top = CM.Disp.TimerBar.style.height; - } - else { + } else { l('sectionLeft').style.top = ''; } CM.Disp.UpdateBackground(); }; -/******** +/** * Section: Functions related to right column of the screen (buildings/upgrades) /** @@ -707,63 +669,60 @@ CM.Disp.UpdateBotTimerBarPosition = function() { * The function is called by CM.Disp.Draw(), CM.Disp.UpdateColors() & CM.Disp.RefreshScale() * And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.Data.Config.BulkBuildColor */ -CM.Disp.UpdateBuildings = function() { - let target = `Objects${Game.buyBulk}` - if (Game.buyMode === 1) { +CM.Disp.UpdateBuildings = function () { + const 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]; + for (const 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"); + for (const 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 = ''; + } else if (Game.buyMode === -1) { + for (const i of Object.keys(CM.Cache.Objects1)) { + const o = Game.Objects[i]; + l(`productPrice${o.id}`).style.color = ''; /* * Fix sell price displayed in the object in the store. * * The buildings sell price displayed by the game itself (without any mod) is incorrect. * The following line of code fixes this issue, and can be safely removed when the game gets fixed. - * + * * This issue is extensively detailed here: https://github.com/Aktanusa/CookieMonster/issues/359#issuecomment-735658262 */ - l('productPrice' + o.id).innerHTML = Beautify(CM.Sim.BuildingSell(o, o.basePrice, o.amount, o.free, Game.buyBulk, 1)); + l(`productPrice${o.id}`).innerHTML = Beautify(CM.Sim.BuildingSell(o, o.basePrice, o.amount, o.free, Game.buyBulk, 1)); } } - + // Build array of pointers, sort by pp, use array index (+2) as the grid row number // (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options) // This regulates sorting of buildings if (Game.buyMode === 1 && CM.Options.SortBuildings) { - let arr = Object.keys(CM.Cache[target]).map(k => - { - let o = CM.Cache[target][k]; + const arr = Object.keys(CM.Cache[target]).map((k) => { + const o = CM.Cache[target][k]; o.name = k; o.id = Game.Objects[k].id; return o; }); - arr.sort(function(a, b){ return (CM.Disp.colors.indexOf(a.color) > CM.Disp.colors.indexOf(b.color) ? 1 : (CM.Disp.colors.indexOf(a.color) < CM.Disp.colors.indexOf(b.color) ? -1 : (a.pp < b.pp) ? -1 : 0)); }); - + arr.sort(function (a, b) { return (CM.Disp.colors.indexOf(a.color) > CM.Disp.colors.indexOf(b.color) ? 1 : (CM.Disp.colors.indexOf(a.color) < CM.Disp.colors.indexOf(b.color) ? -1 : (a.pp < b.pp) ? -1 : 0)); }); + for (let x = 0; x < arr.length; x++) { - Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2); + Game.Objects[arr[x].name].l.style.gridRow = `${x + 2}/${x + 2}`; } } else { - let arr = Object.keys(CM.Cache.Objects1).map(k => - { - let o = CM.Cache.Objects1[k]; - o.name = k; - o.id = Game.Objects[k].id; - return o; - }); + const arr = Object.keys(CM.Cache.Objects1).map((k) => { + const 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; x < arr.length; x++) { - Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2); + Game.Objects[arr[x].name].l.style.gridRow = `${x + 2}/${x + 2}`; } } }; @@ -774,7 +733,7 @@ CM.Disp.UpdateBuildings = function() { * The function is called by CM.Disp.Draw(), CM.Disp.ToggleUpgradeBarAndColor & CM.Disp.RefreshScale() * And by changes in CM.Options.SortUpgrades */ -CM.Disp.UpdateUpgrades = 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) { let blue = 0; @@ -785,22 +744,22 @@ CM.Disp.UpdateUpgrades = function() { let purple = 0; let gray = 0; - for (let i of Object.keys(Game.UpgradesInStore)) { - let me = Game.UpgradesInStore[i]; + for (const i of Object.keys(Game.UpgradesInStore)) { + const 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; + 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; addedColor = true; break; } } if (!addedColor) { - let div = document.createElement('div'); + const div = document.createElement('div'); div.style.width = '10px'; div.style.height = '10px'; div.className = CM.Disp.colorBackPre + CM.Cache.Upgrades[me.name].color; - l('upgrade' + i).appendChild(div); + l(`upgrade${i}`).appendChild(div); } if (CM.Cache.Upgrades[me.name].color === CM.Disp.colorBlue) blue++; else if (CM.Cache.Upgrades[me.name].color === CM.Disp.colorGreen) green++; @@ -819,12 +778,12 @@ CM.Disp.UpdateUpgrades = function() { l('CMUpgradeBarPurple').textContent = purple; l('CMUpgradeBarGray').textContent = gray; } - + + const arr = []; // Build array of pointers, sort by pp, set flex positions // This regulates sorting of upgrades - let arr = []; - for (let x = 0; x < Game.UpgradesInStore.length; x++){ - let o = {}; + for (let x = 0; x < Game.UpgradesInStore.length; x++) { + const o = {}; o.name = Game.UpgradesInStore[x].name; o.price = Game.UpgradesInStore[x].basePrice; o.pp = CM.Cache.Upgrades[o.name].pp; @@ -833,36 +792,33 @@ CM.Disp.UpdateUpgrades = function() { if (CM.Options.SortUpgrades) { arr.sort((a, b) => CM.Disp.colors.indexOf(a.color) - CM.Disp.colors.indexOf(b.color)); - } - else { + } else { arr.sort((a, b) => a.price - b.price); } - - let nameChecker = function(arr, upgrade) { - return arr.findIndex(e => e.name === upgrade.name); + + const nameChecker = function (arr2, upgrade) { + return arr2.findIndex((e) => e.name === upgrade.name); }; - for (let x = 0; x < Game.UpgradesInStore.length; x++){ - l("upgrade" + x).style.order = nameChecker(arr, Game.UpgradesInStore[x]) + 1; + for (let x = 0; x < Game.UpgradesInStore.length; x++) { + l(`upgrade${x}`).style.order = nameChecker(arr, Game.UpgradesInStore[x]) + 1; } }; -/******** +/** * Section: Functions related to the Upgrade Bar /** * This function toggles the upgrade bar and the colours of upgrades * It is called by a change in CM.Options.UpBarColor */ -CM.Disp.ToggleUpgradeBarAndColor = function() { +CM.Disp.ToggleUpgradeBarAndColor = function () { if (CM.Options.UpBarColor === 1) { // Colours and bar on CM.Disp.UpgradeBar.style.display = ''; CM.Disp.UpdateUpgrades(); - } - else if (CM.Options.UpBarColor === 2) {// Colours on and bar off + } else if (CM.Options.UpBarColor === 2) { // Colours on and bar off CM.Disp.UpgradeBar.style.display = 'none'; CM.Disp.UpdateUpgrades(); - } - else { // Colours and bar off + } else { // Colours and bar off CM.Disp.UpgradeBar.style.display = 'none'; Game.RebuildUpgrades(); } @@ -872,12 +828,11 @@ CM.Disp.ToggleUpgradeBarAndColor = function() { * This function toggles the position of the upgrade bar from fixed or non-fixed mode * It is called by a change in CM.Options.UpgradeBarFixedPos */ -CM.Disp.ToggleUpgradeBarFixedPos = function() { +CM.Disp.ToggleUpgradeBarFixedPos = function () { if (CM.Options.UpgradeBarFixedPos === 1) { // Fix to top of screen when scrolling CM.Disp.UpgradeBar.style.position = 'sticky'; CM.Disp.UpgradeBar.style.top = '0px'; - } - else { + } else { CM.Disp.UpgradeBar.style.position = ''; // Possible to scroll offscreen } }; @@ -886,7 +841,7 @@ CM.Disp.ToggleUpgradeBarFixedPos = function() { * This function creates the upgrade bar above the upgrade-section in the right section of the screen * The number (.textContent) of upgrades gets updated by CM.Disp.UpdateUpgrades() */ -CM.Disp.CreateUpgradeBar = function() { +CM.Disp.CreateUpgradeBar = function () { CM.Disp.UpgradeBar = document.createElement('div'); CM.Disp.UpgradeBar.id = 'CMUpgradeBar'; CM.Disp.UpgradeBar.style.width = '100%'; @@ -895,14 +850,14 @@ CM.Disp.CreateUpgradeBar = function() { CM.Disp.UpgradeBar.style.fontWeight = 'bold'; CM.Disp.UpgradeBar.style.display = 'none'; CM.Disp.UpgradeBar.style.zIndex = '21'; - CM.Disp.UpgradeBar.onmouseout = function() { Game.tooltip.hide(); }; + CM.Disp.UpgradeBar.onmouseout = function () { Game.tooltip.hide(); }; - let placeholder = document.createElement('div'); + const placeholder = document.createElement('div'); placeholder.appendChild(CM.Disp.CreateUpgradeBarLegend()); - CM.Disp.UpgradeBar.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');}; + CM.Disp.UpgradeBar.onmouseover = function () { Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store'); }; - let upgradeNumber = function(id, color) { - let span = document.createElement('span'); + const upgradeNumber = function (id, color) { + const span = document.createElement('span'); span.id = id; span.className = CM.Disp.colorTextPre + color; span.style.width = '14.28571428571429%'; @@ -925,20 +880,20 @@ CM.Disp.CreateUpgradeBar = function() { * This function creates the legend for the upgrade bar, it is called by CM.Disp.CreateUpgradeBar * @returns {object} legend The legend-object to be added */ -CM.Disp.CreateUpgradeBarLegend = function() { - let legend = document.createElement('div'); +CM.Disp.CreateUpgradeBarLegend = function () { + const legend = document.createElement('div'); legend.style.minWidth = '330px'; legend.style.marginBottom = '4px'; - let title = document.createElement('div'); + const title = document.createElement('div'); title.className = 'name'; title.style.marginBottom = '4px'; title.textContent = 'Legend'; legend.appendChild(title); - let legendLine = function(color, text) { - let div = document.createElement('div'); + const legendLine = function (color, text) { + const div = document.createElement('div'); div.style.verticalAlign = 'middle'; - let span = document.createElement('span'); + const span = document.createElement('span'); span.className = CM.Disp.colorBackPre + color; span.style.display = 'inline-block'; span.style.height = '10px'; @@ -959,14 +914,14 @@ CM.Disp.CreateUpgradeBarLegend = function() { return legend; }; -/******** +/** * Section: Functions related to the flashes/sound/notifications /** * This function creates a white square over the full screen and appends it to l('wrapper') * It is used by CM.Disp.Flash() to create the effect of a flash and called by CM.Main.DelayInit() */ -CM.Disp.CreateWhiteScreen = function() { +CM.Disp.CreateWhiteScreen = function () { CM.Disp.WhiteScreen = document.createElement('div'); CM.Disp.WhiteScreen.id = 'CMWhiteScreen'; CM.Disp.WhiteScreen.style.width = '100%'; @@ -979,42 +934,39 @@ CM.Disp.CreateWhiteScreen = function() { }; /** - * This function creates a flash depending on configs. It is called by all functions + * This function creates a flash depending on configs. It is called by all functions * that check game-events and which have settings for Flashes (e.g., Golden Cookies appearing, Magic meter being full) * @param {number} mode Sets the intensity of the flash, used to recursively dim flash * All calls of function have use mode === 3 * @param {string} config The setting in CM.Options that is checked before creating the flash */ -CM.Disp.Flash = function(mode, config) { +CM.Disp.Flash = function (mode, config) { // The arguments check makes the sound not play upon initialization of the mod if ((CM.Options[config] === 1 && mode === 3 && CM.Footer.isInitzializing === false) || mode === 1) { CM.Disp.WhiteScreen.style.opacity = '0.5'; if (mode === 3) { CM.Disp.WhiteScreen.style.display = 'inline'; - setTimeout(function() {CM.Disp.Flash(2, config);}, 1000/Game.fps); + setTimeout(function () { CM.Disp.Flash(2, config); }, 1000 / Game.fps); + } else { + setTimeout(function () { CM.Disp.Flash(0, config); }, 1000 / Game.fps); } - else { - setTimeout(function() {CM.Disp.Flash(0, config);}, 1000/Game.fps); - } - } - else if (mode === 2) { + } else if (mode === 2) { CM.Disp.WhiteScreen.style.opacity = '1'; - setTimeout(function() {CM.Disp.Flash(1, config);}, 1000/Game.fps); - } - else if (mode === 0) CM.Disp.WhiteScreen.style.display = 'none'; + setTimeout(function () { CM.Disp.Flash(1, config); }, 1000 / Game.fps); + } else if (mode === 0) CM.Disp.WhiteScreen.style.display = 'none'; }; /** - * This function plays a sound depending on configs. It is called by all functions + * This function plays a sound depending on configs. It is called by all functions * that check game-events and which have settings for sound (e.g., Golden Cookies appearing, Magic meter being full) * @param {variable} url A variable that gives the url for the sound (e.g., CM.Options.GCSoundURL) * @param {string} sndConfig The setting in CM.Options that is checked before creating the sound * @param {string} volConfig The setting in CM.Options that is checked to determine volume */ -CM.Disp.PlaySound = function(url, sndConfig, volConfig) { +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) { - let sound = new realAudio(url); + const 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(); @@ -1022,27 +974,27 @@ CM.Disp.PlaySound = function(url, sndConfig, volConfig) { }; /** - * This function creates a notifcation depending on configs. It is called by all functions + * This function creates a notifcation depending on configs. It is called by all functions * that check game-events and which have settings for notifications (e.g., Golden Cookies appearing, Magic meter being full) * @param {string} notifyConfig The setting in CM.Options that is checked before creating the notification * @param {string} title The title of the to-be created notifications * @param {string} message The text of the to-be created notifications */ -CM.Disp.Notification = function(notifyConfig, title, message) { +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) { - let CookieIcon = 'https://orteil.dashnet.org/cookieclicker/favicon.ico'; - new Notification(title, {body: message, badge: CookieIcon}); + const CookieIcon = 'https://orteil.dashnet.org/cookieclicker/favicon.ico'; + new Notification(title, { body: message, badge: CookieIcon }); } }; -/******** +/** * Section: Functions related to updating the tab in the browser's tab-bar /** * This function creates the Favicon, it is called by CM.Main.DelayInit() */ -CM.Disp.CreateFavicon = function() { +CM.Disp.CreateFavicon = function () { CM.Disp.Favicon = document.createElement('link'); CM.Disp.Favicon.id = 'CMFavicon'; CM.Disp.Favicon.rel = 'shortcut icon'; @@ -1052,40 +1004,36 @@ CM.Disp.CreateFavicon = function() { /** * This function updates the Favicon depending on whether a Golden Cookie has spawned - * It is called on every loop by CM.Main.CheckGoldenCookie() or by a change in CM.Options.Favicon + * It is called on every loop by CM.Main.CheckGoldenCookie() or by a change in CM.Options.Favicon * By relying on CM.Cache.spawnedGoldenShimmer it only changes for non-user spawned cookie */ -CM.Disp.UpdateFavicon = function() { +CM.Disp.UpdateFavicon = function () { if (CM.Options.Favicon === 1 && CM.Main.lastGoldenCookieState > 0) { 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'; + } else CM.Disp.Favicon.href = 'https://orteil.dashnet.org/cookieclicker/favicon.ico'; }; /** * This function updates the tab title * It is called on every loop by Game.Logic() which also sets CM.Disp.Title to Game.cookies */ -CM.Disp.UpdateTitle = function() { +CM.Disp.UpdateTitle = function () { if (Game.OnAscend || CM.Options.Title === 0) { document.title = CM.Disp.Title; - } - else if (CM.Options.Title === 1) { + } 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]'; + } 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; @@ -1096,8 +1044,7 @@ CM.Disp.UpdateTitle = function() { 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)}]`; + titleSP = `[${Number(l('CMTimerBarRenMinBar').textContent) < 0 ? '!' : ''}${Math.ceil((Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps)}]`; } } @@ -1106,9 +1053,8 @@ CM.Disp.UpdateTitle = function() { if (str.charAt(0) === '[') { str = str.substring(str.lastIndexOf(']') + 1); } - document.title = titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '') + ' ' + str; - } - else if (CM.Options.Title === 2) { + document.title = `${titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '')} ${str}`; + } else if (CM.Options.Title === 2) { let str = ''; let spawn = false; if (CM.Cache.spawnedGoldenShimmer) { @@ -1132,7 +1078,7 @@ CM.Disp.UpdateTitle = function() { } }; -/******** +/** * Section: Functions related to the Golden Cookie Timers /** @@ -1140,9 +1086,9 @@ CM.Disp.UpdateTitle = function() { * It is called by CM.Main.CheckGoldenCookie() * @param {object} cookie A Golden Cookie object */ -CM.Disp.CreateGCTimer = function(cookie) { - let GCTimer = document.createElement('div'); - GCTimer.id = 'GCTimer' + cookie.id; +CM.Disp.CreateGCTimer = function (cookie) { + const GCTimer = document.createElement('div'); + GCTimer.id = `GCTimer${cookie.id}`; GCTimer.style.width = '96px'; GCTimer.style.height = '96px'; GCTimer.style.position = 'absolute'; @@ -1156,32 +1102,31 @@ CM.Disp.CreateGCTimer = function(cookie) { 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 = '';}; + 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); }; /** - * This function toggles GC Timers are visible + * This function toggles GC Timers are visible * It is called by a change in CM.Options.GCTimer */ -CM.Disp.ToggleGCTimer = function() { +CM.Disp.ToggleGCTimer = function () { if (CM.Options.GCTimer === 1) { - for (let i of Object.keys(CM.Disp.GCTimers)) { + for (const 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'; + } else { + for (const i of Object.keys(CM.Disp.GCTimers)) CM.Disp.GCTimers[i].style.display = 'none'; } }; -/******** +/** * Section: Functions related to Tooltips /** @@ -1192,12 +1137,12 @@ CM.Disp.ToggleGCTimer = function() { * @param {string} text The text of the tooltip * @param {string} minWidth The minimum width of the tooltip */ -CM.Disp.CreateSimpleTooltip = function(placeholder, text, minWidth) { +CM.Disp.CreateSimpleTooltip = function (placeholder, text, minWidth) { CM.Disp[placeholder] = document.createElement('div'); - let desc = document.createElement('div'); + const desc = document.createElement('div'); desc.style.minWidth = minWidth; desc.style.marginBottom = '4px'; - let div = document.createElement('div'); + const div = document.createElement('div'); div.style.textAlign = 'left'; div.textContent = text; desc.appendChild(div); @@ -1209,12 +1154,12 @@ CM.Disp.CreateSimpleTooltip = function(placeholder, text, minWidth) { * CM.Disp.Tooltip() sets the tooltip type to 'u' * It is called by Game.RebuildUpgrades() through CM.Main.ReplaceNative() and is therefore not permanent like the other ReplaceTooltip functions */ -CM.Disp.ReplaceTooltipUpgrade = function() { +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();}}; + for (const 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(); } }; } } }; @@ -1226,17 +1171,17 @@ CM.Disp.ReplaceTooltipUpgrade = function() { * @param {string} name Name of the object/item the tooltip relates to * @returns {string} l('tooltip').innerHTML The HTML of the l('tooltip')-object */ -CM.Disp.Tooltip = function(type, name) { +CM.Disp.Tooltip = function (type, name) { if (type === 'b') { // Buildings l('tooltip').innerHTML = Game.Objects[name].tooltip(); // Adds amortization info to the list of info per building 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; + const buildPrice = CM.Sim.BuildingGetPrice(Game.Objects[name], Game.Objects[name].basePrice, 0, Game.Objects[name].free, Game.Objects[name].amount); + const 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 + ')'); + .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) { @@ -1245,28 +1190,26 @@ CM.Disp.Tooltip = function(type, name) { * * The buildings sell price displayed by the game itself (without any mod) is incorrect. * The following line of code fixes this issue, and can be safely removed when the game gets fixed. - * + * * This issue is extensively detailed here: https://github.com/Aktanusa/CookieMonster/issues/359#issuecomment-735658262 */ 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') { // Upgrades + } else if (type === 'u') { // Upgrades if (!Game.UpgradesInStore[name]) return ''; l('tooltip').innerHTML = Game.crateTooltip(Game.UpgradesInStore[name], 'store'); - } - else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip(); // Sugar Lumps + } else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip(); // Sugar Lumps else if (type === 'g') l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); // Grimoire - else if (type === 'p') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])(); // Garden plots - else if (type === 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)(); // Harvest all button in garden + else if (type === 'p') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])(); // Garden plots + else if (type === 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)(); // Harvest all button in garden // Adds area for extra tooltip-sections if ((type === 'b' && Game.buyMode === 1) || type === 'u' || type === 's' || type === 'g' || type === 'p' || type === 'ha') { - let area = document.createElement('div'); + const area = document.createElement('div'); area.id = 'CMTooltipArea'; l('tooltip').appendChild(area); } - + // Sets global variables used by CM.Disp.UpdateTooltip() CM.Disp.tooltipType = type; CM.Disp.tooltipName = name; @@ -1281,9 +1224,9 @@ CM.Disp.Tooltip = function(type, name) { * It is called by all CM.Disp.UpdateTooltip functions. * @returns {object} div An object containing the stylized box */ -CM.Disp.TooltipCreateTooltipBox = function() { +CM.Disp.TooltipCreateTooltipBox = function () { l('tooltip').firstChild.style.paddingBottom = '4px'; // Sets padding on base-tooltip - let tooltipBox = document.createElement('div'); + const tooltipBox = document.createElement('div'); tooltipBox.style.border = '1px solid'; tooltipBox.style.padding = '4px'; tooltipBox.style.margin = '0px -4px'; @@ -1293,13 +1236,13 @@ CM.Disp.TooltipCreateTooltipBox = function() { }; /** - * This function creates a header object for tooltips. + * This function creates a header object for tooltips. * It is called by all CM.Disp.UpdateTooltip functions. * @param {string} text Title of header * @returns {object} div An object containing the stylized header */ -CM.Disp.TooltipCreateHeader = function(text) { - let div = document.createElement('div'); +CM.Disp.TooltipCreateHeader = function (text) { + const div = document.createElement('div'); div.style.fontWeight = 'bold'; div.className = CM.Disp.colorTextPre + CM.Disp.colorBlue; div.textContent = text; @@ -1312,38 +1255,38 @@ CM.Disp.TooltipCreateHeader = function(text) { * The actual data is added by the Update-functions themselves * @param {object} tooltip Object of a TooltipBox, normally created by a call to CM.Disp.TooltipCreateTooltipBox() */ -CM.Disp.TooltipCreateCalculationSection = function(tooltip) { +CM.Disp.TooltipCreateCalculationSection = function (tooltip) { tooltip.appendChild(CM.Disp.TooltipCreateHeader('Bonus Income')); - let income = document.createElement('div'); + const 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'); + tooltip.lastChild.style.display = 'none'; + const click = document.createElement('div'); click.style.marginBottom = '4px'; click.style.color = 'white'; - click.style.display = "none"; + click.style.display = 'none'; click.id = 'CMTooltipCookiePerClick'; tooltip.appendChild(click); tooltip.appendChild(CM.Disp.TooltipCreateHeader('Payback Period')); - let pp = document.createElement('div'); + const 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'); + const 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 - let production = document.createElement('div'); + const production = document.createElement('div'); production.id = 'CMTooltipProduction'; tooltip.appendChild(production); } @@ -1355,39 +1298,39 @@ CM.Disp.TooltipCreateCalculationSection = function(tooltip) { * The object is also removed by CM.Disp.UpdateTooltipWarnings() when type is 's' or 'g' * @returns {object} CM.Disp.TooltipWarn The Warnings-tooltip object */ -CM.Disp.TooltipCreateWarningSection = function() { +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"; + CM.Disp.TooltipWarn.id = 'CMDispTooltipWarningParent'; - let create = function(boxId, color, labelTextFront, labelTextBack, deficitId) { - let box = document.createElement('div'); + const create = function (boxId, color, labelTextFront, labelTextBack, deficitId) { + const 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'); + const labelDiv = document.createElement('div'); box.appendChild(labelDiv); - let labelSpan = document.createElement('span'); + const 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'); + const deficitDiv = document.createElement('div'); box.appendChild(deficitDiv); - let deficitSpan = document.createElement('span'); + const 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')); @@ -1395,13 +1338,13 @@ CM.Disp.TooltipCreateWarningSection = function() { 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')); - if (Game.Objects["Wizard tower"].minigameLoaded) { + if (Game.Objects['Wizard tower'].minigameLoaded) { 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')); } CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px'; CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnUser', CM.Disp.colorRed, 'Warning: ', `Purchase of this item will put you under the number of Cookies equal to ${CM.Options.ToolWarnUser} seconds of CPS`, 'CMDispTooltipWarnUserText')); - + return CM.Disp.TooltipWarn; }; @@ -1409,35 +1352,29 @@ CM.Disp.TooltipCreateWarningSection = function() { * This function updates the sections of the tooltips created by CookieMonster * It is called when tooltips are created by and CM.Disp.Tooltip() on every loop by CM.Disp.Draw() */ -CM.Disp.UpdateTooltip = function() { +CM.Disp.UpdateTooltip = function () { CM.Sim.CopyData(); - if (l('tooltipAnchor').style.display != 'none' && l('CMTooltipArea')) { + if (l('tooltipAnchor').style.display !== 'none' && l('CMTooltipArea')) { l('CMTooltipArea').innerHTML = ''; - let tooltipBox = CM.Disp.TooltipCreateTooltipBox(); + const tooltipBox = CM.Disp.TooltipCreateTooltipBox(); l('CMTooltipArea').appendChild(tooltipBox); - + if (CM.Disp.tooltipType === 'b') { CM.Disp.UpdateTooltipBuilding(); - } - else if (CM.Disp.tooltipType === 'u') { + } else if (CM.Disp.tooltipType === 'u') { CM.Disp.UpdateTooltipUpgrade(); - } - else if (CM.Disp.tooltipType === 's') { + } else if (CM.Disp.tooltipType === 's') { CM.Disp.UpdateTooltipSugarLump(); - } - else if (CM.Disp.tooltipType === 'g') { + } else if (CM.Disp.tooltipType === 'g') { CM.Disp.UpdateTooltipGrimoire(); - } - else if (CM.Disp.tooltipType === 'p') { + } else if (CM.Disp.tooltipType === 'p') { CM.Disp.UpdateTooltipGardenPlots(); - } - else if (CM.Disp.tooltipType === 'ha') { + } else if (CM.Disp.tooltipType === 'ha') { CM.Disp.UpdateTooltipHarvestAll(); } CM.Disp.UpdateTooltipWarnings(); - } - else if (l('CMTooltipArea') === null) { // Remove warnings if its a basic tooltip - if (l('CMDispTooltipWarningParent') != null) { + } else if (l('CMTooltipArea') === null) { // Remove warnings if its a basic tooltip + if (l('CMDispTooltipWarningParent') !== null) { l('CMDispTooltipWarningParent').remove(); } } @@ -1447,59 +1384,56 @@ CM.Disp.UpdateTooltip = function() { * This function adds extra info to the Building tooltips * It is called when Building tooltips are created or refreshed by CM.Disp.UpdateTooltip() */ -CM.Disp.UpdateTooltipBuilding = function() { +CM.Disp.UpdateTooltipBuilding = function () { if (CM.Options.TooltipBuildUpgrade === 1 && Game.buyMode === 1) { - let tooltipBox = l('CMTooltipBorder'); + const tooltipBox = l('CMTooltipBorder'); CM.Disp.TooltipCreateCalculationSection(tooltipBox); - let target = `Objects${Game.buyBulk}` + const 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 * 10000); - if (isFinite(increase) && increase != 0) { - l('CMTooltipIncome').textContent += ' (' + (increase / 100) + '% of income)'; + const increase = Math.round(CM.Disp.TooltipBonusIncome / Game.cookiesPs * 10000); + if (Number.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()); + const 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)"; - } - else 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)`; + } else l('CMTooltipTime').textContent = timeColor.text; l('CMTooltipTime').className = CM.Disp.colorTextPre + timeColor.color; } // Add "production left till next achievement"-bar - l('CMTooltipProductionHeader').style.display = "none"; + l('CMTooltipProductionHeader').style.display = 'none'; l('CMTooltipTime').style.marginBottom = '0px'; - for (let i of Object.keys(Game.Objects[CM.Disp.tooltipName].productionAchievs)) { + for (const i of Object.keys(Game.Objects[CM.Disp.tooltipName].productionAchievs)) { if (!Game.HasAchiev(Game.Objects[CM.Disp.tooltipName].productionAchievs[i].achiev.name)) { - let nextProductionAchiev = Game.Objects[CM.Disp.tooltipName].productionAchievs[i]; + const nextProductionAchiev = Game.Objects[CM.Disp.tooltipName].productionAchievs[i]; l('CMTooltipTime').style.marginBottom = '4px'; - l('CMTooltipProductionHeader').style.display = ""; - l('CMTooltipProduction').className = "ProdAchievement" + CM.Disp.tooltipName; + l('CMTooltipProductionHeader').style.display = ''; + l('CMTooltipProduction').className = `ProdAchievement${CM.Disp.tooltipName}`; l('CMTooltipProduction').textContent = Beautify(nextProductionAchiev.pow - CM.Sim.Objects[CM.Disp.tooltipName].totalCookies, 15); - l('CMTooltipProduction').style.color = "white"; + l('CMTooltipProduction').style.color = 'white'; break; } } - } - else l('CMTooltipArea').style.display = "none"; + } else l('CMTooltipArea').style.display = 'none'; }; /** * This function adds extra info to the Upgrade tooltips * It is called when Upgrade tooltips are created or refreshed by CM.Disp.UpdateTooltip() */ -CM.Disp.UpdateTooltipUpgrade = function() { - let tooltipBox = l('CMTooltipBorder'); +CM.Disp.UpdateTooltipUpgrade = function () { + const tooltipBox = l('CMTooltipBorder'); CM.Disp.TooltipCreateCalculationSection(tooltipBox); CM.Disp.TooltipBonusIncome = CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].bonus; @@ -1508,45 +1442,42 @@ CM.Disp.UpdateTooltipUpgrade = function() { if (CM.Options.TooltipBuildUpgrade === 1) { l('CMTooltipIncome').textContent = Beautify(CM.Disp.TooltipBonusIncome, 2); - let increase = Math.round(CM.Disp.TooltipBonusIncome / Game.cookiesPs * 10000); - if (isFinite(increase) && increase != 0) { - l('CMTooltipIncome').textContent += ' (' + (increase / 100) + '% of income)'; + const increase = Math.round(CM.Disp.TooltipBonusIncome / Game.cookiesPs * 10000); + if (Number.isFinite(increase) && increase !== 0) { + l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`; } l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color; // If clicking power upgrade if (CM.Disp.TooltipBonusMouse) { l('CMTooltipCookiePerClick').textContent = Beautify(CM.Disp.TooltipBonusMouse); - l('CMTooltipCookiePerClick').style.display = "block"; - l('CMTooltipCookiePerClick').previousSibling.style.display = "block"; + l('CMTooltipCookiePerClick').style.display = 'block'; + l('CMTooltipCookiePerClick').previousSibling.style.display = 'block'; } // If only a clicking power upgrade change PP to click-based period - if (CM.Disp.TooltipBonusIncome === 0 && CM.Disp.TooltipBonusMouse) { - l('CMTooltipPP').textContent = Beautify(CM.Disp.TooltipPrice / CM.Disp.TooltipBonusMouse) + ' Clicks'; - l('CMTooltipPP').style.color = "white"; - } - else { + if (CM.Disp.TooltipBonusIncome === 0 && CM.Disp.TooltipBonusMouse) { + l('CMTooltipPP').textContent = `${Beautify(CM.Disp.TooltipPrice / CM.Disp.TooltipBonusMouse)} Clicks`; + l('CMTooltipPP').style.color = 'white'; + } else { 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; } - let timeColor = CM.Disp.GetTimeColor((CM.Disp.TooltipPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()); + const 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)"; - } - else l('CMTooltipTime').textContent = timeColor.text; + if (timeColor.text === 'Done!' && Game.cookies < Game.UpgradesInStore[CM.Disp.tooltipName].getPrice()) { + l('CMTooltipTime').textContent = `${timeColor.text} (with Wrink)`; + } else l('CMTooltipTime').textContent = timeColor.text; l('CMTooltipTime').className = CM.Disp.colorTextPre + timeColor.color; - + // Add extra info to Chocolate egg tooltip - if (Game.UpgradesInStore[CM.Disp.tooltipName].name === "Chocolate egg") { + 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)')); - let chocolate = document.createElement('div'); + const chocolate = document.createElement('div'); chocolate.style.color = 'white'; - chocolate.textContent = CM.Disp.Beautify(Game.cookies * 0.05) + " / " + CM.Disp.Beautify(CM.Cache.lastChoEgg); + chocolate.textContent = `${CM.Disp.Beautify(Game.cookies * 0.05)} / ${CM.Disp.Beautify(CM.Cache.lastChoEgg)}`; l('CMTooltipBorder').appendChild(chocolate); } - } - else l('CMTooltipArea').style.display = "none"; + } else l('CMTooltipArea').style.display = 'none'; }; /** @@ -1554,20 +1485,19 @@ CM.Disp.UpdateTooltipUpgrade = function() { * It is called when the Sugar Lump tooltip is created or refreshed by CM.Disp.UpdateTooltip() * It adds to the additional information to l('CMTooltipArea') */ -CM.Disp.UpdateTooltipSugarLump = function() { +CM.Disp.UpdateTooltipSugarLump = function () { if (CM.Options.TooltipLump === 1) { - let tooltipBox = l('CMTooltipBorder'); + const tooltipBox = l('CMTooltipBorder'); tooltipBox.appendChild(CM.Disp.TooltipCreateHeader('Current Sugar Lump')); - let lumpType = document.createElement('div'); + const lumpType = document.createElement('div'); lumpType.id = 'CMTooltipTime'; tooltipBox.appendChild(lumpType); - let lumpColor = CM.Disp.GetLumpColor(Game.lumpCurrentType); + const lumpColor = CM.Disp.GetLumpColor(Game.lumpCurrentType); lumpType.textContent = lumpColor.text; lumpType.className = CM.Disp.colorTextPre + lumpColor.color; - } - else l('CMTooltipArea').style.display = "none"; + } else l('CMTooltipArea').style.display = 'none'; }; /** @@ -1575,29 +1505,29 @@ CM.Disp.UpdateTooltipSugarLump = function() { * It is called when Grimoire tooltips are created or refreshed by CM.Disp.UpdateTooltip() * It adds to the additional information to l('CMTooltipArea') */ -CM.Disp.UpdateTooltipGrimoire = function() { - let minigame = Game.Objects['Wizard tower'].minigame; - let spellCost = minigame.getSpellCost(minigame.spellsById[CM.Disp.tooltipName]); +CM.Disp.UpdateTooltipGrimoire = function () { + const minigame = Game.Objects['Wizard tower'].minigame; + const spellCost = minigame.getSpellCost(minigame.spellsById[CM.Disp.tooltipName]); if (CM.Options.TooltipGrim === 1 && spellCost <= minigame.magicM) { - let tooltipBox = l('CMTooltipBorder'); + const tooltipBox = l('CMTooltipBorder'); // Time left till enough magic for spell tooltipBox.appendChild(CM.Disp.TooltipCreateHeader('Time Left')); - let time = document.createElement('div'); + const time = document.createElement('div'); time.id = 'CMTooltipTime'; tooltipBox.appendChild(time); - let timeColor = CM.Disp.GetTimeColor(CM.Disp.CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost)); + const 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')); - let recover = document.createElement('div'); + const recover = document.createElement('div'); recover.id = 'CMTooltipRecover'; tooltipBox.appendChild(recover); - let recoverColor = CM.Disp.GetTimeColor(CM.Disp.CalculateGrimoireRefillTime(Math.max(0, minigame.magic - spellCost), minigame.magicM, minigame.magic)); + const 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; } @@ -1605,25 +1535,24 @@ 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')); - let conjure = document.createElement('div'); + const conjure = document.createElement('div'); conjure.id = 'CMTooltipConjure'; tooltipBox.appendChild(conjure); - let reward = document.createElement('span'); - reward.style.color = "#33FF00"; + const 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); - let seperator = document.createElement('span'); + const seperator = document.createElement('span'); seperator.textContent = ' / '; conjure.appendChild(seperator); - let loss = document.createElement('span'); - loss.style.color = "red"; + const loss = document.createElement('span'); + loss.style.color = 'red'; loss.textContent = Beautify((CM.Cache.NoGoldSwitchCookiesPS * 60 * 15), 2); conjure.appendChild(loss); } l('CMTooltipArea').appendChild(tooltipBox); - } - else l('CMTooltipArea').style.display = "none"; + } else l('CMTooltipArea').style.display = 'none'; }; /** @@ -1631,30 +1560,25 @@ CM.Disp.UpdateTooltipGrimoire = function() { * It is called when Garden plots tooltips are created or refreshed by CM.Disp.UpdateTooltip() * It adds to the additional information to l('CMTooltipArea') */ -CM.Disp.UpdateTooltipGardenPlots = function() { - let minigame = Game.Objects.Farm.minigame; - if (CM.Options.TooltipLump && minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] != 0) { - 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)')); - 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 * 0.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 * 0.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 * 0.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 * 0.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.UpdateTooltipGardenPlots = function () { + const minigame = Game.Objects.Farm.minigame; + if (CM.Options.TooltipLump && minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] !== 0) { + const 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; + const 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)')); + const 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 * 0.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 * 0.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 * 0.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 * 0.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'; }; /** @@ -1662,61 +1586,57 @@ CM.Disp.UpdateTooltipGardenPlots = function() { * It is called when the Harvest All tooltip is created or refreshed by CM.Disp.UpdateTooltip() * It adds to the additional information to l('CMTooltipArea') */ -CM.Disp.UpdateTooltipHarvestAll = function() { - let minigame = Game.Objects.Farm.minigame; +CM.Disp.UpdateTooltipHarvestAll = function () { + const 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; + 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) { + const tile = minigame.plot[y][x]; + const me = minigame.plantsById[tile[0] - 1]; + const plantName = me.name; - let count = true; - if (mortal && me.immortal) count = false; - if (tile[1] < me.matureBase) count = false; - if (count && plantName === "Bakeberry") { - totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30); - } - else if (count && plantName === "Chocoroot" || plantName === "White chocoroot") { - totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3); - } - else if (count && plantName === "Queenbeet") { - totalGain += Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60); - } - else if (count && plantName === "Duketater") { - totalGain += Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120); - } + let count = true; + if (mortal && me.immortal) count = false; + if (tile[1] < me.matureBase) count = false; + if (count && plantName === 'Bakeberry') { + totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30); + } else if (count && plantName === 'Chocoroot' || plantName === 'White chocoroot') { + totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3); + } else if (count && plantName === 'Queenbeet') { + totalGain += Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60); + } else if (count && plantName === 'Duketater') { + totalGain += Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120); } } } - l('CMTooltipBorder').appendChild(document.createTextNode(CM.Disp.Beautify(totalGain))); - } - else l('CMTooltipArea').style.display = "none"; + } + l('CMTooltipBorder').appendChild(document.createTextNode(CM.Disp.Beautify(totalGain))); + } else l('CMTooltipArea').style.display = 'none'; }; /** * This function updates the warnings section of the building and upgrade tooltips * It is called by CM.Disp.UpdateTooltip() */ -CM.Disp.UpdateTooltipWarnings = function() { - if (CM.Disp.tooltipType === "b" || CM.Disp.tooltipType === "u") { - if (document.getElementById("CMDispTooltipWarningParent") === null) { - let warningTooltip = CM.Disp.TooltipCreateWarningSection(); +CM.Disp.UpdateTooltipWarnings = function () { + if (CM.Disp.tooltipType === 'b' || CM.Disp.tooltipType === 'u') { + if (document.getElementById('CMDispTooltipWarningParent') === null) { + const warningTooltip = CM.Disp.TooltipCreateWarningSection(); l('tooltipAnchor').appendChild(warningTooltip); CM.Disp.ToggleToolWarnPos(); } if (CM.Options.ToolWarnPos === 0) CM.Disp.TooltipWarn.style.right = '0px'; - else CM.Disp.TooltipWarn.style.top = (l('tooltip').offsetHeight) + 'px'; + else CM.Disp.TooltipWarn.style.top = `${l('tooltip').offsetHeight}px`; - CM.Disp.TooltipWarn.style.width = (l('tooltip').offsetWidth - 6) + 'px'; + CM.Disp.TooltipWarn.style.width = `${l('tooltip').offsetWidth - 6}px`; - let amount = (Game.cookies + CM.Disp.GetWrinkConfigBank()) - CM.Disp.TooltipPrice; + const amount = (Game.cookies + CM.Disp.GetWrinkConfigBank()) - CM.Disp.TooltipPrice; let limitLucky = CM.Cache.Lucky; if (CM.Options.ToolWarnBon === 1) { let bonusNoFren = CM.Disp.TooltipBonusIncome; @@ -1725,62 +1645,53 @@ CM.Disp.UpdateTooltipWarnings = function() { } if (CM.Options.ToolWarnLucky === 1) { - if (amount < limitLucky && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) { + if (amount < limitLucky && (CM.Disp.tooltipType !== 'b' || Game.buyMode === 1)) { l('CMDispTooltipWarnLucky').style.display = ''; - l('CMDispTooltipWarnLuckyText').textContent = Beautify(limitLucky - amount) + ' (' + CM.Disp.FormatTime((limitLucky - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')'; + l('CMDispTooltipWarnLuckyText').textContent = `${Beautify(limitLucky - amount)} (${CM.Disp.FormatTime((limitLucky - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome))})`; } else l('CMDispTooltipWarnLucky').style.display = 'none'; - } - else l('CMDispTooltipWarnLucky').style.display = 'none'; - + } else l('CMDispTooltipWarnLucky').style.display = 'none'; + if (CM.Options.ToolWarnLuckyFrenzy === 1) { - let limitLuckyFrenzy = limitLucky * 7; - if (amount < limitLuckyFrenzy && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) { + const limitLuckyFrenzy = limitLucky * 7; + if (amount < limitLuckyFrenzy && (CM.Disp.tooltipType !== 'b' || Game.buyMode === 1)) { l('CMDispTooltipWarnLuckyFrenzy').style.display = ''; - l('CMDispTooltipWarnLuckyFrenzyText').textContent = Beautify(limitLuckyFrenzy - amount) + ' (' + CM.Disp.FormatTime((limitLuckyFrenzy - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')'; + l('CMDispTooltipWarnLuckyFrenzyText').textContent = `${Beautify(limitLuckyFrenzy - amount)} (${CM.Disp.FormatTime((limitLuckyFrenzy - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome))})`; } else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none'; - } - else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none'; + } else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none'; if (CM.Options.ToolWarnConjure === 1) { - let limitConjure = limitLucky * 2; - if ((amount < limitConjure) && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) { + const 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)) + ')'; + l('CMDispTooltipWarnConjureText').textContent = `${Beautify(limitConjure - amount)} (${CM.Disp.FormatTime((limitConjure - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome))})`; } else l('CMDispTooltipWarnConjure').style.display = 'none'; - } - else l('CMDispTooltipWarnConjure').style.display = 'none'; + } else l('CMDispTooltipWarnConjure').style.display = 'none'; if (CM.Options.ToolWarnConjureFrenzy === 1) { - let limitConjureFrenzy = limitLucky * 2 * 7; - if ((amount < limitConjureFrenzy) && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) { + const 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)) + ')'; + l('CMDispTooltipWarnConjureFrenzyText').textContent = `${Beautify(limitConjureFrenzy - amount)} (${CM.Disp.FormatTime((limitConjureFrenzy - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome))})`; } else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none'; - } - else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none'; + } else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none'; if (CM.Options.ToolWarnEdifice === 1) { - if (CM.Cache.Edifice && amount < CM.Cache.Edifice && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) { + if (CM.Cache.Edifice && amount < CM.Cache.Edifice && (CM.Disp.tooltipType !== 'b' || Game.buyMode === 1)) { l('CMDispTooltipWarnEdifice').style.display = ''; - l('CMDispTooltipWarnEdificeText').textContent = Beautify(CM.Cache.Edifice - amount) + ' (' + CM.Disp.FormatTime((CM.Cache.Edifice - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')'; + l('CMDispTooltipWarnEdificeText').textContent = `${Beautify(CM.Cache.Edifice - amount)} (${CM.Disp.FormatTime((CM.Cache.Edifice - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome))})`; } else l('CMDispTooltipWarnEdifice').style.display = 'none'; - } - else l('CMDispTooltipWarnEdifice').style.display = 'none'; + } else l('CMDispTooltipWarnEdifice').style.display = 'none'; if (CM.Options.ToolWarnUser > 0) { - if (amount < CM.Options.ToolWarnUser * CM.Disp.GetCPS() && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) { + if (amount < CM.Options.ToolWarnUser * CM.Disp.GetCPS() && (CM.Disp.tooltipType !== 'b' || Game.buyMode === 1)) { l('CMDispTooltipWarnUser').style.display = ''; // Need to update tooltip text dynamically - l('CMDispTooltipWarnUser').children[0].textContent = `Purchase of this item will put you under the number of Cookies equal to ${CM.Options.ToolWarnUser} seconds of CPS` - l('CMDispTooltipWarnUserText').textContent = Beautify(CM.Options.ToolWarnUser * CM.Disp.GetCPS() - amount) + ' (' + CM.Disp.FormatTime((CM.Options.ToolWarnUser * CM.Disp.GetCPS() - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')'; + l('CMDispTooltipWarnUser').children[0].textContent = `Purchase of this item will put you under the number of Cookies equal to ${CM.Options.ToolWarnUser} seconds of CPS`; + l('CMDispTooltipWarnUserText').textContent = `${Beautify(CM.Options.ToolWarnUser * CM.Disp.GetCPS() - amount)} (${CM.Disp.FormatTime((CM.Options.ToolWarnUser * CM.Disp.GetCPS() - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome))})`; } else l('CMDispTooltipWarnUser').style.display = 'none'; - } - else l('CMDispTooltipWarnUser').style.display = 'none'; - } - else { - if (l('CMDispTooltipWarningParent') != null) { - l('CMDispTooltipWarningParent').remove(); - } + } else l('CMDispTooltipWarnUser').style.display = 'none'; + } else if (l('CMDispTooltipWarningParent') !== null) { + l('CMDispTooltipWarningParent').remove(); } }; @@ -1788,33 +1699,32 @@ CM.Disp.UpdateTooltipWarnings = function() { * This function updates the location of the tooltip * It is called by Game.tooltip.update() because of CM.Main.ReplaceNative() */ -CM.Disp.UpdateTooltipLocation = function() { +CM.Disp.UpdateTooltipLocation = function () { if (Game.tooltip.origin === 'store') { let warnOffset = 0; - if (CM.Options.ToolWarnLucky === 1 && CM.Options.ToolWarnPos === 1 && typeof CM.Disp.TooltipWarn != "undefined") { + if (CM.Options.ToolWarnLucky === 1 && CM.Options.ToolWarnPos === 1 && typeof CM.Disp.TooltipWarn !== 'undefined') { warnOffset = CM.Disp.TooltipWarn.clientHeight - 4; } - Game.tooltip.tta.style.top = Math.min(parseInt(Game.tooltip.tta.style.top), (l('game').clientHeight + l('topBar').clientHeight) - Game.tooltip.tt.clientHeight - warnOffset - 46) + 'px'; + Game.tooltip.tta.style.top = `${Math.min(parseInt(Game.tooltip.tta.style.top), (l('game').clientHeight + l('topBar').clientHeight) - Game.tooltip.tt.clientHeight - warnOffset - 46)}px`; } // Kept for future possible use if the code changes again - /*else if (!Game.onCrate && !Game.OnAscend && CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) { + /* else if (!Game.onCrate && !Game.OnAscend && CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) { Game.tooltip.tta.style.top = (parseInt(Game.tooltip.tta.style.top) + parseInt(CM.Disp.TimerBar.style.height)) + 'px'; - }*/ + } */ }; /** * This function toggles the position of the warnings created by CM.Disp.TooltipCreateWarningSection() - * It is called by a change in CM.Options.ToolWarnPos + * It is called by a change in CM.Options.ToolWarnPos * and upon creation of the warning tooltip by CM.Disp.UpdateTooltipWarnings() */ -CM.Disp.ToggleToolWarnPos = function() { - if (typeof CM.Disp.TooltipWarn != "undefined") { +CM.Disp.ToggleToolWarnPos = function () { + if (typeof CM.Disp.TooltipWarn !== 'undefined') { if (CM.Options.ToolWarnPos === 0) { CM.Disp.TooltipWarn.style.top = 'auto'; CM.Disp.TooltipWarn.style.margin = '4px -4px'; CM.Disp.TooltipWarn.style.padding = '3px 4px'; - } - else { + } else { CM.Disp.TooltipWarn.style.right = 'auto'; CM.Disp.TooltipWarn.style.margin = '4px'; CM.Disp.TooltipWarn.style.padding = '4px 3px'; @@ -1827,19 +1737,19 @@ CM.Disp.ToggleToolWarnPos = function() { * It is called by CM.Disp.Draw() * As wrinklers are not appended to the DOM we us a different system than for other tooltips */ -CM.Disp.CheckWrinklerTooltip = function() { +CM.Disp.CheckWrinklerTooltip = function () { if (CM.Options.TooltipWrink === 1 && CM.Disp.TooltipWrinklerArea === 1) { // Latter is set by CM.Main.AddWrinklerAreaDetect let showingTooltip = false; - for (let i of Object.keys(Game.wrinklers)) { - let me = Game.wrinklers[i]; + for (const i of Object.keys(Game.wrinklers)) { + const me = Game.wrinklers[i]; if (me.phase > 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'); + const placeholder = document.createElement('div'); + const wrinkler = document.createElement('div'); wrinkler.style.minWidth = '120px'; wrinkler.style.marginBottom = '4px'; - let div = document.createElement('div'); + const div = document.createElement('div'); div.style.textAlign = 'center'; div.id = 'CMTooltipWrinkler'; wrinkler.appendChild(div); @@ -1847,10 +1757,8 @@ CM.Disp.CheckWrinklerTooltip = function() { Game.tooltip.draw(this, escape(placeholder.innerHTML)); CM.Disp.TooltipWrinkler = i; CM.Disp.TooltipWrinklerBeingShown[i] = 1; - } - else break; - } - else { + } else break; + } else { CM.Disp.TooltipWrinklerBeingShown[i] = 0; } } @@ -1865,8 +1773,8 @@ CM.Disp.CheckWrinklerTooltip = function() { * It is called by CM.Disp.Draw() * 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) { +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; @@ -1874,7 +1782,7 @@ CM.Disp.UpdateWrinklerTooltip = function() { sucked *= toSuck; if (Game.Has('Wrinklerspawn')) sucked *= 1.05; if (CM.Sim.Objects.Temple.minigameLoaded) { - let godLvl = Game.hasGod('scorn'); + const godLvl = Game.hasGod('scorn'); if (godLvl === 1) sucked *= 1.15; else if (godLvl === 2) sucked *= 1.1; else if (godLvl === 3) sucked *= 1.05; @@ -1883,7 +1791,7 @@ CM.Disp.UpdateWrinklerTooltip = function() { } }; -/******** +/** * Section: Functions related to the Dragon */ /** @@ -1891,25 +1799,24 @@ CM.Disp.UpdateWrinklerTooltip = function() { * It is called by Game.DescribeDragonAura() after CM.Main.ReplaceNative() * @param {number} aura The number of the aura currently selected by the mouse/user */ -CM.Disp.AddAuraInfo = function(aura) { +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); + const [bonusCPS, priceOfChange] = CM.Sim.CalculateChangeAura(aura); + const timeToRecover = CM.Disp.FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs)); + const bonusCPSPercentage = CM.Disp.Beautify(bonusCPS / Game.cookiesPs); - 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').style.minHeight = '60px'; + l('dragonAuraInfo').style.margin = '8px'; + l('dragonAuraInfo').appendChild(document.createElement('div')).className = 'line'; + const div = document.createElement('div'); + div.style.minWidth = '200px'; + div.style.textAlign = 'center'; + div.textContent = `Picking this aura will change CPS by ${CM.Disp.Beautify(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."; + const 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); } }; @@ -1918,41 +1825,38 @@ CM.Disp.AddAuraInfo = function(aura) { * This functions adds a tooltip to the level up button displaying the cost of rebuying all * It is called by Game.ToggleSpecialMenu() after CM.Main.ReplaceNative() */ -CM.Disp.AddDragonLevelUpTooltip = function() { +CM.Disp.AddDragonLevelUpTooltip = function () { // Check if it is the dragon popup that is on screen - if ((l('specialPopup').className.match(/onScreen/) && l('specialPopup').children[0].style.background.match(/dragon/)) != null) { + if ((l('specialPopup').className.match(/onScreen/) && l('specialPopup').children[0].style.background.match(/dragon/)) !== null) { for (let i = 0; i < l('specialPopup').childNodes.length; i++) { - if (l('specialPopup').childNodes[i].className === "optionBox") { - l('specialPopup').children[i].onmouseover = function() {CM.Cache.CacheDragonCost(); Game.tooltip.dynamic = 1; Game.tooltip.draw(l('specialPopup'), `
${CM.Cache.CostDragonUpgrade}
`, 'this'); Game.tooltip.wobble();}; - l('specialPopup').children[i].onmouseout = function() {Game.tooltip.shouldHide = 1;}; + if (l('specialPopup').childNodes[i].className === 'optionBox') { + l('specialPopup').children[i].onmouseover = function () { CM.Cache.CacheDragonCost(); Game.tooltip.dynamic = 1; Game.tooltip.draw(l('specialPopup'), `
${CM.Cache.CostDragonUpgrade}
`, 'this'); Game.tooltip.wobble(); }; + l('specialPopup').children[i].onmouseout = function () { Game.tooltip.shouldHide = 1; }; } } } }; -/******** +/** * Section: General functions related to the Options/Stats pages /** * This function adds the calll the functions to add extra info to the stats and options pages * It is called by Game.UpdateMenu() */ -CM.Disp.AddMenu = function() { - let title = document.createElement('div'); - title.className = 'title' +CM.Disp.AddMenu = function () { + const title = document.createElement('div'); + title.className = 'title'; if (Game.onMenu === 'prefs') { title.textContent = 'Cookie Monster Settings'; CM.Disp.AddMenuPref(title); - - } - else if (Game.onMenu === 'stats') { + } else if (Game.onMenu === 'stats') { if (CM.Options.Stats) { title.textContent = 'Cookie Monster Statistics'; CM.Disp.AddMenuStats(title); } - } - else if (Game.onMenu === 'log') { + } else if (Game.onMenu === 'log') { title.textContent = 'Cookie Monster '; // To create space between name and button CM.Disp.AddMenuInfo(title); } @@ -1962,11 +1866,11 @@ CM.Disp.AddMenu = function() { * This function refreshes the stats page, CM.Options.UpStats determines the rate at which that happens * It is called by CM.Disp.Draw() */ -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.RefreshMenu = function () { + if (CM.Options.UpStats && Game.onMenu === 'stats' && (Game.drawT - 1) % (Game.fps * 5) !== 0 && (Game.drawT - 1) % Game.fps === 0) Game.UpdateMenu(); }; -/******** +/** * Section: Functions related to the Options/Preferences page /** @@ -1974,44 +1878,44 @@ CM.Disp.RefreshMenu = function() { * It is called by CM.Disp.AddMenu * @param {object} title On object that includes the title of the menu */ -CM.Disp.AddMenuPref = function(title) { - let frag = document.createDocumentFragment(); +CM.Disp.AddMenuPref = function (title) { + const 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]); // (group, display-name of group) + for (const group of Object.keys(CM.Data.ConfigGroups)) { + const groupObject = CM.Disp.CreatePrefHeader(group, CM.Data.ConfigGroups[group]); // (group, display-name of group) frag.appendChild(groupObject); if (CM.Options.Header[group]) { // 0 is show, 1 is collapsed // Make sub-sections of Notification section - if (group === "Notification") { - for (let subGroup of Object.keys(CM.Data.ConfigGroupsNotification)) { - let subGroupObject = CM.Disp.CreatePrefHeader(subGroup, CM.Data.ConfigGroupsNotification[subGroup]); // (group, display-name of group) - subGroupObject.style.fontSize = "15px"; - subGroupObject.style.opacity = "0.5"; + if (group === 'Notification') { + for (const subGroup of Object.keys(CM.Data.ConfigGroupsNotification)) { + const subGroupObject = CM.Disp.CreatePrefHeader(subGroup, CM.Data.ConfigGroupsNotification[subGroup]); // (group, display-name of group) + subGroupObject.style.fontSize = '15px'; + subGroupObject.style.opacity = '0.5'; frag.appendChild(subGroupObject); if (CM.Options.Header[subGroup]) { - for (let option in CM.Data.Config) { + for (const 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)) { + for (const 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'); + + const resDef = document.createElement('div'); resDef.className = 'listing'; - let resDefBut = document.createElement('a'); + const resDefBut = document.createElement('a'); resDefBut.className = 'option'; - resDefBut.onclick = function() {CM.Config.RestoreDefault();}; + 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]); }; @@ -2022,14 +1926,14 @@ CM.Disp.AddMenuPref = function(title) { * @param {string} text The to-be displayed name of the header * @returns {object} div The header object */ -CM.Disp.CreatePrefHeader = function(config, text) { - let div = document.createElement('div'); +CM.Disp.CreatePrefHeader = function (config, text) { + const 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'); // Creates the +/- button + div.appendChild(document.createTextNode(`${text} `)); + const span = document.createElement('span'); // Creates the +/- button span.style.cursor = 'pointer'; span.style.display = 'inline-block'; span.style.height = '14px'; @@ -2041,7 +1945,7 @@ CM.Disp.CreatePrefHeader = function(config, text) { span.style.fontSize = '13px'; span.style.verticalAlign = 'middle'; span.textContent = CM.Options.Header[config] ? '-' : '+'; - span.onclick = function() {CM.Config.ToggleHeader(config); Game.UpdateMenu();}; + span.onclick = function () { CM.Config.ToggleHeader(config); Game.UpdateMenu(); }; div.appendChild(span); return div; }; @@ -2052,63 +1956,56 @@ CM.Disp.CreatePrefHeader = function(config, text) { * @param {string} config The name of the option * @returns {object} div The option object */ -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'); +CM.Disp.CreatePrefOption = function (config) { + const div = document.createElement('div'); + div.className = 'listing'; + if (CM.Data.Config[config].type === 'bool') { + const a = document.createElement('a'); if (CM.Data.Config[config].toggle && CM.Options[config] === 0) { a.className = 'option off'; - } - else { + } else { a.className = 'option'; } a.id = CM.Config.ConfigPrefix + config; - a.onclick = function() {CM.Config.ToggleConfig(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'); + const 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'); + } else if (CM.Data.Config[config].type === 'vol') { + const volume = document.createElement('div'); volume.className = 'sliderBox'; - let title = document.createElement('div'); - title.style.float = "left"; + const 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] + "%"; + const 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"; + const 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);}; + 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'); + } else if (CM.Data.Config[config].type === 'url') { + const span = document.createElement('span'); span.className = 'option'; - span.textContent = CM.Data.Config[config].label + ' '; + span.textContent = `${CM.Data.Config[config].label} `; div.appendChild(span); - let input = document.createElement('input'); + const input = document.createElement('input'); input.id = CM.Config.ConfigPrefix + config; input.className = 'option'; input.type = 'text'; @@ -2117,82 +2014,80 @@ CM.Disp.CreatePrefOption = function(config) { input.style.width = '300px'; div.appendChild(input); div.appendChild(document.createTextNode(' ')); - let inputPrompt = document.createElement('input'); - inputPrompt.id = CM.Config.ConfigPrefix + config + 'Prompt'; + const 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'); + const 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.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'); + const 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'); + } else if (CM.Data.Config[config].type === 'color') { + div.className = ''; for (let i = 0; i < CM.Disp.colors.length; i++) { - let innerDiv = document.createElement('div'); + const innerDiv = document.createElement('div'); innerDiv.className = 'listing'; - let input = document.createElement('input'); + const input = document.createElement('input'); input.id = CM.Disp.colors[i]; input.style.width = '65px'; input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]); innerDiv.appendChild(input); - let change = function() {CM.Options.Colors[this.targetElement.id] = this.toHEXString(); CM.Disp.UpdateColors(); CM.Config.SaveConfig(); Game.UpdateMenu();}; - new JSColor(input, {hash: true, position: "right", onInput: change}); - let label = document.createElement('label'); + const change = function () { CM.Options.Colors[this.targetElement.id] = this.toHEXString(); CM.Disp.UpdateColors(); CM.Config.SaveConfig(); Game.UpdateMenu(); }; + new JSColor(input, { hash: true, position: 'right', onInput: change }); + const label = document.createElement('label'); label.textContent = CM.Data.Config.Colors.desc[CM.Disp.colors[i]]; innerDiv.appendChild(label); div.appendChild(innerDiv); } return div; - } - else if (CM.Data.Config[config].type === "numscale") { - let div = document.createElement('div'); - div.className = 'listing'; - let span = document.createElement('span'); + } else if (CM.Data.Config[config].type === 'numscale') { + const span = document.createElement('span'); span.className = 'option'; - span.textContent = CM.Data.Config[config].label + ' '; + span.textContent = `${CM.Data.Config[config].label} `; div.appendChild(span); - let input = document.createElement('input'); + const input = document.createElement('input'); input.id = CM.Config.ConfigPrefix + config; input.className = 'option'; input.type = 'number'; input.value = (CM.Options[config]); input.min = CM.Data.Config[config].min; input.max = CM.Data.Config[config].max; - input.oninput = function() {if (this.value > this.max) console.log("TEST"); - CM.Options[config] = this.value; - CM.Config.SaveConfig(); + input.oninput = function () { + if (this.value > this.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'); + const label = document.createElement('label'); label.textContent = CM.Data.Config[config].desc; div.appendChild(label); return div; } + return div; }; /** * This function changes some of the time-displays in the game to be more detailed * It is called by a change in CM.Options.DetailedTime */ -CM.Disp.ToggleDetailedTime = function() { +CM.Disp.ToggleDetailedTime = function () { if (CM.Options.DetailedTime === 1) Game.sayTime = CM.Disp.sayTime; else Game.sayTime = CM.Backup.sayTime; }; /** * This function refreshes all numbers after a change in scale-setting - * It is therefore called by a changes in CM.Options.Scale, CM.Options.ScaleDecimals, CM.Options.ScaleSeparator and CM.Options.ScaleCutoff + * It is therefore called by a changes in CM.Options.Scale, CM.Options.ScaleDecimals, CM.Options.ScaleSeparator and CM.Options.ScaleCutoff */ -CM.Disp.RefreshScale = function() { +CM.Disp.RefreshScale = function () { BeautifyAll(); Game.RefreshStore(); Game.RebuildUpgrades(); @@ -2206,22 +2101,22 @@ CM.Disp.RefreshScale = function() { * This function changes/refreshes colours if the user has set new standard colours * The function is therefore called by a change in CM.Options.Colors */ -CM.Disp.UpdateColors = function() { +CM.Disp.UpdateColors = function () { let str = ''; for (let i = 0; i < CM.Disp.colors.length; i++) { - str += '.' + CM.Disp.colorTextPre + CM.Disp.colors[i] + ' { color: ' + CM.Options.Colors[CM.Disp.colors[i]] + '; }\n'; + str += `.${CM.Disp.colorTextPre}${CM.Disp.colors[i]} { color: ${CM.Options.Colors[CM.Disp.colors[i]]}; }\n`; } for (let i = 0; i < CM.Disp.colors.length; i++) { - str += '.' + CM.Disp.colorBackPre + CM.Disp.colors[i] + ' { background-color: ' + CM.Options.Colors[CM.Disp.colors[i]] + '; }\n'; + str += `.${CM.Disp.colorBackPre}${CM.Disp.colors[i]} { background-color: ${CM.Options.Colors[CM.Disp.colors[i]]}; }\n`; } for (let i = 0; i < CM.Disp.colors.length; i++) { - str += '.' + CM.Disp.colorBorderPre + CM.Disp.colors[i] + ' { border: 1px solid ' + CM.Options.Colors[CM.Disp.colors[i]] + '; }\n'; + str += `.${CM.Disp.colorBorderPre}${CM.Disp.colors[i]} { border: 1px solid ${CM.Options.Colors[CM.Disp.colors[i]]}; }\n`; } CM.Disp.Css.textContent = str; CM.Disp.UpdateBuildings(); // Class has been already set }; -/******** +/** * Section: Functions related to the Stats page /** @@ -2229,8 +2124,8 @@ CM.Disp.UpdateColors = function() { * It is called by CM.Disp.AddMenu * @param {object} title On object that includes the title of the menu */ -CM.Disp.AddMenuStats = function(title) { - let stats = document.createElement('div'); +CM.Disp.AddMenuStats = function (title) { + const stats = document.createElement('div'); stats.className = 'subsection'; stats.appendChild(title); @@ -2243,14 +2138,14 @@ CM.Disp.AddMenuStats = function(title) { if (CM.Options.Header.Chain) { stats.appendChild(CM.Disp.CreateStatsChainSection()); } - - if (Game.Objects["Wizard tower"].minigameLoaded) { + + if (Game.Objects['Wizard tower'].minigameLoaded) { stats.appendChild(CM.Disp.CreateStatsHeader('Spells', 'Spells')); if (CM.Options.Header.Spells) { stats.appendChild(CM.Disp.CreateStatsSpellsSection()); } } - + if (Game.Objects.Farm.minigameLoaded) { stats.appendChild(CM.Disp.CreateStatsHeader('Garden', 'Garden')); if (CM.Options.Header.Garden) { @@ -2266,116 +2161,114 @@ CM.Disp.AddMenuStats = function(title) { if (Game.cpsSucked > 0) { 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'); + const popAllFrag = document.createDocumentFragment(); + popAllFrag.appendChild(document.createTextNode(`${Beautify(CM.Cache.WrinklersTotal)} / ${Beautify(CM.Cache.WrinklersNormal)} `)); + const popAllA = document.createElement('a'); popAllA.textContent = 'Pop All Normal'; popAllA.className = 'option'; - popAllA.onclick = function() { CM.Disp.PopAllNormalWrinklers(); }; + 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'); + stats.appendChild(CM.Disp.CreateStatsListing('basic', 'Rewards of Popping (All/Normal)', popAllFrag)); + const popFattestFrag = document.createDocumentFragment(); + popFattestFrag.appendChild(document.createTextNode(`${Beautify(CM.Cache.WrinklersFattest[0])} `)); + const 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; }; + 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] !== null ? CM.Cache.WrinklersFattest[1] : "None") + ")", popFattestFrag)); + stats.appendChild(CM.Disp.CreateStatsListing('basic', `Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ${CM.Cache.WrinklersFattest[1] !== null ? CM.Cache.WrinklersFattest[1] : 'None'})`, popFattestFrag)); } } - let specDisp = false; - let missingHalloweenCookies = []; - for (let i of Object.keys(CM.Data.HalloCookies)) { + const missingHalloweenCookies = []; + for (const 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)) { + const missingChristmasCookies = []; + for (const 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)) { + const missingValentineCookies = []; + for (const 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)) { + const missingNormalEggs = []; + for (const 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)) { + const missingRareEggs = []; + for (const 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)) { + const missingPlantDrops = []; + for (const 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'); - + const choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); + const 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 (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 (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')); + 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) * 10000) / 100) + '%'))); + stats.appendChild(CM.Disp.CreateStatsListing('basic', 'Century Egg Multiplier', document.createTextNode(`${Math.round((CM.Cache.CentEgg - 1) * 10000) / 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.Disp.GetCPS(), 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)))); + 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.Disp.GetCPS(), 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)) { + const fortunes = []; + for (const 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))); + if (fortunes.length !== 0) stats.appendChild(CM.Disp.CreateStatsListing('basic', 'Fortune Upgrades Left to Buy', CM.Disp.CreateStatsMissDisp(fortunes))); } if (CM.Options.ShowMissedGC) { - stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Missed Golden Cookies', document.createTextNode(Beautify(Game.missedGoldenClicks)))); + stats.appendChild(CM.Disp.CreateStatsListing('basic', 'Missed Golden Cookies', document.createTextNode(Beautify(Game.missedGoldenClicks)))); } if (Game.prefs.autosave) { - let timer = document.createElement('span'); + const 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)); + stats.appendChild(CM.Disp.CreateStatsListing('basic', 'Time till autosave', timer)); } } @@ -2393,15 +2286,15 @@ CM.Disp.AddMenuStats = function(title) { * @param {string} text The to-be displayed name of the header * @returns {object} div The header object */ -CM.Disp.CreateStatsHeader = function(text, config) { - let div = document.createElement('div'); +CM.Disp.CreateStatsHeader = function (text, config) { + const div = document.createElement('div'); div.className = 'title'; div.style.padding = '0px 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'); + div.appendChild(document.createTextNode(`${text} `)); + const span = document.createElement('span'); span.style.cursor = 'pointer'; span.style.display = 'inline-block'; span.style.height = '14px'; @@ -2413,7 +2306,7 @@ CM.Disp.CreateStatsHeader = function(text, config) { span.style.fontSize = '13px'; span.style.verticalAlign = 'middle'; span.textContent = CM.Options.Header[config] ? '-' : '+'; - span.onclick = function() {CM.Config.ToggleHeader(config); Game.UpdateMenu();}; + span.onclick = function () { CM.Config.ToggleHeader(config); Game.UpdateMenu(); }; div.appendChild(span); return div; }; @@ -2427,20 +2320,20 @@ CM.Disp.CreateStatsHeader = function(text, config) { * @param {string} placeholder The id of the to-be displayed tooltip if applicable * @returns {object} div The option object */ -CM.Disp.CreateStatsListing = function(type, name, text, placeholder) { - let div = document.createElement('div'); +CM.Disp.CreateStatsListing = function (type, name, text, placeholder) { + const div = document.createElement('div'); div.className = 'listing'; - let listingName = document.createElement('b'); + const listingName = document.createElement('b'); listingName.textContent = name; div.appendChild(listingName); - if (type === "withTooltip") { + if (type === 'withTooltip') { div.className = 'listing'; div.appendChild(document.createTextNode(' ')); - let tooltip = document.createElement('span'); - tooltip.onmouseout = function() { Game.tooltip.hide(); }; - tooltip.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp[placeholder].innerHTML));}; + const 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'; @@ -2464,29 +2357,29 @@ CM.Disp.CreateStatsListing = function(type, name, text, placeholder) { * @param {list} theMissDisp A list of the missing holiday items * @returns {object} frag The tooltip object */ -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'); +CM.Disp.CreateStatsMissDisp = function (theMissDisp) { + const frag = document.createDocumentFragment(); + frag.appendChild(document.createTextNode(`${theMissDisp.length} `)); + const span = document.createElement('span'); + span.onmouseout = function () { Game.tooltip.hide(); }; + const placeholder = document.createElement('div'); + const missing = document.createElement('div'); missing.style.minWidth = '140px'; missing.style.marginBottom = '4px'; - let title = document.createElement('div'); + const 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'); + for (const i of Object.keys(theMissDisp)) { + const 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.onmouseover = function () { Game.tooltip.draw(this, escape(placeholder.innerHTML)); }; span.style.cursor = 'default'; span.style.display = 'inline-block'; span.style.height = '10px'; @@ -2506,64 +2399,63 @@ CM.Disp.CreateStatsMissDisp = function(theMissDisp) { * This function creates the "Lucky" section of the stats page * @returns {object} section The object contating the Lucky section */ -CM.Disp.CreateStatsLuckySection = function() { +CM.Disp.CreateStatsLuckySection = function () { // This sets which tooltip to display for certain stats - let goldCookTooltip = Game.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder'; - - let section = document.createElement('div'); + const goldCookTooltip = Game.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder'; + + const section = document.createElement('div'); section.className = 'CMStatsLuckySection'; - - 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'); + + const luckyColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Lucky) ? CM.Disp.colorRed : CM.Disp.colorGreen; + const luckyTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Lucky) ? CM.Disp.FormatTime((CM.Cache.Lucky - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + const luckyReqFrag = document.createDocumentFragment(); + const 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 != '') { - let luckyReqSmall = document.createElement('small'); - luckyReqSmall.textContent = ' (' + luckyTime + ')'; + if (luckyTime !== '') { + const luckyReqSmall = document.createElement('small'); + luckyReqSmall.textContent = ` (${luckyTime})`; luckyReqFrag.appendChild(luckyReqSmall); } - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Lucky!" Cookies Required', luckyReqFrag, goldCookTooltip)); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', '"Lucky!" Cookies Required', luckyReqFrag, goldCookTooltip)); - - 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'); + const luckyColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.LuckyFrenzy) ? CM.Disp.colorRed : CM.Disp.colorGreen; + const luckyTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.LuckyFrenzy) ? CM.Disp.FormatTime((CM.Cache.LuckyFrenzy - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + const luckyReqFrenFrag = document.createDocumentFragment(); + const 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 != '') { - let luckyReqFrenSmall = document.createElement('small'); - luckyReqFrenSmall.textContent = ' (' + luckyTimeFrenzy + ')'; + if (luckyTimeFrenzy !== '') { + const luckyReqFrenSmall = document.createElement('small'); + luckyReqFrenSmall.textContent = ` (${luckyTimeFrenzy})`; luckyReqFrenFrag.appendChild(luckyReqFrenSmall); } - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Lucky!" Cookies Required (Frenzy)', luckyReqFrenFrag, goldCookTooltip)); - - let luckySplit = CM.Cache.LuckyReward != CM.Cache.LuckyWrathReward; + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', '"Lucky!" Cookies Required (Frenzy)', luckyReqFrenFrag, goldCookTooltip)); - let luckyRewardMaxSpan = document.createElement('span'); + const luckySplit = CM.Cache.LuckyReward !== CM.Cache.LuckyWrathReward; + + const 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)); + 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)); - let luckyRewardFrenzyMaxSpan = document.createElement('span'); + const 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)); - - 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'); + 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)); + + const luckyCurBase = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 15) + 13; + const 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)) : ''); - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Lucky!" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : ''), luckyCurSpan, goldCookTooltip)); + luckyCurSpan.textContent = Beautify(CM.Cache.GoldenCookiesMult * luckyCurBase) + (luckySplit ? (` / ${Beautify(CM.Cache.WrathCookiesMult * luckyCurBase)}`) : ''); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', `"Lucky!" Reward (CUR)${luckySplit ? ' (Golden / Wrath)' : ''}`, luckyCurSpan, goldCookTooltip)); return section; }; @@ -2571,84 +2463,84 @@ CM.Disp.CreateStatsLuckySection = function() { * This function creates the "Chain" section of the stats page * @returns {object} section The object contating the Chain section */ -CM.Disp.CreateStatsChainSection = function() { +CM.Disp.CreateStatsChainSection = function () { // This sets which tooltip to display for certain stats - let goldCookTooltip = Game.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder'; - - let section = document.createElement('div'); + const goldCookTooltip = Game.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder'; + + const section = document.createElement('div'); section.className = 'CMStatsChainSection'; - 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'); + const chainColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen; + const chainTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainRequired) ? CM.Disp.FormatTime((CM.Cache.ChainRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + const chainReqFrag = document.createDocumentFragment(); + const 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 != '') { - let chainReqSmall = document.createElement('small'); - chainReqSmall.textContent = ' (' + chainTime + ')'; + if (chainTime !== '') { + const chainReqSmall = document.createElement('small'); + chainReqSmall.textContent = ` (${chainTime})`; chainReqFrag.appendChild(chainReqSmall); } - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required', chainReqFrag, goldCookTooltip)); - - 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'); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', '"Chain" Cookies Required', chainReqFrag, goldCookTooltip)); + + const chainWrathColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrathRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen; + const chainWrathTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrathRequired) ? CM.Disp.FormatTime((CM.Cache.ChainWrathRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + const chainWrathReqFrag = document.createDocumentFragment(); + const 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 != '') { - let chainWrathReqSmall = document.createElement('small'); - chainWrathReqSmall.textContent = ' (' + chainWrathTime + ')'; + if (chainWrathTime !== '') { + const chainWrathReqSmall = document.createElement('small'); + chainWrathReqSmall.textContent = ` (${chainWrathTime})`; chainWrathReqFrag.appendChild(chainWrathReqSmall); } - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Wrath)', chainWrathReqFrag, goldCookTooltip)); - - 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'); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', '"Chain" Cookies Required (Wrath)', chainWrathReqFrag, goldCookTooltip)); + + const chainColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen; + const chainTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyRequired) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzyRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + const chainReqFrenFrag = document.createDocumentFragment(); + const 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 != '') { - let chainReqFrenSmall = document.createElement('small'); - chainReqFrenSmall.textContent = ' (' + chainTimeFrenzy + ')'; + if (chainTimeFrenzy !== '') { + const chainReqFrenSmall = document.createElement('small'); + chainReqFrenSmall.textContent = ` (${chainTimeFrenzy})`; chainReqFrenFrag.appendChild(chainReqFrenSmall); } - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Frenzy)', chainReqFrenFrag, goldCookTooltip)); - - 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'); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', '"Chain" Cookies Required (Frenzy)', chainReqFrenFrag, goldCookTooltip)); + + const chainWrathColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrathRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen; + const chainWrathTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrathRequired) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzyWrathRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + const chainWrathReqFrenFrag = document.createDocumentFragment(); + const 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 != '') { - let chainWrathReqFrenSmall = document.createElement('small'); - chainWrathReqFrenSmall.textContent = ' (' + chainWrathTimeFrenzy + ')'; + if (chainWrathTimeFrenzy !== '') { + const chainWrathReqFrenSmall = document.createElement('small'); + chainWrathReqFrenSmall.textContent = ` (${chainWrathTimeFrenzy})`; chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSmall); } - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Frenzy) (Wrath)', chainWrathReqFrenFrag, goldCookTooltip)); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', '"Chain" Cookies Required (Frenzy) (Wrath)', chainWrathReqFrenFrag, goldCookTooltip)); - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (MAX) (Golden / Wrath)', document.createTextNode(Beautify(CM.Cache.ChainMaxReward[0]) + ' / ' + Beautify(CM.Cache.ChainMaxWrathReward[0])), goldCookTooltip)); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', '"Chain" Reward (MAX) (Golden / Wrath)', document.createTextNode(`${Beautify(CM.Cache.ChainMaxReward[0])} / ${Beautify(CM.Cache.ChainMaxWrathReward[0])}`), goldCookTooltip)); - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode((Beautify(CM.Cache.ChainFrenzyMaxReward[0]) + ' / ' + Beautify(CM.Cache.ChainFrenzyMaxWrathReward[0]))), goldCookTooltip)); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', '"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode((`${Beautify(CM.Cache.ChainFrenzyMaxReward[0])} / ${Beautify(CM.Cache.ChainFrenzyMaxWrathReward[0])}`)), goldCookTooltip)); - let chainCurMax = Math.min(Game.cookiesPs * 60 * 60 * 6 * CM.Cache.DragonsFortuneMultAdjustment, Game.cookies * 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)); + const chainCurMax = Math.min(Game.cookiesPs * 60 * 60 * 6 * CM.Cache.DragonsFortuneMultAdjustment, Game.cookies * 0.5); + const chainCur = CM.Cache.MaxChainCookieReward(7, chainCurMax, CM.Cache.GoldenCookiesMult)[0]; + const 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)); - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'CPS Needed For Next Level (G / W)', document.createTextNode((Beautify(CM.Cache.ChainRequiredNext) + ' / ' + Beautify(CM.Cache.ChainWrathRequiredNext))), 'ChainNextLevelPlaceholder')); - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'CPS Needed For Next Level (Frenzy) (G / W)', document.createTextNode((Beautify(CM.Cache.ChainFrenzyRequiredNext) + ' / ' + Beautify(CM.Cache.ChainFrenzyWrathRequiredNext))), 'ChainNextLevelPlaceholder')); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', 'CPS Needed For Next Level (G / W)', document.createTextNode((`${Beautify(CM.Cache.ChainRequiredNext)} / ${Beautify(CM.Cache.ChainWrathRequiredNext)}`)), 'ChainNextLevelPlaceholder')); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', 'CPS Needed For Next Level (Frenzy) (G / W)', document.createTextNode((`${Beautify(CM.Cache.ChainFrenzyRequiredNext)} / ${Beautify(CM.Cache.ChainFrenzyWrathRequiredNext)}`)), 'ChainNextLevelPlaceholder')); return section; }; @@ -2656,47 +2548,47 @@ CM.Disp.CreateStatsChainSection = function() { * This function creates the "Spells" section of the stats page * @returns {object} section The object contating the Spells section */ -CM.Disp.CreateStatsSpellsSection = function() { - let section = document.createElement('div'); +CM.Disp.CreateStatsSpellsSection = function () { + const section = document.createElement('div'); section.className = 'CMStatsSpellsSection'; - 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()) : ''; - - let conjureReqFrag = document.createDocumentFragment(); - let conjureReqSpan = document.createElement('span'); + const conjureColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure) ? CM.Disp.colorRed : CM.Disp.colorGreen; + const conjureTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure) ? CM.Disp.FormatTime((CM.Cache.Conjure - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + + const conjureReqFrag = document.createDocumentFragment(); + const 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 != '') { - let conjureReqSmall = document.createElement('small'); - conjureReqSmall.textContent = ' (' + conjureTime + ')'; + if (conjureTime !== '') { + const 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')); - - 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()) : ''; - - let conjureFrenzyReqFrag = document.createDocumentFragment(); - let conjureFrenzyReqSpan = document.createElement('span'); + 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')); + + const conjureFrenzyColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.colorRed : CM.Disp.colorGreen; + const conjureFrenzyCur = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 30); + const 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()) : ''; + + const conjureFrenzyReqFrag = document.createDocumentFragment(); + const 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 != '') { - let conjureFrenzyReqSmall = document.createElement('small'); - conjureFrenzyReqSmall.textContent = ' (' + conjureFrenzyTime + ')'; + if (conjureFrenzyTime !== '') { + const conjureFrenzyReqSmall = document.createElement('small'); + conjureFrenzyReqSmall.textContent = ` (${conjureFrenzyTime})`; conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSmall); } - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Conjure Baked Goods" Cookies Required (Frenzy)', conjureFrenzyReqFrag, 'GoldCookTooltipPlaceholder')); - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Conjure Baked Goods" Reward (MAX) (Frenzy)', document.createTextNode(CM.Disp.Beautify(CM.Cache.ConjureReward * 7)), 'GoldCookTooltipPlaceholder')); - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Conjure Baked Goods" Reward (CUR)', document.createTextNode(CM.Disp.Beautify(conjureFrenzyCur)), 'GoldCookTooltipPlaceholder')); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', '"Conjure Baked Goods" Cookies Required (Frenzy)', conjureFrenzyReqFrag, 'GoldCookTooltipPlaceholder')); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', '"Conjure Baked Goods" Reward (MAX) (Frenzy)', document.createTextNode(CM.Disp.Beautify(CM.Cache.ConjureReward * 7)), 'GoldCookTooltipPlaceholder')); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', '"Conjure Baked Goods" Reward (CUR)', document.createTextNode(CM.Disp.Beautify(conjureFrenzyCur)), 'GoldCookTooltipPlaceholder')); if (CM.Cache.Edifice) { - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Spontaneous Edifice" Cookies Required (most expensive building)', document.createTextNode(CM.Disp.Beautify(CM.Cache.Edifice) + ' (' + CM.Cache.EdificeBuilding + ")"), 'GoldCookTooltipPlaceholder')); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', '"Spontaneous Edifice" Cookies Required (most expensive building)', document.createTextNode(`${CM.Disp.Beautify(CM.Cache.Edifice)} (${CM.Cache.EdificeBuilding})`), 'GoldCookTooltipPlaceholder')); } return section; }; @@ -2705,37 +2597,37 @@ CM.Disp.CreateStatsSpellsSection = function() { * This function creates the "Garden" section of the stats page * @returns {object} section The object contating the Spells section */ -CM.Disp.CreateStatsGardenSection = function() { - let section = document.createElement('div'); +CM.Disp.CreateStatsGardenSection = function () { + const section = document.createElement('div'); section.className = 'CMStatsGardenSection'; - - let bakeberryColor = (Game.cookies < Game.cookiesPs * 60 * 30) ? CM.Disp.colorRed : CM.Disp.colorGreen; - let bakeberryFrag = document.createElement('span'); + + const bakeberryColor = (Game.cookies < Game.cookiesPs * 60 * 30) ? CM.Disp.colorRed : CM.Disp.colorGreen; + const bakeberryFrag = document.createElement('span'); bakeberryFrag.style.fontWeight = 'bold'; bakeberryFrag.className = CM.Disp.colorTextPre + bakeberryColor; bakeberryFrag.textContent = Beautify(Game.cookiesPs * 60 * 30); - section.appendChild(CM.Disp.CreateStatsListing("basic", 'Cookies required for max reward of Bakeberry: ', bakeberryFrag)); - - let chocorootColor = (Game.cookies < Game.cookiesPs * 60 * 3) ? CM.Disp.colorRed : CM.Disp.colorGreen; - let chocorootFrag = document.createElement('span'); + section.appendChild(CM.Disp.CreateStatsListing('basic', 'Cookies required for max reward of Bakeberry: ', bakeberryFrag)); + + const chocorootColor = (Game.cookies < Game.cookiesPs * 60 * 3) ? CM.Disp.colorRed : CM.Disp.colorGreen; + const chocorootFrag = document.createElement('span'); chocorootFrag.style.fontWeight = 'bold'; chocorootFrag.className = CM.Disp.colorTextPre + chocorootColor; chocorootFrag.textContent = Beautify(Game.cookiesPs * 60 * 3); - section.appendChild(CM.Disp.CreateStatsListing("basic", 'Cookies required for max reward of Chocoroot: ', chocorootFrag)); + section.appendChild(CM.Disp.CreateStatsListing('basic', 'Cookies required for max reward of Chocoroot: ', chocorootFrag)); - let queenbeetColor = (Game.cookies < Game.cookiesPs * 60 * 60) ? CM.Disp.colorRed : CM.Disp.colorGreen; - let queenbeetFrag = document.createElement('span'); + const queenbeetColor = (Game.cookies < Game.cookiesPs * 60 * 60) ? CM.Disp.colorRed : CM.Disp.colorGreen; + const queenbeetFrag = document.createElement('span'); queenbeetFrag.style.fontWeight = 'bold'; queenbeetFrag.className = CM.Disp.colorTextPre + queenbeetColor; queenbeetFrag.textContent = Beautify(Game.cookiesPs * 60 * 60); - section.appendChild(CM.Disp.CreateStatsListing("basic", 'Cookies required for max reward of Queenbeet: ', queenbeetFrag)); + section.appendChild(CM.Disp.CreateStatsListing('basic', 'Cookies required for max reward of Queenbeet: ', queenbeetFrag)); - let duketaterColor = (Game.cookies < Game.cookiesPs * 60 * 120) ? CM.Disp.colorRed : CM.Disp.colorGreen; - let duketaterFrag = document.createElement('span'); + const duketaterColor = (Game.cookies < Game.cookiesPs * 60 * 120) ? CM.Disp.colorRed : CM.Disp.colorGreen; + const duketaterFrag = document.createElement('span'); duketaterFrag.style.fontWeight = 'bold'; duketaterFrag.className = CM.Disp.colorTextPre + duketaterColor; duketaterFrag.textContent = Beautify(Game.cookiesPs * 60 * 120); - section.appendChild(CM.Disp.CreateStatsListing("basic", 'Cookies required for max reward of Duketater: ', duketaterFrag)); + section.appendChild(CM.Disp.CreateStatsListing('basic', 'Cookies required for max reward of Duketater: ', duketaterFrag)); return section; }; @@ -2743,78 +2635,78 @@ CM.Disp.CreateStatsGardenSection = function() { * This function creates the "Prestige" section of the stats page * @returns {object} section The object contating the Prestige section */ -CM.Disp.CreateStatsPrestigeSection = function() { - let section = document.createElement('div'); +CM.Disp.CreateStatsPrestigeSection = function () { + const section = document.createElement('div'); section.className = 'CMStatsPrestigeSection'; - 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')); - - 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))); - 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')); + const 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')); - section.appendChild(CM.Disp.CreateStatsListing("basic", 'Heavenly Chips Per Second (last 5 seconds)', document.createTextNode(Beautify(CM.Cache.HCPerSecond, 2)))); - - let HCTarget = Number(CM.Options.HeavenlyChipsTarget) + const 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)); + const cookiesNextFrag = document.createDocumentFragment(); + cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook))); + const 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')); + + section.appendChild(CM.Disp.CreateStatsListing('basic', 'Heavenly Chips Per Second (last 5 seconds)', document.createTextNode(Beautify(CM.Cache.HCPerSecond, 2)))); + + const HCTarget = Number(CM.Options.HeavenlyChipsTarget); if (!isNaN(HCTarget)) { - let CookiesTillTarget = HCTarget - Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + const CookiesTillTarget = HCTarget - Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); if (CookiesTillTarget > 0) { - section.appendChild(CM.Disp.CreateStatsListing("basic", 'Heavenly Chips To Target Set In Settings (CUR)', document.createTextNode(Beautify(CookiesTillTarget)))); - section.appendChild(CM.Disp.CreateStatsListing("basic", 'Time To Target (CUR, Current 5 Second Average)', document.createTextNode(CM.Disp.FormatTime(CookiesTillTarget / CM.Cache.HCPerSecond)))); + section.appendChild(CM.Disp.CreateStatsListing('basic', 'Heavenly Chips To Target Set In Settings (CUR)', document.createTextNode(Beautify(CookiesTillTarget)))); + section.appendChild(CM.Disp.CreateStatsListing('basic', 'Time To Target (CUR, Current 5 Second Average)', document.createTextNode(CM.Disp.FormatTime(CookiesTillTarget / CM.Cache.HCPerSecond)))); } } - let resetBonus = CM.Sim.ResetBonus(possiblePresMax); - let resetFrag = document.createDocumentFragment(); + const resetBonus = CM.Sim.ResetBonus(possiblePresMax); + const resetFrag = document.createDocumentFragment(); resetFrag.appendChild(document.createTextNode(Beautify(resetBonus))); - let increase = Math.round(resetBonus / Game.cookiesPs * 10000); - if (isFinite(increase) && increase != 0) { - let resetSmall = document.createElement('small'); - resetSmall.textContent = ' (' + (increase / 100) + '% of income)'; + const increase = Math.round(resetBonus / Game.cookiesPs * 10000); + if (isFinite(increase) && increase !== 0) { + const resetSmall = document.createElement('small'); + resetSmall.textContent = ` (${increase / 100}% of income)`; resetFrag.appendChild(resetSmall); } - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'Reset Bonus Income', resetFrag, 'ResetTooltipPlaceholder')); + section.appendChild(CM.Disp.CreateStatsListing('withTooltip', 'Reset Bonus Income', resetFrag, 'ResetTooltipPlaceholder')); - let currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset)); - let willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); - let willGet = willHave - currentPrestige; + const currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset)); + const willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); + const willGet = willHave - currentPrestige; if (!Game.Has('Lucky digit')) { let delta7 = 7 - (willHave % 10); if (delta7 < 0) delta7 += 10; - 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)); + const next7Reset = willGet + delta7; + const next7Total = willHave + delta7; + const 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')) { let delta777 = 777 - (willHave % 1000); if (delta777 < 0) delta777 += 1000; - 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)); + const next777Reset = willGet + delta777; + const next777Total = willHave + delta777; + const 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')) { let delta777777 = 777777 - (willHave % 1000000); if (delta777777 < 0) delta777777 += 1000000; - 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)); + const next777777Reset = willGet + delta777777; + const next777777Total = willHave + delta777777; + const frag777777 = document.createDocumentFragment(); + frag777777.appendChild(document.createTextNode(`${next777777Total.toLocaleString()} / ${next777777Reset.toLocaleString()} (+${delta777777})`)); + section.appendChild(CM.Disp.CreateStatsListing('basic', 'Next "Lucky Payout" (total / reset)', frag777777)); } return section; @@ -2824,49 +2716,48 @@ CM.Disp.CreateStatsPrestigeSection = function() { * This function creates the missing upgrades sections for prestige, normal and cookie upgrades * It is called by CM.Disp.AddMenuStats() when CM.Options.MissingUpgrades is set */ -CM.Disp.AddMissingUpgrades = function() { - for (let menuSection of (l('menu').children)) { +CM.Disp.AddMissingUpgrades = function () { + for (const menuSection of (l('menu').children)) { if (menuSection.children[0]) { - if (menuSection.children[0].innerHTML === "Prestige" && CM.Cache.MissingUpgradesPrestige) { - let prestigeUpgradesMissing = CM.Cache.MissingUpgradesPrestige.match(new RegExp("div", "g") || []).length / 2; - let title = document.createElement('div'); - title.id = "CMMissingUpgradesPrestigeTitle"; - title.className = "listing"; - let titlefrag = document.createElement('div'); - titlefrag.innerHTML = 'Missing Prestige upgrades: '+ prestigeUpgradesMissing + '/' + Game.PrestigeUpgrades.length + ' (' + Math.floor((prestigeUpgradesMissing / Game.PrestigeUpgrades.length) * 100) + '%)'; + if (menuSection.children[0].innerHTML === 'Prestige' && CM.Cache.MissingUpgradesPrestige) { + const prestigeUpgradesMissing = CM.Cache.MissingUpgradesPrestige.match(new RegExp('div', 'g') || []).length / 2; + const title = document.createElement('div'); + title.id = 'CMMissingUpgradesPrestigeTitle'; + title.className = 'listing'; + const titlefrag = document.createElement('div'); + titlefrag.innerHTML = `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"; + const upgrades = document.createElement('div'); + upgrades.className = 'listing crateBox'; upgrades.innerHTML = CM.Cache.MissingUpgradesPrestige; menuSection.appendChild(upgrades); - } - else if (menuSection.children[0].innerHTML === "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) + '%)'; + const normalUpgradesMissing = CM.Cache.MissingUpgrades.match(new RegExp('div', 'g') || []).length / 2; + const title = document.createElement('div'); + title.id = 'CMMissingUpgradesTitle'; + title.className = 'listing'; + const 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"; + const upgrades = document.createElement('div'); + upgrades.className = 'listing crateBox'; upgrades.innerHTML = CM.Cache.MissingUpgrades; - menuSection.insertBefore(upgrades, document.getElementById("CMMissingUpgradesTitle").nextSibling); + 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) + '%)'; + const cookieUpgradesMissing = CM.Cache.MissingUpgradesCookies.match(new RegExp('div', 'g') || []).length / 2; + const title = document.createElement('div'); + title.id = 'CMMissingUpgradesCookiesTitle'; + title.className = 'listing'; + const 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"; + const upgrades = document.createElement('div'); + upgrades.className = 'listing crateBox'; upgrades.innerHTML = CM.Cache.MissingUpgradesCookies; menuSection.appendChild(upgrades); } @@ -2882,24 +2773,24 @@ CM.Disp.AddMissingUpgrades = function() { * @param {object} me The upgrade object * @returns {string} ? The HTML string that creates the icon. */ -CM.Disp.crateMissing = function(me) { +CM.Disp.crateMissing = function (me) { let classes = 'crate upgrade missing'; - if (me.pool === 'prestige') classes+=' heavenly'; - + 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');}`; + const tooltip = `function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`; return `
+ style = "${(`${icon[2] ? `background-image: url(${icon[2]});` : ''}background-position:${-icon[0] * 48}px ${-icon[1] * 48}px`)};">
`; }; -/******** +/** * Section: Functions related to the Stats page /** @@ -2907,11 +2798,11 @@ CM.Disp.crateMissing = function(me) { * It is called by CM.Disp.AddMenu * @param {object} title On object that includes the title of the menu */ -CM.Disp.AddMenuInfo = function(title) { - let info = document.createElement('div'); +CM.Disp.AddMenuInfo = function (title) { + const info = document.createElement('div'); info.className = 'subsection'; - let span = document.createElement('span'); + const span = document.createElement('span'); span.style.cursor = 'pointer'; span.style.display = 'inline-block'; span.style.height = '14px'; @@ -2923,43 +2814,42 @@ CM.Disp.AddMenuInfo = function(title) { span.style.fontSize = '13px'; span.style.verticalAlign = 'middle'; span.textContent = CM.Options.Header.InfoTab ? '-' : '+'; - span.onclick = function() {CM.Config.ToggleHeader('InfoTab'); Game.UpdateMenu();}; + span.onclick = function () { CM.Config.ToggleHeader('InfoTab'); Game.UpdateMenu(); }; title.appendChild(span); info.appendChild(title); if (CM.Options.Header.InfoTab) { - let description = document.createElement('div') - description.innerHTML = CM.Data.ModDescription - info.appendChild(description) - let notes = document.createElement('div') - notes.innerHTML = CM.Data.LatestReleaseNotes - info.appendChild(notes) + const description = document.createElement('div'); + description.innerHTML = CM.Data.ModDescription; + info.appendChild(description); + const notes = document.createElement('div'); + notes.innerHTML = CM.Data.LatestReleaseNotes; + info.appendChild(notes); } - let menu = l('menu').children[1] - menu.insertBefore(info, menu.children[1]) -} + const menu = l('menu').children[1]; + menu.insertBefore(info, menu.children[1]); +}; - -/******** +/** * Section: Functions related to the left column of the page */ /** * This function creates two objects at the bottom of the left column that allowing popping of wrinklers * It is called by CM.Main.DelayInit() */ -CM.Disp.CreateWrinklerButtons = function() { - let popAllA = document.createElement('a'); - popAllA.id = "PopAllNormalWrinklerButton"; +CM.Disp.CreateWrinklerButtons = function () { + const popAllA = document.createElement('a'); + popAllA.id = 'PopAllNormalWrinklerButton'; popAllA.textContent = 'Pop All Normal'; popAllA.className = 'option'; - popAllA.onclick = function() { CM.Disp.PopAllNormalWrinklers(); }; + popAllA.onclick = function () { CM.Disp.PopAllNormalWrinklers(); }; l('sectionLeftExtra').children[0].append(popAllA); - let popFattestA = document.createElement('a'); - popFattestA.id = "PopFattestWrinklerButton"; + const 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; }; + popFattestA.onclick = function () { if (CM.Cache.WrinklersFattest[1]) Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; }; l('sectionLeftExtra').children[0].append(popFattestA); }; @@ -2967,36 +2857,35 @@ CM.Disp.CreateWrinklerButtons = function() { * This function updates the display setting of the two objects created by CM.Disp.CreateWrinklerButtons() * It is called by changes in CM.Options.WrinklerButtons */ -CM.Disp.UpdateWrinklerButtons = function() { +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"; + l('PopAllNormalWrinklerButton').style.display = ''; + l('PopFattestWrinklerButton').style.display = ''; + } else { + l('PopAllNormalWrinklerButton').style.display = 'none'; + l('PopFattestWrinklerButton').style.display = 'none'; } }; -/******** +/** * Section: Variables used in Disp functions */ /** * This list is used to make some very basic tooltips. * It is used by CM.Main.DelayInit() in the call of CM.Disp.CreateSimpleTooltip() - * @item {string} placeholder - * @item {string} text - * @item {string} minWidth + * @item {string} placeholder + * @item {string} text + * @item {string} minWidth */ 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'], + ['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'], - ['ChainNextLevelPlaceholder', 'Cheated cookies might break this formula', '250px'] + ['ChainNextLevelPlaceholder', 'Cheated cookies might break this formula', '250px'], ]; /** @@ -3020,11 +2909,12 @@ CM.Disp.colorPink = 'Pink'; CM.Disp.colorBrown = 'Brown'; CM.Disp.colors = [CM.Disp.colorGray, CM.Disp.colorBlue, CM.Disp.colorGreen, CM.Disp.colorYellow, CM.Disp.colorOrange, CM.Disp.colorRed, CM.Disp.colorPurple, CM.Disp.colorPink, CM.Disp.colorBrown]; - /** * This array is used to give certain timers specific colours */ -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.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, +}; /** * This array is used to track GC timers @@ -3032,7 +2922,7 @@ CM.Disp.buffColors = {'Frenzy': CM.Disp.colorYellow, 'Dragon Harvest': CM.Disp.c CM.Disp.GCTimers = {}; /** - * These arrays 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]; @@ -3052,7 +2942,6 @@ CM.Disp.TooltipWrinklerBeingShown = []; CM.Disp.TooltipWrinklerArea = 0; CM.Disp.TooltipWrinkler = -1; - /** * Used to store the number of cookies to be displayed in the tab-title */ diff --git a/src/Footer.js b/src/Footer.js index 48ab13b..baa64db 100644 --- a/src/Footer.js +++ b/src/Footer.js @@ -1,8 +1,8 @@ -/********** +/** * Footer * - **********/ + */ -/******** +/** * Section: Functions related to base game modding API */ /** @@ -11,18 +11,18 @@ * declare hooks here" * It starts the further initialization of CookieMonster and registers hooks */ -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.init = function () { + CM.Footer.isInitzializing = true; + let proceed = true; + if (Game.version !== Number(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; + } }; /** @@ -30,39 +30,39 @@ CM.init = function() { * "use this to store persistent data associated with your mod * return 'a string to be saved';" */ -CM.save = function() { - return JSON.stringify({ - settings: CM.Options, - version: CM.VersionMajor + '.' + CM.VersionMinor, - }); +CM.save = function () { + return JSON.stringify({ + settings: CM.Options, + version: `${CM.VersionMajor}.${CM.VersionMinor}`, + }); }; /** * This registers a load function to the CM object. Per Game code/comments: * "do stuff with the string data you saved previously" */ -CM.load = function(str) { - let save = JSON.parse(str); - CM.Config.LoadConfig(save.settings); - if (save.version !== CM.VersionMajor + '.' + CM.VersionMinor) { - if (Game.prefs.popups) Game.Popup('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!'); - else Game.Notify('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!', '', '', 0, 1); - } +CM.load = function (str) { + const save = JSON.parse(str); + CM.Config.LoadConfig(save.settings); + if (save.version !== `${CM.VersionMajor}.${CM.VersionMinor}`) { + if (Game.prefs.popups) Game.Popup('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!'); + else Game.Notify('A new version of Cookie Monster has been loaded, check out the release notes in the info tab!', '', '', 0, 1); + } }; -/******** +/** * Section: Functions related to the initialization of CookieMonster */ /** - * This functions loads an external script (on the same repository) that creates the + * This functions loads an external script (on the same repository) that creates the * functionality needed to dynamiccaly change colours * It is called by the last function in the footer */ -CM.Footer.AddJscolor = function() { +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); + document.head.appendChild(CM.Footer.Jscolor); }; /** @@ -70,12 +70,12 @@ CM.Footer.AddJscolor = function() { * It is called as the last function in this script's execution */ 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 + CM.Footer.AddJscolor(); + const delay = setInterval(function () { + if (typeof jscolor !== 'undefined') { + jscolor.init(); + Game.registerMod('CookieMonster', CM); + clearInterval(delay); + } + }, 500); +} diff --git a/src/Header.js b/src/Header.js index 3b0ea79..62d4197 100644 --- a/src/Header.js +++ b/src/Header.js @@ -1,19 +1,18 @@ -/* eslint-disable no-redeclare */ /* eslint-disable no-unused-vars */ -/********** +/** * Header * - **********/ + */ const CM = { - Backup: {}, - Cache: {}, - Config: {}, - Data: {Config: {}}, - Disp: {}, - Footer: {}, - Main: {}, - Options: {}, - Sim: {}, - VersionMajor: '2.031', - VersionMinor: '4', + Backup: {}, + Cache: {}, + Config: {}, + Data: { Config: {} }, + Disp: {}, + Footer: {}, + Main: {}, + Options: {}, + Sim: {}, + VersionMajor: '2.031', + VersionMinor: '4', }; diff --git a/src/Main.js b/src/Main.js index 804a085..460142b 100644 --- a/src/Main.js +++ b/src/Main.js @@ -1,28 +1,28 @@ -/******** +/** * Main * - ********/ + */ -/******** +/** * Section: Functions related to the main and initialization loop */ /** * Main loop of Cookie Monster * CM.init registers it to the "logic" hook provided by the modding api */ -CM.Main.Loop = function() { - if (CM.Disp.lastAscendState != Game.OnAscend) { +CM.Main.Loop = function () { + if (CM.Disp.lastAscendState !== Game.OnAscend) { CM.Disp.lastAscendState = Game.OnAscend; CM.Disp.UpdateAscendState(); } if (!Game.OnAscend && Game.AscendTimer === 0) { // Check if any other mods have been loaded - if (CM.Main.LastModCount != Object.keys(Game.mods).length) { + if (CM.Main.LastModCount !== Object.keys(Game.mods).length) { CM.Sim.CreateSimFunctions(); CM.Sim.InitData(); CM.Cache.InitCache(); CM.Main.LastModCount = Object.keys(Game.mods).length; } - + // CM.Sim.DoSims is set whenever CPS has changed if (CM.Sim.DoSims) { CM.Cache.CacheIncome(); @@ -41,12 +41,11 @@ CM.Main.Loop = function() { } // Check for aura change to recalculate buildings prices - let hasBuildAura = Game.auraMult('Fierce Hoarder') > 0; + const 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) { + } else if (CM.Cache.HadBuildAura && !hasBuildAura) { CM.Cache.HadBuildAura = false; CM.Cache.DoRemakeBuildPrices = 1; } @@ -72,7 +71,7 @@ CM.Main.Loop = function() { * Initialization loop of Cookie Monster * Called by CM.init() */ -CM.Main.DelayInit = function() { +CM.Main.DelayInit = function () { // Create CM.Sim functions CM.Sim.CreateSimFunctions(); @@ -80,7 +79,7 @@ CM.Main.DelayInit = function() { CM.Cache.InitCache(); // Stored to check if we need to re-initiliaze data - CM.Main.LastModCount = Object.keys(Game.mods).length + CM.Main.LastModCount = Object.keys(Game.mods).length; // Creating visual elements CM.Disp.CreateCssArea(); @@ -89,7 +88,7 @@ CM.Main.DelayInit = function() { CM.Disp.CreateUpgradeBar(); CM.Disp.CreateWhiteScreen(); CM.Disp.CreateFavicon(); - for (let i of Object.keys(CM.Disp.TooltipText)) { + for (const 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(); @@ -105,61 +104,61 @@ CM.Main.DelayInit = function() { CM.Config.LoadConfig(); // Must be after all things are created! 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); + 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'); - }; -/******** +/** * Section: Functions related to replacing stuff */ /** * This function replaces certain native (from the base-game) functions * It is called by CM.Main.DelayInit() */ -CM.Main.ReplaceNative = function() { +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() { + 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) { + 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() { + 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() { + Game.UpdateWrinklers = function () { CM.Main.FixMouseY(CM.Backup.UpdateWrinklers); }; CM.Backup.UpdateSpecial = Game.UpdateSpecial; - Game.UpdateSpecial = function() { + Game.UpdateSpecial = function () { CM.Main.FixMouseY(CM.Backup.UpdateSpecial); }; // Assumes newer browsers l('bigCookie').removeEventListener('click', Game.ClickCookie, false); - l('bigCookie').addEventListener('click', function() { CM.Main.FixMouseY(Game.ClickCookie); }, false); + l('bigCookie').addEventListener('click', function () { CM.Main.FixMouseY(Game.ClickCookie); }, false); CM.Backup.RebuildUpgrades = Game.RebuildUpgrades; - Game.RebuildUpgrades = function() { + Game.RebuildUpgrades = function () { CM.Backup.RebuildUpgrades(); CM.Disp.ReplaceTooltipUpgrade(); Game.CalculateGains(); @@ -168,9 +167,9 @@ CM.Main.ReplaceNative = function() { CM.Backup.ClickProduct = Game.ClickProduct; /** * This function adds a check to the purchase of a building to allow BulkBuyBlock to work. - * If the options is 1 (on) bulkPrice is under cookies you can't buy the building. + * If the options is 1 (on) bulkPrice is under cookies you can't buy the building. */ - Game.ClickProduct = function(what) { + Game.ClickProduct = function (what) { if (!CM.Options.BulkBuyBlock || Game.ObjectsById[what].bulkPrice < Game.cookies) { CM.Backup.ClickProduct(what); } @@ -182,7 +181,7 @@ CM.Main.ReplaceNative = function() { * This adds information about CPS differences and costs to the aura choosing interface * @param {number} aura The number of the aura currently selected by the mouse/user */ - Game.DescribeDragonAura = function(aura) { + Game.DescribeDragonAura = function (aura) { CM.Backup.DescribeDragonAura(aura); CM.Disp.AddAuraInfo(aura); }; @@ -191,13 +190,13 @@ CM.Main.ReplaceNative = function() { /** * This function adds the code to display the tooltips for the levelUp button of the dragon */ - Game.ToggleSpecialMenu = function(on) { + Game.ToggleSpecialMenu = function (on) { CM.Backup.ToggleSpecialMenu(on); CM.Disp.AddDragonLevelUpTooltip(); }; CM.Backup.UpdateMenu = Game.UpdateMenu; - Game.UpdateMenu = function() { + Game.UpdateMenu = function () { if (typeof jscolor.picker === 'undefined' || typeof jscolor.picker.owner === 'undefined') { CM.Backup.UpdateMenu(); CM.Disp.AddMenu(); @@ -205,21 +204,21 @@ CM.Main.ReplaceNative = function() { }; CM.Backup.sayTime = Game.sayTime; - CM.Disp.sayTime = function(time, detail) { - if (isNaN(time) || time <= 0) return CM.Backup.sayTime(time, detail); + CM.Disp.sayTime = function (time, detail) { + if (Number.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; + CM.Backup.Logic = Game.Logic; CM.Backup.LogicMod = new Function( `return ${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 ? `
It takes ${CM.Cache.TimeTillNextPrestige} to reach the next level and you are making ${Beautify(CM.Cache.HCPerSecond, 2)} chips on average in the last 5 seconds.
` : ``}`;")}`, + .split('document.title') + .join('CM.Disp.Title') + .split("' more cookies for the next level.
';") + .join("` more cookies for the next level.
${CM.Options.TooltipAscendButton ? `
It takes ${CM.Cache.TimeTillNextPrestige} to reach the next level and you are making ${Beautify(CM.Cache.HCPerSecond, 2)} chips on average in the last 5 seconds.
` : ``}`;")}`, )(); - Game.Logic = function() { + Game.Logic = function () { CM.Backup.LogicMod(); // Update Title CM.Disp.UpdateTitle(); @@ -230,7 +229,7 @@ CM.Main.ReplaceNative = function() { * This function fixes replaces the Launch and Draw functions of the Grimoire * It is called by CM.Main.DelayInit() and Game.LoadMinigames() */ -CM.Main.ReplaceNativeGrimoire = function() { +CM.Main.ReplaceNativeGrimoire = function () { CM.Main.ReplaceNativeGrimoireLaunch(); CM.Main.ReplaceNativeGrimoireDraw(); }; @@ -239,12 +238,12 @@ CM.Main.ReplaceNativeGrimoire = function() { * This function fixes replaces the .launch function of the Grimoire * It is called by CM.Main.ReplaceNativeGrimoire() */ -CM.Main.ReplaceNativeGrimoireLaunch = function() { +CM.Main.ReplaceNativeGrimoireLaunch = function () { if (!CM.Main.HasReplaceNativeGrimoireLaunch && Game.Objects['Wizard tower'].minigameLoaded) { - let minigame = Game.Objects['Wizard tower'].minigame; + const 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() { + 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; @@ -258,35 +257,35 @@ CM.Main.ReplaceNativeGrimoireLaunch = function() { * This function fixes replaces the .draw function of the Grimoire * It is called by CM.Main.ReplaceNativeGrimoire() */ -CM.Main.ReplaceNativeGrimoireDraw = function() { +CM.Main.ReplaceNativeGrimoireDraw = function () { if (!CM.Main.HasReplaceNativeGrimoireDraw && Game.Objects['Wizard tower'].minigameLoaded) { - let minigame = Game.Objects['Wizard tower'].minigame; + const minigame = Game.Objects['Wizard tower'].minigame; CM.Backup.GrimoireDraw = minigame.draw; - Game.Objects['Wizard tower'].minigame.draw = function() { + Game.Objects['Wizard tower'].minigame.draw = function () { CM.Backup.GrimoireDraw(); if (CM.Options.GrimoireBar === 1 && minigame.magic < minigame.magicM) { - minigame.magicBarTextL.innerHTML += ' (' + CM.Disp.FormatTime(CM.Disp.CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM)) + ')'; + minigame.magicBarTextL.innerHTML += ` (${CM.Disp.FormatTime(CM.Disp.CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM))})`; } }; CM.Main.HasReplaceNativeGrimoireDraw = true; } }; -/******** +/** * Section: Functions related to first initizalition of CM */ /** * This function call all functions that replace Game-tooltips with CM-enhanced tooltips * It is called by CM.Main.DelayInit() */ -CM.Main.ReplaceTooltips = function() { +CM.Main.ReplaceTooltips = function () { CM.Main.ReplaceTooltipBuild(); CM.Main.ReplaceTooltipLump(); // Replace Tooltips of Minigames. Nesting it in LoadMinigames makes sure to replace them even if // they were not loaded initially CM.Backup.LoadMinigames = Game.LoadMinigames; - Game.LoadMinigames = function() { + Game.LoadMinigames = function () { CM.Backup.LoadMinigames(); CM.Main.ReplaceTooltipGarden(); CM.Main.ReplaceTooltipGrimoire(); @@ -295,7 +294,7 @@ CM.Main.ReplaceTooltips = function() { Game.LoadMinigames(); }; -/******** +/** * Section: Functions related to replacing tooltips */ /** @@ -303,13 +302,13 @@ CM.Main.ReplaceTooltips = function() { * CM.Disp.Tooltip() sets the tooltip type to 'b' * It is called by CM.Main.ReplaceTooltips() */ -CM.Main.ReplaceTooltipBuild = function() { +CM.Main.ReplaceTooltipBuild = function () { CM.Main.TooltipBuildBackup = []; - for (let i of Object.keys(Game.Objects)) { - 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();}'); + for (const i of Object.keys(Game.Objects)) { + const 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();}`); } } }; @@ -319,10 +318,10 @@ CM.Main.ReplaceTooltipBuild = function() { * CM.Disp.Tooltip() sets the tooltip type to 's' * It is called by CM.Main.ReplaceTooltips() */ -CM.Main.ReplaceTooltipLump = function() { +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();}'); + eval('l(\'lumps\').onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'s\', \'Lump\');}, \'this\'); Game.tooltip.wobble();}'); } }; @@ -331,13 +330,13 @@ CM.Main.ReplaceTooltipLump = function() { * CM.Disp.Tooltip() sets the tooltip type to 'g' * It is called by CM.Main.ReplaceTooltips() */ -CM.Main.ReplaceTooltipGrimoire = function() { +CM.Main.ReplaceTooltipGrimoire = function () { if (Game.Objects['Wizard tower'].minigameLoaded) { CM.Main.TooltipGrimoireBackup = []; - for (let i in Game.Objects['Wizard tower'].minigame.spellsById) { - if (l('grimoireSpell' + i).onmouseover != null) { - CM.Main.TooltipGrimoireBackup[i] = l('grimoireSpell' + i).onmouseover; - eval('l(\'grimoireSpell\' + i).onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'g\', \'' + i + '\');}, \'this\'); Game.tooltip.wobble();}'); + for (const i in Game.Objects['Wizard tower'].minigame.spellsById) { + if (l(`grimoireSpell${i}`).onmouseover !== null) { + CM.Main.TooltipGrimoireBackup[i] = l(`grimoireSpell${i}`).onmouseover; + eval(`l('grimoireSpell' + i).onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('g', '${i}');}, 'this'); Game.tooltip.wobble();}`); } } } @@ -348,28 +347,28 @@ CM.Main.ReplaceTooltipGrimoire = function() { * CM.Disp.Tooltip() sets the tooltip type to 'p' * It is called by CM.Main.ReplaceTooltips() */ -CM.Main.ReplaceTooltipGarden = function() { +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();}; + 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) => { - 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();}; + const 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(); }; }); } }; -/******** +/** * Section: Functions related to checking for changes in Minigames/GC's/Ticker */ /** - * Auxilirary function that finds all currently spawned shimmers. + * Auxilirary function that finds all currently spawned shimmers. * CM.Cache.spawnedGoldenShimmer stores the non-user spawned cookie to later determine data for the favicon and tab-title * It is called by CM.CM.Main.CheckGoldenCookie */ -CM.Main.FindShimmer = function() { +CM.Main.FindShimmer = function () { CM.Main.currSpawnedGoldenCookieState = 0; CM.Cache.goldenShimmersByID = {}; - for (let i of Object.keys(Game.shimmers)) { + for (const 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]; @@ -382,25 +381,25 @@ CM.Main.FindShimmer = function() { * This function checks for changes in the amount of Golden Cookies * It is called by CM.Main.Loop */ -CM.Main.CheckGoldenCookie = function() { +CM.Main.CheckGoldenCookie = function () { CM.Main.FindShimmer(); - for (let i of Object.keys(CM.Disp.GCTimers)) { - if (typeof CM.Cache.goldenShimmersByID[i] === "undefined") { + for (const 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) { + if (CM.Main.lastGoldenCookieState !== Game.shimmerTypes.golden.n) { CM.Main.lastGoldenCookieState = Game.shimmerTypes.golden.n; if (CM.Main.lastGoldenCookieState) { if (CM.Main.lastSpawnedGoldenCookieState < CM.Main.currSpawnedGoldenCookieState) { CM.Disp.Flash(3, 'GCFlash'); CM.Disp.PlaySound(CM.Options.GCSoundURL, 'GCSound', 'GCVolume'); - CM.Disp.Notification('GCNotification', "Golden Cookie Spawned", "A Golden Cookie has spawned. Click it now!"); + CM.Disp.Notification('GCNotification', 'Golden Cookie Spawned', 'A Golden Cookie has spawned. Click it now!'); } - - for (let i of Object.keys(Game.shimmers)) { - if (typeof CM.Disp.GCTimers[Game.shimmers[i].id] === "undefined") { + + for (const i of Object.keys(Game.shimmers)) { + if (typeof CM.Disp.GCTimers[Game.shimmers[i].id] === 'undefined') { CM.Disp.CreateGCTimer(Game.shimmers[i]); } } @@ -408,9 +407,8 @@ CM.Main.CheckGoldenCookie = function() { CM.Disp.UpdateFavicon(); CM.Main.lastSpawnedGoldenCookieState = CM.Main.currSpawnedGoldenCookieState; if (CM.Main.currSpawnedGoldenCookieState === 0) CM.Cache.spawnedGoldenShimmer = 0; - } - else if (CM.Options.GCTimer === 1 && CM.Main.lastGoldenCookieState) { - for (let i of Object.keys(CM.Disp.GCTimers)) { + } else if (CM.Options.GCTimer === 1 && CM.Main.lastGoldenCookieState) { + for (const i of Object.keys(CM.Disp.GCTimers)) { CM.Disp.GCTimers[i].style.opacity = CM.Cache.goldenShimmersByID[i].l.style.opacity; CM.Disp.GCTimers[i].style.transform = CM.Cache.goldenShimmersByID[i].l.style.transform; CM.Disp.GCTimers[i].textContent = Math.ceil(CM.Cache.goldenShimmersByID[i].life / Game.fps); @@ -422,10 +420,10 @@ CM.Main.CheckGoldenCookie = function() { * This function checks if there is reindeer that has spawned * It is called by CM.Main.Loop */ -CM.Main.CheckSeasonPopup = function() { - if (CM.Main.lastSeasonPopupState != Game.shimmerTypes.reindeer.spawned) { +CM.Main.CheckSeasonPopup = function () { + if (CM.Main.lastSeasonPopupState !== Game.shimmerTypes.reindeer.spawned) { CM.Main.lastSeasonPopupState = Game.shimmerTypes.reindeer.spawned; - for (let i of Object.keys(Game.shimmers)) { + for (const i of Object.keys(Game.shimmers)) { if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') { CM.Cache.seasonPopShimmer = Game.shimmers[i]; break; @@ -433,7 +431,7 @@ CM.Main.CheckSeasonPopup = function() { } CM.Disp.Flash(3, 'SeaFlash'); CM.Disp.PlaySound(CM.Options.SeaSoundURL, 'SeaSound', 'SeaVolume'); - CM.Disp.Notification('SeaNotification',"Reindeer sighted!", "A Reindeer has spawned. Click it now!"); + CM.Disp.Notification('SeaNotification', 'Reindeer sighted!', 'A Reindeer has spawned. Click it now!'); } }; @@ -441,13 +439,13 @@ CM.Main.CheckSeasonPopup = function() { * This function checks if there is a fortune cookie on the ticker * It is called by CM.Main.Loop */ -CM.Main.CheckTickerFortune = function() { - if (CM.Main.lastTickerFortuneState != (Game.TickerEffect && Game.TickerEffect.type === 'fortune')) { +CM.Main.CheckTickerFortune = function () { + if (CM.Main.lastTickerFortuneState !== (Game.TickerEffect && Game.TickerEffect.type === 'fortune')) { CM.Main.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type === 'fortune'); if (CM.Main.lastTickerFortuneState) { CM.Disp.Flash(3, 'FortuneFlash'); CM.Disp.PlaySound(CM.Options.FortuneSoundURL, 'FortuneSound', 'FortuneVolume'); - CM.Disp.Notification('FortuneNotification', "Fortune Cookie found", "A Fortune Cookie has appeared on the Ticker."); + CM.Disp.Notification('FortuneNotification', 'Fortune Cookie found', 'A Fortune Cookie has appeared on the Ticker.'); } } }; @@ -456,9 +454,9 @@ CM.Main.CheckTickerFortune = function() { * This function checks if a garden tick has happened * It is called by CM.Main.Loop */ -CM.Main.CheckGardenTick = function() { - if (Game.Objects.Farm.minigameLoaded && CM.Main.lastGardenNextStep != Game.Objects.Farm.minigame.nextStep) { - if (CM.Main.lastGardenNextStep != 0 && CM.Main.lastGardenNextStep < Date.now()) { +CM.Main.CheckGardenTick = function () { + if (Game.Objects.Farm.minigameLoaded && CM.Main.lastGardenNextStep !== Game.Objects.Farm.minigame.nextStep) { + if (CM.Main.lastGardenNextStep !== 0 && CM.Main.lastGardenNextStep < Date.now()) { CM.Disp.Flash(3, 'GardFlash'); CM.Disp.PlaySound(CM.Options.GardSoundURL, 'GardSound', 'GardVolume'); } @@ -470,15 +468,15 @@ CM.Main.CheckGardenTick = function() { * This function checks if the magic meter is full * It is called by CM.Main.Loop */ -CM.Main.CheckMagicMeter = function() { +CM.Main.CheckMagicMeter = function () { if (Game.Objects['Wizard tower'].minigameLoaded && CM.Options.GrimoireBar === 1) { - let minigame = Game.Objects['Wizard tower'].minigame; + const minigame = Game.Objects['Wizard tower'].minigame; if (minigame.magic < minigame.magicM) CM.Main.lastMagicBarFull = false; else if (!CM.Main.lastMagicBarFull) { CM.Main.lastMagicBarFull = true; CM.Disp.Flash(3, 'MagicFlash'); CM.Disp.PlaySound(CM.Options.MagicSoundURL, 'MagicSound', 'MagicVolume'); - CM.Disp.Notification('MagicNotification', "Magic Meter full", "Your Magic Meter is full. Cast a spell!"); + CM.Disp.Notification('MagicNotification', 'Magic Meter full', 'Your Magic Meter is full. Cast a spell!'); } } }; @@ -487,10 +485,10 @@ CM.Main.CheckMagicMeter = function() { * This function checks if any new Wrinklers have popped up * It is called by CM.Main.Loop */ -CM.Main.CheckWrinklerCount = function() { +CM.Main.CheckWrinklerCount = function () { if (Game.elderWrath > 0) { let CurrentWrinklers = 0; - for (let i in Game.wrinklers) { + for (const i in Game.wrinklers) { if (Game.wrinklers[i].phase === 2) CurrentWrinklers++; } if (CurrentWrinklers > CM.Main.lastWrinklerCount) { @@ -505,10 +503,10 @@ CM.Main.CheckWrinklerCount = function() { } 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"); + 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"); + CM.Disp.Notification('WrinklerNotification', 'A Wrinkler appeared', 'A new wrinkler has appeared'); } } else { CM.Main.lastWrinklerCount = CurrentWrinklers; @@ -521,18 +519,18 @@ CM.Main.CheckWrinklerCount = function() { * It is called by CM.Main.DelayInit * 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;}; - l('backgroundLeftCanvas').onmouseout = function() { +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)) { + for (const i of Object.keys(Game.wrinklers)) { CM.Disp.TooltipWrinklerBeingShown[i] = 0; } }; }; -/******** +/** * Section: Functions related to the mouse */ /** @@ -540,14 +538,13 @@ CM.Main.AddWrinklerAreaDetect = function() { * It is called by Game.UpdateWrinklers(), Game.UpdateSpecial() and the .onmousover of the BigCookie * before execution of their actual function */ -CM.Main.FixMouseY = function(target) { +CM.Main.FixMouseY = function (target) { if (CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) { - let timerBarHeight = parseInt(CM.Disp.TimerBar.style.height); + const timerBarHeight = parseInt(CM.Disp.TimerBar.style.height); Game.mouseY -= timerBarHeight; target(); Game.mouseY += timerBarHeight; - } - else { + } else { target(); } }; diff --git a/src/Sim.js b/src/Sim.js index e933faa..25b223f 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -1,8 +1,8 @@ -/******* +/** * Sim * - *******/ + */ -/******** +/** * Section: Functions to calculate building buy and sell prices */ /** @@ -16,10 +16,10 @@ * @param {number} increase Increase of building * @returns {number} moni Total price */ -CM.Sim.BuildingGetPrice = function(build, basePrice, start, free, increase) { +CM.Sim.BuildingGetPrice = function (build, basePrice, start, free, increase) { let moni = 0; for (let i = 0; i < increase; i++) { - let price = basePrice * Math.pow(Game.priceIncrease, Math.max(0, start - free)); + let price = basePrice * Game.priceIncrease ** Math.max(0, start - free); price = Game.modifyBuildingPrice(build, price); price = Math.ceil(price); moni += price; @@ -35,13 +35,13 @@ CM.Sim.BuildingGetPrice = function(build, basePrice, start, free, increase) { * @param {number} price Current price of building * @returns {number} price The modified building price */ -CM.Sim.modifyBuildingPrice = function(building, price) { +CM.Sim.modifyBuildingPrice = function (building, price) { if (CM.Sim.Has('Season savings')) price *= 0.99; if (CM.Sim.Has('Santa\'s dominion')) price *= 0.99; if (CM.Sim.Has('Faberge egg')) price *= 0.99; if (CM.Sim.Has('Divine discount')) price *= 0.99; if (CM.Sim.Has('Fortune #100')) price *= 0.99; - //if (CM.Sim.hasAura('Fierce Hoarder')) price *= 0.98; + // if (CM.Sim.hasAura('Fierce Hoarder')) price *= 0.98; price *= 1 - CM.Sim.auraMult('Fierce Hoarder') * 0.02; if (Game.hasBuff('Everything must go')) price *= 0.95; if (Game.hasBuff('Crafty pixies')) price *= 0.98; @@ -49,7 +49,7 @@ CM.Sim.modifyBuildingPrice = function(building, price) { if (building.fortune && CM.Sim.Has(building.fortune.name)) price *= 0.93; price *= CM.Sim.eff('buildingCost'); if (CM.Sim.Objects.Temple.minigameLoaded) { - let godLvl = CM.Sim.hasGod('creation'); + const godLvl = CM.Sim.hasGod('creation'); if (godLvl === 1) price *= 0.93; else if (godLvl === 2) price *= 0.95; else if (godLvl === 3) price *= 0.98; @@ -62,7 +62,7 @@ CM.Sim.modifyBuildingPrice = function(building, price) { * It is called by CM.Sim.BuildingSell() * @returns {number} giveBack The multiplier */ -CM.Sim.getSellMultiplier = function() { +CM.Sim.getSellMultiplier = function () { let giveBack = 0.25; giveBack *= 1 + CM.Sim.auraMult('Earth Shatterer'); return giveBack; @@ -80,18 +80,18 @@ CM.Sim.getSellMultiplier = function() { * @param {number} noSim 1 of 0 depending on if function is called from CM.Sim * @returns {number} moni Total price gained */ -CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, noSim) { +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; + noSim = typeof noSim === 'undefined' ? 0 : noSim; 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)); + let price = basePrice * Game.priceIncrease ** Math.max(0, start - free); price = noSim ? Game.modifyBuildingPrice(build, price) : CM.Sim.modifyBuildingPrice(build, price); price = Math.ceil(price); - let giveBack = noSim ? build.getSellMultiplier() : CM.Sim.getSellMultiplier(); + const giveBack = noSim ? build.getSellMultiplier() : CM.Sim.getSellMultiplier(); price = Math.floor(price * giveBack); if (start > 0) { moni += price; @@ -101,60 +101,60 @@ CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, noSim) { return moni; }; -/******** +/** * Section: Functions related to making functions that check against sim data rather than game data */ /** * This functions helps create functions that check sim data * For example, instead of Game.Has, a function that has gone through CM.Sim.ReplaceFunction will use CM.Sim.Has() * Subsequently the function rather than checking Game.Upgrades, will check CM.Sim.Upgrades - * + * * It is called by CM.Sim.ReplaceRelevantFunctions() * @param {function} funcToBeReplaced Function to be replaced * @returns {string} The function in string form with only calls to CM.Sim */ -CM.Sim.ReplaceFunction = function(funcToBeReplaced) { +CM.Sim.ReplaceFunction = function (funcToBeReplaced) { return funcToBeReplaced.toString() - .split("Game.Upgrades[") // Include '[' to not replace Game.UpgradesByPool - .join("CM.Sim.Upgrades[") - .split("Game.Achievements") - .join("CM.Sim.Achievements") - .split("Game.Has") - .join("CM.Sim.Has") - .split("Game.dragonAura]") - .join("CM.Sim.dragonAura]") - .split("Game.dragonAura2]") - .join("CM.Sim.dragonAura2]") - .split("Game.auraMult") - .join("CM.Sim.auraMult") - .split("Game.hasGod") - .join("CM.Sim.hasGod") - .split("M.gods[what]") // Replaces code in the Pantheon minigame - .join("CM.Sim.Objects.Temple.minigame.gods[what]") - .split("M.slot[i]") // Replaces code in the Pantheon minigame - .join("CM.Sim.Objects.Temple.minigame.slot[i]") - .split("Game.effs") // Replaces code in the Pantheon minigame - .join("CM.Sim.effs") - .split("Game.Objects") - .join("CM.Sim.Objects") - .split("Game.GetTieredCpsMult") // Replace in .cps of building objects - .join("CM.Sim.GetTieredCpsMult") + .split('Game.Upgrades[') // Include '[' to not replace Game.UpgradesByPool + .join('CM.Sim.Upgrades[') + .split('Game.Achievements') + .join('CM.Sim.Achievements') + .split('Game.Has') + .join('CM.Sim.Has') + .split('Game.dragonAura]') + .join('CM.Sim.dragonAura]') + .split('Game.dragonAura2]') + .join('CM.Sim.dragonAura2]') + .split('Game.auraMult') + .join('CM.Sim.auraMult') + .split('Game.hasGod') + .join('CM.Sim.hasGod') + .split('M.gods[what]') // Replaces code in the Pantheon minigame + .join('CM.Sim.Objects.Temple.minigame.gods[what]') + .split('M.slot[i]') // Replaces code in the Pantheon minigame + .join('CM.Sim.Objects.Temple.minigame.slot[i]') + .split('Game.effs') // Replaces code in the Pantheon minigame + .join('CM.Sim.effs') + .split('Game.Objects') + .join('CM.Sim.Objects') + .split('Game.GetTieredCpsMult') // Replace in .cps of building objects + .join('CM.Sim.GetTieredCpsMult') .split('Game.eff') // Replace in .cps of building objects .join('CM.Sim.eff'); - //.split('syn.buildingTie1.amount') - //.join('CM.Sim.Objects[syn.buildingTie1.name].amount') - //.split('syn.buildingTie2.amount') - //.join('CM.Sim.Objects[syn.buildingTie2.name].amount') -} + // .split('syn.buildingTie1.amount') + // .join('CM.Sim.Objects[syn.buildingTie1.name].amount') + // .split('syn.buildingTie2.amount') + // .join('CM.Sim.Objects[syn.buildingTie2.name].amount') +}; /** * This functions creates all functions by CM.Sim to check CM.Sim. data instead of Game. data * It does this by calling CM.Sim.ReplaceFunction() * It follows naming of the vanilla functions - * + * * It is called by CM.Main.DelayInit() */ -CM.Sim.CreateSimFunctions = function() { +CM.Sim.CreateSimFunctions = function () { CM.Sim.Has = new Function(`return ${CM.Sim.ReplaceFunction(Game.Has)}`)(); CM.Sim.HasAchiev = new Function(`return ${CM.Sim.ReplaceFunction(Game.HasAchiev)}`)(); CM.Sim.hasAura = new Function(`return ${CM.Sim.ReplaceFunction(Game.hasAura)}`)(); @@ -163,7 +163,7 @@ CM.Sim.CreateSimFunctions = function() { CM.Sim.auraMult = new Function(`return ${CM.Sim.ReplaceFunction(Game.auraMult)}`)(); CM.Sim.eff = new Function(`return ${CM.Sim.ReplaceFunction(Game.eff)}`)(); CM.Sim.GetTieredCpsMult = new Function(`return ${CM.Sim.ReplaceFunction(Game.GetTieredCpsMult)}`)(); -} +}; /** * This function "wins" an achievement in the current sim data @@ -171,16 +171,16 @@ CM.Sim.CreateSimFunctions = function() { * It is not created by CM.Sim.CreateSimFunctions() in order to avoid spamming pop-ups upon winning * @param {string} what Name of the achievement */ -CM.Sim.Win = function(what) { +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++; + if (Game.Achievements[what].pool !== 'shadow') CM.Sim.AchievementsOwned++; } } }; -/******** +/** * Section: Functions used to create static objects of Buildings, Upgrades and Achievements */ /** @@ -193,9 +193,9 @@ CM.Sim.Win = function(what) { * @param {string} buildingName Name of the building * @returns {Object} you The static object */ -CM.Sim.InitialBuildingData = function(buildingName) { - let me = Game.Objects[buildingName]; - let you = {}; +CM.Sim.InitialBuildingData = function (buildingName) { + const me = Game.Objects[buildingName]; + const you = {}; you.cps = new Function(`return ${CM.Sim.ReplaceFunction(me.cps)}`)(); // Below is needed for above eval, specifically for the GetTieredCpsMult function you.baseCps = me.baseCps; @@ -204,9 +204,9 @@ CM.Sim.InitialBuildingData = function(buildingName) { you.synergies = me.synergies; you.fortune = me.fortune; you.grandma = me.grandma; - you.baseCPS = me.baseCps - you.id = me.id - you.vanilla = me.vanilla + you.baseCPS = me.baseCps; + you.id = me.id; + you.vanilla = me.vanilla; return you; }; @@ -216,12 +216,12 @@ CM.Sim.InitialBuildingData = function(buildingName) { * @param {string} upgradeName Name of the Upgrade * @returns {Object} you The static object */ -CM.Sim.InitUpgrade = function(upgradeName) { - let me = Game.Upgrades[upgradeName]; - let you = {}; +CM.Sim.InitUpgrade = function (upgradeName) { + const me = Game.Upgrades[upgradeName]; + const you = {}; // Some upgrades have a function for .power (notably the valentine cookies) you.power = me.power; - if (typeof(me.power) === 'function') { + if (typeof (me.power) === 'function') { me.power = new Function(`return ${CM.Sim.ReplaceFunction(me.power)}`)(); } you.pool = me.pool; @@ -235,47 +235,46 @@ CM.Sim.InitUpgrade = function(upgradeName) { * @param {string} achievementName Name of the Achievement * @returns {Object} you The static object */ -CM.Sim.InitAchievement = function(achievementName) { - let me = Game.Achievements[achievementName]; - let you = {}; +CM.Sim.InitAchievement = function (achievementName) { + const me = Game.Achievements[achievementName]; + const you = {}; you.name = me.name; return you; }; - /** * This function creates static objects for Buildings, Upgrades and Achievements * It is called by CM.Main.DelayInit() */ -CM.Sim.InitData = function() { +CM.Sim.InitData = function () { // Buildings CM.Sim.Objects = []; - for (let i of Object.keys(Game.Objects)) { + for (const i of Object.keys(Game.Objects)) { CM.Sim.Objects[i] = CM.Sim.InitialBuildingData(i); } // Upgrades CM.Sim.Upgrades = []; - for (let i of Object.keys(Game.Upgrades)) { + for (const i of Object.keys(Game.Upgrades)) { CM.Sim.Upgrades[i] = CM.Sim.InitUpgrade(i); } // Achievements CM.Sim.Achievements = []; - for (let i of Object.keys(Game.Achievements)) { + for (const i of Object.keys(Game.Achievements)) { CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i); } CM.Sim.CopyData(); }; -/******** +/** * Section: Functions related to creating a new iteration of "sim data" */ /** * This function copies all relevant data and therefore sets a new iteration of the "sim data" * It is called at the start of any function that simulates certain behaviour or actions */ -CM.Sim.CopyData = function() { +CM.Sim.CopyData = function () { // Other variables CM.Sim.UpgradesOwned = Game.UpgradesOwned; CM.Sim.pledges = Game.pledges; @@ -284,11 +283,12 @@ CM.Sim.CopyData = function() { CM.Sim.prestige = Game.prestige; // Buildings - for (let i of Object.keys(Game.Objects)) { - let me = Game.Objects[i]; + for (const i of Object.keys(Game.Objects)) { + const me = Game.Objects[i]; let you = CM.Sim.Objects[i]; if (you === undefined) { // New building! - you = CM.Sim.Objects[i] = CM.Sim.InitialBuildingData(i); + CM.Sim.Objects[i] = CM.Sim.InitialBuildingData(i); + you = CM.Sim.Objects[i]; CM.Disp.CreateBotBarBuildingColumn(i); // Add new building to the bottom bar } you.amount = me.amount; @@ -300,21 +300,23 @@ CM.Sim.CopyData = function() { } // Upgrades - for (let i of Object.keys(Game.Upgrades)) { - let me = Game.Upgrades[i]; + for (const i of Object.keys(Game.Upgrades)) { + const me = Game.Upgrades[i]; let you = CM.Sim.Upgrades[i]; if (you === undefined) { - you = CM.Sim.Upgrades[i] = CM.Sim.InitUpgrade(i); + CM.Sim.Upgrades[i] = CM.Sim.InitUpgrade(i); + you = CM.Sim.Upgrades[i]; } you.bought = me.bought; } // Achievements - for (let i of Object.keys(Game.Achievements)) { - let me = Game.Achievements[i]; + for (const i of Object.keys(Game.Achievements)) { + const me = Game.Achievements[i]; let you = CM.Sim.Achievements[i]; if (you === undefined) { - you = CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i); + CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i); + you = CM.Sim.Achievements[i]; } you.won = me.won; } @@ -325,7 +327,7 @@ CM.Sim.CopyData = function() { CM.Sim.dragonAura2 = CM.Cache.dragonAura2; }; -/******** +/** * Section: Functions related to checking the CPS of the current sim data */ /** @@ -334,35 +336,35 @@ CM.Sim.CopyData = function() { * It is called at the start of any function that simulates certain behaviour or actions * @global {number} CM.Sim.cookiesPs The CPS of the current sim data */ -CM.Sim.CalculateGains = function() { +CM.Sim.CalculateGains = function () { CM.Sim.cookiesPs = 0; let mult = 1; // Include minigame effects - let effs = {}; - for (let i of Object.keys(Game.Objects)) { + const effs = {}; + for (const 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) { + const myEffs = Game.Objects[i].minigame.effs; + for (const ii in myEffs) { if (effs[ii]) effs[ii] *= myEffs[ii]; - else effs[ii] = myEffs[ii]; + else effs[ii] = myEffs[ii]; } } } CM.Sim.effs = effs; - - if (Game.ascensionMode != 1) mult += parseFloat(CM.Sim.prestige) * 0.01 * CM.Sim.heavenlyPower * CM.Sim.GetHeavenlyMultiplier(); - + + if (Game.ascensionMode !== 1) mult += parseFloat(CM.Sim.prestige) * 0.01 * CM.Sim.heavenlyPower * CM.Sim.GetHeavenlyMultiplier(); + mult *= CM.Sim.eff('cps'); - if (CM.Sim.Has('Heralds') && Game.ascensionMode != 1) mult *= 1 + 0.01 * Game.heralds; + if (CM.Sim.Has('Heralds') && Game.ascensionMode !== 1) mult *= 1 + 0.01 * Game.heralds; - for (let i of Object.keys(Game.cookieUpgrades)) { - let me = Game.cookieUpgrades[i]; + for (const i of Object.keys(Game.cookieUpgrades)) { + const me = Game.cookieUpgrades[i]; if (CM.Sim.Has(me.name)) { // Some upgrades have a functio as .power (notably the valentine cookies) // CM.Sim.InitialBuildingData has changed to use CM.Sim.Has instead of Game.Has etc. // Therefore this call is to the .power of the Sim.Object - if (typeof(me.power) === 'function') { + if (typeof (me.power) === 'function') { mult *= 1 + (CM.Sim.Upgrades[me.name].power(CM.Sim.Upgrades[me.name]) * 0.01); } else mult *= 1 + (me.power * 0.01); } @@ -395,8 +397,8 @@ CM.Sim.CalculateGains = function() { godLvl = CM.Sim.hasGod('ages'); if (godLvl === 1) mult *= 1 + 0.15 * Math.sin((CM.Sim.DateAges / 1000 / (60 * 60 * 3)) * Math.PI * 2); - else if (godLvl === 2) mult *= 1 + 0.15 * Math.sin((CM.Sim.DateAges / 1000 / (60 * 60 * 12)) * Math.PI*2); - else if (godLvl === 3) mult *= 1 + 0.15 * Math.sin((CM.Sim.DateAges / 1000 / (60 * 60 * 24)) * Math.PI*2); + else if (godLvl === 2) mult *= 1 + 0.15 * Math.sin((CM.Sim.DateAges / 1000 / (60 * 60 * 12)) * Math.PI * 2); + else if (godLvl === 3) mult *= 1 + 0.15 * Math.sin((CM.Sim.DateAges / 1000 / (60 * 60 * 24)) * Math.PI * 2); godLvl = CM.Sim.hasGod('decadence'); if (godLvl === 1) buildMult *= 0.93; @@ -416,13 +418,13 @@ CM.Sim.CalculateGains = function() { if (CM.Sim.Has('Santa\'s legacy')) mult *= 1 + (Game.santaLevel + 1) * 0.03; - let milkProgress = CM.Sim.AchievementsOwned / 25; + const milkProgress = CM.Sim.AchievementsOwned / 25; let milkMult = 1; if (CM.Sim.Has('Santa\'s milk and cookies')) milkMult *= 1.05; - //if (CM.Sim.hasAura('Breath of Milk')) milkMult *= 1.05; + // if (CM.Sim.hasAura('Breath of Milk')) milkMult *= 1.05; milkMult *= 1 + CM.Sim.auraMult('Breath of Milk') * 0.05; if (CM.Sim.hasGod) { - let godLvl = CM.Sim.hasGod('mother'); + const 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; @@ -447,15 +449,15 @@ CM.Sim.CalculateGains = function() { if (CM.Sim.Has('Kitten angels')) catMult *= (1 + milkProgress * 0.1 * milkMult); if (CM.Sim.Has('Fortune #103')) catMult *= (1 + milkProgress * 0.05 * milkMult); - for (let i of Object.keys(CM.Sim.Objects)) { - let me = CM.Sim.Objects[i]; + for (const i of Object.keys(CM.Sim.Objects)) { + const me = CM.Sim.Objects[i]; let storedCps = me.cps(me); - if (Game.ascensionMode != 1) storedCps *= (1 + me.level * 0.01) * buildMult; - if (me.name === "Grandma" && CM.Sim.Has('Milkhelp® lactose intolerance relief tablets')) storedCps *= 1 + 0.05 * milkProgress * milkMult; + if (Game.ascensionMode !== 1) storedCps *= (1 + me.level * 0.01) * buildMult; + if (me.name === 'Grandma' && CM.Sim.Has('Milkhelp® lactose intolerance relief tablets')) storedCps *= 1 + 0.05 * milkProgress * milkMult; CM.Sim.cookiesPs += me.amount * storedCps; } - if (CM.Sim.Has('"egg"')) CM.Sim.cookiesPs += 9;//"egg" + if (CM.Sim.Has('"egg"')) CM.Sim.cookiesPs += 9;// "egg" mult *= catMult; @@ -477,30 +479,30 @@ CM.Sim.CalculateGains = function() { 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; + CM.Cache.CentEgg = 1 + (1 - (1 - day / 100) ** 3) * 0.1; eggMult *= CM.Cache.CentEgg; } mult *= eggMult; if (CM.Sim.Has('Sugar baking')) mult *= (1 + Math.min(100, Game.lumps) * 0.01); - //if (CM.Sim.hasAura('Radiant Appetite')) mult *= 2; + // if (CM.Sim.hasAura('Radiant Appetite')) mult *= 2; mult *= 1 + CM.Sim.auraMult('Radiant Appetite'); - let rawCookiesPs = CM.Sim.cookiesPs * mult; - for (let i of Object.keys(Game.CpsAchievements)) { + const rawCookiesPs = CM.Sim.cookiesPs * mult; + for (const 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 < n; i++){ + const n = Game.shimmerTypes.golden.n; + const auraMult = CM.Sim.auraMult('Dragon\'s Fortune'); + for (let i = 0; i < n; i++) { mult *= 1 + auraMult * 1.23; } - let name = Game.bakeryName.toLowerCase(); + const name = Game.bakeryName.toLowerCase(); if (name === 'orteil') mult *= 0.99; else if (name === 'ortiel') mult *= 0.98; @@ -509,8 +511,8 @@ CM.Sim.CalculateGains = function() { if (CM.Sim.Has('Golden switch [off]')) { let goldenSwitchMult = 1.5; if (CM.Sim.Has('Residual luck')) { - let upgrades = Game.goldenCookieUpgrades; - for (let i of Object.keys(upgrades)) { + const upgrades = Game.goldenCookieUpgrades; + for (const i of Object.keys(upgrades)) { if (CM.Sim.Has(upgrades[i])) goldenSwitchMult += 0.1; } } @@ -522,11 +524,11 @@ CM.Sim.CalculateGains = function() { mult *= 1 + veilMult; } - if (CM.Sim.Has('Magic shenanigans')) mult*=1000; - if (CM.Sim.Has('Occult obstruction')) mult*=0; + if (CM.Sim.Has('Magic shenanigans')) mult *= 1000; + if (CM.Sim.Has('Occult obstruction')) mult *= 0; CM.Sim.cookiesPs = Game.runModHookOnValue('cps', CM.Sim.cookiesPs); - + mult *= CM.Cache.getCPSBuffMult(); CM.Sim.cookiesPs *= mult; @@ -539,9 +541,9 @@ CM.Sim.CalculateGains = function() { * If so it CM.Sim.Win()'s them and the caller function will know to recall CM.Sim.CalculateGains() * It is called at the end of any functions that simulates certain behaviour */ -CM.Sim.CheckOtherAchiev = function() { +CM.Sim.CheckOtherAchiev = function () { let grandmas = 0; - for (let i of Object.keys(Game.GrandmaSynergies)) { + for (const i of Object.keys(Game.GrandmaSynergies)) { if (CM.Sim.Has(Game.GrandmaSynergies[i])) grandmas++; } if (!CM.Sim.HasAchiev('Elder') && grandmas >= 7) CM.Sim.Win('Elder'); @@ -551,11 +553,11 @@ CM.Sim.CheckOtherAchiev = function() { let mathematician = 1; let base10 = 1; let minAmount = 100000; - for (let i of Object.keys(CM.Sim.Objects)) { + for (const 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 < Math.min(128, Math.pow(2, (Game.ObjectsById.length - Game.Objects[i].id) - 1))) mathematician = 0; + if (CM.Sim.Objects[i].amount < Math.min(128, 2 ** ((Game.ObjectsById.length - Game.Objects[i].id) - 1))) mathematician = 0; } if (!CM.Sim.HasAchiev('Base 10')) { if (CM.Sim.Objects[i].amount < (Game.ObjectsById.length - Game.Objects[i].id) * 10) base10 = 0; @@ -596,21 +598,21 @@ CM.Sim.CheckOtherAchiev = function() { 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)) { + for (const 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)) { + for (const 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; + const list = Game.Tiers.fortune.upgrades; let fortunes = 0; - for (let i of Object.keys(list)) { + for (const i of Object.keys(list)) { if (CM.Sim.Has(list[i].name)) fortunes++; } if (fortunes >= list.length) CM.Sim.Win('O Fortuna'); @@ -621,14 +623,14 @@ CM.Sim.CheckOtherAchiev = function() { * This function calculates CPS without the Golden Switch * It is called by CM.Cache.NoGoldSwitchCPS() */ -CM.Sim.NoGoldSwitchCPS = function() { +CM.Sim.NoGoldSwitchCPS = function () { CM.Sim.CopyData(); CM.Sim.Upgrades['Golden switch [off]'].bought = 0; CM.Sim.CalculateGains(); return CM.Sim.cookiesPs; }; -/******** +/** * Section: Functions related to calculating Bonus Income */ /** @@ -638,9 +640,9 @@ CM.Sim.NoGoldSwitchCPS = function() { * @param {number} amount The amount to be bought * @returns {number} The bonus income of the building */ -CM.Sim.BuyBuildingsBonusIncome = function(building, amount) { +CM.Sim.BuyBuildingsBonusIncome = function (building, amount) { CM.Sim.CopyData(); - let me = CM.Sim.Objects[building]; + const me = CM.Sim.Objects[building]; me.amount += amount; if (building === 'Cursor') { @@ -655,21 +657,21 @@ CM.Sim.BuyBuildingsBonusIncome = function(building, amount) { 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) + } else { + for (const 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; + const lastAchievementsOwned = CM.Sim.AchievementsOwned; CM.Sim.CalculateGains(); CM.Sim.CheckOtherAchiev(); - if (lastAchievementsOwned != CM.Sim.AchievementsOwned) { + if (lastAchievementsOwned !== CM.Sim.AchievementsOwned) { CM.Sim.CalculateGains(); } @@ -682,10 +684,10 @@ CM.Sim.BuyBuildingsBonusIncome = function(building, amount) { * @param {string} building The name of the upgrade to be bought * @returns {[{number, number}]} The bonus income of the upgrade and the difference in MouseCPS */ -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.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]; + const me = CM.Sim.Upgrades[upgrade]; me.bought = 1; if (Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool)) CM.Sim.UpgradesOwned++; @@ -693,44 +695,40 @@ CM.Sim.BuyUpgradesBonusIncome = function(upgrade) { 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') { + } else if (upgrade === 'Elder Covenant') { CM.Sim.Win('Elder calm'); - } - else if (upgrade === 'Prism heart biscuits') { + } else if (upgrade === 'Prism heart biscuits') { CM.Sim.Win('Lovely cookies'); - } - else if (upgrade === 'Heavenly key') { + } else if (upgrade === 'Heavenly key') { CM.Sim.Win('Wholesome'); } - let lastAchievementsOwned = CM.Sim.AchievementsOwned; + const lastAchievementsOwned = CM.Sim.AchievementsOwned; CM.Sim.CalculateGains(); CM.Sim.CheckOtherAchiev(); - if (lastAchievementsOwned != CM.Sim.AchievementsOwned) { + if (lastAchievementsOwned !== CM.Sim.AchievementsOwned) { CM.Sim.CalculateGains(); } - let diffMouseCPS = CM.Sim.mouseCps() - Game.computedMouseCps; + const diffMouseCPS = CM.Sim.mouseCps() - Game.computedMouseCps; if (diffMouseCPS) { return [CM.Sim.cookiesPs - Game.cookiesPs, diffMouseCPS]; - } + } return [CM.Sim.cookiesPs - Game.cookiesPs]; } else { return []; } }; - /** * This function calculates the cookies per click * It is called by CM.Sim.BuyUpgradesBonusIncome() when an upgrades has no bonus-income (and is thus a clicking-upgrade) * @returns {number} out The clicking power */ -CM.Sim.mouseCps = function() { +CM.Sim.mouseCps = function () { let add = 0; if (CM.Sim.Has('Thousand fingers')) add += 0.1; if (CM.Sim.Has('Million fingers')) add *= 5; @@ -742,10 +740,10 @@ CM.Sim.mouseCps = function() { 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;} + let num = 0; + for (const i of Object.keys(CM.Sim.Objects)) { num += CM.Sim.Objects[i].amount; } num -= CM.Sim.Objects.Cursor.amount; - add = add * num; + add *= num; // Can use CM.Sim.cookiesPs as function is always called after CM.Sim.CalculateGains() if (CM.Sim.Has('Plastic mouse')) add += CM.Sim.cookiesPs * 0.01; @@ -763,46 +761,45 @@ CM.Sim.mouseCps = function() { if (CM.Sim.Has('Miraculite mouse')) add += CM.Sim.cookiesPs * 0.01; if (CM.Sim.Has('Fortune #104')) add += CM.Sim.cookiesPs * 0.01; - - let mult=1; + + 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 + 0.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'); + const 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; + for (const i of Object.keys(Game.buffs)) { + if (typeof Game.buffs[i].multClick !== 'undefined') mult *= Game.buffs[i].multClick; } - - //if (CM.Sim.auraMult('Dragon Cursor')) mult*=1.05; + + // if (CM.Sim.auraMult('Dragon Cursor')) mult*=1.05; mult *= 1 + CM.Sim.auraMult('Dragon Cursor') * 0.05; - + // No need to make this function a CM function 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; }; - -/******** +/** * Section: Functions related to calculating the effect of changing Dragon Aura */ /** @@ -811,23 +808,23 @@ CM.Sim.mouseCps = function() { * @param {number} aura The number of the aura currently selected by the mouse/user * @returns {[number, number]} [CM.Sim.cookiesPs - Game.cookiesPs, price] The bonus cps and the price of the change */ -CM.Sim.CalculateChangeAura = function(aura) { +CM.Sim.CalculateChangeAura = function (aura) { CM.Sim.CopyData(); // Check if aura being changed is first or second aura - let auraToBeChanged = l('promptContent').children[0].innerHTML.includes("secondary"); + const auraToBeChanged = l('promptContent').children[0].innerHTML.includes('secondary'); if (auraToBeChanged) CM.Sim.dragonAura2 = aura; else CM.Sim.dragonAura = aura; // Sell highest building but only if aura is different 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; + 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) { + const 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 = CM.Sim.Objects[highestBuilding].basePrice * 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; @@ -835,17 +832,17 @@ CM.Sim.CalculateChangeAura = function(aura) { } } - let lastAchievementsOwned = CM.Sim.AchievementsOwned; + const lastAchievementsOwned = CM.Sim.AchievementsOwned; CM.Sim.CalculateGains(); CM.Sim.CheckOtherAchiev(); - if (lastAchievementsOwned != CM.Sim.AchievementsOwned) { + if (lastAchievementsOwned !== CM.Sim.AchievementsOwned) { CM.Sim.CalculateGains(); } return [CM.Sim.cookiesPs - Game.cookiesPs, price]; }; -/******** +/** * Section: Functions related to calculating the reset bonus */ /** @@ -854,7 +851,7 @@ CM.Sim.CalculateChangeAura = function(aura) { * @param {number} newHeavenlyChips The total heavenly chips after ascension * @returns {number} ResetCPS The CPS difference after reset */ -CM.Sim.ResetBonus = function(newHeavenlyChips) { +CM.Sim.ResetBonus = function (newHeavenlyChips) { // Calculate CPS with all Heavenly upgrades let curCPS = Game.cookiesPs; @@ -900,17 +897,17 @@ CM.Sim.ResetBonus = function(newHeavenlyChips) { CM.Sim.prestige = newHeavenlyChips; - let lastAchievementsOwned = CM.Sim.AchievementsOwned; + const lastAchievementsOwned = CM.Sim.AchievementsOwned; CM.Sim.CalculateGains(); CM.Sim.CheckOtherAchiev(); - if (lastAchievementsOwned != CM.Sim.AchievementsOwned) { + if (lastAchievementsOwned !== CM.Sim.AchievementsOwned) { CM.Sim.CalculateGains(); } - let ResetCPS = CM.Sim.cookiesPs - curCPS; + const ResetCPS = CM.Sim.cookiesPs - curCPS; // Reset Pretige level after calculation as it is used in CM.Sim.CalculateGains() so can't be local CM.Sim.prestige = Game.prestige; @@ -918,7 +915,7 @@ CM.Sim.ResetBonus = function(newHeavenlyChips) { return ResetCPS; }; -/******** +/** * Section: Functions related to selling builings before buying the chocolate egg */ /** @@ -926,11 +923,11 @@ CM.Sim.ResetBonus = function(newHeavenlyChips) { * It is called by CM.Cache.CacheSellForChoEgg() * @returns {number} sellTotal The maximum cookies to be earned */ -CM.Sim.SellBuildingsForChoEgg = function() { +CM.Sim.SellBuildingsForChoEgg = function () { let sellTotal = 0; CM.Sim.CopyData(); - + // Change auras to Earth Shatterer + Reality bending to optimize money made by selling let buildingsToSacrifice = 2; if (CM.Sim.dragonAura === 5 || CM.Sim.dragonAura === 18) { @@ -945,8 +942,8 @@ CM.Sim.SellBuildingsForChoEgg = function() { // Sacrifice highest buildings for the aura switch for (let i = 0; i < buildingsToSacrifice; ++i) { let highestBuilding = 0; - for (let j in CM.Sim.Objects) { - if (CM.Sim.Objects[j].amount > 0) { + for (const j in CM.Sim.Objects) { + if (CM.Sim.Objects[j].amount > 0) { highestBuilding = CM.Sim.Objects[j]; } } @@ -955,8 +952,8 @@ CM.Sim.SellBuildingsForChoEgg = function() { } // Get money made by selling all remaining buildings - for (let i of Object.keys(CM.Sim.Objects)) { - let me = CM.Sim.Objects[i]; + for (const i of Object.keys(CM.Sim.Objects)) { + const 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); } From fcd5588a03598284d798220ceb77f94376e8b718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Wed, 24 Feb 2021 00:18:38 +0100 Subject: [PATCH 2/3] Added changelog --- CookieMonster.js | 2 +- src/Data.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 42af996..7362ee8 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:"4"};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.HeavenlyChipsDiff=new CMAvgQueue(5);CM.Cache.CacheHeavenlyChipsPS();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();CM.Cache.CacheHeavenlyChipsPS();const cookiesToNext=Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))+1)-(Game.cookiesEarned+Game.cookiesReset);CM.Cache.TimeTillNextPrestige=CM.Disp.FormatTime(cookiesToNext/CM.Disp.GetCPS())};class CMAvgQueue{constructor(maxLength){this.maxLength=maxLength;this.queue=[]}addLatest(newValue){if(this.queue.push(newValue)>this.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.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;const 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(const 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(const 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 nextRequired=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.ChainMaxReward=CM.Cache.MaxChainCookieReward(7,maxPayout,CM.Cache.GoldenCookiesMult);CM.Cache.ChainRequired=CM.Cache.ChainMaxReward[1]*2/CM.Cache.GoldenCookiesMult;CM.Cache.ChainRequiredNext=CM.Cache.ChainMaxReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainMaxWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout,CM.Cache.WrathCookiesMult);CM.Cache.ChainWrathRequired=CM.Cache.ChainMaxWrathReward[1]*2/CM.Cache.WrathCookiesMult;CM.Cache.ChainWrathRequiredNext=CM.Cache.ChainMaxWrathReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyMaxReward=CM.Cache.MaxChainCookieReward(7,maxPayout*7,CM.Cache.GoldenCookiesMult);CM.Cache.ChainFrenzyRequired=CM.Cache.ChainFrenzyMaxReward[1]*2/CM.Cache.GoldenCookiesMult;CM.Cache.ChainFrenzyRequiredNext=CM.Cache.ChainFrenzyMaxReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyMaxWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout*7,CM.Cache.WrathCookiesMult);CM.Cache.ChainFrenzyWrathRequired=CM.Cache.ChainFrenzyMaxWrathReward[1]*2/CM.Cache.WrathCookiesMult;CM.Cache.ChainFrenzyWrathRequiredNext=CM.Cache.ChainFrenzyMaxWrathReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment};CM.Cache.CacheMissingUpgrades=function(){CM.Cache.MissingUpgrades="";CM.Cache.MissingUpgradesCookies="";CM.Cache.MissingUpgradesPrestige="";const list=[];for(const i of Object.keys(Game.Upgrades)){list.push(Game.Upgrades[i])}const sortMap=function(a,b){if(a.order>b.order)return 1;else if(a.order0)choEggTotal+=CM.Cache.WrinklersTotal;CM.Cache.RealCookiesEarned=Math.max(Game.cookiesEarned,choEggTotal);choEggTotal*=.05;const timeDiff=currDate-CM.Cache.lastCPSCheck;const bankDiffAvg=Math.max(0,Game.cookies-CM.Cache.lastCookies)/timeDiff;const wrinkDiffAvg=Math.max(0,CM.Cache.WrinklersTotal-CM.Cache.lastWrinkCookies)/timeDiff;const wrinkFattestDiffAvg=Math.max(0,CM.Cache.WrinklersFattest[0]-CM.Cache.lastWrinkFattestCookies)/timeDiff;const choEggDiffAvg=Math.max(0,choEggTotal-CM.Cache.lastChoEgg)/timeDiff;const clicksDiffAvg=(Game.cookieClicks-CM.Cache.lastClicks)/timeDiff;for(let i=0;iCM.Cache.max)color=CM.Disp.colorPurple;else if(me.pp>CM.Cache.mid)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow;if(Number(CM.Options.PPSecondsLowerLimit)!==0){if(price/CM.Disp.GetCPS()0)color=CM.Disp.colorRed}return color};CM.Cache.CacheBuildingsPP=function(){CM.Cache.min=Infinity;CM.Cache.max=1;CM.Cache.ArrayOfPPs=[];if(typeof CM.Options.PPExcludeTop==="undefined")CM.Options.PPExcludeTop=0;if(CM.Options.ColorPPBulkMode===0){for(const i of Object.keys(CM.Cache.Objects1)){if(Game.cookiesPs){CM.Cache.Objects1[i].pp=Math.max(Game.Objects[i].getPrice()-(Game.cookies+CM.Disp.GetWrinkConfigBank()),0)/Game.cookiesPs+Game.Objects[i].getPrice()/CM.Cache.Objects1[i].bonus}else CM.Cache.Objects1[i].pp=Game.Objects[i].getPrice()/CM.Cache.Objects1[i].bonus;CM.Cache.ArrayOfPPs.push([CM.Cache.Objects1[i].pp,Game.Objects[i].getPrice()])}CM.Cache.ArrayOfPPs.sort(((a,b)=>a[0]-b[0]));if(CM.Options.PPOnlyConsiderBuyable){while(CM.Cache.ArrayOfPPs[0][1]>Game.cookies){if(CM.Cache.ArrayOfPPs.length===1){break}CM.Cache.ArrayOfPPs.shift()}}CM.Cache.min=CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop][0];CM.Cache.max=CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length-1][0];CM.Cache.mid=(CM.Cache.max-CM.Cache.min)/2+CM.Cache.min;for(const i of Object.keys(CM.Cache.Objects1)){CM.Cache.Objects1[i].color=CM.Cache.ColourOfPP(CM.Cache.Objects1[i],Game.Objects[i].getPrice());for(let j=0;ja[0]-b[0]));if(CM.Options.PPOnlyConsiderBuyable){while(CM.Cache.ArrayOfPPs[0][1]>Game.cookies){if(CM.Cache.ArrayOfPPs.length===1){break}CM.Cache.ArrayOfPPs.shift()}}CM.Cache.min=CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop][0];CM.Cache.max=CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length-1][0];CM.Cache.mid=(CM.Cache.max-CM.Cache.min)/2+CM.Cache.min;for(const i of Object.keys(CM.Cache.Objects1)){CM.Cache[target][i].color=CM.Cache.ColourOfPP(CM.Cache[target][i],Game.Objects[i].bulkPrice);for(let j=0;j-1&&CM.Options[i]-1&&CM.Options[i][j]<2)){mod=true;CM.Options[i][j]=CM.Data.ConfigDefault[i][j]}}}else{for(const 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(const 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){const 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.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.ColorPPBulkMode={type:"bool",group:"Calculation",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,func:function(){CM.Cache.CachePP()}};CM.Data.Config.PPExcludeTop={type:"bool",group:"Calculation",label:["Don't Ignore Any","Ignore 1st Best","Ignore 1st and 2nd Best","Ignore 1st, 2nd and 3rd Best"],desc:"Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values",toggle:true};CM.Data.Config.PPSecondsLowerLimit={type:"numscale",group:"Calculation",label:"Lower limit for PP (in seconds): ",desc:'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option',min:0,max:Infinity};CM.Data.Config.PPOnlyConsiderBuyable={type:"bool",group:"Calculation",label:["Don't Ignore Non-Buyable","Ignore Non-Buyable"],desc:"Makes CookieMonster label buildings and upgrades you can't buy right now red, useful in those situations where you just want to spend your full bank 'most optimally'",toggle:true};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.ToolWarnUser={type:"numscale",group:"Tooltip",label:"Tooltip Warning At x times CPS: ",desc:"Use this to show a customized warning if buying it will put the bank under the amount equal to value times cps; setting to 0 disables the function altogether",min:0,max:Infinity};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 Extra Info Ascend Tooltip OFF","Show Extra Info Ascend Tooltip ON"],desc:"Shows additional info in the ascend tooltip",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.HeavenlyChipsTarget={type:"numscale",group:"Statistics",label:"Heavenly Chips Target: ",desc:'Use this to set a Heavenly Chips target that will be counted towards in the "prestige" statsistics sections',min:1,max:Infinity};CM.Data.Config.ShowMissedGC={type:"bool",group:"Statistics",label:["Missed GC OFF","Missed GC ON"],desc:"Show a stat in the statistics screen that counts how many Golden Cookies you have missed",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,UpBarColor:1,UpgradeBarFixedPos:1,CalcWrink:0,CPSMode:1,AvgCPSHist:3,AvgClicksHist:0,ColorPPBulkMode:1,PPExcludeTop:0,PPSecondsLowerLimit:0,PPOnlyConsiderBuyable: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,ToolWarnUser:0,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,HeavenlyChipsTarget:1,ShowMissedGC: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,Chain:1,Spells:1,Garden:1,Prestige:1,Wrink:1,Sea:1,Misc:1,InfoTab:1}};CM.Data.ModDescription=`
\nCookie Monster\noffers a wide range of tools and statistics to enhance your game experience.\nIt is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.
\nProgess on new updates and all previous release notes can be found on the GitHub page linked above!\n
\n`;CM.Data.LatestReleaseNotes=`
\nThe latest update (v 2.031.4) has introduced the following features:\n- A new warning and stat for Conjure Baked Goods in combination with Frenzy has been added
\n- User can now set a custom tooltip warning ("x times cps") in the settings
\n- Garden plots with plants that give cookies on harvest now display a tooltip with current and maximum reward
\n- The Harvest All button in the Garden now has a tooltip displaying the current reward
\n- The Ascend button can now display additional info (this can be turned off in the settings)
\n- The statistics page now displays the Heavenly Chips per second
\n- The statistics page now displays the CPS needed for the next level in Chain Cookies
\n- You can now set a Heavenly Chips target in the settings which will be counted down to in the statistics page
\n- The color picker in the settings has been updated to its latest version
\n- The overlay of seconds/percentage of timers is now toggle able and more readable
\n- You can now toggle to disable bulk-buying from buying less than the selected amount (i.e., buying 7 of a building by pressing the buy 10 when you don't have enough for 10)
\n- CookieMonster now uses the Modding API provided by the base game
\n- There is a new option that allows the decoupling of the base game volume setting and the volumes of sounds created by the mod
\n- The tab title now displays a "!" if a Golden Cookie or Reindeer can spawn
\n- PP calculation can now be set to: 1) Exclude the 1st, 2nd or 3rd most optimal building (if you never want to buy that it), 2) Always consider optimal buildings that cost below "xx seconds of CPS" (toggleable in the settings), 3) Ignore any building or upgrade that is not purchasable at the moment
\n
\nThis update fixes the following bugs:
\n- Minigames with enhanced tooltips will now also show these if the minigames were not loaded when CookieMonster was loaded
\n- Sound, Flashes and Notifications will no longer play when the mod is initializing
\n- The color picker should now update its display consistently
\n- Fixed some typo's
\n- Fixed a game breaking bug when the player had not purchased any upgrades
\n- Fixed a number of console errors thrown by CM
\n- Fixed the integration with mods that provide additional content, they should now no longer break CookieMonster
\n- The Timer bar will now disappear correctly when the Golden Switch has been activated
\n- Fixed errors in the calculation of the Chain Cookies and Wrinkler stats
\n
\n`;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(const 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&&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){const decimals=CM.Options.ScaleDecimals+1;if(CM.Options.Scale===0){return CM.Backup.Beautify(num,floats)}else if(Number.isFinite(num)){let answer="";if(num===0){return num.toString()}else if(num>.001&&num=.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(const i of Object.keys(CM.Disp.BuffTimerBars)){CM.Disp.BuffTimerBars[i].remove()}CM.Disp.BuffTimerBars={};for(const i of Object.keys(Game.buffs)){if(Game.buffs[i]){const 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(const 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(){const target=`Objects${Game.buyBulk}`;if(Game.buyMode===1){if(CM.Options.BuildColor===1){for(const 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(const i of Object.keys(Game.Objects)){l(`productPrice${Game.Objects[i].id}`).style.removeProperty("color")}}}else if(Game.buyMode===-1){for(const i of Object.keys(CM.Cache.Objects1)){const 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){const arr=Object.keys(CM.Cache[target]).map((k=>{const o=CM.Cache[target][k];o.name=k;o.id=Game.Objects[k].id;return o}));arr.sort((function(a,b){return CM.Disp.colors.indexOf(a.color)>CM.Disp.colors.indexOf(b.color)?1:CM.Disp.colors.indexOf(a.color){const 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(const i of Object.keys(Game.UpgradesInStore)){const me=Game.UpgradesInStore[i];let addedColor=false;for(let j=0;jCM.Disp.colors.indexOf(a.color)-CM.Disp.colors.indexOf(b.color)))}else{arr.sort(((a,b)=>a.price-b.price))}const nameChecker=function(arr2,upgrade){return arr2.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){const 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(const 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(const 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");const desc=document.createElement("div");desc.style.minWidth=minWidth;desc.style.marginBottom="4px";const 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(const 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){const buildPrice=CM.Sim.BuildingGetPrice(Game.Objects[name],Game.Objects[name].basePrice,0,Game.Objects[name].free,Game.Objects[name].amount);const 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"){const 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";const 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){const 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"));const 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";const 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"));const pp=document.createElement("div");pp.style.marginBottom="4px";pp.id="CMTooltipPP";tooltip.appendChild(pp);tooltip.appendChild(CM.Disp.TooltipCreateHeader("Time Left"));const 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";const 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";const create=function(boxId,color,labelTextFront,labelTextBack,deficitId){const 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)";const labelDiv=document.createElement("div");box.appendChild(labelDiv);const 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));const deficitDiv=document.createElement("div");box.appendChild(deficitDiv);const 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"));if(Game.Objects["Wizard tower"].minigameLoaded){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"))}CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px";CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnUser",CM.Disp.colorRed,"Warning: ",`Purchase of this item will put you under the number of Cookies equal to ${CM.Options.ToolWarnUser} seconds of CPS`,"CMDispTooltipWarnUserText"));return CM.Disp.TooltipWarn};CM.Disp.UpdateTooltip=function(){CM.Sim.CopyData();if(l("tooltipAnchor").style.display!=="none"&&l("CMTooltipArea")){l("CMTooltipArea").innerHTML="";const 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){const tooltipBox=l("CMTooltipBorder");CM.Disp.TooltipCreateCalculationSection(tooltipBox);const 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);const increase=Math.round(CM.Disp.TooltipBonusIncome/Game.cookiesPs*1e4);if(Number.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;const 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;const 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)"));const 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(){const 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){const tile=minigame.plot[y][x];const me=minigame.plantsById[tile[0]-1];const plantName=me.name;let count=true;if(mortal&&me.immortal)count=false;if(tile[1]0){if(amount0&&me.selected){showingTooltip=true;if(CM.Disp.TooltipWrinklerBeingShown[i]===0||CM.Disp.TooltipWrinklerBeingShown[i]===undefined){const placeholder=document.createElement("div");const wrinkler=document.createElement("div");wrinkler.style.minWidth="120px";wrinkler.style.marginBottom="4px";const 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){const 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){const[bonusCPS,priceOfChange]=CM.Sim.CalculateChangeAura(aura);const timeToRecover=CM.Disp.FormatTime(priceOfChange/(bonusCPS+Game.cookiesPs));const bonusCPSPercentage=CM.Disp.Beautify(bonusCPS/Game.cookiesPs);l("dragonAuraInfo").style.minHeight="60px";l("dragonAuraInfo").style.margin="8px";l("dragonAuraInfo").appendChild(document.createElement("div")).className="line";const div=document.createElement("div");div.style.minWidth="200px";div.style.textAlign="center";div.textContent=`Picking this aura will change CPS by ${CM.Disp.Beautify(bonusCPS)} (${bonusCPSPercentage}% of current CPS).`;l("dragonAuraInfo").appendChild(div);const 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(){const title=document.createElement("div");title.className="title";if(Game.onMenu==="prefs"){title.textContent="Cookie Monster Settings";CM.Disp.AddMenuPref(title)}else if(Game.onMenu==="stats"){if(CM.Options.Stats){title.textContent="Cookie Monster Statistics";CM.Disp.AddMenuStats(title)}}else if(Game.onMenu==="log"){title.textContent="Cookie Monster ";CM.Disp.AddMenuInfo(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){const frag=document.createDocumentFragment();frag.appendChild(title);for(const group of Object.keys(CM.Data.ConfigGroups)){const groupObject=CM.Disp.CreatePrefHeader(group,CM.Data.ConfigGroups[group]);frag.appendChild(groupObject);if(CM.Options.Header[group]){if(group==="Notification"){for(const subGroup of Object.keys(CM.Data.ConfigGroupsNotification)){const 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(const option in CM.Data.Config){if(CM.Data.Config[option].group===subGroup)frag.appendChild(CM.Disp.CreatePrefOption(option))}}}}else{for(const option of Object.keys(CM.Data.Config)){if(CM.Data.Config[option].group===group)frag.appendChild(CM.Disp.CreatePrefOption(option))}}}}const resDef=document.createElement("div");resDef.className="listing";const 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){const div=document.createElement("div");div.className="title";div.style.opacity="0.7";div.style.fontSize="17px";div.appendChild(document.createTextNode(`${text} `));const 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){const div=document.createElement("div");div.className="listing";if(CM.Data.Config[config].type==="bool"){const 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);const label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}else if(CM.Data.Config[config].type==="vol"){const volume=document.createElement("div");volume.className="sliderBox";const title=document.createElement("div");title.style.float="left";title.innerHTML=CM.Data.Config[config].desc;volume.appendChild(title);const percent=document.createElement("div");percent.id=`slider${config}right`;percent.style.float="right";percent.innerHTML=`${CM.Options[config]}%`;volume.appendChild(percent);const 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"){const span=document.createElement("span");span.className="option";span.textContent=`${CM.Data.Config[config].label} `;div.appendChild(span);const 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(" "));const inputPrompt=document.createElement("input");inputPrompt.id=`${CM.Config.ConfigPrefix+config}Prompt`;inputPrompt.className="option";inputPrompt.type="text";inputPrompt.setAttribute("value",CM.Options[config]);const 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);const label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}else if(CM.Data.Config[config].type==="color"){div.className="";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(" "));const label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}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){const popAllFrag=document.createDocumentFragment();popAllFrag.appendChild(document.createTextNode(`${Beautify(CM.Cache.WrinklersTotal)} / ${Beautify(CM.Cache.WrinklersNormal)} `));const 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));const popFattestFrag=document.createDocumentFragment();popFattestFrag.appendChild(document.createTextNode(`${Beautify(CM.Cache.WrinklersFattest[0])} `));const 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]!==null?CM.Cache.WrinklersFattest[1]:"None"})`,popFattestFrag))}}let specDisp=false;const missingHalloweenCookies=[];for(const i of Object.keys(CM.Data.HalloCookies)){if(!Game.Has(CM.Data.HalloCookies[i])){missingHalloweenCookies.push(CM.Data.HalloCookies[i]);specDisp=true}}const missingChristmasCookies=[];for(const i of Object.keys(CM.Data.ChristCookies)){if(!Game.Has(CM.Data.ChristCookies[i])){missingChristmasCookies.push(CM.Data.ChristCookies[i]);specDisp=true}}const missingValentineCookies=[];for(const i of Object.keys(CM.Data.ValCookies)){if(!Game.Has(CM.Data.ValCookies[i])){missingValentineCookies.push(CM.Data.ValCookies[i]);specDisp=true}}const missingNormalEggs=[];for(const i of Object.keys(Game.eggDrops)){if(!Game.HasUnlocked(Game.eggDrops[i])){missingNormalEggs.push(Game.eggDrops[i]);specDisp=true}}const missingRareEggs=[];for(const i of Object.keys(Game.rareEggDrops)){if(!Game.HasUnlocked(Game.rareEggDrops[i])){missingRareEggs.push(Game.rareEggDrops[i]);specDisp=true}}const missingPlantDrops=[];for(const i of Object.keys(CM.Data.PlantDrops)){if(!Game.HasUnlocked(CM.Data.PlantDrops[i])){missingPlantDrops.push(CM.Data.PlantDrops[i]);specDisp=true}}const choEgg=Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg");const 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.Disp.GetCPS(),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")){const fortunes=[];for(const 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)))}if(CM.Options.ShowMissedGC){stats.appendChild(CM.Disp.CreateStatsListing("basic","Missed Golden Cookies",document.createTextNode(Beautify(Game.missedGoldenClicks))))}if(Game.prefs.autosave){const 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){const div=document.createElement("div");div.className="title";div.style.padding="0px 16px";div.style.opacity="0.7";div.style.fontSize="17px";div.style.fontFamily='"Kavoon", Georgia, serif';div.appendChild(document.createTextNode(`${text} `));const 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){const div=document.createElement("div");div.className="listing";const listingName=document.createElement("b");listingName.textContent=name;div.appendChild(listingName);if(type==="withTooltip"){div.className="listing";div.appendChild(document.createTextNode(" "));const 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(text);return div};CM.Disp.CreateStatsMissDisp=function(theMissDisp){const frag=document.createDocumentFragment();frag.appendChild(document.createTextNode(`${theMissDisp.length} `));const span=document.createElement("span");span.onmouseout=function(){Game.tooltip.hide()};const placeholder=document.createElement("div");const missing=document.createElement("div");missing.style.minWidth="140px";missing.style.marginBottom="4px";const title=document.createElement("div");title.className="name";title.style.marginBottom="4px";title.style.textAlign="center";title.textContent="Missing";missing.appendChild(title);for(const i of Object.keys(theMissDisp)){const 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(){const goldCookTooltip=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder";const section=document.createElement("div");section.className="CMStatsLuckySection";const luckyColor=Game.cookies+CM.Disp.GetWrinkConfigBank()0){section.appendChild(CM.Disp.CreateStatsListing("basic","Heavenly Chips To Target Set In Settings (CUR)",document.createTextNode(Beautify(CookiesTillTarget))));section.appendChild(CM.Disp.CreateStatsListing("basic","Time To Target (CUR, Current 5 Second Average)",document.createTextNode(CM.Disp.FormatTime(CookiesTillTarget/CM.Cache.HCPerSecond))))}}const resetBonus=CM.Sim.ResetBonus(possiblePresMax);const resetFrag=document.createDocumentFragment();resetFrag.appendChild(document.createTextNode(Beautify(resetBonus)));const increase=Math.round(resetBonus/Game.cookiesPs*1e4);if(isFinite(increase)&&increase!==0){const resetSmall=document.createElement("small");resetSmall.textContent=` (${increase/100}% of income)`;resetFrag.appendChild(resetSmall)}section.appendChild(CM.Disp.CreateStatsListing("withTooltip","Reset Bonus Income",resetFrag,"ResetTooltipPlaceholder"));const currentPrestige=Math.floor(Game.HowMuchPrestige(Game.cookiesReset));const willHave=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned));const willGet=willHave-currentPrestige;if(!Game.Has("Lucky digit")){let delta7=7-willHave%10;if(delta7<0)delta7+=10;const next7Reset=willGet+delta7;const next7Total=willHave+delta7;const 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")){let delta777=777-willHave%1e3;if(delta777<0)delta777+=1e3;const next777Reset=willGet+delta777;const next777Total=willHave+delta777;const 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")){let delta777777=777777-willHave%1e6;if(delta777777<0)delta777777+=1e6;const next777777Reset=willGet+delta777777;const next777777Total=willHave+delta777777;const frag777777=document.createDocumentFragment();frag777777.appendChild(document.createTextNode(`${next777777Total.toLocaleString()} / ${next777777Reset.toLocaleString()} (+${delta777777})`));section.appendChild(CM.Disp.CreateStatsListing("basic",'Next "Lucky Payout" (total / reset)',frag777777))}return section};CM.Disp.AddMissingUpgrades=function(){for(const menuSection of l("menu").children){if(menuSection.children[0]){if(menuSection.children[0].innerHTML==="Prestige"&&CM.Cache.MissingUpgradesPrestige){const prestigeUpgradesMissing=CM.Cache.MissingUpgradesPrestige.match(new RegExp("div","g")||[]).length/2;const title=document.createElement("div");title.id="CMMissingUpgradesPrestigeTitle";title.className="listing";const titlefrag=document.createElement("div");titlefrag.innerHTML=`Missing Prestige upgrades: ${prestigeUpgradesMissing}/${Game.PrestigeUpgrades.length} (${Math.floor(prestigeUpgradesMissing/Game.PrestigeUpgrades.length*100)}%)`;title.appendChild(titlefrag);menuSection.appendChild(title);const 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){const normalUpgradesMissing=CM.Cache.MissingUpgrades.match(new RegExp("div","g")||[]).length/2;const title=document.createElement("div");title.id="CMMissingUpgradesTitle";title.className="listing";const 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]);const upgrades=document.createElement("div");upgrades.className="listing crateBox";upgrades.innerHTML=CM.Cache.MissingUpgrades;menuSection.insertBefore(upgrades,document.getElementById("CMMissingUpgradesTitle").nextSibling)}if(CM.Cache.MissingUpgradesCookies){const cookieUpgradesMissing=CM.Cache.MissingUpgradesCookies.match(new RegExp("div","g")||[]).length/2;const title=document.createElement("div");title.id="CMMissingUpgradesCookiesTitle";title.className="listing";const 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);const 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();const tooltip=`function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;return`
\n\t
`};CM.Disp.AddMenuInfo=function(title){const info=document.createElement("div");info.className="subsection";const 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.InfoTab?"-":"+";span.onclick=function(){CM.Config.ToggleHeader("InfoTab");Game.UpdateMenu()};title.appendChild(span);info.appendChild(title);if(CM.Options.Header.InfoTab){const description=document.createElement("div");description.innerHTML=CM.Data.ModDescription;info.appendChild(description);const notes=document.createElement("div");notes.innerHTML=CM.Data.LatestReleaseNotes;info.appendChild(notes)}const menu=l("menu").children[1];menu.insertBefore(info,menu.children[1])};CM.Disp.CreateWrinklerButtons=function(){const 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);const 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"],["ChainNextLevelPlaceholder","Cheated cookies might break this formula","250px"]];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.colorGray,CM.Disp.colorBlue,CM.Disp.colorGreen,CM.Disp.colorYellow,CM.Disp.colorOrange,CM.Disp.colorRed,CM.Disp.colorPurple,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.Main.LastModCount!==Object.keys(Game.mods).length){CM.Sim.CreateSimFunctions();CM.Sim.InitData();CM.Cache.InitCache();CM.Main.LastModCount=Object.keys(Game.mods).length}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}const 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.CreateSimFunctions();CM.Sim.InitData();CM.Cache.InitCache();CM.Main.LastModCount=Object.keys(Game.mods).length;CM.Disp.CreateCssArea();CM.Disp.CreateBotBar();CM.Disp.CreateTimerBar();CM.Disp.CreateUpgradeBar();CM.Disp.CreateWhiteScreen();CM.Disp.CreateFavicon();for(const 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 ? `
It takes ${CM.Cache.TimeTillNextPrestige} to reach the next level and you are making ${Beautify(CM.Cache.HCPerSecond, 2)} chips on average in the last 5 seconds.
` : ``}`;")}`)();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){const 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){const 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{const 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(const 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(const 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(const 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(const 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){const 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.ReplaceFunction=function(funcToBeReplaced){return funcToBeReplaced.toString().split("Game.Upgrades[").join("CM.Sim.Upgrades[").split("Game.Achievements").join("CM.Sim.Achievements").split("Game.Has").join("CM.Sim.Has").split("Game.dragonAura]").join("CM.Sim.dragonAura]").split("Game.dragonAura2]").join("CM.Sim.dragonAura2]").split("Game.auraMult").join("CM.Sim.auraMult").split("Game.hasGod").join("CM.Sim.hasGod").split("M.gods[what]").join("CM.Sim.Objects.Temple.minigame.gods[what]").split("M.slot[i]").join("CM.Sim.Objects.Temple.minigame.slot[i]").split("Game.effs").join("CM.Sim.effs").split("Game.Objects").join("CM.Sim.Objects").split("Game.GetTieredCpsMult").join("CM.Sim.GetTieredCpsMult").split("Game.eff").join("CM.Sim.eff")};CM.Sim.CreateSimFunctions=function(){CM.Sim.Has=new Function(`return ${CM.Sim.ReplaceFunction(Game.Has)}`)();CM.Sim.HasAchiev=new Function(`return ${CM.Sim.ReplaceFunction(Game.HasAchiev)}`)();CM.Sim.hasAura=new Function(`return ${CM.Sim.ReplaceFunction(Game.hasAura)}`)();if(Game.hasGod)CM.Sim.hasGod=new Function(`return ${CM.Sim.ReplaceFunction(Game.hasGod)}`)();CM.Sim.GetHeavenlyMultiplier=new Function(`return ${CM.Sim.ReplaceFunction(Game.GetHeavenlyMultiplier)}`)();CM.Sim.auraMult=new Function(`return ${CM.Sim.ReplaceFunction(Game.auraMult)}`)();CM.Sim.eff=new Function(`return ${CM.Sim.ReplaceFunction(Game.eff)}`)();CM.Sim.GetTieredCpsMult=new Function(`return ${CM.Sim.ReplaceFunction(Game.GetTieredCpsMult)}`)()};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.InitialBuildingData=function(buildingName){const me=Game.Objects[buildingName];const you={};you.cps=new Function(`return ${CM.Sim.ReplaceFunction(me.cps)}`)();you.baseCps=me.baseCps;you.name=me.name;you.tieredUpgrades=me.tieredUpgrades;you.synergies=me.synergies;you.fortune=me.fortune;you.grandma=me.grandma;you.baseCPS=me.baseCps;you.id=me.id;you.vanilla=me.vanilla;return you};CM.Sim.InitUpgrade=function(upgradeName){const me=Game.Upgrades[upgradeName];const you={};you.power=me.power;if(typeof me.power==="function"){me.power=new Function(`return ${CM.Sim.ReplaceFunction(me.power)}`)()}you.pool=me.pool;you.name=me.name;return you};CM.Sim.InitAchievement=function(achievementName){const me=Game.Achievements[achievementName];const you={};you.name=me.name;return you};CM.Sim.InitData=function(){CM.Sim.Objects=[];for(const i of Object.keys(Game.Objects)){CM.Sim.Objects[i]=CM.Sim.InitialBuildingData(i)}CM.Sim.Upgrades=[];for(const i of Object.keys(Game.Upgrades)){CM.Sim.Upgrades[i]=CM.Sim.InitUpgrade(i)}CM.Sim.Achievements=[];for(const 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(const i of Object.keys(Game.Objects)){const me=Game.Objects[i];let you=CM.Sim.Objects[i];if(you===undefined){CM.Sim.Objects[i]=CM.Sim.InitialBuildingData(i);you=CM.Sim.Objects[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(const i of Object.keys(Game.Upgrades)){const me=Game.Upgrades[i];let you=CM.Sim.Upgrades[i];if(you===undefined){CM.Sim.Upgrades[i]=CM.Sim.InitUpgrade(i);you=CM.Sim.Upgrades[i]}you.bought=me.bought}for(const i of Object.keys(Game.Achievements)){const me=Game.Achievements[i];let you=CM.Sim.Achievements[i];if(you===undefined){CM.Sim.Achievements[i]=CM.Sim.InitAchievement(i);you=CM.Sim.Achievements[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;const effs={};for(const i of Object.keys(Game.Objects)){if(Game.Objects[i].minigameLoaded&&Game.Objects[i].minigame.effs){const myEffs=Game.Objects[i].minigame.effs;for(const 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(const i of Object.keys(Game.cookieUpgrades)){const 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;const 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){const 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(const i of Object.keys(CM.Sim.Objects)){const 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");const rawCookiesPs=CM.Sim.cookiesPs*mult;for(const i of Object.keys(Game.CpsAchievements)){if(rawCookiesPs>=Game.CpsAchievements[i].threshold)CM.Sim.Win(Game.CpsAchievements[i].name)}CM.Sim.cookiesPsRaw=rawCookiesPs;const n=Game.shimmerTypes.golden.n;const 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(const 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(const 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(const 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")){const list=Game.Tiers.fortune.upgrades;let fortunes=0;for(const 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();const 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(const 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)}}}const 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();const 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")}const lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!==CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}const 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(const i of Object.keys(CM.Sim.Objects)){num+=CM.Sim.Objects[i].amount}num-=CM.Sim.Objects.Cursor.amount;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){const 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(const 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();const 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){const 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}}}const 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;const lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!==CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}const 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(const i of Object.keys(CM.Sim.Objects)){const 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!==Number(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){const save=JSON.parse(str);CM.Config.LoadConfig(save.settings);if(save.version!==`${CM.VersionMajor}.${CM.VersionMinor}`){if(Game.prefs.popups)Game.Popup("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!");else Game.Notify("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!","","",0,1)}};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();const 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:"4"};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.HeavenlyChipsDiff=new CMAvgQueue(5);CM.Cache.CacheHeavenlyChipsPS();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();CM.Cache.CacheHeavenlyChipsPS();const cookiesToNext=Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))+1)-(Game.cookiesEarned+Game.cookiesReset);CM.Cache.TimeTillNextPrestige=CM.Disp.FormatTime(cookiesToNext/CM.Disp.GetCPS())};class CMAvgQueue{constructor(maxLength){this.maxLength=maxLength;this.queue=[]}addLatest(newValue){if(this.queue.push(newValue)>this.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.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;const 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(const 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(const 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 nextRequired=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.ChainMaxReward=CM.Cache.MaxChainCookieReward(7,maxPayout,CM.Cache.GoldenCookiesMult);CM.Cache.ChainRequired=CM.Cache.ChainMaxReward[1]*2/CM.Cache.GoldenCookiesMult;CM.Cache.ChainRequiredNext=CM.Cache.ChainMaxReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainMaxWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout,CM.Cache.WrathCookiesMult);CM.Cache.ChainWrathRequired=CM.Cache.ChainMaxWrathReward[1]*2/CM.Cache.WrathCookiesMult;CM.Cache.ChainWrathRequiredNext=CM.Cache.ChainMaxWrathReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyMaxReward=CM.Cache.MaxChainCookieReward(7,maxPayout*7,CM.Cache.GoldenCookiesMult);CM.Cache.ChainFrenzyRequired=CM.Cache.ChainFrenzyMaxReward[1]*2/CM.Cache.GoldenCookiesMult;CM.Cache.ChainFrenzyRequiredNext=CM.Cache.ChainFrenzyMaxReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment;CM.Cache.ChainFrenzyMaxWrathReward=CM.Cache.MaxChainCookieReward(6,maxPayout*7,CM.Cache.WrathCookiesMult);CM.Cache.ChainFrenzyWrathRequired=CM.Cache.ChainFrenzyMaxWrathReward[1]*2/CM.Cache.WrathCookiesMult;CM.Cache.ChainFrenzyWrathRequiredNext=CM.Cache.ChainFrenzyMaxWrathReward[2]/60/60/6/CM.Cache.DragonsFortuneMultAdjustment};CM.Cache.CacheMissingUpgrades=function(){CM.Cache.MissingUpgrades="";CM.Cache.MissingUpgradesCookies="";CM.Cache.MissingUpgradesPrestige="";const list=[];for(const i of Object.keys(Game.Upgrades)){list.push(Game.Upgrades[i])}const sortMap=function(a,b){if(a.order>b.order)return 1;else if(a.order0)choEggTotal+=CM.Cache.WrinklersTotal;CM.Cache.RealCookiesEarned=Math.max(Game.cookiesEarned,choEggTotal);choEggTotal*=.05;const timeDiff=currDate-CM.Cache.lastCPSCheck;const bankDiffAvg=Math.max(0,Game.cookies-CM.Cache.lastCookies)/timeDiff;const wrinkDiffAvg=Math.max(0,CM.Cache.WrinklersTotal-CM.Cache.lastWrinkCookies)/timeDiff;const wrinkFattestDiffAvg=Math.max(0,CM.Cache.WrinklersFattest[0]-CM.Cache.lastWrinkFattestCookies)/timeDiff;const choEggDiffAvg=Math.max(0,choEggTotal-CM.Cache.lastChoEgg)/timeDiff;const clicksDiffAvg=(Game.cookieClicks-CM.Cache.lastClicks)/timeDiff;for(let i=0;iCM.Cache.max)color=CM.Disp.colorPurple;else if(me.pp>CM.Cache.mid)color=CM.Disp.colorOrange;else color=CM.Disp.colorYellow;if(Number(CM.Options.PPSecondsLowerLimit)!==0){if(price/CM.Disp.GetCPS()0)color=CM.Disp.colorRed}return color};CM.Cache.CacheBuildingsPP=function(){CM.Cache.min=Infinity;CM.Cache.max=1;CM.Cache.ArrayOfPPs=[];if(typeof CM.Options.PPExcludeTop==="undefined")CM.Options.PPExcludeTop=0;if(CM.Options.ColorPPBulkMode===0){for(const i of Object.keys(CM.Cache.Objects1)){if(Game.cookiesPs){CM.Cache.Objects1[i].pp=Math.max(Game.Objects[i].getPrice()-(Game.cookies+CM.Disp.GetWrinkConfigBank()),0)/Game.cookiesPs+Game.Objects[i].getPrice()/CM.Cache.Objects1[i].bonus}else CM.Cache.Objects1[i].pp=Game.Objects[i].getPrice()/CM.Cache.Objects1[i].bonus;CM.Cache.ArrayOfPPs.push([CM.Cache.Objects1[i].pp,Game.Objects[i].getPrice()])}CM.Cache.ArrayOfPPs.sort(((a,b)=>a[0]-b[0]));if(CM.Options.PPOnlyConsiderBuyable){while(CM.Cache.ArrayOfPPs[0][1]>Game.cookies){if(CM.Cache.ArrayOfPPs.length===1){break}CM.Cache.ArrayOfPPs.shift()}}CM.Cache.min=CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop][0];CM.Cache.max=CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length-1][0];CM.Cache.mid=(CM.Cache.max-CM.Cache.min)/2+CM.Cache.min;for(const i of Object.keys(CM.Cache.Objects1)){CM.Cache.Objects1[i].color=CM.Cache.ColourOfPP(CM.Cache.Objects1[i],Game.Objects[i].getPrice());for(let j=0;ja[0]-b[0]));if(CM.Options.PPOnlyConsiderBuyable){while(CM.Cache.ArrayOfPPs[0][1]>Game.cookies){if(CM.Cache.ArrayOfPPs.length===1){break}CM.Cache.ArrayOfPPs.shift()}}CM.Cache.min=CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop][0];CM.Cache.max=CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length-1][0];CM.Cache.mid=(CM.Cache.max-CM.Cache.min)/2+CM.Cache.min;for(const i of Object.keys(CM.Cache.Objects1)){CM.Cache[target][i].color=CM.Cache.ColourOfPP(CM.Cache[target][i],Game.Objects[i].bulkPrice);for(let j=0;j-1&&CM.Options[i]-1&&CM.Options[i][j]<2)){mod=true;CM.Options[i][j]=CM.Data.ConfigDefault[i][j]}}}else{for(const 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(const 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){const 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.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.ColorPPBulkMode={type:"bool",group:"Calculation",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,func:function(){CM.Cache.CachePP()}};CM.Data.Config.PPExcludeTop={type:"bool",group:"Calculation",label:["Don't Ignore Any","Ignore 1st Best","Ignore 1st and 2nd Best","Ignore 1st, 2nd and 3rd Best"],desc:"Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values",toggle:true};CM.Data.Config.PPSecondsLowerLimit={type:"numscale",group:"Calculation",label:"Lower limit for PP (in seconds): ",desc:'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option',min:0,max:Infinity};CM.Data.Config.PPOnlyConsiderBuyable={type:"bool",group:"Calculation",label:["Don't Ignore Non-Buyable","Ignore Non-Buyable"],desc:"Makes CookieMonster label buildings and upgrades you can't buy right now red, useful in those situations where you just want to spend your full bank 'most optimally'",toggle:true};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.ToolWarnUser={type:"numscale",group:"Tooltip",label:"Tooltip Warning At x times CPS: ",desc:"Use this to show a customized warning if buying it will put the bank under the amount equal to value times cps; setting to 0 disables the function altogether",min:0,max:Infinity};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 Extra Info Ascend Tooltip OFF","Show Extra Info Ascend Tooltip ON"],desc:"Shows additional info in the ascend tooltip",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.HeavenlyChipsTarget={type:"numscale",group:"Statistics",label:"Heavenly Chips Target: ",desc:'Use this to set a Heavenly Chips target that will be counted towards in the "prestige" statsistics sections',min:1,max:Infinity};CM.Data.Config.ShowMissedGC={type:"bool",group:"Statistics",label:["Missed GC OFF","Missed GC ON"],desc:"Show a stat in the statistics screen that counts how many Golden Cookies you have missed",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,UpBarColor:1,UpgradeBarFixedPos:1,CalcWrink:0,CPSMode:1,AvgCPSHist:3,AvgClicksHist:0,ColorPPBulkMode:1,PPExcludeTop:0,PPSecondsLowerLimit:0,PPOnlyConsiderBuyable: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,ToolWarnUser:0,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,HeavenlyChipsTarget:1,ShowMissedGC: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,Chain:1,Spells:1,Garden:1,Prestige:1,Wrink:1,Sea:1,Misc:1,InfoTab:1}};CM.Data.ModDescription=`
\nCookie Monster\noffers a wide range of tools and statistics to enhance your game experience.\nIt is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.
\nProgess on new updates and all previous release notes can be found on the GitHub page linked above!
\nPlease also report any bugs you may find over there!
\n
\n`;CM.Data.LatestReleaseNotes=`
\nThe latest update (v 2.031.4) has introduced the following features:
\n- Added a changelog to the info tab and notification indicating a new version
\n- Warnings in tooltips are now based on the income after buying the upgrade
\n- A new warning and stat for Conjure Baked Goods in combination with Frenzy has been added
\n- User can now set a custom tooltip warning ("x times cps") in the settings
\n- Garden plots with plants that give cookies on harvest now display a tooltip with current and maximum reward
\n- The Harvest All button in the Garden now has a tooltip displaying the current reward
\n- The Ascend button can now display additional info (this can be turned off in the settings)
\n- The statistics page now displays the Heavenly Chips per second
\n- The statistics page now displays the CPS needed for the next level in Chain Cookies
\n- The statistics page now displays the cookies needed for optimal rewards for garden plants
\n- You can now set a Heavenly Chips target in the settings which will be counted down to in the statistics page
\n- The color picker in the settings has been updated to its latest version
\n- The overlay of seconds/percentage of timers is now toggle able and more readable
\n- You can now toggle to disable bulk-buying from buying less than the selected amount (i.e., buying 7 of a building by pressing the buy 10 when you don't have enough for 10)
\n- CookieMonster now uses the Modding API provided by the base game
\n- There is a new option that allows the decoupling of the base game volume setting and the volumes of sounds created by the mod
\n- The tab title now displays a "!" if a Golden Cookie or Reindeer can spawn
\n- PP calculation can now be set to: 1) Exclude the 1st, 2nd or 3rd most optimal building (if you never want to buy that it), 2) Always consider optimal buildings that cost below "xx seconds of CPS" (toggleable in the settings), 3) Ignore any building or upgrade that is not purchasable at the moment
\n
\nThis update fixes the following bugs:
\n- Minigames with enhanced tooltips will now also show these if the minigames were not loaded when CookieMonster was loaded
\n- Sound, Flashes and Notifications will no longer play when the mod is initializing
\n- The color picker should now update its display consistently
\n- Fixed some typo's
\n- Fixed a game breaking bug when the player had not purchased any upgrades
\n- Fixed a number of console errors thrown by CM
\n- Fixed the integration with mods that provide additional content, they should now no longer break CookieMonster
\n- The Timer bar will now disappear correctly when the Golden Switch has been activated
\n- Fixed errors in the calculation of the Chain Cookies and Wrinkler stats
\n- Fixed buy warnings showing incorrectly
\n
\n`;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(const 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&&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){const decimals=CM.Options.ScaleDecimals+1;if(CM.Options.Scale===0){return CM.Backup.Beautify(num,floats)}else if(Number.isFinite(num)){let answer="";if(num===0){return num.toString()}else if(num>.001&&num=.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(const i of Object.keys(CM.Disp.BuffTimerBars)){CM.Disp.BuffTimerBars[i].remove()}CM.Disp.BuffTimerBars={};for(const i of Object.keys(Game.buffs)){if(Game.buffs[i]){const 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(const 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(){const target=`Objects${Game.buyBulk}`;if(Game.buyMode===1){if(CM.Options.BuildColor===1){for(const 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(const i of Object.keys(Game.Objects)){l(`productPrice${Game.Objects[i].id}`).style.removeProperty("color")}}}else if(Game.buyMode===-1){for(const i of Object.keys(CM.Cache.Objects1)){const 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){const arr=Object.keys(CM.Cache[target]).map((k=>{const o=CM.Cache[target][k];o.name=k;o.id=Game.Objects[k].id;return o}));arr.sort((function(a,b){return CM.Disp.colors.indexOf(a.color)>CM.Disp.colors.indexOf(b.color)?1:CM.Disp.colors.indexOf(a.color){const 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(const i of Object.keys(Game.UpgradesInStore)){const me=Game.UpgradesInStore[i];let addedColor=false;for(let j=0;jCM.Disp.colors.indexOf(a.color)-CM.Disp.colors.indexOf(b.color)))}else{arr.sort(((a,b)=>a.price-b.price))}const nameChecker=function(arr2,upgrade){return arr2.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){const 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(const 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(const 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");const desc=document.createElement("div");desc.style.minWidth=minWidth;desc.style.marginBottom="4px";const 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(const 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){const buildPrice=CM.Sim.BuildingGetPrice(Game.Objects[name],Game.Objects[name].basePrice,0,Game.Objects[name].free,Game.Objects[name].amount);const 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"){const 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";const 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){const 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"));const 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";const 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"));const pp=document.createElement("div");pp.style.marginBottom="4px";pp.id="CMTooltipPP";tooltip.appendChild(pp);tooltip.appendChild(CM.Disp.TooltipCreateHeader("Time Left"));const 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";const 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";const create=function(boxId,color,labelTextFront,labelTextBack,deficitId){const 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)";const labelDiv=document.createElement("div");box.appendChild(labelDiv);const 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));const deficitDiv=document.createElement("div");box.appendChild(deficitDiv);const 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"));if(Game.Objects["Wizard tower"].minigameLoaded){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"))}CM.Disp.TooltipWarn.lastChild.style.marginBottom="4px";CM.Disp.TooltipWarn.appendChild(create("CMDispTooltipWarnUser",CM.Disp.colorRed,"Warning: ",`Purchase of this item will put you under the number of Cookies equal to ${CM.Options.ToolWarnUser} seconds of CPS`,"CMDispTooltipWarnUserText"));return CM.Disp.TooltipWarn};CM.Disp.UpdateTooltip=function(){CM.Sim.CopyData();if(l("tooltipAnchor").style.display!=="none"&&l("CMTooltipArea")){l("CMTooltipArea").innerHTML="";const 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){const tooltipBox=l("CMTooltipBorder");CM.Disp.TooltipCreateCalculationSection(tooltipBox);const 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);const increase=Math.round(CM.Disp.TooltipBonusIncome/Game.cookiesPs*1e4);if(Number.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;const 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;const 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)"));const 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(){const 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){const tile=minigame.plot[y][x];const me=minigame.plantsById[tile[0]-1];const plantName=me.name;let count=true;if(mortal&&me.immortal)count=false;if(tile[1]0){if(amount0&&me.selected){showingTooltip=true;if(CM.Disp.TooltipWrinklerBeingShown[i]===0||CM.Disp.TooltipWrinklerBeingShown[i]===undefined){const placeholder=document.createElement("div");const wrinkler=document.createElement("div");wrinkler.style.minWidth="120px";wrinkler.style.marginBottom="4px";const 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){const 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){const[bonusCPS,priceOfChange]=CM.Sim.CalculateChangeAura(aura);const timeToRecover=CM.Disp.FormatTime(priceOfChange/(bonusCPS+Game.cookiesPs));const bonusCPSPercentage=CM.Disp.Beautify(bonusCPS/Game.cookiesPs);l("dragonAuraInfo").style.minHeight="60px";l("dragonAuraInfo").style.margin="8px";l("dragonAuraInfo").appendChild(document.createElement("div")).className="line";const div=document.createElement("div");div.style.minWidth="200px";div.style.textAlign="center";div.textContent=`Picking this aura will change CPS by ${CM.Disp.Beautify(bonusCPS)} (${bonusCPSPercentage}% of current CPS).`;l("dragonAuraInfo").appendChild(div);const 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(){const title=document.createElement("div");title.className="title";if(Game.onMenu==="prefs"){title.textContent="Cookie Monster Settings";CM.Disp.AddMenuPref(title)}else if(Game.onMenu==="stats"){if(CM.Options.Stats){title.textContent="Cookie Monster Statistics";CM.Disp.AddMenuStats(title)}}else if(Game.onMenu==="log"){title.textContent="Cookie Monster ";CM.Disp.AddMenuInfo(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){const frag=document.createDocumentFragment();frag.appendChild(title);for(const group of Object.keys(CM.Data.ConfigGroups)){const groupObject=CM.Disp.CreatePrefHeader(group,CM.Data.ConfigGroups[group]);frag.appendChild(groupObject);if(CM.Options.Header[group]){if(group==="Notification"){for(const subGroup of Object.keys(CM.Data.ConfigGroupsNotification)){const 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(const option in CM.Data.Config){if(CM.Data.Config[option].group===subGroup)frag.appendChild(CM.Disp.CreatePrefOption(option))}}}}else{for(const option of Object.keys(CM.Data.Config)){if(CM.Data.Config[option].group===group)frag.appendChild(CM.Disp.CreatePrefOption(option))}}}}const resDef=document.createElement("div");resDef.className="listing";const 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){const div=document.createElement("div");div.className="title";div.style.opacity="0.7";div.style.fontSize="17px";div.appendChild(document.createTextNode(`${text} `));const 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){const div=document.createElement("div");div.className="listing";if(CM.Data.Config[config].type==="bool"){const 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);const label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}else if(CM.Data.Config[config].type==="vol"){const volume=document.createElement("div");volume.className="sliderBox";const title=document.createElement("div");title.style.float="left";title.innerHTML=CM.Data.Config[config].desc;volume.appendChild(title);const percent=document.createElement("div");percent.id=`slider${config}right`;percent.style.float="right";percent.innerHTML=`${CM.Options[config]}%`;volume.appendChild(percent);const 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"){const span=document.createElement("span");span.className="option";span.textContent=`${CM.Data.Config[config].label} `;div.appendChild(span);const 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(" "));const inputPrompt=document.createElement("input");inputPrompt.id=`${CM.Config.ConfigPrefix+config}Prompt`;inputPrompt.className="option";inputPrompt.type="text";inputPrompt.setAttribute("value",CM.Options[config]);const 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);const label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}else if(CM.Data.Config[config].type==="color"){div.className="";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(" "));const label=document.createElement("label");label.textContent=CM.Data.Config[config].desc;div.appendChild(label);return div}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){const popAllFrag=document.createDocumentFragment();popAllFrag.appendChild(document.createTextNode(`${Beautify(CM.Cache.WrinklersTotal)} / ${Beautify(CM.Cache.WrinklersNormal)} `));const 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));const popFattestFrag=document.createDocumentFragment();popFattestFrag.appendChild(document.createTextNode(`${Beautify(CM.Cache.WrinklersFattest[0])} `));const 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]!==null?CM.Cache.WrinklersFattest[1]:"None"})`,popFattestFrag))}}let specDisp=false;const missingHalloweenCookies=[];for(const i of Object.keys(CM.Data.HalloCookies)){if(!Game.Has(CM.Data.HalloCookies[i])){missingHalloweenCookies.push(CM.Data.HalloCookies[i]);specDisp=true}}const missingChristmasCookies=[];for(const i of Object.keys(CM.Data.ChristCookies)){if(!Game.Has(CM.Data.ChristCookies[i])){missingChristmasCookies.push(CM.Data.ChristCookies[i]);specDisp=true}}const missingValentineCookies=[];for(const i of Object.keys(CM.Data.ValCookies)){if(!Game.Has(CM.Data.ValCookies[i])){missingValentineCookies.push(CM.Data.ValCookies[i]);specDisp=true}}const missingNormalEggs=[];for(const i of Object.keys(Game.eggDrops)){if(!Game.HasUnlocked(Game.eggDrops[i])){missingNormalEggs.push(Game.eggDrops[i]);specDisp=true}}const missingRareEggs=[];for(const i of Object.keys(Game.rareEggDrops)){if(!Game.HasUnlocked(Game.rareEggDrops[i])){missingRareEggs.push(Game.rareEggDrops[i]);specDisp=true}}const missingPlantDrops=[];for(const i of Object.keys(CM.Data.PlantDrops)){if(!Game.HasUnlocked(CM.Data.PlantDrops[i])){missingPlantDrops.push(CM.Data.PlantDrops[i]);specDisp=true}}const choEgg=Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg");const 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.Disp.GetCPS(),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")){const fortunes=[];for(const 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)))}if(CM.Options.ShowMissedGC){stats.appendChild(CM.Disp.CreateStatsListing("basic","Missed Golden Cookies",document.createTextNode(Beautify(Game.missedGoldenClicks))))}if(Game.prefs.autosave){const 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){const div=document.createElement("div");div.className="title";div.style.padding="0px 16px";div.style.opacity="0.7";div.style.fontSize="17px";div.style.fontFamily='"Kavoon", Georgia, serif';div.appendChild(document.createTextNode(`${text} `));const 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){const div=document.createElement("div");div.className="listing";const listingName=document.createElement("b");listingName.textContent=name;div.appendChild(listingName);if(type==="withTooltip"){div.className="listing";div.appendChild(document.createTextNode(" "));const 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(text);return div};CM.Disp.CreateStatsMissDisp=function(theMissDisp){const frag=document.createDocumentFragment();frag.appendChild(document.createTextNode(`${theMissDisp.length} `));const span=document.createElement("span");span.onmouseout=function(){Game.tooltip.hide()};const placeholder=document.createElement("div");const missing=document.createElement("div");missing.style.minWidth="140px";missing.style.marginBottom="4px";const title=document.createElement("div");title.className="name";title.style.marginBottom="4px";title.style.textAlign="center";title.textContent="Missing";missing.appendChild(title);for(const i of Object.keys(theMissDisp)){const 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(){const goldCookTooltip=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder";const section=document.createElement("div");section.className="CMStatsLuckySection";const luckyColor=Game.cookies+CM.Disp.GetWrinkConfigBank()0){section.appendChild(CM.Disp.CreateStatsListing("basic","Heavenly Chips To Target Set In Settings (CUR)",document.createTextNode(Beautify(CookiesTillTarget))));section.appendChild(CM.Disp.CreateStatsListing("basic","Time To Target (CUR, Current 5 Second Average)",document.createTextNode(CM.Disp.FormatTime(CookiesTillTarget/CM.Cache.HCPerSecond))))}}const resetBonus=CM.Sim.ResetBonus(possiblePresMax);const resetFrag=document.createDocumentFragment();resetFrag.appendChild(document.createTextNode(Beautify(resetBonus)));const increase=Math.round(resetBonus/Game.cookiesPs*1e4);if(isFinite(increase)&&increase!==0){const resetSmall=document.createElement("small");resetSmall.textContent=` (${increase/100}% of income)`;resetFrag.appendChild(resetSmall)}section.appendChild(CM.Disp.CreateStatsListing("withTooltip","Reset Bonus Income",resetFrag,"ResetTooltipPlaceholder"));const currentPrestige=Math.floor(Game.HowMuchPrestige(Game.cookiesReset));const willHave=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned));const willGet=willHave-currentPrestige;if(!Game.Has("Lucky digit")){let delta7=7-willHave%10;if(delta7<0)delta7+=10;const next7Reset=willGet+delta7;const next7Total=willHave+delta7;const 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")){let delta777=777-willHave%1e3;if(delta777<0)delta777+=1e3;const next777Reset=willGet+delta777;const next777Total=willHave+delta777;const 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")){let delta777777=777777-willHave%1e6;if(delta777777<0)delta777777+=1e6;const next777777Reset=willGet+delta777777;const next777777Total=willHave+delta777777;const frag777777=document.createDocumentFragment();frag777777.appendChild(document.createTextNode(`${next777777Total.toLocaleString()} / ${next777777Reset.toLocaleString()} (+${delta777777})`));section.appendChild(CM.Disp.CreateStatsListing("basic",'Next "Lucky Payout" (total / reset)',frag777777))}return section};CM.Disp.AddMissingUpgrades=function(){for(const menuSection of l("menu").children){if(menuSection.children[0]){if(menuSection.children[0].innerHTML==="Prestige"&&CM.Cache.MissingUpgradesPrestige){const prestigeUpgradesMissing=CM.Cache.MissingUpgradesPrestige.match(new RegExp("div","g")||[]).length/2;const title=document.createElement("div");title.id="CMMissingUpgradesPrestigeTitle";title.className="listing";const titlefrag=document.createElement("div");titlefrag.innerHTML=`Missing Prestige upgrades: ${prestigeUpgradesMissing}/${Game.PrestigeUpgrades.length} (${Math.floor(prestigeUpgradesMissing/Game.PrestigeUpgrades.length*100)}%)`;title.appendChild(titlefrag);menuSection.appendChild(title);const 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){const normalUpgradesMissing=CM.Cache.MissingUpgrades.match(new RegExp("div","g")||[]).length/2;const title=document.createElement("div");title.id="CMMissingUpgradesTitle";title.className="listing";const 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]);const upgrades=document.createElement("div");upgrades.className="listing crateBox";upgrades.innerHTML=CM.Cache.MissingUpgrades;menuSection.insertBefore(upgrades,document.getElementById("CMMissingUpgradesTitle").nextSibling)}if(CM.Cache.MissingUpgradesCookies){const cookieUpgradesMissing=CM.Cache.MissingUpgradesCookies.match(new RegExp("div","g")||[]).length/2;const title=document.createElement("div");title.id="CMMissingUpgradesCookiesTitle";title.className="listing";const 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);const 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();const tooltip=`function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;return`
\n\t
`};CM.Disp.AddMenuInfo=function(title){const info=document.createElement("div");info.className="subsection";const 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.InfoTab?"-":"+";span.onclick=function(){CM.Config.ToggleHeader("InfoTab");Game.UpdateMenu()};title.appendChild(span);info.appendChild(title);if(CM.Options.Header.InfoTab){const description=document.createElement("div");description.innerHTML=CM.Data.ModDescription;info.appendChild(description);const notes=document.createElement("div");notes.innerHTML=CM.Data.LatestReleaseNotes;info.appendChild(notes)}const menu=l("menu").children[1];menu.insertBefore(info,menu.children[1])};CM.Disp.CreateWrinklerButtons=function(){const 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);const 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"],["ChainNextLevelPlaceholder","Cheated cookies might break this formula","250px"]];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.colorGray,CM.Disp.colorBlue,CM.Disp.colorGreen,CM.Disp.colorYellow,CM.Disp.colorOrange,CM.Disp.colorRed,CM.Disp.colorPurple,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.Main.LastModCount!==Object.keys(Game.mods).length){CM.Sim.CreateSimFunctions();CM.Sim.InitData();CM.Cache.InitCache();CM.Main.LastModCount=Object.keys(Game.mods).length}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}const 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.CreateSimFunctions();CM.Sim.InitData();CM.Cache.InitCache();CM.Main.LastModCount=Object.keys(Game.mods).length;CM.Disp.CreateCssArea();CM.Disp.CreateBotBar();CM.Disp.CreateTimerBar();CM.Disp.CreateUpgradeBar();CM.Disp.CreateWhiteScreen();CM.Disp.CreateFavicon();for(const 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 ? `
It takes ${CM.Cache.TimeTillNextPrestige} to reach the next level and you are making ${Beautify(CM.Cache.HCPerSecond, 2)} chips on average in the last 5 seconds.
` : ``}`;")}`)();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){const 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){const 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{const 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(const 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(const 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(const 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(const 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){const 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.ReplaceFunction=function(funcToBeReplaced){return funcToBeReplaced.toString().split("Game.Upgrades[").join("CM.Sim.Upgrades[").split("Game.Achievements").join("CM.Sim.Achievements").split("Game.Has").join("CM.Sim.Has").split("Game.dragonAura]").join("CM.Sim.dragonAura]").split("Game.dragonAura2]").join("CM.Sim.dragonAura2]").split("Game.auraMult").join("CM.Sim.auraMult").split("Game.hasGod").join("CM.Sim.hasGod").split("M.gods[what]").join("CM.Sim.Objects.Temple.minigame.gods[what]").split("M.slot[i]").join("CM.Sim.Objects.Temple.minigame.slot[i]").split("Game.effs").join("CM.Sim.effs").split("Game.Objects").join("CM.Sim.Objects").split("Game.GetTieredCpsMult").join("CM.Sim.GetTieredCpsMult").split("Game.eff").join("CM.Sim.eff")};CM.Sim.CreateSimFunctions=function(){CM.Sim.Has=new Function(`return ${CM.Sim.ReplaceFunction(Game.Has)}`)();CM.Sim.HasAchiev=new Function(`return ${CM.Sim.ReplaceFunction(Game.HasAchiev)}`)();CM.Sim.hasAura=new Function(`return ${CM.Sim.ReplaceFunction(Game.hasAura)}`)();if(Game.hasGod)CM.Sim.hasGod=new Function(`return ${CM.Sim.ReplaceFunction(Game.hasGod)}`)();CM.Sim.GetHeavenlyMultiplier=new Function(`return ${CM.Sim.ReplaceFunction(Game.GetHeavenlyMultiplier)}`)();CM.Sim.auraMult=new Function(`return ${CM.Sim.ReplaceFunction(Game.auraMult)}`)();CM.Sim.eff=new Function(`return ${CM.Sim.ReplaceFunction(Game.eff)}`)();CM.Sim.GetTieredCpsMult=new Function(`return ${CM.Sim.ReplaceFunction(Game.GetTieredCpsMult)}`)()};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.InitialBuildingData=function(buildingName){const me=Game.Objects[buildingName];const you={};you.cps=new Function(`return ${CM.Sim.ReplaceFunction(me.cps)}`)();you.baseCps=me.baseCps;you.name=me.name;you.tieredUpgrades=me.tieredUpgrades;you.synergies=me.synergies;you.fortune=me.fortune;you.grandma=me.grandma;you.baseCPS=me.baseCps;you.id=me.id;you.vanilla=me.vanilla;return you};CM.Sim.InitUpgrade=function(upgradeName){const me=Game.Upgrades[upgradeName];const you={};you.power=me.power;if(typeof me.power==="function"){me.power=new Function(`return ${CM.Sim.ReplaceFunction(me.power)}`)()}you.pool=me.pool;you.name=me.name;return you};CM.Sim.InitAchievement=function(achievementName){const me=Game.Achievements[achievementName];const you={};you.name=me.name;return you};CM.Sim.InitData=function(){CM.Sim.Objects=[];for(const i of Object.keys(Game.Objects)){CM.Sim.Objects[i]=CM.Sim.InitialBuildingData(i)}CM.Sim.Upgrades=[];for(const i of Object.keys(Game.Upgrades)){CM.Sim.Upgrades[i]=CM.Sim.InitUpgrade(i)}CM.Sim.Achievements=[];for(const 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(const i of Object.keys(Game.Objects)){const me=Game.Objects[i];let you=CM.Sim.Objects[i];if(you===undefined){CM.Sim.Objects[i]=CM.Sim.InitialBuildingData(i);you=CM.Sim.Objects[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(const i of Object.keys(Game.Upgrades)){const me=Game.Upgrades[i];let you=CM.Sim.Upgrades[i];if(you===undefined){CM.Sim.Upgrades[i]=CM.Sim.InitUpgrade(i);you=CM.Sim.Upgrades[i]}you.bought=me.bought}for(const i of Object.keys(Game.Achievements)){const me=Game.Achievements[i];let you=CM.Sim.Achievements[i];if(you===undefined){CM.Sim.Achievements[i]=CM.Sim.InitAchievement(i);you=CM.Sim.Achievements[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;const effs={};for(const i of Object.keys(Game.Objects)){if(Game.Objects[i].minigameLoaded&&Game.Objects[i].minigame.effs){const myEffs=Game.Objects[i].minigame.effs;for(const 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(const i of Object.keys(Game.cookieUpgrades)){const 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;const 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){const 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(const i of Object.keys(CM.Sim.Objects)){const 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-(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");const rawCookiesPs=CM.Sim.cookiesPs*mult;for(const i of Object.keys(Game.CpsAchievements)){if(rawCookiesPs>=Game.CpsAchievements[i].threshold)CM.Sim.Win(Game.CpsAchievements[i].name)}CM.Sim.cookiesPsRaw=rawCookiesPs;const n=Game.shimmerTypes.golden.n;const 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(const 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(const 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(const 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")){const list=Game.Tiers.fortune.upgrades;let fortunes=0;for(const 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();const 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(const 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)}}}const 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();const 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")}const lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!==CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}const 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(const i of Object.keys(CM.Sim.Objects)){num+=CM.Sim.Objects[i].amount}num-=CM.Sim.Objects.Cursor.amount;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){const 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(const 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();const 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){const 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*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}}}const 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;const lastAchievementsOwned=CM.Sim.AchievementsOwned;CM.Sim.CalculateGains();CM.Sim.CheckOtherAchiev();if(lastAchievementsOwned!==CM.Sim.AchievementsOwned){CM.Sim.CalculateGains()}const 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(const i of Object.keys(CM.Sim.Objects)){const 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!==Number(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){const save=JSON.parse(str);CM.Config.LoadConfig(save.settings);if(save.version!==`${CM.VersionMajor}.${CM.VersionMinor}`){if(Game.prefs.popups)Game.Popup("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!");else Game.Notify("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!","","",0,1)}};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();const 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/Data.js b/src/Data.js index 2bd27d6..560f55a 100644 --- a/src/Data.js +++ b/src/Data.js @@ -532,19 +532,22 @@ CM.Data.ModDescription = `
Cookie Monster offers a wide range of tools and statistics to enhance your game experience. It is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.
-Progess on new updates and all previous release notes can be found on the GitHub page linked above! +Progess on new updates and all previous release notes can be found on the GitHub page linked above!
+Please also report any bugs you may find over there!
`; CM.Data.LatestReleaseNotes = `
-The latest update (v 2.031.4) has introduced the following features:
The latest update (v 2.031.4) has introduced the following features:
+- Added a changelog to the info tab and notification indicating a new version
- Warnings in tooltips are now based on the income after buying the upgrade
- A new warning and stat for Conjure Baked Goods in combination with Frenzy has been added
- User can now set a custom tooltip warning ("x times cps") in the settings
- Garden plots with plants that give cookies on harvest now display a tooltip with current and maximum reward
-- The Harvest All button in the Garden now has a tooltip displaying the current reward
-- The Ascend button can now display additional info (this can be turned off in the settings)
+- The Harvest All button in the Garden now has a tooltip displaying the current reward
+- The Ascend button can now display additional info (this can be turned off in the settings)
- The statistics page now displays the Heavenly Chips per second
- The statistics page now displays the CPS needed for the next level in Chain Cookies
+- The statistics page now displays the cookies needed for optimal rewards for garden plants
- You can now set a Heavenly Chips target in the settings which will be counted down to in the statistics page
- The color picker in the settings has been updated to its latest version
- The overlay of seconds/percentage of timers is now toggle able and more readable
@@ -564,5 +567,6 @@ CM.Data.LatestReleaseNotes = `
- Fixed the integration with mods that provide additional content, they should now no longer break CookieMonster
- The Timer bar will now disappear correctly when the Golden Switch has been activated
- Fixed errors in the calculation of the Chain Cookies and Wrinkler stats
+- Fixed buy warnings showing incorrectly
`; From ab3a4b37bc2a5736b772a4a2e964dae614872733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Wed, 24 Feb 2021 00:21:44 +0100 Subject: [PATCH 3/3] Updated ESLint action --- .github/workflows/CI.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d6a3644..eb67a84 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,7 +6,9 @@ jobs: steps: - uses: actions/checkout@v2 - name: Run ESLint - run: npx eslint src + run: | + npm install + npx eslint src Check_main_file: runs-on: ubuntu-latest steps: