Fixed linting issues

This commit is contained in:
Daniël van Noord
2021-05-01 22:43:02 +02:00
parent 1d12977984
commit 1c8bd79640
94 changed files with 8692 additions and 1316 deletions

View File

@@ -1,10 +1,6 @@
/** Functions related to the Bottom Bar */
import {
CacheObjects1,
CacheObjects10,
CacheObjects100,
} from '../../Cache/VariablesAndData';
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import { VersionMajor, VersionMinor } from '../../Data/Moddata.ts';
import Beautify from '../BeautifyAndFormatting/Beautify';
@@ -13,12 +9,7 @@ import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour';
import GetCPS from '../HelperFunctions/GetCPS';
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
import {
ColourBlue,
ColourTextPre,
ColourYellow,
LastTargetBotBar,
} from '../VariablesAndData';
import { ColourBlue, ColourTextPre, ColourYellow, LastTargetBotBar } from '../VariablesAndData';
import { CreateBotBarBuildingColumn } from './CreateDOMElements';
/**
@@ -35,8 +26,7 @@ export function CreateBotBar() {
BotBar.style.backgroundImage = 'linear-gradient(to bottom, #4d4548, #000000)';
BotBar.style.borderTop = '1px solid black';
BotBar.style.overflow = 'auto';
BotBar.style.textShadow =
'-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black';
BotBar.style.textShadow = '-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black';
const table = BotBar.appendChild(document.createElement('table'));
table.style.width = '100%';
@@ -53,9 +43,7 @@ export function CreateBotBar() {
};
const type = tbody.appendChild(document.createElement('tr'));
type.style.fontWeight = 'bold';
type.appendChild(
firstCol(`CM ${VersionMajor}.${VersionMinor}`, ColourYellow),
);
type.appendChild(firstCol(`CM ${VersionMajor}.${VersionMinor}`, ColourYellow));
const bonus = tbody.appendChild(document.createElement('tr'));
bonus.appendChild(firstCol('Bonus Income', ColourBlue));
const pp = tbody.appendChild(document.createElement('tr'));
@@ -90,37 +78,28 @@ export function UpdateBotBar() {
l('CMBotBar').firstChild.firstChild.childNodes[0].childNodes[
count
].childNodes[1].textContent = Game.Objects[i].amount;
l('CMBotBar').firstChild.firstChild.childNodes[1].childNodes[
count
].textContent = Beautify(target[i].bonus, 2);
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
count
].className = ColourTextPre + target[i].color;
let PPString;
if (CMOptions.PPDisplayTime)
PPString = FormatTime(Math.round(target[i].pp));
else PPString = Beautify(Math.round(target[i].pp), 2);
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
count
].textContent = PPString;
const timeColour = GetTimeColour(
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) /
GetCPS(),
l('CMBotBar').firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(
target[i].bonus,
2,
);
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
count
].className = ColourTextPre + timeColour.color;
if (
timeColour.text === 'Done!' &&
Game.cookies < Game.Objects[i].bulkPrice
) {
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className =
ColourTextPre + target[i].color;
let PPString;
if (CMOptions.PPDisplayTime) PPString = FormatTime(Math.round(target[i].pp));
else PPString = Beautify(Math.round(target[i].pp), 2);
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].textContent = PPString;
const timeColour = GetTimeColour(
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
);
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].className =
ColourTextPre + timeColour.color;
if (timeColour.text === 'Done!' && Game.cookies < Game.Objects[i].bulkPrice) {
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
count
].textContent = `${timeColour.text} (with Wrink)`;
} else
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
count
].textContent = timeColour.text;
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].textContent =
timeColour.text;
});
}
}

View File

@@ -77,9 +77,7 @@ export function CreateBotBarBuildingColumn(buildingName) {
const i = buildingName;
const header = type.appendChild(document.createElement('td'));
header.appendChild(
document.createTextNode(
`${i.indexOf(' ') !== -1 ? i.substring(0, i.indexOf(' ')) : i} (`,
),
document.createTextNode(`${i.indexOf(' ') !== -1 ? i.substring(0, i.indexOf(' ')) : i} (`),
);
const span = header.appendChild(document.createElement('span'));

View File

@@ -57,28 +57,19 @@ export function UpdateTimerBar() {
let numberOfTimers = 0;
// Regulates visibility of Golden Cookie timer
if (
Game.shimmerTypes.golden.spawned === 0 &&
!Game.Has('Golden switch [off]')
) {
if (Game.shimmerTypes.golden.spawned === 0 && !Game.Has('Golden switch [off]')) {
l('CMTimerBarGC').style.display = '';
l('CMTimerBarGCMinBar').style.width = `${Math.round(
(Math.max(
0,
Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time,
) *
(Math.max(0, Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) *
maxWidthTwoBar) /
Game.shimmerTypes.golden.maxTime,
)}px`;
if (CMOptions.TimerBarOverlay >= 1)
l('CMTimerBarGCMinBar').textContent = Math.ceil(
(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) /
Game.fps,
(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) / Game.fps,
);
else l('CMTimerBarGCMinBar').textContent = '';
if (
Game.shimmerTypes.golden.minTime === Game.shimmerTypes.golden.maxTime
) {
if (Game.shimmerTypes.golden.minTime === Game.shimmerTypes.golden.maxTime) {
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '10px';
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '10px';
} else {
@@ -102,37 +93,27 @@ export function UpdateTimerBar() {
);
else l('CMTimerBarGCBar').textContent = '';
l('CMTimerBarGCTime').textContent = Math.ceil(
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) /
Game.fps,
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps,
);
numberOfTimers += 1;
} else l('CMTimerBarGC').style.display = 'none';
// Regulates visibility of Reindeer timer
if (
Game.season === 'christmas' &&
Game.shimmerTypes.reindeer.spawned === 0
) {
if (Game.season === 'christmas' && Game.shimmerTypes.reindeer.spawned === 0) {
l('CMTimerBarRen').style.display = '';
l('CMTimerBarRenMinBar').style.width = `${Math.round(
(Math.max(
0,
Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time,
) *
(Math.max(0, Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) *
maxWidthTwoBar) /
Game.shimmerTypes.reindeer.maxTime,
)}px`;
if (CMOptions.TimerBarOverlay >= 1)
l('CMTimerBarRenMinBar').textContent = Math.ceil(
(Game.shimmerTypes.reindeer.minTime -
Game.shimmerTypes.reindeer.time) /
Game.fps,
(Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) / Game.fps,
);
else l('CMTimerBarRenMinBar').textContent = '';
l('CMTimerBarRenBar').style.width = `${Math.round(
(Math.min(
Game.shimmerTypes.reindeer.maxTime -
Game.shimmerTypes.reindeer.minTime,
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime,
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time,
) *
maxWidthTwoBar) /
@@ -141,16 +122,13 @@ export function UpdateTimerBar() {
if (CMOptions.TimerBarOverlay >= 1)
l('CMTimerBarRenBar').textContent = Math.ceil(
Math.min(
Game.shimmerTypes.reindeer.maxTime -
Game.shimmerTypes.reindeer.minTime,
Game.shimmerTypes.reindeer.maxTime -
Game.shimmerTypes.reindeer.time,
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime,
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time,
) / Game.fps,
);
else l('CMTimerBarRenBar').textContent = '';
l('CMTimerBarRenTime').textContent = Math.ceil(
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) /
Game.fps,
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps,
);
numberOfTimers += 1;
} else {
@@ -180,13 +158,10 @@ export function UpdateTimerBar() {
else timer.lastChild.children[1].textContent = '';
timer.lastChild.children[1].style.width = `${Math.round(
(Game.buffs[i].time *
(maxWidthOneBar -
Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8)) /
(maxWidthOneBar - Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8)) /
Game.buffs[i].maxTime,
)}px`;
timer.lastChild.children[2].textContent = Math.ceil(
Game.buffs[i].time / Game.fps,
);
timer.lastChild.children[2].textContent = Math.ceil(Game.buffs[i].time / Game.fps);
numberOfTimers += 1;
BuffTimerBars[Game.buffs[i].name] = timer;
}