Added 'time left' to ascend tooltip #80

This commit is contained in:
Daniël van Noord
2021-02-20 17:13:50 +01:00
parent fd77e84a90
commit af5a44eb9a
4 changed files with 56 additions and 38 deletions

View File

@@ -48,24 +48,16 @@ CM.Main.Loop = function() {
CM.Cache.DoRemakeBuildPrices = 0;
}
// Update Wrinkler Bank
CM.Cache.CacheWrinklers();
CM.Cache.LoopCache();
// Calculate PP
CM.Cache.CachePP();
// Check all changing minigames and game-states
CM.Main.CheckGoldenCookie();
CM.Main.CheckTickerFortune();
CM.Main.CheckSeasonPopup();
CM.Main.CheckGardenTick();
CM.Main.CheckMagicMeter();
CM.Main.CheckWrinklerCount();
}
// Check all changing minigames and game-states
CM.Main.CheckGoldenCookie();
CM.Main.CheckTickerFortune();
CM.Main.CheckSeasonPopup();
CM.Main.CheckGardenTick();
CM.Main.CheckMagicMeter();
CM.Main.CheckWrinklerCount();
// Cache average CPS
CM.Cache.CacheCurrWrinklerCPS();
CM.Cache.CacheAvgCPS();
};
/**
@@ -202,9 +194,12 @@ CM.Main.ReplaceNative = function() {
if (isNaN(time) || time <= 0) return CM.Backup.sayTime(time, detail);
else return CM.Disp.FormatTime(time / Game.fps, 1);
};
// Since the Ascend Tooltip is not actually a tooltip we need to add our additional info here...
CM.Backup.Logic = Game.Logic;
eval('CM.Backup.LogicMod = ' + Game.Logic.toString().split('document.title').join('CM.Disp.Title'));
eval('CM.Backup.LogicMod = ' + Game.Logic.toString()
.split('document.title').join('CM.Disp.Title')
.split("' more cookies</b> for the next level.<br>';").join("` more cookies</b> for the next level.<br>${CM.Options.TooltipAscendButton ? `<div class='line'></div>You need ${CM.Cache.TimeTillNextPrestige} for the next level.<br>` : ``}`;"));
Game.Logic = function() {
CM.Backup.LogicMod();
// Update Title
@@ -267,7 +262,7 @@ CM.Main.ReplaceNativeGrimoireDraw = function() {
*/
CM.Main.ReplaceTooltips = function() {
CM.Main.ReplaceTooltipBuild();
CM.Main.ReplaceTooltipLump();
CM.Main.ReplaceTooltipLump();
// Replace Tooltips of Minigames. Nesting it in LoadMinigames makes sure to replace them even if
// they were not loaded initially
@@ -300,6 +295,18 @@ CM.Main.ReplaceTooltipBuild = function() {
}
};
/**
* This function replaces the original .onmouseover functions of sugar lumps so that it calls CM.Disp.Tooltip()
* CM.Disp.Tooltip() sets the tooltip type to 's'
* It is called by CM.Main.ReplaceTooltips()
*/
CM.Main.ReplaceTooltipLump = function() {
if (Game.canLumps()) {
CM.Main.TooltipLumpBackup = l('lumps').onmouseover;
eval('l(\'lumps\').onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'s\', \'Lump\');}, \'this\'); Game.tooltip.wobble();}');
}
};
/**
* This function replaces the original .onmouseover functions of the Grimoire minigame so that it calls CM.Disp.Tooltip()
* CM.Disp.Tooltip() sets the tooltip type to 'g'
@@ -317,18 +324,6 @@ CM.Main.ReplaceTooltipGrimoire = function() {
}
};
/**
* This function replaces the original .onmouseover functions of sugar lumps so that it calls CM.Disp.Tooltip()
* CM.Disp.Tooltip() sets the tooltip type to 's'
* It is called by CM.Main.ReplaceTooltips()
*/
CM.Main.ReplaceTooltipLump = function() {
if (Game.canLumps()) {
CM.Main.TooltipLumpBackup = l('lumps').onmouseover;
eval('l(\'lumps\').onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'s\', \'Lump\');}, \'this\'); Game.tooltip.wobble();}');
}
};
/**
* This function replaces the original .onmouseover functions of all garden plants so that it calls CM.Disp.Tooltip()
* CM.Disp.Tooltip() sets the tooltip type to 'p'