Changes according to Eslint
This commit is contained in:
@@ -34,12 +34,13 @@ export class CMAvgQueue {
|
||||
* @returns {number} ret The average
|
||||
*/
|
||||
calcAverage(timePeriod) {
|
||||
if (timePeriod > this.maxLength) timePeriod = this.maxLength;
|
||||
if (timePeriod > this.queue.length) timePeriod = this.queue.length;
|
||||
let time = timePeriod;
|
||||
if (time > this.maxLength) time = this.maxLength;
|
||||
if (time > this.queue.length) time = this.queue.length;
|
||||
let ret = 0;
|
||||
for (
|
||||
let i = this.queue.length - 1;
|
||||
i >= 0 && i > this.queue.length - 1 - timePeriod;
|
||||
i >= 0 && i > this.queue.length - 1 - time;
|
||||
i--
|
||||
) {
|
||||
ret += this.queue[i];
|
||||
@@ -47,7 +48,7 @@ export class CMAvgQueue {
|
||||
if (ret === 0) {
|
||||
return 0;
|
||||
}
|
||||
return ret / timePeriod;
|
||||
return ret / time;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ import {
|
||||
export default function CacheCurrWrinklerCPS() {
|
||||
CacheCurrWrinklerCPSMult = 0;
|
||||
let count = 0;
|
||||
for (const i in Game.wrinklers) {
|
||||
if (Game.wrinklers[i].phase === 2) count++;
|
||||
}
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
if (Game.wrinklers[i].phase === 2) count += 1;
|
||||
});
|
||||
let godMult = 1;
|
||||
if (SimObjects.Temple.minigameLoaded) {
|
||||
const godLvl = Game.hasGod('scorn');
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
*/
|
||||
export default function GetCPSBuffMult() {
|
||||
let mult = 1;
|
||||
for (const i of Object.keys(Game.buffs)) {
|
||||
Object.keys(Game.buffs).forEach((i) => {
|
||||
if (typeof Game.buffs[i].multCpS !== 'undefined')
|
||||
mult *= Game.buffs[i].multCpS;
|
||||
}
|
||||
});
|
||||
return mult;
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ export default function CacheSellAllForChoEgg() {
|
||||
if (Game.Objects.Bank.minigameLoaded) {
|
||||
const marketGoods = Game.Objects.Bank.minigame.goods;
|
||||
let goodsVal = 0;
|
||||
for (const i of Object.keys(marketGoods)) {
|
||||
Object.keys(marketGoods).forEach((i) => {
|
||||
const marketGood = marketGoods[i];
|
||||
goodsVal += marketGood.stock * marketGood.val;
|
||||
}
|
||||
});
|
||||
sellTotal += goodsVal * Game.cookiesPsRawHighest;
|
||||
}
|
||||
// Compute cookies earned by selling all buildings with optimal auras (ES + RB)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Functions related to the Dragon */
|
||||
|
||||
@@ -44,7 +45,7 @@ export default function CacheDragonCost() {
|
||||
price = Game.modifyBuildingPrice(SimObjects[target], price);
|
||||
price = Math.ceil(price);
|
||||
cost += price;
|
||||
SimObjects[target].amount--;
|
||||
SimObjects[target].amount -= 1;
|
||||
}
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${cost}`;
|
||||
}
|
||||
@@ -68,7 +69,7 @@ export default function CacheDragonCost() {
|
||||
price = Game.modifyBuildingPrice(SimObjects[target], price);
|
||||
price = Math.ceil(price);
|
||||
cost += price;
|
||||
SimObjects[target].amount--;
|
||||
SimObjects[target].amount -= 1;
|
||||
}
|
||||
}
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
|
||||
@@ -19,7 +20,7 @@ import ColourOfPP from './ColourOfPP';
|
||||
* It is called by CM.Cache.CacheBuildingsPP()
|
||||
*/
|
||||
function CacheBuildingsBulkPP(target) {
|
||||
for (const i of Object.keys(target)) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
if (Game.cookiesPs) {
|
||||
target[i].pp =
|
||||
Math.max(target[i].price - (Game.cookies + GetWrinkConfigBank()), 0) /
|
||||
@@ -28,7 +29,7 @@ function CacheBuildingsBulkPP(target) {
|
||||
} else target[i].pp = target[i].price / target[i].bonus;
|
||||
|
||||
target[i].color = ColourOfPP(target[i], target[i].price);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +44,7 @@ export default function CacheBuildingsPP() {
|
||||
|
||||
// Calculate PP and colors when compared to purchase of optimal building in single-purchase mode
|
||||
if (CMOptions.ColorPPBulkMode === 0 && Game.buyMode > 0) {
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
if (Game.cookiesPs) {
|
||||
CacheObjects1[i].pp =
|
||||
Math.max(
|
||||
@@ -56,7 +57,7 @@ export default function CacheBuildingsPP() {
|
||||
CacheObjects1[i].pp =
|
||||
Game.Objects[i].getPrice() / CacheObjects1[i].bonus;
|
||||
CacheArrayOfPPs.push([CacheObjects1[i].pp, Game.Objects[i].getPrice()]);
|
||||
}
|
||||
});
|
||||
// Set CM.Cache.min to best non-excluded buidliung
|
||||
CacheArrayOfPPs.sort((a, b) => a[0] - b[0]);
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
@@ -70,7 +71,7 @@ export default function CacheBuildingsPP() {
|
||||
CacheMinPP = CacheArrayOfPPs[CMOptions.PPExcludeTop][0];
|
||||
CacheMaxPP = CacheArrayOfPPs[CacheArrayOfPPs.length - 1][0];
|
||||
CacheMidPP = (CacheMaxPP - CacheMinPP) / 2 + CacheMinPP;
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
CacheObjects1[i].color = ColourOfPP(
|
||||
CacheObjects1[i],
|
||||
Game.Objects[i].getPrice(),
|
||||
@@ -80,7 +81,7 @@ export default function CacheBuildingsPP() {
|
||||
if (CacheObjects1[i].pp === CacheArrayOfPPs[j][0])
|
||||
CacheObjects1[i].color = ColorGray;
|
||||
}
|
||||
}
|
||||
});
|
||||
// Calculate PP of bulk-buy modes
|
||||
CacheBuildingsBulkPP(CacheObjects10);
|
||||
CacheBuildingsBulkPP(CacheObjects100);
|
||||
@@ -90,7 +91,7 @@ export default function CacheBuildingsPP() {
|
||||
if (Game.buyBulk === 1) target = CacheObjects1;
|
||||
else if (Game.buyBulk === 10) target = CacheObjects10;
|
||||
else if (Game.buyBulk === 100) target = CacheObjects100;
|
||||
for (const i of Object.keys(target)) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
if (Game.cookiesPs) {
|
||||
target[i].pp =
|
||||
Math.max(
|
||||
@@ -101,7 +102,7 @@ export default function CacheBuildingsPP() {
|
||||
Game.Objects[i].bulkPrice / target[i].bonus;
|
||||
} else target[i].pp = Game.Objects[i].bulkPrice / target[i].bonus;
|
||||
CacheArrayOfPPs.push([target[i].pp, Game.Objects[i].bulkPrice]);
|
||||
}
|
||||
});
|
||||
// Set CM.Cache.min to best non-excluded buidliung
|
||||
CacheArrayOfPPs.sort((a, b) => a[0] - b[0]);
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
@@ -116,12 +117,12 @@ export default function CacheBuildingsPP() {
|
||||
CacheMaxPP = CacheArrayOfPPs[CacheArrayOfPPs.length - 1][0];
|
||||
CacheMidPP = (CacheMaxPP - CacheMinPP) / 2 + CacheMinPP;
|
||||
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
target[i].color = ColourOfPP(target[i], Game.Objects[i].bulkPrice);
|
||||
// Colour based on excluding certain top-buildings
|
||||
for (let j = 0; j < CMOptions.PPExcludeTop; j++) {
|
||||
if (target[i].pp === CacheArrayOfPPs[j][0]) target[i].color = ColorGray;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import ColourOfPP from './ColourOfPP';
|
||||
* It is called by CM.Cache.CachePP()
|
||||
*/
|
||||
export default function CacheUpgradePP() {
|
||||
for (const i of Object.keys(CacheUpgrades)) {
|
||||
Object.keys(CacheUpgrades).forEach((i) => {
|
||||
if (Game.cookiesPs) {
|
||||
CacheUpgrades[i].pp =
|
||||
Math.max(
|
||||
@@ -25,5 +25,5 @@ export default function CacheUpgradePP() {
|
||||
CacheUpgrades[i],
|
||||
Game.Upgrades[i].getPrice(),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ import {
|
||||
*/
|
||||
function CacheBuildingIncome(amount, target) {
|
||||
const result = [];
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
result[i] = {};
|
||||
result[i].bonus = BuyBuildingsBonusIncome(i, amount);
|
||||
if (amount !== 1) {
|
||||
CacheDoRemakeBuildPrices = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -36,19 +36,19 @@ function CacheBuildingIncome(amount, target) {
|
||||
*/
|
||||
function CacheUpgradeIncome() {
|
||||
CacheUpgrades = [];
|
||||
for (const i of Object.keys(Game.Upgrades)) {
|
||||
Object.keys(Game.Upgrades).forEach((i) => {
|
||||
const bonusIncome = BuyUpgradesBonusIncome(i);
|
||||
CacheUpgrades[i] = {};
|
||||
if (bonusIncome[0]) CacheUpgrades[i].bonus = bonusIncome[0];
|
||||
if (bonusIncome[1]) CacheUpgrades[i].bonusMouse = bonusIncome[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This functions caches the price of each building and stores it in the cache
|
||||
*/
|
||||
export function CacheBuildingsPrices() {
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
CacheObjects1[i].price = BuildingGetPrice(
|
||||
Game.Objects[i],
|
||||
Game.Objects[i].basePrice,
|
||||
@@ -70,7 +70,7 @@ export function CacheBuildingsPrices() {
|
||||
Game.Objects[i].free,
|
||||
100,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,7 +51,7 @@ export function MaxChainCookieReward(digit, maxPayout, mult) {
|
||||
);
|
||||
nextRequired = Math.floor((1 / 9) * 10 ** (chain + 1) * digit * mult);
|
||||
totalFromChain += moni;
|
||||
chain++;
|
||||
chain += 1;
|
||||
}
|
||||
return [totalFromChain, moni, nextRequired];
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ export default function CacheAllMissingUpgrades() {
|
||||
CacheMissingUpgradesPrestige = '';
|
||||
const list = [];
|
||||
// sort the upgrades
|
||||
for (const i of Object.keys(Game.Upgrades)) {
|
||||
Object.keys(Game.Upgrades).forEach((i) => {
|
||||
list.push(Game.Upgrades[i]);
|
||||
}
|
||||
});
|
||||
const sortMap = function (a, b) {
|
||||
if (a.order > b.order) return 1;
|
||||
if (a.order < b.order) return -1;
|
||||
@@ -29,7 +29,7 @@ export default function CacheAllMissingUpgrades() {
|
||||
};
|
||||
list.sort(sortMap);
|
||||
|
||||
for (const i of Object.keys(list)) {
|
||||
Object.keys(list).forEach((i) => {
|
||||
const me = list[i];
|
||||
|
||||
if (me.bought === 0) {
|
||||
@@ -45,5 +45,5 @@ export default function CacheAllMissingUpgrades() {
|
||||
)
|
||||
CacheMissingUpgrades += str;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ export function CacheStatsCookies() {
|
||||
CacheEdifice = 0;
|
||||
let max = 0;
|
||||
let n = 0;
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
if (Game.Objects[i].amount > max) max = Game.Objects[i].amount;
|
||||
if (Game.Objects[i].amount > 0) n++;
|
||||
}
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
if (Game.Objects[i].amount > 0) n += 1;
|
||||
});
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
if (
|
||||
(Game.Objects[i].amount < max || n === 1) &&
|
||||
Game.Objects[i].amount < 400 &&
|
||||
@@ -55,7 +55,7 @@ export function CacheStatsCookies() {
|
||||
CacheEdifice = Game.Objects[i].price * 2;
|
||||
CacheEdificeBuilding = i;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,7 @@ export default function CacheWrinklers() {
|
||||
CacheWrinklersNormal = 0;
|
||||
CacheWrinklersFattest = [0, null];
|
||||
for (let i = 0; i < Game.wrinklers.length; i++) {
|
||||
let sucked = Game.wrinklers[i].sucked;
|
||||
let { sucked } = Game.wrinklers[i];
|
||||
let toSuck = 1.1;
|
||||
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
|
||||
if (Game.wrinklers[i].type === 1) toSuck *= 3; // Shiny wrinklers
|
||||
|
||||
Reference in New Issue
Block a user