Fixed high number of ESLint errors

This commit is contained in:
Daniël van Noord
2021-04-04 17:05:39 +02:00
parent e2f99d1cf9
commit e3321ebe2f
53 changed files with 130 additions and 182 deletions

View File

@@ -19,11 +19,7 @@ module.exports = {
rules: { rules: {
'import/no-mutable-exports': 'off', 'import/no-mutable-exports': 'off',
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-new-func': 'off',
'func-names': 'off', 'func-names': 'off',
'no-console': 'off',
'no-alert': 'off',
'no-restricted-globals': 'off',
'prefer-destructuring': ['error', { object: true, array: false }], 'prefer-destructuring': ['error', { object: true, array: false }],
'max-len': [ 'max-len': [
1, 1,

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData'; import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
import { import {
ChoEggDiff, ChoEggDiff,
@@ -65,9 +64,9 @@ export class CMAvgQueue {
* Called by CM.Cache.InitCache() * Called by CM.Cache.InitCache()
*/ */
export function InitCookiesDiff() { export function InitCookiesDiff() {
CookiesDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); CookiesDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); // eslint-disable-line no-unused-vars
WrinkDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); WrinkDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); // eslint-disable-line no-unused-vars
WrinkFattestDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); WrinkFattestDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); // eslint-disable-line no-unused-vars
ChoEggDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); ChoEggDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); // eslint-disable-line no-unused-vars
ClicksDiff = new CMAvgQueue(ClickTimes[ClickTimes.length - 1]); ClicksDiff = new CMAvgQueue(ClickTimes[ClickTimes.length - 1]); // eslint-disable-line no-unused-vars
} }

View File

@@ -1,5 +1,3 @@
/* eslint-disable no-unused-vars */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData'; import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
import { import {
@@ -41,7 +39,7 @@ export default function CacheAvgCPS() {
if ((Game.T / Game.fps) % 1 === 0) { if ((Game.T / Game.fps) % 1 === 0) {
let choEggTotal = Game.cookies + CacheSellForChoEgg; let choEggTotal = Game.cookies + CacheSellForChoEgg;
if (Game.cpsSucked > 0) choEggTotal += CacheWrinklersTotal; if (Game.cpsSucked > 0) choEggTotal += CacheWrinklersTotal;
CacheRealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal); CacheRealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal); // eslint-disable-line no-unused-vars
choEggTotal *= 0.05; choEggTotal *= 0.05;
// Add recent gains to AvgQueue's // Add recent gains to AvgQueue's
@@ -89,8 +87,9 @@ export default function CacheAvgCPS() {
CacheAverageGainBank + CacheAverageGainBank +
CacheAverageGainWrink + CacheAverageGainWrink +
(choEgg ? CacheAverageGainChoEgg : 0); (choEgg ? CacheAverageGainChoEgg : 0);
} else CacheAvgCPSWithChoEgg = CacheAverageCPS; } else CacheAvgCPSWithChoEgg = CacheAverageCPS; // eslint-disable-line no-unused-vars
// eslint-disable-next-line no-unused-vars
CacheAverageClicks = ClicksDiff.calcAverage( CacheAverageClicks = ClicksDiff.calcAverage(
ClickTimes[CMOptions.AvgClicksHist], ClickTimes[CMOptions.AvgClicksHist],
); );

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { SimObjects } from '../../Sim/VariablesAndData'; import { SimObjects } from '../../Sim/VariablesAndData';
import { import {
CacheCurrWrinklerCount, CacheCurrWrinklerCount,
@@ -23,8 +22,8 @@ export default function CacheCurrWrinklerCPS() {
else if (godLvl === 2) godMult *= 1.1; else if (godLvl === 2) godMult *= 1.1;
else if (godLvl === 3) godMult *= 1.05; else if (godLvl === 3) godMult *= 1.05;
} }
CacheCurrWrinklerCount = count; CacheCurrWrinklerCount = count; // eslint-disable-line no-unused-vars
CacheCurrWrinklerCPSMult = CacheCurrWrinklerCPSMult = // eslint-disable-line no-unused-vars
count * count *
(count * 0.05 * 1.1) * (count * 0.05 * 1.1) *
(Game.Has('Sacrilegious corruption') * 0.05 + 1) * (Game.Has('Sacrilegious corruption') * 0.05 + 1) *

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import CalcNoGoldSwitchCPS from '../../Sim/Calculations/NoGoldenSwitchCalc'; import CalcNoGoldSwitchCPS from '../../Sim/Calculations/NoGoldenSwitchCalc';
import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData'; import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData';
@@ -10,5 +9,5 @@ import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData';
export default function CacheNoGoldSwitchCPS() { export default function CacheNoGoldSwitchCPS() {
if (Game.Has('Golden switch [off]')) { if (Game.Has('Golden switch [off]')) {
CacheNoGoldSwitchCookiesPS = CalcNoGoldSwitchCPS(); CacheNoGoldSwitchCookiesPS = CalcNoGoldSwitchCPS();
} else CacheNoGoldSwitchCookiesPS = Game.cookiesPs; } else CacheNoGoldSwitchCookiesPS = Game.cookiesPs; // eslint-disable-line no-unused-vars
} }

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import SellBuildingsForChoEgg from '../../Sim/SimulationEvents/SellBuildingForChoEgg'; import SellBuildingsForChoEgg from '../../Sim/SimulationEvents/SellBuildingForChoEgg';
import { CacheSellForChoEgg } from '../VariablesAndData'; import { CacheSellForChoEgg } from '../VariablesAndData';
@@ -21,5 +20,5 @@ export default function CacheSellAllForChoEgg() {
} }
// Compute cookies earned by selling all buildings with optimal auras (ES + RB) // Compute cookies earned by selling all buildings with optimal auras (ES + RB)
sellTotal += SellBuildingsForChoEgg(); sellTotal += SellBuildingsForChoEgg();
CacheSellForChoEgg = sellTotal; CacheSellForChoEgg = sellTotal; // eslint-disable-line no-unused-vars
} }

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { ClickTimes } from '../Disp/VariablesAndData'; import { ClickTimes } from '../Disp/VariablesAndData';
import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue'; import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue';
import CacheAvgCPS from './CPS/CPS'; import CacheAvgCPS from './CPS/CPS';
@@ -34,8 +33,9 @@ export default function InitCache() {
CacheAllMissingUpgrades(); CacheAllMissingUpgrades();
CacheSeasonSpec(); CacheSeasonSpec();
InitCookiesDiff(); InitCookiesDiff();
HeavenlyChipsDiff = new CMAvgQueue(5); // Used by CM.Cache.CacheHeavenlyChipsPS() /** Used by CM.Cache.CacheHeavenlyChipsPS() */
CacheAverageCookiesFromClicks = new CMAvgQueue( HeavenlyChipsDiff = new CMAvgQueue(5); // eslint-disable-line no-unused-vars
CacheAverageCookiesFromClicks = new CMAvgQueue( // eslint-disable-line no-unused-vars
ClickTimes[ClickTimes.length - 1] * 20, ClickTimes[ClickTimes.length - 1] * 20,
); );
CacheHeavenlyChipsPS(); CacheHeavenlyChipsPS();

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { FormatTime } from '../Disp/BeautifyAndFormatting/BeautifyFormatting'; import { FormatTime } from '../Disp/BeautifyAndFormatting/BeautifyFormatting';
import GetCPS from '../Disp/HelperFunctions/GetCPS'; import GetCPS from '../Disp/HelperFunctions/GetCPS';
import CacheAvgCPS from './CPS/CPS'; import CacheAvgCPS from './CPS/CPS';
@@ -27,5 +26,5 @@ export default function LoopCache() {
1, 1,
) - ) -
(Game.cookiesEarned + Game.cookiesReset); (Game.cookiesEarned + Game.cookiesReset);
CacheTimeTillNextPrestige = FormatTime(cookiesToNext / GetCPS()); CacheTimeTillNextPrestige = FormatTime(cookiesToNext / GetCPS()); // eslint-disable-line no-unused-vars
} }

