Added prettier (#661)
* Added prettier * Added prettier * Added prettier
This commit is contained in:
@@ -4,7 +4,11 @@ import { FormatTime } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting'
|
||||
|
||||
import CalculateGrimoireRefillTime from '../../Disp/HelperFunctions/CalculateGrimoireRefillTime';
|
||||
import {
|
||||
BackupGrimoireDraw, BackupGrimoireLaunch, BackupGrimoireLaunchMod, HasReplaceNativeGrimoireDraw, HasReplaceNativeGrimoireLaunch,
|
||||
BackupGrimoireDraw,
|
||||
BackupGrimoireLaunch,
|
||||
BackupGrimoireLaunchMod,
|
||||
HasReplaceNativeGrimoireDraw,
|
||||
HasReplaceNativeGrimoireLaunch,
|
||||
} from '../VariablesAndData';
|
||||
import ReplaceTooltipGrimoire from './TooltipGrimoire';
|
||||
|
||||
@@ -12,42 +16,59 @@ import ReplaceTooltipGrimoire from './TooltipGrimoire';
|
||||
* This function fixes replaces the .draw function of the Grimoire
|
||||
*/
|
||||
function ReplaceNativeGrimoireDraw() {
|
||||
if (!HasReplaceNativeGrimoireDraw && Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
BackupGrimoireDraw = minigame.draw;
|
||||
Game.Objects['Wizard tower'].minigame.draw = function () {
|
||||
BackupGrimoireDraw();
|
||||
if (CMOptions.GrimoireBar === 1 && minigame.magic < minigame.magicM) {
|
||||
minigame.magicBarTextL.innerHTML += ` (${FormatTime(CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM))})`;
|
||||
}
|
||||
};
|
||||
HasReplaceNativeGrimoireDraw = true;
|
||||
}
|
||||
if (
|
||||
!HasReplaceNativeGrimoireDraw &&
|
||||
Game.Objects['Wizard tower'].minigameLoaded
|
||||
) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
BackupGrimoireDraw = minigame.draw;
|
||||
Game.Objects['Wizard tower'].minigame.draw = function () {
|
||||
BackupGrimoireDraw();
|
||||
if (CMOptions.GrimoireBar === 1 && minigame.magic < minigame.magicM) {
|
||||
minigame.magicBarTextL.innerHTML += ` (${FormatTime(
|
||||
CalculateGrimoireRefillTime(
|
||||
minigame.magic,
|
||||
minigame.magicM,
|
||||
minigame.magicM,
|
||||
),
|
||||
)})`;
|
||||
}
|
||||
};
|
||||
HasReplaceNativeGrimoireDraw = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function fixes replaces the .launch function of the Grimoire
|
||||
*/
|
||||
function ReplaceNativeGrimoireLaunch() {
|
||||
if (!HasReplaceNativeGrimoireLaunch && Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
BackupGrimoireLaunch = minigame.launch;
|
||||
BackupGrimoireLaunchMod = new Function(`return ${minigame.launch.toString().split('=this').join('= Game.Objects[\'Wizard tower\'].minigame')}`);
|
||||
Game.Objects['Wizard tower'].minigame.launch = function () {
|
||||
BackupGrimoireLaunchMod();
|
||||
ReplaceTooltipGrimoire();
|
||||
HasReplaceNativeGrimoireDraw = false;
|
||||
ReplaceNativeGrimoireDraw();
|
||||
if (
|
||||
!HasReplaceNativeGrimoireLaunch &&
|
||||
Game.Objects['Wizard tower'].minigameLoaded
|
||||
) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
BackupGrimoireLaunch = minigame.launch;
|
||||
BackupGrimoireLaunchMod = new Function(
|
||||
`return ${minigame.launch
|
||||
.toString()
|
||||
.split('=this')
|
||||
.join("= Game.Objects['Wizard tower'].minigame")}`,
|
||||
);
|
||||
Game.Objects['Wizard tower'].minigame.launch = function () {
|
||||
BackupGrimoireLaunchMod();
|
||||
ReplaceTooltipGrimoire();
|
||||
HasReplaceNativeGrimoireDraw = false;
|
||||
ReplaceNativeGrimoireDraw();
|
||||
|
||||
HasReplaceNativeGrimoireLaunch = true;
|
||||
};
|
||||
}
|
||||
HasReplaceNativeGrimoireLaunch = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function fixes replaces the Launch and Draw functions of the Grimoire
|
||||
*/
|
||||
export default function ReplaceNativeGrimoire() {
|
||||
ReplaceNativeGrimoireLaunch();
|
||||
ReplaceNativeGrimoireDraw();
|
||||
ReplaceNativeGrimoireLaunch();
|
||||
ReplaceNativeGrimoireDraw();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user