Added prettier to master (#662)

* Bump dev to 2.031.6

* Added prettier (#661)

* Added prettier

* Added prettier

* Added prettier
This commit is contained in:
Daniël van Noord
2021-03-14 19:08:36 +01:00
committed by GitHub
parent 5dda8cac55
commit 3e07541fd5
131 changed files with 7141 additions and 4892 deletions

View File

@@ -7,11 +7,14 @@ import { LastGardenNextStep } from '../VariablesAndData';
* This function checks if a garden tick has happened
*/
export default function CheckGardenTick() {
if (Game.Objects.Farm.minigameLoaded && LastGardenNextStep !== Game.Objects.Farm.minigame.nextStep) {
if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) {
Flash(3, 'GardFlash');
PlaySound(CMOptions.GardSoundURL, 'GardSound', 'GardVolume');
}
LastGardenNextStep = Game.Objects.Farm.minigame.nextStep;
}
if (
Game.Objects.Farm.minigameLoaded &&
LastGardenNextStep !== Game.Objects.Farm.minigame.nextStep
) {
if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) {
Flash(3, 'GardFlash');
PlaySound(CMOptions.GardSoundURL, 'GardSound', 'GardVolume');
}
LastGardenNextStep = Game.Objects.Farm.minigame.nextStep;
}
}

View File

@@ -1,5 +1,8 @@
/* eslint-disable no-unused-vars */
import { CacheSpawnedGoldenShimmer, CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
import {
CacheSpawnedGoldenShimmer,
CacheGoldenShimmersByID,
} from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import CreateGCTimer from '../../Disp/GoldenCookieTimers/GoldenCookieTimers';
import Flash from '../../Disp/Notifications/Flash';
@@ -7,7 +10,11 @@ import Notification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound';
import { UpdateFavicon } from '../../Disp/TabTitle/FavIcon';
import { GCTimers } from '../../Disp/VariablesAndData';
import { CurrSpawnedGoldenCookieState, LastGoldenCookieState, LastSpawnedGoldenCookieState } from '../VariablesAndData';
import {
CurrSpawnedGoldenCookieState,
LastGoldenCookieState,
LastSpawnedGoldenCookieState,
} from '../VariablesAndData';
/**
* Auxilirary function that finds all currently spawned shimmers.
@@ -15,15 +22,15 @@ import { CurrSpawnedGoldenCookieState, LastGoldenCookieState, LastSpawnedGoldenC
* It is called by CM.CM.Main.CheckGoldenCookie
*/
function FindShimmer() {
CurrSpawnedGoldenCookieState = 0;
CacheGoldenShimmersByID = {};
for (const i of Object.keys(Game.shimmers)) {
CacheGoldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i];
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'golden') {
CacheSpawnedGoldenShimmer = Game.shimmers[i];
CurrSpawnedGoldenCookieState += 1;
}
}
CurrSpawnedGoldenCookieState = 0;
CacheGoldenShimmersByID = {};
for (const i of Object.keys(Game.shimmers)) {
CacheGoldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i];
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'golden') {
CacheSpawnedGoldenShimmer = Game.shimmers[i];
CurrSpawnedGoldenCookieState += 1;
}
}
}
/**
@@ -31,36 +38,43 @@ function FindShimmer() {
* It is called by CM.Main.Loop
*/
export default function CheckGoldenCookie() {
FindShimmer();
for (const i of Object.keys(GCTimers)) {
if (typeof CacheGoldenShimmersByID[i] === 'undefined') {
GCTimers[i].parentNode.removeChild(GCTimers[i]);
delete GCTimers[i];
}
}
if (LastGoldenCookieState !== Game.shimmerTypes.golden.n) {
LastGoldenCookieState = Game.shimmerTypes.golden.n;
if (LastGoldenCookieState) {
if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) {
Flash(3, 'GCFlash');
PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume');
Notification('GCNotification', 'Golden Cookie Spawned', 'A Golden Cookie has spawned. Click it now!');
}
FindShimmer();
for (const i of Object.keys(GCTimers)) {
if (typeof CacheGoldenShimmersByID[i] === 'undefined') {
GCTimers[i].parentNode.removeChild(GCTimers[i]);
delete GCTimers[i];
}
}
if (LastGoldenCookieState !== Game.shimmerTypes.golden.n) {
LastGoldenCookieState = Game.shimmerTypes.golden.n;
if (LastGoldenCookieState) {
if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) {
Flash(3, 'GCFlash');
PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume');
Notification(
'GCNotification',
'Golden Cookie Spawned',
'A Golden Cookie has spawned. Click it now!',
);
}
for (const i of Object.keys(Game.shimmers)) {
if (typeof GCTimers[Game.shimmers[i].id] === 'undefined') {
CreateGCTimer(Game.shimmers[i]);
}
}
}
UpdateFavicon();
LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState;
if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0;
} else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) {
for (const i of Object.keys(GCTimers)) {
GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity;
GCTimers[i].style.transform = CacheGoldenShimmersByID[i].l.style.transform;
GCTimers[i].textContent = Math.ceil(CacheGoldenShimmersByID[i].life / Game.fps);
}
}
for (const i of Object.keys(Game.shimmers)) {
if (typeof GCTimers[Game.shimmers[i].id] === 'undefined') {
CreateGCTimer(Game.shimmers[i]);
}
}
}
UpdateFavicon();
LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState;
if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0;
} else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) {
for (const i of Object.keys(GCTimers)) {
GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity;
GCTimers[i].style.transform =
CacheGoldenShimmersByID[i].l.style.transform;
GCTimers[i].textContent = Math.ceil(
CacheGoldenShimmersByID[i].life / Game.fps,
);
}
}
}

View File

