From f65749db50583712d22046eb5b85c5677f4ec0e0 Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Fri, 4 Dec 2020 20:50:20 +0100 Subject: [PATCH 1/9] Fixed negative PP #406 --- CookieMonster.js | 8 ++++---- src/Sim.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index d1f554e..9210c3e 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -3951,11 +3951,11 @@ CM.Sim.hasGod=function(what) { CM.Sim.eff = function(name) { if (typeof CM.Sim.effs[name]==='undefined') { - CM.Sim.effs[name] = 1 - return CM.Sim.effs[name] + CM.Sim.effs[name] = 1; + return CM.Sim.effs[name]; } else { - return Game.effs[name]; + return CM.Sim.effs[name]; } } @@ -4089,7 +4089,7 @@ CM.Sim.CalculateGains = function() { var mult = 1; // Include minigame effects var effs={}; - for (var i in CM.Cache.Objects) { + for (var i in Game.Objects) { // TODO Store minigames and effects in Cache // Include possibility of new/modded building and new/modded minigames if (CM.Sim.Objects[i].minigameLoaded && CM.Sim.Objects[i].minigame.effs) { diff --git a/src/Sim.js b/src/Sim.js index 902cc7b..09b79ad 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -114,11 +114,11 @@ CM.Sim.hasGod=function(what) { CM.Sim.eff = function(name) { if (typeof CM.Sim.effs[name]==='undefined') { - CM.Sim.effs[name] = 1 - return CM.Sim.effs[name] + CM.Sim.effs[name] = 1; + return CM.Sim.effs[name]; } else { - return Game.effs[name]; + return CM.Sim.effs[name]; } } @@ -252,7 +252,7 @@ CM.Sim.CalculateGains = function() { var mult = 1; // Include minigame effects var effs={}; - for (var i in CM.Cache.Objects) { + for (var i in Game.Objects) { // TODO Store minigames and effects in Cache // Include possibility of new/modded building and new/modded minigames if (CM.Sim.Objects[i].minigameLoaded && CM.Sim.Objects[i].minigame.effs) { From a22ab829ec842cf106c896c9b0d24c7da0d912b5 Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Fri, 4 Dec 2020 20:52:51 +0100 Subject: [PATCH 2/9] Fixed crash on selecting Sell mode #407 --- CookieMonster.js | 2 +- src/Disp.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 9210c3e..0e5addb 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -3106,7 +3106,7 @@ CM.Disp.UpdateTooltip = function() { 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; } - if (CM.Config.TooltipBuildUp) { + if (CM.Config.TooltipBuildUp && Game.buyMode == 1) { for (var i in Game.Objects[CM.Disp.tooltipName].productionAchievs) { if (!CM.Sim.HasAchiev(Game.Objects[CM.Disp.tooltipName].productionAchievs[i].achiev.name)) { var nextProductionAchiev = Game.Objects[CM.Disp.tooltipName].productionAchievs[i] diff --git a/src/Disp.js b/src/Disp.js index 154065c..2f3c8a8 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -2264,7 +2264,7 @@ CM.Disp.UpdateTooltip = function() { 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; } - if (CM.Config.TooltipBuildUp) { + if (CM.Config.TooltipBuildUp && Game.buyMode == 1) { for (var i in Game.Objects[CM.Disp.tooltipName].productionAchievs) { if (!CM.Sim.HasAchiev(Game.Objects[CM.Disp.tooltipName].productionAchievs[i].achiev.name)) { var nextProductionAchiev = Game.Objects[CM.Disp.tooltipName].productionAchievs[i] From 5c736b7790e9adb790d46f5ca8da5b95bfeca55c Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Fri, 4 Dec 2020 20:55:44 +0100 Subject: [PATCH 3/9] Fix GC no longer updating --- CookieMonster.js | 1 + src/Disp.js | 1 + 2 files changed, 2 insertions(+) diff --git a/CookieMonster.js b/CookieMonster.js index 0e5addb..f62f924 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1876,6 +1876,7 @@ CM.Disp.CheckGoldenCookie = function() { CM.Disp.Notification('GCNotification', "Golden Cookie Spawned", "A Golden Cookie has spawned. Click it now!") } CM.Disp.lastSpawnedGoldenCookieState = CM.Disp.currSpawnedGoldenCookieState + if (CM.Main.currSpawnedGoldenCookieState == 0) CM.Disp.spawnedGoldenShimmer = 0; CM.Disp.UpdateFavicon(); if (CM.Config.GCTimer == 1) { diff --git a/src/Disp.js b/src/Disp.js index 2f3c8a8..f769f1a 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1034,6 +1034,7 @@ CM.Disp.CheckGoldenCookie = function() { CM.Disp.Notification('GCNotification', "Golden Cookie Spawned", "A Golden Cookie has spawned. Click it now!") } CM.Disp.lastSpawnedGoldenCookieState = CM.Disp.currSpawnedGoldenCookieState + if (CM.Main.currSpawnedGoldenCookieState == 0) CM.Disp.spawnedGoldenShimmer = 0; CM.Disp.UpdateFavicon(); if (CM.Config.GCTimer == 1) { From 9ce42f2f3c7b14408c364f1dccefcdd1d0104c2e Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Fri, 4 Dec 2020 22:45:55 +0100 Subject: [PATCH 4/9] Hotfix for #405 --- CookieMonster.js | 2 +- src/Disp.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index ea5b8fa..17dabe9 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1876,7 +1876,7 @@ CM.Disp.CheckGoldenCookie = function() { CM.Disp.Notification('GCNotification', "Golden Cookie Spawned", "A Golden Cookie has spawned. Click it now!") } CM.Disp.lastSpawnedGoldenCookieState = CM.Disp.currSpawnedGoldenCookieState - if (CM.Main.currSpawnedGoldenCookieState == 0) CM.Disp.spawnedGoldenShimmer = 0; + if (CM.Disp.currSpawnedGoldenCookieState == 0) CM.Disp.spawnedGoldenShimmer = 0; CM.Disp.UpdateFavicon(); if (CM.Config.GCTimer == 1) { diff --git a/src/Disp.js b/src/Disp.js index 3589969..49faa74 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1034,7 +1034,7 @@ CM.Disp.CheckGoldenCookie = function() { CM.Disp.Notification('GCNotification', "Golden Cookie Spawned", "A Golden Cookie has spawned. Click it now!") } CM.Disp.lastSpawnedGoldenCookieState = CM.Disp.currSpawnedGoldenCookieState - if (CM.Main.currSpawnedGoldenCookieState == 0) CM.Disp.spawnedGoldenShimmer = 0; + if (CM.Disp.currSpawnedGoldenCookieState == 0) CM.Disp.spawnedGoldenShimmer = 0; CM.Disp.UpdateFavicon(); if (CM.Config.GCTimer == 1) { From f3ea56f34db9975a654f38c58f346085896a2d2c Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Fri, 4 Dec 2020 22:50:41 +0100 Subject: [PATCH 5/9] Hotfix v3 #405 --- CookieMonster.js | 8 +++++--- src/Disp.js | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 17dabe9..0e38cb5 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1875,9 +1875,7 @@ CM.Disp.CheckGoldenCookie = function() { CM.Disp.PlaySound(CM.Config.GCSoundURL, 'GCSound', 'GCVolume'); CM.Disp.Notification('GCNotification', "Golden Cookie Spawned", "A Golden Cookie has spawned. Click it now!") } - CM.Disp.lastSpawnedGoldenCookieState = CM.Disp.currSpawnedGoldenCookieState - if (CM.Disp.currSpawnedGoldenCookieState == 0) CM.Disp.spawnedGoldenShimmer = 0; - CM.Disp.UpdateFavicon(); + if (CM.Config.GCTimer == 1) { for (var i in Game.shimmers) { @@ -1892,6 +1890,10 @@ CM.Disp.CheckGoldenCookie = function() { CM.Disp.GCTimers[i].style.display = 'none'; } } + CM.Disp.lastSpawnedGoldenCookieState = CM.Disp.currSpawnedGoldenCookieState + if (CM.Disp.currSpawnedGoldenCookieState == 0) CM.Disp.spawnedGoldenShimmer = 0; + CM.Disp.UpdateFavicon(); + } else if (CM.Config.GCTimer == 1 && CM.Disp.lastGoldenCookieState) { for (var i in CM.Disp.GCTimers) { diff --git a/src/Disp.js b/src/Disp.js index 49faa74..6ac94aa 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1033,9 +1033,7 @@ CM.Disp.CheckGoldenCookie = function() { CM.Disp.PlaySound(CM.Config.GCSoundURL, 'GCSound', 'GCVolume'); CM.Disp.Notification('GCNotification', "Golden Cookie Spawned", "A Golden Cookie has spawned. Click it now!") } - CM.Disp.lastSpawnedGoldenCookieState = CM.Disp.currSpawnedGoldenCookieState - if (CM.Disp.currSpawnedGoldenCookieState == 0) CM.Disp.spawnedGoldenShimmer = 0; - CM.Disp.UpdateFavicon(); + if (CM.Config.GCTimer == 1) { for (var i in Game.shimmers) { @@ -1050,6 +1048,10 @@ CM.Disp.CheckGoldenCookie = function() { CM.Disp.GCTimers[i].style.display = 'none'; } } + CM.Disp.lastSpawnedGoldenCookieState = CM.Disp.currSpawnedGoldenCookieState + if (CM.Disp.currSpawnedGoldenCookieState == 0) CM.Disp.spawnedGoldenShimmer = 0; + CM.Disp.UpdateFavicon(); + } else if (CM.Config.GCTimer == 1 && CM.Disp.lastGoldenCookieState) { for (var i in CM.Disp.GCTimers) { From 1b88b70c722bfac721fcf5b0d6dc39db8cd3f789 Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Sat, 5 Dec 2020 23:05:43 +0100 Subject: [PATCH 6/9] Hotfix for #414 --- CookieMonster.js | 8 +++++--- src/Sim.js | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 0e38cb5..fc7c8e6 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -4007,11 +4007,13 @@ CM.Sim.InitialBuildingData = function(buildingName) { } /* Similar to the previous function, but for upgrades. - * Note: currently no static data is used by Cookie Monster, - * so this function just returns an empty object. */ CM.Sim.InitUpgrade = function(upgradeName) { - return {}; + var me = Game.Upgrades[upgradeName]; + var you = {}; + you.pool = me.pool; + you.name = me.name; + return you; } /* Similar to the previous function, but for achievements. diff --git a/src/Sim.js b/src/Sim.js index 09b79ad..1f01194 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -167,11 +167,13 @@ CM.Sim.InitialBuildingData = function(buildingName) { } /* Similar to the previous function, but for upgrades. - * Note: currently no static data is used by Cookie Monster, - * so this function just returns an empty object. */ CM.Sim.InitUpgrade = function(upgradeName) { - return {}; + var me = Game.Upgrades[upgradeName]; + var you = {}; + you.pool = me.pool; + you.name = me.name; + return you; } /* Similar to the previous function, but for achievements. From 0d9f45a53714ea8da8ab35aa205e82f1a61d52e3 Mon Sep 17 00:00:00 2001 From: Chorizorro Date: Sun, 6 Dec 2020 09:01:05 +0100 Subject: [PATCH 7/9] Fix favicon not being reset with no GC left --- CookieMonster.js | 2 +- src/Disp.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index fc7c8e6..bd08fe1 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1805,7 +1805,7 @@ CM.Disp.CreateFavicon = function() { } CM.Disp.UpdateFavicon = function() { - if (CM.Config.Favicon == 1) { + if (CM.Config.Favicon == 1 && CM.Disp.lastGoldenCookieState > 0) { if (CM.Disp.spawnedGoldenShimmer.wrath) { CM.Disp.Favicon.href = 'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico'; } diff --git a/src/Disp.js b/src/Disp.js index 6ac94aa..7d15a04 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -963,7 +963,7 @@ CM.Disp.CreateFavicon = function() { } CM.Disp.UpdateFavicon = function() { - if (CM.Config.Favicon == 1) { + if (CM.Config.Favicon == 1 && CM.Disp.lastGoldenCookieState > 0) { if (CM.Disp.spawnedGoldenShimmer.wrath) { CM.Disp.Favicon.href = 'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico'; } From eb7a710464b7a35f3236706352c5c1b28bd8861a Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Sun, 6 Dec 2020 19:36:29 +0100 Subject: [PATCH 8/9] Fix sell price being displayed #416 --- CookieMonster.js | 4 ++-- src/Disp.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index bd08fe1..6bba1de 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1516,8 +1516,8 @@ CM.Disp.UpdateBuildings = function() { l('productPrice' + Game.Objects[i].id).style.color = CM.Config.Colors[CM.Cache[target][i].color]; } } - else { - for (var i in CM.Cache.Objects) { + else if (Game.buyMode == -1) { + for (var i in CM.Cache.Objects ) { var o = Game.Objects[i]; l('productPrice' + o.id).style.color = ''; /* diff --git a/src/Disp.js b/src/Disp.js index 7d15a04..b296d94 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -674,8 +674,8 @@ CM.Disp.UpdateBuildings = function() { l('productPrice' + Game.Objects[i].id).style.color = CM.Config.Colors[CM.Cache[target][i].color]; } } - else { - for (var i in CM.Cache.Objects) { + else if (Game.buyMode == -1) { + for (var i in CM.Cache.Objects ) { var o = Game.Objects[i]; l('productPrice' + o.id).style.color = ''; /* From 88792454c217e34754f837152a80dd78f4b5a5b9 Mon Sep 17 00:00:00 2001 From: Chorizorro Date: Mon, 7 Dec 2020 09:52:39 +0100 Subject: [PATCH 9/9] Fix Dragon's Fortune mult in CalculateGains sim --- CookieMonster.js | 11 +++++------ src/Sim.js | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 6bba1de..0bc7d65 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -4248,13 +4248,12 @@ CM.Sim.CalculateGains = function() { if (rawCookiesPs >= Game.CpsAchievements[i].threshold) CM.Sim.Win(Game.CpsAchievements[i].name); } - CM.Sim.cookiesPsRaw=rawCookiesPs; + CM.Sim.cookiesPsRaw = rawCookiesPs; - if (CM.Sim.hasAura('Dragon\'s Fortune')) { - var n = Game.shimmerTypes['golden'].n; - for (var i = 0; i < n; i++) { - mult *= 1.23; - } + var n = Game.shimmerTypes['golden'].n; + var auraMult = CM.Sim.auraMult('Dragon\'s Fortune'); + for (var i = 0; i < n; i++){ + mult *= 1 + auraMult * 1.23; } var name = Game.bakeryName.toLowerCase(); diff --git a/src/Sim.js b/src/Sim.js index 1f01194..044be36 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -408,13 +408,12 @@ CM.Sim.CalculateGains = function() { if (rawCookiesPs >= Game.CpsAchievements[i].threshold) CM.Sim.Win(Game.CpsAchievements[i].name); } - CM.Sim.cookiesPsRaw=rawCookiesPs; + CM.Sim.cookiesPsRaw = rawCookiesPs; - if (CM.Sim.hasAura('Dragon\'s Fortune')) { - var n = Game.shimmerTypes['golden'].n; - for (var i = 0; i < n; i++) { - mult *= 1.23; - } + var n = Game.shimmerTypes['golden'].n; + var auraMult = CM.Sim.auraMult('Dragon\'s Fortune'); + for (var i = 0; i < n; i++){ + mult *= 1 + auraMult * 1.23; } var name = Game.bakeryName.toLowerCase();