View File

@@ -1,10 +1,9 @@
/* eslint-disable no-unused-vars */
import { CacheDragonAura, CacheDragonAura2 } from '../VariablesAndData'; import { CacheDragonAura, CacheDragonAura2 } from '../VariablesAndData';
/** /**
* This functions caches the currently selected Dragon Auras * This functions caches the currently selected Dragon Auras
*/ */
export default function CacheDragonAuras() { export default function CacheDragonAuras() {
CacheDragonAura = Game.dragonAura; CacheDragonAura = Game.dragonAura; // eslint-disable-line no-unused-vars
CacheDragonAura2 = Game.dragonAura2; CacheDragonAura2 = Game.dragonAura2; // eslint-disable-line no-unused-vars
} }

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
/** Functions related to the Dragon */ /** Functions related to the Dragon */
import { Beautify } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting'; import { Beautify } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting';
@@ -6,8 +5,6 @@ import CopyData from '../../Sim/SimulationData/CopyData';
import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData'; import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData';
import { import {
CacheCostDragonUpgrade, CacheCostDragonUpgrade,
CacheDragonAura,
CacheDragonAura2,
CacheLastDragonLevel, CacheLastDragonLevel,
} from '../VariablesAndData'; } from '../VariablesAndData';
@@ -70,7 +67,7 @@ export default function CacheDragonCost() {
cost += price; cost += price;
SimObjects[target].amount -= 1; SimObjects[target].amount -= 1;
} }
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`; CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`; // eslint-disable-line no-unused-vars
}); });
} }
} }

View File

@@ -1,5 +1,3 @@
/* eslint-disable no-param-reassign */
/* eslint-disable no-unused-vars */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank'; import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
import { ColourGray } from '../../Disp/VariablesAndData'; import { ColourGray } from '../../Disp/VariablesAndData';
@@ -20,16 +18,17 @@ import ColourOfPP from './ColourOfPP';
function CacheColour(target, amount) { function CacheColour(target, amount) {
Object.keys(target).forEach((i) => { Object.keys(target).forEach((i) => {
if (CMOptions.PPRigidelMode && amount === 1) { if (CMOptions.PPRigidelMode && amount === 1) {
target[i].color = ColourGray; target[i].color = ColourGray; // eslint-disable-line no-param-reassign
return; return;
} }
// eslint-disable-next-line no-param-reassign
target[i].color = ColourOfPP( target[i].color = ColourOfPP(
target[i], target[i],
Game.Objects[i].getSumPrice(amount), Game.Objects[i].getSumPrice(amount),
); );
// Colour based on excluding certain top-buildings // Colour based on excluding certain top-buildings
for (let j = 0; j < CMOptions.PPExcludeTop; j++) { for (let j = 0; j < CMOptions.PPExcludeTop; j++) {
if (target[i].pp === CachePPArray[j][0]) target[i].color = ColourGray; if (target[i].pp === CachePPArray[j][0]) target[i].color = ColourGray; // eslint-disable-line no-param-reassign
} }
}); });
} }
@@ -38,11 +37,11 @@ function CachePP(target, amount) {
Object.keys(target).forEach((i) => { Object.keys(target).forEach((i) => {
const price = Game.Objects[i].getSumPrice(amount); const price = Game.Objects[i].getSumPrice(amount);
if (Game.cookiesPs) { if (Game.cookiesPs) {
target[i].pp = target[i].pp = // eslint-disable-line no-param-reassign
Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) / Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) /
Game.cookiesPs + Game.cookiesPs +
price / target[i].bonus; price / target[i].bonus;
} else target[i].pp = price / target[i].bonus; } else target[i].pp = price / target[i].bonus; // eslint-disable-line no-param-reassign
if (!(CMOptions.PPRigidelMode && amount === 1)) if (!(CMOptions.PPRigidelMode && amount === 1))
CachePPArray.push([target[i].pp, amount]); CachePPArray.push([target[i].pp, amount]);
}); });
@@ -73,7 +72,7 @@ export default function CacheBuildingsPP() {
} }
} }
} }
CacheMinPP = CachePPArray[CMOptions.PPExcludeTop][indexOfMin]; CacheMinPP = CachePPArray[CMOptions.PPExcludeTop][indexOfMin]; // eslint-disable-line no-unused-vars
CacheColour(CacheObjects1, 1); CacheColour(CacheObjects1, 1);
CacheColour(CacheObjects10, 10); CacheColour(CacheObjects10, 10);

View File

