Complete overhaul of code structure and relevant files (#639)

This commit is contained in:
Daniël van Noord
2021-03-14 00:41:14 +01:00
committed by GitHub
parent bb34bce9a5
commit 1bffb58782
163 changed files with 7369 additions and 10882 deletions

View File

@@ -0,0 +1,26 @@
import { CreateTooltip } from '../../Disp/Tooltips/Tooltip';
import { TooltipUpgradeBackup } from '../VariablesAndData';
/**
* This function replaces the original .onmouseover functions of upgrades so that it calls CM.Disp.Tooltip()
* CM.Disp.Tooltip() sets the tooltip type to 'u'
* It is called by Game.RebuildUpgrades() through CM.Main.ReplaceNative() and is therefore not permanent like the other ReplaceTooltip functions
*/
export default function ReplaceTooltipUpgrade() {
TooltipUpgradeBackup = [];
for (const i of Object.keys(Game.UpgradesInStore)) {
if (l(`upgrade${i}`).onmouseover !== null) {
TooltipUpgradeBackup[i] = l(`upgrade${i}`).onmouseover;
l(`upgrade${i}`).onmouseover = function () {
if (!Game.mouseDown) {
Game.setOnCrate(this);
Game.tooltip.dynamic = 1;
Game.tooltip.draw(this, function () {
return CreateTooltip('u', `${i}`);
}, 'store');
Game.tooltip.wobble();
}
};
}
}
}