diff --git a/src/Cache.js b/src/Cache.js index 39c4ae3..adcf847 100644 --- a/src/Cache.js +++ b/src/Cache.js @@ -133,6 +133,14 @@ CM.Cache.RemakePP = function() { CM.Cache.RemakeBuildingsOtherPP(100, 'Objects100'); } +CM.Cache.RemakeMultiple = function () { + for (var i in CM.Cache.Objects) { + var nextMultiple = 50 - Game.Objects[i].amount % 50; + CM.Cache.Objects[i].multiple_quantity = nextMultiple; + CM.Cache.Objects[i].multiple_price = CM.Sim.BuildingGetPrice(Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, nextMultiple); + } +} + CM.Cache.RemakeLucky = function() { CM.Cache.Lucky = (CM.Cache.NoGoldSwitchCookiesPS * 60 * 15) / 0.15; CM.Cache.Lucky /= CM.Sim.getCPSBuffMult(); diff --git a/src/Config.js b/src/Config.js index cb2940a..0b2dcbf 100644 --- a/src/Config.js +++ b/src/Config.js @@ -139,6 +139,7 @@ CM.ConfigData.Title = {label: ['Title OFF', 'Title ON', 'Title Pinned Tab Highli CM.ConfigData.Favicon = {label: ['Favicon OFF', 'Favicon ON'], desc: 'Update favicon with Golden/Wrath Cookie', toggle: true, func: function() {CM.Disp.UpdateFavicon();}}; CM.ConfigData.Tooltip = {label: ['Tooltip Information OFF', 'Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades/grimoire', toggle: true}; CM.ConfigData.TooltipAmor = {label: ['Tooltip Amortization Information OFF', 'Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip', toggle: true}; +CM.ConfigData.TooltipNextMultiple = {label: ['Tooltip Next Multiple of 50 Information OFF', 'Tooltip Next Multiple of 50 Information ON'], desc: 'Add the total price necessary to reach the next multiple of 50 buildings of a kind to buildings tooltip', toggle: true}; 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', toggle: true, 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', toggle: false, func: function() {CM.Disp.ToggleToolWarnCautPos();}}; 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}; diff --git a/src/Disp.js b/src/Disp.js index a91aab5..d8807ab 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1047,6 +1047,7 @@ CM.Disp.AddMenuPref = function(title) { frag.appendChild(header('Tooltip')); frag.appendChild(listing('Tooltip')); frag.appendChild(listing('TooltipAmor')); + frag.appendChild(listing('TooltipNextMultiple')); frag.appendChild(listing('ToolWarnCaut')); frag.appendChild(listing('ToolWarnCautPos')); frag.appendChild(listing('ToolWrink')); @@ -1565,13 +1566,23 @@ CM.Disp.AddTooltipGrimoire = function() { CM.Disp.Tooltip = function(type, name) { if (type == 'b') { l('tooltip').innerHTML = Game.Objects[name].tooltip(); + var addedAmor = false; + if (CM.Config.TooltipAmor == 1) { var buildPrice = CM.Sim.BuildingGetPrice(Game.Objects[name].basePrice, 0, Game.Objects[name].free, Game.Objects[name].amount); var amortizeAmount = buildPrice - Game.Objects[name].totalCookies; if (amortizeAmount > 0) { - l('tooltip').innerHTML = l('tooltip').innerHTML.split('so far').join('so far
' + Beautify(amortizeAmount) + ' ' + (Math.floor(amortizeAmount) == 1 ? 'cookie' : 'cookies') + ' left to amortize (' + CM.Disp.GetTimeColor(buildPrice, Game.Objects[name].totalCookies, (Game.Objects[name].storedTotalCps * Game.globalCpsMult)).text + ')'); + addedAmor = true; + l('tooltip').innerHTML = l('tooltip').innerHTML.split('so far').join('so far
' + Beautify(amortizeAmount) + ' ' + (Math.floor(amortizeAmount) == 1 ? 'cookie' : 'cookies') + ' left to amortize (' + CM.Disp.GetTimeColor(buildPrice, Game.Objects[name].totalCookies, (Game.Objects[name].storedTotalCps * Game.globalCpsMult)).text + ')'); } } + + if (CM.Config.TooltipNextMultiple == 1) { + var marker = addedAmor ? ')' : 'so far'; + var multiple_quantity = CM.Cache.Objects[name].multiple_quantity; + l('tooltip').innerHTML = l('tooltip').innerHTML.split(marker + '').join(marker + '
' + multiple_quantity + ' left to reach ' + (Game.Objects[name].amount + multiple_quantity) + ', ' + Beautify(CM.Cache.Objects[name].multiple_price, 2) + ' in total'); + } + if (Game.buyMode == 1) { var target = ''; var change = false; diff --git a/src/Main.js b/src/Main.js index 335dd2b..5ab37a0 100644 --- a/src/Main.js +++ b/src/Main.js @@ -162,6 +162,10 @@ CM.Loop = function() { // Calculate PP CM.Cache.RemakePP(); + // Calculate total price until reaching next multiple of 50 + // for each building + CM.Cache.RemakeMultiple(); + // Update colors CM.Disp.UpdateBotBarOther(); CM.Disp.UpdateBuildings(); @@ -247,7 +251,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: 0, AvgClicksHist: 0, ToolWarnCautBon: 0, 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, Favicon: 1, Tooltip: 1, TooltipAmor: 0, ToolWarnCaut: 1, ToolWarnCautPos: 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: 0, AvgClicksHist: 0, ToolWarnCautBon: 0, 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, Favicon: 1, Tooltip: 1, TooltipAmor: 0, TooltipNextMultiple: 0, ToolWarnCaut: 1, ToolWarnCautPos: 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.ConfigPrefix = 'CMConfig'; CM.VersionMajor = '2.0042';