@@ -1,13 +1,10 @@
/* eslint-disable no-unused-vars */
/** Section: Functions related to caching income */ /** Section: Functions related to caching income */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import GetCPS from '../../Disp/HelperFunctions/GetCPS';
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding'; import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome'; import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades'; import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades';
import { import {
CacheAverageCPS,
CacheAverageGainBank, CacheAverageGainBank,
CacheAverageGainWrink, CacheAverageGainWrink,
CacheAverageGainWrinkFattest, CacheAverageGainWrinkFattest,
@@ -30,7 +27,7 @@ function CacheBuildingIncome(amount) {
result[i] = {}; result[i] = {};
result[i].bonus = BuyBuildingsBonusIncome(i, amount); result[i].bonus = BuyBuildingsBonusIncome(i, amount);
if (amount !== 1) { if (amount !== 1) {
CacheDoRemakeBuildPrices = 1; CacheDoRemakeBuildPrices = 1; // eslint-disable-line no-unused-vars
} }
}); });
return result; return result;

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import GetCPSBuffMult from '../CPS/GetCPSBuffMult'; import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
import { import {
CacheChainFrenzyMaxReward, CacheChainFrenzyMaxReward,
@@ -89,8 +88,8 @@ export function CacheChain() {
maxPayout, maxPayout,
CacheGoldenCookiesMult, CacheGoldenCookiesMult,
); );
CacheChainRequired = (CacheChainMaxReward[1] * 2) / CacheGoldenCookiesMult; CacheChainRequired = (CacheChainMaxReward[1] * 2) / CacheGoldenCookiesMult; // eslint-disable-line no-unused-vars
CacheChainRequiredNext = CacheChainRequiredNext = // eslint-disable-line no-unused-vars
CacheChainMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment; CacheChainMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
CacheChainWrathMaxReward = MaxChainCookieReward( CacheChainWrathMaxReward = MaxChainCookieReward(
@@ -98,9 +97,9 @@ export function CacheChain() {
maxPayout, maxPayout,
CacheWrathCookiesMult, CacheWrathCookiesMult,
); );
CacheChainWrathRequired = CacheChainWrathRequired = // eslint-disable-line no-unused-vars
(CacheChainWrathMaxReward[1] * 2) / CacheWrathCookiesMult; (CacheChainWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
CacheChainWrathRequiredNext = CacheChainWrathRequiredNext = // eslint-disable-line no-unused-vars
CacheChainWrathMaxReward[2] / CacheChainWrathMaxReward[2] /
60 / 60 /
60 / 60 /
@@ -112,9 +111,9 @@ export function CacheChain() {
maxPayout * 7, maxPayout * 7,
CacheGoldenCookiesMult, CacheGoldenCookiesMult,
); );
CacheChainFrenzyRequired = CacheChainFrenzyRequired = // eslint-disable-line no-unused-vars
(CacheChainFrenzyMaxReward[1] * 2) / CacheGoldenCookiesMult; (CacheChainFrenzyMaxReward[1] * 2) / CacheGoldenCookiesMult;
CacheChainFrenzyRequiredNext = CacheChainFrenzyRequiredNext = // eslint-disable-line no-unused-vars
CacheChainFrenzyMaxReward[2] / CacheChainFrenzyMaxReward[2] /
60 / 60 /
60 / 60 /
@@ -126,9 +125,9 @@ export function CacheChain() {
maxPayout * 7, maxPayout * 7,
CacheWrathCookiesMult, CacheWrathCookiesMult,
); );
CacheChainFrenzyWrathRequired = CacheChainFrenzyWrathRequired = // eslint-disable-line no-unused-vars
(CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult; (CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
CacheChainFrenzyWrathRequiredNext = CacheChainFrenzyWrathRequiredNext = // eslint-disable-line no-unused-vars
CacheChainFrenzyWrathMaxReward[2] / CacheChainFrenzyWrathMaxReward[2] /
60 / 60 /
60 / 60 /

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { import {
CacheHCPerSecond, CacheHCPerSecond,
CacheLastHeavenlyCheck, CacheLastHeavenlyCheck,
@@ -34,6 +33,6 @@ export default function CacheHeavenlyChipsPS() {
CacheLastHeavenlyChips = ascendNowToGet; CacheLastHeavenlyChips = ascendNowToGet;
// Get average gain over period of 5 seconds // Get average gain over period of 5 seconds
CacheHCPerSecond = HeavenlyChipsDiff.calcAverage(5); CacheHCPerSecond = HeavenlyChipsDiff.calcAverage(5); // eslint-disable-line no-unused-vars
} }
} }

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { crateMissing } from '../../Disp/MenuSections/Statistics/CreateMissingUpgrades'; import { crateMissing } from '../../Disp/MenuSections/Statistics/CreateMissingUpgrades';
import { import {
CacheMissingUpgrades, CacheMissingUpgrades,
@@ -36,6 +35,7 @@ export default function CacheAllMissingUpgrades() {
let str = ''; let str = '';
str += crateMissing(me); str += crateMissing(me);
/* eslint-disable no-unused-vars */
if (me.pool === 'prestige') CacheMissingUpgradesPrestige += str; if (me.pool === 'prestige') CacheMissingUpgradesPrestige += str;
else if (me.pool === 'cookie') CacheMissingUpgradesCookies += str; else if (me.pool === 'cookie') CacheMissingUpgradesCookies += str;
else if ( else if (
@@ -44,6 +44,7 @@ export default function CacheAllMissingUpgrades() {
me.pool !== 'debug' me.pool !== 'debug'
) )
CacheMissingUpgrades += str; CacheMissingUpgrades += str;
/* eslint-enable no-unused-vars */
} }
}); });
} }

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { CacheSeaSpec } from '../VariablesAndData'; import { CacheSeaSpec } from '../VariablesAndData';
/** /**
@@ -12,6 +11,6 @@ export default function CacheSeasonSpec() {
if (Game.hasBuff('Elder frenzy')) val *= 0.5; if (Game.hasBuff('Elder frenzy')) val *= 0.5;
if (Game.hasBuff('Frenzy')) val *= 0.75; if (Game.hasBuff('Frenzy')) val *= 0.75;
CacheSeaSpec = Math.max(25, val); CacheSeaSpec = Math.max(25, val);
if (Game.Has('Ho ho ho-flavored frosting')) CacheSeaSpec *= 2; if (Game.Has('Ho ho ho-flavored frosting')) CacheSeaSpec *= 2; // eslint-disable-line no-unused-vars
} }
} }

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
/** Functions related to Caching stats */ /** Functions related to Caching stats */
import SimHas from '../../Sim/ReplacedGameFunctions/SimHas'; import SimHas from '../../Sim/ReplacedGameFunctions/SimHas';
@@ -29,15 +28,15 @@ export function CacheStatsCookies() {
const cpsBuffMult = GetCPSBuffMult(); const cpsBuffMult = GetCPSBuffMult();
if (cpsBuffMult > 0) CacheLucky /= cpsBuffMult; if (cpsBuffMult > 0) CacheLucky /= cpsBuffMult;
else CacheLucky = 0; else CacheLucky = 0;
CacheLuckyReward = CacheGoldenCookiesMult * (CacheLucky * 0.15) + 13; CacheLuckyReward = CacheGoldenCookiesMult * (CacheLucky * 0.15) + 13; // eslint-disable-line no-unused-vars
CacheLuckyWrathReward = CacheWrathCookiesMult * (CacheLucky * 0.15) + 13; CacheLuckyWrathReward = CacheWrathCookiesMult * (CacheLucky * 0.15) + 13; // eslint-disable-line no-unused-vars
CacheLuckyFrenzy = CacheLucky * 7; CacheLuckyFrenzy = CacheLucky * 7;
CacheLuckyRewardFrenzy = CacheLuckyRewardFrenzy = // eslint-disable-line no-unused-vars
CacheGoldenCookiesMult * (CacheLuckyFrenzy * 0.15) + 13; CacheGoldenCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
CacheLuckyWrathRewardFrenzy = CacheLuckyWrathRewardFrenzy = // eslint-disable-line no-unused-vars
CacheWrathCookiesMult * (CacheLuckyFrenzy * 0.15) + 13; CacheWrathCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
CacheConjure = CacheLucky * 2; CacheConjure = CacheLucky * 2;
CacheConjureReward = CacheConjure * 0.15; CacheConjureReward = CacheConjure * 0.15; // eslint-disable-line no-unused-vars
CacheEdifice = 0; CacheEdifice = 0;
let max = 0; let max = 0;
@@ -53,7 +52,7 @@ export function CacheStatsCookies() {
Game.Objects[i].price * 2 > CacheEdifice Game.Objects[i].price * 2 > CacheEdifice
) { ) {
CacheEdifice = Game.Objects[i].price * 2; CacheEdifice = Game.Objects[i].price * 2;
CacheEdificeBuilding = i; CacheEdificeBuilding = i; // eslint-disable-line no-unused-vars
} }
}); });
} }

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
/** Caches data related to Wrinklers */ /** Caches data related to Wrinklers */
import { SimObjects } from '../../Sim/VariablesAndData'; import { SimObjects } from '../../Sim/VariablesAndData';
@@ -32,9 +31,9 @@ export default function CacheWrinklers() {
else if (godLvl === 2) sucked *= 1.1; else if (godLvl === 2) sucked *= 1.1;
else if (godLvl === 3) sucked *= 1.05; else if (godLvl === 3) sucked *= 1.05;
} }
CacheWrinklersTotal += sucked; CacheWrinklersTotal += sucked; // eslint-disable-line no-unused-vars
if (Game.wrinklers[i].type === 0) { if (Game.wrinklers[i].type === 0) {
CacheWrinklersNormal += sucked; CacheWrinklersNormal += sucked; // eslint-disable-line no-unused-vars
if (sucked > CacheWrinklersFattest[0]) if (sucked > CacheWrinklersFattest[0])
CacheWrinklersFattest = [sucked, i]; CacheWrinklersFattest = [sucked, i];
} }

