From 7cfba6f80ac7a9cc92c805388ea3ffe828e77407 Mon Sep 17 00:00:00 2001 From: BONNe Date: Tue, 28 Aug 2018 11:59:30 +0300 Subject: [PATCH 01/16] Improve Sugar lump Tooltip. Add message that shows current sugar lump type. --- CookieMonster.js | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ src/Disp.js | 87 +++++++++++++++++++++++++++++++++++++++++++++++ src/Main.js | 1 + 3 files changed, 176 insertions(+) diff --git a/CookieMonster.js b/CookieMonster.js index b9692d4d..7798d8c0 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -641,6 +641,46 @@ CM.Disp.GetTimeColor = function(price, bank, cps, time) { return {text: text, color: color}; } +/** + * This function returns Name and Color as object for sugar lump type that is given as input param. + * @param type Sugar Lump Type. + * @returns {{text: string, color: string}} + * @constructor + */ +CM.Disp.GetLumpColor = function(type) { + var name = ""; + var color = ""; + + switch (type) { + case 0: + name = "Normal"; + color = CM.Disp.colorGray; + break; + case 1: + name = "Bifurcated"; + color = CM.Disp.colorGreen; + break; + case 2: + name = "Golden"; + color = CM.Disp.colorYellow; + break; + case 3: + name = "Meaty"; + color = CM.Disp.colorOrange; + break; + case 4: + name = "Caramelized"; + color = CM.Disp.colorPurple; + break; + default: + name = "Unknown Sugar Lump"; + color = CM.Disp.colorRed; + break; + } + + return {text: name, color: color}; +}; + CM.Disp.Beautify = function(num, frac) { if (CM.Config.Scale != 0 && isFinite(num)) { var answer = ''; @@ -2163,6 +2203,17 @@ CM.Disp.AddTooltipGrimoire = function() { } } +/** + * This function improves Sugar Lump tooltip by adding extra infromation. + * @constructor + */ +CM.Disp.AddTooltipLump = function() { + if (Game.canLumps()) { + CM.Disp.TooltipLumpBack = 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.Disp.Tooltip = function(type, name) { if (type == 'b') { l('tooltip').innerHTML = Game.Objects[name].tooltip(); @@ -2201,6 +2252,10 @@ CM.Disp.Tooltip = function(type, name) { if (!Game.UpgradesInStore[name]) return ''; l('tooltip').innerHTML = Game.crate(Game.UpgradesInStore[name], 'store', undefined, undefined, 1)(); } + else if (type === 's') { + // Sugar Lump + l('tooltip').innerHTML = Game.lumpTooltip(); + } else { // Grimoire l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); } @@ -2350,6 +2405,38 @@ CM.Disp.UpdateTooltip = function() { CM.Disp.TooltipWarnCaut.style.display = 'none'; } } + else if (CM.Disp.tooltipType === 's') { + // Adding information about Sugar Lumps. + + CM.Disp.TooltipWarnCaut.style.display = 'none'; + l('CMDispTooltipWarn').style.display = 'none'; + l('CMDispTooltipCaut').style.display = 'none'; + + l('CMTooltipArea').innerHTML = ''; + + l('tooltip').firstChild.style.paddingBottom = '4px'; + var lumpTooltip = document.createElement('div'); + lumpTooltip.style.border = '1px solid'; + lumpTooltip.style.padding = '4px'; + lumpTooltip.style.margin = '0px -4px'; + lumpTooltip.id = 'CMTooltipBorder'; + lumpTooltip.className = CM.Disp.colorTextPre + CM.Disp.colorGray; + + var lumpHeader = document.createElement('div'); + lumpHeader.style.fontWeight = 'bold'; + lumpHeader.className = CM.Disp.colorTextPre + CM.Disp.colorBlue; + lumpHeader.textContent = 'Current Sugar Lump'; + + lumpTooltip.appendChild(lumpHeader); + var lumpType = document.createElement('div'); + lumpType.id = 'CMTooltipTime'; + lumpTooltip.appendChild(lumpType); + var lumpColor = CM.Disp.GetLumpColor(Game.lumpCurrentType); + lumpType.textContent = lumpColor.text; + lumpType.className = CM.Disp.colorTextPre + lumpColor.color; + + l('CMTooltipArea').appendChild(lumpTooltip); + } else { // Grimoire CM.Disp.TooltipWarnCaut.style.display = 'none'; l('CMDispTooltipWarn').style.display = 'none'; @@ -2788,6 +2875,7 @@ CM.DelayInit = function() { CM.Disp.CreateTooltipWarnCaut(); CM.Disp.AddTooltipBuild(); CM.Disp.AddTooltipGrimoire(); + CM.Disp.AddTooltipLump(); CM.Disp.AddWrinklerAreaDetect(); CM.Cache.InitCookiesDiff(); CM.ReplaceNative(); diff --git a/src/Disp.js b/src/Disp.js index c1c2edf5..76e008d5 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -88,6 +88,46 @@ CM.Disp.GetTimeColor = function(price, bank, cps, time) { return {text: text, color: color}; } +/** + * This function returns Name and Color as object for sugar lump type that is given as input param. + * @param type Sugar Lump Type. + * @returns {{text: string, color: string}} + * @constructor + */ +CM.Disp.GetLumpColor = function(type) { + var name = ""; + var color = ""; + + switch (type) { + case 0: + name = "Normal"; + color = CM.Disp.colorGray; + break; + case 1: + name = "Bifurcated"; + color = CM.Disp.colorGreen; + break; + case 2: + name = "Golden"; + color = CM.Disp.colorYellow; + break; + case 3: + name = "Meaty"; + color = CM.Disp.colorOrange; + break; + case 4: + name = "Caramelized"; + color = CM.Disp.colorPurple; + break; + default: + name = "Unknown Sugar Lump"; + color = CM.Disp.colorRed; + break; + } + + return {text: name, color: color}; +}; + CM.Disp.Beautify = function(num, frac) { if (CM.Config.Scale != 0 && isFinite(num)) { var answer = ''; @@ -1610,6 +1650,17 @@ CM.Disp.AddTooltipGrimoire = function() { } } +/** + * This function improves Sugar Lump tooltip by adding extra infromation. + * @constructor + */ +CM.Disp.AddTooltipLump = function() { + if (Game.canLumps()) { + CM.Disp.TooltipLumpBack = 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.Disp.Tooltip = function(type, name) { if (type == 'b') { l('tooltip').innerHTML = Game.Objects[name].tooltip(); @@ -1648,6 +1699,10 @@ CM.Disp.Tooltip = function(type, name) { if (!Game.UpgradesInStore[name]) return ''; l('tooltip').innerHTML = Game.crate(Game.UpgradesInStore[name], 'store', undefined, undefined, 1)(); } + else if (type === 's') { + // Sugar Lump + l('tooltip').innerHTML = Game.lumpTooltip(); + } else { // Grimoire l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); } @@ -1797,6 +1852,38 @@ CM.Disp.UpdateTooltip = function() { CM.Disp.TooltipWarnCaut.style.display = 'none'; } } + else if (CM.Disp.tooltipType === 's') { + // Adding information about Sugar Lumps. + + CM.Disp.TooltipWarnCaut.style.display = 'none'; + l('CMDispTooltipWarn').style.display = 'none'; + l('CMDispTooltipCaut').style.display = 'none'; + + l('CMTooltipArea').innerHTML = ''; + + l('tooltip').firstChild.style.paddingBottom = '4px'; + var lumpTooltip = document.createElement('div'); + lumpTooltip.style.border = '1px solid'; + lumpTooltip.style.padding = '4px'; + lumpTooltip.style.margin = '0px -4px'; + lumpTooltip.id = 'CMTooltipBorder'; + lumpTooltip.className = CM.Disp.colorTextPre + CM.Disp.colorGray; + + var lumpHeader = document.createElement('div'); + lumpHeader.style.fontWeight = 'bold'; + lumpHeader.className = CM.Disp.colorTextPre + CM.Disp.colorBlue; + lumpHeader.textContent = 'Current Sugar Lump'; + + lumpTooltip.appendChild(lumpHeader); + var lumpType = document.createElement('div'); + lumpType.id = 'CMTooltipTime'; + lumpTooltip.appendChild(lumpType); + var lumpColor = CM.Disp.GetLumpColor(Game.lumpCurrentType); + lumpType.textContent = lumpColor.text; + lumpType.className = CM.Disp.colorTextPre + lumpColor.color; + + l('CMTooltipArea').appendChild(lumpTooltip); + } else { // Grimoire CM.Disp.TooltipWarnCaut.style.display = 'none'; l('CMDispTooltipWarn').style.display = 'none'; diff --git a/src/Main.js b/src/Main.js index 1ea76d41..727ae1e8 100644 --- a/src/Main.js +++ b/src/Main.js @@ -228,6 +228,7 @@ CM.DelayInit = function() { CM.Disp.CreateTooltipWarnCaut(); CM.Disp.AddTooltipBuild(); CM.Disp.AddTooltipGrimoire(); + CM.Disp.AddTooltipLump(); CM.Disp.AddWrinklerAreaDetect(); CM.Cache.InitCookiesDiff(); CM.ReplaceNative(); From 5b9d3636dba929b087735ba61456f64cfe24261e Mon Sep 17 00:00:00 2001 From: BONNe1704 Date: Tue, 28 Aug 2018 13:00:50 +0300 Subject: [PATCH 02/16] Add possibility to disable Sugar Lump tooltip. --- CookieMonster.js | 54 ++++++++++++++++++++++++++---------------------- src/Config.js | 1 + src/Disp.js | 51 ++++++++++++++++++++++++--------------------- src/Main.js | 2 +- 4 files changed, 58 insertions(+), 50 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 7798d8c0..4d1a1a3f 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -537,6 +537,7 @@ CM.ConfigData.ToolWarnCaut = {label: ['Tooltip Warning/Caution OFF', 'Tooltip Wa CM.ConfigData.ToolWarnCautPos = {label: ['Tooltip Warning/Caution Position (Left)', 'Tooltip Warning/Caution Position (Bottom)'], desc: 'Placement of the warning/caution boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnCautPos();}}; CM.ConfigData.TooltipGrim = {label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true}; CM.ConfigData.ToolWrink = {label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true}; +CM.ConfigData.TooltipLump = {label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true}; CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true}; CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false}; CM.ConfigData.TimeFormat = {label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], desc: 'Change the time format', toggle: false}; @@ -1691,6 +1692,7 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('ToolWarnCautPos')); frag.appendChild(listing('TooltipGrim')); frag.appendChild(listing('ToolWrink')); + frag.appendChild(listing('TooltipLump')); frag.appendChild(header('Statistics')); frag.appendChild(listing('Stats')); @@ -2412,30 +2414,32 @@ CM.Disp.UpdateTooltip = function() { l('CMDispTooltipWarn').style.display = 'none'; l('CMDispTooltipCaut').style.display = 'none'; - l('CMTooltipArea').innerHTML = ''; - - l('tooltip').firstChild.style.paddingBottom = '4px'; - var lumpTooltip = document.createElement('div'); - lumpTooltip.style.border = '1px solid'; - lumpTooltip.style.padding = '4px'; - lumpTooltip.style.margin = '0px -4px'; - lumpTooltip.id = 'CMTooltipBorder'; - lumpTooltip.className = CM.Disp.colorTextPre + CM.Disp.colorGray; - - var lumpHeader = document.createElement('div'); - lumpHeader.style.fontWeight = 'bold'; - lumpHeader.className = CM.Disp.colorTextPre + CM.Disp.colorBlue; - lumpHeader.textContent = 'Current Sugar Lump'; - - lumpTooltip.appendChild(lumpHeader); - var lumpType = document.createElement('div'); - lumpType.id = 'CMTooltipTime'; - lumpTooltip.appendChild(lumpType); - var lumpColor = CM.Disp.GetLumpColor(Game.lumpCurrentType); - lumpType.textContent = lumpColor.text; - lumpType.className = CM.Disp.colorTextPre + lumpColor.color; - - l('CMTooltipArea').appendChild(lumpTooltip); + if (CM.Config.TooltipLump === 1) { + l('CMTooltipArea').innerHTML = ''; + + l('tooltip').firstChild.style.paddingBottom = '4px'; + var lumpTooltip = document.createElement('div'); + lumpTooltip.style.border = '1px solid'; + lumpTooltip.style.padding = '4px'; + lumpTooltip.style.margin = '0px -4px'; + lumpTooltip.id = 'CMTooltipBorder'; + lumpTooltip.className = CM.Disp.colorTextPre + CM.Disp.colorGray; + + var lumpHeader = document.createElement('div'); + lumpHeader.style.fontWeight = 'bold'; + lumpHeader.className = CM.Disp.colorTextPre + CM.Disp.colorBlue; + lumpHeader.textContent = 'Current Sugar Lump'; + + lumpTooltip.appendChild(lumpHeader); + var lumpType = document.createElement('div'); + lumpType.id = 'CMTooltipTime'; + lumpTooltip.appendChild(lumpType); + var lumpColor = CM.Disp.GetLumpColor(Game.lumpCurrentType); + lumpType.textContent = lumpColor.text; + lumpType.className = CM.Disp.colorTextPre + lumpColor.color; + + l('CMTooltipArea').appendChild(lumpTooltip); + } } else { // Grimoire CM.Disp.TooltipWarnCaut.style.display = 'none'; @@ -2895,7 +2899,7 @@ CM.DelayInit = function() { CM.HasReplaceNativeGrimoireLaunch = false; CM.HasReplaceNativeGrimoireDraw = false; -CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, BulkBuildColor: 0, UpBarColor: 1, CalcWrink: 0, CPSMode: 1, AvgCPSHist: 3, AvgClicksHist: 0, ToolWarnCautBon: 0, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Favicon: 1, TooltipBuildUp: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, TooltipGrim:1, ToolWrink: 1, Stats: 1, UpStats: 1, TimeFormat: 0, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'}}; +CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, BulkBuildColor: 0, UpBarColor: 1, CalcWrink: 0, CPSMode: 1, AvgCPSHist: 3, AvgClicksHist: 0, ToolWarnCautBon: 0, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Favicon: 1, TooltipBuildUp: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, TooltipGrim:1, ToolWrink: 1, TooltipLump: 1, Stats: 1, UpStats: 1, TimeFormat: 0, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'}}; CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '2.012'; diff --git a/src/Config.js b/src/Config.js index a3f353e5..528f7de1 100644 --- a/src/Config.js +++ b/src/Config.js @@ -143,6 +143,7 @@ CM.ConfigData.ToolWarnCaut = {label: ['Tooltip Warning/Caution OFF', 'Tooltip Wa CM.ConfigData.ToolWarnCautPos = {label: ['Tooltip Warning/Caution Position (Left)', 'Tooltip Warning/Caution Position (Bottom)'], desc: 'Placement of the warning/caution boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnCautPos();}}; CM.ConfigData.TooltipGrim = {label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true}; CM.ConfigData.ToolWrink = {label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true}; +CM.ConfigData.TooltipLump = {label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true}; CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true}; CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false}; CM.ConfigData.TimeFormat = {label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], desc: 'Change the time format', toggle: false}; diff --git a/src/Disp.js b/src/Disp.js index 76e008d5..8245ea55 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1138,6 +1138,7 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('ToolWarnCautPos')); frag.appendChild(listing('TooltipGrim')); frag.appendChild(listing('ToolWrink')); + frag.appendChild(listing('TooltipLump')); frag.appendChild(header('Statistics')); frag.appendChild(listing('Stats')); @@ -1859,30 +1860,32 @@ CM.Disp.UpdateTooltip = function() { l('CMDispTooltipWarn').style.display = 'none'; l('CMDispTooltipCaut').style.display = 'none'; - l('CMTooltipArea').innerHTML = ''; - - l('tooltip').firstChild.style.paddingBottom = '4px'; - var lumpTooltip = document.createElement('div'); - lumpTooltip.style.border = '1px solid'; - lumpTooltip.style.padding = '4px'; - lumpTooltip.style.margin = '0px -4px'; - lumpTooltip.id = 'CMTooltipBorder'; - lumpTooltip.className = CM.Disp.colorTextPre + CM.Disp.colorGray; - - var lumpHeader = document.createElement('div'); - lumpHeader.style.fontWeight = 'bold'; - lumpHeader.className = CM.Disp.colorTextPre + CM.Disp.colorBlue; - lumpHeader.textContent = 'Current Sugar Lump'; - - lumpTooltip.appendChild(lumpHeader); - var lumpType = document.createElement('div'); - lumpType.id = 'CMTooltipTime'; - lumpTooltip.appendChild(lumpType); - var lumpColor = CM.Disp.GetLumpColor(Game.lumpCurrentType); - lumpType.textContent = lumpColor.text; - lumpType.className = CM.Disp.colorTextPre + lumpColor.color; - - l('CMTooltipArea').appendChild(lumpTooltip); + if (CM.Config.TooltipLump === 1) { + l('CMTooltipArea').innerHTML = ''; + + l('tooltip').firstChild.style.paddingBottom = '4px'; + var lumpTooltip = document.createElement('div'); + lumpTooltip.style.border = '1px solid'; + lumpTooltip.style.padding = '4px'; + lumpTooltip.style.margin = '0px -4px'; + lumpTooltip.id = 'CMTooltipBorder'; + lumpTooltip.className = CM.Disp.colorTextPre + CM.Disp.colorGray; + + var lumpHeader = document.createElement('div'); + lumpHeader.style.fontWeight = 'bold'; + lumpHeader.className = CM.Disp.colorTextPre + CM.Disp.colorBlue; + lumpHeader.textContent = 'Current Sugar Lump'; + + lumpTooltip.appendChild(lumpHeader); + var lumpType = document.createElement('div'); + lumpType.id = 'CMTooltipTime'; + lumpTooltip.appendChild(lumpType); + var lumpColor = CM.Disp.GetLumpColor(Game.lumpCurrentType); + lumpType.textContent = lumpColor.text; + lumpType.className = CM.Disp.colorTextPre + lumpColor.color; + + l('CMTooltipArea').appendChild(lumpTooltip); + } } else { // Grimoire CM.Disp.TooltipWarnCaut.style.display = 'none'; diff --git a/src/Main.js b/src/Main.js index 727ae1e8..539bac4a 100644 --- a/src/Main.js +++ b/src/Main.js @@ -248,7 +248,7 @@ CM.DelayInit = function() { CM.HasReplaceNativeGrimoireLaunch = false; CM.HasReplaceNativeGrimoireDraw = false; -CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, BulkBuildColor: 0, UpBarColor: 1, CalcWrink: 0, CPSMode: 1, AvgCPSHist: 3, AvgClicksHist: 0, ToolWarnCautBon: 0, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Favicon: 1, TooltipBuildUp: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, TooltipGrim:1, ToolWrink: 1, Stats: 1, UpStats: 1, TimeFormat: 0, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'}}; +CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, BulkBuildColor: 0, UpBarColor: 1, CalcWrink: 0, CPSMode: 1, AvgCPSHist: 3, AvgClicksHist: 0, ToolWarnCautBon: 0, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Favicon: 1, TooltipBuildUp: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, TooltipGrim:1, ToolWrink: 1, TooltipLump: 1, Stats: 1, UpStats: 1, TimeFormat: 0, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'}}; CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '2.012'; From ac015ab5a809a8986270641f2c02660b58049e16 Mon Sep 17 00:00:00 2001 From: Jeff Shepler <1145213+jshepler@users.noreply.github.com> Date: Wed, 19 Sep 2018 20:36:27 -0400 Subject: [PATCH 03/16] added stats --- CookieMonster.js | 54 +++++++++++++++++++++++++++++++++++++++++++++++- src/Disp.js | 54 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 106 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index feed6a63..08d294a6 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1884,8 +1884,8 @@ CM.Disp.AddMenuStats = function(title) { if (CM.Config.StatsPref.Prestige) { var possiblePresMax = Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + (choEgg ? CM.Cache.lastChoEgg : 0))); var neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + (choEgg ? CM.Cache.lastChoEgg : 0)); - stats.appendChild(listing(listingQuest('Prestige Level (CUR / MAX)', 'PrestMaxTooltipPlaceholder'), document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePresMax)))); + var cookiesNextFrag = document.createDocumentFragment(); cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook))); var cookiesNextSmall = document.createElement('small'); @@ -1893,6 +1893,7 @@ CM.Disp.AddMenuStats = function(title) { cookiesNextFrag.appendChild(cookiesNextSmall); stats.appendChild(listing(listingQuest('Cookies To Next Level', 'NextPrestTooltipPlaceholder'), cookiesNextFrag)); stats.appendChild(listing(listingQuest('Heavenly Chips (CUR / MAX)', 'HeavenChipMaxTooltipPlaceholder'), document.createTextNode(Beautify(Game.heavenlyChips) + ' / ' + Beautify((possiblePresMax - Game.prestige) + Game.heavenlyChips)))); + var resetBonus = CM.Sim.ResetBonus(possiblePresMax); var resetFrag = document.createDocumentFragment(); resetFrag.appendChild(document.createTextNode(Beautify(resetBonus))); @@ -1903,6 +1904,57 @@ CM.Disp.AddMenuStats = function(title) { resetFrag.appendChild(resetSmall); } stats.appendChild(listing(listingQuest('Reset Bonus Income', 'ResetTooltipPlaceholder'), resetFrag)); + + var currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset)); + var willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); + var willGet = willHave - currentPrestige; + var addCommas = (n) => + { + var s1 = n.toString(); + var s2 = ''; + for (var i in s1) + { + if ((s1.length - i) % 3 == 0 && i > 0) + s2 += ','; + + s2 += s1[i]; + } + + return s2; + }; + + if (!Game.Has('Lucky digit')) + { + var delta7 = 7 - (willHave % 10); + if (delta7 < 0) delta7 += 10; + var next7Reset = willGet + delta7; + var next7Total = willHave + delta7; + var frag7 = document.createDocumentFragment(); + frag7.appendChild(document.createTextNode(addCommas(next7Total) + " / " + addCommas(next7Reset) + " (+" + delta7 + ")")); + stats.appendChild(listing('Next "Lucky Digit" (total / reset)', frag7)); + } + + if (!Game.Has('Lucky number')) + { + var delta777 = 777 - (willHave % 1000); + if (delta777 < 0) delta777 += 1000; + var next777Reset = willGet + delta777; + var next777Total = willHave + delta777; + var frag777 = document.createDocumentFragment(); + frag777.appendChild(document.createTextNode(addCommas(next777Total) + " / " + addCommas(next777Reset) + " (+" + delta777 + ")")); + stats.appendChild(listing('Next "Lucky Number" (total / reset)', frag777)); + } + + if (!Game.Has('Lucky payout')) + { + var delta777777 = 777777 - (willHave % 1000000); + if (delta777777 < 0) delta777777 += 1000000; + var next777777Reset = willGet + delta777777; + var next777777Total = willHave + delta777777; + var frag777777 = document.createDocumentFragment(); + frag777777.appendChild(document.createTextNode(addCommas(next777777Total) + " / " + addCommas(next777777Reset) + " (+" + delta777777 + ")")); + stats.appendChild(listing('Next "Lucky Payout" (total / reset)', frag777777)); + } } if (Game.cpsSucked > 0) { diff --git a/src/Disp.js b/src/Disp.js index ed590719..053c5165 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1330,8 +1330,8 @@ CM.Disp.AddMenuStats = function(title) { if (CM.Config.StatsPref.Prestige) { var possiblePresMax = Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + (choEgg ? CM.Cache.lastChoEgg : 0))); var neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + (choEgg ? CM.Cache.lastChoEgg : 0)); - stats.appendChild(listing(listingQuest('Prestige Level (CUR / MAX)', 'PrestMaxTooltipPlaceholder'), document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePresMax)))); + var cookiesNextFrag = document.createDocumentFragment(); cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook))); var cookiesNextSmall = document.createElement('small'); @@ -1339,6 +1339,7 @@ CM.Disp.AddMenuStats = function(title) { cookiesNextFrag.appendChild(cookiesNextSmall); stats.appendChild(listing(listingQuest('Cookies To Next Level', 'NextPrestTooltipPlaceholder'), cookiesNextFrag)); stats.appendChild(listing(listingQuest('Heavenly Chips (CUR / MAX)', 'HeavenChipMaxTooltipPlaceholder'), document.createTextNode(Beautify(Game.heavenlyChips) + ' / ' + Beautify((possiblePresMax - Game.prestige) + Game.heavenlyChips)))); + var resetBonus = CM.Sim.ResetBonus(possiblePresMax); var resetFrag = document.createDocumentFragment(); resetFrag.appendChild(document.createTextNode(Beautify(resetBonus))); @@ -1349,6 +1350,57 @@ CM.Disp.AddMenuStats = function(title) { resetFrag.appendChild(resetSmall); } stats.appendChild(listing(listingQuest('Reset Bonus Income', 'ResetTooltipPlaceholder'), resetFrag)); + + var currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset)); + var willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); + var willGet = willHave - currentPrestige; + var addCommas = (n) => + { + var s1 = n.toString(); + var s2 = ''; + for (var i in s1) + { + if ((s1.length - i) % 3 == 0 && i > 0) + s2 += ','; + + s2 += s1[i]; + } + + return s2; + }; + + if (!Game.Has('Lucky digit')) + { + var delta7 = 7 - (willHave % 10); + if (delta7 < 0) delta7 += 10; + var next7Reset = willGet + delta7; + var next7Total = willHave + delta7; + var frag7 = document.createDocumentFragment(); + frag7.appendChild(document.createTextNode(addCommas(next7Total) + " / " + addCommas(next7Reset) + " (+" + delta7 + ")")); + stats.appendChild(listing('Next "Lucky Digit" (total / reset)', frag7)); + } + + if (!Game.Has('Lucky number')) + { + var delta777 = 777 - (willHave % 1000); + if (delta777 < 0) delta777 += 1000; + var next777Reset = willGet + delta777; + var next777Total = willHave + delta777; + var frag777 = document.createDocumentFragment(); + frag777.appendChild(document.createTextNode(addCommas(next777Total) + " / " + addCommas(next777Reset) + " (+" + delta777 + ")")); + stats.appendChild(listing('Next "Lucky Number" (total / reset)', frag777)); + } + + if (!Game.Has('Lucky payout')) + { + var delta777777 = 777777 - (willHave % 1000000); + if (delta777777 < 0) delta777777 += 1000000; + var next777777Reset = willGet + delta777777; + var next777777Total = willHave + delta777777; + var frag777777 = document.createDocumentFragment(); + frag777777.appendChild(document.createTextNode(addCommas(next777777Total) + " / " + addCommas(next777777Reset) + " (+" + delta777777 + ")")); + stats.appendChild(listing('Next "Lucky Payout" (total / reset)', frag777777)); + } } if (Game.cpsSucked > 0) { From a13efd0c5b4832729916a747db512fed867fef81 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Sun, 20 Oct 2019 17:43:12 -0400 Subject: [PATCH 04/16] Change to Version 2.022.1 and fixed for Version 2.022 of Cookie Clicker (Issues #276) --- CookieMonster.js | 9 +++++---- src/Main.js | 4 ++-- src/Sim.js | 5 +++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index fc68285a..204ec8a1 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -3018,8 +3018,8 @@ CM.ConfigDefault = { }; CM.ConfigPrefix = 'CMConfig'; -CM.VersionMajor = '2.021'; -CM.VersionMinor = '2'; +CM.VersionMajor = '2.022'; +CM.VersionMinor = '1'; /******* * Sim * @@ -3088,8 +3088,9 @@ CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, emuAura) { } CM.Sim.Has = function(what) { - if (Game.ascensionMode == 1 && Game.Upgrades[what].pool == 'prestige') return 0; - return (CM.Sim.Upgrades[what] ? CM.Sim.Upgrades[what].bought : 0); + var it = CM.Sim.Upgrades[what]; + if (Game.ascensionMode == 1 && (it.pool == 'prestige' || it.tier == 'fortune')) return 0; + return (it ? it.bought : 0); } diff --git a/src/Main.js b/src/Main.js index b5a582e5..55c5de34 100644 --- a/src/Main.js +++ b/src/Main.js @@ -299,6 +299,6 @@ CM.ConfigDefault = { }; CM.ConfigPrefix = 'CMConfig'; -CM.VersionMajor = '2.021'; -CM.VersionMinor = '2'; +CM.VersionMajor = '2.022'; +CM.VersionMinor = '1'; diff --git a/src/Sim.js b/src/Sim.js index feed0f60..d2ea864b 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -65,8 +65,9 @@ CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, emuAura) { } CM.Sim.Has = function(what) { - if (Game.ascensionMode == 1 && Game.Upgrades[what].pool == 'prestige') return 0; - return (CM.Sim.Upgrades[what] ? CM.Sim.Upgrades[what].bought : 0); + var it = CM.Sim.Upgrades[what]; + if (Game.ascensionMode == 1 && (it.pool == 'prestige' || it.tier == 'fortune')) return 0; + return (it ? it.bought : 0); } From 2ff37d561c257e83cc7a4b9ae0ea57865539600b Mon Sep 17 00:00:00 2001 From: Tydus Date: Sun, 22 Dec 2019 00:19:46 +0900 Subject: [PATCH 05/16] Extend metric unit prefixes The extra unit prefixes are combinations of basic prefixes (KMGTPEZY) with several Y's, means to combine (multiply) these prefixes. E.g. KY means 1,000 * Y => 1e27 --- src/Disp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Disp.js b/src/Disp.js index fcb1d2de..2e4a85b5 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -2075,7 +2075,7 @@ CM.Disp.lastAscendState = -1; CM.Disp.cookieTimes = [10, 15, 30, 60, 300, 600, 900, 1800]; CM.Disp.clickTimes = [1, 5, 10, 15, 30]; -CM.Disp.metric = ['M', 'G', 'T', 'P', 'E', 'Z', 'Y']; +CM.Disp.metric = ['M', 'G', 'T', 'P', 'E', 'Z', 'Y', 'KY', 'MY', 'GY', 'TY', 'PY', 'EY', 'ZY', 'YY', 'KYY', 'MYY', 'GYY', 'TYY', 'PYY', 'EYY', 'ZYY', 'YYY']; CM.Disp.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.Disp.TooltipWrinklerArea = 0; From c05071ab6e2bbb27f6870f7d6cd75a4245260942 Mon Sep 17 00:00:00 2001 From: Chorizorro Date: Wed, 4 Nov 2020 13:54:52 +0100 Subject: [PATCH 06/16] Add sim gains calculation support up to v2.0.31 Add the Dragon scale upgrade in gains calculation. Add the following achievements in gains calculation: - Quincentennial and a half - Sexcentennial - Grand design - Ecumenopolis - The full picture - When there's nothing left to add - Polymath - Renaissance baker - Gotta hand it to you - The devil's workshop --- CookieMonster.js | 14 ++++++++++++-- src/Sim.js | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index fc68285a..fd1fa5e5 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -3243,6 +3243,8 @@ CM.Sim.CalculateGains = function() { 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; + var buildMult = 1; if (Game.hasGod) { var godLvl = Game.hasGod('asceticism'); @@ -3425,19 +3427,25 @@ CM.Sim.CheckOtherAchiev = function() { 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 >= 1000) CM.Sim.Win('Engineer'); if (buildingsOwned >= 2000) CM.Sim.Win('Lord of Constructs'); + if (buildingsOwned >= 4000) CM.Sim.Win('Grand design'); + if (buildingsOwned >= 8000) 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 >= 3000 && CM.Sim.UpgradesOwned >= 300) CM.Sim.Win('Polymath'); - if (buildingsOwned >= 4000 && CM.Sim.UpgradesOwned >= 400) CM.Sim.Win('Renaissance baker'); + if (buildingsOwned >= 4000 && CM.Sim.UpgradesOwned >= 300) CM.Sim.Win('Polymath'); + if (buildingsOwned >= 8000 && 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'); @@ -3480,6 +3488,8 @@ CM.Sim.BuyBuildings = function(amount, target) { 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 (var j in Game.Objects[me.name].tieredAchievs) { diff --git a/src/Sim.js b/src/Sim.js index feed0f60..0e6b60ff 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -220,6 +220,8 @@ CM.Sim.CalculateGains = function() { 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; + var buildMult = 1; if (Game.hasGod) { var godLvl = Game.hasGod('asceticism'); @@ -402,19 +404,25 @@ CM.Sim.CheckOtherAchiev = function() { 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 >= 1000) CM.Sim.Win('Engineer'); if (buildingsOwned >= 2000) CM.Sim.Win('Lord of Constructs'); + if (buildingsOwned >= 4000) CM.Sim.Win('Grand design'); + if (buildingsOwned >= 8000) 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 >= 3000 && CM.Sim.UpgradesOwned >= 300) CM.Sim.Win('Polymath'); - if (buildingsOwned >= 4000 && CM.Sim.UpgradesOwned >= 400) CM.Sim.Win('Renaissance baker'); + if (buildingsOwned >= 4000 && CM.Sim.UpgradesOwned >= 300) CM.Sim.Win('Polymath'); + if (buildingsOwned >= 8000 && 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'); @@ -457,6 +465,8 @@ CM.Sim.BuyBuildings = function(amount, target) { 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 (var j in Game.Objects[me.name].tieredAchievs) { From f69fe119214cfc51c085b3e4f0d6cd6615432d3b Mon Sep 17 00:00:00 2001 From: Chorizorro Date: Wed, 4 Nov 2020 13:55:48 +0100 Subject: [PATCH 07/16] =?UTF-8?q?Fix=20grandma=20Cps=20gains=20calculation?= =?UTF-8?q?=20with=20Milkhelp=C2=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for the "Milkhelp® lactose intolerance relief tablets" ascension upgrade, as it isn't computed in the game's Grandma CpS. --- CookieMonster.js | 52 +++++++++++++++++++++++++----------------------- src/Sim.js | 52 +++++++++++++++++++++++++----------------------- 2 files changed, 54 insertions(+), 50 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index fd1fa5e5..6ef8eb71 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -3275,16 +3275,8 @@ CM.Sim.CalculateGains = function() { if (CM.Sim.Has('Santa\'s legacy')) mult *= 1 + (Game.santaLevel + 1) * 0.03; - for (var i in CM.Sim.Objects) { - var me = CM.Sim.Objects[i]; - var storedCps = (typeof(me.cps) == 'function' ? me.cps(me) : me.cps); - if (Game.ascensionMode != 1) storedCps *= (1 + me.level * 0.01) * buildMult; - CM.Sim.cookiesPs += me.amount * storedCps; - } - - if (CM.Sim.Has('"egg"')) CM.Sim.cookiesPs += 9; // "egg" - - var milkMult=1; + var milkProgress = CM.Sim.AchievementsOwned / 25; + var milkMult = 1; if (CM.Sim.Has('Santa\'s milk and cookies')) milkMult *= 1.05; //if (CM.Sim.hasAura('Breath of Milk')) milkMult *= 1.05; milkMult *= 1 + CM.Sim.auraMult('Breath of Milk') * 0.05; @@ -3299,21 +3291,31 @@ CM.Sim.CalculateGains = function() { var catMult = 1; - if (CM.Sim.Has('Kitten helpers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.1 * milkMult); - if (CM.Sim.Has('Kitten workers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.125 * milkMult); - if (CM.Sim.Has('Kitten engineers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.15 * milkMult); - if (CM.Sim.Has('Kitten overseers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.175 * milkMult); - if (CM.Sim.Has('Kitten managers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten accountants')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten specialists')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten experts')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten consultants')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten assistants to the regional manager')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.175 * milkMult); - if (CM.Sim.Has('Kitten marketeers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.15 * milkMult); - if (CM.Sim.Has('Kitten analysts')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.125 * milkMult); - if (CM.Sim.Has('Kitten executives')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.115 * milkMult); - if (CM.Sim.Has('Kitten angels')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.1 * milkMult); - if (CM.Sim.Has('Fortune #103')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.05 * milkMult); + if (CM.Sim.Has('Kitten helpers')) catMult *= (1 + milkProgress * 0.1 * milkMult); + if (CM.Sim.Has('Kitten workers')) catMult *= (1 + milkProgress * 0.125 * milkMult); + if (CM.Sim.Has('Kitten engineers')) catMult *= (1 + milkProgress * 0.15 * milkMult); + if (CM.Sim.Has('Kitten overseers')) catMult *= (1 + milkProgress * 0.175 * milkMult); + if (CM.Sim.Has('Kitten managers')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten accountants')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten specialists')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten experts')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten consultants')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten assistants to the regional manager')) catMult *= (1 + milkProgress * 0.175 * milkMult); + if (CM.Sim.Has('Kitten marketeers')) catMult *= (1 + milkProgress * 0.15 * milkMult); + if (CM.Sim.Has('Kitten analysts')) catMult *= (1 + milkProgress * 0.125 * milkMult); + if (CM.Sim.Has('Kitten executives')) catMult *= (1 + milkProgress * 0.115 * milkMult); + 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 (var i in CM.Sim.Objects) { + var me = CM.Sim.Objects[i]; + var storedCps = (typeof(me.cps) == 'function' ? me.cps(me) : me.cps); + 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" mult *= catMult; diff --git a/src/Sim.js b/src/Sim.js index 0e6b60ff..15adeb1f 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -252,16 +252,8 @@ CM.Sim.CalculateGains = function() { if (CM.Sim.Has('Santa\'s legacy')) mult *= 1 + (Game.santaLevel + 1) * 0.03; - for (var i in CM.Sim.Objects) { - var me = CM.Sim.Objects[i]; - var storedCps = (typeof(me.cps) == 'function' ? me.cps(me) : me.cps); - if (Game.ascensionMode != 1) storedCps *= (1 + me.level * 0.01) * buildMult; - CM.Sim.cookiesPs += me.amount * storedCps; - } - - if (CM.Sim.Has('"egg"')) CM.Sim.cookiesPs += 9; // "egg" - - var milkMult=1; + var milkProgress = CM.Sim.AchievementsOwned / 25; + var milkMult = 1; if (CM.Sim.Has('Santa\'s milk and cookies')) milkMult *= 1.05; //if (CM.Sim.hasAura('Breath of Milk')) milkMult *= 1.05; milkMult *= 1 + CM.Sim.auraMult('Breath of Milk') * 0.05; @@ -276,21 +268,31 @@ CM.Sim.CalculateGains = function() { var catMult = 1; - if (CM.Sim.Has('Kitten helpers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.1 * milkMult); - if (CM.Sim.Has('Kitten workers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.125 * milkMult); - if (CM.Sim.Has('Kitten engineers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.15 * milkMult); - if (CM.Sim.Has('Kitten overseers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.175 * milkMult); - if (CM.Sim.Has('Kitten managers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten accountants')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten specialists')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten experts')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten consultants')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.2 * milkMult); - if (CM.Sim.Has('Kitten assistants to the regional manager')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.175 * milkMult); - if (CM.Sim.Has('Kitten marketeers')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.15 * milkMult); - if (CM.Sim.Has('Kitten analysts')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.125 * milkMult); - if (CM.Sim.Has('Kitten executives')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.115 * milkMult); - if (CM.Sim.Has('Kitten angels')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.1 * milkMult); - if (CM.Sim.Has('Fortune #103')) catMult *= (1 + (CM.Sim.AchievementsOwned / 25) * 0.05 * milkMult); + if (CM.Sim.Has('Kitten helpers')) catMult *= (1 + milkProgress * 0.1 * milkMult); + if (CM.Sim.Has('Kitten workers')) catMult *= (1 + milkProgress * 0.125 * milkMult); + if (CM.Sim.Has('Kitten engineers')) catMult *= (1 + milkProgress * 0.15 * milkMult); + if (CM.Sim.Has('Kitten overseers')) catMult *= (1 + milkProgress * 0.175 * milkMult); + if (CM.Sim.Has('Kitten managers')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten accountants')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten specialists')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten experts')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten consultants')) catMult *= (1 + milkProgress * 0.2 * milkMult); + if (CM.Sim.Has('Kitten assistants to the regional manager')) catMult *= (1 + milkProgress * 0.175 * milkMult); + if (CM.Sim.Has('Kitten marketeers')) catMult *= (1 + milkProgress * 0.15 * milkMult); + if (CM.Sim.Has('Kitten analysts')) catMult *= (1 + milkProgress * 0.125 * milkMult); + if (CM.Sim.Has('Kitten executives')) catMult *= (1 + milkProgress * 0.115 * milkMult); + 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 (var i in CM.Sim.Objects) { + var me = CM.Sim.Objects[i]; + var storedCps = (typeof(me.cps) == 'function' ? me.cps(me) : me.cps); + 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" mult *= catMult; From 356b1fec573b16bd7a55d860e175830b7b5695f5 Mon Sep 17 00:00:00 2001 From: Chorizorro Date: Thu, 5 Nov 2020 00:11:02 +0100 Subject: [PATCH 08/16] Handle Prism heart biscuits from Valentine season Add Prism heart biscuits to Valentine cookies data. Update required Valentine upgrade for "Lovely cookies" achievement to "Prism heart biscuits". --- CookieMonster.js | 4 ++-- src/Data.js | 2 +- src/Sim.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 6ef8eb71..112ead68 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -619,7 +619,7 @@ CM.Data.Fortunes = [ ]; 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']; +CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits', 'Prism heart biscuits']; /******** * Disp * @@ -3535,7 +3535,7 @@ CM.Sim.BuyUpgrades = function() { else if (i == 'Elder Covenant') { CM.Sim.Win('Elder calm') } - else if (i == 'Eternal heart biscuits') { + else if (i == 'Prism heart biscuits') { CM.Sim.Win('Lovely cookies'); } else if (i == 'Heavenly key') { diff --git a/src/Data.js b/src/Data.js index 4202c893..3f0c8724 100644 --- a/src/Data.js +++ b/src/Data.js @@ -28,5 +28,5 @@ CM.Data.Fortunes = [ ]; 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']; +CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits', 'Prism heart biscuits']; diff --git a/src/Sim.js b/src/Sim.js index 15adeb1f..8d5a7128 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -512,7 +512,7 @@ CM.Sim.BuyUpgrades = function() { else if (i == 'Elder Covenant') { CM.Sim.Win('Elder calm') } - else if (i == 'Eternal heart biscuits') { + else if (i == 'Prism heart biscuits') { CM.Sim.Win('Lovely cookies'); } else if (i == 'Heavenly key') { From e2ec8a34f29344046cea202fb41cc4644725b797 Mon Sep 17 00:00:00 2001 From: Chorizorro Date: Thu, 5 Nov 2020 00:13:16 +0100 Subject: [PATCH 09/16] Add Fortune #018 to Fortunes data. Add Fortune #018 (Idleverse related fortune cookie) introduced in v2.031 to the list of fortune cookies. --- CookieMonster.js | 1 + src/Data.js | 1 + 2 files changed, 2 insertions(+) diff --git a/CookieMonster.js b/CookieMonster.js index 112ead68..8df1f292 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -611,6 +611,7 @@ CM.Data.Fortunes = [ 'Fortune #015', 'Fortune #016', 'Fortune #017', + 'Fortune #018', 'Fortune #100', 'Fortune #101', 'Fortune #102', diff --git a/src/Data.js b/src/Data.js index 3f0c8724..f5a8bded 100644 --- a/src/Data.js +++ b/src/Data.js @@ -20,6 +20,7 @@ CM.Data.Fortunes = [ 'Fortune #015', 'Fortune #016', 'Fortune #017', + 'Fortune #018', 'Fortune #100', 'Fortune #101', 'Fortune #102', From 7660e6dff3c968244323245b9383c0623cd78032 Mon Sep 17 00:00:00 2001 From: DanielNoord Date: Mon, 23 Nov 2020 16:32:27 +0100 Subject: [PATCH 10/16] Config option to make upgrade bar sticky (#323) Option to make Upgrade Bar sticky --- CookieMonster.js | 12 ++++++++++++ src/Config.js | 1 + src/Disp.js | 11 +++++++++++ 3 files changed, 24 insertions(+) diff --git a/CookieMonster.js b/CookieMonster.js index d1a16a86..8d71f0ae 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -540,6 +540,7 @@ CM.ConfigData.Colors = { }, func: function() {CM.Disp.UpdateColors();} }; +CM.ConfigData.UpgradeBarFixedPos = {label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Positione 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.ConfigData.CalcWrink = {label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON'], desc: 'Calculate times and average Cookies Per Second with Wrinklers', toggle: true}; CM.ConfigData.CPSMode = {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 = {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}; @@ -1227,6 +1228,7 @@ CM.Disp.CreateUpgradeBar = function() { CM.Disp.UpgradeBar.style.textAlign = 'center'; 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(); }; var placeholder = document.createElement('div'); @@ -1360,6 +1362,16 @@ CM.Disp.UpdateColors = function() { CM.Disp.UpdateBuildings(); // Class has been already set } +CM.Disp.ToggleUpgradeBarFixedPos = function() { + if (CM.Config.UpgradeBarFixedPos() == 1) { + CM.Disp.UpgradeBar.style.position = 'sticky'; + CM.Disp.UpgradeBar.style.top = '0px'; + } + else { + CM.Disp.UpgradeBar.style.position = ''; + } +} + CM.Disp.CreateWhiteScreen = function() { CM.Disp.WhiteScreen = document.createElement('div'); CM.Disp.WhiteScreen.id = 'CMWhiteScreen'; diff --git a/src/Config.js b/src/Config.js index 1598ebf8..907a8f70 100644 --- a/src/Config.js +++ b/src/Config.js @@ -134,6 +134,7 @@ CM.ConfigData.Colors = { }, func: function() {CM.Disp.UpdateColors();} }; +CM.ConfigData.UpgradeBarFixedPos = {label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Positione 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.ConfigData.CalcWrink = {label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON'], desc: 'Calculate times and average Cookies Per Second with Wrinklers', toggle: true}; CM.ConfigData.CPSMode = {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 = {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}; diff --git a/src/Disp.js b/src/Disp.js index fcb1d2de..a1f5f1d0 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -603,6 +603,7 @@ CM.Disp.CreateUpgradeBar = function() { CM.Disp.UpgradeBar.style.textAlign = 'center'; 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(); }; var placeholder = document.createElement('div'); @@ -736,6 +737,16 @@ CM.Disp.UpdateColors = function() { CM.Disp.UpdateBuildings(); // Class has been already set } +CM.Disp.ToggleUpgradeBarFixedPos = function() { + if (CM.Config.UpgradeBarFixedPos() == 1) { + CM.Disp.UpgradeBar.style.position = 'sticky'; + CM.Disp.UpgradeBar.style.top = '0px'; + } + else { + CM.Disp.UpgradeBar.style.position = ''; + } +} + CM.Disp.CreateWhiteScreen = function() { CM.Disp.WhiteScreen = document.createElement('div'); CM.Disp.WhiteScreen.id = 'CMWhiteScreen'; From bcef69a344d2f32a81e103f6ab59f6be355e1d20 Mon Sep 17 00:00:00 2001 From: Fabian Date: Mon, 23 Nov 2020 16:41:46 +0100 Subject: [PATCH 11/16] Sort buildings and upgrades by PP (#253) --- CookieMonster.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++-- src/Config.js | 3 ++- src/Disp.js | 47 +++++++++++++++++++++++++++++++++++++++++ src/Main.js | 4 +++- 4 files changed, 104 insertions(+), 4 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 8d71f0ae..030470ac 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -589,7 +589,8 @@ CM.ConfigData.TimeFormat = {label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', toggle: true, func: function() {CM.Disp.ToggleSayTime();}}; CM.ConfigData.GrimoireBar = {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.ConfigData.Scale = {label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}}; - +CM.ConfigData.SortBuildings = {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.ConfigData.SortUpgrades = {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();}}; /******** * Data * ********/ @@ -831,6 +832,14 @@ CM.Disp.CreateCssArea = function() { CM.Disp.Css.type = 'text/css'; document.head.appendChild(CM.Disp.Css); + + // given the architecture of your code, you probably want these lines somewhere else, + // but I stuck them here for convenience + l("products").style.display = "grid"; + l("storeBulk").style.gridRow = "1/1"; + + l("upgrades").style.display = "flex"; + l("upgrades").style["flex-wrap"] = "wrap"; } CM.Disp.CreateBotBar = function() { @@ -1218,6 +1227,24 @@ CM.Disp.UpdateBuildings = function() { l('productPrice' + Game.Objects[i].id).style.color = ''; } } + + // 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) + var arr = Object.keys(CM.Cache.Objects).map(k => + { + var o = CM.Cache.Objects[k]; + o.name = k; + o.id = Game.Objects[k].id; + return o; + }); + + if (CM.Config.SortBuildings) + arr.sort((a, b) => a.pp - b.pp); + else + arr.sort((a, b) => a.id - b.id); + + for (var x = 0; x < arr.length; x++) + Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2); } CM.Disp.CreateUpgradeBar = function() { @@ -1345,6 +1372,25 @@ CM.Disp.UpdateUpgrades = function() { l('CMUpgradeBarPurple').textContent = purple; l('CMUpgradeBarGray').textContent = gray; } + + // Build array of pointers, sort by pp, set flex positions + var arr = []; + for (var x = 0; x < Game.UpgradesInStore.length; x++){ + var o = {}; + o.name = Game.UpgradesInStore[x].name; + o.price = Game.UpgradesInStore[x].basePrice; + o.pp = CM.Cache.Upgrades[o.name].pp; + arr.push(o); + } + + if (CM.Config.SortUpgrades) + arr.sort((a, b) => a.pp - b.pp); + else + arr.sort((a, b) => a.price - b.price); + + for (var x = 0; x < Game.UpgradesInStore.length; x++){ + l("upgrade" + x).style.order = arr.findIndex(e => e.name === Game.UpgradesInStore[x].name) + 1 + } } CM.Disp.UpdateColors = function() { @@ -1733,6 +1779,8 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('BotBar')); frag.appendChild(listing('TimerBar')); frag.appendChild(listing('TimerBarPos')); + frag.appendChild(listing('SortBuildings')); + frag.appendChild(listing('SortUpgrades')); frag.appendChild(listing('BuildColor')); frag.appendChild(listing('BulkBuildColor')); frag.appendChild(listing('UpBarColor')); @@ -3027,7 +3075,9 @@ CM.ConfigDefault = { GrimoireBar: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, - 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 }; CM.ConfigPrefix = 'CMConfig'; diff --git a/src/Config.js b/src/Config.js index 907a8f70..56974a8c 100644 --- a/src/Config.js +++ b/src/Config.js @@ -183,4 +183,5 @@ CM.ConfigData.TimeFormat = {label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', toggle: true, func: function() {CM.Disp.ToggleSayTime();}}; CM.ConfigData.GrimoireBar = {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.ConfigData.Scale = {label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}}; - +CM.ConfigData.SortBuildings = {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.ConfigData.SortUpgrades = {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();}}; diff --git a/src/Disp.js b/src/Disp.js index 8e65ec9f..5f5fe96c 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -206,6 +206,14 @@ CM.Disp.CreateCssArea = function() { CM.Disp.Css.type = 'text/css'; document.head.appendChild(CM.Disp.Css); + + // given the architecture of your code, you probably want these lines somewhere else, + // but I stuck them here for convenience + l("products").style.display = "grid"; + l("storeBulk").style.gridRow = "1/1"; + + l("upgrades").style.display = "flex"; + l("upgrades").style["flex-wrap"] = "wrap"; } CM.Disp.CreateBotBar = function() { @@ -593,6 +601,24 @@ CM.Disp.UpdateBuildings = function() { l('productPrice' + Game.Objects[i].id).style.color = ''; } } + + // 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) + var arr = Object.keys(CM.Cache.Objects).map(k => + { + var o = CM.Cache.Objects[k]; + o.name = k; + o.id = Game.Objects[k].id; + return o; + }); + + if (CM.Config.SortBuildings) + arr.sort((a, b) => a.pp - b.pp); + else + arr.sort((a, b) => a.id - b.id); + + for (var x = 0; x < arr.length; x++) + Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2); } CM.Disp.CreateUpgradeBar = function() { @@ -720,6 +746,25 @@ CM.Disp.UpdateUpgrades = function() { l('CMUpgradeBarPurple').textContent = purple; l('CMUpgradeBarGray').textContent = gray; } + + // Build array of pointers, sort by pp, set flex positions + var arr = []; + for (var x = 0; x < Game.UpgradesInStore.length; x++){ + var o = {}; + o.name = Game.UpgradesInStore[x].name; + o.price = Game.UpgradesInStore[x].basePrice; + o.pp = CM.Cache.Upgrades[o.name].pp; + arr.push(o); + } + + if (CM.Config.SortUpgrades) + arr.sort((a, b) => a.pp - b.pp); + else + arr.sort((a, b) => a.price - b.price); + + for (var x = 0; x < Game.UpgradesInStore.length; x++){ + l("upgrade" + x).style.order = arr.findIndex(e => e.name === Game.UpgradesInStore[x].name) + 1 + } } CM.Disp.UpdateColors = function() { @@ -1108,6 +1153,8 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('BotBar')); frag.appendChild(listing('TimerBar')); frag.appendChild(listing('TimerBarPos')); + frag.appendChild(listing('SortBuildings')); + frag.appendChild(listing('SortUpgrades')); frag.appendChild(listing('BuildColor')); frag.appendChild(listing('BulkBuildColor')); frag.appendChild(listing('UpBarColor')); diff --git a/src/Main.js b/src/Main.js index 55c5de34..2d3b3e83 100644 --- a/src/Main.js +++ b/src/Main.js @@ -295,7 +295,9 @@ CM.ConfigDefault = { GrimoireBar: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, - 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 }; CM.ConfigPrefix = 'CMConfig'; From 981dc2d1c0d9418ac235a764d831e2a33f957099 Mon Sep 17 00:00:00 2001 From: DanielNoord Date: Mon, 23 Nov 2020 16:45:09 +0100 Subject: [PATCH 12/16] Revert "Extend metric unit prefixes" (#325) --- src/Disp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Disp.js b/src/Disp.js index 5f5fe96c..0e4642f0 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -2133,7 +2133,7 @@ CM.Disp.lastAscendState = -1; CM.Disp.cookieTimes = [10, 15, 30, 60, 300, 600, 900, 1800]; CM.Disp.clickTimes = [1, 5, 10, 15, 30]; -CM.Disp.metric = ['M', 'G', 'T', 'P', 'E', 'Z', 'Y', 'KY', 'MY', 'GY', 'TY', 'PY', 'EY', 'ZY', 'YY', 'KYY', 'MYY', 'GYY', 'TYY', 'PYY', 'EYY', 'ZYY', 'YYY']; +CM.Disp.metric = ['M', 'G', 'T', 'P', 'E', 'Z', 'Y']; CM.Disp.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.Disp.TooltipWrinklerArea = 0; From deb309c08f2c6cafd9121f17372f7745f2ec8a22 Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Mon, 23 Nov 2020 10:50:32 -0500 Subject: [PATCH 13/16] Fix accidental global leakage (#250) * Fix accidental global leakage --- CookieMonster.js | 2 +- src/Sim.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 4172ab12..5baa5ca4 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -3520,7 +3520,7 @@ CM.Sim.CalculateGains = function() { mult *= CM.Sim.getCPSBuffMult(); // Pointless? - name = Game.bakeryName.toLowerCase(); + var name = Game.bakeryName.toLowerCase(); if (name == 'orteil') mult *= 0.99; else if (name == 'ortiel') mult *= 0.98; //or so help me diff --git a/src/Sim.js b/src/Sim.js index acc992e9..1baab394 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -342,7 +342,7 @@ CM.Sim.CalculateGains = function() { mult *= CM.Sim.getCPSBuffMult(); // Pointless? - name = Game.bakeryName.toLowerCase(); + var name = Game.bakeryName.toLowerCase(); if (name == 'orteil') mult *= 0.99; else if (name == 'ortiel') mult *= 0.98; //or so help me From fc20c8490cc28626913b19464e18a3b275cae806 Mon Sep 17 00:00:00 2001 From: DanielNoord Date: Mon, 23 Nov 2020 17:56:07 +0100 Subject: [PATCH 14/16] Finalized version 2.031 (#327) --- CookieMonster | 1 + CookieMonster.js | 9 ++++++--- src/Config.js | 2 +- src/Disp.js | 3 ++- src/Main.js | 5 +++-- 5 files changed, 13 insertions(+), 7 deletions(-) create mode 160000 CookieMonster diff --git a/CookieMonster b/CookieMonster new file mode 160000 index 00000000..4949b868 --- /dev/null +++ b/CookieMonster @@ -0,0 +1 @@ +Subproject commit 4949b868fa148dac5aa9f1c9ec7ac83fa1ffdbda diff --git a/CookieMonster.js b/CookieMonster.js index 64bd01ae..1e05231d 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -540,7 +540,7 @@ CM.ConfigData.Colors = { }, func: function() {CM.Disp.UpdateColors();} }; -CM.ConfigData.UpgradeBarFixedPos = {label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Positione 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.ConfigData.UpgradeBarFixedPos = {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.ConfigData.CalcWrink = {label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON'], desc: 'Calculate times and average Cookies Per Second with Wrinklers', toggle: true}; CM.ConfigData.CPSMode = {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 = {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}; @@ -1450,7 +1450,7 @@ CM.Disp.UpdateColors = function() { } CM.Disp.ToggleUpgradeBarFixedPos = function() { - if (CM.Config.UpgradeBarFixedPos() == 1) { + if (CM.Config.UpgradeBarFixedPos == 1) { CM.Disp.UpgradeBar.style.position = 'sticky'; CM.Disp.UpgradeBar.style.top = '0px'; } @@ -1841,6 +1841,7 @@ CM.Disp.AddMenuPref = function(title) { div.appendChild(label); frag.appendChild(div); } + frag.appendChild(listing('UpgradeBarFixedPos')); frag.appendChild(header('Calculation')); frag.appendChild(listing('CalcWrink')); @@ -3182,6 +3183,7 @@ CM.ConfigDefault = { BuildColor: 1, BulkBuildColor: 0, UpBarColor: 1, + UpgradeBarFixedPos: 1, CalcWrink: 0, CPSMode: 1, AvgCPSHist: 3, @@ -3212,6 +3214,7 @@ CM.ConfigDefault = { ToolWarnCautPos: 1, TooltipGrim:1, ToolWrink: 1, + TooltipLump: 1, Stats: 1, UpStats: 1, TimeFormat: 0, @@ -3225,7 +3228,7 @@ CM.ConfigDefault = { }; CM.ConfigPrefix = 'CMConfig'; -CM.VersionMajor = '2.022'; +CM.VersionMajor = '2.031'; CM.VersionMinor = '1'; /******* diff --git a/src/Config.js b/src/Config.js index 8c437cfc..79d8613c 100644 --- a/src/Config.js +++ b/src/Config.js @@ -134,7 +134,7 @@ CM.ConfigData.Colors = { }, func: function() {CM.Disp.UpdateColors();} }; -CM.ConfigData.UpgradeBarFixedPos = {label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Positione 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.ConfigData.UpgradeBarFixedPos = {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.ConfigData.CalcWrink = {label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON'], desc: 'Calculate times and average Cookies Per Second with Wrinklers', toggle: true}; CM.ConfigData.CPSMode = {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 = {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}; diff --git a/src/Disp.js b/src/Disp.js index de530fab..60d6920d 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -823,7 +823,7 @@ CM.Disp.UpdateColors = function() { } CM.Disp.ToggleUpgradeBarFixedPos = function() { - if (CM.Config.UpgradeBarFixedPos() == 1) { + if (CM.Config.UpgradeBarFixedPos == 1) { CM.Disp.UpgradeBar.style.position = 'sticky'; CM.Disp.UpgradeBar.style.top = '0px'; } @@ -1214,6 +1214,7 @@ CM.Disp.AddMenuPref = function(title) { div.appendChild(label); frag.appendChild(div); } + frag.appendChild(listing('UpgradeBarFixedPos')); frag.appendChild(header('Calculation')); frag.appendChild(listing('CalcWrink')); diff --git a/src/Main.js b/src/Main.js index a3250771..3eb16e64 100644 --- a/src/Main.js +++ b/src/Main.js @@ -252,7 +252,6 @@ CM.DelayInit = function() { CM.HasReplaceNativeGrimoireLaunch = false; CM.HasReplaceNativeGrimoireDraw = false; -CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, BulkBuildColor: 0, UpBarColor: 1, CalcWrink: 0, CPSMode: 1, AvgCPSHist: 3, AvgClicksHist: 0, ToolWarnCautBon: 0, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Favicon: 1, TooltipBuildUp: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, TooltipGrim:1, ToolWrink: 1, TooltipLump: 1, Stats: 1, UpStats: 1, TimeFormat: 0, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'}}; CM.ConfigDefault = { BotBar: 1, TimerBar: 1, @@ -260,6 +259,7 @@ CM.ConfigDefault = { BuildColor: 1, BulkBuildColor: 0, UpBarColor: 1, + UpgradeBarFixedPos: 1, CalcWrink: 0, CPSMode: 1, AvgCPSHist: 3, @@ -290,6 +290,7 @@ CM.ConfigDefault = { ToolWarnCautPos: 1, TooltipGrim:1, ToolWrink: 1, + TooltipLump: 1, Stats: 1, UpStats: 1, TimeFormat: 0, @@ -303,6 +304,6 @@ CM.ConfigDefault = { }; CM.ConfigPrefix = 'CMConfig'; -CM.VersionMajor = '2.022'; +CM.VersionMajor = '2.031'; CM.VersionMinor = '1'; From 65b335b85305fb710e239ddd4b73a9ffd5747132 Mon Sep 17 00:00:00 2001 From: DanielNoord Date: Mon, 23 Nov 2020 18:03:20 +0100 Subject: [PATCH 15/16] Version 2.031.1 (#329) From 2e2631fca8dad80bbc39759174606b0b835fc2d3 Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Mon, 23 Nov 2020 18:09:12 +0100 Subject: [PATCH 16/16] Cleaned up repository --- CookieMonster | 1 - 1 file changed, 1 deletion(-) delete mode 160000 CookieMonster diff --git a/CookieMonster b/CookieMonster deleted file mode 160000 index 4949b868..00000000 --- a/CookieMonster +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4949b868fa148dac5aa9f1c9ec7ac83fa1ffdbda