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,5 +1,5 @@
{ {
"recursive": true, "recursive": true,
"require": ["esm", "ts-node/register"], "require": ["esm", "ts-node/register"],
"reporter": "min" "reporter": "min"
} }

View File

@@ -4,16 +4,10 @@
// ==/UserScript== // ==/UserScript==
const readyCheck = setInterval(() => { const readyCheck = setInterval(() => {
const Game = unsafeWindow.Game; const Game = unsafeWindow.Game;
if ( if (typeof Game !== 'undefined' && typeof Game.ready !== 'undefined' && Game.ready) {
typeof Game !== "undefined" && Game.LoadMod('https://aktanusa.github.io/CookieMonster/CookieMonster.js');
typeof Game.ready !== "undefined" && clearInterval(readyCheck);
Game.ready }
) {
Game.LoadMod(
"https://aktanusa.github.io/CookieMonster/CookieMonster.js"
);
clearInterval(readyCheck);
}
}, 1000); }, 1000);

8254
dist/CookieMonster.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -37,11 +37,7 @@ export class CMAvgQueue {
if (time > this.maxLength) time = this.maxLength; if (time > this.maxLength) time = this.maxLength;
if (time > this.queue.length) time = this.queue.length; if (time > this.queue.length) time = this.queue.length;
let ret = 0; let ret = 0;
for ( for (let i = this.queue.length - 1; i >= 0 && i > this.queue.length - 1 - time; i--) {
let i = this.queue.length - 1;
i >= 0 && i > this.queue.length - 1 - time;
i--
) {
ret += this.queue[i]; ret += this.queue[i];
} }
if (ret === 0) { if (ret === 0) {

View File

@@ -45,11 +45,9 @@ export default function CacheAvgCPS() {
// Add recent gains to AvgQueue's // Add recent gains to AvgQueue's
const timeDiff = currDate - CacheLastCPSCheck; const timeDiff = currDate - CacheLastCPSCheck;
const bankDiffAvg = Math.max(0, Game.cookies - CacheLastCookies) / timeDiff; const bankDiffAvg = Math.max(0, Game.cookies - CacheLastCookies) / timeDiff;
const wrinkDiffAvg = const wrinkDiffAvg = Math.max(0, CacheWrinklersTotal - CacheLastWrinkCookies) / timeDiff;
Math.max(0, CacheWrinklersTotal - CacheLastWrinkCookies) / timeDiff;
const wrinkFattestDiffAvg = const wrinkFattestDiffAvg =
Math.max(0, CacheWrinklersFattest[0] - CacheLastWrinkFattestCookies) / Math.max(0, CacheWrinklersFattest[0] - CacheLastWrinkFattestCookies) / timeDiff;
timeDiff;
const choEggDiffAvg = Math.max(0, choEggTotal - CacheLastChoEgg) / timeDiff; const choEggDiffAvg = Math.max(0, choEggTotal - CacheLastChoEgg) / timeDiff;
const clicksDiffAvg = (Game.cookieClicks - CacheLastClicks) / timeDiff; const clicksDiffAvg = (Game.cookieClicks - CacheLastClicks) / timeDiff;
for (let i = 0; i < timeDiff; i++) { for (let i = 0; i < timeDiff; i++) {
@@ -76,22 +74,16 @@ export default function CacheAvgCPS() {
CacheAverageGainChoEgg = ChoEggDiff.calcAverage(cpsLength); CacheAverageGainChoEgg = ChoEggDiff.calcAverage(cpsLength);
CacheAverageCPS = CacheAverageGainBank; CacheAverageCPS = CacheAverageGainBank;
if (CMOptions.CalcWrink === 1) CacheAverageCPS += CacheAverageGainWrink; if (CMOptions.CalcWrink === 1) CacheAverageCPS += CacheAverageGainWrink;
if (CMOptions.CalcWrink === 2) if (CMOptions.CalcWrink === 2) CacheAverageCPS += CacheAverageGainWrinkFattest;
CacheAverageCPS += CacheAverageGainWrinkFattest;
const choEgg = const choEgg = Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
if (choEgg || CMOptions.CalcWrink === 0) { if (choEgg || CMOptions.CalcWrink === 0) {
CacheAvgCPSWithChoEgg = CacheAvgCPSWithChoEgg =
CacheAverageGainBank + CacheAverageGainBank + CacheAverageGainWrink + (choEgg ? CacheAverageGainChoEgg : 0);
CacheAverageGainWrink +
(choEgg ? CacheAverageGainChoEgg : 0);
} else CacheAvgCPSWithChoEgg = CacheAverageCPS; // eslint-disable-line no-unused-vars } else CacheAvgCPSWithChoEgg = CacheAverageCPS; // eslint-disable-line no-unused-vars
// eslint-disable-next-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,8 +1,5 @@
import { SimObjects } from '../../Sim/VariablesAndData'; import { SimObjects } from '../../Sim/VariablesAndData';
import { import { CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult } from '../VariablesAndData';
CacheCurrWrinklerCount,
CacheCurrWrinklerCPSMult,
} from '../VariablesAndData';
/** /**
* This functions caches the current Wrinkler CPS multiplier * This functions caches the current Wrinkler CPS multiplier

View File

@@ -5,8 +5,7 @@
export default function GetCPSBuffMult() { export default function GetCPSBuffMult() {
let mult = 1; let mult = 1;
Object.keys(Game.buffs).forEach((i) => { Object.keys(Game.buffs).forEach((i) => {
if (typeof Game.buffs[i].multCpS !== 'undefined') if (typeof Game.buffs[i].multCpS !== 'undefined') mult *= Game.buffs[i].multCpS;
mult *= Game.buffs[i].multCpS;
}); });
return mult; return mult;
} }

View File

@@ -3,23 +3,14 @@ import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue';
import CacheAvgCPS from './CPS/CPS'; import CacheAvgCPS from './CPS/CPS';
import CacheDragonAuras from './Dragon/CacheDragonAuras'; import CacheDragonAuras from './Dragon/CacheDragonAuras';
import CachePP from './PP/PP'; import CachePP from './PP/PP';
import { import { CacheBuildingsPrices, CacheIncome } from './PriceAndIncome/PriceAndIncome';
CacheBuildingsPrices,
CacheIncome,
} from './PriceAndIncome/PriceAndIncome';
import { CacheChain } from './Stats/ChainCookies'; import { CacheChain } from './Stats/ChainCookies';
import CacheHeavenlyChipsPS from './Stats/HeavenlyChips'; import CacheHeavenlyChipsPS from './Stats/HeavenlyChips';
import CacheAllMissingUpgrades from './Stats/MissingUpgrades'; import CacheAllMissingUpgrades from './Stats/MissingUpgrades';
import CacheSeasonSpec from './Stats/Reindeer'; import CacheSeasonSpec from './Stats/Reindeer';
import { import { CacheGoldenAndWrathCookiesMults, CacheStatsCookies } from './Stats/Stats';
CacheGoldenAndWrathCookiesMults,
CacheStatsCookies,
} from './Stats/Stats';
import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement'; import AllAmountTillNextAchievement from './TillNextAchievement/AllAmountTillNextAchievement';
import { import { CacheAverageCookiesFromClicks, HeavenlyChipsDiff } from './VariablesAndData';
CacheAverageCookiesFromClicks,
HeavenlyChipsDiff,
} from './VariablesAndData';
import CacheWrinklers from './Wrinklers/Wrinklers'; import CacheWrinklers from './Wrinklers/Wrinklers';
/** /**
@@ -36,9 +27,7 @@ export default function InitCache() {
InitCookiesDiff(); InitCookiesDiff();
/** Used by CM.Cache.CacheHeavenlyChipsPS() */ /** Used by CM.Cache.CacheHeavenlyChipsPS() */
HeavenlyChipsDiff = new CMAvgQueue(5); // eslint-disable-line no-unused-vars HeavenlyChipsDiff = new CMAvgQueue(5); // eslint-disable-line no-unused-vars
CacheAverageCookiesFromClicks = new CMAvgQueue( // eslint-disable-line no-unused-vars CacheAverageCookiesFromClicks = new CMAvgQueue(ClickTimes[ClickTimes.length - 1] * 20); // eslint-disable-line no-unused-vars
ClickTimes[ClickTimes.length - 1] * 20,
);
CacheHeavenlyChipsPS(); CacheHeavenlyChipsPS();
AllAmountTillNextAchievement(); AllAmountTillNextAchievement();
CacheAvgCPS(); CacheAvgCPS();

View File

@@ -22,8 +22,7 @@ export default function LoopCache() {
const cookiesToNext = const cookiesToNext =
Game.HowManyCookiesReset( Game.HowManyCookiesReset(
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + 1,
1,
) - ) -
(Game.cookiesEarned + Game.cookiesReset); (Game.cookiesEarned + Game.cookiesReset);
CacheTimeTillNextPrestige = FormatTime(cookiesToNext / GetCPS()); // eslint-disable-line no-unused-vars CacheTimeTillNextPrestige = FormatTime(cookiesToNext / GetCPS()); // eslint-disable-line no-unused-vars

View File

@@ -3,10 +3,7 @@
import Beautify from '../../Disp/BeautifyAndFormatting/Beautify'; import Beautify from '../../Disp/BeautifyAndFormatting/Beautify';
import CopyData from '../../Sim/SimulationData/CopyData'; import CopyData from '../../Sim/SimulationData/CopyData';
import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData'; import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData';
import { import { CacheCostDragonUpgrade, CacheLastDragonLevel } from '../VariablesAndData';
CacheCostDragonUpgrade,
CacheLastDragonLevel,
} from '../VariablesAndData';
/** /**
* This functions caches the current cost of upgrading the dragon level so it can be displayed in the tooltip * This functions caches the current cost of upgrading the dragon level so it can be displayed in the tooltip
@@ -17,9 +14,7 @@ export default function CacheDragonCost() {
Game.dragonLevel < 25 && Game.dragonLevel < 25 &&
Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice') Game.dragonLevels[Game.dragonLevel].buy.toString().includes('sacrifice')
) { ) {
let target = Game.dragonLevels[Game.dragonLevel].buy let target = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1];
.toString()
.match(/Objects\[(.*)\]/)[1];
const amount = Game.dragonLevels[Game.dragonLevel].buy const amount = Game.dragonLevels[Game.dragonLevel].buy
.toString() .toString()
.match(/sacrifice\((.*?)\)/)[1]; .match(/sacrifice\((.*?)\)/)[1];
@@ -34,10 +29,7 @@ export default function CacheDragonCost() {
let price = let price =
SimObjects[target].basePrice * SimObjects[target].basePrice *
Game.priceIncrease ** Game.priceIncrease **
Math.max( Math.max(0, SimObjects[target].amount - 1 - SimObjects[target].free);
0,
SimObjects[target].amount - 1 - SimObjects[target].free,
);
price = Game.modifyBuildingPrice(SimObjects[target], price); price = Game.modifyBuildingPrice(SimObjects[target], price);
price = Math.ceil(price); price = Math.ceil(price);
cost += price; cost += price;
@@ -58,10 +50,7 @@ export default function CacheDragonCost() {
let price = let price =
SimObjects[target].basePrice * SimObjects[target].basePrice *
Game.priceIncrease ** Game.priceIncrease **
Math.max( Math.max(0, SimObjects[target].amount - 1 - SimObjects[target].free);
0,
SimObjects[target].amount - 1 - SimObjects[target].free,
);
price = Game.modifyBuildingPrice(SimObjects[target], price); price = Game.modifyBuildingPrice(SimObjects[target], price);
price = Math.ceil(price); price = Math.ceil(price);
cost += price; cost += price;

View File

@@ -22,10 +22,7 @@ function CacheColour(target, amount) {
return; return;
} }
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
target[i].color = ColourOfPP( target[i].color = ColourOfPP(target[i], Game.Objects[i].getSumPrice(amount));
target[i],
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; // eslint-disable-line no-param-reassign if (target[i].pp === CachePPArray[j][0]) target[i].color = ColourGray; // eslint-disable-line no-param-reassign
@@ -38,12 +35,10 @@ function CachePP(target, amount) {
const price = Game.Objects[i].getSumPrice(amount); const price = Game.Objects[i].getSumPrice(amount);
if (Game.cookiesPs) { if (Game.cookiesPs) {
target[i].pp = // eslint-disable-line no-param-reassign 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; // eslint-disable-line no-param-reassign } 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]);
}); });
} }

View File

@@ -31,8 +31,7 @@ export default function ColourOfPP(me, price) {
// Colour based on price in terms of CPS // Colour based on price in terms of CPS
if (Number(CMOptions.PPSecondsLowerLimit) !== 0) { if (Number(CMOptions.PPSecondsLowerLimit) !== 0) {
if (price / GetCPS() < Number(CMOptions.PPSecondsLowerLimit)) if (price / GetCPS() < Number(CMOptions.PPSecondsLowerLimit)) color = ColourBlue;
color = ColourBlue;
} }
// Colour based on being able to purchase // Colour based on being able to purchase
if (CMOptions.PPOnlyConsiderBuyable) { if (CMOptions.PPOnlyConsiderBuyable) {

View File

@@ -10,20 +10,12 @@ export default function CacheUpgradePP() {
Object.keys(CacheUpgrades).forEach((i) => { Object.keys(CacheUpgrades).forEach((i) => {
if (Game.cookiesPs) { if (Game.cookiesPs) {
CacheUpgrades[i].pp = CacheUpgrades[i].pp =
Math.max( Math.max(Game.Upgrades[i].getPrice() - (Game.cookies + GetWrinkConfigBank()), 0) /
Game.Upgrades[i].getPrice() - (Game.cookies + GetWrinkConfigBank()),
0,
) /
Game.cookiesPs + Game.cookiesPs +
Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus; Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus;
} else } else CacheUpgrades[i].pp = Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus;
CacheUpgrades[i].pp =
Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus;
if (Number.isNaN(CacheUpgrades[i].pp)) CacheUpgrades[i].pp = Infinity; if (Number.isNaN(CacheUpgrades[i].pp)) CacheUpgrades[i].pp = Infinity;
CacheUpgrades[i].color = ColourOfPP( CacheUpgrades[i].color = ColourOfPP(CacheUpgrades[i], Game.Upgrades[i].getPrice());
CacheUpgrades[i],
Game.Upgrades[i].getPrice(),
);
}); });
} }

View File

@@ -44,10 +44,8 @@ function CacheUpgradeIncome() {
const bonusIncome = BuyUpgradesBonusIncome(i); const bonusIncome = BuyUpgradesBonusIncome(i);
if (i === 'Elder Pledge') { if (i === 'Elder Pledge') {
CacheUpgrades[i] = { bonus: Game.cookiesPs - CacheAverageGainBank }; CacheUpgrades[i] = { bonus: Game.cookiesPs - CacheAverageGainBank };
if (CMOptions.CalcWrink === 1) if (CMOptions.CalcWrink === 1) CacheUpgrades[i].bonus -= CacheAverageGainWrink;
CacheUpgrades[i].bonus -= CacheAverageGainWrink; else if (CMOptions.CalcWrink === 2) CacheUpgrades[i].bonus -= CacheAverageGainWrinkFattest;
else if (CMOptions.CalcWrink === 2)
CacheUpgrades[i].bonus -= CacheAverageGainWrinkFattest;
if (!Number.isFinite(CacheUpgrades[i].bonus)) CacheUpgrades[i].bonus = 0; if (!Number.isFinite(CacheUpgrades[i].bonus)) CacheUpgrades[i].bonus = 0;
} else { } else {
CacheUpgrades[i] = {}; CacheUpgrades[i] = {};

View File

@@ -31,22 +31,15 @@ export function MaxChainCookieReward(digit, maxPayout, mult) {
let moni = 0; let moni = 0;
let nextMoni = 0; let nextMoni = 0;
let nextRequired = 0; let nextRequired = 0;
let chain = let chain = 1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10);
1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10);
while (nextMoni < maxPayout * mult) { while (nextMoni < maxPayout * mult) {
moni = Math.max( moni = Math.max(
digit, digit,
Math.min( Math.min(Math.floor((1 / 9) * 10 ** chain * digit * mult), maxPayout * mult),
Math.floor((1 / 9) * 10 ** chain * digit * mult),
maxPayout * mult,
),
); );
nextMoni = Math.max( nextMoni = Math.max(
digit, digit,
Math.min( Math.min(Math.floor((1 / 9) * 10 ** (chain + 1) * digit * mult), maxPayout * mult),
Math.floor((1 / 9) * 10 ** (chain + 1) * digit * mult),
maxPayout * mult,
),
); );
nextRequired = Math.floor((1 / 9) * 10 ** (chain + 1) * digit * mult); nextRequired = Math.floor((1 / 9) * 10 ** (chain + 1) * digit * mult);
totalFromChain += moni; totalFromChain += moni;
@@ -72,65 +65,28 @@ export function MaxChainCookieReward(digit, maxPayout, mult) {
* @global {number} CM.Cache.ChainFrenzyWrathRequiredNext Total cookies needed for next level for wrath frenzy chain * @global {number} CM.Cache.ChainFrenzyWrathRequiredNext Total cookies needed for next level for wrath frenzy chain
*/ */
export function CacheChain() { export function CacheChain() {
let maxPayout = let maxPayout = CacheNoGoldSwitchCookiesPS * 60 * 60 * 6 * CacheDragonsFortuneMultAdjustment;
CacheNoGoldSwitchCookiesPS *
60 *
60 *
6 *
CacheDragonsFortuneMultAdjustment;
// Removes effect of Frenzy etc. // Removes effect of Frenzy etc.
const cpsBuffMult = GetCPSBuffMult(); const cpsBuffMult = GetCPSBuffMult();
if (cpsBuffMult > 0) maxPayout /= cpsBuffMult; if (cpsBuffMult > 0) maxPayout /= cpsBuffMult;
else maxPayout = 0; else maxPayout = 0;
CacheChainMaxReward = MaxChainCookieReward( CacheChainMaxReward = MaxChainCookieReward(7, maxPayout, CacheGoldenCookiesMult);
7,
maxPayout,
CacheGoldenCookiesMult,
);
CacheChainRequired = (CacheChainMaxReward[1] * 2) / CacheGoldenCookiesMult; // eslint-disable-line no-unused-vars CacheChainRequired = (CacheChainMaxReward[1] * 2) / CacheGoldenCookiesMult; // eslint-disable-line no-unused-vars
CacheChainRequiredNext = // eslint-disable-line no-unused-vars CacheChainRequiredNext = CacheChainMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment; // eslint-disable-line no-unused-vars
CacheChainMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
CacheChainWrathMaxReward = MaxChainCookieReward( CacheChainWrathMaxReward = MaxChainCookieReward(6, maxPayout, CacheWrathCookiesMult);
6, CacheChainWrathRequired = (CacheChainWrathMaxReward[1] * 2) / CacheWrathCookiesMult; // eslint-disable-line no-unused-vars
maxPayout,
CacheWrathCookiesMult,
);
CacheChainWrathRequired = // eslint-disable-line no-unused-vars
(CacheChainWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
CacheChainWrathRequiredNext = // eslint-disable-line no-unused-vars CacheChainWrathRequiredNext = // eslint-disable-line no-unused-vars
CacheChainWrathMaxReward[2] / CacheChainWrathMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
60 /
60 /
6 /
CacheDragonsFortuneMultAdjustment;
CacheChainFrenzyMaxReward = MaxChainCookieReward( CacheChainFrenzyMaxReward = MaxChainCookieReward(7, maxPayout * 7, CacheGoldenCookiesMult);
7, CacheChainFrenzyRequired = (CacheChainFrenzyMaxReward[1] * 2) / CacheGoldenCookiesMult; // eslint-disable-line no-unused-vars
maxPayout * 7,
CacheGoldenCookiesMult,
);
CacheChainFrenzyRequired = // eslint-disable-line no-unused-vars
(CacheChainFrenzyMaxReward[1] * 2) / CacheGoldenCookiesMult;
CacheChainFrenzyRequiredNext = // eslint-disable-line no-unused-vars CacheChainFrenzyRequiredNext = // eslint-disable-line no-unused-vars
CacheChainFrenzyMaxReward[2] / CacheChainFrenzyMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
60 /
60 /
6 /
CacheDragonsFortuneMultAdjustment;
CacheChainFrenzyWrathMaxReward = MaxChainCookieReward( CacheChainFrenzyWrathMaxReward = MaxChainCookieReward(6, maxPayout * 7, CacheWrathCookiesMult);
6, CacheChainFrenzyWrathRequired = (CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult; // eslint-disable-line no-unused-vars
maxPayout * 7,
CacheWrathCookiesMult,
);
CacheChainFrenzyWrathRequired = // eslint-disable-line no-unused-vars
(CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
CacheChainFrenzyWrathRequiredNext = // eslint-disable-line no-unused-vars CacheChainFrenzyWrathRequiredNext = // eslint-disable-line no-unused-vars
CacheChainFrenzyWrathMaxReward[2] / CacheChainFrenzyWrathMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
60 /
60 /
6 /
CacheDragonsFortuneMultAdjustment;
} }

View File

@@ -15,15 +15,12 @@ export default function CacheHeavenlyChipsPS() {
// Only calculate every new second // Only calculate every new second
if ((Game.T / Game.fps) % 1 === 0) { if ((Game.T / Game.fps) % 1 === 0) {
const chipsOwned = Game.HowMuchPrestige(Game.cookiesReset); const chipsOwned = Game.HowMuchPrestige(Game.cookiesReset);
const ascendNowToOwn = Math.floor( const ascendNowToOwn = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned),
);
const ascendNowToGet = ascendNowToOwn - Math.floor(chipsOwned); const ascendNowToGet = ascendNowToOwn - Math.floor(chipsOwned);
// Add recent gains to AvgQueue's // Add recent gains to AvgQueue's
const timeDiff = currDate - CacheLastHeavenlyCheck; const timeDiff = currDate - CacheLastHeavenlyCheck;
const heavenlyChipsDiffAvg = const heavenlyChipsDiffAvg = Math.max(0, ascendNowToGet - CacheLastHeavenlyChips) / timeDiff;
Math.max(0, ascendNowToGet - CacheLastHeavenlyChips) / timeDiff;
for (let i = 0; i < timeDiff; i++) { for (let i = 0; i < timeDiff; i++) {
HeavenlyChipsDiff.addLatest(heavenlyChipsDiffAvg); HeavenlyChipsDiff.addLatest(heavenlyChipsDiffAvg);
} }

View File

@@ -38,11 +38,7 @@ export default function CacheAllMissingUpgrades() {
/* eslint-disable no-unused-vars */ /* 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 (me.pool !== 'toggle' && me.pool !== 'unused' && me.pool !== 'debug')
me.pool !== 'toggle' &&
me.pool !== 'unused' &&
me.pool !== 'debug'
)
CacheMissingUpgrades += str; CacheMissingUpgrades += str;
/* eslint-enable no-unused-vars */ /* eslint-enable no-unused-vars */
} }

View File

@@ -31,10 +31,8 @@ export function CacheStatsCookies() {
CacheLuckyReward = CacheGoldenCookiesMult * (CacheLucky * 0.15) + 13; // eslint-disable-line no-unused-vars CacheLuckyReward = CacheGoldenCookiesMult * (CacheLucky * 0.15) + 13; // eslint-disable-line no-unused-vars
CacheLuckyWrathReward = CacheWrathCookiesMult * (CacheLucky * 0.15) + 13; // eslint-disable-line no-unused-vars CacheLuckyWrathReward = CacheWrathCookiesMult * (CacheLucky * 0.15) + 13; // eslint-disable-line no-unused-vars
CacheLuckyFrenzy = CacheLucky * 7; CacheLuckyFrenzy = CacheLucky * 7;
CacheLuckyRewardFrenzy = // eslint-disable-line no-unused-vars CacheLuckyRewardFrenzy = CacheGoldenCookiesMult * (CacheLuckyFrenzy * 0.15) + 13; // eslint-disable-line no-unused-vars
CacheGoldenCookiesMult * (CacheLuckyFrenzy * 0.15) + 13; CacheLuckyWrathRewardFrenzy = CacheWrathCookiesMult * (CacheLuckyFrenzy * 0.15) + 13; // eslint-disable-line no-unused-vars
CacheLuckyWrathRewardFrenzy = // eslint-disable-line no-unused-vars
CacheWrathCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
CacheConjure = CacheLucky * 2; CacheConjure = CacheLucky * 2;
CacheConjureReward = CacheConjure * 0.15; // eslint-disable-line no-unused-vars CacheConjureReward = CacheConjure * 0.15; // eslint-disable-line no-unused-vars
@@ -84,7 +82,6 @@ export function CacheGoldenAndWrathCookiesMults() {
// Otherwise, the aura effect will be factored in the base CPS making the multiplier not requiring adjustment. // Otherwise, the aura effect will be factored in the base CPS making the multiplier not requiring adjustment.
CacheDragonsFortuneMultAdjustment = 1; CacheDragonsFortuneMultAdjustment = 1;
if (Game.shimmerTypes.golden.n === 0) { if (Game.shimmerTypes.golden.n === 0) {
CacheDragonsFortuneMultAdjustment *= CacheDragonsFortuneMultAdjustment *= 1 + Game.auraMult("Dragon's Fortune") * 1.23;
1 + Game.auraMult("Dragon's Fortune") * 1.23;
} }
} }

View File

@@ -10,8 +10,7 @@ export default function AllAmountTillNextAchievement() {
CacheObjectsNextAchievement[i].TotalNeeded > Game.Objects[i].amount CacheObjectsNextAchievement[i].TotalNeeded > Game.Objects[i].amount
) { ) {
result[i] = { result[i] = {
AmountNeeded: AmountNeeded: CacheObjectsNextAchievement[i].TotalNeeded - Game.Objects[i].amount,
CacheObjectsNextAchievement[i].TotalNeeded - Game.Objects[i].amount,
TotalNeeded: CacheObjectsNextAchievement[i].TotalNeeded, TotalNeeded: CacheObjectsNextAchievement[i].TotalNeeded,
}; };
} else { } else {

View File

@@ -34,8 +34,7 @@ export default function CacheWrinklers() {
CacheWrinklersTotal += sucked; // eslint-disable-line no-unused-vars CacheWrinklersTotal += sucked; // eslint-disable-line no-unused-vars
if (Game.wrinklers[i].type === 0) { if (Game.wrinklers[i].type === 0) {
CacheWrinklersNormal += sucked; // eslint-disable-line no-unused-vars CacheWrinklersNormal += sucked; // eslint-disable-line no-unused-vars
if (sucked > CacheWrinklersFattest[0]) if (sucked > CacheWrinklersFattest[0]) CacheWrinklersFattest = [sucked, i];
CacheWrinklersFattest = [sucked, i];
} }
} }
} }

View File

@@ -19,14 +19,8 @@ export function SaveConfig() {
); );
const CookieMonsterSave = saveString.match(/CookieMonster.*(;|$)/); const CookieMonsterSave = saveString.match(/CookieMonster.*(;|$)/);
if (CookieMonsterSave !== null) { if (CookieMonsterSave !== null) {
const newSaveString = saveString.replace( const newSaveString = saveString.replace(CookieMonsterSave[0], `CookieMonster:${save()}`);
CookieMonsterSave[0], localStorage.setItem('CookieClickerGame', escape(`${utf8_to_b64(newSaveString)}!END!`));
`CookieMonster:${save()}`,
);
localStorage.setItem(
'CookieClickerGame',
escape(`${utf8_to_b64(newSaveString)}!END!`),
);
} }
} }

View File

@@ -7,15 +7,9 @@ import { CMOptions } from './VariablesAndData';
* This function changes the position of both the bottom and timer bar * This function changes the position of both the bottom and timer bar
*/ */
export function UpdateBotTimerBarPosition() { export function UpdateBotTimerBarPosition() {
if ( if (CMOptions.BotBar === 1 && CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 1) {
CMOptions.BotBar === 1 &&
CMOptions.TimerBar === 1 &&
CMOptions.TimerBarPos === 1
) {
l('CMBotBar').style.bottom = l('CMTimerBar').style.height; l('CMBotBar').style.bottom = l('CMTimerBar').style.height;
l('game').style.bottom = `${ l('game').style.bottom = `${Number(l('CMTimerBar').style.height.replace('px', '')) + 70}px`;
Number(l('CMTimerBar').style.height.replace('px', '')) + 70
}px`;
} else if (CMOptions.BotBar === 1) { } else if (CMOptions.BotBar === 1) {
l('CMBotBar').style.bottom = '0px'; l('CMBotBar').style.bottom = '0px';
l('game').style.bottom = '70px'; l('game').style.bottom = '70px';

View File

@@ -17,8 +17,7 @@ export function ToggleConfig(config) {
if (CMOptions[config] === ConfigData[config].label.length) { if (CMOptions[config] === ConfigData[config].label.length) {
CMOptions[config] = 0; CMOptions[config] = 0;
if (ConfigData[config].toggle) if (ConfigData[config].toggle) l(ConfigPrefix + config).className = 'option off';
l(ConfigPrefix + config).className = 'option off';
} else l(ConfigPrefix + config).className = 'option'; } else l(ConfigPrefix + config).className = 'option';
if (typeof ConfigData[config].func !== 'undefined') { if (typeof ConfigData[config].func !== 'undefined') {

View File

@@ -77,15 +77,13 @@ const ConfigDefault: {
ColourFortuneFlash: '#ffffff', ColourFortuneFlash: '#ffffff',
FortuneSound: 1, FortuneSound: 1,
FortuneVolume: 100, FortuneVolume: 100,
FortuneSoundURL: FortuneSoundURL: 'https://freesound.org/data/previews/174/174027_3242494-lq.mp3',
'https://freesound.org/data/previews/174/174027_3242494-lq.mp3',
SeaNotification: 0, SeaNotification: 0,
SeaFlash: 1, SeaFlash: 1,
ColourSeaFlash: '#ffffff', ColourSeaFlash: '#ffffff',
SeaSound: 1, SeaSound: 1,
SeaVolume: 100, SeaVolume: 100,
SeaSoundURL: SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
GardFlash: 1, GardFlash: 1,
ColourGardFlash: '#ffffff', ColourGardFlash: '#ffffff',
GardSound: 1, GardSound: 1,
@@ -96,22 +94,19 @@ const ConfigDefault: {
ColourMagicFlash: '#ffffff', ColourMagicFlash: '#ffffff',
MagicSound: 1, MagicSound: 1,
MagicVolume: 100, MagicVolume: 100,
MagicSoundURL: MagicSoundURL: 'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
WrinklerNotification: 0, WrinklerNotification: 0,
WrinklerFlash: 1, WrinklerFlash: 1,
ColourWrinklerFlash: '#ffffff', ColourWrinklerFlash: '#ffffff',
WrinklerSound: 1, WrinklerSound: 1,
WrinklerVolume: 100, WrinklerVolume: 100,
WrinklerSoundURL: WrinklerSoundURL: 'https://freesound.org/data/previews/124/124186_8043-lq.mp3',
'https://freesound.org/data/previews/124/124186_8043-lq.mp3',
WrinklerMaxNotification: 0, WrinklerMaxNotification: 0,
WrinklerMaxFlash: 1, WrinklerMaxFlash: 1,
ColourWrinklerMaxFlash: '#ffffff', ColourWrinklerMaxFlash: '#ffffff',
WrinklerMaxSound: 1, WrinklerMaxSound: 1,
WrinklerMaxVolume: 100, WrinklerMaxVolume: 100,
WrinklerMaxSoundURL: WrinklerMaxSoundURL: 'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
BulkBuyBlock: 0, BulkBuyBlock: 0,
FavouriteSettings: 1, FavouriteSettings: 1,
Header: { Header: {

View File

@@ -1,11 +1,7 @@
/** General functions to format or beautify strings */ /** General functions to format or beautify strings */
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { import { metric, shortScale, shortScaleAbbreviated } from '../../Data/Scales.ts';
metric,
shortScale,
shortScaleAbbreviated,
} from '../../Data/Scales.ts';
import { BackupFunctions } from '../../Main/VariablesAndData'; import { BackupFunctions } from '../../Main/VariablesAndData';
/** /**
@@ -44,12 +40,8 @@ export default function Beautify(num, floats, forced) {
answer = num.toExponential(decimals).toString().replace('e', 'E'); answer = num.toExponential(decimals).toString().replace('e', 'E');
} else { } else {
const exponential = num.toExponential().toString(); const exponential = num.toExponential().toString();
const AmountOfTenPowerThree = Math.floor( const AmountOfTenPowerThree = Math.floor(exponential.slice(exponential.indexOf('e') + 1) / 3);
exponential.slice(exponential.indexOf('e') + 1) / 3, answer = (num / Number(`1e${AmountOfTenPowerThree * 3}`)).toFixed(decimals);
);
answer = (num / Number(`1e${AmountOfTenPowerThree * 3}`)).toFixed(
decimals,
);
// answer is now "xxx.xx" (e.g., 123456789 would be 123.46) // answer is now "xxx.xx" (e.g., 123456789 would be 123.46)
if ((CMOptions.Scale === 1 && !forced) || forced === 1) { if ((CMOptions.Scale === 1 && !forced) || forced === 1) {
// Metric scale, 123456789 => 123.457 M // Metric scale, 123456789 => 123.457 M
@@ -63,10 +55,7 @@ export default function Beautify(num, floats, forced) {
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation } else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
} else if ((CMOptions.Scale === 3 && !forced) || forced === 3) { } else if ((CMOptions.Scale === 3 && !forced) || forced === 3) {
// Short scale, 123456789 => 123.457 M // Short scale, 123456789 => 123.457 M
if ( if (num >= 0.01 && num < Number(`1e${shortScaleAbbreviated.length * 3}`)) {
num >= 0.01 &&
num < Number(`1e${shortScaleAbbreviated.length * 3}`)
) {
answer += ` ${shortScaleAbbreviated[AmountOfTenPowerThree]}`; answer += ` ${shortScaleAbbreviated[AmountOfTenPowerThree]}`;
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation } else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
} else if ((CMOptions.Scale === 5 && !forced) || forced === 5) { } else if ((CMOptions.Scale === 5 && !forced) || forced === 5) {
@@ -76,9 +65,7 @@ export default function Beautify(num, floats, forced) {
} }
if (answer === '') { if (answer === '') {
// eslint-disable-next-line no-console // 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}`,
);
answer = BackupFunctions.Beautify(num, floats); answer = BackupFunctions.Beautify(num, floats);
} }
if (CMOptions.ScaleSeparator) answer = answer.replace('.', ','); if (CMOptions.ScaleSeparator) answer = answer.replace('.', ',');

View File

@@ -25,8 +25,7 @@ export default function FormatTime(time, longFormat) {
str += `${(m < 10 ? '0' : '') + m}:`; str += `${(m < 10 ? '0' : '') + m}:`;
str += (s < 10 ? '0' : '') + s; str += (s < 10 ? '0' : '') + s;
} else { } else {
if (formattedTime > 777600000) if (formattedTime > 777600000) 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')}, ` // eslint-disable-line no-nested-ternary ? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` // eslint-disable-line no-nested-ternary

View File

@@ -1,10 +1,5 @@
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { import { ColourGreen, ColourOrange, ColourRed, ColourYellow } from '../VariablesAndData';
ColourGreen,
ColourOrange,
ColourRed,
ColourYellow,
} from '../VariablesAndData';
import FormatTime from './FormatTime'; import FormatTime from './FormatTime';
/** /**

View File

@@ -1,8 +1,4 @@
import { import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
CacheObjects1,
CacheObjects10,
CacheObjects100,
} from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding'; import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
import Beautify from '../BeautifyAndFormatting/Beautify'; import Beautify from '../BeautifyAndFormatting/Beautify';
@@ -31,8 +27,7 @@ export default function UpdateBuildings() {
if (Game.buyMode === 1) { if (Game.buyMode === 1) {
if (CMOptions.BuildColour === 1) { if (CMOptions.BuildColour === 1) {
Object.keys(target).forEach((i) => { Object.keys(target).forEach((i) => {
l(`productPrice${Game.Objects[i].id}`).style.color = l(`productPrice${Game.Objects[i].id}`).style.color = CMOptions[`Colour${target[i].color}`];
CMOptions[`Colour${target[i].color}`];
}); });
} else { } else {
Object.keys(Game.Objects).forEach((i) => { Object.keys(Game.Objects).forEach((i) => {
@@ -70,14 +65,16 @@ export default function UpdateBuildings() {
return o; return o;
}); });
arr.sort((a, b) => ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary arr.sort((a, b) =>
ColoursOrdering.indexOf(b.color) ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color)
? 1 ? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary : 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
: 0); : 0,
);
} else if (CMOptions.SortBuildings === 2) { } else if (CMOptions.SortBuildings === 2) {
arr = Object.keys(target).map((k) => { arr = Object.keys(target).map((k) => {
const o = target[k]; const o = target[k];
@@ -86,14 +83,16 @@ export default function UpdateBuildings() {
return o; return o;
}); });
arr.sort((a, b) => ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary arr.sort((a, b) =>
ColoursOrdering.indexOf(b.color) ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
ColoursOrdering.indexOf(b.color)
? 1 ? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary : 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
: 0); : 0,
);
} }
for (let x = 0; x < arr.length; x++) { for (let x = 0; x < arr.length; x++) {

View File

@@ -38,24 +38,12 @@ function CreateUpgradeBarLegend() {
return div; return div;
}; };
legend.appendChild( legend.appendChild(legendLine(ColourBlue, 'Better than the best PP of a building option'));
legendLine(ColourBlue, 'Better than the best PP of a building option'), legend.appendChild(legendLine(ColourGreen, 'Same as the best PP building option'));
); legend.appendChild(legendLine(ColourYellow, 'Within the top 10 of PP for buildings'));
legend.appendChild( legend.appendChild(legendLine(ColourOrange, 'Within the top 20 of PP for buildings'));
legendLine(ColourGreen, 'Same as the best PP building option'), legend.appendChild(legendLine(ColourRed, 'Within the top 30 of PP for buildings'));
); legend.appendChild(legendLine(ColourPurple, 'Outside of the top 30 of PP for buildings'));
legend.appendChild(
legendLine(ColourYellow, 'Within the top 10 of PP for buildings'),
);
legend.appendChild(
legendLine(ColourOrange, 'Within the top 20 of PP for buildings'),
);
legend.appendChild(
legendLine(ColourRed, 'Within the top 30 of PP for buildings'),
);
legend.appendChild(
legendLine(ColourPurple, 'Outside of the top 30 of PP for buildings'),
);
legend.appendChild(legendLine(ColourGray, 'Negative or infinity PP')); legend.appendChild(legendLine(ColourGray, 'Negative or infinity PP'));
return legend; return legend;
} }
@@ -99,8 +87,5 @@ export default function CreateUpgradeBar() {
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarPurple', ColourPurple)); UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarPurple', ColourPurple));
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGray', ColourGray)); UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGray', ColourGray));
l('upgrades').parentNode.insertBefore( l('upgrades').parentNode.insertBefore(UpgradeBar, l('upgrades').parentNode.childNodes[3]);
UpgradeBar,
l('upgrades').parentNode.childNodes[3],
);
} }

View File

@@ -33,11 +33,8 @@ export default function UpdateUpgrades() {
const me = Game.UpgradesInStore[i]; const me = Game.UpgradesInStore[i];
let addedColour = false; let addedColour = false;
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) { for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
if ( if (l(`upgrade${i}`).childNodes[j].className.indexOf(ColourBackPre) !== -1) {
l(`upgrade${i}`).childNodes[j].className.indexOf(ColourBackPre) !== -1 l(`upgrade${i}`).childNodes[j].className = ColourBackPre + CacheUpgrades[me.name].color;
) {
l(`upgrade${i}`).childNodes[j].className =
ColourBackPre + CacheUpgrades[me.name].color;
addedColour = true; addedColour = true;
break; break;
} }
@@ -79,13 +76,15 @@ export default function UpdateUpgrades() {
} }
if (CMOptions.SortUpgrades) { if (CMOptions.SortUpgrades) {
arr.sort((a, b) => ColoursOrdering.indexOf(a.color) > ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) > ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
? 1 ? 1
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary : 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
: 0); : 0,
);
} else { } else {
arr.sort((a, b) => a.price - b.price); arr.sort((a, b) => a.price - b.price);
} }
@@ -94,7 +93,6 @@ export default function UpdateUpgrades() {
return arr2.findIndex((e) => e.name === upgrade.name); return arr2.findIndex((e) => e.name === upgrade.name);
}; };
for (let x = 0; x < Game.UpgradesInStore.length; x += 1) { for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
l(`upgrade${x}`).style.order = l(`upgrade${x}`).style.order = nameChecker(arr, Game.UpgradesInStore[x]) + 1;
nameChecker(arr, Game.UpgradesInStore[x]) + 1;
} }
} }

View File

@@ -14,17 +14,14 @@ import FormatTime from '../BeautifyAndFormatting/FormatTime';
export function AddAuraInfo(aura) { export function AddAuraInfo(aura) {
if (CMOptions.DragonAuraInfo === 1) { if (CMOptions.DragonAuraInfo === 1) {
const [bonusCPS, priceOfChange] = CalculateChangeAura(aura); const [bonusCPS, priceOfChange] = CalculateChangeAura(aura);
const timeToRecover = FormatTime( const timeToRecover = FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs));
priceOfChange / (bonusCPS + Game.cookiesPs),
);
let bonusCPSPercentage; let bonusCPSPercentage;
if (Game.cookiesPs === 0) bonusCPSPercentage = Beautify(Infinity); if (Game.cookiesPs === 0) bonusCPSPercentage = Beautify(Infinity);
else bonusCPSPercentage = Beautify((bonusCPS / Game.cookiesPs) * 100); else bonusCPSPercentage = Beautify((bonusCPS / Game.cookiesPs) * 100);
l('dragonAuraInfo').style.minHeight = '60px'; l('dragonAuraInfo').style.minHeight = '60px';
l('dragonAuraInfo').style.margin = '8px'; l('dragonAuraInfo').style.margin = '8px';
l('dragonAuraInfo').appendChild(document.createElement('div')).className = l('dragonAuraInfo').appendChild(document.createElement('div')).className = 'line';
'line';
const div = document.createElement('div'); const div = document.createElement('div');
div.style.minWidth = '200px'; div.style.minWidth = '200px';
div.style.textAlign = 'center'; div.style.textAlign = 'center';

View File

@@ -27,10 +27,8 @@ export default function CreateGCTimer(cookie) {
cookie.pop(); cookie.pop();
}; };
GCTimer.onmouseover = function () { GCTimer.onmouseover = function () {
cookie.l.style.filter = // eslint-disable-line no-param-reassign cookie.l.style.filter = 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; // eslint-disable-line no-param-reassign
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; cookie.l.style.webkitFilter = 'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))'; // eslint-disable-line no-param-reassign
cookie.l.style.webkitFilter = // eslint-disable-line no-param-reassign
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
}; };
GCTimer.onmouseout = function () { GCTimer.onmouseout = function () {
cookie.l.style.filter = ''; // eslint-disable-line no-param-reassign cookie.l.style.filter = ''; // eslint-disable-line no-param-reassign

View File

@@ -5,11 +5,7 @@
* @param {number} targetMagic The target magic level * @param {number} targetMagic The target magic level
* @returns {number} count / Game.fps The time it takes to reach targetMagic * @returns {number} count / Game.fps The time it takes to reach targetMagic
*/ */
export default function CalculateGrimoireRefillTime( export default function CalculateGrimoireRefillTime(currentMagic, maxMagic, targetMagic) {
currentMagic,
maxMagic,
targetMagic,
) {
let magic = currentMagic; let magic = currentMagic;
let count = 0; let count = 0;
while (magic < targetMagic) { while (magic < targetMagic) {

View File

@@ -18,16 +18,10 @@ export default function GetCPS() {
return Game.cookiesPs * (1 - Game.cpsSucked); return Game.cookiesPs * (1 - Game.cpsSucked);
} }
if (CMOptions.CalcWrink === 1) { if (CMOptions.CalcWrink === 1) {
return ( return Game.cookiesPs * (CacheCurrWrinklerCPSMult + (1 - CacheCurrWrinklerCount * 0.05));
Game.cookiesPs *
(CacheCurrWrinklerCPSMult + (1 - CacheCurrWrinklerCount * 0.05))
);
} }
if (CacheWrinklersFattest[1] !== null) if (CacheWrinklersFattest[1] !== null)
if ( if (CMOptions.CalcWrink === 2 && Game.wrinklers[CacheWrinklersFattest[1]].type === 1) {
CMOptions.CalcWrink === 2 &&
Game.wrinklers[CacheWrinklersFattest[1]].type === 1
) {
return ( return (
Game.cookiesPs * Game.cookiesPs *
((CacheCurrWrinklerCPSMult * 3) / CacheCurrWrinklerCount + ((CacheCurrWrinklerCPSMult * 3) / CacheCurrWrinklerCount +
@@ -36,7 +30,6 @@ export default function GetCPS() {
} }
return ( return (
Game.cookiesPs * Game.cookiesPs *
(CacheCurrWrinklerCPSMult / CacheCurrWrinklerCount + (CacheCurrWrinklerCPSMult / CacheCurrWrinklerCount + (1 - CacheCurrWrinklerCount * 0.05))
(1 - CacheCurrWrinklerCount * 0.05))
); );
} }

View File

@@ -1,7 +1,4 @@
import { import { CacheWrinklersFattest, CacheWrinklersTotal } from '../../Cache/VariablesAndData';
CacheWrinklersFattest,
CacheWrinklersTotal,
} from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
/** /**

View File

@@ -5,11 +5,8 @@
*/ */
export default function UpdateBackground() { export default function UpdateBackground() {
Game.Background.canvas.width = Game.Background.canvas.parentNode.offsetWidth; Game.Background.canvas.width = Game.Background.canvas.parentNode.offsetWidth;
Game.Background.canvas.height = Game.Background.canvas.height = Game.Background.canvas.parentNode.offsetHeight;
Game.Background.canvas.parentNode.offsetHeight; Game.LeftBackground.canvas.width = Game.LeftBackground.canvas.parentNode.offsetWidth;
Game.LeftBackground.canvas.width = Game.LeftBackground.canvas.height = Game.LeftBackground.canvas.parentNode.offsetHeight;
Game.LeftBackground.canvas.parentNode.offsetWidth;
Game.LeftBackground.canvas.height =
Game.LeftBackground.canvas.parentNode.offsetHeight;
Game.DrawBackground(); Game.DrawBackground();
} }

View File

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

View File

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

View File

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

View File

@@ -15,12 +15,9 @@ export default function CreateSectionHideButtons() {
l('vaultUpgrades').style.display = 'none'; l('vaultUpgrades').style.display = 'none';
} else { } else {
l('upgrades').style.display = 'flex'; l('upgrades').style.display = 'flex';
if (l('toggleUpgrades').children.length !== 0) if (l('toggleUpgrades').children.length !== 0) l('toggleUpgrades').style.display = 'block';
l('toggleUpgrades').style.display = 'block'; if (l('techUpgrades').children.length !== 0) l('techUpgrades').style.display = 'block';
if (l('techUpgrades').children.length !== 0) if (l('vaultUpgrades').children.length !== 0) l('vaultUpgrades').style.display = 'block';
l('techUpgrades').style.display = 'block';
if (l('vaultUpgrades').children.length !== 0)
l('vaultUpgrades').style.display = 'block';
} }
}; };
a.textContent = 'Hide/Show Upgrades'; a.textContent = 'Hide/Show Upgrades';
@@ -28,8 +25,7 @@ export default function CreateSectionHideButtons() {
const b = document.createElement('a'); const b = document.createElement('a');
b.className = 'option'; b.className = 'option';
b.onclick = function () { b.onclick = function () {
if (l('products').style.display === 'grid') if (l('products').style.display === 'grid') l('products').style.display = 'none';
l('products').style.display = 'none';
else l('products').style.display = 'grid'; else l('products').style.display = 'grid';
}; };
b.textContent = 'Hide/Show Buildings'; b.textContent = 'Hide/Show Buildings';

View File

@@ -18,11 +18,7 @@ export default function CreateWrinklerButtons() {
}; };
popAllA.onmouseover = function () { popAllA.onmouseover = function () {
Game.tooltip.dynamic = 1; Game.tooltip.dynamic = 1;
Game.tooltip.draw( Game.tooltip.draw(this, () => CreateTooltip('wb', 'PopAll'), 'this');
this,
() => CreateTooltip('wb', 'PopAll'),
'this',
);
Game.tooltip.wobble(); Game.tooltip.wobble();
}; };
l('sectionLeftExtra').children[0].append(popAllA); l('sectionLeftExtra').children[0].append(popAllA);
@@ -31,19 +27,14 @@ export default function CreateWrinklerButtons() {
popFattestA.textContent = 'Pop Single Fattest'; popFattestA.textContent = 'Pop Single Fattest';
popFattestA.className = 'option'; popFattestA.className = 'option';
popFattestA.onclick = function () { popFattestA.onclick = function () {
if (CacheWrinklersFattest[1] !== null) if (CacheWrinklersFattest[1] !== null) Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
}; };
popFattestA.onmouseout = function () { popFattestA.onmouseout = function () {
Game.tooltip.shouldHide = 1; Game.tooltip.shouldHide = 1;
}; };
popFattestA.onmouseover = function () { popFattestA.onmouseover = function () {
Game.tooltip.dynamic = 1; Game.tooltip.dynamic = 1;
Game.tooltip.draw( Game.tooltip.draw(this, () => CreateTooltip('wb', 'PopFattest'), 'this');
this,
() => CreateTooltip('wb', 'PopFattest'),
'this',
);
Game.tooltip.wobble(); Game.tooltip.wobble();
}; };
l('sectionLeftExtra').children[0].append(popFattestA); l('sectionLeftExtra').children[0].append(popFattestA);

View File

@@ -1,11 +1,7 @@
import jscolor, * as JsColor from '@eastdesire/jscolor'; import jscolor, * as JsColor from '@eastdesire/jscolor';
import ToggleFavouriteSetting from '../../../Config/Toggles/ToggleFavourites'; import ToggleFavouriteSetting from '../../../Config/Toggles/ToggleFavourites';
import { SaveConfig } from '../../../Config/SaveLoadReload/SaveLoadReloadSettings'; import { SaveConfig } from '../../../Config/SaveLoadReload/SaveLoadReloadSettings';
import { import { ConfigPrefix, ToggleConfig, ToggleConfigVolume } from '../../../Config/ToggleSetting';
ConfigPrefix,
ToggleConfig,
ToggleConfigVolume,
} from '../../../Config/ToggleSetting';
import { CMOptions } from '../../../Config/VariablesAndData'; import { CMOptions } from '../../../Config/VariablesAndData';
import {} from '../../../Data/Sectionheaders.ts'; import {} from '../../../Data/Sectionheaders.ts';
import Config from '../../../Data/SettingsData'; import Config from '../../../Data/SettingsData';
@@ -13,10 +9,7 @@ import RefreshScale from '../../HelperFunctions/RefreshScale';
import UpdateColours from '../../HelperFunctions/UpdateColours'; import UpdateColours from '../../HelperFunctions/UpdateColours';
import Flash from '../../Notifications/Flash'; import Flash from '../../Notifications/Flash';
import PlaySound from '../../Notifications/Sound'; import PlaySound from '../../Notifications/Sound';
import { import { FavouriteSettings, SimpleTooltipElements } from '../../VariablesAndData';
FavouriteSettings,
SimpleTooltipElements,
} from '../../VariablesAndData';
import CookieMonsterPrompt from '../Prompt'; import CookieMonsterPrompt from '../Prompt';
/** /**
@@ -37,10 +30,7 @@ function CreateFavouriteStar(config) {
Game.UpdateMenu(); Game.UpdateMenu();
}; };
FavStar.onmouseover = function () { FavStar.onmouseover = function () {
Game.tooltip.draw( Game.tooltip.draw(this, escape(SimpleTooltipElements.FavouriteSettingPlaceholder.innerHTML));
this,
escape(SimpleTooltipElements.FavouriteSettingPlaceholder.innerHTML),
);
}; };
FavStar.onmouseout = function () { FavStar.onmouseout = function () {
Game.tooltip.hide(); Game.tooltip.hide();

View File

@@ -1,9 +1,6 @@
import { LoadConfig } from '../../../Config/SaveLoadReload/SaveLoadReloadSettings'; import { LoadConfig } from '../../../Config/SaveLoadReload/SaveLoadReloadSettings';
import { CMOptions } from '../../../Config/VariablesAndData'; import { CMOptions } from '../../../Config/VariablesAndData';
import { import { ConfigGroups, ConfigGroupsNotification } from '../../../Data/Sectionheaders.ts';
ConfigGroups,
ConfigGroupsNotification,
} from '../../../Data/Sectionheaders.ts';
import Config from '../../../Data/SettingsData'; import Config from '../../../Data/SettingsData';
import ConfigDefault from '../../../Data/SettingsDefault.ts'; import ConfigDefault from '../../../Data/SettingsDefault.ts';
import { FavouriteSettings } from '../../VariablesAndData'; import { FavouriteSettings } from '../../VariablesAndData';
@@ -35,24 +32,19 @@ export default function AddMenuPref(title) {
// Make sub-sections of Notification section // Make sub-sections of Notification section
if (group === 'Notification') { if (group === 'Notification') {
Object.keys(ConfigGroupsNotification).forEach((subGroup) => { Object.keys(ConfigGroupsNotification).forEach((subGroup) => {
const subGroupObject = CreatePrefHeader( const subGroupObject = CreatePrefHeader(subGroup, ConfigGroupsNotification[subGroup]); // (group, display-name of group)
subGroup,
ConfigGroupsNotification[subGroup],
); // (group, display-name of group)
subGroupObject.style.fontSize = '15px'; subGroupObject.style.fontSize = '15px';
subGroupObject.style.opacity = '0.5'; subGroupObject.style.opacity = '0.5';
frag.appendChild(subGroupObject); frag.appendChild(subGroupObject);
if (CMOptions.Header[subGroup]) { if (CMOptions.Header[subGroup]) {
Object.keys(Config).forEach((option) => { Object.keys(Config).forEach((option) => {
if (Config[option].group === subGroup) if (Config[option].group === subGroup) frag.appendChild(CreatePrefOption(option));
frag.appendChild(CreatePrefOption(option));
}); });
} }
}); });
} else { } else {
Object.keys(Config).forEach((option) => { Object.keys(Config).forEach((option) => {
if (Config[option].group === group) if (Config[option].group === group) frag.appendChild(CreatePrefOption(option));
frag.appendChild(CreatePrefOption(option));
}); });
} }
} }
@@ -72,8 +64,6 @@ export default function AddMenuPref(title) {
l('menu').childNodes[2].insertBefore( l('menu').childNodes[2].insertBefore(
frag, frag,
l('menu').childNodes[2].childNodes[ l('menu').childNodes[2].childNodes[l('menu').childNodes[2].childNodes.length - 1],
l('menu').childNodes[2].childNodes.length - 1
],
); );
} }

View File

@@ -64,9 +64,7 @@ export default function AddMenuStats(title) {
const popAllFrag = document.createDocumentFragment(); const popAllFrag = document.createDocumentFragment();
popAllFrag.appendChild( popAllFrag.appendChild(
document.createTextNode( document.createTextNode(
`${Beautify(CacheWrinklersTotal)} / ${Beautify( `${Beautify(CacheWrinklersTotal)} / ${Beautify(CacheWrinklersNormal)} `,
CacheWrinklersNormal,
)} `,
), ),
); );
const popAllA = document.createElement('a'); const popAllA = document.createElement('a');
@@ -77,31 +75,22 @@ export default function AddMenuStats(title) {
}; };
popAllFrag.appendChild(popAllA); popAllFrag.appendChild(popAllA);
stats.appendChild( stats.appendChild(
CreateElements.StatsListing( CreateElements.StatsListing('basic', 'Rewards of Popping (All/Normal)', popAllFrag),
'basic',
'Rewards of Popping (All/Normal)',
popAllFrag,
),
); );
const popFattestFrag = document.createDocumentFragment(); const popFattestFrag = document.createDocumentFragment();
popFattestFrag.appendChild( popFattestFrag.appendChild(document.createTextNode(`${Beautify(CacheWrinklersFattest[0])} `));
document.createTextNode(`${Beautify(CacheWrinklersFattest[0])} `),
);
const popFattestA = document.createElement('a'); const popFattestA = document.createElement('a');
popFattestA.textContent = 'Pop Single Fattest'; popFattestA.textContent = 'Pop Single Fattest';
popFattestA.className = 'option'; popFattestA.className = 'option';
popFattestA.onclick = function () { popFattestA.onclick = function () {
if (CacheWrinklersFattest[1] !== null) if (CacheWrinklersFattest[1] !== null) Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
Game.wrinklers[CacheWrinklersFattest[1]].hp = 0;
}; };
popFattestFrag.appendChild(popFattestA); popFattestFrag.appendChild(popFattestA);
stats.appendChild( stats.appendChild(
CreateElements.StatsListing( CreateElements.StatsListing(
'basic', 'basic',
`Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ${ `Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ${
CacheWrinklersFattest[1] !== null CacheWrinklersFattest[1] !== null ? CacheWrinklersFattest[1] : 'None'
? CacheWrinklersFattest[1]
: 'None'
})`, })`,
popFattestFrag, popFattestFrag,
), ),
@@ -128,9 +117,9 @@ export default function AddMenuStats(title) {
stats.appendChild( stats.appendChild(
CreateElements.StatsListing( CreateElements.StatsListing(
'basic', 'basic',
`Average cookie clicks per second (past ${ `Average cookie clicks per second (past ${ClickTimes[CMOptions.AvgClicksHist]}${
ClickTimes[CMOptions.AvgClicksHist] CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds'
}${CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds'})`, })`,
document.createTextNode(Beautify(CacheAverageClicks, 1)), document.createTextNode(Beautify(CacheAverageClicks, 1)),
), ),
); );
@@ -181,9 +170,7 @@ export default function AddMenuStats(title) {
Game.fps * 60 - (Game.OnAscend ? 0 : Game.T % (Game.fps * 60)), Game.fps * 60 - (Game.OnAscend ? 0 : Game.T % (Game.fps * 60)),
4, 4,
); );
stats.appendChild( stats.appendChild(CreateElements.StatsListing('basic', 'Time till autosave', timer));
CreateElements.StatsListing('basic', 'Time till autosave', timer),
);
} }
} }

View File

@@ -64,10 +64,7 @@ export function StatsListing(type, name, text, placeholder) {
Game.tooltip.hide(); Game.tooltip.hide();
}; };
tooltip.onmouseover = function () { tooltip.onmouseover = function () {
Game.tooltip.draw( Game.tooltip.draw(this, escape(SimpleTooltipElements[placeholder].innerHTML));
this,
escape(SimpleTooltipElements[placeholder].innerHTML),
);
}; };
tooltip.style.cursor = 'default'; tooltip.style.cursor = 'default';
tooltip.style.display = 'inline-block'; tooltip.style.display = 'inline-block';

View File

@@ -7,8 +7,7 @@ function CrateTooltipLockedAchievements(me) {
tags.push('Locked', 0); tags.push('Locked', 0);
let neuromancy = 0; let neuromancy = 0;
if (Game.Has('Neuromancy') || (Game.sesame && me.pool === 'debug')) if (Game.Has('Neuromancy') || (Game.sesame && me.pool === 'debug')) neuromancy = 1;
neuromancy = 1;
if (neuromancy && me.won === 0) tags.push('Click to win!', '#00c462'); if (neuromancy && me.won === 0) tags.push('Click to win!', '#00c462');
else if (neuromancy && me.won > 0) tags.push('Click to lose!', '#00c462'); else if (neuromancy && me.won > 0) tags.push('Click to lose!', '#00c462');
@@ -21,9 +20,9 @@ function CrateTooltipLockedAchievements(me) {
let tagsStr = ''; let tagsStr = '';
for (let i = 0; i < tags.length; i += 2) { for (let i = 0; i < tags.length; i += 2) {
if (i % 2 === 0) if (i % 2 === 0)
tagsStr += ` <div class="tag" style="color:${ tagsStr += ` <div class="tag" style="color:${tags[i + 1] === 0 ? '#fff' : tags[i + 1]};">[${
tags[i + 1] === 0 ? '#fff' : tags[i + 1] tags[i]
};">[${tags[i]}]</div>`; }]</div>`;
} }
tagsStr = tagsStr.substring(1); tagsStr = tagsStr.substring(1);
@@ -35,9 +34,9 @@ function CrateTooltipLockedAchievements(me) {
${tagsStr}<div class="line"></div><div class="description">${desc}</div></div> ${tagsStr}<div class="line"></div><div class="description">${desc}</div></div>
${ ${
Game.sesame Game.sesame
? `<div style="font-size:9px;">Id : ${me.id} | Order : ${Math.floor( ? `<div style="font-size:9px;">Id : ${me.id} | Order : ${Math.floor(me.order)}${
me.order, me.tier ? ` | Tier : ${me.tier}` : ''
)}${me.tier ? ` | Tier : ${me.tier}` : ''}</div>` }</div>`
: '' : ''
}`; }`;
} }
@@ -58,9 +57,7 @@ export default function AddMissingAchievements() {
const id = achievsCrate.onclick.toString().split(/\[(.*)\]/gi)[1]; const id = achievsCrate.onclick.toString().split(/\[(.*)\]/gi)[1];
const { icon } = Game.AchievementsById[id]; const { icon } = Game.AchievementsById[id];
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
achievsCrate.style.backgroundPosition = `${-icon[0] * 48}px ${ achievsCrate.style.backgroundPosition = `${-icon[0] * 48}px ${-icon[1] * 48}px`;
-icon[1] * 48
}px`;
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
achievsCrate.onmouseover = function () { achievsCrate.onmouseover = function () {
if (!Game.mouseDown) { if (!Game.mouseDown) {
@@ -68,10 +65,9 @@ export default function AddMissingAchievements() {
Game.tooltip.dynamic = 1; Game.tooltip.dynamic = 1;
Game.tooltip.draw( Game.tooltip.draw(
this, this,
() => (function () { () =>
return CrateTooltipLockedAchievements( (function () {
Game.AchievementsById[id], return CrateTooltipLockedAchievements(Game.AchievementsById[id]);
);
})(), })(),
'top', 'top',
); );

View File

@@ -12,22 +12,16 @@ import {
export function AddMissingUpgrades() { export function AddMissingUpgrades() {
l('menu').childNodes.forEach((menuSection) => { l('menu').childNodes.forEach((menuSection) => {
if (menuSection.children[0]) { if (menuSection.children[0]) {
if ( if (menuSection.children[0].innerHTML === 'Prestige' && CacheMissingUpgradesPrestige) {
menuSection.children[0].innerHTML === 'Prestige' &&
CacheMissingUpgradesPrestige
) {
const prestigeUpgradesMissing = const prestigeUpgradesMissing =
CacheMissingUpgradesPrestige.match(new RegExp('div', 'g') || []) CacheMissingUpgradesPrestige.match(new RegExp('div', 'g') || []).length / 2;
.length / 2;
const title = document.createElement('div'); const title = document.createElement('div');
title.id = 'CMMissingUpgradesPrestigeTitle'; title.id = 'CMMissingUpgradesPrestigeTitle';
title.className = 'listing'; title.className = 'listing';
const titlefrag = document.createElement('div'); const titlefrag = document.createElement('div');
titlefrag.innerHTML = `<b>Missing Prestige upgrades:</b> ${prestigeUpgradesMissing}/${ titlefrag.innerHTML = `<b>Missing Prestige upgrades:</b> ${prestigeUpgradesMissing}/${
Game.PrestigeUpgrades.length Game.PrestigeUpgrades.length
} (${Math.floor( } (${Math.floor((prestigeUpgradesMissing / Game.PrestigeUpgrades.length) * 100)}%)`;
(prestigeUpgradesMissing / Game.PrestigeUpgrades.length) * 100,
)}%)`;
title.appendChild(titlefrag); title.appendChild(titlefrag);
menuSection.appendChild(title); menuSection.appendChild(title);
const upgrades = document.createElement('div'); const upgrades = document.createElement('div');
@@ -46,8 +40,7 @@ export function AddMissingUpgrades() {
Game.UpgradesByPool[''].length + Game.UpgradesByPool.tech.length Game.UpgradesByPool[''].length + Game.UpgradesByPool.tech.length
} (${Math.floor( } (${Math.floor(
(normalUpgradesMissing / (normalUpgradesMissing /
(Game.UpgradesByPool[''].length + (Game.UpgradesByPool[''].length + Game.UpgradesByPool.tech.length)) *
Game.UpgradesByPool.tech.length)) *
100, 100,
)}%)`; )}%)`;
title.appendChild(titlefrag); title.appendChild(titlefrag);
@@ -62,17 +55,14 @@ export function AddMissingUpgrades() {
} }
if (CacheMissingUpgradesCookies) { if (CacheMissingUpgradesCookies) {
const cookieUpgradesMissing = const cookieUpgradesMissing =
CacheMissingUpgradesCookies.match(new RegExp('div', 'g') || []) CacheMissingUpgradesCookies.match(new RegExp('div', 'g') || []).length / 2;
.length / 2;
const title = document.createElement('div'); const title = document.createElement('div');
title.id = 'CMMissingUpgradesCookiesTitle'; title.id = 'CMMissingUpgradesCookiesTitle';
title.className = 'listing'; title.className = 'listing';
const titlefrag = document.createElement('div'); const titlefrag = document.createElement('div');
titlefrag.innerHTML = `<b>Missing Cookie upgrades:</b> ${cookieUpgradesMissing}/${ titlefrag.innerHTML = `<b>Missing Cookie upgrades:</b> ${cookieUpgradesMissing}/${
Game.UpgradesByPool.cookie.length Game.UpgradesByPool.cookie.length
} (${Math.floor( } (${Math.floor((cookieUpgradesMissing / Game.UpgradesByPool.cookie.length) * 100)}%)`;
(cookieUpgradesMissing / Game.UpgradesByPool.cookie.length) * 100,
)}%)`;
title.appendChild(titlefrag); title.appendChild(titlefrag);
menuSection.appendChild(title); menuSection.appendChild(title);
const upgrades = document.createElement('div'); const upgrades = document.createElement('div');
@@ -104,8 +94,8 @@ export function crateMissing(me) {
const tooltip = `function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`; const tooltip = `function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;
return `<div class="${classes}" return `<div class="${classes}"
${Game.getDynamicTooltip(tooltip, 'top', true)} ${Game.getDynamicTooltip(tooltip, 'top', true)}
style = "${`${ style = "${`${icon[2] ? `background-image: url(${icon[2]});` : ''}background-position:${
icon[2] ? `background-image: url(${icon[2]});` : '' -icon[0] * 48
}background-position:${-icon[0] * 48}px ${-icon[1] * 48}px`};"> }px ${-icon[1] * 48}px`};">
</div>`; </div>`;
} }

View File

@@ -58,13 +58,10 @@ export function LuckySection() {
const section = document.createElement('div'); const section = document.createElement('div');
section.className = 'CMStatsLuckySection'; section.className = 'CMStatsLuckySection';
const luckyColour = const luckyColour = Game.cookies + GetWrinkConfigBank() < CacheLucky ? ColourRed : ColourGreen;
Game.cookies + GetWrinkConfigBank() < CacheLucky ? ColourRed : ColourGreen;
const luckyTime = const luckyTime =
Game.cookies + GetWrinkConfigBank() < CacheLucky Game.cookies + GetWrinkConfigBank() < CacheLucky
? FormatTime( ? FormatTime((CacheLucky - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
(CacheLucky - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
)
: ''; : '';
const luckyReqFrag = document.createDocumentFragment(); const luckyReqFrag = document.createDocumentFragment();
const luckyReqSpan = document.createElement('span'); const luckyReqSpan = document.createElement('span');
@@ -78,23 +75,14 @@ export function LuckySection() {
luckyReqFrag.appendChild(luckyReqSmall); luckyReqFrag.appendChild(luckyReqSmall);
} }
section.appendChild( section.appendChild(
StatsListing( StatsListing('withTooltip', '"Lucky!" cookies required', luckyReqFrag, goldCookTooltip),
'withTooltip',
'"Lucky!" cookies required',
luckyReqFrag,
goldCookTooltip,
),
); );
const luckyColourFrenzy = const luckyColourFrenzy =
Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy ? ColourRed : ColourGreen;
? ColourRed
: ColourGreen;
const luckyTimeFrenzy = const luckyTimeFrenzy =
Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy
? FormatTime( ? FormatTime((CacheLuckyFrenzy - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
(CacheLuckyFrenzy - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
)
: ''; : '';
const luckyReqFrenFrag = document.createDocumentFragment(); const luckyReqFrenFrag = document.createDocumentFragment();
const luckyReqFrenSpan = document.createElement('span'); const luckyReqFrenSpan = document.createElement('span');
@@ -122,8 +110,7 @@ export function LuckySection() {
luckyRewardMaxSpan.style.fontWeight = 'bold'; luckyRewardMaxSpan.style.fontWeight = 'bold';
luckyRewardMaxSpan.className = ColourTextPre + CacheLuckyReward; luckyRewardMaxSpan.className = ColourTextPre + CacheLuckyReward;
luckyRewardMaxSpan.textContent = luckyRewardMaxSpan.textContent =
Beautify(CacheLuckyReward) + Beautify(CacheLuckyReward) + (luckySplit ? ` / ${Beautify(CacheLuckyWrathReward)}` : '');
(luckySplit ? ` / ${Beautify(CacheLuckyWrathReward)}` : '');
section.appendChild( section.appendChild(
StatsListing( StatsListing(
'withTooltip', 'withTooltip',
@@ -184,15 +171,10 @@ export function ChainSection() {
section.className = 'CMStatsChainSection'; section.className = 'CMStatsChainSection';
const chainColour = const chainColour =
Game.cookies + GetWrinkConfigBank() < CacheChainRequired Game.cookies + GetWrinkConfigBank() < CacheChainRequired ? ColourRed : ColourGreen;
? ColourRed
: ColourGreen;
const chainTime = const chainTime =
Game.cookies + GetWrinkConfigBank() < CacheChainRequired Game.cookies + GetWrinkConfigBank() < CacheChainRequired
? FormatTime( ? FormatTime((CacheChainRequired - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
(CacheChainRequired - (Game.cookies + GetWrinkConfigBank())) /
GetCPS(),
)
: ''; : '';
const chainReqFrag = document.createDocumentFragment(); const chainReqFrag = document.createDocumentFragment();
const chainReqSpan = document.createElement('span'); const chainReqSpan = document.createElement('span');
@@ -206,24 +188,14 @@ export function ChainSection() {
chainReqFrag.appendChild(chainReqSmall); chainReqFrag.appendChild(chainReqSmall);
} }
section.appendChild( section.appendChild(
StatsListing( StatsListing('withTooltip', '"Chain" cookies required', chainReqFrag, goldCookTooltip),
'withTooltip',
'"Chain" cookies required',
chainReqFrag,
goldCookTooltip,
),
); );
const chainWrathColour = const chainWrathColour =
Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired ? ColourRed : ColourGreen;
? ColourRed
: ColourGreen;
const chainWrathTime = const chainWrathTime =
Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired
? FormatTime( ? FormatTime((CacheChainWrathRequired - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
(CacheChainWrathRequired - (Game.cookies + GetWrinkConfigBank())) /
GetCPS(),
)
: ''; : '';
const chainWrathReqFrag = document.createDocumentFragment(); const chainWrathReqFrag = document.createDocumentFragment();
const chainWrathReqSpan = document.createElement('span'); const chainWrathReqSpan = document.createElement('span');
@@ -246,15 +218,10 @@ export function ChainSection() {
); );
const chainColourFrenzy = const chainColourFrenzy =
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired ? ColourRed : ColourGreen;
? ColourRed
: ColourGreen;
const chainTimeFrenzy = const chainTimeFrenzy =
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired
? FormatTime( ? FormatTime((CacheChainFrenzyRequired - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
(CacheChainFrenzyRequired - (Game.cookies + GetWrinkConfigBank())) /
GetCPS(),
)
: ''; : '';
const chainReqFrenFrag = document.createDocumentFragment(); const chainReqFrenFrag = document.createDocumentFragment();
const chainReqFrenSpan = document.createElement('span'); const chainReqFrenSpan = document.createElement('span');
@@ -277,15 +244,11 @@ export function ChainSection() {
); );
const chainWrathColourFrenzy = const chainWrathColourFrenzy =
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired ? ColourRed : ColourGreen;
? ColourRed
: ColourGreen;
const chainWrathTimeFrenzy = const chainWrathTimeFrenzy =
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired
? FormatTime( ? FormatTime(
(CacheChainFrenzyWrathRequired - (CacheChainFrenzyWrathRequired - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
(Game.cookies + GetWrinkConfigBank())) /
GetCPS(),
) )
: ''; : '';
const chainWrathReqFrenFrag = document.createDocumentFragment(); const chainWrathReqFrenFrag = document.createDocumentFragment();
@@ -313,9 +276,7 @@ export function ChainSection() {
'withTooltip', 'withTooltip',
'"Chain" reward (max) (golden / wrath)', '"Chain" reward (max) (golden / wrath)',
document.createTextNode( document.createTextNode(
`${Beautify(CacheChainMaxReward[0])} / ${Beautify( `${Beautify(CacheChainMaxReward[0])} / ${Beautify(CacheChainWrathMaxReward[0])}`,
CacheChainWrathMaxReward[0],
)}`,
), ),
goldCookTooltip, goldCookTooltip,
), ),
@@ -326,9 +287,7 @@ export function ChainSection() {
'withTooltip', 'withTooltip',
'"Chain" reward (max) (frenzy) (golden / wrath)', '"Chain" reward (max) (frenzy) (golden / wrath)',
document.createTextNode( document.createTextNode(
`${Beautify(CacheChainFrenzyMaxReward[0])} / ${Beautify( `${Beautify(CacheChainFrenzyMaxReward[0])} / ${Beautify(CacheChainFrenzyMaxReward[0])}`,
CacheChainFrenzyMaxReward[0],
)}`,
), ),
goldCookTooltip, goldCookTooltip,
), ),
@@ -338,23 +297,13 @@ export function ChainSection() {
Game.cookiesPs * 60 * 60 * 6 * CacheDragonsFortuneMultAdjustment, Game.cookiesPs * 60 * 60 * 6 * CacheDragonsFortuneMultAdjustment,
Game.cookies * 0.5, Game.cookies * 0.5,
); );
const chainCur = MaxChainCookieReward( const chainCur = MaxChainCookieReward(7, chainCurMax, CacheGoldenCookiesMult)[0];
7, const chainCurWrath = MaxChainCookieReward(6, chainCurMax, CacheWrathCookiesMult)[0];
chainCurMax,
CacheGoldenCookiesMult,
)[0];
const chainCurWrath = MaxChainCookieReward(
6,
chainCurMax,
CacheWrathCookiesMult,
)[0];
section.appendChild( section.appendChild(
StatsListing( StatsListing(
'withTooltip', 'withTooltip',
'"Chain" reward (cur) (golden / wrath)', '"Chain" reward (cur) (golden / wrath)',
document.createTextNode( document.createTextNode(`${Beautify(chainCur)} / ${Beautify(chainCurWrath)}`),
`${Beautify(chainCur)} / ${Beautify(chainCurWrath)}`,
),
goldCookTooltip, goldCookTooltip,
), ),
); );
@@ -364,9 +313,7 @@ export function ChainSection() {
'withTooltip', 'withTooltip',
'CPS needed for next level (g / w)', 'CPS needed for next level (g / w)',
document.createTextNode( document.createTextNode(
`${Beautify(CacheChainRequiredNext)} / ${Beautify( `${Beautify(CacheChainRequiredNext)} / ${Beautify(CacheChainWrathRequiredNext)}`,
CacheChainWrathRequiredNext,
)}`,
), ),
'ChainNextLevelPlaceholder', 'ChainNextLevelPlaceholder',
), ),
@@ -395,14 +342,10 @@ export function SpellsSection() {
section.className = 'CMStatsSpellsSection'; section.className = 'CMStatsSpellsSection';
const conjureColour = const conjureColour =
Game.cookies + GetWrinkConfigBank() < CacheConjure Game.cookies + GetWrinkConfigBank() < CacheConjure ? ColourRed : ColourGreen;
? ColourRed
: ColourGreen;
const conjureTime = const conjureTime =
Game.cookies + GetWrinkConfigBank() < CacheConjure Game.cookies + GetWrinkConfigBank() < CacheConjure
? FormatTime( ? FormatTime((CacheConjure - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
(CacheConjure - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
)
: ''; : '';
const conjureReqFrag = document.createDocumentFragment(); const conjureReqFrag = document.createDocumentFragment();
@@ -434,18 +377,14 @@ export function SpellsSection() {
); );
const conjureFrenzyColour = const conjureFrenzyColour =
Game.cookies + GetWrinkConfigBank() < CacheConjure * 7 Game.cookies + GetWrinkConfigBank() < CacheConjure * 7 ? ColourRed : ColourGreen;
? ColourRed
: ColourGreen;
const conjureFrenzyCur = Math.min( const conjureFrenzyCur = Math.min(
(Game.cookies + GetWrinkConfigBank()) * 0.15, (Game.cookies + GetWrinkConfigBank()) * 0.15,
CacheNoGoldSwitchCookiesPS * 60 * 30, CacheNoGoldSwitchCookiesPS * 60 * 30,
); );
const conjureFrenzyTime = const conjureFrenzyTime =
Game.cookies + GetWrinkConfigBank() < CacheConjure * 7 Game.cookies + GetWrinkConfigBank() < CacheConjure * 7
? FormatTime( ? FormatTime((CacheConjure * 7 - (Game.cookies + GetWrinkConfigBank())) / GetCPS())
(CacheConjure * 7 - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
)
: ''; : '';
const conjureFrenzyReqFrag = document.createDocumentFragment(); const conjureFrenzyReqFrag = document.createDocumentFragment();
@@ -488,9 +427,7 @@ export function SpellsSection() {
StatsListing( StatsListing(
'withTooltip', 'withTooltip',
'"Spontaneous Edifice" cookies required (most expensive building)', '"Spontaneous Edifice" cookies required (most expensive building)',
document.createTextNode( document.createTextNode(`${Beautify(CacheEdifice)} (${CacheEdificeBuilding})`),
`${Beautify(CacheEdifice)} (${CacheEdificeBuilding})`,
),
'GoldCookTooltipPlaceholder', 'GoldCookTooltipPlaceholder',
), ),
); );
@@ -506,60 +443,40 @@ export function GardenSection() {
const section = document.createElement('div'); const section = document.createElement('div');
section.className = 'CMStatsGardenSection'; section.className = 'CMStatsGardenSection';
const bakeberryColour = const bakeberryColour = Game.cookies < Game.cookiesPs * 60 * 10 * 100 ? ColourRed : ColourGreen;
Game.cookies < Game.cookiesPs * 60 * 10 * 100 ? ColourRed : ColourGreen;
const bakeberryFrag = document.createElement('span'); const bakeberryFrag = document.createElement('span');
bakeberryFrag.style.fontWeight = 'bold'; bakeberryFrag.style.fontWeight = 'bold';
bakeberryFrag.className = ColourTextPre + bakeberryColour; bakeberryFrag.className = ColourTextPre + bakeberryColour;
bakeberryFrag.textContent = Beautify(Game.cookiesPs * 60 * 10 * 100); bakeberryFrag.textContent = Beautify(Game.cookiesPs * 60 * 10 * 100);
section.appendChild( section.appendChild(
StatsListing( StatsListing('basic', 'Cookies required for max reward of Bakeberry: ', bakeberryFrag),
'basic',
'Cookies required for max reward of Bakeberry: ',
bakeberryFrag,
),
); );
const chocorootColour = const chocorootColour = Game.cookies < Game.cookiesPs * 60 * 100 ? ColourRed : ColourGreen;
Game.cookies < Game.cookiesPs * 60 * 100 ? ColourRed : ColourGreen;
const chocorootFrag = document.createElement('span'); const chocorootFrag = document.createElement('span');
chocorootFrag.style.fontWeight = 'bold'; chocorootFrag.style.fontWeight = 'bold';
chocorootFrag.className = ColourTextPre + chocorootColour; chocorootFrag.className = ColourTextPre + chocorootColour;
chocorootFrag.textContent = Beautify(Game.cookiesPs * 60 * 100); chocorootFrag.textContent = Beautify(Game.cookiesPs * 60 * 100);
section.appendChild( section.appendChild(
StatsListing( StatsListing('basic', 'Cookies required for max reward of Chocoroot: ', chocorootFrag),
'basic',
'Cookies required for max reward of Chocoroot: ',
chocorootFrag,
),
); );
const queenbeetColour = const queenbeetColour = Game.cookies < Game.cookiesPs * 60 * 60 * 25 ? ColourRed : ColourGreen;
Game.cookies < Game.cookiesPs * 60 * 60 * 25 ? ColourRed : ColourGreen;
const queenbeetFrag = document.createElement('span'); const queenbeetFrag = document.createElement('span');
queenbeetFrag.style.fontWeight = 'bold'; queenbeetFrag.style.fontWeight = 'bold';
queenbeetFrag.className = ColourTextPre + queenbeetColour; queenbeetFrag.className = ColourTextPre + queenbeetColour;
queenbeetFrag.textContent = Beautify(Game.cookiesPs * 60 * 60 * 25); queenbeetFrag.textContent = Beautify(Game.cookiesPs * 60 * 60 * 25);
section.appendChild( section.appendChild(
StatsListing( StatsListing('basic', 'Cookies required for max reward of Queenbeet: ', queenbeetFrag),
'basic',
'Cookies required for max reward of Queenbeet: ',
queenbeetFrag,
),
); );
const duketaterColour = const duketaterColour = Game.cookies < Game.cookiesPs * 60 * 15 * 100 ? ColourRed : ColourGreen;
Game.cookies < Game.cookiesPs * 60 * 15 * 100 ? ColourRed : ColourGreen;
const duketaterFrag = document.createElement('span'); const duketaterFrag = document.createElement('span');
duketaterFrag.style.fontWeight = 'bold'; duketaterFrag.style.fontWeight = 'bold';
duketaterFrag.className = ColourTextPre + duketaterColour; duketaterFrag.className = ColourTextPre + duketaterColour;
duketaterFrag.textContent = Beautify(Game.cookiesPs * 60 * 15 * 100); duketaterFrag.textContent = Beautify(Game.cookiesPs * 60 * 15 * 100);
section.appendChild( section.appendChild(
StatsListing( StatsListing('basic', 'Cookies required for max reward of Duketater: ', duketaterFrag),
'basic',
'Cookies required for max reward of Duketater: ',
duketaterFrag,
),
); );
const missingPlantDrops = []; const missingPlantDrops = [];
Object.keys(GameData.PlantDrops).forEach((i) => { Object.keys(GameData.PlantDrops).forEach((i) => {
@@ -569,11 +486,7 @@ export function GardenSection() {
}); });
if (missingPlantDrops.length !== 0) { if (missingPlantDrops.length !== 0) {
section.appendChild( section.appendChild(
StatsListing( StatsListing('basic', 'Rare plant drops left to unlock', StatsMissDisp(missingPlantDrops)),
'basic',
'Rare plant drops left to unlock',
StatsMissDisp(missingPlantDrops),
),
); );
} }
return section; return section;
@@ -592,18 +505,14 @@ export function PrestigeSection() {
CacheRealCookiesEarned + CacheRealCookiesEarned +
Game.cookiesReset + Game.cookiesReset +
CacheWrinklersTotal + CacheWrinklersTotal +
(Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CacheLastChoEgg : 0),
? CacheLastChoEgg
: 0),
), ),
); );
section.appendChild( section.appendChild(
StatsListing( StatsListing(
'withTooltip', 'withTooltip',
'Prestige level (cur / max)', 'Prestige level (cur / max)',
document.createTextNode( document.createTextNode(`${Beautify(Game.prestige)} / ${Beautify(possiblePresMax)}`),
`${Beautify(Game.prestige)} / ${Beautify(possiblePresMax)}`,
),
'PrestMaxTooltipPlaceholder', 'PrestMaxTooltipPlaceholder',
), ),
); );
@@ -614,21 +523,14 @@ export function PrestigeSection() {
(CacheRealCookiesEarned + (CacheRealCookiesEarned +
Game.cookiesReset + Game.cookiesReset +
CacheWrinklersTotal + CacheWrinklersTotal +
(( ((Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') ? CacheLastChoEgg : 0)
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')
? CacheLastChoEgg
: 0
)
? CacheLastChoEgg ? CacheLastChoEgg
: 0)), : 0)),
); );
const cookiesNextFrag = document.createDocumentFragment(); const cookiesNextFrag = document.createDocumentFragment();
cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook))); cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook)));
const cookiesNextSmall = document.createElement('small'); const cookiesNextSmall = document.createElement('small');
cookiesNextSmall.textContent = ` (${FormatTime( cookiesNextSmall.textContent = ` (${FormatTime(neededCook / CacheAvgCPSWithChoEgg, 1)})`;
neededCook / CacheAvgCPSWithChoEgg,
1,
)})`;
cookiesNextFrag.appendChild(cookiesNextSmall); cookiesNextFrag.appendChild(cookiesNextSmall);
section.appendChild( section.appendChild(
StatsListing( StatsListing(
@@ -663,8 +565,7 @@ export function PrestigeSection() {
const HCTarget = Number(CMOptions.HeavenlyChipsTarget); const HCTarget = Number(CMOptions.HeavenlyChipsTarget);
if (!Number.isNaN(HCTarget)) { if (!Number.isNaN(HCTarget)) {
const CookiesTillTarget = const CookiesTillTarget =
HCTarget - HCTarget - Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
if (CookiesTillTarget > 0) { if (CookiesTillTarget > 0) {
section.appendChild( section.appendChild(
StatsListing( StatsListing(
@@ -677,9 +578,7 @@ export function PrestigeSection() {
StatsListing( StatsListing(
'basic', 'basic',
'Time till target (cur, current 5 second average)', 'Time till target (cur, current 5 second average)',
document.createTextNode( document.createTextNode(FormatTime(CookiesTillTarget / CacheHCPerSecond)),
FormatTime(CookiesTillTarget / CacheHCPerSecond),
),
), ),
); );
} }
@@ -695,18 +594,11 @@ export function PrestigeSection() {
resetFrag.appendChild(resetSmall); resetFrag.appendChild(resetSmall);
} }
section.appendChild( section.appendChild(
StatsListing( StatsListing('withTooltip', 'Reset bonus income', resetFrag, 'ResetTooltipPlaceholder'),
'withTooltip',
'Reset bonus income',
resetFrag,
'ResetTooltipPlaceholder',
),
); );
const currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset)); const currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
const willHave = Math.floor( const willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned),
);
const willGet = willHave - currentPrestige; const willGet = willHave - currentPrestige;
if (!Game.Has('Lucky digit')) { if (!Game.Has('Lucky digit')) {
let delta7 = 7 - (willHave % 10); let delta7 = 7 - (willHave % 10);
@@ -719,9 +611,7 @@ export function PrestigeSection() {
`${next7Total.toLocaleString()} / ${next7Reset.toLocaleString()} (+${delta7})`, `${next7Total.toLocaleString()} / ${next7Reset.toLocaleString()} (+${delta7})`,
), ),
); );
section.appendChild( section.appendChild(StatsListing('basic', 'Next "Lucky Digit" (total / reset)', frag7));
StatsListing('basic', 'Next "Lucky Digit" (total / reset)', frag7),
);
} }
if (!Game.Has('Lucky number')) { if (!Game.Has('Lucky number')) {
@@ -735,9 +625,7 @@ export function PrestigeSection() {
`${next777Total.toLocaleString()} / ${next777Reset.toLocaleString()} (+${delta777})`, `${next777Total.toLocaleString()} / ${next777Reset.toLocaleString()} (+${delta777})`,
), ),
); );
section.appendChild( section.appendChild(StatsListing('basic', 'Next "Lucky Number" (total / reset)', frag777));
StatsListing('basic', 'Next "Lucky Number" (total / reset)', frag777),
);
} }
if (!Game.Has('Lucky payout')) { if (!Game.Has('Lucky payout')) {
@@ -751,9 +639,7 @@ export function PrestigeSection() {
`${next777777Total.toLocaleString()} / ${next777777Reset.toLocaleString()} (+${delta777777})`, `${next777777Total.toLocaleString()} / ${next777777Reset.toLocaleString()} (+${delta777777})`,
), ),
); );
section.appendChild( section.appendChild(StatsListing('basic', 'Next "Lucky Payout" (total / reset)', frag777777));
StatsListing('basic', 'Next "Lucky Payout" (total / reset)', frag777777),
);
} }
return section; return section;
@@ -803,8 +689,7 @@ export function SeasonSection() {
specDisp = true; specDisp = true;
} }
}); });
const choEgg = const choEgg = Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
const centEgg = Game.Has('Century egg'); const centEgg = Game.Has('Century egg');
if (Game.season === 'christmas' || specDisp || choEgg || centEgg) { if (Game.season === 'christmas' || specDisp || choEgg || centEgg) {
@@ -834,9 +719,7 @@ export function SeasonSection() {
'basic', 'basic',
'Chance of receiving a cookie from wrinkler/shiny wrinkler', 'Chance of receiving a cookie from wrinkler/shiny wrinkler',
document.createTextNode( document.createTextNode(
`${Beautify( `${Beautify((1 - failRateHalloween) * obtainedCookiesChance * 100)}% / ${Beautify(
(1 - failRateHalloween) * obtainedCookiesChance * 100,
)}% / ${Beautify(
(1 - failRateHalloween * 0.9) * obtainedCookiesChance * 100, (1 - failRateHalloween * 0.9) * obtainedCookiesChance * 100,
)}%`, )}%`,
), ),
@@ -867,9 +750,7 @@ export function SeasonSection() {
'basic', 'basic',
'Chance of receiving a cookie from reindeer', 'Chance of receiving a cookie from reindeer',
document.createTextNode( document.createTextNode(
`${Beautify( `${Beautify((1 - failRateChristmas) * obtainedCookiesChance * 100)}%`,
(1 - failRateChristmas) * obtainedCookiesChance * 100,
)}%`,
), ),
), ),
); );
@@ -897,23 +778,14 @@ export function SeasonSection() {
// Calculations courtesy of @svschouw, at https://github.com/Aktanusa/CookieMonster/issues/25 // Calculations courtesy of @svschouw, at https://github.com/Aktanusa/CookieMonster/issues/25
const succesRateEgg = 1 - failRateEgg; const succesRateEgg = 1 - failRateEgg;
const obtainedEggs = Game.eggDrops.length - missingNormalEggs.length; const obtainedEggs = Game.eggDrops.length - missingNormalEggs.length;
const obtainedRareEggs = const obtainedRareEggs = Game.rareEggDrops.length - missingRareEggs.length;
Game.rareEggDrops.length - missingRareEggs.length; const pNormal1 = succesRateEgg * 0.9 * (1 - obtainedEggs / Game.eggDrops.length);
const pNormal1 = const pRare1 = succesRateEgg * 0.1 * (1 - obtainedRareEggs / Game.rareEggDrops.length);
succesRateEgg * 0.9 * (1 - obtainedEggs / Game.eggDrops.length); const pRedropNormal = succesRateEgg * 0.9 * (obtainedEggs / Game.eggDrops.length);
const pRare1 = const pRedropRare = succesRateEgg * 0.1 * (obtainedRareEggs / Game.rareEggDrops.length);
succesRateEgg *
0.1 *
(1 - obtainedRareEggs / Game.rareEggDrops.length);
const pRedropNormal =
succesRateEgg * 0.9 * (obtainedEggs / Game.eggDrops.length);
const pRedropRare =
succesRateEgg * 0.1 * (obtainedRareEggs / Game.rareEggDrops.length);
const pRedrop = pRedropNormal + pRedropRare; const pRedrop = pRedropNormal + pRedropRare;
const pNormal2 = const pNormal2 = pRedrop * 0.9 * (1 - obtainedEggs / Game.eggDrops.length);
pRedrop * 0.9 * (1 - obtainedEggs / Game.eggDrops.length); const pRare2 = pRedrop * 0.1 * (1 - obtainedRareEggs / Game.rareEggDrops.length);
const pRare2 =
pRedrop * 0.1 * (1 - obtainedRareEggs / Game.rareEggDrops.length);
return [pNormal1 + pNormal2, pRare1 + pRare2]; return [pNormal1 + pNormal2, pRare1 + pRare2];
}; };
if (missingNormalEggs.length !== 0) { if (missingNormalEggs.length !== 0) {
@@ -929,29 +801,21 @@ export function SeasonSection() {
'basic', 'basic',
'Chance of receiving an egg from wrinkler/golden cookie', 'Chance of receiving an egg from wrinkler/golden cookie',
document.createTextNode( document.createTextNode(
`${Beautify(dropRateEgg(0.98)[0] * 100)}% / ${Beautify( `${Beautify(dropRateEgg(0.98)[0] * 100)}% / ${Beautify(dropRateEgg(0.9)[0] * 100)}%`,
dropRateEgg(0.9)[0] * 100,
)}%`,
), ),
), ),
); );
} }
if (missingRareEggs.length !== 0) { if (missingRareEggs.length !== 0) {
section.appendChild( section.appendChild(
StatsListing( StatsListing('basic', 'Rare easter eggs left to unlock', StatsMissDisp(missingRareEggs)),
'basic',
'Rare easter eggs left to unlock',
StatsMissDisp(missingRareEggs),
),
); );
section.appendChild( section.appendChild(
StatsListing( StatsListing(
'basic', 'basic',
'Chance of receiving a rare egg from wrinkler/golden cookie', 'Chance of receiving a rare egg from wrinkler/golden cookie',
document.createTextNode( document.createTextNode(
`${Beautify(dropRateEgg(0.98)[1] * 100)}% / ${Beautify( `${Beautify(dropRateEgg(0.98)[1] * 100)}% / ${Beautify(dropRateEgg(0.9)[1] * 100)}%`,
dropRateEgg(0.9)[1] * 100,
)}%`,
), ),
), ),
); );
@@ -959,11 +823,7 @@ export function SeasonSection() {
if (Game.season === 'christmas') if (Game.season === 'christmas')
section.appendChild( section.appendChild(
StatsListing( StatsListing('basic', 'Reindeer reward', document.createTextNode(Beautify(CacheSeaSpec))),
'basic',
'Reindeer reward',
document.createTextNode(Beautify(CacheSeaSpec)),
),
); );
if (choEgg) { if (choEgg) {
section.appendChild( section.appendChild(
@@ -980,9 +840,7 @@ export function SeasonSection() {
StatsListing( StatsListing(
'basic', 'basic',
'Century egg multiplier', 'Century egg multiplier',
document.createTextNode( document.createTextNode(`${Math.round((CacheCentEgg - 1) * 10000) / 100}%`),
`${Math.round((CacheCentEgg - 1) * 10000) / 100}%`,
),
), ),
); );
} }

View File

@@ -12,9 +12,7 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
export default function Flash(mode, config, forced) { export default function Flash(mode, config, forced) {
// The arguments check makes the sound not play upon initialization of the mod // The arguments check makes the sound not play upon initialization of the mod
if ( if (
((CMOptions[config] === 1 || forced) && ((CMOptions[config] === 1 || forced) && mode === 3 && isInitializing === false) ||
mode === 3 &&
isInitializing === false) ||
mode === 1 mode === 1
) { ) {
l('CMFlashScreen').style.backgroundColor = CMOptions[`Colour${config}`]; l('CMFlashScreen').style.backgroundColor = CMOptions[`Colour${config}`];

View File

@@ -14,8 +14,7 @@ export default function PlaySound(url, sndConfig, volConfig, forced) {
if ((CMOptions[sndConfig] === 1 || forced) && isInitializing === false) { if ((CMOptions[sndConfig] === 1 || forced) && isInitializing === false) {
// eslint-disable-next-line new-cap // eslint-disable-next-line new-cap
const sound = new Audio(url); const sound = new Audio(url);
if (CMOptions.GeneralSound) if (CMOptions.GeneralSound) sound.volume = (CMOptions[volConfig] / 100) * (Game.volume / 100);
sound.volume = (CMOptions[volConfig] / 100) * (Game.volume / 100);
else sound.volume = CMOptions[volConfig] / 100; else sound.volume = CMOptions[volConfig] / 100;
sound.play(); sound.play();
} }

View File

@@ -20,12 +20,7 @@ export function CreateFavicon() {
export function UpdateFavicon() { export function UpdateFavicon() {
if (CMOptions.Favicon === 1 && LastGoldenCookieState > 0) { if (CMOptions.Favicon === 1 && LastGoldenCookieState > 0) {
if (CacheSpawnedGoldenShimmer.wrath) if (CacheSpawnedGoldenShimmer.wrath)
l('CMFavicon').href = l('CMFavicon').href = 'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico';
'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico'; else l('CMFavicon').href = 'https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico';
else } else l('CMFavicon').href = 'https://orteil.dashnet.org/cookieclicker/favicon.ico';
l('CMFavicon').href =
'https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico';
} else
l('CMFavicon').href =
'https://orteil.dashnet.org/cookieclicker/favicon.ico';
} }

View File

@@ -1,14 +1,8 @@
/** Functions related to updating the tab in the browser's tab-bar */ /** Functions related to updating the tab in the browser's tab-bar */
import { import { CacheSeasonPopShimmer, CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData';
CacheSeasonPopShimmer,
CacheSpawnedGoldenShimmer,
} from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import { import { LastSeasonPopupState, LastTickerFortuneState } from '../../Main/VariablesAndData';
LastSeasonPopupState,
LastTickerFortuneState,
} from '../../Main/VariablesAndData';
import { Title } from '../VariablesAndData'; import { Title } from '../VariablesAndData';
/** /**
@@ -28,14 +22,10 @@ export default function UpdateTitle() {
if (CacheSpawnedGoldenShimmer) { if (CacheSpawnedGoldenShimmer) {
if (CacheSpawnedGoldenShimmer.wrath) if (CacheSpawnedGoldenShimmer.wrath)
titleGC = `[W${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`; titleGC = `[W${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
else else titleGC = `[G${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
titleGC = `[G${Math.ceil(CacheSpawnedGoldenShimmer.life / Game.fps)}]`;
} else if (!Game.Has('Golden switch [off]')) { } else if (!Game.Has('Golden switch [off]')) {
titleGC = `[${ titleGC = `[${Number(l('CMTimerBarGCMinBar').textContent) < 0 ? '!' : ''}${Math.ceil(
Number(l('CMTimerBarGCMinBar').textContent) < 0 ? '!' : '' (Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps,
}${Math.ceil(
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) /
Game.fps,
)}]`; )}]`;
} else titleGC = '[GS]'; } else titleGC = '[GS]';
@@ -46,15 +36,10 @@ export default function UpdateTitle() {
if (Game.season === 'christmas') { if (Game.season === 'christmas') {
addSP = true; addSP = true;
if (LastSeasonPopupState) if (LastSeasonPopupState) titleSP = `[R${Math.ceil(CacheSeasonPopShimmer.life / Game.fps)}]`;
titleSP = `[R${Math.ceil(CacheSeasonPopShimmer.life / Game.fps)}]`;
else { else {
titleSP = `[${ titleSP = `[${Number(l('CMTimerBarRenMinBar').textContent) < 0 ? '!' : ''}${Math.ceil(
Number(l('CMTimerBarRenMinBar').textContent) < 0 ? '!' : '' (Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps,
}${Math.ceil(
(Game.shimmerTypes.reindeer.maxTime -
Game.shimmerTypes.reindeer.time) /
Game.fps,
)}]`; )}]`;
} }
} }
@@ -64,9 +49,7 @@ export default function UpdateTitle() {
if (str.charAt(0) === '[') { if (str.charAt(0) === '[') {
str = str.substring(str.lastIndexOf(']') + 1); str = str.substring(str.lastIndexOf(']') + 1);
} }
document.title = `${ document.title = `${titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '')} ${str}`;
titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '')
} ${str}`;
} else if (CMOptions.Title === 2) { } else if (CMOptions.Title === 2) {
let str = ''; let str = '';
let spawn = false; let spawn = false;

View File

@@ -15,44 +15,35 @@ export default function ReplaceAscendTooltip() {
const cookiesToNext = Math.max( const cookiesToNext = Math.max(
0, 0,
Game.HowManyCookiesReset( Game.HowManyCookiesReset(
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + 1,
1,
) - ) -
(Game.cookiesEarned + Game.cookiesReset), (Game.cookiesEarned + Game.cookiesReset),
); );
const startDate = Game.sayTime( const startDate = Game.sayTime(((Date.now() - Game.startDate) / 1000) * Game.fps, -1);
((Date.now() - Game.startDate) / 1000) * Game.fps,
-1,
);
let str = ''; let str = '';
str += `You've been on this run for <b>${ str += `You've been on this run for <b>${
startDate === '' ? 'not very long' : startDate startDate === '' ? 'not very long' : startDate
}</b>.<br>`; }</b>.<br>`;
str += '<div class="line"></div>'; str += '<div class="line"></div>';
if (Game.prestige > 0) { if (Game.prestige > 0) {
str += `Your prestige level is currently <b>${Beautify( str += `Your prestige level is currently <b>${Beautify(Game.prestige)}</b>.<br>(CpS +${Beautify(
Game.prestige, Game.prestige,
)}</b>.<br>(CpS +${Beautify(Game.prestige)}%)`; )}%)`;
str += '<div class="line"></div>'; str += '<div class="line"></div>';
} }
if (CacheLastHeavenlyChips < 1) if (CacheLastHeavenlyChips < 1) str += 'Ascending now would grant you no prestige.';
str += 'Ascending now would grant you no prestige.';
else if (CacheLastHeavenlyChips < 2) else if (CacheLastHeavenlyChips < 2)
str += str +=
'Ascending now would grant you<br><b>1 prestige level</b> (+1% CpS)<br>and <b>1 heavenly chip</b> to spend.'; 'Ascending now would grant you<br><b>1 prestige level</b> (+1% CpS)<br>and <b>1 heavenly chip</b> to spend.';
else else
str += `Ascending now would grant you<br><b>${Beautify( str += `Ascending now would grant you<br><b>${Beautify(
CacheLastHeavenlyChips, CacheLastHeavenlyChips,
)} prestige levels</b> (+${Beautify( )} prestige levels</b> (+${Beautify(CacheLastHeavenlyChips)}% CpS)<br>and <b>${Beautify(
CacheLastHeavenlyChips,
)}% CpS)<br>and <b>${Beautify(
CacheLastHeavenlyChips, CacheLastHeavenlyChips,
)} heavenly chips</b> to spend.`; )} heavenly chips</b> to spend.`;
str += '<div class="line"></div>'; str += '<div class="line"></div>';
str += `You need <b>${Beautify( str += `You need <b>${Beautify(cookiesToNext)} more cookies</b> for the next level.<br>`;
cookiesToNext,
)} more cookies</b> for the next level.<br>`;
str += `${ str += `${
CMOptions.TooltipAscendButton CMOptions.TooltipAscendButton
? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you were making ${Beautify( ? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you were making ${Beautify(

View File

@@ -1,9 +1,5 @@
import UpdateTooltips from './UpdateTooltips'; import UpdateTooltips from './UpdateTooltips';
import { import { SimpleTooltipElements, TooltipName, TooltipType } from '../VariablesAndData';
SimpleTooltipElements,
TooltipName,
TooltipType,
} from '../VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding'; import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour'; import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour';
@@ -93,32 +89,20 @@ export function CreateTooltip(type, name) {
} else if (type === 'u') { } else if (type === 'u') {
// Upgrades // Upgrades
if (!Game.UpgradesInStore[name]) return ''; if (!Game.UpgradesInStore[name]) return '';
l('tooltip').innerHTML = Game.crateTooltip( l('tooltip').innerHTML = Game.crateTooltip(Game.UpgradesInStore[name], 'store');
Game.UpgradesInStore[name],
'store',
);
} else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip(); } else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip();
// Sugar Lumps // Sugar Lumps
else if (type === 'g') else if (type === 'g')
l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip( l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)();
name,
)();
// Grimoire // Grimoire
else if (type === 'p') else if (type === 'p')
l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip( l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])();
name[0],
name[1],
)();
// Harvest all button in garden // Harvest all button in garden
else if (type === 'ha') else if (type === 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)();
l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)();
else if (type === 'wb') l('tooltip').innerHTML = ''; else if (type === 'wb') l('tooltip').innerHTML = '';
else if (type === 'pag') else if (type === 'pag') l('tooltip').innerHTML = Game.Objects.Temple.minigame.godTooltip(name)();
l('tooltip').innerHTML = Game.Objects.Temple.minigame.godTooltip(name)();
else if (type === 'pas') else if (type === 'pas')
l('tooltip').innerHTML = Game.Objects.Temple.minigame.slotTooltip( l('tooltip').innerHTML = Game.Objects.Temple.minigame.slotTooltip(name[0])();
name[0],
)();
// Adds area for extra tooltip-sections // Adds area for extra tooltip-sections
if ( if (

View File

@@ -45,9 +45,7 @@ export default function Building() {
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) { if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2); l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2);
const increase = Math.round( const increase = Math.round((TooltipBonusIncome / Game.cookiesPs) * 10000);
(TooltipBonusIncome / Game.cookiesPs) * 10000,
);
if (Number.isFinite(increase) && increase !== 0) { if (Number.isFinite(increase) && increase !== 0) {
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`; l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
} else { } else {
@@ -55,8 +53,7 @@ export default function Building() {
CMOptions.ScaleSeparator ? ',' : '.' CMOptions.ScaleSeparator ? ',' : '.'
}01% of income)`; }01% of income)`;
} }
l('CMTooltipBorder').className = l('CMTooltipBorder').className = ColourTextPre + target[TooltipName].color;
ColourTextPre + target[TooltipName].color;
if (CMOptions.PPDisplayTime) if (CMOptions.PPDisplayTime)
l('CMTooltipPP').textContent = FormatTime(target[TooltipName].pp); l('CMTooltipPP').textContent = FormatTime(target[TooltipName].pp);
else l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2); else l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
@@ -65,10 +62,7 @@ export default function Building() {
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(), (TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
); );
l('CMTooltipTime').textContent = timeColour.text; l('CMTooltipTime').textContent = timeColour.text;
if ( if (timeColour.text === 'Done!' && Game.cookies < target[TooltipName].price) {
timeColour.text === 'Done!' &&
Game.cookies < target[TooltipName].price
) {
l('CMTooltipTime').textContent = `${timeColour.text} (with Wrink)`; l('CMTooltipTime').textContent = `${timeColour.text} (with Wrink)`;
} else l('CMTooltipTime').textContent = timeColour.text; } else l('CMTooltipTime').textContent = timeColour.text;
l('CMTooltipTime').className = ColourTextPre + timeColour.color; l('CMTooltipTime').className = ColourTextPre + timeColour.color;
@@ -80,18 +74,11 @@ export default function Building() {
// eslint-disable-next-line no-restricted-syntax // eslint-disable-next-line no-restricted-syntax
for (const i of Object.keys(Game.Objects[TooltipName].productionAchievs)) { for (const i of Object.keys(Game.Objects[TooltipName].productionAchievs)) {
if ( if (!Game.HasAchiev(Game.Objects[TooltipName].productionAchievs[i].achiev.name)) {
!Game.HasAchiev( const nextProductionAchiev = Game.Objects[TooltipName].productionAchievs[i];
Game.Objects[TooltipName].productionAchievs[i].achiev.name,
)
) {
const nextProductionAchiev =
Game.Objects[TooltipName].productionAchievs[i];
l('CMTooltipTime').style.marginBottom = '4px'; l('CMTooltipTime').style.marginBottom = '4px';
l('CMTooltipProductionLeftHeader').style.display = ''; l('CMTooltipProductionLeftHeader').style.display = '';
l( l('CMTooltipProductionLeft').className = `ProdAchievement${TooltipName}`;
'CMTooltipProductionLeft',
).className = `ProdAchievement${TooltipName}`;
l('CMTooltipProductionLeft').textContent = Beautify( l('CMTooltipProductionLeft').textContent = Beautify(
nextProductionAchiev.pow - SimObjects[TooltipName].totalCookies, nextProductionAchiev.pow - SimObjects[TooltipName].totalCookies,
15, 15,
@@ -109,10 +96,7 @@ export default function Building() {
let PPOfAmount; let PPOfAmount;
if (Game.cookiesPs) { if (Game.cookiesPs) {
PPOfAmount = PPOfAmount =
Math.max( Math.max(ObjectsTillNext.price - (Game.cookies + GetWrinkConfigBank()), 0) /
ObjectsTillNext.price - (Game.cookies + GetWrinkConfigBank()),
0,
) /
Game.cookiesPs + Game.cookiesPs +
ObjectsTillNext.price / ObjectsTillNext.price /
BuyBuildingsBonusIncome(TooltipName, ObjectsTillNext.AmountNeeded); BuyBuildingsBonusIncome(TooltipName, ObjectsTillNext.AmountNeeded);
@@ -128,8 +112,7 @@ export default function Building() {
const PPFrag = document.createElement('span'); const PPFrag = document.createElement('span');
if (CMOptions.PPDisplayTime) PPFrag.textContent = FormatTime(PPOfAmount); if (CMOptions.PPDisplayTime) PPFrag.textContent = FormatTime(PPOfAmount);
else PPFrag.textContent = Beautify(PPOfAmount); else PPFrag.textContent = Beautify(PPOfAmount);
PPFrag.className = PPFrag.className = ColourTextPre + ColourOfPP({ pp: PPOfAmount }, ObjectsTillNext.price);
ColourTextPre + ColourOfPP({ pp: PPOfAmount }, ObjectsTillNext.price);
l('CMTooltipNextAchievement').appendChild(PPFrag); l('CMTooltipNextAchievement').appendChild(PPFrag);
} else { } else {
l('CMTooltipNextAchievementHeader').style.display = 'none'; l('CMTooltipNextAchievementHeader').style.display = 'none';

View File

@@ -9,46 +9,31 @@ import * as Create from '../CreateTooltip';
*/ */
export default function GardenPlots() { export default function GardenPlots() {
const { minigame } = Game.Objects.Farm; const { minigame } = Game.Objects.Farm;
if ( if (CMOptions.TooltipPlots && minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0) {
CMOptions.TooltipPlots &&
minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0
) {
const mature = const mature =
minigame.plot[TooltipName[1]][TooltipName[0]][1] > minigame.plot[TooltipName[1]][TooltipName[0]][1] >
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1] minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].mature;
.mature;
const plantName = const plantName =
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1] minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].name;
.name; l('CMTooltipBorder').appendChild(Create.TooltipCreateHeader('Reward (Current / Maximum)'));
l('CMTooltipBorder').appendChild(
Create.TooltipCreateHeader('Reward (Current / Maximum)'),
);
const reward = document.createElement('div'); const reward = document.createElement('div');
reward.id = 'CMTooltipPlantReward'; reward.id = 'CMTooltipPlantReward';
l('CMTooltipBorder').appendChild(reward); l('CMTooltipBorder').appendChild(reward);
if (plantName === 'Bakeberry') { if (plantName === 'Bakeberry') {
l('CMTooltipPlantReward').textContent = `${ l('CMTooltipPlantReward').textContent = `${
mature mature ? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30)) : '0'
? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30))
: '0'
} / ${Beautify(Game.cookiesPs * 60 * 30)}`; } / ${Beautify(Game.cookiesPs * 60 * 30)}`;
} else if (plantName === 'Chocoroot' || plantName === 'White chocoroot') { } else if (plantName === 'Chocoroot' || plantName === 'White chocoroot') {
l('CMTooltipPlantReward').textContent = `${ l('CMTooltipPlantReward').textContent = `${
mature mature ? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3)) : '0'
? Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3))
: '0'
} / ${Beautify(Game.cookiesPs * 60 * 3)}`; } / ${Beautify(Game.cookiesPs * 60 * 3)}`;
} else if (plantName === 'Queenbeet') { } else if (plantName === 'Queenbeet') {
l('CMTooltipPlantReward').textContent = `${ l('CMTooltipPlantReward').textContent = `${
mature mature ? Beautify(Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60)) : '0'
? Beautify(Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60))
: '0'
} / ${Beautify(Game.cookiesPs * 60 * 60)}`; } / ${Beautify(Game.cookiesPs * 60 * 60)}`;
} else if (plantName === 'Duketater') { } else if (plantName === 'Duketater') {
l('CMTooltipPlantReward').textContent = `${ l('CMTooltipPlantReward').textContent = `${
mature mature ? Beautify(Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120)) : '0'
? Beautify(Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120))
: '0'
} / ${Beautify(Game.cookiesPs * 60 * 120)}`; } / ${Beautify(Game.cookiesPs * 60 * 120)}`;
} else l('CMTooltipArea').style.display = 'none'; } else l('CMTooltipArea').style.display = 'none';
} else l('CMTooltipArea').style.display = 'none'; } else l('CMTooltipArea').style.display = 'none';

View File

@@ -48,9 +48,7 @@ export default function Grimoire() {
// Extra information on cookies gained when spell is Conjure Baked Goods (Name === 0) // Extra information on cookies gained when spell is Conjure Baked Goods (Name === 0)
if (TooltipName === '0') { if (TooltipName === '0') {
tooltipBox.appendChild( tooltipBox.appendChild(Create.TooltipCreateHeader('Cookies to be gained/lost'));
Create.TooltipCreateHeader('Cookies to be gained/lost'),
);
const conjure = document.createElement('div'); const conjure = document.createElement('div');
conjure.id = 'x'; conjure.id = 'x';
tooltipBox.appendChild(conjure); tooltipBox.appendChild(conjure);

View File

@@ -10,9 +10,7 @@ import * as Create from '../CreateTooltip';
export default function HarvestAll() { export default function HarvestAll() {
const { minigame } = Game.Objects.Farm; const { minigame } = Game.Objects.Farm;
if (CMOptions.TooltipLump) { if (CMOptions.TooltipLump) {
l('CMTooltipBorder').appendChild( l('CMTooltipBorder').appendChild(Create.TooltipCreateHeader('Cookies gained from harvesting:'));
Create.TooltipCreateHeader('Cookies gained from harvesting:'),
);
let totalGain = 0; let totalGain = 0;
let mortal = 0; let mortal = 0;
if (Game.keys[16] && Game.keys[17]) mortal = 1; if (Game.keys[16] && Game.keys[17]) mortal = 1;
@@ -27,31 +25,17 @@ export default function HarvestAll() {
if (mortal && me.immortal) count = false; if (mortal && me.immortal) count = false;
if (tile[1] < me.matureBase) count = false; if (tile[1] < me.matureBase) count = false;
if (count && plantName === 'Bakeberry') { if (count && plantName === 'Bakeberry') {
totalGain += Math.min( totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30);
Game.cookies * 0.03, } else if ((count && plantName === 'Chocoroot') || plantName === 'White chocoroot') {
Game.cookiesPs * 60 * 30,
);
} else if (
(count && plantName === 'Chocoroot') ||
plantName === 'White chocoroot'
) {
totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3); totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3);
} else if (count && plantName === 'Queenbeet') { } else if (count && plantName === 'Queenbeet') {
totalGain += Math.min( totalGain += Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60);
Game.cookies * 0.04,
Game.cookiesPs * 60 * 60,
);
} else if (count && plantName === 'Duketater') { } else if (count && plantName === 'Duketater') {
totalGain += Math.min( totalGain += Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120);
Game.cookies * 0.08,
Game.cookiesPs * 60 * 120,
);
} }
} }
} }
} }
l('CMTooltipBorder').appendChild( l('CMTooltipBorder').appendChild(document.createTextNode(Beautify(totalGain)));
document.createTextNode(Beautify(totalGain)),
);
} else l('CMTooltipArea').style.display = 'none'; } else l('CMTooltipArea').style.display = 'none';
} }

View File

@@ -22,15 +22,11 @@ export default function PantheonGods() {
cps1.id = 'CMPantheonTooltipPosition1'; cps1.id = 'CMPantheonTooltipPosition1';
if (CacheGods[GodID][0] !== 0) { if (CacheGods[GodID][0] !== 0) {
cps1.textContent = Beautify(CacheGods[GodID][0]); cps1.textContent = Beautify(CacheGods[GodID][0]);
const increase = Math.round( const increase = Math.round((CacheGods[GodID][0] / Game.cookiesPs) * 10000);
(CacheGods[GodID][0] / Game.cookiesPs) * 10000,
);
if (Number.isFinite(increase) && increase !== 0) { if (Number.isFinite(increase) && increase !== 0) {
cps1.textContent += ` (${increase / 100}% of income)`; cps1.textContent += ` (${increase / 100}% of income)`;
} else { } else {
cps1.textContent += ` (<0${ cps1.textContent += ` (<0${CMOptions.ScaleSeparator ? ',' : '.'}01% of income)`;
CMOptions.ScaleSeparator ? ',' : '.'
}01% of income)`;
} }
} else cps1.textContent = 'No effect to CPS'; } else cps1.textContent = 'No effect to CPS';
tooltipBox.appendChild(cps1); tooltipBox.appendChild(cps1);
@@ -40,15 +36,11 @@ export default function PantheonGods() {
cps2.id = 'CMPantheonTooltipPosition2'; cps2.id = 'CMPantheonTooltipPosition2';
if (CacheGods[GodID][1] !== 0) { if (CacheGods[GodID][1] !== 0) {
cps2.textContent = Beautify(CacheGods[GodID][1]); cps2.textContent = Beautify(CacheGods[GodID][1]);
const increase = Math.round( const increase = Math.round((CacheGods[GodID][1] / Game.cookiesPs) * 10000);
(CacheGods[GodID][1] / Game.cookiesPs) * 10000,
);
if (Number.isFinite(increase) && increase !== 0) { if (Number.isFinite(increase) && increase !== 0) {
cps2.textContent += ` (${increase / 100}% of income)`; cps2.textContent += ` (${increase / 100}% of income)`;
} else { } else {
cps2.textContent += ` (<0${ cps2.textContent += ` (<0${CMOptions.ScaleSeparator ? ',' : '.'}01% of income)`;
CMOptions.ScaleSeparator ? ',' : '.'
}01% of income)`;
} }
} else cps2.textContent = 'No effect to CPS'; } else cps2.textContent = 'No effect to CPS';
tooltipBox.appendChild(cps2); tooltipBox.appendChild(cps2);
@@ -58,15 +50,11 @@ export default function PantheonGods() {
cps3.id = 'CMPantheonTooltipPosition2'; cps3.id = 'CMPantheonTooltipPosition2';
if (CacheGods[GodID][2] !== 0) { if (CacheGods[GodID][2] !== 0) {
cps3.textContent = Beautify(CacheGods[GodID][2]); cps3.textContent = Beautify(CacheGods[GodID][2]);
const increase = Math.round( const increase = Math.round((CacheGods[GodID][2] / Game.cookiesPs) * 10000);
(CacheGods[GodID][2] / Game.cookiesPs) * 10000,
);
if (Number.isFinite(increase) && increase !== 0) { if (Number.isFinite(increase) && increase !== 0) {
cps3.textContent += ` (${increase / 100}% of income)`; cps3.textContent += ` (${increase / 100}% of income)`;
} else { } else {
cps3.textContent += ` (<0${ cps3.textContent += ` (<0${CMOptions.ScaleSeparator ? ',' : '.'}01% of income)`;
CMOptions.ScaleSeparator ? ',' : '.'
}01% of income)`;
} }
} else cps3.textContent = 'No effect to CPS'; } else cps3.textContent = 'No effect to CPS';
tooltipBox.appendChild(cps3); tooltipBox.appendChild(cps3);

View File

@@ -1,7 +1,4 @@
import { import { CacheLastChoEgg, CacheUpgrades } from '../../../Cache/VariablesAndData';
CacheLastChoEgg,
CacheUpgrades,
} from '../../../Cache/VariablesAndData';
import { CMOptions } from '../../../Config/VariablesAndData'; import { CMOptions } from '../../../Config/VariablesAndData';
import Beautify from '../../BeautifyAndFormatting/Beautify'; import Beautify from '../../BeautifyAndFormatting/Beautify';
import FormatTime from '../../BeautifyAndFormatting/FormatTime'; import FormatTime from '../../BeautifyAndFormatting/FormatTime';
@@ -25,22 +22,15 @@ export default function Upgrade() {
const tooltipBox = l('CMTooltipBorder'); const tooltipBox = l('CMTooltipBorder');
Create.TooltipCreateCalculationSection(tooltipBox); Create.TooltipCreateCalculationSection(tooltipBox);
TooltipBonusIncome = TooltipBonusIncome = CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonus;
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonus; TooltipPrice = Game.Upgrades[Game.UpgradesInStore[TooltipName].name].getPrice();
TooltipPrice = Game.Upgrades[ TooltipBonusMouse = CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonusMouse;
Game.UpgradesInStore[TooltipName].name
].getPrice();
TooltipBonusMouse =
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonusMouse;
if (CMOptions.TooltipBuildUpgrade === 1) { if (CMOptions.TooltipBuildUpgrade === 1) {
l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2); l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2);
const increase = Math.round((TooltipBonusIncome / Game.cookiesPs) * 10000); const increase = Math.round((TooltipBonusIncome / Game.cookiesPs) * 10000);
// Don't display certain parts of tooltip if not applicable // Don't display certain parts of tooltip if not applicable
if ( if (l('CMTooltipIncome').textContent === '0' && (TooltipType === 'b' || TooltipType === 'u')) {
l('CMTooltipIncome').textContent === '0' &&
(TooltipType === 'b' || TooltipType === 'u')
) {
l('Bonus IncomeTitle').style.display = 'none'; l('Bonus IncomeTitle').style.display = 'none';
l('CMTooltipIncome').style.display = 'none'; l('CMTooltipIncome').style.display = 'none';
l('Payback PeriodTitle').style.display = 'none'; l('Payback PeriodTitle').style.display = 'none';
@@ -54,8 +44,7 @@ export default function Upgrade() {
}01% of income)`; }01% of income)`;
} }
l('CMTooltipBorder').className = l('CMTooltipBorder').className =
ColourTextPre + ColourTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
// If clicking power upgrade // If clicking power upgrade
if (TooltipBonusMouse) { if (TooltipBonusMouse) {
l('CMTooltipCookiePerClick').textContent = Beautify(TooltipBonusMouse); l('CMTooltipCookiePerClick').textContent = Beautify(TooltipBonusMouse);
@@ -64,9 +53,7 @@ export default function Upgrade() {
} }
// If only a clicking power upgrade change PP to click-based period // If only a clicking power upgrade change PP to click-based period
if (TooltipBonusIncome === 0 && TooltipBonusMouse) { if (TooltipBonusIncome === 0 && TooltipBonusMouse) {
l('CMTooltipPP').textContent = `${Beautify( l('CMTooltipPP').textContent = `${Beautify(TooltipPrice / TooltipBonusMouse)} Clicks`;
TooltipPrice / TooltipBonusMouse,
)} Clicks`;
l('CMTooltipPP').style.color = 'white'; l('CMTooltipPP').style.color = 'white';
} else { } else {
if (CMOptions.PPDisplayTime) if (CMOptions.PPDisplayTime)
@@ -79,8 +66,7 @@ export default function Upgrade() {
2, 2,
); );
l('CMTooltipPP').className = l('CMTooltipPP').className =
ColourTextPre + ColourTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
} }
} }
const timeColour = GetTimeColour( const timeColour = GetTimeColour(
@@ -103,9 +89,7 @@ export default function Upgrade() {
); );
const chocolate = document.createElement('div'); const chocolate = document.createElement('div');
chocolate.style.color = 'white'; chocolate.style.color = 'white';
chocolate.textContent = `${Beautify(Game.cookies * 0.05)} / ${Beautify( chocolate.textContent = `${Beautify(Game.cookies * 0.05)} / ${Beautify(CacheLastChoEgg)}`;
CacheLastChoEgg,
)}`;
l('CMTooltipBorder').appendChild(chocolate); l('CMTooltipBorder').appendChild(chocolate);
} }
} else l('CMTooltipArea').style.display = 'none'; } else l('CMTooltipArea').style.display = 'none';

View File

@@ -6,11 +6,7 @@ import Beautify from '../../BeautifyAndFormatting/Beautify';
import FormatTime from '../../BeautifyAndFormatting/FormatTime'; import FormatTime from '../../BeautifyAndFormatting/FormatTime';
import GetCPS from '../../HelperFunctions/GetCPS'; import GetCPS from '../../HelperFunctions/GetCPS';
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank'; import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
import { import { TooltipBonusIncome, TooltipPrice, TooltipType } from '../../VariablesAndData';
TooltipBonusIncome,
TooltipPrice,
TooltipType,
} from '../../VariablesAndData';
import * as Create from '../CreateTooltip'; import * as Create from '../CreateTooltip';
/** /**
@@ -23,16 +19,10 @@ export default function Warnings() {
ToggleToolWarnPos(); ToggleToolWarnPos();
} }
if (CMOptions.ToolWarnPos === 0) if (CMOptions.ToolWarnPos === 0) l('CMDispTooltipWarningParent').style.right = '0px';
l('CMDispTooltipWarningParent').style.right = '0px'; else l('CMDispTooltipWarningParent').style.top = `${l('tooltip').offsetHeight}px`;
else
l('CMDispTooltipWarningParent').style.top = `${
l('tooltip').offsetHeight
}px`;
l('CMDispTooltipWarningParent').style.width = `${ l('CMDispTooltipWarningParent').style.width = `${l('tooltip').offsetWidth - 6}px`;
l('tooltip').offsetWidth - 6
}px`;
const amount = Game.cookies + GetWrinkConfigBank() - TooltipPrice; const amount = Game.cookies + GetWrinkConfigBank() - TooltipPrice;
const bonusIncomeUsed = CMOptions.ToolWarnBon ? TooltipBonusIncome : 0; const bonusIncomeUsed = CMOptions.ToolWarnBon ? TooltipBonusIncome : 0;
@@ -48,72 +38,46 @@ export default function Warnings() {
l('CMDispTooltipWarnLucky').style.display = ''; l('CMDispTooltipWarnLucky').style.display = '';
l('CMDispTooltipWarnLuckyText').textContent = `${Beautify( l('CMDispTooltipWarnLuckyText').textContent = `${Beautify(
limitLucky - amount, limitLucky - amount,
)} (${FormatTime( )} (${FormatTime((limitLucky - amount) / (GetCPS() + bonusIncomeUsed))})`;
(limitLucky - amount) / (GetCPS() + bonusIncomeUsed),
)})`;
} else l('CMDispTooltipWarnLucky').style.display = 'none'; } else l('CMDispTooltipWarnLucky').style.display = 'none';
} else l('CMDispTooltipWarnLucky').style.display = 'none'; } else l('CMDispTooltipWarnLucky').style.display = 'none';
if (CMOptions.ToolWarnLuckyFrenzy === 1) { if (CMOptions.ToolWarnLuckyFrenzy === 1) {
const limitLuckyFrenzy = limitLucky * 7; const limitLuckyFrenzy = limitLucky * 7;
if ( if (amount < limitLuckyFrenzy && (TooltipType !== 'b' || Game.buyMode === 1)) {
amount < limitLuckyFrenzy &&
(TooltipType !== 'b' || Game.buyMode === 1)
) {
l('CMDispTooltipWarnLuckyFrenzy').style.display = ''; l('CMDispTooltipWarnLuckyFrenzy').style.display = '';
l('CMDispTooltipWarnLuckyFrenzyText').textContent = `${Beautify( l('CMDispTooltipWarnLuckyFrenzyText').textContent = `${Beautify(
limitLuckyFrenzy - amount, limitLuckyFrenzy - amount,
)} (${FormatTime( )} (${FormatTime((limitLuckyFrenzy - amount) / (GetCPS() + bonusIncomeUsed))})`;
(limitLuckyFrenzy - amount) / (GetCPS() + bonusIncomeUsed),
)})`;
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none'; } else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none'; } else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
if (CMOptions.ToolWarnConjure === 1) { if (CMOptions.ToolWarnConjure === 1) {
const limitConjure = limitLucky * 2; const limitConjure = limitLucky * 2;
if ( if (amount < limitConjure && (TooltipType !== 'b' || Game.buyMode === 1)) {
amount < limitConjure &&
(TooltipType !== 'b' || Game.buyMode === 1)
) {
l('CMDispTooltipWarnConjure').style.display = ''; l('CMDispTooltipWarnConjure').style.display = '';
l('CMDispTooltipWarnConjureText').textContent = `${Beautify( l('CMDispTooltipWarnConjureText').textContent = `${Beautify(
limitConjure - amount, limitConjure - amount,
)} (${FormatTime( )} (${FormatTime((limitConjure - amount) / (GetCPS() + bonusIncomeUsed))})`;
(limitConjure - amount) / (GetCPS() + bonusIncomeUsed),
)})`;
} else l('CMDispTooltipWarnConjure').style.display = 'none'; } else l('CMDispTooltipWarnConjure').style.display = 'none';
} else l('CMDispTooltipWarnConjure').style.display = 'none'; } else l('CMDispTooltipWarnConjure').style.display = 'none';
if (CMOptions.ToolWarnConjureFrenzy === 1) { if (CMOptions.ToolWarnConjureFrenzy === 1) {
const limitConjureFrenzy = limitLucky * 2 * 7; const limitConjureFrenzy = limitLucky * 2 * 7;
if ( if (amount < limitConjureFrenzy && (TooltipType !== 'b' || Game.buyMode === 1)) {
amount < limitConjureFrenzy &&
(TooltipType !== 'b' || Game.buyMode === 1)
) {
l('CMDispTooltipWarnConjureFrenzy').style.display = ''; l('CMDispTooltipWarnConjureFrenzy').style.display = '';
l('CMDispTooltipWarnConjureFrenzyText').textContent = `${Beautify( l('CMDispTooltipWarnConjureFrenzyText').textContent = `${Beautify(
limitConjureFrenzy - amount, limitConjureFrenzy - amount,
)} (${FormatTime( )} (${FormatTime((limitConjureFrenzy - amount) / (GetCPS() + bonusIncomeUsed))})`;
(limitConjureFrenzy - amount) / (GetCPS() + bonusIncomeUsed),
)})`;
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none'; } else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none'; } else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
if ( if (CMOptions.ToolWarnEdifice === 1 && Game.Objects['Wizard tower'].minigameLoaded) {
CMOptions.ToolWarnEdifice === 1 && if (CacheEdifice && amount < CacheEdifice && (TooltipType !== 'b' || Game.buyMode === 1)) {
Game.Objects['Wizard tower'].minigameLoaded
) {
if (
CacheEdifice &&
amount < CacheEdifice &&
(TooltipType !== 'b' || Game.buyMode === 1)
) {
l('CMDispTooltipWarnEdifice').style.display = ''; l('CMDispTooltipWarnEdifice').style.display = '';
l('CMDispTooltipWarnEdificeText').textContent = `${Beautify( l('CMDispTooltipWarnEdificeText').textContent = `${Beautify(
CacheEdifice - amount, CacheEdifice - amount,
)} (${FormatTime( )} (${FormatTime((CacheEdifice - amount) / (GetCPS() + bonusIncomeUsed))})`;
(CacheEdifice - amount) / (GetCPS() + bonusIncomeUsed),
)})`;
} else l('CMDispTooltipWarnEdifice').style.display = 'none'; } else l('CMDispTooltipWarnEdifice').style.display = 'none';
} else l('CMDispTooltipWarnEdifice').style.display = 'none'; } else l('CMDispTooltipWarnEdifice').style.display = 'none';
@@ -130,8 +94,7 @@ export default function Warnings() {
l('CMDispTooltipWarnUserText').textContent = `${Beautify( l('CMDispTooltipWarnUserText').textContent = `${Beautify(
CMOptions.ToolWarnUser * GetCPS() - amount, CMOptions.ToolWarnUser * GetCPS() - amount,
)} (${FormatTime( )} (${FormatTime(
(CMOptions.ToolWarnUser * GetCPS() - amount) / (CMOptions.ToolWarnUser * GetCPS() - amount) / (GetCPS() + bonusIncomeUsed),
(GetCPS() + bonusIncomeUsed),
)})`; )})`;
} else l('CMDispTooltipWarnUser').style.display = 'none'; } else l('CMDispTooltipWarnUser').style.display = 'none';
} else l('CMDispTooltipWarnUser').style.display = 'none'; } else l('CMDispTooltipWarnUser').style.display = 'none';

View File

@@ -1,7 +1,4 @@
import { import { CacheWrinklersFattest, CacheWrinklersTotal } from '../../../Cache/VariablesAndData';
CacheWrinklersFattest,
CacheWrinklersTotal,
} from '../../../Cache/VariablesAndData';
import Beautify from '../../BeautifyAndFormatting/Beautify'; import Beautify from '../../BeautifyAndFormatting/Beautify';
import { TooltipName } from '../../VariablesAndData'; import { TooltipName } from '../../VariablesAndData';
import * as Create from '../CreateTooltip'; import * as Create from '../CreateTooltip';

View File

@@ -35,10 +35,7 @@ export default function UpdateTooltips() {
HarvestAll(); HarvestAll();
} else if (TooltipType === 'wb') { } else if (TooltipType === 'wb') {
WrinklerButton(); WrinklerButton();
} else if ( } else if (TooltipType === 'pag' || (TooltipType === 'pas' && TooltipName[1] !== -1)) {
TooltipType === 'pag' ||
(TooltipType === 'pas' && TooltipName[1] !== -1)
) {
PantheonGods(); PantheonGods();
} }
Warnings(); Warnings();

View File

@@ -20,10 +20,7 @@ export function CheckWrinklerTooltip() {
const me = Game.wrinklers[i]; const me = Game.wrinklers[i];
if (me.phase > 0 && me.selected) { if (me.phase > 0 && me.selected) {
showingTooltip = true; showingTooltip = true;
if ( if (TooltipWrinklerBeingShown[i] === 0 || TooltipWrinklerBeingShown[i] === undefined) {
TooltipWrinklerBeingShown[i] === 0 ||
TooltipWrinklerBeingShown[i] === undefined
) {
const placeholder = document.createElement('div'); const placeholder = document.createElement('div');
const wrinkler = document.createElement('div'); const wrinkler = document.createElement('div');
wrinkler.style.minWidth = '120px'; wrinkler.style.minWidth = '120px';

View File

@@ -73,11 +73,7 @@ export const TooltipText = [
'The amount of cookies you would get from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and then buying Chocolate egg', 'The amount of cookies you would get from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and then buying Chocolate egg',
'300px', '300px',
], ],
[ ['ChainNextLevelPlaceholder', 'Cheated cookies might break this formula', '250px'],
'ChainNextLevelPlaceholder',
'Cheated cookies might break this formula',
'250px',
],
[ [
'FavouriteSettingPlaceholder', 'FavouriteSettingPlaceholder',
"Click to set this setting as favourite and show it in 'favourite' settings at the top of the Cookie Monster Settings", "Click to set this setting as favourite and show it in 'favourite' settings at the top of the Cookie Monster Settings",

View File

@@ -11,8 +11,7 @@ export default function load(str) {
const save = JSON.parse(str); const save = JSON.parse(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; // eslint-disable-line no-unused-vars
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,7 +1,4 @@
import { import { CacheSpawnedGoldenShimmer, CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
CacheSpawnedGoldenShimmer,
CacheGoldenShimmersByID,
} from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
import CreateGCTimer from '../../Disp/GoldenCookieTimers/GoldenCookieTimers'; import CreateGCTimer from '../../Disp/GoldenCookieTimers/GoldenCookieTimers';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
@@ -69,11 +66,8 @@ export default function CheckGoldenCookie() {
} 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;
GCTimers[i].style.transform = GCTimers[i].style.transform = CacheGoldenShimmersByID[i].l.style.transform;
CacheGoldenShimmersByID[i].l.style.transform; GCTimers[i].textContent = Math.ceil(CacheGoldenShimmersByID[i].life / Game.fps);
GCTimers[i].textContent = Math.ceil(
CacheGoldenShimmersByID[i].life / Game.fps,
);
}); });
} }
} }

View File

@@ -9,10 +9,7 @@ import { LastMagicBarFull } from '../VariablesAndData';
* It is called by CM.Main.Loop * It is called by CM.Main.Loop
*/ */
export default function CheckMagicMeter() { export default function CheckMagicMeter() {
if ( if (Game.Objects['Wizard tower'].minigameLoaded && CMOptions.GrimoireBar === 1) {
Game.Objects['Wizard tower'].minigameLoaded &&
CMOptions.GrimoireBar === 1
) {
const { minigame } = Game.Objects['Wizard tower']; const { minigame } = Game.Objects['Wizard tower'];
if (minigame.magic < minigame.magicM) LastMagicBarFull = false; if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
else if (!LastMagicBarFull) { else if (!LastMagicBarFull) {

View File

@@ -9,20 +9,11 @@ import { LastTickerFortuneState } from '../VariablesAndData';
* It is called by CM.Main.Loop * It is called by CM.Main.Loop
*/ */
export default function CheckTickerFortune() { export default function CheckTickerFortune() {
if ( if (LastTickerFortuneState !== (Game.TickerEffect && Game.TickerEffect.type === 'fortune')) {
LastTickerFortuneState !== LastTickerFortuneState = Game.TickerEffect && Game.TickerEffect.type === 'fortune';
(Game.TickerEffect && Game.TickerEffect.type === 'fortune')
) {
LastTickerFortuneState =
Game.TickerEffect && Game.TickerEffect.type === 'fortune';
if (LastTickerFortuneState) { if (LastTickerFortuneState) {
Flash(3, 'FortuneFlash', false); Flash(3, 'FortuneFlash', false);
PlaySound( PlaySound(CMOptions.FortuneSoundURL, 'FortuneSound', 'FortuneVolume', false);
CMOptions.FortuneSoundURL,
'FortuneSound',
'FortuneVolume',
false,
);
CreateNotification( CreateNotification(
'FortuneNotification', 'FortuneNotification',
'Fortune Cookie found', 'Fortune Cookie found',

View File

@@ -16,36 +16,17 @@ export default function CheckWrinklerCount() {
}); });
if (CurrentWrinklers > LastWrinklerCount) { if (CurrentWrinklers > LastWrinklerCount) {
LastWrinklerCount = CurrentWrinklers; LastWrinklerCount = CurrentWrinklers;
if ( if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxFlash) {
CurrentWrinklers === Game.getWrinklersMax() &&
CMOptions.WrinklerMaxFlash
) {
Flash(3, 'WrinklerMaxFlash', false); Flash(3, 'WrinklerMaxFlash', false);
} else { } else {
Flash(3, 'WrinklerFlash', false); Flash(3, 'WrinklerFlash', false);
} }
if ( if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxSound) {
CurrentWrinklers === Game.getWrinklersMax() && PlaySound(CMOptions.WrinklerMaxSoundURL, 'WrinklerMaxSound', 'WrinklerMaxVolume', false);
CMOptions.WrinklerMaxSound
) {
PlaySound(
CMOptions.WrinklerMaxSoundURL,
'WrinklerMaxSound',
'WrinklerMaxVolume',
false,
);
} else { } else {
PlaySound( PlaySound(CMOptions.WrinklerSoundURL, 'WrinklerSound', 'WrinklerVolume', false);
CMOptions.WrinklerSoundURL,
'WrinklerSound',
'WrinklerVolume',
false,
);
} }
if ( if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxNotification) {
CurrentWrinklers === Game.getWrinklersMax() &&
CMOptions.WrinklerMaxNotification
) {
CreateNotification( CreateNotification(
'WrinklerMaxNotification', 'WrinklerMaxNotification',
'Maximum Wrinklers Reached', 'Maximum Wrinklers Reached',

View File

@@ -40,11 +40,7 @@ export default function InitializeCookieMonster() {
CreateSectionHideButtons(); CreateSectionHideButtons();
CreateFavicon(); CreateFavicon();
Object.keys(TooltipText).forEach((i) => { Object.keys(TooltipText).forEach((i) => {
CreateSimpleTooltip( CreateSimpleTooltip(TooltipText[i][0], TooltipText[i][1], TooltipText[i][2]);
TooltipText[i][0],
TooltipText[i][1],
TooltipText[i][2],
);
}); });
CreateWrinklerButtons(); CreateWrinklerButtons();
UpdateBuildingUpgradeStyle(); UpdateBuildingUpgradeStyle();
@@ -61,17 +57,8 @@ export default function InitializeCookieMonster() {
CMLastAscendState = Game.OnAscend; // eslint-disable-line no-unused-vars CMLastAscendState = Game.OnAscend; // eslint-disable-line no-unused-vars
if (Game.prefs.popups) if (Game.prefs.popups)
Game.Popup( Game.Popup(`Cookie Monster version ${VersionMajor}.${VersionMinor} loaded!`);
`Cookie Monster version ${VersionMajor}.${VersionMinor} loaded!`, else Game.Notify(`Cookie Monster version ${VersionMajor}.${VersionMinor} loaded!`, '', '', 1, 1);
);
else
Game.Notify(
`Cookie Monster version ${VersionMajor}.${VersionMinor} loaded!`,
'',
'',
1,
1,
);
Game.Win('Third-party'); Game.Win('Third-party');
} }

View File

@@ -4,22 +4,13 @@ import CacheNoGoldSwitchCPS from '../Cache/CPS/NoGoldSwitchCPS';
import CacheSellAllForChoEgg from '../Cache/CPS/SellChoEgg'; import CacheSellAllForChoEgg from '../Cache/CPS/SellChoEgg';
import CacheDragonCost from '../Cache/Dragon/Dragon'; import CacheDragonCost from '../Cache/Dragon/Dragon';
import CachePantheonGods from '../Cache/PantheonGods/CacheGods'; import CachePantheonGods from '../Cache/PantheonGods/CacheGods';
import { import { CacheBuildingsPrices, CacheIncome } from '../Cache/PriceAndIncome/PriceAndIncome';
CacheBuildingsPrices,
CacheIncome,
} from '../Cache/PriceAndIncome/PriceAndIncome';
import { CacheChain } from '../Cache/Stats/ChainCookies'; import { CacheChain } from '../Cache/Stats/ChainCookies';
import CacheAllMissingUpgrades from '../Cache/Stats/MissingUpgrades'; import CacheAllMissingUpgrades from '../Cache/Stats/MissingUpgrades';
import CacheSeasonSpec from '../Cache/Stats/Reindeer'; import CacheSeasonSpec from '../Cache/Stats/Reindeer';
import { import { CacheGoldenAndWrathCookiesMults, CacheStatsCookies } from '../Cache/Stats/Stats';
CacheGoldenAndWrathCookiesMults,
CacheStatsCookies,
} from '../Cache/Stats/Stats';
import AllAmountTillNextAchievement from '../Cache/TillNextAchievement/AllAmountTillNextAchievement'; import AllAmountTillNextAchievement from '../Cache/TillNextAchievement/AllAmountTillNextAchievement';
import { import { CacheDoRemakeBuildPrices, CacheHadBuildAura } from '../Cache/VariablesAndData';
CacheDoRemakeBuildPrices,
CacheHadBuildAura,
} from '../Cache/VariablesAndData';
import UpdateAscendState from '../Disp/HelperFunctions/UpdateAscendState'; import UpdateAscendState from '../Disp/HelperFunctions/UpdateAscendState';
import { LastAscendState } from '../Disp/VariablesAndData'; import { LastAscendState } from '../Disp/VariablesAndData';
import InitData from '../Sim/InitializeData/InitData'; import InitData from '../Sim/InitializeData/InitData';

View File

@@ -14,21 +14,14 @@ import ReplaceTooltipGrimoire from './TooltipGrimoire';
* This function fixes replaces the .draw function of the Grimoire * This function fixes replaces the .draw function of the Grimoire
*/ */
function ReplaceNativeGrimoireDraw() { function ReplaceNativeGrimoireDraw() {
if ( if (!HasReplaceNativeGrimoireDraw && Game.Objects['Wizard tower'].minigameLoaded) {
!HasReplaceNativeGrimoireDraw &&
Game.Objects['Wizard tower'].minigameLoaded
) {
const { minigame } = Game.Objects['Wizard tower']; const { minigame } = Game.Objects['Wizard tower'];
BackupGrimoireDraw = minigame.draw; BackupGrimoireDraw = minigame.draw;
Game.Objects['Wizard tower'].minigame.draw = function () { Game.Objects['Wizard tower'].minigame.draw = function () {
BackupGrimoireDraw(); BackupGrimoireDraw();
if (CMOptions.GrimoireBar === 1 && minigame.magic < minigame.magicM) { if (CMOptions.GrimoireBar === 1 && minigame.magic < minigame.magicM) {
minigame.magicBarTextL.innerHTML += ` (${FormatTime( minigame.magicBarTextL.innerHTML += ` (${FormatTime(
CalculateGrimoireRefillTime( CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM),
minigame.magic,
minigame.magicM,
minigame.magicM,
),
)})`; )})`;
} }
}; };
@@ -40,10 +33,7 @@ function ReplaceNativeGrimoireDraw() {
* This function fixes replaces the .launch function of the Grimoire * This function fixes replaces the .launch function of the Grimoire
*/ */
function ReplaceNativeGrimoireLaunch() { function ReplaceNativeGrimoireLaunch() {
if ( if (!HasReplaceNativeGrimoireLaunch && Game.Objects['Wizard tower'].minigameLoaded) {
!HasReplaceNativeGrimoireLaunch &&
Game.Objects['Wizard tower'].minigameLoaded
) {
const { minigame } = Game.Objects['Wizard tower']; const { minigame } = Game.Objects['Wizard tower'];
BackupGrimoireLaunch = minigame.launch; // eslint-disable-line no-unused-vars BackupGrimoireLaunch = minigame.launch; // eslint-disable-line no-unused-vars
BackupGrimoireLaunchMod = new Function( // eslint-disable-line no-new-func BackupGrimoireLaunchMod = new Function( // eslint-disable-line no-new-func

View File

@@ -6,21 +6,15 @@ import { TooltipGrimoireBackup } from '../VariablesAndData';
*/ */
export default function ReplaceTooltipGrimoire() { export default function ReplaceTooltipGrimoire() {
if (Game.Objects['Wizard tower'].minigameLoaded) { if (Game.Objects['Wizard tower'].minigameLoaded) {
Object.keys(Game.Objects['Wizard tower'].minigame.spellsById).forEach( Object.keys(Game.Objects['Wizard tower'].minigame.spellsById).forEach((i) => {
(i) => { if (l(`grimoireSpell${i}`).onmouseover !== null) {
if (l(`grimoireSpell${i}`).onmouseover !== null) { TooltipGrimoireBackup[i] = l(`grimoireSpell${i}`).onmouseover;
TooltipGrimoireBackup[i] = l(`grimoireSpell${i}`).onmouseover; l(`grimoireSpell${i}`).onmouseover = function () {
l(`grimoireSpell${i}`).onmouseover = function () { Game.tooltip.dynamic = 1;
Game.tooltip.dynamic = 1; Game.tooltip.draw(this, () => CreateTooltip('g', `${i}`), 'this');
Game.tooltip.draw( Game.tooltip.wobble();
this, };
() => CreateTooltip('g', `${i}`), }
'this', });
);
Game.tooltip.wobble();
};
}
},
);
} }
} }

View File

@@ -15,11 +15,7 @@ export default function ReplaceTooltipUpgrade() {
if (!Game.mouseDown) { if (!Game.mouseDown) {
Game.setOnCrate(this); Game.setOnCrate(this);
Game.tooltip.dynamic = 1; Game.tooltip.dynamic = 1;
Game.tooltip.draw( Game.tooltip.draw(this, () => CreateTooltip('u', `${i}`), 'store');
this,
() => CreateTooltip('u', `${i}`),
'store',
);
Game.tooltip.wobble(); Game.tooltip.wobble();
} }
}; };

View File

@@ -1,11 +1,7 @@
/** Functions related to replacing tooltips */ /** Functions related to replacing tooltips */
import { CreateTooltip } from '../../Disp/Tooltips/Tooltip'; import { CreateTooltip } from '../../Disp/Tooltips/Tooltip';
import { import { LoadMinigames, TooltipBuildBackup, TooltipLumpBackup } from '../VariablesAndData';
LoadMinigames,
TooltipBuildBackup,
TooltipLumpBackup,
} from '../VariablesAndData';
import ReplaceNativeGrimoire from './NativeGrimoire'; import ReplaceNativeGrimoire from './NativeGrimoire';
import ReplaceTooltipGrimoire from './TooltipGrimoire'; import ReplaceTooltipGrimoire from './TooltipGrimoire';
@@ -19,11 +15,7 @@ function ReplaceTooltipBuild() {
TooltipBuildBackup[i] = l(`product${me.id}`).onmouseover; TooltipBuildBackup[i] = l(`product${me.id}`).onmouseover;
l(`product${me.id}`).onmouseover = function () { l(`product${me.id}`).onmouseover = function () {
Game.tooltip.dynamic = 1; Game.tooltip.dynamic = 1;
Game.tooltip.draw( Game.tooltip.draw(this, () => CreateTooltip('b', `${i}`), 'store');
this,
() => CreateTooltip('b', `${i}`),
'store',
);
Game.tooltip.wobble(); Game.tooltip.wobble();
}; };
} }
@@ -38,11 +30,7 @@ function ReplaceTooltipLump() {
TooltipLumpBackup = l('lumps').onmouseover; // eslint-disable-line no-unused-vars 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(this, () => CreateTooltip('s', 'Lump'), 'this');
this,
() => CreateTooltip('s', 'Lump'),
'this',
);
Game.tooltip.wobble(); Game.tooltip.wobble();
}; };
} }
@@ -55,11 +43,7 @@ function ReplaceTooltipGarden() {
if (Game.Objects.Farm.minigameLoaded) { if (Game.Objects.Farm.minigameLoaded) {
l('gardenTool-1').onmouseover = function () { l('gardenTool-1').onmouseover = function () {
Game.tooltip.dynamic = 1; Game.tooltip.dynamic = 1;
Game.tooltip.draw( Game.tooltip.draw(this, () => CreateTooltip('ha', 'HarvestAllButton'), 'this');
this,
() => CreateTooltip('ha', 'HarvestAllButton'),
'this',
);
Game.tooltip.wobble(); Game.tooltip.wobble();
}; };
Array.from(l('gardenPlot').children).forEach((child) => { Array.from(l('gardenPlot').children).forEach((child) => {
@@ -67,11 +51,7 @@ function ReplaceTooltipGarden() {
// eslint-disable-next-line no-param-reassign // 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(this, () => CreateTooltip('p', [`${coords[0]}`, `${coords[2]}`]), 'this');
this,
() => CreateTooltip('p', [`${coords[0]}`, `${coords[2]}`]),
'this',
);
Game.tooltip.wobble(); Game.tooltip.wobble();
}; };
}); });
@@ -83,11 +63,7 @@ function ReplaceTooltipPantheon() {
for (let i = 0; i < 11; i += 1) { for (let i = 0; i < 11; i += 1) {
l(`templeGod${i}`).onmouseover = function () { l(`templeGod${i}`).onmouseover = function () {
Game.tooltip.dynamic = 1; Game.tooltip.dynamic = 1;
Game.tooltip.draw( Game.tooltip.draw(this, () => CreateTooltip('pag', i), 'this');
this,
() => CreateTooltip('pag', i),
'this',
);
Game.tooltip.wobble(); Game.tooltip.wobble();
}; };
} }
@@ -96,10 +72,7 @@ function ReplaceTooltipPantheon() {
Game.tooltip.dynamic = 1; Game.tooltip.dynamic = 1;
Game.tooltip.draw( Game.tooltip.draw(
this, this,
() => CreateTooltip('pas', [ () => CreateTooltip('pas', [i, Game.Objects.Temple.minigame.slot[i]]),
i,
Game.Objects.Temple.minigame.slot[i],
]),
'this', 'this',
); );
Game.tooltip.wobble(); Game.tooltip.wobble();

View File

@@ -45,10 +45,7 @@ export default function ReplaceNative() {
BackupFunctions.tooltip.update = Game.tooltip.update; BackupFunctions.tooltip.update = Game.tooltip.update;
BackupFunctions.tooltip.updateMod = new Function( // eslint-disable-line no-new-func BackupFunctions.tooltip.updateMod = new Function( // eslint-disable-line no-new-func
`return ${Game.tooltip.update `return ${Game.tooltip.update.toString().split('this.').join('Game.tooltip.')}`,
.toString()
.split('this.')
.join('Game.tooltip.')}`,
)(); )();
Game.tooltip.update = function () { Game.tooltip.update = function () {
BackupFunctions.tooltip.updateMod(); BackupFunctions.tooltip.updateMod();
@@ -119,10 +116,7 @@ export default function ReplaceNative() {
BackupFunctions.UpdateMenu = Game.UpdateMenu; BackupFunctions.UpdateMenu = Game.UpdateMenu;
Game.UpdateMenu = function () { Game.UpdateMenu = function () {
if ( if (typeof jscolor.picker === 'undefined' || typeof jscolor.picker.owner === 'undefined') {
typeof jscolor.picker === 'undefined' ||
typeof jscolor.picker.owner === 'undefined'
) {
BackupFunctions.UpdateMenu(); BackupFunctions.UpdateMenu();
AddMenu(); AddMenu();
} }
@@ -131,8 +125,7 @@ export default function ReplaceNative() {
BackupFunctions.sayTime = Game.sayTime; BackupFunctions.sayTime = Game.sayTime;
// eslint-disable-next-line no-unused-vars // 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);
return FormatTime(time / Game.fps, 1); return FormatTime(time / Game.fps, 1);
}; };

View File

@@ -1,7 +1,4 @@
import { import { TooltipWrinklerArea, TooltipWrinklerBeingShown } from '../../Disp/VariablesAndData';
TooltipWrinklerArea,
TooltipWrinklerBeingShown,
} from '../../Disp/VariablesAndData';
/** /**
* This function creates .onmouseover/out events that determine if the mouse is hovering-over a Wrinkler * This function creates .onmouseover/out events that determine if the mouse is hovering-over a Wrinkler

View File

@@ -1,9 +1,6 @@
import GetCPSBuffMult from '../../Cache/CPS/GetCPSBuffMult'; import GetCPSBuffMult from '../../Cache/CPS/GetCPSBuffMult';
import { CacheCentEgg } from '../../Cache/VariablesAndData'; import { CacheCentEgg } from '../../Cache/VariablesAndData';
import { import { CenturyDateAtBeginLoop, CycliusDateAtBeginLoop } from '../../Main/VariablesAndData';
CenturyDateAtBeginLoop,
CycliusDateAtBeginLoop,
} from '../../Main/VariablesAndData';
import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult'; import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult';
import SimEff from '../ReplacedGameFunctions/SimEff'; import SimEff from '../ReplacedGameFunctions/SimEff';
import SimGetHeavenlyMultiplier from '../ReplacedGameFunctions/SimGetHeavenlyMultiplier'; import SimGetHeavenlyMultiplier from '../ReplacedGameFunctions/SimGetHeavenlyMultiplier';
@@ -44,16 +41,11 @@ export default function CalculateGains() {
SimEffs = effs; // eslint-disable-line no-unused-vars SimEffs = effs; // eslint-disable-line no-unused-vars
if (Game.ascensionMode !== 1) if (Game.ascensionMode !== 1)
mult += mult += parseFloat(SimPrestige) * 0.01 * SimHeavenlyPower * SimGetHeavenlyMultiplier();
parseFloat(SimPrestige) *
0.01 *
SimHeavenlyPower *
SimGetHeavenlyMultiplier();
mult *= SimEff('cps'); mult *= SimEff('cps');
if (SimHas('Heralds') && Game.ascensionMode !== 1) if (SimHas('Heralds') && Game.ascensionMode !== 1) mult *= 1 + 0.01 * Game.heralds;
mult *= 1 + 0.01 * Game.heralds;
Object.keys(Game.cookieUpgrades).forEach((i) => { Object.keys(Game.cookieUpgrades).forEach((i) => {
const me = Game.cookieUpgrades[i]; const me = Game.cookieUpgrades[i];
@@ -94,26 +86,11 @@ export default function CalculateGains() {
godLvl = SimHasGod('ages'); godLvl = SimHasGod('ages');
if (godLvl === 1) if (godLvl === 1)
mult *= mult *= 1 + 0.15 * Math.sin((CycliusDateAtBeginLoop / 1000 / (60 * 60 * 3)) * Math.PI * 2);
1 +
0.15 *
Math.sin(
(CycliusDateAtBeginLoop / 1000 / (60 * 60 * 3)) * Math.PI * 2,
);
else if (godLvl === 2) else if (godLvl === 2)
mult *= mult *= 1 + 0.15 * Math.sin((CycliusDateAtBeginLoop / 1000 / (60 * 60 * 12)) * Math.PI * 2);
1 +
0.15 *
Math.sin(
(CycliusDateAtBeginLoop / 1000 / (60 * 60 * 12)) * Math.PI * 2,
);
else if (godLvl === 3) else if (godLvl === 3)
mult *= mult *= 1 + 0.15 * Math.sin((CycliusDateAtBeginLoop / 1000 / (60 * 60 * 24)) * Math.PI * 2);
1 +
0.15 *
Math.sin(
(CycliusDateAtBeginLoop / 1000 / (60 * 60 * 24)) * Math.PI * 2,
);
godLvl = SimHasGod('decadence'); godLvl = SimHasGod('decadence');
if (godLvl === 1) buildMult *= 0.93; if (godLvl === 1) buildMult *= 0.93;
@@ -151,35 +128,25 @@ export default function CalculateGains() {
if (SimHas('Kitten helpers')) catMult *= 1 + milkProgress * 0.1 * milkMult; if (SimHas('Kitten helpers')) catMult *= 1 + milkProgress * 0.1 * milkMult;
if (SimHas('Kitten workers')) catMult *= 1 + milkProgress * 0.125 * milkMult; if (SimHas('Kitten workers')) catMult *= 1 + milkProgress * 0.125 * milkMult;
if (SimHas('Kitten engineers')) catMult *= 1 + milkProgress * 0.15 * milkMult; if (SimHas('Kitten engineers')) catMult *= 1 + milkProgress * 0.15 * milkMult;
if (SimHas('Kitten overseers')) if (SimHas('Kitten overseers')) catMult *= 1 + milkProgress * 0.175 * milkMult;
catMult *= 1 + milkProgress * 0.175 * milkMult;
if (SimHas('Kitten managers')) catMult *= 1 + milkProgress * 0.2 * milkMult; if (SimHas('Kitten managers')) catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten accountants')) if (SimHas('Kitten accountants')) catMult *= 1 + milkProgress * 0.2 * milkMult;
catMult *= 1 + milkProgress * 0.2 * milkMult; if (SimHas('Kitten specialists')) catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten specialists'))
catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten experts')) catMult *= 1 + milkProgress * 0.2 * milkMult; if (SimHas('Kitten experts')) catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten consultants')) if (SimHas('Kitten consultants')) catMult *= 1 + milkProgress * 0.2 * milkMult;
catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten assistants to the regional manager')) if (SimHas('Kitten assistants to the regional manager'))
catMult *= 1 + milkProgress * 0.175 * milkMult; catMult *= 1 + milkProgress * 0.175 * milkMult;
if (SimHas('Kitten marketeers')) if (SimHas('Kitten marketeers')) catMult *= 1 + milkProgress * 0.15 * milkMult;
catMult *= 1 + milkProgress * 0.15 * milkMult;
if (SimHas('Kitten analysts')) catMult *= 1 + milkProgress * 0.125 * milkMult; if (SimHas('Kitten analysts')) catMult *= 1 + milkProgress * 0.125 * milkMult;
if (SimHas('Kitten executives')) if (SimHas('Kitten executives')) catMult *= 1 + milkProgress * 0.115 * milkMult;
catMult *= 1 + milkProgress * 0.115 * milkMult;
if (SimHas('Kitten angels')) catMult *= 1 + milkProgress * 0.1 * milkMult; if (SimHas('Kitten angels')) catMult *= 1 + milkProgress * 0.1 * milkMult;
if (SimHas('Fortune #103')) catMult *= 1 + milkProgress * 0.05 * milkMult; if (SimHas('Fortune #103')) catMult *= 1 + milkProgress * 0.05 * milkMult;
Object.keys(SimObjects).forEach((i) => { Object.keys(SimObjects).forEach((i) => {
const me = SimObjects[i]; const me = SimObjects[i];
let storedCps = me.cps(me); let storedCps = me.cps(me);
if (Game.ascensionMode !== 1) if (Game.ascensionMode !== 1) storedCps *= (1 + me.level * 0.01) * buildMult;
storedCps *= (1 + me.level * 0.01) * buildMult; if (me.name === 'Grandma' && SimHas('Milkhelp&reg; lactose intolerance relief tablets'))
if (
me.name === 'Grandma' &&
SimHas('Milkhelp&reg; lactose intolerance relief tablets')
)
storedCps *= 1 + 0.05 * milkProgress * milkMult; storedCps *= 1 + 0.05 * milkProgress * milkMult;
SimCookiesPs += me.amount * storedCps; SimCookiesPs += me.amount * storedCps;
}); });
@@ -204,10 +171,7 @@ export default function CalculateGains() {
if (SimHas('Century egg')) { if (SimHas('Century egg')) {
// The boost increases a little every day, with diminishing returns up to +10% on the 100th day // The boost increases a little every day, with diminishing returns up to +10% on the 100th day
let day = let day =
(Math.floor((CenturyDateAtBeginLoop - Game.startDate) / 1000 / 10) * 10) / (Math.floor((CenturyDateAtBeginLoop - Game.startDate) / 1000 / 10) * 10) / 60 / 60 / 24;
60 /
60 /
24;
day = Math.min(day, 100); day = Math.min(day, 100);
// Sets a Cache value to be displayed in the Stats page, could be moved... // Sets a Cache value to be displayed in the Stats page, could be moved...
CacheCentEgg = 1 + (1 - (1 - day / 100) ** 3) * 0.1; CacheCentEgg = 1 + (1 - (1 - day / 100) ** 3) * 0.1;
@@ -222,8 +186,7 @@ export default function CalculateGains() {
const rawCookiesPs = SimCookiesPs * mult; const rawCookiesPs = SimCookiesPs * mult;
Object.keys(Game.CpsAchievements).forEach((i) => { Object.keys(Game.CpsAchievements).forEach((i) => {
if (rawCookiesPs >= Game.CpsAchievements[i].threshold) if (rawCookiesPs >= Game.CpsAchievements[i].threshold) SimWin(Game.CpsAchievements[i].name);
SimWin(Game.CpsAchievements[i].name);
}); });
SimCookiesPsRaw = rawCookiesPs; // eslint-disable-line no-unused-vars SimCookiesPsRaw = rawCookiesPs; // eslint-disable-line no-unused-vars

View File

@@ -32,11 +32,7 @@ export default function CheckOtherAchiev() {
mathematician = 0; mathematician = 0;
} }
if (!SimHasAchiev('Base 10')) { if (!SimHasAchiev('Base 10')) {
if ( if (SimObjects[i].amount < (Game.ObjectsById.length - Game.Objects[i].id) * 10) base10 = 0;
SimObjects[i].amount <
(Game.ObjectsById.length - Game.Objects[i].id) * 10
)
base10 = 0;
} }
}); });
if (minAmount >= 1) SimWin('One with everything'); if (minAmount >= 1) SimWin('One with everything');
@@ -69,11 +65,9 @@ export default function CheckOtherAchiev() {
if (SimUpgradesOwned >= 400) SimWin("When there's nothing left to add"); if (SimUpgradesOwned >= 400) SimWin("When there's nothing left to add");
if (buildingsOwned >= 4000 && SimUpgradesOwned >= 300) SimWin('Polymath'); if (buildingsOwned >= 4000 && SimUpgradesOwned >= 300) SimWin('Polymath');
if (buildingsOwned >= 8000 && SimUpgradesOwned >= 400) if (buildingsOwned >= 8000 && SimUpgradesOwned >= 400) SimWin('Renaissance baker');
SimWin('Renaissance baker');
if (SimObjects.Cursor.amount + SimObjects.Grandma.amount >= 777) if (SimObjects.Cursor.amount + SimObjects.Grandma.amount >= 777) SimWin('The elder scrolls');
SimWin('The elder scrolls');
let hasAllHalloCook = true; let hasAllHalloCook = true;
Object.keys(HalloCookies).forEach((i) => { Object.keys(HalloCookies).forEach((i) => {

View File

@@ -70,8 +70,7 @@ export default function InitialBuildingData(buildingName) {
let add = 0; let add = 0;
if (SimHas('One mind')) add += SimObjects.Grandma.amount * 0.02; if (SimHas('One mind')) add += SimObjects.Grandma.amount * 0.02;
if (SimHas('Communal brainsweep')) if (SimHas('Communal brainsweep')) add += SimObjects.Grandma.amount * 0.02;
add += SimObjects.Grandma.amount * 0.02;
if (SimHas('Elder Pact')) add += SimObjects.Portal.amount * 0.05; if (SimHas('Elder Pact')) add += SimObjects.Portal.amount * 0.05;
let num = 0; let num = 0;

View File

@@ -7,19 +7,14 @@ import SimHas from './SimHas';
export default function SimGetTieredCpsMult(me) { export default function SimGetTieredCpsMult(me) {
let mult = 1; let mult = 1;
Object.keys(me.tieredUpgrades).forEach((i) => { Object.keys(me.tieredUpgrades).forEach((i) => {
if ( if (!Game.Tiers[me.tieredUpgrades[i].tier].special && SimHas(me.tieredUpgrades[i].name))
!Game.Tiers[me.tieredUpgrades[i].tier].special &&
SimHas(me.tieredUpgrades[i].name)
)
mult *= 2; mult *= 2;
}); });
Object.keys(me.synergies).forEach((i) => { Object.keys(me.synergies).forEach((i) => {
if (SimHas(me.synergies[i].name)) { if (SimHas(me.synergies[i].name)) {
const syn = me.synergies[i]; const syn = me.synergies[i];
if (syn.buildingTie1.name === me.name) if (syn.buildingTie1.name === me.name) mult *= 1 + 0.05 * syn.buildingTie2.amount;
mult *= 1 + 0.05 * syn.buildingTie2.amount; else if (syn.buildingTie2.name === me.name) mult *= 1 + 0.001 * syn.buildingTie1.amount;
else if (syn.buildingTie2.name === me.name)
mult *= 1 + 0.001 * syn.buildingTie1.amount;
} }
}); });
if (me.fortune && SimHas(me.fortune.name)) mult *= 1.07; if (me.fortune && SimHas(me.fortune.name)) mult *= 1.07;

View File

@@ -5,10 +5,6 @@ import { SimUpgrades } from '../VariablesAndData';
*/ */
export default function SimHas(what) { export default function SimHas(what) {
const it = SimUpgrades[what]; const it = SimUpgrades[what];
if ( if (Game.ascensionMode === 1 && (it.pool === 'prestige' || it.tier === 'fortune')) return 0;
Game.ascensionMode === 1 &&
(it.pool === 'prestige' || it.tier === 'fortune')
)
return 0;
return it ? it.bought : 0; return it ? it.bought : 0;
} }

View File

@@ -1,7 +1,4 @@
import { import { CacheDragonAura, CacheDragonAura2 } from '../../Cache/VariablesAndData';
CacheDragonAura,
CacheDragonAura2,
} from '../../Cache/VariablesAndData';
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';
@@ -24,18 +21,13 @@ export default function CalculateChangeAura(aura) {
CopyData(); CopyData();
// Check if aura being changed is first or second aura // Check if aura being changed is first or second aura
const auraToBeChanged = l('promptContent').children[0].innerHTML.includes( const auraToBeChanged = l('promptContent').children[0].innerHTML.includes('secondary');
'secondary',
);
if (auraToBeChanged) SimDragonAura2 = aura; if (auraToBeChanged) SimDragonAura2 = aura;
else SimDragonAura = aura; else SimDragonAura = aura;
// Sell highest building but only if aura is different // Sell highest building but only if aura is different
let price = 0; let price = 0;
if ( if (SimDragonAura !== CacheDragonAura || SimDragonAura2 !== CacheDragonAura2) {
SimDragonAura !== CacheDragonAura ||
SimDragonAura2 !== CacheDragonAura2
) {
for (let i = Game.ObjectsById.length - 1; i > -1; --i) { for (let i = Game.ObjectsById.length - 1; i > -1; --i) {
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;
@@ -44,12 +36,7 @@ export default function CalculateChangeAura(aura) {
price = price =
SimObjects[highestBuilding].basePrice * SimObjects[highestBuilding].basePrice *
Game.priceIncrease ** Game.priceIncrease **
Math.max( Math.max(0, SimObjects[highestBuilding].amount - 1 - SimObjects[highestBuilding].free);
0,
SimObjects[highestBuilding].amount -
1 -
SimObjects[highestBuilding].free,
);
price = Game.modifyBuildingPrice(SimObjects[highestBuilding], price); price = Game.modifyBuildingPrice(SimObjects[highestBuilding], price);
price = Math.ceil(price); price = Math.ceil(price);
break; break;

View File

@@ -9,18 +9,11 @@
* @param {number} increase Increase of building * @param {number} increase Increase of building
* @returns {number} moni Total price * @returns {number} moni Total price
*/ */
export default function BuildingGetPrice( export default function BuildingGetPrice(build, basePrice, start, free, increase) {
build,
basePrice,
start,
free,
increase,
) {
let startingAmount = start; let startingAmount = start;
let moni = 0; let moni = 0;
for (let i = 0; i < increase; i += 1) { for (let i = 0; i < increase; i += 1) {
let price = let price = basePrice * Game.priceIncrease ** Math.max(0, startingAmount - free);
basePrice * Game.priceIncrease ** Math.max(0, startingAmount - free);
price = Game.modifyBuildingPrice(build, price); price = Game.modifyBuildingPrice(build, price);
price = Math.ceil(price); price = Math.ceil(price);
moni += price; moni += price;

View File

@@ -2,11 +2,7 @@ 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';
import SimWin from '../SimulationData/SimWin'; import SimWin from '../SimulationData/SimWin';
import { import { SimAchievementsOwned, SimCookiesPs, SimObjects } from '../VariablesAndData';
SimAchievementsOwned,
SimCookiesPs,
SimObjects,
} from '../VariablesAndData';
/** /**
* This function calculates the bonus income of buying a building * This function calculates the bonus income of buying a building
@@ -34,10 +30,7 @@ export default function BuyBuildingsBonusIncome(building, amount) {
if (me.amount >= 800) SimWin("The devil's workshop"); if (me.amount >= 800) SimWin("The devil's workshop");
} else { } else {
Object.keys(Game.Objects[me.name].tieredAchievs).forEach((j) => { Object.keys(Game.Objects[me.name].tieredAchievs).forEach((j) => {
if ( if (me.amount >= Game.Tiers[Game.Objects[me.name].tieredAchievs[j].tier].achievUnlock) {
me.amount >=
Game.Tiers[Game.Objects[me.name].tieredAchievs[j].tier].achievUnlock
) {
SimWin(Game.Objects[me.name].tieredAchievs[j].name); SimWin(Game.Objects[me.name].tieredAchievs[j].name);
} }
}); });

View File

@@ -63,13 +63,7 @@ function MouseCps() {
if (SimHas('Dragon claw')) mult *= 1.03; if (SimHas('Dragon claw')) mult *= 1.03;
if (SimHas('Aura gloves')) { if (SimHas('Aura gloves')) {
mult *= mult *= 1 + 0.05 * Math.min(Game.Objects.Cursor.level, SimHas('Luminous gloves') ? 20 : 10);
1 +
0.05 *
Math.min(
Game.Objects.Cursor.level,
SimHas('Luminous gloves') ? 20 : 10,
);
} }
mult *= SimEff('click'); mult *= SimEff('click');
@@ -83,8 +77,7 @@ function MouseCps() {
} }
Object.keys(Game.buffs).forEach((i) => { Object.keys(Game.buffs).forEach((i) => {
if (typeof Game.buffs[i].multClick !== 'undefined') if (typeof Game.buffs[i].multClick !== 'undefined') mult *= Game.buffs[i].multClick;
mult *= Game.buffs[i].multClick;
}); });
// if (CM.Sim.auraMult('Dragon Cursor')) mult*=1.05; // if (CM.Sim.auraMult('Dragon Cursor')) mult*=1.05;
@@ -129,8 +122,7 @@ export default function BuyUpgradesBonusIncome(upgrade) {
} else { } else {
SimUpgrades[upgrade].bought = (SimUpgrades[upgrade].bought + 1) % 2; SimUpgrades[upgrade].bought = (SimUpgrades[upgrade].bought + 1) % 2;
} }
if (Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool)) if (Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool)) SimUpgradesOwned += 1; // eslint-disable-line no-unused-vars
SimUpgradesOwned += 1; // eslint-disable-line no-unused-vars
if (upgrade === 'Elder Pledge') { if (upgrade === 'Elder Pledge') {
SimPledges += 1; SimPledges += 1;

View File

@@ -1,13 +1,7 @@
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';
import { import { SimAchievementsOwned, SimCookiesPs, SimGod1, SimGod2, SimGod3 } from '../VariablesAndData';
SimAchievementsOwned,
SimCookiesPs,
SimGod1,
SimGod2,
SimGod3,
} from '../VariablesAndData';
/** /**
* This functions calculates the cps and cost of changing a Dragon Aura * This functions calculates the cps and cost of changing a Dragon Aura

View File

@@ -3,12 +3,7 @@ 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';
import SimWin from '../SimulationData/SimWin'; import SimWin from '../SimulationData/SimWin';
import { import { SimAchievementsOwned, SimCookiesPs, SimPrestige, SimUpgrades } from '../VariablesAndData';
SimAchievementsOwned,
SimCookiesPs,
SimPrestige,
SimUpgrades,
} from '../VariablesAndData';
/** /**
* This function calculates the cookies per click difference betwene current and after a ascension * This function calculates the cookies per click difference betwene current and after a ascension
@@ -41,37 +36,23 @@ export default function ResetBonus(newHeavenlyChips) {
if (CacheRealCookiesEarned >= 1000000000000) SimWin('From scratch'); if (CacheRealCookiesEarned >= 1000000000000) SimWin('From scratch');
if (CacheRealCookiesEarned >= 1000000000000000) SimWin('Nihilism'); if (CacheRealCookiesEarned >= 1000000000000000) SimWin('Nihilism');
if (CacheRealCookiesEarned >= 1000000000000000000) SimWin('Dematerialize'); if (CacheRealCookiesEarned >= 1000000000000000000) SimWin('Dematerialize');
if (CacheRealCookiesEarned >= 1000000000000000000000) if (CacheRealCookiesEarned >= 1000000000000000000000) SimWin('Nil zero zilch');
SimWin('Nil zero zilch'); if (CacheRealCookiesEarned >= 1000000000000000000000000) SimWin('Transcendence');
if (CacheRealCookiesEarned >= 1000000000000000000000000) if (CacheRealCookiesEarned >= 1000000000000000000000000000) SimWin('Obliterate');
SimWin('Transcendence'); if (CacheRealCookiesEarned >= 1000000000000000000000000000000) SimWin('Negative void');
if (CacheRealCookiesEarned >= 1000000000000000000000000000) if (CacheRealCookiesEarned >= 1000000000000000000000000000000000) SimWin('To crumbs, you say?');
SimWin('Obliterate'); if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000) SimWin('You get nothing');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000)
SimWin('Negative void');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000)
SimWin('To crumbs, you say?');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000)
SimWin('You get nothing');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000) if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000)
SimWin('Humble rebeginnings'); SimWin('Humble rebeginnings');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000) if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000)
SimWin('The end of the world'); SimWin('The end of the world');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000000) if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000000)
SimWin("Oh, you're back"); SimWin("Oh, you're back");
if ( if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000000000)
CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000000000
)
SimWin('Lazarus'); SimWin('Lazarus');
if ( if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000000000000)
CacheRealCookiesEarned >=
1000000000000000000000000000000000000000000000000000
)
SimWin('Smurf account'); SimWin('Smurf account');
if ( if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000000000000000)
CacheRealCookiesEarned >=
1000000000000000000000000000000000000000000000000000000
)
SimWin("If at first you don't succeed"); SimWin("If at first you don't succeed");
SimUpgrades['Heavenly chip secret'].bought = 1; SimUpgrades['Heavenly chip secret'].bought = 1;

View File

@@ -12,14 +12,7 @@ import SimModifyBuildingPrice from '../ReplacedGameFunctions/SimModifyBuidlingPr
* @param {number} noSim 1 of 0 depending on if function is called from CM.Sim * @param {number} noSim 1 of 0 depending on if function is called from CM.Sim
* @returns {number} moni Total price gained * @returns {number} moni Total price gained
*/ */
export default function BuildingSell( export default function BuildingSell(build, basePrice, start, free, amount, noSim) {
build,
basePrice,
start,
free,
amount,
noSim,
) {
// Calculate money gains from selling buildings // Calculate money gains from selling buildings
// If noSim is set, use Game methods to compute price instead of Sim ones. // If noSim is set, use Game methods to compute price instead of Sim ones.
const noSimRes = typeof noSim === 'undefined' ? 0 : noSim; const noSimRes = typeof noSim === 'undefined' ? 0 : noSim;
@@ -29,15 +22,12 @@ export default function BuildingSell(
if (amount === -1) toChange = startingAmount; if (amount === -1) toChange = startingAmount;
if (!amount) toChange = Game.buyBulk; if (!amount) toChange = Game.buyBulk;
for (let i = 0; i < toChange; i++) { for (let i = 0; i < toChange; i++) {
let price = let price = basePrice * Game.priceIncrease ** Math.max(0, startingAmount - free);
basePrice * Game.priceIncrease ** Math.max(0, startingAmount - free);
price = noSimRes price = noSimRes
? Game.modifyBuildingPrice(build, price) ? Game.modifyBuildingPrice(build, price)
: SimModifyBuildingPrice(build, price); : SimModifyBuildingPrice(build, price);
price = Math.ceil(price); price = Math.ceil(price);
const giveBack = noSimRes const giveBack = noSimRes ? build.getSellMultiplier() : SimGetSellMultiplier();
? build.getSellMultiplier()
: SimGetSellMultiplier();
price = Math.floor(price * giveBack); price = Math.floor(price * giveBack);
if (startingAmount > 0) { if (startingAmount > 0) {
moni += price; moni += price;

View File

@@ -1,10 +1,5 @@
import CopyData from '../SimulationData/CopyData'; import CopyData from '../SimulationData/CopyData';
import { import { SimBuildingsOwned, SimDragonAura, SimDragonAura2, SimObjects } from '../VariablesAndData';
SimBuildingsOwned,
SimDragonAura,
SimDragonAura2,
SimObjects,
} from '../VariablesAndData';
import BuildingSell from './SellBuilding'; import BuildingSell from './SellBuilding';
/** /**

View File

@@ -55,16 +55,10 @@ describe('FormatTime', () => {
assert.equal(FormatTime(3601, 1), '1 hour, 0 minutes, 1 second'); assert.equal(FormatTime(3601, 1), '1 hour, 0 minutes, 1 second');
}); });
it('Format when time is over 1 day', () => { it('Format when time is over 1 day', () => {
assert.equal( assert.equal(FormatTime(86401, 1), '1 day, 0 hours, 0 minutes, 1 second');
FormatTime(86401, 1),
'1 day, 0 hours, 0 minutes, 1 second',
);
}); });
it('Format when time is over 1 year', () => { it('Format when time is over 1 year', () => {
assert.equal( assert.equal(FormatTime(31536001, 1), '1 year, 0 days, 0 hours, 0 minutes, 1 second');
FormatTime(31536001, 1),
'1 year, 0 days, 0 hours, 0 minutes, 1 second',
);
}); });
it('Format when time is over >9000 days', () => { it('Format when time is over >9000 days', () => {
assert.equal(FormatTime(777600001, 1), 'Over 9000 days!'); assert.equal(FormatTime(777600001, 1), 'Over 9000 days!');

View File

@@ -4,6 +4,6 @@
"noImplicitAny": true, "noImplicitAny": true,
"sourceMap": true, "sourceMap": true,
"target": "ES6", "target": "ES6",
"strictNullChecks": true, "strictNullChecks": true
} }
} }