From 51617c97772b861993cff74170e4a377a4555a4e Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Sun, 20 Dec 2020 11:50:48 +0100 Subject: [PATCH 1/3] Added ToolWarnEdifice option --- CookieMonster.js | 2 ++ src/Data.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CookieMonster.js b/CookieMonster.js index 42d30ea..f3e281c 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -942,6 +942,7 @@ CM.ConfigData.TooltipAmor = {type: 'bool', group: 'Tooltip', label: ['Buildings CM.ConfigData.ToolWarnLucky = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards', toggle: true}; CM.ConfigData.ToolWarnLuckyFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Frenzy Warning OFF', 'Tooltip Lucky Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards', toggle: true}; CM.ConfigData.ToolWarnConjure = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true}; +CM.ConfigData.ToolWarnEdifice = {type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to give you your most expensive building', toggle: true}; CM.ConfigData.ToolWarnPos = {type: 'bool', group: 'Tooltip', label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnPos();}}; CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true}; CM.ConfigData.ToolWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true}; @@ -1022,6 +1023,7 @@ CM.Data.ConfigDefault = { ToolWarnLucky: 1, ToolWarnLuckyFrenzy: 1, ToolWarnConjure: 1, + ToolWarnEdifice: 1, ToolWarnPos: 1, TooltipGrim:1, ToolWrink: 1, diff --git a/src/Data.js b/src/Data.js index e96b951..8d3290d 100644 --- a/src/Data.js +++ b/src/Data.js @@ -175,6 +175,7 @@ CM.ConfigData.TooltipAmor = {type: 'bool', group: 'Tooltip', label: ['Buildings CM.ConfigData.ToolWarnLucky = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards', toggle: true}; CM.ConfigData.ToolWarnLuckyFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Frenzy Warning OFF', 'Tooltip Lucky Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards', toggle: true}; CM.ConfigData.ToolWarnConjure = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true}; +CM.ConfigData.ToolWarnEdifice = {type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to give you your most expensive building', toggle: true}; CM.ConfigData.ToolWarnPos = {type: 'bool', group: 'Tooltip', label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnPos();}}; CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true}; CM.ConfigData.ToolWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true}; @@ -255,6 +256,7 @@ CM.Data.ConfigDefault = { ToolWarnLucky: 1, ToolWarnLuckyFrenzy: 1, ToolWarnConjure: 1, + ToolWarnEdifice: 1, ToolWarnPos: 1, TooltipGrim:1, ToolWrink: 1, From a05c9290de6e2192f156e51c4d50c91f0b3b5ff4 Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Sun, 20 Dec 2020 12:15:50 +0100 Subject: [PATCH 2/3] Created warning for ToolWarnEdifice --- CookieMonster.js | 38 ++++++++++++++++++++++++++++++-------- src/Data.js | 5 +++-- src/Disp.js | 32 ++++++++++++++++++++++++++------ 3 files changed, 59 insertions(+), 16 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index f3e281c..fe706cc 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -942,7 +942,7 @@ CM.ConfigData.TooltipAmor = {type: 'bool', group: 'Tooltip', label: ['Buildings CM.ConfigData.ToolWarnLucky = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards', toggle: true}; CM.ConfigData.ToolWarnLuckyFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Frenzy Warning OFF', 'Tooltip Lucky Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards', toggle: true}; CM.ConfigData.ToolWarnConjure = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true}; -CM.ConfigData.ToolWarnEdifice = {type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to give you your most expensive building', toggle: true}; +CM.ConfigData.ToolWarnEdifice = {type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building', toggle: true}; CM.ConfigData.ToolWarnPos = {type: 'bool', group: 'Tooltip', label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnPos();}}; CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true}; CM.ConfigData.ToolWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true}; @@ -1043,7 +1043,9 @@ CM.Data.ConfigDefault = { SortBuildings: 0, SortUpgrades: 0, Header: {BarsColors: 1, Calculation: 1, Notification: 1, Tooltip: 1, Statistics: 1, Notation: 1, Lucky: 1, Conjure: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, -};/******** +}; + +/******** * Disp * ********/ @@ -2449,7 +2451,9 @@ CM.Disp.TooltipCreateWarningSection = function() { CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnLuckyFrenzy', CM.Disp.colorYellow, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Lucky!" (Frenzy)', 'CMDispTooltipWarnLuckyFrenzyText')); CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px'; CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnConjure', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"', 'CMDispTooltipWarnConjureText')); - + CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px'; + CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnEdifice', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"', 'CMDispTooltipWarnEdificeText')); + return CM.Disp.TooltipWarn; } @@ -2711,13 +2715,31 @@ CM.Disp.UpdateTooltipWarnings = function() { if ((amount < limitConjure) && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) { l('CMDispTooltipWarnConjure').style.display = ''; l('CMDispTooltipWarnConjureText').textContent = Beautify(limitConjure - amount) + ' (' + CM.Disp.FormatTime((limitConjure - amount) / CM.Disp.GetCPS()) + ')'; - } else { - l('CMDispTooltipWarnConjure').style.display = 'none'; + } else l('CMDispTooltipWarnConjure').style.display = 'none'; + } + else l('CMDispTooltipWarnConjure').style.display = 'none'; + + if (CM.Options.ToolWarnEdifice == 1) { + var limitEdifice = 0; + var max = 0; + var n = 0; + for (var i in Game.Objects) { + if (Game.Objects[i].amount > max) max = Game.Objects[i].amount; + if (Game.Objects[i].amount > 0) n++; } + for (var i in Game.Objects) { + if ((Game.Objects[i].amount < max || n == 1) && + Game.Objects[i].amount < 400 && + Game.Objects[i].price * 2 > limitEdifice) { + limitEdifice = Game.Objects[i].price * 2; + } + } + if (limitEdifice && amount < limitEdifice && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) { + l('CMDispTooltipWarnEdifice').style.display = ''; + l('CMDispTooltipWarnEdificeText').textContent = Beautify(limitEdifice - amount) + ' (' + CM.Disp.FormatTime((limitEdifice - amount) / CM.Disp.GetCPS()) + ')'; + } else l('CMDispTooltipWarnEdifice').style.display = 'none'; } - else { - l('CMDispTooltipWarnConjure').style.display = 'none'; - } + else l('CMDispTooltipWarnEdifice').style.display = 'none'; } else { if (l('CMDispTooltipWarningParent') != null) { diff --git a/src/Data.js b/src/Data.js index 8d3290d..5bb518e 100644 --- a/src/Data.js +++ b/src/Data.js @@ -175,7 +175,7 @@ CM.ConfigData.TooltipAmor = {type: 'bool', group: 'Tooltip', label: ['Buildings CM.ConfigData.ToolWarnLucky = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards', toggle: true}; CM.ConfigData.ToolWarnLuckyFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Frenzy Warning OFF', 'Tooltip Lucky Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards', toggle: true}; CM.ConfigData.ToolWarnConjure = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true}; -CM.ConfigData.ToolWarnEdifice = {type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to give you your most expensive building', toggle: true}; +CM.ConfigData.ToolWarnEdifice = {type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building', toggle: true}; CM.ConfigData.ToolWarnPos = {type: 'bool', group: 'Tooltip', label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnPos();}}; CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true}; CM.ConfigData.ToolWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true}; @@ -276,4 +276,5 @@ CM.Data.ConfigDefault = { SortBuildings: 0, SortUpgrades: 0, Header: {BarsColors: 1, Calculation: 1, Notification: 1, Tooltip: 1, Statistics: 1, Notation: 1, Lucky: 1, Conjure: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1}, -}; \ No newline at end of file +}; + diff --git a/src/Disp.js b/src/Disp.js index 261b707..8141621 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1404,7 +1404,9 @@ CM.Disp.TooltipCreateWarningSection = function() { CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnLuckyFrenzy', CM.Disp.colorYellow, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Lucky!" (Frenzy)', 'CMDispTooltipWarnLuckyFrenzyText')); CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px'; CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnConjure', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"', 'CMDispTooltipWarnConjureText')); - + CM.Disp.TooltipWarn.lastChild.style.marginBottom = '4px'; + CM.Disp.TooltipWarn.appendChild(create('CMDispTooltipWarnEdifice', CM.Disp.colorPurple, 'Warning: ', 'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"', 'CMDispTooltipWarnEdificeText')); + return CM.Disp.TooltipWarn; } @@ -1666,13 +1668,31 @@ CM.Disp.UpdateTooltipWarnings = function() { if ((amount < limitConjure) && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) { l('CMDispTooltipWarnConjure').style.display = ''; l('CMDispTooltipWarnConjureText').textContent = Beautify(limitConjure - amount) + ' (' + CM.Disp.FormatTime((limitConjure - amount) / CM.Disp.GetCPS()) + ')'; - } else { - l('CMDispTooltipWarnConjure').style.display = 'none'; + } else l('CMDispTooltipWarnConjure').style.display = 'none'; + } + else l('CMDispTooltipWarnConjure').style.display = 'none'; + + if (CM.Options.ToolWarnEdifice == 1) { + var limitEdifice = 0; + var max = 0; + var n = 0; + for (var i in Game.Objects) { + if (Game.Objects[i].amount > max) max = Game.Objects[i].amount; + if (Game.Objects[i].amount > 0) n++; } + for (var i in Game.Objects) { + if ((Game.Objects[i].amount < max || n == 1) && + Game.Objects[i].amount < 400 && + Game.Objects[i].price * 2 > limitEdifice) { + limitEdifice = Game.Objects[i].price * 2; + } + } + if (limitEdifice && amount < limitEdifice && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) { + l('CMDispTooltipWarnEdifice').style.display = ''; + l('CMDispTooltipWarnEdificeText').textContent = Beautify(limitEdifice - amount) + ' (' + CM.Disp.FormatTime((limitEdifice - amount) / CM.Disp.GetCPS()) + ')'; + } else l('CMDispTooltipWarnEdifice').style.display = 'none'; } - else { - l('CMDispTooltipWarnConjure').style.display = 'none'; - } + else l('CMDispTooltipWarnEdifice').style.display = 'none'; } else { if (l('CMDispTooltipWarningParent') != null) { From 1715306374e34152ab0530146da570dbe8f8b90b Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Sun, 20 Dec 2020 12:27:43 +0100 Subject: [PATCH 3/3] Removed tooltip box from Sell tooltip --- CookieMonster.js | 8 +++++--- src/Disp.js | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index fe706cc..b9f99be 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -2317,9 +2317,11 @@ CM.Disp.Tooltip = function(type, name) { else if (type === 'g') l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); // Grimoire // Adds area for extra tooltip-sections - var area = document.createElement('div'); - area.id = 'CMTooltipArea'; - l('tooltip').appendChild(area); + if ((type == 'b' && Game.buyMode == 1) || type == 'u' || type == 's' || type == 'g') { + var area = document.createElement('div'); + area.id = 'CMTooltipArea'; + l('tooltip').appendChild(area); + } // Sets global variables used by CM.Disp.UpdateTooltip() CM.Disp.tooltipType = type; diff --git a/src/Disp.js b/src/Disp.js index 8141621..4993eec 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1270,9 +1270,11 @@ CM.Disp.Tooltip = function(type, name) { else if (type === 'g') l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); // Grimoire // Adds area for extra tooltip-sections - var area = document.createElement('div'); - area.id = 'CMTooltipArea'; - l('tooltip').appendChild(area); + if ((type == 'b' && Game.buyMode == 1) || type == 'u' || type == 's' || type == 'g') { + var area = document.createElement('div'); + area.id = 'CMTooltipArea'; + l('tooltip').appendChild(area); + } // Sets global variables used by CM.Disp.UpdateTooltip() CM.Disp.tooltipType = type;