From 3ff3b970a0b87cc719c12ba5c199b2a428353324 Mon Sep 17 00:00:00 2001 From: Eric Olsen Date: Fri, 4 Oct 2019 23:42:05 -0600 Subject: [PATCH 01/10] Fortune Cookie Effects configuration --- src/Config.js | 7 +++++++ src/Main.js | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/Config.js b/src/Config.js index 63c6b18..a75f8f8 100644 --- a/src/Config.js +++ b/src/Config.js @@ -148,6 +148,13 @@ for (var i = 0; i < 101; i++) { CM.ConfigData.GCSoundURL = {label: 'Golden Cookie Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns'}; CM.ConfigData.GCTimer = {label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when it has been spawned', toggle: true, func: function() {CM.Disp.ToggleGCTimer();}}; CM.ConfigData.Favicon = {label: ['Favicon OFF', 'Favicon ON'], desc: 'Update favicon with Golden/Wrath Cookie', toggle: true, func: function() {CM.Disp.UpdateFavicon();}}; +CM.ConfigData.FortuneFlash = {label: ['Fortune Cookie Flash OFF', 'Fortune Cookie Flash ON'], desc: 'Flash screen on Fortune Cookie', toggle: true}; +CM.ConfigData.FortuneSound = {label: ['Fortune Cookie Sound OFF', 'Fortune Cookie Sound ON'], desc: 'Play a sound on Fortune Cookie', toggle: true}; +CM.ConfigData.FortuneVolume = {label: [], desc: 'Volume of the Fortune Cookie sound'}; +for (var i = 0; i < 101; i++) { + CM.ConfigData.FortuneVolume.label[i] = i + '%'; +} +CM.ConfigData.FortuneSoundURL = {label: 'Fortune Cookie Sound URL:', desc: 'URL of the sound to be played when the Ticker has a Fortune Cookie'}; CM.ConfigData.SeaFlash = {label: ['Season Special Flash OFF', 'Season Special Flash ON'], desc: 'Flash screen on Season Popup', toggle: true}; CM.ConfigData.SeaSound = {label: ['Season Special Sound OFF', 'Season Special Sound ON'], desc: 'Play a sound on Season Popup', toggle: true}; CM.ConfigData.SeaVolume = {label: [], desc: 'Volume of the Season Special sound'}; diff --git a/src/Main.js b/src/Main.js index 4a87586..34bb595 100644 --- a/src/Main.js +++ b/src/Main.js @@ -266,6 +266,10 @@ CM.ConfigDefault = { GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3', GCTimer: 1, Favicon: 1, + FortuneFlash: 1, + FortuneSound: 1, + FortuneVolume: 100, + FortuneSoundURL: 'https://freesound.org/data/previews/419/419594_7062176-lq.mp3', SeaFlash: 1, SeaSound: 1, SeaVolume: 100, From 8e2777df0eea0b0e32d427e3659d8520e19ced8e Mon Sep 17 00:00:00 2001 From: Eric Olsen Date: Fri, 4 Oct 2019 23:44:33 -0600 Subject: [PATCH 02/10] more Fortune Cookie config stuff --- src/Disp.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Disp.js b/src/Disp.js index 4197b76..8bdff76 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1112,6 +1112,10 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(url('GCSoundURL')); frag.appendChild(listing('GCTimer')); frag.appendChild(listing('Favicon')); + frag.appendChild(listing('FortuneFlash')); + frag.appendChild(listing('FortuneSound')); + frag.appendChild(vol('FortuneVolume')); + frag.appendChild(url('FortuneSoundURL')); frag.appendChild(listing('SeaFlash')); frag.appendChild(listing('SeaSound')); frag.appendChild(vol('SeaVolume')); From 8af54cfe8c302f4ccc9cb49babcc6d50dcb25352 Mon Sep 17 00:00:00 2001 From: Eric Olsen Date: Fri, 4 Oct 2019 23:46:42 -0600 Subject: [PATCH 03/10] Fortune Cookie checker function and added to the main loop --- src/Disp.js | 10 ++++++++++ src/Main.js | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/Disp.js b/src/Disp.js index 8bdff76..c8f98be 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -869,6 +869,15 @@ CM.Disp.CheckGoldenCookie = function() { } } +CM.Disp.CheckTickerFortune = function() { + if (CM.Disp.lastTickerFortuneState != (Game.TickerEffect && Game.TickerEffect.type == 'fortune')) { + CM.Disp.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type == 'fortune'); + if (CM.Disp.lastTickerFortuneState) { + CM.Disp.Flash(3, 'FortuneFlash'); + CM.Disp.PlaySound(CM.Config.FortuneSoundURL, 'FortuneSound', 'FortuneVolume'); + } + } +} CM.Disp.CheckSeasonPopup = function() { if (CM.Disp.lastSeasonPopupState != Game.shimmerTypes['reindeer'].spawned) { @@ -2030,6 +2039,7 @@ CM.Disp.colorBrown = 'Brown'; CM.Disp.colors = [CM.Disp.colorBlue, CM.Disp.colorGreen, CM.Disp.colorYellow, CM.Disp.colorOrange, CM.Disp.colorRed, CM.Disp.colorPurple, CM.Disp.colorGray, CM.Disp.colorPink, CM.Disp.colorBrown]; CM.Disp.buffColors = {'Frenzy': CM.Disp.colorYellow, 'Dragon Harvest': CM.Disp.colorBrown, 'Elder frenzy': CM.Disp.colorGreen, 'Clot': CM.Disp.colorRed, 'Click frenzy': CM.Disp.colorBlue, 'Dragonflight': CM.Disp.colorPink}; CM.Disp.lastGoldenCookieState = 0; +CM.Disp.lastTickerFortuneState = 0; CM.Disp.lastSeasonPopupState = 0; CM.Disp.lastGardenNextStep = 0; CM.Disp.goldenShimmer; diff --git a/src/Main.js b/src/Main.js index 34bb595..75c5bb7 100644 --- a/src/Main.js +++ b/src/Main.js @@ -186,6 +186,9 @@ CM.Loop = function() { // Check Golden Cookies CM.Disp.CheckGoldenCookie(); + // Check Fortune Cookies + CM.Disp.CheckTickerFortune(); + // Check Season Popup CM.Disp.CheckSeasonPopup(); From 836804b3f957f2c7491e6a6560f4e6880f80f4f9 Mon Sep 17 00:00:00 2001 From: Eric Olsen Date: Fri, 4 Oct 2019 23:58:30 -0600 Subject: [PATCH 04/10] combine Fortune Cooke effect commits into CookieMonster.js --- CookieMonster.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/CookieMonster.js b/CookieMonster.js index 8aa733b..ab60b8b 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -542,6 +542,13 @@ for (var i = 0; i < 101; i++) { CM.ConfigData.GCSoundURL = {label: 'Golden Cookie Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns'}; CM.ConfigData.GCTimer = {label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when it has been spawned', toggle: true, func: function() {CM.Disp.ToggleGCTimer();}}; CM.ConfigData.Favicon = {label: ['Favicon OFF', 'Favicon ON'], desc: 'Update favicon with Golden/Wrath Cookie', toggle: true, func: function() {CM.Disp.UpdateFavicon();}}; +CM.ConfigData.FortuneFlash = {label: ['Fortune Cookie Flash OFF', 'Fortune Cookie Flash ON'], desc: 'Flash screen on Fortune Cookie', toggle: true}; +CM.ConfigData.FortuneSound = {label: ['Fortune Cookie Sound OFF', 'Fortune Cookie Sound ON'], desc: 'Play a sound on Fortune Cookie', toggle: true}; +CM.ConfigData.FortuneVolume = {label: [], desc: 'Volume of the Fortune Cookie sound'}; +for (var i = 0; i < 101; i++) { + CM.ConfigData.FortuneVolume.label[i] = i + '%'; +} +CM.ConfigData.FortuneSoundURL = {label: 'Fortune Cookie Sound URL:', desc: 'URL of the sound to be played when the Ticker has a Fortune Cookie'}; CM.ConfigData.SeaFlash = {label: ['Season Special Flash OFF', 'Season Special Flash ON'], desc: 'Flash screen on Season Popup', toggle: true}; CM.ConfigData.SeaSound = {label: ['Season Special Sound OFF', 'Season Special Sound ON'], desc: 'Play a sound on Season Popup', toggle: true}; CM.ConfigData.SeaVolume = {label: [], desc: 'Volume of the Season Special sound'}; @@ -1449,6 +1456,15 @@ CM.Disp.CheckGoldenCookie = function() { } } +CM.Disp.CheckTickerFortune = function() { + if (CM.Disp.lastTickerFortuneState != (Game.TickerEffect && Game.TickerEffect.type == 'fortune')) { + CM.Disp.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type == 'fortune'); + if (CM.Disp.lastTickerFortuneState) { + CM.Disp.Flash(3, 'FortuneFlash'); + CM.Disp.PlaySound(CM.Config.FortuneSoundURL, 'FortuneSound', 'FortuneVolume'); + } + } +} CM.Disp.CheckSeasonPopup = function() { if (CM.Disp.lastSeasonPopupState != Game.shimmerTypes['reindeer'].spawned) { @@ -1692,6 +1708,10 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(url('GCSoundURL')); frag.appendChild(listing('GCTimer')); frag.appendChild(listing('Favicon')); + frag.appendChild(listing('FortuneFlash')); + frag.appendChild(listing('FortuneSound')); + frag.appendChild(vol('FortuneVolume')); + frag.appendChild(url('FortuneSoundURL')); frag.appendChild(listing('SeaFlash')); frag.appendChild(listing('SeaSound')); frag.appendChild(vol('SeaVolume')); @@ -2606,6 +2626,7 @@ CM.Disp.colorBrown = 'Brown'; CM.Disp.colors = [CM.Disp.colorBlue, CM.Disp.colorGreen, CM.Disp.colorYellow, CM.Disp.colorOrange, CM.Disp.colorRed, CM.Disp.colorPurple, CM.Disp.colorGray, CM.Disp.colorPink, CM.Disp.colorBrown]; CM.Disp.buffColors = {'Frenzy': CM.Disp.colorYellow, 'Dragon Harvest': CM.Disp.colorBrown, 'Elder frenzy': CM.Disp.colorGreen, 'Clot': CM.Disp.colorRed, 'Click frenzy': CM.Disp.colorBlue, 'Dragonflight': CM.Disp.colorPink}; CM.Disp.lastGoldenCookieState = 0; +CM.Disp.lastTickerFortuneState = 0; CM.Disp.lastSeasonPopupState = 0; CM.Disp.lastGardenNextStep = 0; CM.Disp.goldenShimmer; @@ -2822,6 +2843,9 @@ CM.Loop = function() { // Check Golden Cookies CM.Disp.CheckGoldenCookie(); + // Check Fortune Cookies + CM.Disp.CheckTickerFortune(); + // Check Season Popup CM.Disp.CheckSeasonPopup(); @@ -2902,6 +2926,10 @@ CM.ConfigDefault = { GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3', GCTimer: 1, Favicon: 1, + FortuneFlash: 1, + FortuneSound: 1, + FortuneVolume: 100, + FortuneSoundURL: 'https://freesound.org/data/previews/419/419594_7062176-lq.mp3', SeaFlash: 1, SeaSound: 1, SeaVolume: 100, From 431b1e6cd0c8636c913278f0c3e73c442b34b284 Mon Sep 17 00:00:00 2001 From: Eric Olsen Date: Sat, 5 Oct 2019 00:29:57 -0600 Subject: [PATCH 05/10] cleaned-up whitespace formatting to match the rest (tabs instead of spaces) --- CookieMonster.js | 30 +++++++++++++++--------------- src/Config.js | 2 +- src/Disp.js | 20 ++++++++++---------- src/Main.js | 8 ++++---- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index ab60b8b..e82666d 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -546,7 +546,7 @@ CM.ConfigData.FortuneFlash = {label: ['Fortune Cookie Flash OFF', 'Fortune Cooki CM.ConfigData.FortuneSound = {label: ['Fortune Cookie Sound OFF', 'Fortune Cookie Sound ON'], desc: 'Play a sound on Fortune Cookie', toggle: true}; CM.ConfigData.FortuneVolume = {label: [], desc: 'Volume of the Fortune Cookie sound'}; for (var i = 0; i < 101; i++) { - CM.ConfigData.FortuneVolume.label[i] = i + '%'; + CM.ConfigData.FortuneVolume.label[i] = i + '%'; } CM.ConfigData.FortuneSoundURL = {label: 'Fortune Cookie Sound URL:', desc: 'URL of the sound to be played when the Ticker has a Fortune Cookie'}; CM.ConfigData.SeaFlash = {label: ['Season Special Flash OFF', 'Season Special Flash ON'], desc: 'Flash screen on Season Popup', toggle: true}; @@ -1457,13 +1457,13 @@ CM.Disp.CheckGoldenCookie = function() { } CM.Disp.CheckTickerFortune = function() { - if (CM.Disp.lastTickerFortuneState != (Game.TickerEffect && Game.TickerEffect.type == 'fortune')) { - CM.Disp.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type == 'fortune'); - if (CM.Disp.lastTickerFortuneState) { - CM.Disp.Flash(3, 'FortuneFlash'); - CM.Disp.PlaySound(CM.Config.FortuneSoundURL, 'FortuneSound', 'FortuneVolume'); - } - } + if (CM.Disp.lastTickerFortuneState != (Game.TickerEffect && Game.TickerEffect.type == 'fortune')) { + CM.Disp.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type == 'fortune'); + if (CM.Disp.lastTickerFortuneState) { + CM.Disp.Flash(3, 'FortuneFlash'); + CM.Disp.PlaySound(CM.Config.FortuneSoundURL, 'FortuneSound', 'FortuneVolume'); + } + } } CM.Disp.CheckSeasonPopup = function() { @@ -1709,9 +1709,9 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('GCTimer')); frag.appendChild(listing('Favicon')); frag.appendChild(listing('FortuneFlash')); - frag.appendChild(listing('FortuneSound')); - frag.appendChild(vol('FortuneVolume')); - frag.appendChild(url('FortuneSoundURL')); + frag.appendChild(listing('FortuneSound')); + frag.appendChild(vol('FortuneVolume')); + frag.appendChild(url('FortuneSoundURL')); frag.appendChild(listing('SeaFlash')); frag.appendChild(listing('SeaSound')); frag.appendChild(vol('SeaVolume')); @@ -2926,10 +2926,10 @@ CM.ConfigDefault = { GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3', GCTimer: 1, Favicon: 1, - FortuneFlash: 1, - FortuneSound: 1, - FortuneVolume: 100, - FortuneSoundURL: 'https://freesound.org/data/previews/419/419594_7062176-lq.mp3', + FortuneFlash: 1, + FortuneSound: 1, + FortuneVolume: 100, + FortuneSoundURL: 'https://freesound.org/data/previews/419/419594_7062176-lq.mp3', SeaFlash: 1, SeaSound: 1, SeaVolume: 100, diff --git a/src/Config.js b/src/Config.js index a75f8f8..1598ebf 100644 --- a/src/Config.js +++ b/src/Config.js @@ -152,7 +152,7 @@ CM.ConfigData.FortuneFlash = {label: ['Fortune Cookie Flash OFF', 'Fortune Cooki CM.ConfigData.FortuneSound = {label: ['Fortune Cookie Sound OFF', 'Fortune Cookie Sound ON'], desc: 'Play a sound on Fortune Cookie', toggle: true}; CM.ConfigData.FortuneVolume = {label: [], desc: 'Volume of the Fortune Cookie sound'}; for (var i = 0; i < 101; i++) { - CM.ConfigData.FortuneVolume.label[i] = i + '%'; + CM.ConfigData.FortuneVolume.label[i] = i + '%'; } CM.ConfigData.FortuneSoundURL = {label: 'Fortune Cookie Sound URL:', desc: 'URL of the sound to be played when the Ticker has a Fortune Cookie'}; CM.ConfigData.SeaFlash = {label: ['Season Special Flash OFF', 'Season Special Flash ON'], desc: 'Flash screen on Season Popup', toggle: true}; diff --git a/src/Disp.js b/src/Disp.js index c8f98be..63caeba 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -870,13 +870,13 @@ CM.Disp.CheckGoldenCookie = function() { } CM.Disp.CheckTickerFortune = function() { - if (CM.Disp.lastTickerFortuneState != (Game.TickerEffect && Game.TickerEffect.type == 'fortune')) { - CM.Disp.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type == 'fortune'); - if (CM.Disp.lastTickerFortuneState) { - CM.Disp.Flash(3, 'FortuneFlash'); - CM.Disp.PlaySound(CM.Config.FortuneSoundURL, 'FortuneSound', 'FortuneVolume'); - } - } + if (CM.Disp.lastTickerFortuneState != (Game.TickerEffect && Game.TickerEffect.type == 'fortune')) { + CM.Disp.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type == 'fortune'); + if (CM.Disp.lastTickerFortuneState) { + CM.Disp.Flash(3, 'FortuneFlash'); + CM.Disp.PlaySound(CM.Config.FortuneSoundURL, 'FortuneSound', 'FortuneVolume'); + } + } } CM.Disp.CheckSeasonPopup = function() { @@ -1122,9 +1122,9 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(listing('GCTimer')); frag.appendChild(listing('Favicon')); frag.appendChild(listing('FortuneFlash')); - frag.appendChild(listing('FortuneSound')); - frag.appendChild(vol('FortuneVolume')); - frag.appendChild(url('FortuneSoundURL')); + frag.appendChild(listing('FortuneSound')); + frag.appendChild(vol('FortuneVolume')); + frag.appendChild(url('FortuneSoundURL')); frag.appendChild(listing('SeaFlash')); frag.appendChild(listing('SeaSound')); frag.appendChild(vol('SeaVolume')); diff --git a/src/Main.js b/src/Main.js index 75c5bb7..8181f9a 100644 --- a/src/Main.js +++ b/src/Main.js @@ -269,10 +269,10 @@ CM.ConfigDefault = { GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3', GCTimer: 1, Favicon: 1, - FortuneFlash: 1, - FortuneSound: 1, - FortuneVolume: 100, - FortuneSoundURL: 'https://freesound.org/data/previews/419/419594_7062176-lq.mp3', + FortuneFlash: 1, + FortuneSound: 1, + FortuneVolume: 100, + FortuneSoundURL: 'https://freesound.org/data/previews/419/419594_7062176-lq.mp3', SeaFlash: 1, SeaSound: 1, SeaVolume: 100, From b5eac1ce224561b4891dfa3670efc179f5b29763 Mon Sep 17 00:00:00 2001 From: Eric Olsen Date: Sat, 5 Oct 2019 15:33:36 -0600 Subject: [PATCH 06/10] Add [F] to title when Fortune Cookie is present (remove when it's not) --- CookieMonster.js | 9 ++++++++- src/Disp.js | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index e82666d..3e58a23 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1502,6 +1502,7 @@ CM.Disp.UpdateTitle = function() { var addSP = false; var titleGC; + var titleFC = ''; var titleSP; if (CM.Disp.lastGoldenCookieState) { if (CM.Disp.goldenShimmer.wrath) { @@ -1517,6 +1518,9 @@ CM.Disp.UpdateTitle = function() { else { titleGC = '[GS]' } + if (CM.Disp.lastTickerFortuneState) { + titleFC = '[F]'; + } if (Game.season == 'christmas') { addSP = true; if (CM.Disp.lastSeasonPopupState) { @@ -1532,11 +1536,14 @@ CM.Disp.UpdateTitle = function() { str = str.substring(str.lastIndexOf(']') + 1); } - document.title = titleGC + (addSP ? titleSP : '') + ' ' + str; + document.title = titleFC + titleGC + (addSP ? titleSP : '') + ' ' + str; } else if (CM.Config.Title == 2) { var str = ''; var spawn = false; + if (CM.Disp.lastTickerFortuneState) { + str += '[F]'; + } if (CM.Disp.lastGoldenCookieState) { spawn = true; if (CM.Disp.goldenShimmer.wrath) { diff --git a/src/Disp.js b/src/Disp.js index 63caeba..1b201ba 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -915,6 +915,7 @@ CM.Disp.UpdateTitle = function() { var addSP = false; var titleGC; + var titleFC = ''; var titleSP; if (CM.Disp.lastGoldenCookieState) { if (CM.Disp.goldenShimmer.wrath) { @@ -930,6 +931,9 @@ CM.Disp.UpdateTitle = function() { else { titleGC = '[GS]' } + if (CM.Disp.lastTickerFortuneState) { + titleFC = '[F]'; + } if (Game.season == 'christmas') { addSP = true; if (CM.Disp.lastSeasonPopupState) { @@ -945,11 +949,14 @@ CM.Disp.UpdateTitle = function() { str = str.substring(str.lastIndexOf(']') + 1); } - document.title = titleGC + (addSP ? titleSP : '') + ' ' + str; + document.title = titleFC + titleGC + (addSP ? titleSP : '') + ' ' + str; } else if (CM.Config.Title == 2) { var str = ''; var spawn = false; + if (CM.Disp.lastTickerFortuneState) { + str += '[F]'; + } if (CM.Disp.lastGoldenCookieState) { spawn = true; if (CM.Disp.goldenShimmer.wrath) { From 06ba2ad00004980c6d70186b7cbd052d0774d6f2 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Wed, 9 Oct 2019 21:23:24 -0400 Subject: [PATCH 07/10] Change to Version 2.021.2 --- CookieMonster.js | 2 +- src/Main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index e4c1031..fd344f0 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -2946,7 +2946,7 @@ CM.ConfigDefault = { CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '2.021'; -CM.VersionMinor = '1'; +CM.VersionMinor = '2'; /******* * Sim * diff --git a/src/Main.js b/src/Main.js index 5ca6c15..eb23caf 100644 --- a/src/Main.js +++ b/src/Main.js @@ -293,5 +293,5 @@ CM.ConfigDefault = { CM.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '2.021'; -CM.VersionMinor = '1'; +CM.VersionMinor = '2'; From 244d0342ecac9ce978c6c934ea6fb16091fd68a0 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Thu, 10 Oct 2019 20:23:23 -0400 Subject: [PATCH 08/10] Minor code cleanup from merge --- CookieMonster.js | 13 ++++++++----- src/Disp.js | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 0f915a8..856cef2 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1511,10 +1511,11 @@ CM.Disp.UpdateTitle = function() { document.title = CM.Cache.Title; } else if (CM.Config.Title == 1) { + var addFC = false; var addSP = false; var titleGC; - var titleFC = ''; + var titleFC; var titleSP; if (CM.Disp.lastGoldenCookieState) { if (CM.Disp.goldenShimmer.wrath) { @@ -1531,6 +1532,7 @@ CM.Disp.UpdateTitle = function() { titleGC = '[GS]' } if (CM.Disp.lastTickerFortuneState) { + addFC = true; titleFC = '[F]'; } if (Game.season == 'christmas') { @@ -1548,14 +1550,11 @@ CM.Disp.UpdateTitle = function() { str = str.substring(str.lastIndexOf(']') + 1); } - document.title = titleFC + titleGC + (addSP ? titleSP : '') + ' ' + str; + document.title = titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '') + ' ' + str; } else if (CM.Config.Title == 2) { var str = ''; var spawn = false; - if (CM.Disp.lastTickerFortuneState) { - str += '[F]'; - } if (CM.Disp.lastGoldenCookieState) { spawn = true; if (CM.Disp.goldenShimmer.wrath) { @@ -1565,6 +1564,10 @@ CM.Disp.UpdateTitle = function() { str += '[G ' + Math.ceil(CM.Disp.goldenShimmer.life / Game.fps) + ']'; } } + if (CM.Disp.lastTickerFortuneState) { + spawn = true; + str += '[F]'; + } if (Game.season == 'christmas' && CM.Disp.lastSeasonPopupState) { str += '[R ' + Math.ceil(CM.Disp.seasonPopShimmer.life / Game.fps) + ']'; spawn = true; diff --git a/src/Disp.js b/src/Disp.js index 3996bb0..53fbcb0 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -912,10 +912,11 @@ CM.Disp.UpdateTitle = function() { document.title = CM.Cache.Title; } else if (CM.Config.Title == 1) { + var addFC = false; var addSP = false; var titleGC; - var titleFC = ''; + var titleFC; var titleSP; if (CM.Disp.lastGoldenCookieState) { if (CM.Disp.goldenShimmer.wrath) { @@ -932,6 +933,7 @@ CM.Disp.UpdateTitle = function() { titleGC = '[GS]' } if (CM.Disp.lastTickerFortuneState) { + addFC = true; titleFC = '[F]'; } if (Game.season == 'christmas') { @@ -949,14 +951,11 @@ CM.Disp.UpdateTitle = function() { str = str.substring(str.lastIndexOf(']') + 1); } - document.title = titleFC + titleGC + (addSP ? titleSP : '') + ' ' + str; + document.title = titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '') + ' ' + str; } else if (CM.Config.Title == 2) { var str = ''; var spawn = false; - if (CM.Disp.lastTickerFortuneState) { - str += '[F]'; - } if (CM.Disp.lastGoldenCookieState) { spawn = true; if (CM.Disp.goldenShimmer.wrath) { @@ -966,6 +965,10 @@ CM.Disp.UpdateTitle = function() { str += '[G ' + Math.ceil(CM.Disp.goldenShimmer.life / Game.fps) + ']'; } } + if (CM.Disp.lastTickerFortuneState) { + spawn = true; + str += '[F]'; + } if (Game.season == 'christmas' && CM.Disp.lastSeasonPopupState) { str += '[R ' + Math.ceil(CM.Disp.seasonPopShimmer.life / Game.fps) + ']'; spawn = true; From fa6b998f67fabd8630321757644f290371b68e6b Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Thu, 10 Oct 2019 20:34:36 -0400 Subject: [PATCH 09/10] Changed default Fortune Cookie sound effect --- CookieMonster.js | 2 +- src/Main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 856cef2..773f055 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -2956,7 +2956,7 @@ CM.ConfigDefault = { FortuneFlash: 1, FortuneSound: 1, FortuneVolume: 100, - FortuneSoundURL: 'https://freesound.org/data/previews/419/419594_7062176-lq.mp3', + FortuneSoundURL: 'https://freesound.org/data/previews/174/174027_3242494-lq.mp3', SeaFlash: 1, SeaSound: 1, SeaVolume: 100, diff --git a/src/Main.js b/src/Main.js index f582da7..b5a582e 100644 --- a/src/Main.js +++ b/src/Main.js @@ -272,7 +272,7 @@ CM.ConfigDefault = { FortuneFlash: 1, FortuneSound: 1, FortuneVolume: 100, - FortuneSoundURL: 'https://freesound.org/data/previews/419/419594_7062176-lq.mp3', + FortuneSoundURL: 'https://freesound.org/data/previews/174/174027_3242494-lq.mp3', SeaFlash: 1, SeaSound: 1, SeaVolume: 100, From a920e9e5fb7ceb5b4b03f7c45bad402823d9b424 Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Thu, 10 Oct 2019 22:22:44 -0400 Subject: [PATCH 10/10] Added stat to show missing Fortune upgrades left to buy (Issue #263 and #271) --- CookieMonster.js | 119 ++++++++++++++++++++++++++++++----------------- src/Data.js | 24 ++++++++++ src/Disp.js | 95 ++++++++++++++++++++----------------- 3 files changed, 154 insertions(+), 84 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 773f055..fc68285 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -593,6 +593,30 @@ CM.ConfigData.Scale = {label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', * Data * ********/ +CM.Data.Fortunes = [ + 'Fortune #001', + 'Fortune #002', + 'Fortune #003', + 'Fortune #004', + 'Fortune #005', + 'Fortune #006', + 'Fortune #007', + 'Fortune #008', + 'Fortune #009', + 'Fortune #010', + 'Fortune #011', + 'Fortune #012', + 'Fortune #013', + 'Fortune #014', + 'Fortune #015', + 'Fortune #016', + 'Fortune #017', + 'Fortune #100', + 'Fortune #101', + 'Fortune #102', + 'Fortune #103', + 'Fortune #104' +]; 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']; @@ -1840,6 +1864,45 @@ CM.Disp.AddMenuStats = function(title) { frag.appendChild(span); return frag; } + + var createMissDisp = function(theMissDisp) { + var frag = document.createDocumentFragment(); + frag.appendChild(document.createTextNode(theMissDisp.length + ' ')); + var span = document.createElement('span'); + span.onmouseout = function() { Game.tooltip.hide(); }; + var placeholder = document.createElement('div'); + var missing = document.createElement('div'); + missing.style.minWidth = '140px'; + missing.style.marginBottom = '4px'; + var title = document.createElement('div'); + title.className = 'name'; + title.style.marginBottom = '4px'; + title.style.textAlign = 'center'; + title.textContent = 'Missing'; + missing.appendChild(title); + for (var i in theMissDisp) { + var div = document.createElement('div'); + div.style.textAlign = 'center'; + div.appendChild(document.createTextNode(theMissDisp[i])); + missing.appendChild(div); + } + placeholder.appendChild(missing); + span.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML));}; + span.style.cursor = 'default'; + span.style.display = 'inline-block'; + span.style.height = '10px'; + span.style.width = '10px'; + span.style.borderRadius = '5px'; + span.style.textAlign = 'center'; + span.style.backgroundColor = '#C0C0C0'; + span.style.color = 'black'; + span.style.fontSize = '9px'; + span.style.verticalAlign = 'bottom'; + span.textContent = '?'; + frag.appendChild(span); + return frag; + } + stats.appendChild(header('Lucky Cookies', 'Lucky')); if (CM.Config.StatsPref.Lucky) { @@ -2067,48 +2130,11 @@ CM.Disp.AddMenuStats = function(title) { stats.appendChild(header('Season Specials', 'Sea')); if (CM.Config.StatsPref.Sea) { if (specDisp) { - var createSpecDisp = function(theSpecDisp) { - var frag = document.createDocumentFragment(); - frag.appendChild(document.createTextNode(theSpecDisp.length + ' ')); - var span = document.createElement('span'); - span.onmouseout = function() { Game.tooltip.hide(); }; - var placeholder = document.createElement('div'); - var missing = document.createElement('div'); - missing.style.minWidth = '140px'; - missing.style.marginBottom = '4px'; - var title = document.createElement('div'); - title.className = 'name'; - title.style.marginBottom = '4px'; - title.style.textAlign = 'center'; - title.textContent = 'Missing'; - missing.appendChild(title); - for (var i in theSpecDisp) { - var div = document.createElement('div'); - div.style.textAlign = 'center'; - div.appendChild(document.createTextNode(theSpecDisp[i])); - missing.appendChild(div); - } - placeholder.appendChild(missing); - span.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML));}; - span.style.cursor = 'default'; - span.style.display = 'inline-block'; - span.style.height = '10px'; - span.style.width = '10px'; - span.style.borderRadius = '5px'; - span.style.textAlign = 'center'; - span.style.backgroundColor = '#C0C0C0'; - span.style.color = 'black'; - span.style.fontSize = '9px'; - span.style.verticalAlign = 'bottom'; - span.textContent = '?'; - frag.appendChild(span); - return frag; - } - if (halloCook.length != 0) stats.appendChild(listing('Halloween Cookies Left to Buy', createSpecDisp(halloCook))); - if (christCook.length != 0) stats.appendChild(listing('Christmas Cookies Left to Buy', createSpecDisp(christCook))); - if (valCook.length != 0) stats.appendChild(listing('Valentine Cookies Left to Buy', createSpecDisp(valCook))); - if (normEggs.length != 0) stats.appendChild(listing('Normal Easter Eggs Left to Unlock', createSpecDisp(normEggs))); - if (rareEggs.length != 0) stats.appendChild(listing('Rare Easter Eggs Left to Unlock', createSpecDisp(rareEggs))); + if (halloCook.length != 0) stats.appendChild(listing('Halloween Cookies Left to Buy', createMissDisp(halloCook))); + if (christCook.length != 0) stats.appendChild(listing('Christmas Cookies Left to Buy', createMissDisp(christCook))); + if (valCook.length != 0) stats.appendChild(listing('Valentine Cookies Left to Buy', createMissDisp(valCook))); + if (normEggs.length != 0) stats.appendChild(listing('Normal Easter Eggs Left to Unlock', createMissDisp(normEggs))); + if (rareEggs.length != 0) stats.appendChild(listing('Rare Easter Eggs Left to Unlock', createMissDisp(rareEggs))); } if (Game.season == 'christmas') stats.appendChild(listing('Reindeer Reward', document.createTextNode(Beautify(CM.Cache.SeaSpec)))); @@ -2128,6 +2154,15 @@ CM.Disp.AddMenuStats = function(title) { document.createTextNode(Beautify(CM.Cache.AvgCPS, 3)) )); stats.appendChild(listing('Average Cookie Clicks Per Second (Past ' + CM.Disp.clickTimes[CM.Config.AvgClicksHist] + (CM.Config.AvgClicksHist == 0 ? ' second' : ' seconds') + ')', document.createTextNode(Beautify(CM.Cache.AvgClicks, 1)))); + if (Game.Has('Fortune cookies')) { + var fortunes = []; + for (var i in CM.Data.Fortunes) { + if (!Game.Has(CM.Data.Fortunes[i])) { + fortunes.push(CM.Data.Fortunes[i]); + } + } + if (fortunes.length != 0) stats.appendChild(listing('Fortune Upgrades Left to Buy', createMissDisp(fortunes))); + } stats.appendChild(listing('Missed Golden Cookies', document.createTextNode(Beautify(Game.missedGoldenClicks)))); } diff --git a/src/Data.js b/src/Data.js index 84571d8..4202c89 100644 --- a/src/Data.js +++ b/src/Data.js @@ -2,6 +2,30 @@ * Data * ********/ +CM.Data.Fortunes = [ + 'Fortune #001', + 'Fortune #002', + 'Fortune #003', + 'Fortune #004', + 'Fortune #005', + 'Fortune #006', + 'Fortune #007', + 'Fortune #008', + 'Fortune #009', + 'Fortune #010', + 'Fortune #011', + 'Fortune #012', + 'Fortune #013', + 'Fortune #014', + 'Fortune #015', + 'Fortune #016', + 'Fortune #017', + 'Fortune #100', + 'Fortune #101', + 'Fortune #102', + 'Fortune #103', + 'Fortune #104' +]; 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']; diff --git a/src/Disp.js b/src/Disp.js index 53fbcb0..fcb1d2d 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1241,6 +1241,45 @@ CM.Disp.AddMenuStats = function(title) { frag.appendChild(span); return frag; } + + var createMissDisp = function(theMissDisp) { + var frag = document.createDocumentFragment(); + frag.appendChild(document.createTextNode(theMissDisp.length + ' ')); + var span = document.createElement('span'); + span.onmouseout = function() { Game.tooltip.hide(); }; + var placeholder = document.createElement('div'); + var missing = document.createElement('div'); + missing.style.minWidth = '140px'; + missing.style.marginBottom = '4px'; + var title = document.createElement('div'); + title.className = 'name'; + title.style.marginBottom = '4px'; + title.style.textAlign = 'center'; + title.textContent = 'Missing'; + missing.appendChild(title); + for (var i in theMissDisp) { + var div = document.createElement('div'); + div.style.textAlign = 'center'; + div.appendChild(document.createTextNode(theMissDisp[i])); + missing.appendChild(div); + } + placeholder.appendChild(missing); + span.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML));}; + span.style.cursor = 'default'; + span.style.display = 'inline-block'; + span.style.height = '10px'; + span.style.width = '10px'; + span.style.borderRadius = '5px'; + span.style.textAlign = 'center'; + span.style.backgroundColor = '#C0C0C0'; + span.style.color = 'black'; + span.style.fontSize = '9px'; + span.style.verticalAlign = 'bottom'; + span.textContent = '?'; + frag.appendChild(span); + return frag; + } + stats.appendChild(header('Lucky Cookies', 'Lucky')); if (CM.Config.StatsPref.Lucky) { @@ -1468,48 +1507,11 @@ CM.Disp.AddMenuStats = function(title) { stats.appendChild(header('Season Specials', 'Sea')); if (CM.Config.StatsPref.Sea) { if (specDisp) { - var createSpecDisp = function(theSpecDisp) { - var frag = document.createDocumentFragment(); - frag.appendChild(document.createTextNode(theSpecDisp.length + ' ')); - var span = document.createElement('span'); - span.onmouseout = function() { Game.tooltip.hide(); }; - var placeholder = document.createElement('div'); - var missing = document.createElement('div'); - missing.style.minWidth = '140px'; - missing.style.marginBottom = '4px'; - var title = document.createElement('div'); - title.className = 'name'; - title.style.marginBottom = '4px'; - title.style.textAlign = 'center'; - title.textContent = 'Missing'; - missing.appendChild(title); - for (var i in theSpecDisp) { - var div = document.createElement('div'); - div.style.textAlign = 'center'; - div.appendChild(document.createTextNode(theSpecDisp[i])); - missing.appendChild(div); - } - placeholder.appendChild(missing); - span.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML));}; - span.style.cursor = 'default'; - span.style.display = 'inline-block'; - span.style.height = '10px'; - span.style.width = '10px'; - span.style.borderRadius = '5px'; - span.style.textAlign = 'center'; - span.style.backgroundColor = '#C0C0C0'; - span.style.color = 'black'; - span.style.fontSize = '9px'; - span.style.verticalAlign = 'bottom'; - span.textContent = '?'; - frag.appendChild(span); - return frag; - } - if (halloCook.length != 0) stats.appendChild(listing('Halloween Cookies Left to Buy', createSpecDisp(halloCook))); - if (christCook.length != 0) stats.appendChild(listing('Christmas Cookies Left to Buy', createSpecDisp(christCook))); - if (valCook.length != 0) stats.appendChild(listing('Valentine Cookies Left to Buy', createSpecDisp(valCook))); - if (normEggs.length != 0) stats.appendChild(listing('Normal Easter Eggs Left to Unlock', createSpecDisp(normEggs))); - if (rareEggs.length != 0) stats.appendChild(listing('Rare Easter Eggs Left to Unlock', createSpecDisp(rareEggs))); + if (halloCook.length != 0) stats.appendChild(listing('Halloween Cookies Left to Buy', createMissDisp(halloCook))); + if (christCook.length != 0) stats.appendChild(listing('Christmas Cookies Left to Buy', createMissDisp(christCook))); + if (valCook.length != 0) stats.appendChild(listing('Valentine Cookies Left to Buy', createMissDisp(valCook))); + if (normEggs.length != 0) stats.appendChild(listing('Normal Easter Eggs Left to Unlock', createMissDisp(normEggs))); + if (rareEggs.length != 0) stats.appendChild(listing('Rare Easter Eggs Left to Unlock', createMissDisp(rareEggs))); } if (Game.season == 'christmas') stats.appendChild(listing('Reindeer Reward', document.createTextNode(Beautify(CM.Cache.SeaSpec)))); @@ -1529,6 +1531,15 @@ CM.Disp.AddMenuStats = function(title) { document.createTextNode(Beautify(CM.Cache.AvgCPS, 3)) )); stats.appendChild(listing('Average Cookie Clicks Per Second (Past ' + CM.Disp.clickTimes[CM.Config.AvgClicksHist] + (CM.Config.AvgClicksHist == 0 ? ' second' : ' seconds') + ')', document.createTextNode(Beautify(CM.Cache.AvgClicks, 1)))); + if (Game.Has('Fortune cookies')) { + var fortunes = []; + for (var i in CM.Data.Fortunes) { + if (!Game.Has(CM.Data.Fortunes[i])) { + fortunes.push(CM.Data.Fortunes[i]); + } + } + if (fortunes.length != 0) stats.appendChild(listing('Fortune Upgrades Left to Buy', createMissDisp(fortunes))); + } stats.appendChild(listing('Missed Golden Cookies', document.createTextNode(Beautify(Game.missedGoldenClicks)))); }