Add the 'next multiple of 50' information to buildings' tooltip
This commit is contained in:
committed by
Laurent Georget
parent
f32b1d5685
commit
816c566442
@@ -133,6 +133,14 @@ CM.Cache.RemakePP = function() {
|
|||||||
CM.Cache.RemakeBuildingsOtherPP(100, 'Objects100');
|
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.RemakeLucky = function() {
|
||||||
CM.Cache.Lucky = (CM.Cache.NoGoldSwitchCookiesPS * 60 * 15) / 0.15;
|
CM.Cache.Lucky = (CM.Cache.NoGoldSwitchCookiesPS * 60 * 15) / 0.15;
|
||||||
CM.Cache.Lucky /= CM.Sim.getCPSBuffMult();
|
CM.Cache.Lucky /= CM.Sim.getCPSBuffMult();
|
||||||
|
|||||||
@@ -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.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.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.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.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.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};
|
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};
|
||||||
|
|||||||
13
src/Disp.js
13
src/Disp.js
@@ -1047,6 +1047,7 @@ CM.Disp.AddMenuPref = function(title) {
|
|||||||
frag.appendChild(header('Tooltip'));
|
frag.appendChild(header('Tooltip'));
|
||||||
frag.appendChild(listing('Tooltip'));
|
frag.appendChild(listing('Tooltip'));
|
||||||
frag.appendChild(listing('TooltipAmor'));
|
frag.appendChild(listing('TooltipAmor'));
|
||||||
|
frag.appendChild(listing('TooltipNextMultiple'));
|
||||||
frag.appendChild(listing('ToolWarnCaut'));
|
frag.appendChild(listing('ToolWarnCaut'));
|
||||||
frag.appendChild(listing('ToolWarnCautPos'));
|
frag.appendChild(listing('ToolWarnCautPos'));
|
||||||
frag.appendChild(listing('ToolWrink'));
|
frag.appendChild(listing('ToolWrink'));
|
||||||
@@ -1565,13 +1566,23 @@ CM.Disp.AddTooltipGrimoire = function() {
|
|||||||
CM.Disp.Tooltip = function(type, name) {
|
CM.Disp.Tooltip = function(type, name) {
|
||||||
if (type == 'b') {
|
if (type == 'b') {
|
||||||
l('tooltip').innerHTML = Game.Objects[name].tooltip();
|
l('tooltip').innerHTML = Game.Objects[name].tooltip();
|
||||||
|
var addedAmor = false;
|
||||||
|
|
||||||
if (CM.Config.TooltipAmor == 1) {
|
if (CM.Config.TooltipAmor == 1) {
|
||||||
var buildPrice = CM.Sim.BuildingGetPrice(Game.Objects[name].basePrice, 0, Game.Objects[name].free, Game.Objects[name].amount);
|
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;
|
var amortizeAmount = buildPrice - Game.Objects[name].totalCookies;
|
||||||
if (amortizeAmount > 0) {
|
if (amortizeAmount > 0) {
|
||||||
l('tooltip').innerHTML = l('tooltip').innerHTML.split('so far</div>').join('so far<br/>• <b>' + Beautify(amortizeAmount) + '</b> ' + (Math.floor(amortizeAmount) == 1 ? 'cookie' : 'cookies') + ' left to amortize (' + CM.Disp.GetTimeColor(buildPrice, Game.Objects[name].totalCookies, (Game.Objects[name].storedTotalCps * Game.globalCpsMult)).text + ')</div>');
|
addedAmor = true;
|
||||||
|
l('tooltip').innerHTML = l('tooltip').innerHTML.split('so far</div>').join('so far<br/>• <b>' + Beautify(amortizeAmount) + '</b> ' + (Math.floor(amortizeAmount) == 1 ? 'cookie' : 'cookies') + ' left to amortize (' + CM.Disp.GetTimeColor(buildPrice, Game.Objects[name].totalCookies, (Game.Objects[name].storedTotalCps * Game.globalCpsMult)).text + ')</div>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 + '</div>').join(marker + '<br/>• <b>' + multiple_quantity + '</b> left to reach <b>' + (Game.Objects[name].amount + multiple_quantity) + '</b>, <b>' + Beautify(CM.Cache.Objects[name].multiple_price, 2) + '</b> in total</div>');
|
||||||
|
}
|
||||||
|
|
||||||
if (Game.buyMode == 1) {
|
if (Game.buyMode == 1) {
|
||||||
var target = '';
|
var target = '';
|
||||||
var change = false;
|
var change = false;
|
||||||
|
|||||||
@@ -162,6 +162,10 @@ CM.Loop = function() {
|
|||||||
// Calculate PP
|
// Calculate PP
|
||||||
CM.Cache.RemakePP();
|
CM.Cache.RemakePP();
|
||||||
|
|
||||||
|
// Calculate total price until reaching next multiple of 50
|
||||||
|
// for each building
|
||||||
|
CM.Cache.RemakeMultiple();
|
||||||
|
|
||||||
// Update colors
|
// Update colors
|
||||||
CM.Disp.UpdateBotBarOther();
|
CM.Disp.UpdateBotBarOther();
|
||||||
CM.Disp.UpdateBuildings();
|
CM.Disp.UpdateBuildings();
|
||||||
@@ -247,7 +251,7 @@ CM.DelayInit = function() {
|
|||||||
CM.HasReplaceNativeGrimoireLaunch = false;
|
CM.HasReplaceNativeGrimoireLaunch = false;
|
||||||
CM.HasReplaceNativeGrimoireDraw = 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.ConfigPrefix = 'CMConfig';
|
||||||
|
|
||||||
CM.VersionMajor = '2.0042';
|
CM.VersionMajor = '2.0042';
|
||||||
|
|||||||
Reference in New Issue
Block a user