Changes according to Eslint

This commit is contained in:
Daniël van Noord
2021-03-16 09:32:50 +01:00
parent 26d8e75935
commit a65af049b6
63 changed files with 314 additions and 295 deletions

View File

@@ -20,7 +20,7 @@ function ReplaceNativeGrimoireDraw() {
!HasReplaceNativeGrimoireDraw &&
Game.Objects['Wizard tower'].minigameLoaded
) {
const minigame = Game.Objects['Wizard tower'].minigame;
const { minigame } = Game.Objects['Wizard tower'];
BackupGrimoireDraw = minigame.draw;
Game.Objects['Wizard tower'].minigame.draw = function () {
BackupGrimoireDraw();
@@ -46,7 +46,7 @@ function ReplaceNativeGrimoireLaunch() {
!HasReplaceNativeGrimoireLaunch &&
Game.Objects['Wizard tower'].minigameLoaded
) {
const minigame = Game.Objects['Wizard tower'].minigame;
const { minigame } = Game.Objects['Wizard tower'];
BackupGrimoireLaunch = minigame.launch;
BackupGrimoireLaunchMod = new Function(
`return ${minigame.launch

View File

@@ -6,21 +6,23 @@ import { TooltipGrimoireBackup } from '../VariablesAndData';
*/
export default function ReplaceTooltipGrimoire() {
if (Game.Objects['Wizard tower'].minigameLoaded) {
for (const i in Game.Objects['Wizard tower'].minigame.spellsById) {
if (l(`grimoireSpell${i}`).onmouseover !== null) {
TooltipGrimoireBackup[i] = l(`grimoireSpell${i}`).onmouseover;
l(`grimoireSpell${i}`).onmouseover = function () {
Game.tooltip.dynamic = 1;
Game.tooltip.draw(
this,
function () {
return CreateTooltip('g', `${i}`);
},
'this',
);
Game.tooltip.wobble();
};
}
}
Object.keys(Game.Objects['Wizard tower'].minigame.spellsById).forEach(
(i) => {
if (l(`grimoireSpell${i}`).onmouseover !== null) {
TooltipGrimoireBackup[i] = l(`grimoireSpell${i}`).onmouseover;
l(`grimoireSpell${i}`).onmouseover = function () {
Game.tooltip.dynamic = 1;
Game.tooltip.draw(
this,
function () {
return CreateTooltip('g', `${i}`);
},
'this',
);
Game.tooltip.wobble();
};
}
},
);
}
}

View File

@@ -8,7 +8,7 @@ import { TooltipUpgradeBackup } from '../VariablesAndData';
*/
export default function ReplaceTooltipUpgrade() {
TooltipUpgradeBackup = [];
for (const i of Object.keys(Game.UpgradesInStore)) {
Object.keys(Game.UpgradesInStore).forEach((i) => {
if (l(`upgrade${i}`).onmouseover !== null) {
TooltipUpgradeBackup[i] = l(`upgrade${i}`).onmouseover;
l(`upgrade${i}`).onmouseover = function () {
@@ -26,5 +26,5 @@ export default function ReplaceTooltipUpgrade() {
}
};
}
}
});
}

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
/* eslint-disable no-unused-vars */
/** Functions related to replacing tooltips */
@@ -14,7 +15,7 @@ import ReplaceTooltipGrimoire from './TooltipGrimoire';
* This function replaces the original .onmouseover functions of buildings
*/
function ReplaceTooltipBuild() {
for (const i of Object.keys(Game.Objects)) {
Object.keys(Game.Objects).forEach((i) => {
const me = Game.Objects[i];
if (l(`product${me.id}`).onmouseover !== null) {
TooltipBuildBackup[i] = l(`product${me.id}`).onmouseover;
@@ -30,7 +31,7 @@ function ReplaceTooltipBuild() {
Game.tooltip.wobble();
};
}
}
});
}
/**
@@ -129,6 +130,7 @@ export default function ReplaceTooltips() {
// Replace Tooltips of Minigames. Nesting it in LoadMinigames makes sure to replace them even if
// they were not loaded initially
// eslint-disable-next-line prefer-destructuring
LoadMinigames = Game.LoadMinigames;
Game.LoadMinigames = function () {
LoadMinigames();