Added prettier (#661)

* Added prettier

* Added prettier

* Added prettier
This commit is contained in:
Daniël van Noord
2021-03-14 18:57:07 +01:00
committed by GitHub
parent f3e7964262
commit 932509a877
132 changed files with 7143 additions and 4894 deletions

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,
);
}
}
}