View File

@@ -18,7 +18,7 @@ function CheckNotificationPermissions(ToggleOnOff) {
// Check if the browser supports notifications and which type // Check if the browser supports notifications and which type
if (!('Notification' in window)) { if (!('Notification' in window)) {
console.log('This browser does not support notifications.'); console.log('This browser does not support notifications.'); // eslint-disable-line no-console
} else if (checkNotificationPromise()) { } else if (checkNotificationPromise()) {
Notification.requestPermission().then(); Notification.requestPermission().then();
} else { } else {

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-return-assign */
import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData'; import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
import { GCTimers } from '../../Disp/VariablesAndData'; import { GCTimers } from '../../Disp/VariablesAndData';
import { CMOptions } from '../VariablesAndData'; import { CMOptions } from '../VariablesAndData';
@@ -15,6 +14,7 @@ export default function ToggleGCTimer() {
GCTimers[i].style.top = CacheGoldenShimmersByID[i].l.style.top; GCTimers[i].style.top = CacheGoldenShimmersByID[i].l.style.top;
}); });
} else { } else {
// eslint-disable-next-line no-return-assign
Object.keys(GCTimers).forEach((i) => (GCTimers[i].style.display = 'none')); Object.keys(GCTimers).forEach((i) => (GCTimers[i].style.display = 'none'));
} }
} }

View File

