From 5abdc77e300e0f6e3403ee45bf39d137467d689a Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Wed, 27 Jan 2021 21:43:24 +0100 Subject: [PATCH 1/2] Added data on possible effects --- CookieMonster.js | 34 +++++++++++++++++++++++++++++++--- src/Data.js | 27 +++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 3048252..d5faf20 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -919,6 +919,33 @@ CM.Data.ChristCookies = ['Christmas tree biscuits', 'Snowflake biscuits', 'Snowm CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits', 'Prism heart biscuits']; CM.Data.PlantDrops = ['Elderwort biscuits', 'Bakeberry cookies', 'Duketater cookies', 'Green yeast digestives', 'Wheat slims', 'Fern tea', 'Ichor syrup'] +/******** + * Section: All possible effects plants and other items can have with an explanation */ + +CM.Data.Effects = { + buildingCost: "Building prices", + click: "Cookies per click", + cps: "Total CPS", + cursorCps: "Cursor CPS", + goldenCookieDur: "Golden cookie duration", + goldenCookieEffDur: "Golden cookie effect duration", + goldenCookieFreq: "Golden cookie frequency", + goldenCookieGain: "Golden cookie gains", + grandmaCps: "Grandma CPS", + itemDrops: "Random item drop chance", + milk: "Effect from milk", + reindeerDur: "Reindeer duration", + reindeerFreq: "Reindeer frequency", + reindeerGain: "Reindeer gains", + upgradeCost: "Upgrade prices", + wrathCookieDur: "Wrath cookie duration", + wrathCookieEffDur: "Wrath cookie effect duration", + wrathCookieFreq: "Wrath cookie frequency", + wrathCookieGain: "Wrath cookie gains", + wrinklerEat: "Wrinkler ", + wrinklerSpawn: "Wrinkler spawn frequency" +} + /******** * Section: Data for the various scales used by CookieMonster */ @@ -4310,9 +4337,10 @@ CM.DelayInit = function() { */ CM.Main.ReplaceTooltips = function() { CM.Main.ReplaceTooltipBuild(); - CM.Main.ReplaceTooltipLump(); - CM.Main.ReplaceTooltipGrimoire(); - + CM.Main.ReplaceTooltipLump(); + + // Replace Tooltips of Minigames. Nesting it in LoadMinigames makes sure to replace them even if + // they were not loaded initially CM.Backup.LoadMinigames = Game.LoadMinigames; Game.LoadMinigames = function() { CM.Backup.LoadMinigames(); diff --git a/src/Data.js b/src/Data.js index e481133..050f82b 100644 --- a/src/Data.js +++ b/src/Data.js @@ -35,6 +35,33 @@ CM.Data.ChristCookies = ['Christmas tree biscuits', 'Snowflake biscuits', 'Snowm CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits', 'Prism heart biscuits']; CM.Data.PlantDrops = ['Elderwort biscuits', 'Bakeberry cookies', 'Duketater cookies', 'Green yeast digestives', 'Wheat slims', 'Fern tea', 'Ichor syrup'] +/******** + * Section: All possible effects plants and other items can have with an explanation */ + +CM.Data.Effects = { + buildingCost: "Building prices", + click: "Cookies per click", + cps: "Total CPS", + cursorCps: "Cursor CPS", + goldenCookieDur: "Golden cookie duration", + goldenCookieEffDur: "Golden cookie effect duration", + goldenCookieFreq: "Golden cookie frequency", + goldenCookieGain: "Golden cookie gains", + grandmaCps: "Grandma CPS", + itemDrops: "Random item drop chance", + milk: "Effect from milk", + reindeerDur: "Reindeer duration", + reindeerFreq: "Reindeer frequency", + reindeerGain: "Reindeer gains", + upgradeCost: "Upgrade prices", + wrathCookieDur: "Wrath cookie duration", + wrathCookieEffDur: "Wrath cookie effect duration", + wrathCookieFreq: "Wrath cookie frequency", + wrathCookieGain: "Wrath cookie gains", + wrinklerEat: "Wrinkler ", + wrinklerSpawn: "Wrinkler spawn frequency" +} + /******** * Section: Data for the various scales used by CookieMonster */ From 6c852e2c50d992882ac70c4d0e6e10fae4dfbacc Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Wed, 27 Jan 2021 22:12:37 +0100 Subject: [PATCH 2/2] Tooltip for harvest all button #227 --- CookieMonster.js | 48 +++++++++++++++++++++++++++++++++++++++++++++++- src/Disp.js | 47 ++++++++++++++++++++++++++++++++++++++++++++++- src/Main.js | 1 + 3 files changed, 94 insertions(+), 2 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index d5faf20..cfece1b 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -2446,9 +2446,10 @@ CM.Disp.Tooltip = function(type, name) { else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip(); // Sugar Lumps else if (type === 'g') l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); // Grimoire else if (type == 'p') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])(); // Garden plots + else if (type == 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)(); // Harvest all button in garden // Adds area for extra tooltip-sections - if ((type == 'b' && Game.buyMode == 1) || type == 'u' || type == 's' || type == 'g' || type == 'p') { + if ((type == 'b' && Game.buyMode == 1) || type == 'u' || type == 's' || type == 'g' || type == 'p' || type == 'ha') { var area = document.createElement('div'); area.id = 'CMTooltipArea'; l('tooltip').appendChild(area); @@ -2613,6 +2614,9 @@ CM.Disp.UpdateTooltip = function() { else if (CM.Disp.tooltipType === 'p') { CM.Disp.UpdateTooltipGardenPlots(); } + else if (CM.Disp.tooltipType === 'ha') { + CM.Disp.UpdateTooltipHarvestAll(); + } CM.Disp.UpdateTooltipWarnings(); } else if (l('CMTooltipArea') == null) { // Remove warnings if its a basic tooltip @@ -2844,6 +2848,47 @@ CM.Disp.UpdateTooltipGardenPlots = function() { else l('CMTooltipArea').style.display = "none"; } +/** + * This function adds extra info to the Garden Harvest All tooltip + * It is called when the Harvest All tooltip is created or refreshed by CM.Disp.UpdateTooltip() + * It adds to the additional information to l('CMTooltipArea') + */ +CM.Disp.UpdateTooltipHarvestAll = function() { + var minigame = Game.Objects['Farm'].minigame; + if (CM.Options.TooltipLump) { + l('CMTooltipBorder').appendChild(CM.Disp.TooltipCreateHeader('Cookies gained from harvesting:')); + var totalGain = 0; + if (Game.keys[16] && Game.keys[17]) var mortal = 1; + for (var y=0;y<6;y++) { + for (var x=0;x<6;x++) { + if (minigame.plot[y][x][0]>=1) { + let tile = minigame.plot[y][x]; + let me = minigame.plantsById[tile[0] - 1]; + let plantName = me.name + + let count = true; + if (mortal && me.immortal) count = false; + if (tile[1] < me.matureBase) count = false; + if (count && plantName == "Bakeberry") { + totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30); + } + else if (count && plantName == "Chocoroot" || plantName == "White chocoroot") { + totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3); + } + else if (count && plantName == "Queenbeet") { + totalGain += Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60); + } + else if (count && plantName == "Duketater") { + totalGain += Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120); + } + } + } + } + l('CMTooltipBorder').appendChild(document.createTextNode(CM.Disp.Beautify(totalGain))); + } + else l('CMTooltipArea').style.display = "none"; +} + /** * This function updates the warnings section of the building and upgrade tooltips * It is called by CM.Disp.UpdateTooltip() @@ -4407,6 +4452,7 @@ CM.Main.ReplaceTooltipLump = function() { */ CM.Main.ReplaceTooltipGarden = function() { if (Game.Objects['Farm'].minigameLoaded) { + l('gardenTool-1').onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('ha', 'HarvestAllButton');}, 'this'); Game.tooltip.wobble();} Array.from(l('gardenPlot').children).forEach((child, index) => { var coords = child.id.slice(-3,); child.onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('p', [`${coords[0]}`,`${coords[2]}`]);}, 'this'); Game.tooltip.wobble();}; diff --git a/src/Disp.js b/src/Disp.js index 019439a..2e10ea6 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1234,9 +1234,10 @@ CM.Disp.Tooltip = function(type, name) { else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip(); // Sugar Lumps else if (type === 'g') l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); // Grimoire else if (type == 'p') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])(); // Garden plots + else if (type == 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)(); // Harvest all button in garden // Adds area for extra tooltip-sections - if ((type == 'b' && Game.buyMode == 1) || type == 'u' || type == 's' || type == 'g' || type == 'p') { + if ((type == 'b' && Game.buyMode == 1) || type == 'u' || type == 's' || type == 'g' || type == 'p' || type == 'ha') { var area = document.createElement('div'); area.id = 'CMTooltipArea'; l('tooltip').appendChild(area); @@ -1401,6 +1402,9 @@ CM.Disp.UpdateTooltip = function() { else if (CM.Disp.tooltipType === 'p') { CM.Disp.UpdateTooltipGardenPlots(); } + else if (CM.Disp.tooltipType === 'ha') { + CM.Disp.UpdateTooltipHarvestAll(); + } CM.Disp.UpdateTooltipWarnings(); } else if (l('CMTooltipArea') == null) { // Remove warnings if its a basic tooltip @@ -1632,6 +1636,47 @@ CM.Disp.UpdateTooltipGardenPlots = function() { else l('CMTooltipArea').style.display = "none"; } +/** + * This function adds extra info to the Garden Harvest All tooltip + * It is called when the Harvest All tooltip is created or refreshed by CM.Disp.UpdateTooltip() + * It adds to the additional information to l('CMTooltipArea') + */ +CM.Disp.UpdateTooltipHarvestAll = function() { + var minigame = Game.Objects['Farm'].minigame; + if (CM.Options.TooltipLump) { + l('CMTooltipBorder').appendChild(CM.Disp.TooltipCreateHeader('Cookies gained from harvesting:')); + var totalGain = 0; + if (Game.keys[16] && Game.keys[17]) var mortal = 1; + for (var y=0;y<6;y++) { + for (var x=0;x<6;x++) { + if (minigame.plot[y][x][0]>=1) { + let tile = minigame.plot[y][x]; + let me = minigame.plantsById[tile[0] - 1]; + let plantName = me.name + + let count = true; + if (mortal && me.immortal) count = false; + if (tile[1] < me.matureBase) count = false; + if (count && plantName == "Bakeberry") { + totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30); + } + else if (count && plantName == "Chocoroot" || plantName == "White chocoroot") { + totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3); + } + else if (count && plantName == "Queenbeet") { + totalGain += Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60); + } + else if (count && plantName == "Duketater") { + totalGain += Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120); + } + } + } + } + l('CMTooltipBorder').appendChild(document.createTextNode(CM.Disp.Beautify(totalGain))); + } + else l('CMTooltipArea').style.display = "none"; +} + /** * This function updates the warnings section of the building and upgrade tooltips * It is called by CM.Disp.UpdateTooltip() diff --git a/src/Main.js b/src/Main.js index 06265b7..87b3c48 100644 --- a/src/Main.js +++ b/src/Main.js @@ -330,6 +330,7 @@ CM.Main.ReplaceTooltipLump = function() { */ CM.Main.ReplaceTooltipGarden = function() { if (Game.Objects['Farm'].minigameLoaded) { + l('gardenTool-1').onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('ha', 'HarvestAllButton');}, 'this'); Game.tooltip.wobble();} Array.from(l('gardenPlot').children).forEach((child, index) => { var coords = child.id.slice(-3,); child.onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('p', [`${coords[0]}`,`${coords[2]}`]);}, 'this'); Game.tooltip.wobble();};