@@ -9,14 +9,21 @@ import { LastMagicBarFull } from '../VariablesAndData';
* It is called by CM.Main.Loop
*/
export default function CheckMagicMeter() {
if (Game.Objects['Wizard tower'].minigameLoaded && CMOptions.GrimoireBar === 1) {
const minigame = Game.Objects['Wizard tower'].minigame;
if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
else if (!LastMagicBarFull) {
LastMagicBarFull = true;
Flash(3, 'MagicFlash');
PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume');
Notification('MagicNotification', 'Magic Meter full', 'Your Magic Meter is full. Cast a spell!');
}
}
if (
Game.Objects['Wizard tower'].minigameLoaded &&
CMOptions.GrimoireBar === 1
) {
const minigame = Game.Objects['Wizard tower'].minigame;
if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
else if (!LastMagicBarFull) {
LastMagicBarFull = true;
Flash(3, 'MagicFlash');
PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume');
Notification(
'MagicNotification',
'Magic Meter full',
'Your Magic Meter is full. Cast a spell!',
);
}
}
}

View File

@@ -11,16 +11,20 @@ import { LastSeasonPopupState } from '../VariablesAndData';
* It is called by CM.Main.Loop
*/
export default function CheckSeasonPopup() {
if (LastSeasonPopupState !== Game.shimmerTypes.reindeer.spawned) {
LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
for (const i of Object.keys(Game.shimmers)) {
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') {
CacheSeasonPopShimmer = Game.shimmers[i];
break;
}
}
Flash(3, 'SeaFlash');
PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume');
Notification('SeaNotification', 'Reindeer sighted!', 'A Reindeer has spawned. Click it now!');
}
if (LastSeasonPopupState !== Game.shimmerTypes.reindeer.spawned) {
LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
for (const i of Object.keys(Game.shimmers)) {
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') {
CacheSeasonPopShimmer = Game.shimmers[i];
break;
}
}
Flash(3, 'SeaFlash');
PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume');
Notification(
'SeaNotification',
'Reindeer sighted!',
'A Reindeer has spawned. Click it now!',
);
}
}

View File

@@ -8,12 +8,20 @@ import { LastTickerFortuneState } from '../VariablesAndData';
* It is called by CM.Main.Loop
*/
export default function CheckTickerFortune() {
if (LastTickerFortuneState !== (Game.TickerEffect && Game.TickerEffect.type === 'fortune')) {
LastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type === 'fortune');
if (LastTickerFortuneState) {
Flash(3, 'FortuneFlash');
PlaySound(CM.Options.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
Notification('FortuneNotification', 'Fortune Cookie found', 'A Fortune Cookie has appeared on the Ticker.');
}
}
if (
LastTickerFortuneState !==
(Game.TickerEffect && Game.TickerEffect.type === 'fortune')
) {
LastTickerFortuneState =
Game.TickerEffect && Game.TickerEffect.type === 'fortune';
if (LastTickerFortuneState) {
Flash(3, 'FortuneFlash');
PlaySound(CM.Options.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
Notification(
'FortuneNotification',
'Fortune Cookie found',
'A Fortune Cookie has appeared on the Ticker.',
);
}
}
}

View File

@@ -9,30 +9,55 @@ import { LastWrinklerCount } from '../VariablesAndData';
* It is called by CM.Main.Loop
*/
export default function CheckWrinklerCount() {
if (Game.elderWrath > 0) {
let CurrentWrinklers = 0;
for (const i in Game.wrinklers) {
if (Game.wrinklers[i].phase === 2) CurrentWrinklers++;
}
if (CurrentWrinklers > LastWrinklerCount) {
LastWrinklerCount = CurrentWrinklers;
if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxFlash) {
Flash(3, 'WrinklerMaxFlash');
} else {
Flash(3, 'WrinklerFlash');
}
if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxSound) {
PlaySound(CMOptions.WrinklerMaxSoundURL, 'WrinklerMaxSound', 'WrinklerMaxVolume');
} else {
PlaySound(CMOptions.WrinklerSoundURL, 'WrinklerSound', 'WrinklerVolume');
}
if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxNotification) {
Notification('WrinklerMaxNotification', 'Maximum Wrinklers Reached', 'You have reached your maximum ammount of wrinklers');
} else {
Notification('WrinklerNotification', 'A Wrinkler appeared', 'A new wrinkler has appeared');
}
} else {
LastWrinklerCount = CurrentWrinklers;
}
}
if (Game.elderWrath > 0) {
let CurrentWrinklers = 0;
for (const i in Game.wrinklers) {
if (Game.wrinklers[i].phase === 2) CurrentWrinklers++;
}
if (CurrentWrinklers > LastWrinklerCount) {
LastWrinklerCount = CurrentWrinklers;
if (
CurrentWrinklers === Game.getWrinklersMax() &&
CMOptions.WrinklerMaxFlash
) {
Flash(3, 'WrinklerMaxFlash');
} else {
Flash(3, 'WrinklerFlash');
}
if (
CurrentWrinklers === Game.getWrinklersMax() &&
CMOptions.WrinklerMaxSound
) {
PlaySound(
CMOptions.WrinklerMaxSoundURL,
'WrinklerMaxSound',
'WrinklerMaxVolume',
);
} else {
PlaySound(
CMOptions.WrinklerSoundURL,
'WrinklerSound',
'WrinklerVolume',
);
}
if (
CurrentWrinklers === Game.getWrinklersMax() &&
CMOptions.WrinklerMaxNotification
) {
Notification(
'WrinklerMaxNotification',
'Maximum Wrinklers Reached',
'You have reached your maximum ammount of wrinklers',
);
} else {
Notification(
'WrinklerNotification',
'A Wrinkler appeared',
'A new wrinkler has appeared',
);
}
} else {
LastWrinklerCount = CurrentWrinklers;
}
}
}