1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
(()=>{var __webpack_exports__={};CM.Main.Loop=function(){if(CM.Disp.lastAscendState!==Game.OnAscend&&(CM.Disp.lastAscendState=Game.OnAscend,CM.Disp.UpdateAscendState()),!Game.OnAscend&&0===Game.AscendTimer){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&&(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 e=Game.auraMult("Fierce Hoarder")>0;!CM.Cache.HadBuildAura&&e?(CM.Cache.HadBuildAura=!0,CM.Cache.DoRemakeBuildPrices=1):CM.Cache.HadBuildAura&&!e&&(CM.Cache.HadBuildAura=!1,CM.Cache.DoRemakeBuildPrices=1),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 e of Object.keys(CM.Disp.TooltipText))CM.Disp.CreateSimpleTooltip(CM.Disp.TooltipText[e][0],CM.Disp.TooltipText[e][1],CM.Disp.TooltipText[e][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,Game.prefs.popups?Game.Popup(`Cookie Monster version ${CM.VersionMajor}.${CM.VersionMinor} loaded!`):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(e,i,a){CM.Backup.tooltip.drawMod(e,i,a)},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,!1),l("bigCookie").addEventListener("click",(function(){CM.Main.FixMouseY(Game.ClickCookie)}),!1),CM.Backup.RebuildUpgrades=Game.RebuildUpgrades,Game.RebuildUpgrades=function(){CM.Backup.RebuildUpgrades(),CM.Disp.ReplaceTooltipUpgrade(),Game.CalculateGains()},CM.Backup.ClickProduct=Game.ClickProduct,Game.ClickProduct=function(e){(!CM.Options.BulkBuyBlock||Game.ObjectsById[e].bulkPrice<Game.cookies||-1===Game.buyMode)&&CM.Backup.ClickProduct(e)},CM.Backup.DescribeDragonAura=Game.DescribeDragonAura,Game.DescribeDragonAura=function(e){CM.Backup.DescribeDragonAura(e),CM.Disp.AddAuraInfo(e)},CM.Backup.ToggleSpecialMenu=Game.ToggleSpecialMenu,Game.ToggleSpecialMenu=function(e){CM.Backup.ToggleSpecialMenu(e),CM.Disp.AddDragonLevelUpTooltip()},CM.Backup.UpdateMenu=Game.UpdateMenu,Game.UpdateMenu=function(){void 0!==jscolor.picker&&void 0!==jscolor.picker.owner||(CM.Backup.UpdateMenu(),CM.Disp.AddMenu())},CM.Backup.sayTime=Game.sayTime,CM.Disp.sayTime=function(e,i){return Number.isNaN(e)||e<=0?CM.Backup.sayTime(e,i):CM.Disp.FormatTime(e/Game.fps,1)},CM.Backup.Logic=Game.Logic,CM.Backup.LogicMod=new Function(`return ${Game.Logic.toString().split("document.title").join("CM.Disp.Title").split("' more cookies</b> for the next level.<br>';").join("` more cookies</b> for the next level.<br>${CM.Options.TooltipAscendButton ? `<div class='line'></div>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.<br>` : ``}`;")}`)(),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=!1,CM.Main.ReplaceNativeGrimoireDraw()},CM.Main.HasReplaceNativeGrimoireLaunch=!0}},CM.Main.ReplaceNativeGrimoireDraw=function(){if(!CM.Main.HasReplaceNativeGrimoireDraw&&Game.Objects["Wizard tower"].minigameLoaded){const e=Game.Objects["Wizard tower"].minigame;CM.Backup.GrimoireDraw=e.draw,Game.Objects["Wizard tower"].minigame.draw=function(){CM.Backup.GrimoireDraw(),1===CM.Options.GrimoireBar&&e.magic<e.magicM&&(e.magicBarTextL.innerHTML+=` (${CM.Disp.FormatTime(CM.Disp.CalculateGrimoireRefillTime(e.magic,e.magicM,e.magicM))})`)},CM.Main.HasReplaceNativeGrimoireDraw=!0}},CM.Main.ReplaceTooltips=function(){CM.Main.ReplaceTooltipBuild(),CM.Main.ReplaceTooltipLump(),CM.Backup.LoadMinigames=Game.LoadMinigames,Game.LoadMinigames=function(){CM.Backup.LoadMinigames(),CM.Main.ReplaceTooltipGarden(),CM.Main.ReplaceTooltipGrimoire(),CM.Main.ReplaceNativeGrimoire()},Game.LoadMinigames()},CM.Main.ReplaceTooltipBuild=function(){CM.Main.TooltipBuildBackup=[];for(const i of Object.keys(Game.Objects)){const me=Game.Objects[i];null!==l(`product${me.id}`).onmouseover&&(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();}`))}},CM.Main.ReplaceTooltipLump=function(){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();}"))},CM.Main.ReplaceTooltipGrimoire=function(){if(Game.Objects["Wizard tower"].minigameLoaded){CM.Main.TooltipGrimoireBackup=[];for(const i in Game.Objects["Wizard tower"].minigame.spellsById)null!==l(`grimoireSpell${i}`).onmouseover&&(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();}`))}},CM.Main.ReplaceTooltipGarden=function(){Game.Objects.Farm.minigameLoaded&&(l("gardenTool-1").onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(function(){return CM.Disp.Tooltip("ha","HarvestAllButton")}),"this"),Game.tooltip.wobble()},Array.from(l("gardenPlot").children).forEach((e=>{const i=e.id.slice(-3);e.onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(function(){return CM.Disp.Tooltip("p",[`${i[0]}`,`${i[2]}`])}),"this"),Game.tooltip.wobble()}})))},CM.Main.FindShimmer=function(){CM.Main.currSpawnedGoldenCookieState=0,CM.Cache.goldenShimmersByID={};for(const e of Object.keys(Game.shimmers))CM.Cache.goldenShimmersByID[Game.shimmers[e].id]=Game.shimmers[e],Game.shimmers[e].spawnLead&&"golden"===Game.shimmers[e].type&&(CM.Cache.spawnedGoldenShimmer=Game.shimmers[e],CM.Main.currSpawnedGoldenCookieState+=1)},CM.Main.CheckGoldenCookie=function(){CM.Main.FindShimmer();for(const e of Object.keys(CM.Disp.GCTimers))void 0===CM.Cache.goldenShimmersByID[e]&&(CM.Disp.GCTimers[e].parentNode.removeChild(CM.Disp.GCTimers[e]),delete CM.Disp.GCTimers[e]);if(CM.Main.lastGoldenCookieState!==Game.shimmerTypes.golden.n){if(CM.Main.lastGoldenCookieState=Game.shimmerTypes.golden.n,CM.Main.lastGoldenCookieState){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!"));for(const e of Object.keys(Game.shimmers))void 0===CM.Disp.GCTimers[Game.shimmers[e].id]&&CM.Disp.CreateGCTimer(Game.shimmers[e])}CM.Disp.UpdateFavicon(),CM.Main.lastSpawnedGoldenCookieState=CM.Main.currSpawnedGoldenCookieState,0===CM.Main.currSpawnedGoldenCookieState&&(CM.Cache.spawnedGoldenShimmer=0)}else if(1===CM.Options.GCTimer&&CM.Main.lastGoldenCookieState)for(const e of Object.keys(CM.Disp.GCTimers))CM.Disp.GCTimers[e].style.opacity=CM.Cache.goldenShimmersByID[e].l.style.opacity,CM.Disp.GCTimers[e].style.transform=CM.Cache.goldenShimmersByID[e].l.style.transform,CM.Disp.GCTimers[e].textContent=Math.ceil(CM.Cache.goldenShimmersByID[e].life/Game.fps)},CM.Main.CheckSeasonPopup=function(){if(CM.Main.lastSeasonPopupState!==Game.shimmerTypes.reindeer.spawned){CM.Main.lastSeasonPopupState=Game.shimmerTypes.reindeer.spawned;for(const e of Object.keys(Game.shimmers))if(Game.shimmers[e].spawnLead&&"reindeer"===Game.shimmers[e].type){CM.Cache.seasonPopShimmer=Game.shimmers[e];break}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.Main.CheckTickerFortune=function(){CM.Main.lastTickerFortuneState!==(Game.TickerEffect&&"fortune"===Game.TickerEffect.type)&&(CM.Main.lastTickerFortuneState=Game.TickerEffect&&"fortune"===Game.TickerEffect.type,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.Main.CheckGardenTick=function(){Game.Objects.Farm.minigameLoaded&&CM.Main.lastGardenNextStep!==Game.Objects.Farm.minigame.nextStep&&(0!==CM.Main.lastGardenNextStep&&CM.Main.lastGardenNextStep<Date.now()&&(CM.Disp.Flash(3,"GardFlash"),CM.Disp.PlaySound(CM.Options.GardSoundURL,"GardSound","GardVolume")),CM.Main.lastGardenNextStep=Game.Objects.Farm.minigame.nextStep)},CM.Main.CheckMagicMeter=function(){if(Game.Objects["Wizard tower"].minigameLoaded&&1===CM.Options.GrimoireBar){const e=Game.Objects["Wizard tower"].minigame;e.magic<e.magicM?CM.Main.lastMagicBarFull=!1:CM.Main.lastMagicBarFull||(CM.Main.lastMagicBarFull=!0,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.Main.CheckWrinklerCount=function(){if(Game.elderWrath>0){let e=0;for(const i in Game.wrinklers)2===Game.wrinklers[i].phase&&e++;e>CM.Main.lastWrinklerCount?(CM.Main.lastWrinklerCount=e,e===Game.getWrinklersMax()&&CM.Options.WrinklerMaxFlash?CM.Disp.Flash(3,"WrinklerMaxFlash"):CM.Disp.Flash(3,"WrinklerFlash"),e===Game.getWrinklersMax()&&CM.Options.WrinklerMaxSound?CM.Disp.PlaySound(CM.Options.WrinklerMaxSoundURL,"WrinklerMaxSound","WrinklerMaxVolume"):CM.Disp.PlaySound(CM.Options.WrinklerSoundURL,"WrinklerSound","WrinklerVolume"),e===Game.getWrinklersMax()&&CM.Options.WrinklerMaxNotification?CM.Disp.Notification("WrinklerMaxNotification","Maximum Wrinklers Reached","You have reached your maximum ammount of wrinklers"):CM.Disp.Notification("WrinklerNotification","A Wrinkler appeared","A new wrinkler has appeared")):CM.Main.lastWrinklerCount=e}},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 e of Object.keys(Game.wrinklers))CM.Disp.TooltipWrinklerBeingShown[e]=0}},CM.Main.FixMouseY=function(e){if(1===CM.Options.TimerBar&&0===CM.Options.TimerBarPos){const i=parseInt(CM.Disp.TimerBar.style.height);Game.mouseY-=i,e(),Game.mouseY+=i}else e()}})(); |