From 4118343606dbbd70d8066179fb5cbdd0cbf65eca Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Sun, 12 Oct 2014 21:49:22 -0400 Subject: [PATCH 1/4] Version change --- CookieMonster.js | 2 +- src/Main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index d8dac27..366b6b5 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -2075,7 +2075,7 @@ CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBar CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '1.0465'; -CM.VersionMinor = '13'; +CM.VersionMinor = '14'; /******* * Sim * diff --git a/src/Main.js b/src/Main.js index 00b37b7..fc6762c 100644 --- a/src/Main.js +++ b/src/Main.js @@ -145,5 +145,5 @@ CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBar CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '1.0465'; -CM.VersionMinor = '13'; +CM.VersionMinor = '14'; From cd18b1a402789e74a798dbb08a0c91b0815b95de Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Sun, 12 Oct 2014 22:20:34 -0400 Subject: [PATCH 2/4] Added the option to calculate warn/caution with or without the bonus CPU from buying (Issue #30) --- CookieMonster.js | 15 ++++++++++----- src/Config.js | 1 + src/Disp.js | 12 ++++++++---- src/Main.js | 2 +- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 366b6b5..0430d4f 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -321,6 +321,7 @@ CM.ConfigData.Tooltip = {label: ['Tooltip Information OFF', 'Tooltip Information CM.ConfigData.TooltipAmor = {label: ['Tooltip Amortization Information OFF', 'Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip'}; CM.ConfigData.ToolWarnCaut = {label: ['Tooltip Warning/Caution OFF', 'Tooltip Warning/Caution ON'], desc: 'A warning/caution when buying if it will put the bank under the amount needed for max "Lucky!"/"Lucky!" (Frenzy) rewards', func: function() {CM.Disp.ToggleToolWarnCaut();}}; CM.ConfigData.ToolWarnCautPos = {label: ['Tooltip Warning/Caution Position (Left)', 'Tooltip Warning/Caution Position (Bottom)'], desc: 'Placement of the warning/caution boxes', func: function() {CM.Disp.ToggleToolWarnCautPos();}}; +CM.ConfigData.ToolWarnCautBon = {label: ['Calculate Tooltip Warning/Caution With Bonus CPS OFF', 'Calculate Tooltip Warning/Caution With Bonus CPS ON'], desc: 'Calculate the warning/caution with or without the bonus CPS you get from buying'}; CM.ConfigData.ToolWrink = {label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it'}; CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!'}; CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 3 seconds'}; @@ -1182,6 +1183,7 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('TooltipAmor')); frag.appendChild(listing('ToolWarnCaut')); frag.appendChild(listing('ToolWarnCautPos')); + frag.appendChild(listing('ToolWarnCautBon')); frag.appendChild(listing('ToolWrink')); frag.appendChild(header('Statistics')); @@ -1761,11 +1763,14 @@ CM.Disp.UpdateTooltip = function() { } if (CM.Config.ToolWarnCaut == 1) { - var bonusNoFren = bonus; - if (Game.frenzy > 0) { - bonusNoFren /= Game.frenzyPower; + var warn = CM.Cache.Lucky; + if (CM.Config.ToolWarnCautBon == 1) { + var bonusNoFren = bonus; + if (Game.frenzy > 0) { + bonusNoFren /= Game.frenzyPower; + } + warn += ((bonusNoFren * 60 * 20) / 0.1); } - var warn = CM.Cache.Lucky + ((bonusNoFren * 60 * 20) / 0.1); var caut = warn * 7; var amount = Game.cookies - price; if (amount < warn || amount < caut) { @@ -2071,7 +2076,7 @@ CM.DelayInit = function() { Game.Win('Third-party'); } -CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3'}}; +CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWarnCautBon: 0, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3'}}; CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '1.0465'; diff --git a/src/Config.js b/src/Config.js index 10be1f7..8f7a88d 100644 --- a/src/Config.js +++ b/src/Config.js @@ -122,6 +122,7 @@ CM.ConfigData.Tooltip = {label: ['Tooltip Information OFF', 'Tooltip Information CM.ConfigData.TooltipAmor = {label: ['Tooltip Amortization Information OFF', 'Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip'}; CM.ConfigData.ToolWarnCaut = {label: ['Tooltip Warning/Caution OFF', 'Tooltip Warning/Caution ON'], desc: 'A warning/caution when buying if it will put the bank under the amount needed for max "Lucky!"/"Lucky!" (Frenzy) rewards', func: function() {CM.Disp.ToggleToolWarnCaut();}}; CM.ConfigData.ToolWarnCautPos = {label: ['Tooltip Warning/Caution Position (Left)', 'Tooltip Warning/Caution Position (Bottom)'], desc: 'Placement of the warning/caution boxes', func: function() {CM.Disp.ToggleToolWarnCautPos();}}; +CM.ConfigData.ToolWarnCautBon = {label: ['Calculate Tooltip Warning/Caution With Bonus CPS OFF', 'Calculate Tooltip Warning/Caution With Bonus CPS ON'], desc: 'Calculate the warning/caution with or without the bonus CPS you get from buying'}; CM.ConfigData.ToolWrink = {label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it'}; CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!'}; CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 3 seconds'}; diff --git a/src/Disp.js b/src/Disp.js index c0d5517..9e75ec6 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -845,6 +845,7 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('TooltipAmor')); frag.appendChild(listing('ToolWarnCaut')); frag.appendChild(listing('ToolWarnCautPos')); + frag.appendChild(listing('ToolWarnCautBon')); frag.appendChild(listing('ToolWrink')); frag.appendChild(header('Statistics')); @@ -1424,11 +1425,14 @@ CM.Disp.UpdateTooltip = function() { } if (CM.Config.ToolWarnCaut == 1) { - var bonusNoFren = bonus; - if (Game.frenzy > 0) { - bonusNoFren /= Game.frenzyPower; + var warn = CM.Cache.Lucky; + if (CM.Config.ToolWarnCautBon == 1) { + var bonusNoFren = bonus; + if (Game.frenzy > 0) { + bonusNoFren /= Game.frenzyPower; + } + warn += ((bonusNoFren * 60 * 20) / 0.1); } - var warn = CM.Cache.Lucky + ((bonusNoFren * 60 * 20) / 0.1); var caut = warn * 7; var amount = Game.cookies - price; if (amount < warn || amount < caut) { diff --git a/src/Main.js b/src/Main.js index fc6762c..a06a28f 100644 --- a/src/Main.js +++ b/src/Main.js @@ -141,7 +141,7 @@ CM.DelayInit = function() { Game.Win('Third-party'); } -CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3'}}; +CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWarnCautBon: 0, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3'}}; CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '1.0465'; From b9486e989518fec7b5f99dfa990bf37478b65763 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Sun, 19 Oct 2014 22:52:08 -0400 Subject: [PATCH 3/4] Fixed a bug with large numbers and chain calculations (Thanks to an anonymous wikia user) --- CookieMonster.js | 22 +++++++++++----------- src/Cache.js | 20 ++++++++++---------- src/Sim.js | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 0430d4f..3cb746a 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -21,6 +21,14 @@ CM.Sim = {}; /********* * Cache * *********/ + +CM.Cache.NextNumber = function(base) { + var count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1; + while (base == base + count) { + count = CM.Cache.NextNumber(count); + } + return (base + count); +} CM.Cache.RemakeIncome = function() { // Simulate Building Buys for 1 amount @@ -139,11 +147,7 @@ CM.Cache.RemakeChain = function() { CM.Cache.Chain = 0; } else { - count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1; - while (base == base + count) { - count++; - } - CM.Cache.Chain = (base + count) / 0.25; + CM.Cache.Chain = CM.Cache.NextNumber(base) / 0.25; } CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7); @@ -160,11 +164,7 @@ CM.Cache.RemakeChain = function() { CM.Cache.ChainFrenzy = 0; } else { - count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1; - while(base == base + count) { - count++; - } - CM.Cache.ChainFrenzy = (base + count) / 0.25; + CM.Cache.ChainFrenzy = CM.Cache.NextNumber(base) / 0.25; } } @@ -2086,7 +2086,7 @@ CM.VersionMinor = '14'; * Sim * *******/ -CM.Sim.BuildingGetPrice = function (basePrice, start, increase) { +CM.Sim.BuildingGetPrice = function(basePrice, start, increase) { var totalPrice = 0; var count = 0; while(count < increase) { diff --git a/src/Cache.js b/src/Cache.js index 42099f1..a10ed9a 100644 --- a/src/Cache.js +++ b/src/Cache.js @@ -1,6 +1,14 @@ /********* * Cache * *********/ + +CM.Cache.NextNumber = function(base) { + var count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1; + while (base == base + count) { + count = CM.Cache.NextNumber(count); + } + return (base + count); +} CM.Cache.RemakeIncome = function() { // Simulate Building Buys for 1 amount @@ -119,11 +127,7 @@ CM.Cache.RemakeChain = function() { CM.Cache.Chain = 0; } else { - count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1; - while (base == base + count) { - count++; - } - CM.Cache.Chain = (base + count) / 0.25; + CM.Cache.Chain = CM.Cache.NextNumber(base) / 0.25; } CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7); @@ -140,11 +144,7 @@ CM.Cache.RemakeChain = function() { CM.Cache.ChainFrenzy = 0; } else { - count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1; - while(base == base + count) { - count++; - } - CM.Cache.ChainFrenzy = (base + count) / 0.25; + CM.Cache.ChainFrenzy = CM.Cache.NextNumber(base) / 0.25; } } diff --git a/src/Sim.js b/src/Sim.js index 0aea15e..b73c1fe 100644 --- a/src/Sim.js +++ b/src/Sim.js @@ -2,7 +2,7 @@ * Sim * *******/ -CM.Sim.BuildingGetPrice = function (basePrice, start, increase) { +CM.Sim.BuildingGetPrice = function(basePrice, start, increase) { var totalPrice = 0; var count = 0; while(count < increase) { From 2063fa9db793f17e14ded6ebfb078bd8f52e3518 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Fri, 31 Oct 2014 20:21:09 -0400 Subject: [PATCH 4/4] Version change to 1.0466.1 --- CookieMonster.js | 4 ++-- src/Main.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 3cb746a..621b87a 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -2079,8 +2079,8 @@ CM.DelayInit = function() { CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWarnCautBon: 0, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3'}}; CM.ConfigPrefix = 'CMConfig'; -CM.VersionMajor = '1.0465'; -CM.VersionMinor = '14'; +CM.VersionMajor = '1.0466'; +CM.VersionMinor = '1'; /******* * Sim * diff --git a/src/Main.js b/src/Main.js index a06a28f..a24854e 100644 --- a/src/Main.js +++ b/src/Main.js @@ -144,6 +144,6 @@ CM.DelayInit = function() { CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWarnCautBon: 0, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}, Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3'}}; CM.ConfigPrefix = 'CMConfig'; -CM.VersionMajor = '1.0465'; -CM.VersionMinor = '14'; +CM.VersionMajor = '1.0466'; +CM.VersionMinor = '1';