@@ -1,4 +1,2 @@
/* eslint-disable prefer-const */ export let CMOptions = {}; // eslint-disable-line prefer-const
export let CMOptions = {};
export const ConfigPrefix = 'CMConfig'; export const ConfigPrefix = 'CMConfig';

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import init from './InitSaveLoad/init'; import init from './InitSaveLoad/init';
import load from './InitSaveLoad/load'; import load from './InitSaveLoad/load';
import save from './InitSaveLoad/save'; import save from './InitSaveLoad/save';

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import CheckNotificationPermissions from '../Config/CheckNotificationPermissions'; import CheckNotificationPermissions from '../Config/CheckNotificationPermissions';
import { ToggleTimerBar, ToggleTimerBarPos } from '../Config/SpecificToggles'; import { ToggleTimerBar, ToggleTimerBarPos } from '../Config/SpecificToggles';
import ToggleBotBar from '../Config/Toggles/ToggleBotBar'; import ToggleBotBar from '../Config/Toggles/ToggleBotBar';
@@ -72,7 +71,7 @@ const Config = {
'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) wrinklers', 'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) wrinklers',
true, true,
function () { function () {
SimDoSims = true; SimDoSims = true; // eslint-disable-line no-unused-vars
}, },
), ),

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-nested-ternary */
/** General functions to format or beautify strings */ /** General functions to format or beautify strings */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
@@ -78,6 +77,7 @@ export function Beautify(num, floats, forced) {
} }
} }
if (answer === '') { if (answer === '') {
// eslint-disable-next-line no-console
console.log( console.log(
`Could not beautify number with Cookie Monster Beautify: ${num}`, `Could not beautify number with Cookie Monster Beautify: ${num}`,
); );
@@ -86,7 +86,7 @@ export function Beautify(num, floats, forced) {
if (CMOptions.ScaleSeparator) answer = answer.replace('.', ','); if (CMOptions.ScaleSeparator) answer = answer.replace('.', ',');
return answer; return answer;
} }
console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`); console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`); // eslint-disable-line no-console
return BackupFunctions.Beautify(num, floats); return BackupFunctions.Beautify(num, floats);
} }
@@ -119,15 +119,15 @@ export function FormatTime(time, longFormat) {
return longFormat ? 'Over 9000 days!' : '>9000d'; return longFormat ? 'Over 9000 days!' : '>9000d';
str += str +=
y > 0 y > 0
? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` ? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` // eslint-disable-line no-nested-ternary
: ''; : '';
str += str +=
d > 0 ? `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, ` : ''; d > 0 ? `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, ` : ''; // eslint-disable-line no-nested-ternary
if (str.length > 0 || h > 0) if (str.length > 0 || h > 0)
str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `; str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `; // eslint-disable-line no-nested-ternary
if (str.length > 0 || m > 0) if (str.length > 0 || m > 0)
str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `; str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `; // eslint-disable-line no-nested-ternary
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's'); str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's'); // eslint-disable-line no-nested-ternary
} }
return str; return str;
} }

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-nested-ternary */
import { import {
CacheObjects1, CacheObjects1,
CacheObjects10, CacheObjects10,
@@ -72,10 +71,10 @@ export default function UpdateBuildings() {
}); });
arr.sort(function (a, b) { arr.sort(function (a, b) {
return ColoursOrdering.indexOf(a.color) > return ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color) ColoursOrdering.indexOf(b.color)
? 1 ? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) : ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? -1 ? -1
: a.pp < b.pp : a.pp < b.pp
? -1 ? -1
@@ -90,10 +89,10 @@ export default function UpdateBuildings() {
}); });
arr.sort(function (a, b) { arr.sort(function (a, b) {
return ColoursOrdering.indexOf(a.color) > return ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color) ColoursOrdering.indexOf(b.color)
? 1 ? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) : ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? -1 ? -1
: a.pp < b.pp : a.pp < b.pp
? -1 ? -1

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-nested-ternary */
import { CacheUpgrades } from '../../Cache/VariablesAndData'; import { CacheUpgrades } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { import {
@@ -81,9 +80,9 @@ export default function UpdateUpgrades() {
if (CMOptions.SortUpgrades) { if (CMOptions.SortUpgrades) {
arr.sort(function (a, b) { arr.sort(function (a, b) {
return ColoursOrdering.indexOf(a.color) > ColoursOrdering.indexOf(b.color) return ColoursOrdering.indexOf(a.color) > ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? 1 ? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) : ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? -1 ? -1
: a.pp < b.pp : a.pp < b.pp
? -1 ? -1

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-param-reassign */
/** Section: Functions related to the Golden Cookie Timers */ /** Section: Functions related to the Golden Cookie Timers */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
@@ -28,14 +27,14 @@ export default function CreateGCTimer(cookie) {
cookie.pop(); cookie.pop();
}; };
GCTimer.onmouseover = function () { GCTimer.onmouseover = function () {
cookie.l.style.filter = cookie.l.style.filter = // eslint-disable-line no-param-reassign
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
cookie.l.style.webkitFilter = cookie.l.style.webkitFilter = // eslint-disable-line no-param-reassign
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
}; };
GCTimer.onmouseout = function () { GCTimer.onmouseout = function () {
cookie.l.style.filter = ''; cookie.l.style.filter = ''; // eslint-disable-line no-param-reassign
cookie.l.style.webkitFilter = ''; cookie.l.style.webkitFilter = ''; // eslint-disable-line no-param-reassign
}; };
GCTimers[cookie.id] = GCTimer; GCTimers[cookie.id] = GCTimer;

View File

@@ -218,7 +218,6 @@ export default function CreatePrefOption(config) {
input.min = Config[config].min; input.min = Config[config].min;
input.max = Config[config].max; input.max = Config[config].max;
input.oninput = function () { input.oninput = function () {
if (this.value > this.max) console.log('TEST');
CMOptions[config] = this.value; CMOptions[config] = this.value;
SaveConfig(); SaveConfig();
RefreshScale(); RefreshScale();

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-param-reassign */
import { CMOptions } from '../../../Config/VariablesAndData'; import { CMOptions } from '../../../Config/VariablesAndData';
function CrateTooltipLockedAchievements(me) { function CrateTooltipLockedAchievements(me) {
@@ -58,9 +57,11 @@ export default function AddMissingAchievements() {
if (!achievsCrate.className.includes('enabled')) { if (!achievsCrate.className.includes('enabled')) {
const id = achievsCrate.onclick.toString().match(/(?<=\[).*(?=\])/g)[0]; const id = achievsCrate.onclick.toString().match(/(?<=\[).*(?=\])/g)[0];
const { icon } = Game.AchievementsById[id]; const { icon } = Game.AchievementsById[id];
// eslint-disable-next-line no-param-reassign
achievsCrate.style.backgroundPosition = `${-icon[0] * 48}px ${ achievsCrate.style.backgroundPosition = `${-icon[0] * 48}px ${
-icon[1] * 48 -icon[1] * 48
}px`; }px`;
// eslint-disable-next-line no-param-reassign
achievsCrate.onmouseover = function () { achievsCrate.onmouseover = function () {
if (!Game.mouseDown) { if (!Game.mouseDown) {
Game.setOnCrate(this); Game.setOnCrate(this);

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-param-reassign */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { import {
ColourTextPre, ColourTextPre,
@@ -163,7 +162,7 @@ export function TooltipCreateCalculationSection(tooltip) {
tooltip.appendChild(income); tooltip.appendChild(income);
tooltip.appendChild(TooltipCreateHeader('Bonus Cookies per Click')); tooltip.appendChild(TooltipCreateHeader('Bonus Cookies per Click'));
tooltip.lastChild.style.display = 'none'; tooltip.lastChild.style.display = 'none'; // eslint-disable-line no-param-reassign
const click = document.createElement('div'); const click = document.createElement('div');
click.style.marginBottom = '4px'; click.style.marginBottom = '4px';
click.style.color = 'white'; click.style.color = 'white';
@@ -186,7 +185,8 @@ export function TooltipCreateCalculationSection(tooltip) {
tooltip.appendChild( tooltip.appendChild(
TooltipCreateHeader('Production left till next achievement'), TooltipCreateHeader('Production left till next achievement'),
); );
tooltip.lastChild.id = 'CMTooltipProductionHeader'; // Assign a id in order to hid when no achiev's are left // Assign a id in order to hide when no achiev's are left
tooltip.lastChild.id = 'CMTooltipProductionHeader'; // eslint-disable-line no-param-reassign
const production = document.createElement('div'); const production = document.createElement('div');
production.id = 'CMTooltipProduction'; production.id = 'CMTooltipProduction';
tooltip.appendChild(production); tooltip.appendChild(production);

View File

@@ -1,11 +1,8 @@
/* eslint-disable no-unused-vars */ import UpdateTooltips from './UpdateTooltips';
import UpdateTooltips, * as UpdateTooltip from './UpdateTooltips';
import { TooltipCreateTooltipBox } from './CreateTooltip';
import { import {
Beautify, Beautify,
GetTimeColour, GetTimeColour,
} from '../BeautifyAndFormatting/BeautifyFormatting'; } from '../BeautifyAndFormatting/BeautifyFormatting';
import CopyData from '../../Sim/SimulationData/CopyData';
import { import {
SimpleTooltipElements, SimpleTooltipElements,
TooltipName, TooltipName,
@@ -143,8 +140,8 @@ export function CreateTooltip(type, name) {
} }
// Sets global variables used by CM.Disp.UpdateTooltip() // Sets global variables used by CM.Disp.UpdateTooltip()
TooltipType = type; TooltipType = type; // eslint-disable-line no-unused-vars
TooltipName = name; TooltipName = name; // eslint-disable-line no-unused-vars
UpdateTooltips(); UpdateTooltips();

View File

@@ -1,4 +1,3 @@
/* eslint-disable prefer-const */
/** /**
* Section: Variables used in Disp functions */ * Section: Variables used in Disp functions */
@@ -91,15 +90,15 @@ export const SimpleTooltipElements = {};
* These are variables used by the functions that create tooltips for wrinklers * These are variables used by the functions that create tooltips for wrinklers
* See CM.Disp.CheckWrinklerTooltip(), CM.Disp.UpdateWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect() * See CM.Disp.CheckWrinklerTooltip(), CM.Disp.UpdateWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect()
*/ */
export let TooltipWrinklerArea = 0; export let TooltipWrinklerArea = 0; // eslint-disable-line prefer-const
export let TooltipWrinkler = -1; export let TooltipWrinkler = -1; // eslint-disable-line prefer-const
/** /**
* This array is used to store whether a Wrinkler tooltip is being shown or not * This array is used to store whether a Wrinkler tooltip is being shown or not
* [i] = 1 means tooltip is being shown, [i] = 0 means hidden * [i] = 1 means tooltip is being shown, [i] = 0 means hidden
* It is used by CM.Disp.CheckWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect() * It is used by CM.Disp.CheckWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect()
*/ */
export let TooltipWrinklerBeingShown = []; export let TooltipWrinklerBeingShown = []; // eslint-disable-line prefer-const
export let CMLastAscendState; export let CMLastAscendState;
export let CMSayTime; export let CMSayTime;
@@ -107,9 +106,9 @@ export let CMSayTime;
/** /**
* These are variables used to create various displays when the game is loaded on the "sell all" screen * These are variables used to create various displays when the game is loaded on the "sell all" screen
*/ */
export let LastTargetBotBar = 1; export let LastTargetBotBar = 1; // eslint-disable-line prefer-const
export let LastTargetBuildings = 1; export let LastTargetBuildings = 1; // eslint-disable-line prefer-const
export let LastTargetTooltipBuilding = 1; export let LastTargetTooltipBuilding = 1; // eslint-disable-line prefer-const
/** /**
* These arrays are used in the stats page to show * These arrays are used in the stats page to show
@@ -133,12 +132,12 @@ export const BuffColours = {
/** /**
* This array is used to track GC timers * This array is used to track GC timers
*/ */
export let GCTimers = {}; export let GCTimers = {}; // eslint-disable-line prefer-const
/** /**
* Used to store the number of cookies to be displayed in the tab-title * Used to store the number of cookies to be displayed in the tab-title
*/ */
export let Title = ''; export let Title = ''; // eslint-disable-line prefer-const
export let TooltipPrice; export let TooltipPrice;
export let TooltipBonusIncome; export let TooltipBonusIncome;
@@ -152,4 +151,4 @@ export let LastNumberOfTimers;
/** /**
* This stores the names of settings shown in the favourites section * This stores the names of settings shown in the favourites section
*/ */
export let FavouriteSettings = []; export let FavouriteSettings = []; // eslint-disable-line prefer-const

View File

@@ -1,4 +1,3 @@
/* eslint-disable prefer-const */
/** Variable that shows if Cookie Moonster is initzializing */ /** Variable that shows if Cookie Moonster is initzializing */
export let isInitializing = false; export let isInitializing = false; // eslint-disable-line prefer-const
export let test; export let test;

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { VersionMajor, VersionMinor } from '../Data/Moddata'; import { VersionMajor, VersionMinor } from '../Data/Moddata';
import CMDrawHook from '../Disp/DrawHook'; import CMDrawHook from '../Disp/DrawHook';
import CMClickHook from '../Main/ClickHook'; import CMClickHook from '../Main/ClickHook';
@@ -16,6 +15,7 @@ export default function init() {
isInitializing = true; isInitializing = true;
let proceed = true; let proceed = true;
if (Game.version !== Number(VersionMajor)) { if (Game.version !== Number(VersionMajor)) {
// eslint-disable-next-line no-restricted-globals, no-alert
proceed = confirm( proceed = confirm(
`Cookie Monster version ${VersionMajor}.${VersionMinor} is meant for Game version ${VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`, `Cookie Monster version ${VersionMajor}.${VersionMinor} is meant for Game version ${VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`,
); );
@@ -25,6 +25,6 @@ export default function init() {
Game.registerHook('draw', CMDrawHook); Game.registerHook('draw', CMDrawHook);
Game.registerHook('logic', CMLoopHook); Game.registerHook('logic', CMLoopHook);
Game.registerHook('click', CMClickHook); Game.registerHook('click', CMClickHook);
isInitializing = false; isInitializing = false; // eslint-disable-line no-unused-vars
} }
} }

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings'; import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings';
import { VersionMajor, VersionMinor } from '../Data/Moddata'; import { VersionMajor, VersionMinor } from '../Data/Moddata';
import { FavouriteSettings } from '../Disp/VariablesAndData'; import { FavouriteSettings } from '../Disp/VariablesAndData';
@@ -13,7 +12,7 @@ export default function load(str) {
InitData(); InitData();
// The if-statement is a failsafe for old saves // The if-statement is a failsafe for old saves
if (typeof save.favouriteSettings !== 'undefined') if (typeof save.favouriteSettings !== 'undefined')
FavouriteSettings = save.favouriteSettings; FavouriteSettings = save.favouriteSettings; // eslint-disable-line no-unused-vars
LoadConfig(save.settings); LoadConfig(save.settings);
if (save.version !== `${VersionMajor}.${VersionMinor}`) { if (save.version !== `${VersionMajor}.${VersionMinor}`) {
if (Game.prefs.popups) if (Game.prefs.popups)

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { import {
CacheSpawnedGoldenShimmer, CacheSpawnedGoldenShimmer,
CacheGoldenShimmersByID, CacheGoldenShimmersByID,
@@ -66,7 +65,7 @@ export default function CheckGoldenCookie() {
} }
UpdateFavicon(); UpdateFavicon();
LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState; LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState;
if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0; if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0; // eslint-disable-line no-unused-vars
} else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) { } else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) {
Object.keys(GCTimers).forEach((i) => { Object.keys(GCTimers).forEach((i) => {
GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity; GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity;

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { CacheSeasonPopShimmer } from '../../Cache/VariablesAndData'; import { CacheSeasonPopShimmer } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
@@ -15,7 +14,7 @@ export default function CheckSeasonPopup() {
LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned; LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
Object.keys(Game.shimmers).forEach((i) => { Object.keys(Game.shimmers).forEach((i) => {
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') { if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') {
CacheSeasonPopShimmer = Game.shimmers[i]; CacheSeasonPopShimmer = Game.shimmers[i]; // eslint-disable-line no-unused-vars
} }
}); });
Flash(3, 'SeaFlash', false); Flash(3, 'SeaFlash', false);

View File

@@ -1,10 +1,8 @@
/* eslint-disable no-unused-vars */
import InitCache from '../Cache/CacheInit'; import InitCache from '../Cache/CacheInit';
import { CacheStatsCookies } from '../Cache/Stats/Stats'; import { CacheStatsCookies } from '../Cache/Stats/Stats';
import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings'; import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings';
import { VersionMajor, VersionMinor } from '../Data/Moddata'; import { VersionMajor, VersionMinor } from '../Data/Moddata';
import CreateUpgradeBar from '../Disp/BuildingsUpgrades/UpgradeBar'; import CreateUpgradeBar from '../Disp/BuildingsUpgrades/UpgradeBar';
import UpdateColours from '../Disp/HelperFunctions/UpdateColours';
import { CreateBotBar } from '../Disp/InfoBars/BottomBar'; import { CreateBotBar } from '../Disp/InfoBars/BottomBar';
import { CreateTimerBar } from '../Disp/InfoBars/TimerBar'; import { CreateTimerBar } from '../Disp/InfoBars/TimerBar';
import CreateSectionHideButtons from '../Disp/Initialization/CreateSectionHideButtons'; import CreateSectionHideButtons from '../Disp/Initialization/CreateSectionHideButtons';
@@ -31,7 +29,7 @@ export default function InitializeCookieMonster() {
InitCache(); InitCache();
// Stored to check if we need to re-initiliaze data // Stored to check if we need to re-initiliaze data
LastModCount = Object.keys(Game.mods).length; LastModCount = Object.keys(Game.mods).length; // eslint-disable-line no-unused-vars
// Creating visual elements // Creating visual elements
CreateCssArea(); CreateCssArea();
@@ -60,7 +58,7 @@ export default function InitializeCookieMonster() {
Game.CalculateGains(); Game.CalculateGains();
LoadConfig(); LoadConfig();
CMLastAscendState = Game.OnAscend; CMLastAscendState = Game.OnAscend; // eslint-disable-line no-unused-vars
if (Game.prefs.popups) if (Game.prefs.popups)
Game.Popup( Game.Popup(

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import InitCache from '../Cache/CacheInit'; import InitCache from '../Cache/CacheInit';
import LoopCache from '../Cache/CacheLoop'; import LoopCache from '../Cache/CacheLoop';
import CacheNoGoldSwitchCPS from '../Cache/CPS/NoGoldSwitchCPS'; import CacheNoGoldSwitchCPS from '../Cache/CPS/NoGoldSwitchCPS';

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { FormatTime } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting'; import { FormatTime } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting';
@@ -47,8 +46,8 @@ function ReplaceNativeGrimoireLaunch() {
Game.Objects['Wizard tower'].minigameLoaded Game.Objects['Wizard tower'].minigameLoaded
) { ) {
const { minigame } = Game.Objects['Wizard tower']; const { minigame } = Game.Objects['Wizard tower'];
BackupGrimoireLaunch = minigame.launch; BackupGrimoireLaunch = minigame.launch; // eslint-disable-line no-unused-vars
BackupGrimoireLaunchMod = new Function( BackupGrimoireLaunchMod = new Function( // eslint-disable-line no-new-func
`return ${minigame.launch `return ${minigame.launch
.toString() .toString()
.split('=this') .split('=this')

View File

@@ -1,5 +1,3 @@
/* eslint-disable no-param-reassign */
/* eslint-disable no-unused-vars */
/** Functions related to replacing tooltips */ /** Functions related to replacing tooltips */
import { CreateTooltip } from '../../Disp/Tooltips/Tooltip'; import { CreateTooltip } from '../../Disp/Tooltips/Tooltip';
@@ -39,7 +37,7 @@ function ReplaceTooltipBuild() {
*/ */
function ReplaceTooltipLump() { function ReplaceTooltipLump() {
if (Game.canLumps()) { if (Game.canLumps()) {
TooltipLumpBackup = l('lumps').onmouseover; TooltipLumpBackup = l('lumps').onmouseover; // eslint-disable-line no-unused-vars
l('lumps').onmouseover = function () { l('lumps').onmouseover = function () {
Game.tooltip.dynamic = 1; Game.tooltip.dynamic = 1;
Game.tooltip.draw( Game.tooltip.draw(
@@ -72,6 +70,7 @@ function ReplaceTooltipGarden() {
}; };
Array.from(l('gardenPlot').children).forEach((child) => { Array.from(l('gardenPlot').children).forEach((child) => {
const coords = child.id.slice(-3); const coords = child.id.slice(-3);
// eslint-disable-next-line no-param-reassign
child.onmouseover = function () { child.onmouseover = function () {
Game.tooltip.dynamic = 1; Game.tooltip.dynamic = 1;
Game.tooltip.draw( Game.tooltip.draw(

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import jscolor from '@eastdesire/jscolor'; import jscolor from '@eastdesire/jscolor';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { import {
@@ -32,14 +31,14 @@ export default function ReplaceNative() {
BackupFunctions.CalculateGains = Game.CalculateGains; BackupFunctions.CalculateGains = Game.CalculateGains;
Game.CalculateGains = function () { Game.CalculateGains = function () {
BackupFunctions.CalculateGains(); BackupFunctions.CalculateGains();
SimDoSims = 1; SimDoSims = 1; // eslint-disable-line no-unused-vars
CycliusDateAtBeginLoop = Date.now(); CycliusDateAtBeginLoop = Date.now(); // eslint-disable-line no-unused-vars
CenturyDateAtBeginLoop = Date.now(); CenturyDateAtBeginLoop = Date.now(); // eslint-disable-line no-unused-vars
}; };
BackupFunctions.tooltip = {}; BackupFunctions.tooltip = {};
BackupFunctions.tooltip.draw = Game.tooltip.draw; BackupFunctions.tooltip.draw = Game.tooltip.draw;
BackupFunctions.tooltip.drawMod = new Function( BackupFunctions.tooltip.drawMod = new Function( // eslint-disable-line no-new-func
`return ${Game.tooltip.draw.toString().split('this').join('Game.tooltip')}`, `return ${Game.tooltip.draw.toString().split('this').join('Game.tooltip')}`,
)(); )();
Game.tooltip.draw = function (from, text, origin) { Game.tooltip.draw = function (from, text, origin) {
@@ -47,7 +46,7 @@ export default function ReplaceNative() {
}; };
BackupFunctions.tooltip.update = Game.tooltip.update; BackupFunctions.tooltip.update = Game.tooltip.update;
BackupFunctions.tooltip.updateMod = new Function( BackupFunctions.tooltip.updateMod = new Function( // eslint-disable-line no-new-func
`return ${Game.tooltip.update `return ${Game.tooltip.update
.toString() .toString()
.split('this.') .split('this.')
@@ -132,6 +131,7 @@ export default function ReplaceNative() {
}; };
BackupFunctions.sayTime = Game.sayTime; BackupFunctions.sayTime = Game.sayTime;
// eslint-disable-next-line no-unused-vars
CMSayTime = function (time, detail) { CMSayTime = function (time, detail) {
if (Number.isNaN(time) || time <= 0) if (Number.isNaN(time) || time <= 0)
return BackupFunctions.sayTime(time, detail); return BackupFunctions.sayTime(time, detail);
@@ -145,6 +145,7 @@ export default function ReplaceNative() {
// Update tab title // Update tab title
let title = 'Cookie Clicker'; let title = 'Cookie Clicker';
if (Game.season === 'fools') title = 'Cookie Baker'; if (Game.season === 'fools') title = 'Cookie Baker';
// eslint-disable-next-line no-unused-vars
Title = `${Game.OnAscend ? 'Ascending! ' : ''}${CMBeautify(Game.cookies)} ${ Title = `${Game.OnAscend ? 'Ascending! ' : ''}${CMBeautify(Game.cookies)} ${
Game.cookies === 1 ? 'cookie' : 'cookies' Game.cookies === 1 ? 'cookie' : 'cookies'
} - ${title}`; } - ${title}`;

View File

@@ -1,17 +1,15 @@
/* eslint-disable prefer-const */
export let LastModCount; export let LastModCount;
export let TooltipBuildBackup = []; export let TooltipBuildBackup = []; // eslint-disable-line prefer-const
export let TooltipLumpBackup; export let TooltipLumpBackup;
export let TooltipGrimoireBackup = []; export let TooltipGrimoireBackup = []; // eslint-disable-line prefer-const
export let TooltipUpgradeBackup = []; export let TooltipUpgradeBackup = []; // eslint-disable-line prefer-const
export let BackupGrimoireLaunch; export let BackupGrimoireLaunch;
export let BackupGrimoireLaunchMod; export let BackupGrimoireLaunchMod;
export let BackupGrimoireDraw; export let BackupGrimoireDraw;
export let HasReplaceNativeGrimoireLaunch; export let HasReplaceNativeGrimoireLaunch;
export let HasReplaceNativeGrimoireDraw; export let HasReplaceNativeGrimoireDraw;
export let LoadMinigames; export let LoadMinigames;
export let BackupFunctions = {}; export let BackupFunctions = {}; // eslint-disable-line prefer-const
export let LastSeasonPopupState; export let LastSeasonPopupState;
export let LastTickerFortuneState; export let LastTickerFortuneState;

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { import {
TooltipWrinklerArea, TooltipWrinklerArea,
TooltipWrinklerBeingShown, TooltipWrinklerBeingShown,
@@ -13,7 +12,7 @@ export default function AddWrinklerAreaDetect() {
TooltipWrinklerArea = 1; TooltipWrinklerArea = 1;
}; };
l('backgroundLeftCanvas').onmouseout = function () { l('backgroundLeftCanvas').onmouseout = function () {
TooltipWrinklerArea = 0; TooltipWrinklerArea = 0; // eslint-disable-line no-unused-vars
Game.tooltip.hide(); Game.tooltip.hide();
Object.keys(Game.wrinklers).forEach((i) => { Object.keys(Game.wrinklers).forEach((i) => {
TooltipWrinklerBeingShown[i] = 0; TooltipWrinklerBeingShown[i] = 0;

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import GetCPSBuffMult from '../../Cache/CPS/GetCPSBuffMult'; import GetCPSBuffMult from '../../Cache/CPS/GetCPSBuffMult';
import { CacheCentEgg } from '../../Cache/VariablesAndData'; import { CacheCentEgg } from '../../Cache/VariablesAndData';
import { import {
@@ -42,7 +41,7 @@ export default function CalculateGains() {
}); });
} }
}); });
SimEffs = effs; SimEffs = effs; // eslint-disable-line no-unused-vars
if (Game.ascensionMode !== 1) if (Game.ascensionMode !== 1)
mult += mult +=
@@ -227,7 +226,7 @@ export default function CalculateGains() {
SimWin(Game.CpsAchievements[i].name); SimWin(Game.CpsAchievements[i].name);
}); });
SimCookiesPsRaw = rawCookiesPs; SimCookiesPsRaw = rawCookiesPs; // eslint-disable-line no-unused-vars
const { n } = Game.shimmerTypes.golden; const { n } = Game.shimmerTypes.golden;
const auraMult = SimAuraMult("Dragon's Fortune"); const auraMult = SimAuraMult("Dragon's Fortune");

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import CacheDragonAuras from '../../Cache/Dragon/CacheDragonAuras'; import CacheDragonAuras from '../../Cache/Dragon/CacheDragonAuras';
import { import {
CacheDragonAura, CacheDragonAura,
@@ -30,11 +29,11 @@ import {
*/ */
export default function CopyData() { export default function CopyData() {
// Other variables // Other variables
SimUpgradesOwned = Game.UpgradesOwned; SimUpgradesOwned = Game.UpgradesOwned; // eslint-disable-line no-unused-vars
SimPledges = Game.pledges; SimPledges = Game.pledges; // eslint-disable-line no-unused-vars
SimAchievementsOwned = Game.AchievementsOwned; SimAchievementsOwned = Game.AchievementsOwned; // eslint-disable-line no-unused-vars
SimHeavenlyPower = Game.heavenlyPower; SimHeavenlyPower = Game.heavenlyPower; // eslint-disable-line no-unused-vars
SimPrestige = Game.prestige; SimPrestige = Game.prestige; // eslint-disable-line no-unused-vars
// Buildings // Buildings
Object.keys(Game.Objects).forEach((i) => { Object.keys(Game.Objects).forEach((i) => {
@@ -53,9 +52,9 @@ export default function CopyData() {
you.free = me.free; you.free = me.free;
if (me.minigameLoaded) { if (me.minigameLoaded) {
if (me.name === 'Temple') { if (me.name === 'Temple') {
SimGod1 = me.minigame.slot[0]; SimGod1 = me.minigame.slot[0]; // eslint-disable-line no-unused-vars
SimGod2 = me.minigame.slot[1]; SimGod2 = me.minigame.slot[1]; // eslint-disable-line no-unused-vars
SimGod3 = me.minigame.slot[2]; SimGod3 = me.minigame.slot[2]; // eslint-disable-line no-unused-vars
} }
you.minigameLoaded = me.minigameLoaded; you.minigameLoaded = me.minigameLoaded;
you.minigame = me.minigame; you.minigame = me.minigame;
@@ -89,6 +88,6 @@ export default function CopyData() {
// Auras // Auras
CacheDragonAuras(); CacheDragonAuras();
SimDragonAura = CacheDragonAura; SimDragonAura = CacheDragonAura; // eslint-disable-line no-unused-vars
SimDragonAura2 = CacheDragonAura2; SimDragonAura2 = CacheDragonAura2; // eslint-disable-line no-unused-vars
} }

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { SimAchievements, SimAchievementsOwned } from '../VariablesAndData'; import { SimAchievements, SimAchievementsOwned } from '../VariablesAndData';
/** /**
@@ -11,7 +10,7 @@ export default function SimWin(what) {
if (SimAchievements[what]) { if (SimAchievements[what]) {
if (SimAchievements[what].won === 0) { if (SimAchievements[what].won === 0) {
SimAchievements[what].won = 1; SimAchievements[what].won = 1;
if (Game.Achievements[what].pool !== 'shadow') SimAchievementsOwned += 1; if (Game.Achievements[what].pool !== 'shadow') SimAchievementsOwned += 1; // eslint-disable-line no-unused-vars
} }
} }
} }

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { import {
CacheDragonAura, CacheDragonAura,
CacheDragonAura2, CacheDragonAura2,
@@ -41,7 +40,7 @@ export default function CalculateChangeAura(aura) {
if (Game.ObjectsById[i].amount > 0) { if (Game.ObjectsById[i].amount > 0) {
const highestBuilding = SimObjects[Game.ObjectsById[i].name].name; const highestBuilding = SimObjects[Game.ObjectsById[i].name].name;
SimObjects[highestBuilding].amount -= 1; SimObjects[highestBuilding].amount -= 1;
SimBuildingsOwned -= 1; SimBuildingsOwned -= 1; // eslint-disable-line no-unused-vars
price = price =
SimObjects[highestBuilding].basePrice * SimObjects[highestBuilding].basePrice *
Game.priceIncrease ** Game.priceIncrease **

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import CalculateGains from '../Calculations/CalculateGains'; import CalculateGains from '../Calculations/CalculateGains';
import CheckOtherAchiev from '../Calculations/CheckOtherAchiev'; import CheckOtherAchiev from '../Calculations/CheckOtherAchiev';
import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult'; import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult';
@@ -130,9 +129,8 @@ export default function BuyUpgradesBonusIncome(upgrade) {
} else { } else {
SimUpgrades[upgrade].bought = (SimUpgrades[upgrade].bought + 1) % 2; SimUpgrades[upgrade].bought = (SimUpgrades[upgrade].bought + 1) % 2;
} }
const me = SimUpgrades[upgrade];
if (Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool)) if (Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool))
SimUpgradesOwned += 1; SimUpgradesOwned += 1; // eslint-disable-line no-unused-vars
if (upgrade === 'Elder Pledge') { if (upgrade === 'Elder Pledge') {
SimPledges += 1; SimPledges += 1;

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import CalculateGains from '../Calculations/CalculateGains'; import CalculateGains from '../Calculations/CalculateGains';
import CheckOtherAchiev from '../Calculations/CheckOtherAchiev'; import CheckOtherAchiev from '../Calculations/CheckOtherAchiev';
import CopyData from '../SimulationData/CopyData'; import CopyData from '../SimulationData/CopyData';
@@ -19,9 +18,11 @@ import {
*/ */
export default function CalculateChangeGod(god, slot) { export default function CalculateChangeGod(god, slot) {
CopyData(); CopyData();
/* eslint-disable no-unused-vars */
if (slot === 0) SimGod1 = god; if (slot === 0) SimGod1 = god;
else if (slot === 1) SimGod2 = god; else if (slot === 1) SimGod2 = god;
else if (slot === 2) SimGod3 = god; else if (slot === 2) SimGod3 = god;
/* eslint-enable no-unused-vars */
const lastAchievementsOwned = SimAchievementsOwned; const lastAchievementsOwned = SimAchievementsOwned;
CalculateGains(); CalculateGains();

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import { CacheRealCookiesEarned } from '../../Cache/VariablesAndData'; import { CacheRealCookiesEarned } from '../../Cache/VariablesAndData';
import CalculateGains from '../Calculations/CalculateGains'; import CalculateGains from '../Calculations/CalculateGains';
import CheckOtherAchiev from '../Calculations/CheckOtherAchiev'; import CheckOtherAchiev from '../Calculations/CheckOtherAchiev';
@@ -96,7 +95,7 @@ export default function ResetBonus(newHeavenlyChips) {
const ResetCPS = SimCookiesPs - curCPS; const ResetCPS = SimCookiesPs - curCPS;
// Reset Pretige level after calculation as it is used in CM.Sim.CalculateGains() so can't be local // Reset Pretige level after calculation as it is used in CM.Sim.CalculateGains() so can't be local
SimPrestige = Game.prestige; SimPrestige = Game.prestige; // eslint-disable-line no-unused-vars
return ResetCPS; return ResetCPS;
} }

View File

@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import CopyData from '../SimulationData/CopyData'; import CopyData from '../SimulationData/CopyData';
import { import {
SimBuildingsOwned, SimBuildingsOwned,
@@ -38,7 +37,7 @@ export default function SellBuildingsForChoEgg() {
} }
}); });
SimObjects[highestBuilding].amount -= 1; SimObjects[highestBuilding].amount -= 1;
SimBuildingsOwned -= 1; SimBuildingsOwned -= 1; // eslint-disable-line no-unused-vars
} }
// Get money made by selling all remaining buildings // Get money made by selling all remaining buildings

View File

@@ -1,9 +1,8 @@
/* eslint-disable prefer-const */
/** All variables used by simulation functions */ /** All variables used by simulation functions */
export let SimObjects = []; export let SimObjects = []; // eslint-disable-line prefer-const
export let SimUpgrades = []; export let SimUpgrades = []; // eslint-disable-line prefer-const
export let SimAchievements = []; export let SimAchievements = []; // eslint-disable-line prefer-const
export let SimBuildingsOwned; export let SimBuildingsOwned;
export let SimUpgradesOwned; export let SimUpgradesOwned;
export let SimPledges; export let SimPledges;