From d71c197ec99520856d0a1c0a3a07a20eddb6b00a Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Sat, 23 Jan 2021 21:53:36 +0100 Subject: [PATCH 01/13] Added Conjure Frenzy to stats --- CookieMonster.js | 20 +++++++++++++++++++- src/Disp.js | 20 +++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index f9f7a32..f64746a 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -3758,7 +3758,25 @@ CM.Disp.CreateStatsSpellsSection = function() { } 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')); - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (CUR)', document.createTextNode(CM.Disp.Beautify(conjureCur)), 'GoldCookTooltipPlaceholder')); + + var conjureFrenzyColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.colorRed : CM.Disp.colorGreen; + var conjureFrenzyCur = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 30); + var conjureFrenzyTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.FormatTime((CM.Cache.Conjure * 7 - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + + var conjureFrenzyReqFrag = document.createDocumentFragment(); + var conjureFrenzyReqSpan = document.createElement('span'); + conjureFrenzyReqSpan.style.fontWeight = 'bold'; + conjureFrenzyReqSpan.className = CM.Disp.colorTextPre + conjureFrenzyColor; + conjureFrenzyReqSpan.textContent = Beautify(CM.Cache.Conjure * 7); + conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSpan); + if (conjureFrenzyTime != '') { + var conjureFrenzyReqSmall = document.createElement('small'); + 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')); 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')); } diff --git a/src/Disp.js b/src/Disp.js index e15985f..1e629d9 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -2579,7 +2579,25 @@ CM.Disp.CreateStatsSpellsSection = function() { } 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')); - section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (CUR)', document.createTextNode(CM.Disp.Beautify(conjureCur)), 'GoldCookTooltipPlaceholder')); + + var conjureFrenzyColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.colorRed : CM.Disp.colorGreen; + var conjureFrenzyCur = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 30); + var conjureFrenzyTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.FormatTime((CM.Cache.Conjure * 7 - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; + + var conjureFrenzyReqFrag = document.createDocumentFragment(); + var conjureFrenzyReqSpan = document.createElement('span'); + conjureFrenzyReqSpan.style.fontWeight = 'bold'; + conjureFrenzyReqSpan.className = CM.Disp.colorTextPre + conjureFrenzyColor; + conjureFrenzyReqSpan.textContent = Beautify(CM.Cache.Conjure * 7); + conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSpan); + if (conjureFrenzyTime != '') { + var conjureFrenzyReqSmall = document.createElement('small'); + 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')); 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')); } From f257243b389a35cc23dd1786b6dd87db74381334 Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Sat, 23 Jan 2021 22:02:21 +0100 Subject: [PATCH 02/13] Optional warning for Conjure with Frenzy (#487) --- CookieMonster.js | 13 +++++++++++++ src/Data.js | 2 ++ src/Disp.js | 11 +++++++++++ 3 files changed, 26 insertions(+) diff --git a/CookieMonster.js b/CookieMonster.js index f64746a..e00204a 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1067,6 +1067,7 @@ CM.ConfigData.TooltipAmor = {type: 'bool', group: 'Tooltip', label: ['Buildings CM.ConfigData.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.ConfigData.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.ConfigData.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.ConfigData.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.ConfigData.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.ConfigData.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.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true}; @@ -1152,6 +1153,7 @@ CM.Data.ConfigDefault = { ToolWarnLucky: 1, ToolWarnLuckyFrenzy: 1, ToolWarnConjure: 1, + ToolWarnConjureFrenzy: 1, ToolWarnEdifice: 1, ToolWarnPos: 1, TooltipGrim:1, @@ -2592,6 +2594,8 @@ CM.Disp.TooltipCreateWarningSection = function() { CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px'; CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnConjure', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"', 'CMDispTooltipWarnConjureText')); CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px'; + CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnConjureFrenzy', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)', 'CMDispTooltipWarnConjureFrenzyText')); + CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px'; CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnEdifice', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"', 'CMDispTooltipWarnEdificeText')); return CM.Disp.TooltipWarn; @@ -2867,6 +2871,15 @@ CM.Disp.UpdateTooltipWarnings = function() { } else l('CMDispTooltipWarnConjure').style.display = 'none'; + if (CM.Options.ToolWarnConjureFrenzy == 1) { + var 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()) + ')'; + } 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)) { l('CMDispTooltipWarnEdifice').style.display = ''; diff --git a/src/Data.js b/src/Data.js index 6b2b142..49ef144 100644 --- a/src/Data.js +++ b/src/Data.js @@ -185,6 +185,7 @@ CM.ConfigData.TooltipAmor = {type: 'bool', group: 'Tooltip', label: ['Buildings CM.ConfigData.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.ConfigData.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.ConfigData.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.ConfigData.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.ConfigData.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.ConfigData.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.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true}; @@ -270,6 +271,7 @@ CM.Data.ConfigDefault = { ToolWarnLucky: 1, ToolWarnLuckyFrenzy: 1, ToolWarnConjure: 1, + ToolWarnConjureFrenzy: 1, ToolWarnEdifice: 1, ToolWarnPos: 1, TooltipGrim:1, diff --git a/src/Disp.js b/src/Disp.js index 1e629d9..0485617 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1413,6 +1413,8 @@ CM.Disp.TooltipCreateWarningSection = function() { CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px'; CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnConjure', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"', 'CMDispTooltipWarnConjureText')); CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px'; + CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnConjureFrenzy', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)', 'CMDispTooltipWarnConjureFrenzyText')); + CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px'; CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnEdifice', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"', 'CMDispTooltipWarnEdificeText')); return CM.Disp.TooltipWarn; @@ -1688,6 +1690,15 @@ CM.Disp.UpdateTooltipWarnings = function() { } else l('CMDispTooltipWarnConjure').style.display = 'none'; + if (CM.Options.ToolWarnConjureFrenzy == 1) { + var 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()) + ')'; + } 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)) { l('CMDispTooltipWarnEdifice').style.display = ''; From 62f8e1fe82cebe417fa9ce4aa05530d1ffc80b5f Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Sat, 23 Jan 2021 22:10:06 +0100 Subject: [PATCH 03/13] Base warnings on new income instead of curr #488 --- CookieMonster.js | 10 +++++----- src/Disp.js | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index e00204a..e07907d 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -2848,7 +2848,7 @@ CM.Disp.UpdateTooltipWarnings = function() { if (CM.Options.ToolWarnLucky == 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()) + ')'; + 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'; @@ -2857,7 +2857,7 @@ CM.Disp.UpdateTooltipWarnings = function() { 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()) + ')'; + 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'; @@ -2866,7 +2866,7 @@ CM.Disp.UpdateTooltipWarnings = function() { var 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()) + ')'; + 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'; @@ -2875,7 +2875,7 @@ CM.Disp.UpdateTooltipWarnings = function() { var 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()) + ')'; + 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'; @@ -2883,7 +2883,7 @@ CM.Disp.UpdateTooltipWarnings = function() { if (CM.Options.ToolWarnEdifice == 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()) + ')'; + 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'; diff --git a/src/Disp.js b/src/Disp.js index 0485617..102f600 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1667,7 +1667,7 @@ CM.Disp.UpdateTooltipWarnings = function() { if (CM.Options.ToolWarnLucky == 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()) + ')'; + 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'; @@ -1676,7 +1676,7 @@ CM.Disp.UpdateTooltipWarnings = function() { 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()) + ')'; + 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'; @@ -1685,7 +1685,7 @@ CM.Disp.UpdateTooltipWarnings = function() { var 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()) + ')'; + 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'; @@ -1694,7 +1694,7 @@ CM.Disp.UpdateTooltipWarnings = function() { var 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()) + ')'; + 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'; @@ -1702,7 +1702,7 @@ CM.Disp.UpdateTooltipWarnings = function() { if (CM.Options.ToolWarnEdifice == 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()) + ')'; + 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'; From 519e67dce9dcb5ce876dda1234d1bdb1cdd31e18 Mon Sep 17 00:00:00 2001 From: DanielNoord Date: Mon, 25 Jan 2021 18:07:55 +0100 Subject: [PATCH 04/13] Create CONTRIBUTING.md --- CONTRIBUTING.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ff2fd18 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,22 @@ +The following is a description of the our approach to the project. + +Cookie Monster is written to modify Cookie Clicker as little as possible. This means the data is copied to simulate instead of actually modifying the current values and reverting later. The benefit is that CM should never mess up any data. The downside is that there is an extra overhead to copy and store the copied data. + +Here is a description of what should be stored in each of the source JS. Make edits to the source file first and then use the combine file to compile the final file: + +JS | Description +-- | - +Cache | Functions related to creating and storing data cache +Config | Functions related to manipulating CM configuration +Data | Hard coded values +Disp | Functions related to displaying CM's UI +Footer | The footer of CM's JS (not modified often or ever) +Header | The header of CM's JS (not modified often or ever) +Main | Functions related to the main loop and initializing CM +Sim | Functions related to simulate something + +These are some additional guidelines: +- Try to use DOM as much as possible instead of using string manipulation to modify HTML. +- Please be descriptive of your commits. If the commit is related to an issue or PR, please add the issue/PR number to the commit message. +- Try to follow the formatting and annotation as specified by JSCode +- PR's should target the `dev` branch From 8505b1621d7a8f5f4442e57605c24b650656fb8b Mon Sep 17 00:00:00 2001 From: Zohnannor <35764628+Zohnannor@users.noreply.github.com> Date: Mon, 25 Jan 2021 19:02:24 +0300 Subject: [PATCH 05/13] Update CM.Disp.FormatTime Add years to date formatting, fixes #502 --- CookieMonster.js | 1 + 1 file changed, 1 insertion(+) diff --git a/CookieMonster.js b/CookieMonster.js index b690a6d..bed6c54 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1328,6 +1328,7 @@ CM.Disp.FormatTime = function(time, longFormat) { 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') + ', '; From 51ab15f2ecedbf8c9b016f946b42f2ae82319e64 Mon Sep 17 00:00:00 2001 From: Zohnannor Date: Mon, 25 Jan 2021 22:20:59 +0300 Subject: [PATCH 06/13] Fix in Disp.js and combine --- src/Disp.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Disp.js b/src/Disp.js index 102f600..f2f7fbd 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -147,6 +147,7 @@ CM.Disp.FormatTime = function(time, longFormat) { 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') + ', '; From 0a57450815587d91019417bf3940bb99757a17ed Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Mon, 25 Jan 2021 22:39:03 +0100 Subject: [PATCH 07/13] Fix colour settings not displaying #504 --- CookieMonster.js | 12 +++++++----- src/Disp.js | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index bed6c54..9891323 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -3242,22 +3242,24 @@ CM.Disp.CreatePrefOption = function(config) { return div; } else if (CM.ConfigData[config].type == "color") { + var div = document.createElement('div'); for (var i = 0; i < CM.Disp.colors.length; i++) { - var div = document.createElement('div'); - div.className = 'listing'; + var innerDiv = document.createElement('div'); + innerDiv.className = 'listing'; var input = document.createElement('input'); input.id = CM.ConfigPrefix + 'Color' + CM.Disp.colors[i]; input.className = 'option'; input.style.width = '65px'; input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]); - div.appendChild(input); + innerDiv.appendChild(input); eval('var change = function() {CM.Options.Colors[\'' + CM.Disp.colors[i] + '\'] = l(CM.ConfigPrefix + \'Color\' + \'' + CM.Disp.colors[i] + '\').value; CM.Disp.UpdateColors(); CM.Config.SaveConfig();}'); var jscolorpicker = new jscolor.color(input, {hash: true, caps: false, pickerZIndex: 1000000, pickerPosition: 'right', onImmediateChange: change}); var label = document.createElement('label'); label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]]; - div.appendChild(label); - return div; + innerDiv.appendChild(label); + div.appendChild(innerDiv) } + return div } else if (CM.ConfigData[config].type == "numscale") { var div = document.createElement('div'); diff --git a/src/Disp.js b/src/Disp.js index f2f7fbd..be181a0 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -2061,22 +2061,24 @@ CM.Disp.CreatePrefOption = function(config) { return div; } else if (CM.ConfigData[config].type == "color") { + var div = document.createElement('div'); for (var i = 0; i < CM.Disp.colors.length; i++) { - var div = document.createElement('div'); - div.className = 'listing'; + var innerDiv = document.createElement('div'); + innerDiv.className = 'listing'; var input = document.createElement('input'); input.id = CM.ConfigPrefix + 'Color' + CM.Disp.colors[i]; input.className = 'option'; input.style.width = '65px'; input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]); - div.appendChild(input); + innerDiv.appendChild(input); eval('var change = function() {CM.Options.Colors[\'' + CM.Disp.colors[i] + '\'] = l(CM.ConfigPrefix + \'Color\' + \'' + CM.Disp.colors[i] + '\').value; CM.Disp.UpdateColors(); CM.Config.SaveConfig();}'); var jscolorpicker = new jscolor.color(input, {hash: true, caps: false, pickerZIndex: 1000000, pickerPosition: 'right', onImmediateChange: change}); var label = document.createElement('label'); label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]]; - div.appendChild(label); - return div; + innerDiv.appendChild(label); + div.appendChild(innerDiv) } + return div } else if (CM.ConfigData[config].type == "numscale") { var div = document.createElement('div'); From 5f93186e7db97908e1755b88e5eb51277e053f8b Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Mon, 25 Jan 2021 22:46:08 +0100 Subject: [PATCH 08/13] Fixed bug with display of missing upgrades --- CookieMonster.js | 4 +++- src/Disp.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 9891323..5ed52a9 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -3889,7 +3889,9 @@ CM.Disp.AddMissingUpgrades = function() { l('menu').children[5].appendChild(upgrades) } if (CM.Cache.MissingUpgrades) { - var normalUpgradesOwned = Game.UpgradesByPool[""].length + Game.UpgradesByPool["tech"].length - l('menu').children[6].childNodes[2].children.length; + if (Game.UpgradesOwned) { + var normalUpgradesOwned = Game.UpgradesByPool[""].length + Game.UpgradesByPool["tech"].length - l('menu').children[6].childNodes[2].children.length; + } else var normalUpgradesOwned = 0; var title = document.createElement('div'); title.id = "CMMissingUpgradesTitle"; title.className = "listing"; diff --git a/src/Disp.js b/src/Disp.js index be181a0..ccf77e9 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -2708,7 +2708,9 @@ CM.Disp.AddMissingUpgrades = function() { l('menu').children[5].appendChild(upgrades) } if (CM.Cache.MissingUpgrades) { - var normalUpgradesOwned = Game.UpgradesByPool[""].length + Game.UpgradesByPool["tech"].length - l('menu').children[6].childNodes[2].children.length; + if (Game.UpgradesOwned) { + var normalUpgradesOwned = Game.UpgradesByPool[""].length + Game.UpgradesByPool["tech"].length - l('menu').children[6].childNodes[2].children.length; + } else var normalUpgradesOwned = 0; var title = document.createElement('div'); title.id = "CMMissingUpgradesTitle"; title.className = "listing"; From 28e28fd5a00aa295da06841fd3569d3bb174a440 Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Mon, 25 Jan 2021 22:55:57 +0100 Subject: [PATCH 09/13] Single fattest wrinkler now excludes shiny #498 --- CookieMonster.js | 16 +++++++++------- src/Cache.js | 8 +++++--- src/Data.js | 2 +- src/Disp.js | 6 +++--- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 5ed52a9..754debe 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -73,7 +73,7 @@ CM.Cache.CacheDragonAuras = function() { * It is called by CM.Loop() and CM.Cache.InitCache() * @global {number} CM.Cache.WrinklersTotal The cookies of all wrinklers * @global {number} CM.Cache.WrinklersNormal The cookies of all normal wrinklers - * @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest wrinkler + * @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.WrinklersTotal = 0; @@ -93,8 +93,10 @@ CM.Cache.CacheWrinklers = function() { else if (godLvl == 3) sucked *= 1.05; } CM.Cache.WrinklersTotal += sucked; - if (Game.wrinklers[i].type == 0) CM.Cache.WrinklersNormal += sucked; - if (sucked > CM.Cache.WrinklersFattest[0]) CM.Cache.WrinklersFattest = [sucked, i]; + if (Game.wrinklers[i].type == 0) { + CM.Cache.WrinklersNormal += sucked; + if (sucked > CM.Cache.WrinklersFattest[0]) CM.Cache.WrinklersFattest = [sucked, i]; + } } } @@ -997,7 +999,7 @@ CM.ConfigData.Colors = { type: 'color', group: 'BarsColors', CM.ConfigData.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.ConfigData.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 fattest) Wrinklers', toggle: true}; +CM.ConfigData.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.ConfigData.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.ConfigData.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.ConfigData.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}; @@ -3380,9 +3382,9 @@ CM.Disp.AddMenuStats = function(title) { var popFattestA = document.createElement('a'); popFattestA.textContent = 'Pop Single Fattest'; popFattestA.className = 'option'; - popFattestA.onclick = function() { 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 Wrinkler (id: ' + CM.Cache.WrinklersFattest[1] + ")", popFattestFrag)); + stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ' + (CM.Cache.WrinklersFattest[1] ? CM.Cache.WrinklersFattest[1] : "None") + ")", popFattestFrag)); } } @@ -3963,7 +3965,7 @@ CM.Disp.CreateWrinklerButtons = function() { popFattestA.id = "PopFattestWrinklerButton" popFattestA.textContent = 'Pop Single Fattest'; popFattestA.className = 'option'; - popFattestA.onclick = function() { 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); } diff --git a/src/Cache.js b/src/Cache.js index 349c517..dd8781c 100644 --- a/src/Cache.js +++ b/src/Cache.js @@ -42,7 +42,7 @@ CM.Cache.CacheDragonAuras = function() { * It is called by CM.Loop() and CM.Cache.InitCache() * @global {number} CM.Cache.WrinklersTotal The cookies of all wrinklers * @global {number} CM.Cache.WrinklersNormal The cookies of all normal wrinklers - * @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest wrinkler + * @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.WrinklersTotal = 0; @@ -62,8 +62,10 @@ CM.Cache.CacheWrinklers = function() { else if (godLvl == 3) sucked *= 1.05; } CM.Cache.WrinklersTotal += sucked; - if (Game.wrinklers[i].type == 0) CM.Cache.WrinklersNormal += sucked; - if (sucked > CM.Cache.WrinklersFattest[0]) CM.Cache.WrinklersFattest = [sucked, i]; + if (Game.wrinklers[i].type == 0) { + CM.Cache.WrinklersNormal += sucked; + if (sucked > CM.Cache.WrinklersFattest[0]) CM.Cache.WrinklersFattest = [sucked, i]; + } } } diff --git a/src/Data.js b/src/Data.js index 49ef144..ef16e4c 100644 --- a/src/Data.js +++ b/src/Data.js @@ -115,7 +115,7 @@ CM.ConfigData.Colors = { type: 'color', group: 'BarsColors', CM.ConfigData.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.ConfigData.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 fattest) Wrinklers', toggle: true}; +CM.ConfigData.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.ConfigData.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.ConfigData.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.ConfigData.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}; diff --git a/src/Disp.js b/src/Disp.js index ccf77e9..ed20533 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -2199,9 +2199,9 @@ CM.Disp.AddMenuStats = function(title) { var popFattestA = document.createElement('a'); popFattestA.textContent = 'Pop Single Fattest'; popFattestA.className = 'option'; - popFattestA.onclick = function() { 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 Wrinkler (id: ' + CM.Cache.WrinklersFattest[1] + ")", popFattestFrag)); + stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ' + (CM.Cache.WrinklersFattest[1] ? CM.Cache.WrinklersFattest[1] : "None") + ")", popFattestFrag)); } } @@ -2782,7 +2782,7 @@ CM.Disp.CreateWrinklerButtons = function() { popFattestA.id = "PopFattestWrinklerButton" popFattestA.textContent = 'Pop Single Fattest'; popFattestA.className = 'option'; - popFattestA.onclick = function() { 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); } From 867249e8cb4912aa3da9f34bf06e251478e83ecc Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Mon, 25 Jan 2021 23:00:30 +0100 Subject: [PATCH 10/13] Missing upgrades no longer shows debug #497 --- CookieMonster.js | 2 +- src/Cache.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 754debe..ed43c7a 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -183,7 +183,7 @@ CM.Cache.CacheMissingUpgrades = function() { 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') CM.Cache.MissingUpgrades += str; + else if (me.pool != 'toggle' && me.pool != 'unused' && me.pool != 'debug') CM.Cache.MissingUpgrades += str; } } } diff --git a/src/Cache.js b/src/Cache.js index dd8781c..7079c7f 100644 --- a/src/Cache.js +++ b/src/Cache.js @@ -152,7 +152,7 @@ CM.Cache.CacheMissingUpgrades = function() { 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') CM.Cache.MissingUpgrades += str; + else if (me.pool != 'toggle' && me.pool != 'unused' && me.pool != 'debug') CM.Cache.MissingUpgrades += str; } } } From d5c5a5f62e55636e51d54af921427c83521f8cd8 Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Mon, 25 Jan 2021 23:24:25 +0100 Subject: [PATCH 11/13] Show tooltip warnings when extra info is off #496 --- CookieMonster.js | 7 +++++-- src/Data.js | 4 ++-- src/Disp.js | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index ed43c7a..25bf0dd 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1064,7 +1064,7 @@ CM.ConfigData.WrinklerMaxSoundURL = {type: 'url', group: 'NotificationWrinkMax', CM.ConfigData.Title = {type: 'bool', group: 'Notification', 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', toggle: true}; // Tooltip -CM.ConfigData.TooltipBuildUp = {type: 'bool', group: 'Tooltip', label: ['Buildings/Upgrades Tooltip Information OFF', 'Buildings/Upgrades Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades', toggle: true}; +CM.ConfigData.TooltipInfo = {type: 'bool', group: 'Tooltip', label: ['Extra Tooltip Information OFF', 'Extra Tooltip Information ON'], desc: 'Extra information in tooltips', toggle: true}; CM.ConfigData.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.ConfigData.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.ConfigData.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}; @@ -1150,7 +1150,7 @@ CM.Data.ConfigDefault = { WrinklerMaxVolume: 100, WrinklerMaxSoundURL: 'https://freesound.org/data/previews/152/152743_15663-lq.mp3', Title: 1, - TooltipBuildUp: 1, + TooltipInfo: 1, TooltipAmor: 0, ToolWarnLucky: 1, ToolWarnLuckyFrenzy: 1, @@ -2611,6 +2611,9 @@ CM.Disp.TooltipCreateWarningSection = function() { CM.Disp.UpdateTooltip = function() { CM.Sim.CopyData(); if (l('tooltipAnchor').style.display != 'none' && l('CMTooltipArea')) { + if (CM.Options.TooltipInfo == 0) { + l('CMTooltipArea').style.display = "none"; + } l('CMTooltipArea').innerHTML = ''; tooltipBox = CM.Disp.TooltipCreateTooltipBox(); l('CMTooltipArea').appendChild(tooltipBox); diff --git a/src/Data.js b/src/Data.js index ef16e4c..63dc624 100644 --- a/src/Data.js +++ b/src/Data.js @@ -180,7 +180,7 @@ CM.ConfigData.WrinklerMaxSoundURL = {type: 'url', group: 'NotificationWrinkMax', CM.ConfigData.Title = {type: 'bool', group: 'Notification', 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', toggle: true}; // Tooltip -CM.ConfigData.TooltipBuildUp = {type: 'bool', group: 'Tooltip', label: ['Buildings/Upgrades Tooltip Information OFF', 'Buildings/Upgrades Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades', toggle: true}; +CM.ConfigData.TooltipInfo = {type: 'bool', group: 'Tooltip', label: ['Extra Tooltip Information OFF', 'Extra Tooltip Information ON'], desc: 'Extra information in tooltips', toggle: true}; CM.ConfigData.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.ConfigData.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.ConfigData.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}; @@ -266,7 +266,7 @@ CM.Data.ConfigDefault = { WrinklerMaxVolume: 100, WrinklerMaxSoundURL: 'https://freesound.org/data/previews/152/152743_15663-lq.mp3', Title: 1, - TooltipBuildUp: 1, + TooltipInfo: 1, TooltipAmor: 0, ToolWarnLucky: 1, ToolWarnLuckyFrenzy: 1, diff --git a/src/Disp.js b/src/Disp.js index ed20533..35e476c 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1428,6 +1428,9 @@ CM.Disp.TooltipCreateWarningSection = function() { CM.Disp.UpdateTooltip = function() { CM.Sim.CopyData(); if (l('tooltipAnchor').style.display != 'none' && l('CMTooltipArea')) { + if (CM.Options.TooltipInfo == 0) { + l('CMTooltipArea').style.display = "none"; + } l('CMTooltipArea').innerHTML = ''; tooltipBox = CM.Disp.TooltipCreateTooltipBox(); l('CMTooltipArea').appendChild(tooltipBox); From 92c28b092b64bbbe3da6414e0a71673b8b0eb578 Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Mon, 25 Jan 2021 23:29:21 +0100 Subject: [PATCH 12/13] Timer bar now adjusts height correctly #499 --- CookieMonster.js | 4 ++++ src/Disp.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CookieMonster.js b/CookieMonster.js index 25bf0dd..cec3c26 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1792,6 +1792,10 @@ CM.Disp.UpdateTimerBar = function() { if (numberOfTimers != 0) { CM.Disp.TimerBar.style.height = numberOfTimers * 12 + 2 + 'px'; } + if (CM.Disp.LastNumberOfTimers != numberOfTimers) { + CM.Disp.LastNumberOfTimers = numberOfTimers + CM.Disp.UpdateBotTimerBarPosition(); + } } } diff --git a/src/Disp.js b/src/Disp.js index 35e476c..c9d060a 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -609,6 +609,10 @@ CM.Disp.UpdateTimerBar = function() { if (numberOfTimers != 0) { CM.Disp.TimerBar.style.height = numberOfTimers * 12 + 2 + 'px'; } + if (CM.Disp.LastNumberOfTimers != numberOfTimers) { + CM.Disp.LastNumberOfTimers = numberOfTimers + CM.Disp.UpdateBotTimerBarPosition(); + } } } From e5b24b393eeba477f6030c64219c19675ff280b1 Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Mon, 25 Jan 2021 23:37:41 +0100 Subject: [PATCH 13/13] Fixed decimal notation #500 --- CookieMonster.js | 5 ++++- src/Disp.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index cec3c26..d8a7445 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1379,8 +1379,11 @@ CM.Disp.Beautify = function(num, floats, forced) { return num.toString() } else if (0.001 < num && num < CM.Options.ScaleCutoff) { - answer = num.toFixed(0); + 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) + } return answer; } else if (CM.Options.Scale == 4 && !forced || forced == 4) { // Scientific notation, 123456789 => 1.235E+8 diff --git a/src/Disp.js b/src/Disp.js index c9d060a..f55a4e7 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -196,8 +196,11 @@ CM.Disp.Beautify = function(num, floats, forced) { return num.toString() } else if (0.001 < num && num < CM.Options.ScaleCutoff) { - answer = num.toFixed(0); + 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) + } return answer; } else if (CM.Options.Scale == 4 && !forced || forced == 4) { // Scientific notation, 123456789 => 1.235E+8