11
.eslintrc.js
11
.eslintrc.js
@@ -10,26 +10,19 @@ module.exports = {
|
||||
utf8_to_b64: 'readonly',
|
||||
realAudio: 'readonly',
|
||||
BeautifyAll: 'readonly',
|
||||
CM: 'writable',
|
||||
unsafeWindow: 'readonly',
|
||||
},
|
||||
extends: ['airbnb-base', 'plugin:prettier/recommended'],
|
||||
parserOptions: {
|
||||
ecmaVersion: 12,
|
||||
},
|
||||
rules: {
|
||||
'import/no-named-default': 'off',
|
||||
'import/no-mutable-exports': 'off',
|
||||
'no-param-reassign': 'off',
|
||||
'no-plusplus': 'off',
|
||||
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
||||
'no-new-func': 'off',
|
||||
'no-restricted-syntax': 'off',
|
||||
'prefer-destructuring': 'off',
|
||||
'func-names': 'off',
|
||||
'no-console': 'off',
|
||||
'no-nested-ternary': 'off',
|
||||
'no-new': 'off',
|
||||
'no-alert': 'off',
|
||||
'no-restricted-globals': 'off',
|
||||
'prefer-destructuring': ['error', { object: true, array: false }],
|
||||
},
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
dist/CookieMonster.js
vendored
2
dist/CookieMonster.js
vendored
File diff suppressed because one or more lines are too long
2
dist/CookieMonster.js.map
vendored
2
dist/CookieMonster.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -34,12 +34,13 @@ export class CMAvgQueue {
|
||||
* @returns {number} ret The average
|
||||
*/
|
||||
calcAverage(timePeriod) {
|
||||
if (timePeriod > this.maxLength) timePeriod = this.maxLength;
|
||||
if (timePeriod > this.queue.length) timePeriod = this.queue.length;
|
||||
let time = timePeriod;
|
||||
if (time > this.maxLength) time = this.maxLength;
|
||||
if (time > this.queue.length) time = this.queue.length;
|
||||
let ret = 0;
|
||||
for (
|
||||
let i = this.queue.length - 1;
|
||||
i >= 0 && i > this.queue.length - 1 - timePeriod;
|
||||
i >= 0 && i > this.queue.length - 1 - time;
|
||||
i--
|
||||
) {
|
||||
ret += this.queue[i];
|
||||
@@ -47,7 +48,7 @@ export class CMAvgQueue {
|
||||
if (ret === 0) {
|
||||
return 0;
|
||||
}
|
||||
return ret / timePeriod;
|
||||
return ret / time;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ import {
|
||||
export default function CacheCurrWrinklerCPS() {
|
||||
CacheCurrWrinklerCPSMult = 0;
|
||||
let count = 0;
|
||||
for (const i in Game.wrinklers) {
|
||||
if (Game.wrinklers[i].phase === 2) count++;
|
||||
}
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
if (Game.wrinklers[i].phase === 2) count += 1;
|
||||
});
|
||||
let godMult = 1;
|
||||
if (SimObjects.Temple.minigameLoaded) {
|
||||
const godLvl = Game.hasGod('scorn');
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
*/
|
||||
export default function GetCPSBuffMult() {
|
||||
let mult = 1;
|
||||
for (const i of Object.keys(Game.buffs)) {
|
||||
Object.keys(Game.buffs).forEach((i) => {
|
||||
if (typeof Game.buffs[i].multCpS !== 'undefined')
|
||||
mult *= Game.buffs[i].multCpS;
|
||||
}
|
||||
});
|
||||
return mult;
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ export default function CacheSellAllForChoEgg() {
|
||||
if (Game.Objects.Bank.minigameLoaded) {
|
||||
const marketGoods = Game.Objects.Bank.minigame.goods;
|
||||
let goodsVal = 0;
|
||||
for (const i of Object.keys(marketGoods)) {
|
||||
Object.keys(marketGoods).forEach((i) => {
|
||||
const marketGood = marketGoods[i];
|
||||
goodsVal += marketGood.stock * marketGood.val;
|
||||
}
|
||||
});
|
||||
sellTotal += goodsVal * Game.cookiesPsRawHighest;
|
||||
}
|
||||
// Compute cookies earned by selling all buildings with optimal auras (ES + RB)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Functions related to the Dragon */
|
||||
|
||||
@@ -44,7 +45,7 @@ export default function CacheDragonCost() {
|
||||
price = Game.modifyBuildingPrice(SimObjects[target], price);
|
||||
price = Math.ceil(price);
|
||||
cost += price;
|
||||
SimObjects[target].amount--;
|
||||
SimObjects[target].amount -= 1;
|
||||
}
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${cost}`;
|
||||
}
|
||||
@@ -68,7 +69,7 @@ export default function CacheDragonCost() {
|
||||
price = Game.modifyBuildingPrice(SimObjects[target], price);
|
||||
price = Math.ceil(price);
|
||||
cost += price;
|
||||
SimObjects[target].amount--;
|
||||
SimObjects[target].amount -= 1;
|
||||
}
|
||||
}
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
|
||||
@@ -19,7 +20,7 @@ import ColourOfPP from './ColourOfPP';
|
||||
* It is called by CM.Cache.CacheBuildingsPP()
|
||||
*/
|
||||
function CacheBuildingsBulkPP(target) {
|
||||
for (const i of Object.keys(target)) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
if (Game.cookiesPs) {
|
||||
target[i].pp =
|
||||
Math.max(target[i].price - (Game.cookies + GetWrinkConfigBank()), 0) /
|
||||
@@ -28,7 +29,7 @@ function CacheBuildingsBulkPP(target) {
|
||||
} else target[i].pp = target[i].price / target[i].bonus;
|
||||
|
||||
target[i].color = ColourOfPP(target[i], target[i].price);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +44,7 @@ export default function CacheBuildingsPP() {
|
||||
|
||||
// Calculate PP and colors when compared to purchase of optimal building in single-purchase mode
|
||||
if (CMOptions.ColorPPBulkMode === 0 && Game.buyMode > 0) {
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
if (Game.cookiesPs) {
|
||||
CacheObjects1[i].pp =
|
||||
Math.max(
|
||||
@@ -56,7 +57,7 @@ export default function CacheBuildingsPP() {
|
||||
CacheObjects1[i].pp =
|
||||
Game.Objects[i].getPrice() / CacheObjects1[i].bonus;
|
||||
CacheArrayOfPPs.push([CacheObjects1[i].pp, Game.Objects[i].getPrice()]);
|
||||
}
|
||||
});
|
||||
// Set CM.Cache.min to best non-excluded buidliung
|
||||
CacheArrayOfPPs.sort((a, b) => a[0] - b[0]);
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
@@ -70,7 +71,7 @@ export default function CacheBuildingsPP() {
|
||||
CacheMinPP = CacheArrayOfPPs[CMOptions.PPExcludeTop][0];
|
||||
CacheMaxPP = CacheArrayOfPPs[CacheArrayOfPPs.length - 1][0];
|
||||
CacheMidPP = (CacheMaxPP - CacheMinPP) / 2 + CacheMinPP;
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
CacheObjects1[i].color = ColourOfPP(
|
||||
CacheObjects1[i],
|
||||
Game.Objects[i].getPrice(),
|
||||
@@ -80,7 +81,7 @@ export default function CacheBuildingsPP() {
|
||||
if (CacheObjects1[i].pp === CacheArrayOfPPs[j][0])
|
||||
CacheObjects1[i].color = ColorGray;
|
||||
}
|
||||
}
|
||||
});
|
||||
// Calculate PP of bulk-buy modes
|
||||
CacheBuildingsBulkPP(CacheObjects10);
|
||||
CacheBuildingsBulkPP(CacheObjects100);
|
||||
@@ -90,7 +91,7 @@ export default function CacheBuildingsPP() {
|
||||
if (Game.buyBulk === 1) target = CacheObjects1;
|
||||
else if (Game.buyBulk === 10) target = CacheObjects10;
|
||||
else if (Game.buyBulk === 100) target = CacheObjects100;
|
||||
for (const i of Object.keys(target)) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
if (Game.cookiesPs) {
|
||||
target[i].pp =
|
||||
Math.max(
|
||||
@@ -101,7 +102,7 @@ export default function CacheBuildingsPP() {
|
||||
Game.Objects[i].bulkPrice / target[i].bonus;
|
||||
} else target[i].pp = Game.Objects[i].bulkPrice / target[i].bonus;
|
||||
CacheArrayOfPPs.push([target[i].pp, Game.Objects[i].bulkPrice]);
|
||||
}
|
||||
});
|
||||
// Set CM.Cache.min to best non-excluded buidliung
|
||||
CacheArrayOfPPs.sort((a, b) => a[0] - b[0]);
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
@@ -116,12 +117,12 @@ export default function CacheBuildingsPP() {
|
||||
CacheMaxPP = CacheArrayOfPPs[CacheArrayOfPPs.length - 1][0];
|
||||
CacheMidPP = (CacheMaxPP - CacheMinPP) / 2 + CacheMinPP;
|
||||
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
target[i].color = ColourOfPP(target[i], Game.Objects[i].bulkPrice);
|
||||
// Colour based on excluding certain top-buildings
|
||||
for (let j = 0; j < CMOptions.PPExcludeTop; j++) {
|
||||
if (target[i].pp === CacheArrayOfPPs[j][0]) target[i].color = ColorGray;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import ColourOfPP from './ColourOfPP';
|
||||
* It is called by CM.Cache.CachePP()
|
||||
*/
|
||||
export default function CacheUpgradePP() {
|
||||
for (const i of Object.keys(CacheUpgrades)) {
|
||||
Object.keys(CacheUpgrades).forEach((i) => {
|
||||
if (Game.cookiesPs) {
|
||||
CacheUpgrades[i].pp =
|
||||
Math.max(
|
||||
@@ -25,5 +25,5 @@ export default function CacheUpgradePP() {
|
||||
CacheUpgrades[i],
|
||||
Game.Upgrades[i].getPrice(),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ import {
|
||||
*/
|
||||
function CacheBuildingIncome(amount, target) {
|
||||
const result = [];
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
result[i] = {};
|
||||
result[i].bonus = BuyBuildingsBonusIncome(i, amount);
|
||||
if (amount !== 1) {
|
||||
CacheDoRemakeBuildPrices = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -36,19 +36,19 @@ function CacheBuildingIncome(amount, target) {
|
||||
*/
|
||||
function CacheUpgradeIncome() {
|
||||
CacheUpgrades = [];
|
||||
for (const i of Object.keys(Game.Upgrades)) {
|
||||
Object.keys(Game.Upgrades).forEach((i) => {
|
||||
const bonusIncome = BuyUpgradesBonusIncome(i);
|
||||
CacheUpgrades[i] = {};
|
||||
if (bonusIncome[0]) CacheUpgrades[i].bonus = bonusIncome[0];
|
||||
if (bonusIncome[1]) CacheUpgrades[i].bonusMouse = bonusIncome[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This functions caches the price of each building and stores it in the cache
|
||||
*/
|
||||
export function CacheBuildingsPrices() {
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
CacheObjects1[i].price = BuildingGetPrice(
|
||||
Game.Objects[i],
|
||||
Game.Objects[i].basePrice,
|
||||
@@ -70,7 +70,7 @@ export function CacheBuildingsPrices() {
|
||||
Game.Objects[i].free,
|
||||
100,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,7 +51,7 @@ export function MaxChainCookieReward(digit, maxPayout, mult) {
|
||||
);
|
||||
nextRequired = Math.floor((1 / 9) * 10 ** (chain + 1) * digit * mult);
|
||||
totalFromChain += moni;
|
||||
chain++;
|
||||
chain += 1;
|
||||
}
|
||||
return [totalFromChain, moni, nextRequired];
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ export default function CacheAllMissingUpgrades() {
|
||||
CacheMissingUpgradesPrestige = '';
|
||||
const list = [];
|
||||
// sort the upgrades
|
||||
for (const i of Object.keys(Game.Upgrades)) {
|
||||
Object.keys(Game.Upgrades).forEach((i) => {
|
||||
list.push(Game.Upgrades[i]);
|
||||
}
|
||||
});
|
||||
const sortMap = function (a, b) {
|
||||
if (a.order > b.order) return 1;
|
||||
if (a.order < b.order) return -1;
|
||||
@@ -29,7 +29,7 @@ export default function CacheAllMissingUpgrades() {
|
||||
};
|
||||
list.sort(sortMap);
|
||||
|
||||
for (const i of Object.keys(list)) {
|
||||
Object.keys(list).forEach((i) => {
|
||||
const me = list[i];
|
||||
|
||||
if (me.bought === 0) {
|
||||
@@ -45,5 +45,5 @@ export default function CacheAllMissingUpgrades() {
|
||||
)
|
||||
CacheMissingUpgrades += str;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ export function CacheStatsCookies() {
|
||||
CacheEdifice = 0;
|
||||
let max = 0;
|
||||
let n = 0;
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
if (Game.Objects[i].amount > max) max = Game.Objects[i].amount;
|
||||
if (Game.Objects[i].amount > 0) n++;
|
||||
}
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
if (Game.Objects[i].amount > 0) n += 1;
|
||||
});
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
if (
|
||||
(Game.Objects[i].amount < max || n === 1) &&
|
||||
Game.Objects[i].amount < 400 &&
|
||||
@@ -55,7 +55,7 @@ export function CacheStatsCookies() {
|
||||
CacheEdifice = Game.Objects[i].price * 2;
|
||||
CacheEdificeBuilding = i;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,7 @@ export default function CacheWrinklers() {
|
||||
CacheWrinklersNormal = 0;
|
||||
CacheWrinklersFattest = [0, null];
|
||||
for (let i = 0; i < Game.wrinklers.length; i++) {
|
||||
let sucked = Game.wrinklers[i].sucked;
|
||||
let { sucked } = Game.wrinklers[i];
|
||||
let toSuck = 1.1;
|
||||
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
|
||||
if (Game.wrinklers[i].type === 1) toSuck *= 3; // Shiny wrinklers
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { default as ConfigDefault } from '../../Data/SettingsDefault';
|
||||
import { default as ConfigData } from '../../Data/SettingsData';
|
||||
import ConfigDefault from '../../Data/SettingsDefault';
|
||||
import ConfigData from '../../Data/SettingsData';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
import save from '../../InitSaveLoad/save';
|
||||
import CMLoop from '../../Main/Loop';
|
||||
@@ -43,7 +43,7 @@ export function LoadConfig(settings) {
|
||||
|
||||
// Check values
|
||||
let mod = false;
|
||||
for (const i in ConfigDefault) {
|
||||
Object.keys(ConfigDefault).forEach((i) => {
|
||||
if (typeof CMOptions[i] === 'undefined') {
|
||||
mod = true;
|
||||
CMOptions[i] = ConfigDefault[i];
|
||||
@@ -61,7 +61,7 @@ export function LoadConfig(settings) {
|
||||
CMOptions[i] = ConfigDefault[i];
|
||||
}
|
||||
} else if (i === 'Header') {
|
||||
for (const j in ConfigDefault.Header) {
|
||||
Object.keys(ConfigDefault.Header).forEach((j) => {
|
||||
if (
|
||||
typeof CMOptions[i][j] === 'undefined' ||
|
||||
!(CMOptions[i][j] > -1 && CMOptions[i][j] < 2)
|
||||
@@ -69,10 +69,10 @@ export function LoadConfig(settings) {
|
||||
mod = true;
|
||||
CMOptions[i][j] = ConfigDefault[i][j];
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Colors
|
||||
for (const j in ConfigDefault.Colors) {
|
||||
Object.keys(ConfigDefault.Colors).forEach((j) => {
|
||||
if (
|
||||
typeof CMOptions[i][j] === 'undefined' ||
|
||||
typeof CMOptions[i][j] !== 'string'
|
||||
@@ -80,16 +80,16 @@ export function LoadConfig(settings) {
|
||||
mod = true;
|
||||
CMOptions[i][j] = ConfigDefault[i][j];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (mod) SaveConfig();
|
||||
CMLoop(); // Do loop once
|
||||
for (const i in ConfigDefault) {
|
||||
Object.keys(ConfigDefault).forEach((i) => {
|
||||
if (i !== 'Header' && typeof ConfigData[i].func !== 'undefined') {
|
||||
ConfigData[i].func();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Default values
|
||||
LoadConfig(ConfigDefault);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { default as ConfigData } from '../Data/SettingsData';
|
||||
import ConfigData from '../Data/SettingsData';
|
||||
import { SaveConfig } from './SaveLoadReload/SaveLoadReloadSettings';
|
||||
import { CMOptions } from './VariablesAndData';
|
||||
|
||||
@@ -13,7 +13,7 @@ export const ConfigPrefix = 'CMConfig';
|
||||
* @param {string} config The name of the option
|
||||
*/
|
||||
export function ToggleConfig(config) {
|
||||
CMOptions[config]++;
|
||||
CMOptions[config] += 1;
|
||||
|
||||
if (CMOptions[config] === ConfigData[config].label.length) {
|
||||
CMOptions[config] = 0;
|
||||
@@ -49,7 +49,7 @@ export function ToggleConfigVolume(config) {
|
||||
* @param {string} config The name of the header
|
||||
*/
|
||||
export function ToggleHeader(config) {
|
||||
CMOptions.Header[config]++;
|
||||
CMOptions.Header[config] += 1;
|
||||
if (CMOptions.Header[config] > 1) CMOptions.Header[config] = 0;
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-return-assign */
|
||||
import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
|
||||
import { GCTimers } from '../../Disp/VariablesAndData';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
@@ -8,12 +9,12 @@ import { CMOptions } from '../VariablesAndData';
|
||||
*/
|
||||
export default function ToggleGCTimer() {
|
||||
if (CMOptions.GCTimer === 1) {
|
||||
for (const i of Object.keys(GCTimers)) {
|
||||
Object.keys(GCTimers).forEach((i) => {
|
||||
GCTimers[i].style.display = 'block';
|
||||
GCTimers[i].style.left = CacheGoldenShimmersByID[i].l.style.left;
|
||||
GCTimers[i].style.top = CacheGoldenShimmersByID[i].l.style.top;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
for (const i of Object.keys(GCTimers)) GCTimers[i].style.display = 'none';
|
||||
Object.keys(GCTimers).forEach((i) => (GCTimers[i].style.display = 'none'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
/** General functions to format or beautify strings */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
@@ -93,23 +94,25 @@ export function Beautify(num, floats, forced) {
|
||||
* @returns {string} Formatted time
|
||||
*/
|
||||
export function FormatTime(time, longFormat) {
|
||||
let formattedTime = time;
|
||||
if (time === Infinity) return time;
|
||||
time = Math.ceil(time);
|
||||
const y = Math.floor(time / 31557600);
|
||||
const d = Math.floor((time % 31557600) / 86400);
|
||||
const h = Math.floor((time % 86400) / 3600);
|
||||
const m = Math.floor((time % 3600) / 60);
|
||||
const s = Math.floor(time % 60);
|
||||
formattedTime = Math.ceil(time);
|
||||
const y = Math.floor(formattedTime / 31557600);
|
||||
const d = Math.floor((formattedTime % 31557600) / 86400);
|
||||
const h = Math.floor((formattedTime % 86400) / 3600);
|
||||
const m = Math.floor((formattedTime % 3600) / 60);
|
||||
const s = Math.floor(formattedTime % 60);
|
||||
let str = '';
|
||||
if (CMOptions.TimeFormat) {
|
||||
if (time > 3155760000) return 'XX:XX:XX:XX:XX';
|
||||
if (formattedTime > 3155760000) return 'XX:XX:XX:XX:XX';
|
||||
str += `${(y < 10 ? '0' : '') + y}:`;
|
||||
str += `${(d < 10 ? '0' : '') + d}:`;
|
||||
str += `${(h < 10 ? '0' : '') + h}:`;
|
||||
str += `${(m < 10 ? '0' : '') + m}:`;
|
||||
str += (s < 10 ? '0' : '') + s;
|
||||
} else {
|
||||
if (time > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
|
||||
if (formattedTime > 777600000)
|
||||
return longFormat ? 'Over 9000 days!' : '>9000d';
|
||||
str +=
|
||||
y > 0
|
||||
? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, `
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
import {
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
@@ -30,17 +31,17 @@ export default function UpdateBuildings() {
|
||||
|
||||
if (Game.buyMode === 1) {
|
||||
if (CMOptions.BuildColor === 1) {
|
||||
for (const i of Object.keys(target)) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
l(`productPrice${Game.Objects[i].id}`).style.color =
|
||||
CMOptions.Colors[target[i].color];
|
||||
}
|
||||
});
|
||||
} else {
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color');
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (Game.buyMode === -1) {
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
const o = Game.Objects[i];
|
||||
l(`productPrice${o.id}`).style.color = '';
|
||||
/*
|
||||
@@ -54,7 +55,7 @@ export default function UpdateBuildings() {
|
||||
l(`productPrice${o.id}`).innerHTML = Beautify(
|
||||
BuildingSell(o, o.basePrice, o.amount, o.free, Game.buyBulk, 1),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Build array of pointers, sort by pp, use array index (+2) as the grid row number
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
import { CacheUpgrades } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
@@ -29,10 +30,10 @@ export default function UpdateUpgrades() {
|
||||
let purple = 0;
|
||||
let gray = 0;
|
||||
|
||||
for (const i of Object.keys(Game.UpgradesInStore)) {
|
||||
Object.keys(Game.UpgradesInStore).forEach((i) => {
|
||||
const me = Game.UpgradesInStore[i];
|
||||
let addedColor = false;
|
||||
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j++) {
|
||||
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
|
||||
if (
|
||||
l(`upgrade${i}`).childNodes[j].className.indexOf(ColorBackPre) !== -1
|
||||
) {
|
||||
@@ -49,14 +50,14 @@ export default function UpdateUpgrades() {
|
||||
div.className = ColorBackPre + CacheUpgrades[me.name].color;
|
||||
l(`upgrade${i}`).appendChild(div);
|
||||
}
|
||||
if (CacheUpgrades[me.name].color === ColorBlue) blue++;
|
||||
else if (CacheUpgrades[me.name].color === ColorGreen) green++;
|
||||
else if (CacheUpgrades[me.name].color === ColorYellow) yellow++;
|
||||
else if (CacheUpgrades[me.name].color === ColorOrange) orange++;
|
||||
else if (CacheUpgrades[me.name].color === ColorRed) red++;
|
||||
else if (CacheUpgrades[me.name].color === ColorPurple) purple++;
|
||||
else if (CacheUpgrades[me.name].color === ColorGray) gray++;
|
||||
}
|
||||
if (CacheUpgrades[me.name].color === ColorBlue) blue += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorGreen) green += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorYellow) yellow += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorOrange) orange += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorRed) red += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorPurple) purple += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColorGray) gray += 1;
|
||||
});
|
||||
|
||||
l('CMUpgradeBarBlue').textContent = blue;
|
||||
l('CMUpgradeBarGreen').textContent = green;
|
||||
@@ -70,7 +71,7 @@ export default function UpdateUpgrades() {
|
||||
const arr = [];
|
||||
// Build array of pointers, sort by pp, set flex positions
|
||||
// This regulates sorting of upgrades
|
||||
for (let x = 0; x < Game.UpgradesInStore.length; x++) {
|
||||
for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
|
||||
const o = {};
|
||||
o.name = Game.UpgradesInStore[x].name;
|
||||
o.price = Game.UpgradesInStore[x].basePrice;
|
||||
@@ -95,7 +96,7 @@ export default function UpdateUpgrades() {
|
||||
const nameChecker = function (arr2, upgrade) {
|
||||
return arr2.findIndex((e) => e.name === upgrade.name);
|
||||
};
|
||||
for (let x = 0; x < Game.UpgradesInStore.length; x++) {
|
||||
for (let x = 0; x < Game.UpgradesInStore.length; x += 1) {
|
||||
l(`upgrade${x}`).style.order =
|
||||
nameChecker(arr, Game.UpgradesInStore[x]) + 1;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/** Section: Functions related to the Golden Cookie Timers */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
@@ -10,11 +10,11 @@ export default function CalculateGrimoireRefillTime(
|
||||
maxMagic,
|
||||
targetMagic,
|
||||
) {
|
||||
let magic = currentMagic;
|
||||
let count = 0;
|
||||
while (currentMagic < targetMagic) {
|
||||
currentMagic +=
|
||||
Math.max(0.002, (currentMagic / Math.max(maxMagic, 100)) ** 0.5) * 0.002;
|
||||
count++;
|
||||
while (magic < targetMagic) {
|
||||
magic += Math.max(0.002, (magic / Math.max(maxMagic, 100)) ** 0.5) * 0.002;
|
||||
count += 1;
|
||||
}
|
||||
return count / Game.fps;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* It is called by a click of the 'pop all' button created by CM.Disp.AddMenuStats()
|
||||
*/
|
||||
export default function PopAllNormalWrinklers() {
|
||||
for (const i of Object.keys(Game.wrinklers)) {
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
if (Game.wrinklers[i].sucked > 0 && Game.wrinklers[i].type === 0) {
|
||||
Game.wrinklers[i].hp = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -63,9 +63,9 @@ export function CreateBotBar() {
|
||||
|
||||
l('wrapper').appendChild(BotBar);
|
||||
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
CreateBotBarBuildingColumn(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +74,7 @@ export function CreateBotBar() {
|
||||
export function UpdateBotBar() {
|
||||
if (CMOptions.BotBar === 1 && CacheObjects1 && Game.buyMode === 1) {
|
||||
let count = 0;
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
let target = Game.buyBulk;
|
||||
if (Game.buyMode === 1) {
|
||||
LastTargetBotBar = target;
|
||||
@@ -84,7 +84,7 @@ export function UpdateBotBar() {
|
||||
if (target === 1) target = CacheObjects1;
|
||||
if (target === 10) target = CacheObjects10;
|
||||
if (target === 100) target = CacheObjects100;
|
||||
count++;
|
||||
count += 1;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[0].childNodes[
|
||||
count
|
||||
].childNodes[1].textContent = Game.Objects[i].amount;
|
||||
@@ -115,6 +115,6 @@ export function UpdateBotBar() {
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].textContent = timeColor.text;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ export function UpdateTimerBar() {
|
||||
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) /
|
||||
Game.fps,
|
||||
);
|
||||
numberOfTimers++;
|
||||
numberOfTimers += 1;
|
||||
} else l('CMTimerBarGC').style.display = 'none';
|
||||
|
||||
// Regulates visibility of Reindeer timer
|
||||
@@ -152,7 +152,7 @@ export function UpdateTimerBar() {
|
||||
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) /
|
||||
Game.fps,
|
||||
);
|
||||
numberOfTimers++;
|
||||
numberOfTimers += 1;
|
||||
} else {
|
||||
l('CMTimerBarRen').style.display = 'none';
|
||||
}
|
||||
@@ -160,7 +160,7 @@ export function UpdateTimerBar() {
|
||||
// On every frame all buff-timers are deleted and re-created
|
||||
const BuffTimerBars = {};
|
||||
l('CMTimerBarBuffTimers').innerHTML = '';
|
||||
for (const i of Object.keys(Game.buffs)) {
|
||||
Object.keys(Game.buffs).forEach((i) => {
|
||||
if (Game.buffs[i]) {
|
||||
const timer = CreateTimer(Game.buffs[i].name, Game.buffs[i].name, [
|
||||
{ id: `${Game.buffs[i].name}Bar` },
|
||||
@@ -187,13 +187,13 @@ export function UpdateTimerBar() {
|
||||
timer.lastChild.children[2].textContent = Math.ceil(
|
||||
Game.buffs[i].time / Game.fps,
|
||||
);
|
||||
numberOfTimers++;
|
||||
numberOfTimers += 1;
|
||||
BuffTimerBars[Game.buffs[i].name] = timer;
|
||||
}
|
||||
}
|
||||
for (const i of Object.keys(BuffTimerBars)) {
|
||||
});
|
||||
Object.keys(BuffTimerBars).forEach((i) => {
|
||||
l('CMTimerBarBuffTimers').appendChild(BuffTimerBars[i]);
|
||||
}
|
||||
});
|
||||
|
||||
if (numberOfTimers !== 0) {
|
||||
l('CMTimerBar').style.height = `${numberOfTimers * 12 + 2}px`;
|
||||
|
||||
@@ -112,47 +112,47 @@ export default function AddMenuStats(title) {
|
||||
|
||||
let specDisp = false;
|
||||
const missingHalloweenCookies = [];
|
||||
for (const i of Object.keys(GameData.HalloCookies)) {
|
||||
Object.keys(GameData.HalloCookies).forEach((i) => {
|
||||
if (!Game.Has(GameData.HalloCookies[i])) {
|
||||
missingHalloweenCookies.push(GameData.HalloCookies[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
const missingChristmasCookies = [];
|
||||
for (const i of Object.keys(GameData.ChristCookies)) {
|
||||
Object.keys(GameData.ChristCookies).forEach((i) => {
|
||||
if (!Game.Has(GameData.ChristCookies[i])) {
|
||||
missingChristmasCookies.push(GameData.ChristCookies[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
const missingValentineCookies = [];
|
||||
for (const i of Object.keys(GameData.ValCookies)) {
|
||||
Object.keys(GameData.ValCookies).forEach((i) => {
|
||||
if (!Game.Has(GameData.ValCookies[i])) {
|
||||
missingValentineCookies.push(GameData.ValCookies[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
const missingNormalEggs = [];
|
||||
for (const i of Object.keys(Game.eggDrops)) {
|
||||
Object.keys(Game.eggDrops).forEach((i) => {
|
||||
if (!Game.HasUnlocked(Game.eggDrops[i])) {
|
||||
missingNormalEggs.push(Game.eggDrops[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
const missingRareEggs = [];
|
||||
for (const i of Object.keys(Game.rareEggDrops)) {
|
||||
Object.keys(Game.rareEggDrops).forEach((i) => {
|
||||
if (!Game.HasUnlocked(Game.rareEggDrops[i])) {
|
||||
missingRareEggs.push(Game.rareEggDrops[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
const missingPlantDrops = [];
|
||||
for (const i of Object.keys(GameData.PlantDrops)) {
|
||||
Object.keys(GameData.PlantDrops).forEach((i) => {
|
||||
if (!Game.HasUnlocked(GameData.PlantDrops[i])) {
|
||||
missingPlantDrops.push(GameData.PlantDrops[i]);
|
||||
specDisp = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
const choEgg =
|
||||
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
|
||||
const centEgg = Game.Has('Century egg');
|
||||
@@ -266,11 +266,11 @@ export default function AddMenuStats(title) {
|
||||
);
|
||||
if (Game.Has('Fortune cookies')) {
|
||||
const fortunes = [];
|
||||
for (const i of Object.keys(GameData.Fortunes)) {
|
||||
Object.keys(GameData.Fortunes).forEach((i) => {
|
||||
if (!Game.Has(GameData.Fortunes[i])) {
|
||||
fortunes.push(GameData.Fortunes[i]);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (fortunes.length !== 0)
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
|
||||
@@ -106,12 +106,12 @@ export function StatsMissDisp(theMissDisp) {
|
||||
title.style.textAlign = 'center';
|
||||
title.textContent = 'Missing';
|
||||
missing.appendChild(title);
|
||||
for (const i of Object.keys(theMissDisp)) {
|
||||
Object.keys(theMissDisp).forEach((i) => {
|
||||
const div = document.createElement('div');
|
||||
div.style.textAlign = 'center';
|
||||
div.appendChild(document.createTextNode(theMissDisp[i]));
|
||||
missing.appendChild(div);
|
||||
}
|
||||
});
|
||||
placeholder.appendChild(missing);
|
||||
span.onmouseover = function () {
|
||||
Game.tooltip.draw(this, escape(placeholder.innerHTML));
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
* This function creates the missing upgrades sections for prestige, normal and cookie upgrades
|
||||
*/
|
||||
export function AddMissingUpgrades() {
|
||||
for (const menuSection of l('menu').children) {
|
||||
l('menu').childNodes.forEach((menuSection) => {
|
||||
if (menuSection.children[0]) {
|
||||
if (
|
||||
menuSection.children[0].innerHTML === 'Prestige' &&
|
||||
@@ -82,7 +82,7 @@ export function AddMissingUpgrades() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +99,7 @@ export function crateMissing(me) {
|
||||
if (!Game.prefs.crates) noFrame = 1;
|
||||
if (noFrame) classes += ' noFrame';
|
||||
|
||||
let icon = me.icon;
|
||||
let { icon } = me;
|
||||
if (me.iconFunction) icon = me.iconFunction();
|
||||
const tooltip = `function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;
|
||||
return `<div class="${classes}"
|
||||
|
||||
@@ -170,7 +170,7 @@ function CreatePrefOption(config) {
|
||||
SaveConfig();
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
new JsColor(input, { hash: true, position: 'right', onInput: change });
|
||||
JsColor(input, { hash: true, position: 'right', onInput: change });
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config.Colors.desc[Colors[i]];
|
||||
innerDiv.appendChild(label);
|
||||
@@ -216,14 +216,14 @@ export default function AddMenuPref(title) {
|
||||
const frag = document.createDocumentFragment();
|
||||
frag.appendChild(title);
|
||||
|
||||
for (const group of Object.keys(ConfigGroups)) {
|
||||
Object.keys(ConfigGroups).forEach((group) => {
|
||||
const groupObject = CreatePrefHeader(group, ConfigGroups[group]); // (group, display-name of group)
|
||||
frag.appendChild(groupObject);
|
||||
if (CMOptions.Header[group]) {
|
||||
// 0 is show, 1 is collapsed
|
||||
// Make sub-sections of Notification section
|
||||
if (group === 'Notification') {
|
||||
for (const subGroup of Object.keys(ConfigGroupsNotification)) {
|
||||
Object.keys(ConfigGroupsNotification).forEach((subGroup) => {
|
||||
const subGroupObject = CreatePrefHeader(
|
||||
subGroup,
|
||||
ConfigGroupsNotification[subGroup],
|
||||
@@ -232,20 +232,20 @@ export default function AddMenuPref(title) {
|
||||
subGroupObject.style.opacity = '0.5';
|
||||
frag.appendChild(subGroupObject);
|
||||
if (CMOptions.Header[subGroup]) {
|
||||
for (const option in Config) {
|
||||
Object.keys(Config).forEach((option) => {
|
||||
if (Config[option].group === subGroup)
|
||||
frag.appendChild(CreatePrefOption(option));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
for (const option of Object.keys(Config)) {
|
||||
Object.keys(Config).forEach((option) => {
|
||||
if (Config[option].group === group)
|
||||
frag.appendChild(CreatePrefOption(option));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const resDef = document.createElement('div');
|
||||
resDef.className = 'listing';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
|
||||
* @param {string} title The title of the to-be created notifications
|
||||
* @param {string} message The text of the to-be created notifications
|
||||
*/
|
||||
export default function Notification(notifyConfig, title, message) {
|
||||
export default function CreateNotification(notifyConfig, title, message) {
|
||||
// The arguments check makes the sound not play upon initialization of the mod
|
||||
if (
|
||||
CMOptions[notifyConfig] === 1 &&
|
||||
@@ -18,6 +18,7 @@ export default function Notification(notifyConfig, title, message) {
|
||||
isInitializing === false
|
||||
) {
|
||||
const CookieIcon = 'https://orteil.dashnet.org/cookieclicker/favicon.ico';
|
||||
// eslint-disable-next-line no-new
|
||||
new Notification(title, { body: message, badge: CookieIcon });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
ColorTextPre,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
import {
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as Create from '../CreateTooltip';
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export default function GardenPlots() {
|
||||
const minigame = Game.Objects.Farm.minigame;
|
||||
const { minigame } = Game.Objects.Farm;
|
||||
if (
|
||||
CMOptions.TooltipPlots &&
|
||||
minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0
|
||||
|
||||
@@ -14,7 +14,7 @@ import * as Create from '../CreateTooltip';
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export default function Grimoire() {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
const { minigame } = Game.Objects['Wizard tower'];
|
||||
const spellCost = minigame.getSpellCost(minigame.spellsById[TooltipName]);
|
||||
|
||||
if (CMOptions.TooltipGrim === 1 && spellCost <= minigame.magicM) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as Create from '../CreateTooltip';
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export default function HarvestAll() {
|
||||
const minigame = Game.Objects.Farm.minigame;
|
||||
const { minigame } = Game.Objects.Farm;
|
||||
if (CMOptions.TooltipLump) {
|
||||
l('CMTooltipBorder').appendChild(
|
||||
Create.TooltipCreateHeader('Cookies gained from harvesting:'),
|
||||
|
||||
@@ -16,7 +16,7 @@ export function CheckWrinklerTooltip() {
|
||||
if (CMOptions.TooltipWrink === 1 && TooltipWrinklerArea === 1) {
|
||||
// Latter is set by CM.Main.AddWrinklerAreaDetect
|
||||
let showingTooltip = false;
|
||||
for (const i of Object.keys(Game.wrinklers)) {
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
const me = Game.wrinklers[i];
|
||||
if (me.phase > 0 && me.selected) {
|
||||
showingTooltip = true;
|
||||
@@ -36,11 +36,11 @@ export function CheckWrinklerTooltip() {
|
||||
Game.tooltip.draw(this, escape(placeholder.innerHTML));
|
||||
TooltipWrinkler = i;
|
||||
TooltipWrinklerBeingShown[i] = 1;
|
||||
} else break;
|
||||
}
|
||||
} else {
|
||||
TooltipWrinklerBeingShown[i] = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!showingTooltip) {
|
||||
Game.tooltip.hide();
|
||||
}
|
||||
@@ -54,7 +54,7 @@ export function CheckWrinklerTooltip() {
|
||||
*/
|
||||
export function UpdateWrinklerTooltip() {
|
||||
if (CMOptions.TooltipWrink === 1 && l('CMTooltipWrinkler') !== null) {
|
||||
let sucked = Game.wrinklers[TooltipWrinkler].sucked;
|
||||
let { sucked } = Game.wrinklers[TooltipWrinkler];
|
||||
let toSuck = 1.1;
|
||||
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
|
||||
if (Game.wrinklers[TooltipWrinkler].type === 1) toSuck *= 3; // Shiny wrinklers
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import CreateGCTimer from '../../Disp/GoldenCookieTimers/GoldenCookieTimers';
|
||||
import Flash from '../../Disp/Notifications/Flash';
|
||||
import Notification from '../../Disp/Notifications/Notification';
|
||||
import CreateNotification from '../../Disp/Notifications/Notification';
|
||||
import PlaySound from '../../Disp/Notifications/Sound';
|
||||
import { UpdateFavicon } from '../../Disp/TabTitle/FavIcon';
|
||||
import { GCTimers } from '../../Disp/VariablesAndData';
|
||||
@@ -24,13 +24,13 @@ import {
|
||||
function FindShimmer() {
|
||||
CurrSpawnedGoldenCookieState = 0;
|
||||
CacheGoldenShimmersByID = {};
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
Object.keys(Game.shimmers).forEach((i) => {
|
||||
CacheGoldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i];
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'golden') {
|
||||
CacheSpawnedGoldenShimmer = Game.shimmers[i];
|
||||
CurrSpawnedGoldenCookieState += 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,42 +39,42 @@ function FindShimmer() {
|
||||
*/
|
||||
export default function CheckGoldenCookie() {
|
||||
FindShimmer();
|
||||
for (const i of Object.keys(GCTimers)) {
|
||||
Object.keys(GCTimers).forEach((i) => {
|
||||
if (typeof CacheGoldenShimmersByID[i] === 'undefined') {
|
||||
GCTimers[i].parentNode.removeChild(GCTimers[i]);
|
||||
delete GCTimers[i];
|
||||
}
|
||||
}
|
||||
});
|
||||
if (LastGoldenCookieState !== Game.shimmerTypes.golden.n) {
|
||||
LastGoldenCookieState = Game.shimmerTypes.golden.n;
|
||||
if (LastGoldenCookieState) {
|
||||
if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) {
|
||||
Flash(3, 'GCFlash');
|
||||
PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume');
|
||||
Notification(
|
||||
CreateNotification(
|
||||
'GCNotification',
|
||||
'Golden Cookie Spawned',
|
||||
'A Golden Cookie has spawned. Click it now!',
|
||||
);
|
||||
}
|
||||
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
Object.keys(Game.shimmers).forEach((i) => {
|
||||
if (typeof GCTimers[Game.shimmers[i].id] === 'undefined') {
|
||||
CreateGCTimer(Game.shimmers[i]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
UpdateFavicon();
|
||||
LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState;
|
||||
if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0;
|
||||
} else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) {
|
||||
for (const i of Object.keys(GCTimers)) {
|
||||
Object.keys(GCTimers).forEach((i) => {
|
||||
GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity;
|
||||
GCTimers[i].style.transform =
|
||||
CacheGoldenShimmersByID[i].l.style.transform;
|
||||
GCTimers[i].textContent = Math.ceil(
|
||||
CacheGoldenShimmersByID[i].life / Game.fps,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import Flash from '../../Disp/Notifications/Flash';
|
||||
import Notification from '../../Disp/Notifications/Notification';
|
||||
import CreateNotification from '../../Disp/Notifications/Notification';
|
||||
import PlaySound from '../../Disp/Notifications/Sound';
|
||||
import { LastMagicBarFull } from '../VariablesAndData';
|
||||
|
||||
@@ -13,13 +13,13 @@ export default function CheckMagicMeter() {
|
||||
Game.Objects['Wizard tower'].minigameLoaded &&
|
||||
CMOptions.GrimoireBar === 1
|
||||
) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
const { minigame } = Game.Objects['Wizard tower'];
|
||||
if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
|
||||
else if (!LastMagicBarFull) {
|
||||
LastMagicBarFull = true;
|
||||
Flash(3, 'MagicFlash');
|
||||
PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume');
|
||||
Notification(
|
||||
CreateNotification(
|
||||
'MagicNotification',
|
||||
'Magic Meter full',
|
||||
'Your Magic Meter is full. Cast a spell!',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { CacheSeasonPopShimmer } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import Flash from '../../Disp/Notifications/Flash';
|
||||
import Notification from '../../Disp/Notifications/Notification';
|
||||
import CreateNotification from '../../Disp/Notifications/Notification';
|
||||
import PlaySound from '../../Disp/Notifications/Sound';
|
||||
import { LastSeasonPopupState } from '../VariablesAndData';
|
||||
|
||||
@@ -13,15 +13,14 @@ import { LastSeasonPopupState } from '../VariablesAndData';
|
||||
export default function CheckSeasonPopup() {
|
||||
if (LastSeasonPopupState !== Game.shimmerTypes.reindeer.spawned) {
|
||||
LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
|
||||
for (const i of Object.keys(Game.shimmers)) {
|
||||
Object.keys(Game.shimmers).forEach((i) => {
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') {
|
||||
CacheSeasonPopShimmer = Game.shimmers[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
Flash(3, 'SeaFlash');
|
||||
PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume');
|
||||
Notification(
|
||||
CreateNotification(
|
||||
'SeaNotification',
|
||||
'Reindeer sighted!',
|
||||
'A Reindeer has spawned. Click it now!',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import Flash from '../../Disp/Notifications/Flash';
|
||||
import Notification from '../../Disp/Notifications/Notification';
|
||||
import CreateNotification from '../../Disp/Notifications/Notification';
|
||||
import PlaySound from '../../Disp/Notifications/Sound';
|
||||
import { LastTickerFortuneState } from '../VariablesAndData';
|
||||
|
||||
@@ -18,7 +18,7 @@ export default function CheckTickerFortune() {
|
||||
if (LastTickerFortuneState) {
|
||||
Flash(3, 'FortuneFlash');
|
||||
PlaySound(CMOptions.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
|
||||
Notification(
|
||||
CreateNotification(
|
||||
'FortuneNotification',
|
||||
'Fortune Cookie found',
|
||||
'A Fortune Cookie has appeared on the Ticker.',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import Flash from '../../Disp/Notifications/Flash';
|
||||
import Notification from '../../Disp/Notifications/Notification';
|
||||
import CreateNotification from '../../Disp/Notifications/Notification';
|
||||
import PlaySound from '../../Disp/Notifications/Sound';
|
||||
import { LastWrinklerCount } from '../VariablesAndData';
|
||||
|
||||
@@ -11,9 +11,9 @@ import { LastWrinklerCount } from '../VariablesAndData';
|
||||
export default function CheckWrinklerCount() {
|
||||
if (Game.elderWrath > 0) {
|
||||
let CurrentWrinklers = 0;
|
||||
for (const i in Game.wrinklers) {
|
||||
if (Game.wrinklers[i].phase === 2) CurrentWrinklers++;
|
||||
}
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
if (Game.wrinklers[i].phase === 2) CurrentWrinklers += 1;
|
||||
});
|
||||
if (CurrentWrinklers > LastWrinklerCount) {
|
||||
LastWrinklerCount = CurrentWrinklers;
|
||||
if (
|
||||
@@ -44,13 +44,13 @@ export default function CheckWrinklerCount() {
|
||||
CurrentWrinklers === Game.getWrinklersMax() &&
|
||||
CMOptions.WrinklerMaxNotification
|
||||
) {
|
||||
Notification(
|
||||
CreateNotification(
|
||||
'WrinklerMaxNotification',
|
||||
'Maximum Wrinklers Reached',
|
||||
'You have reached your maximum ammount of wrinklers',
|
||||
);
|
||||
} else {
|
||||
Notification(
|
||||
CreateNotification(
|
||||
'WrinklerNotification',
|
||||
'A Wrinkler appeared',
|
||||
'A new wrinkler has appeared',
|
||||
|
||||
@@ -38,13 +38,13 @@ export default function InitializeCookieMonster() {
|
||||
CreateUpgradeBar();
|
||||
CreateWhiteScreen();
|
||||
CreateFavicon();
|
||||
for (const i of Object.keys(TooltipText)) {
|
||||
Object.keys(TooltipText).forEach((i) => {
|
||||
CreateSimpleTooltip(
|
||||
TooltipText[i][0],
|
||||
TooltipText[i][1],
|
||||
TooltipText[i][2],
|
||||
);
|
||||
}
|
||||
});
|
||||
CreateWrinklerButtons();
|
||||
UpdateBuildingUpgradeStyle();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ function ReplaceNativeGrimoireDraw() {
|
||||
!HasReplaceNativeGrimoireDraw &&
|
||||
Game.Objects['Wizard tower'].minigameLoaded
|
||||
) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
const { minigame } = Game.Objects['Wizard tower'];
|
||||
BackupGrimoireDraw = minigame.draw;
|
||||
Game.Objects['Wizard tower'].minigame.draw = function () {
|
||||
BackupGrimoireDraw();
|
||||
@@ -46,7 +46,7 @@ function ReplaceNativeGrimoireLaunch() {
|
||||
!HasReplaceNativeGrimoireLaunch &&
|
||||
Game.Objects['Wizard tower'].minigameLoaded
|
||||
) {
|
||||
const minigame = Game.Objects['Wizard tower'].minigame;
|
||||
const { minigame } = Game.Objects['Wizard tower'];
|
||||
BackupGrimoireLaunch = minigame.launch;
|
||||
BackupGrimoireLaunchMod = new Function(
|
||||
`return ${minigame.launch
|
||||
|
||||
@@ -6,7 +6,8 @@ import { TooltipGrimoireBackup } from '../VariablesAndData';
|
||||
*/
|
||||
export default function ReplaceTooltipGrimoire() {
|
||||
if (Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
for (const i in Game.Objects['Wizard tower'].minigame.spellsById) {
|
||||
Object.keys(Game.Objects['Wizard tower'].minigame.spellsById).forEach(
|
||||
(i) => {
|
||||
if (l(`grimoireSpell${i}`).onmouseover !== null) {
|
||||
TooltipGrimoireBackup[i] = l(`grimoireSpell${i}`).onmouseover;
|
||||
l(`grimoireSpell${i}`).onmouseover = function () {
|
||||
@@ -21,6 +22,7 @@ export default function ReplaceTooltipGrimoire() {
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TooltipUpgradeBackup } from '../VariablesAndData';
|
||||
*/
|
||||
export default function ReplaceTooltipUpgrade() {
|
||||
TooltipUpgradeBackup = [];
|
||||
for (const i of Object.keys(Game.UpgradesInStore)) {
|
||||
Object.keys(Game.UpgradesInStore).forEach((i) => {
|
||||
if (l(`upgrade${i}`).onmouseover !== null) {
|
||||
TooltipUpgradeBackup[i] = l(`upgrade${i}`).onmouseover;
|
||||
l(`upgrade${i}`).onmouseover = function () {
|
||||
@@ -26,5 +26,5 @@ export default function ReplaceTooltipUpgrade() {
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Functions related to replacing tooltips */
|
||||
|
||||
@@ -14,7 +15,7 @@ import ReplaceTooltipGrimoire from './TooltipGrimoire';
|
||||
* This function replaces the original .onmouseover functions of buildings
|
||||
*/
|
||||
function ReplaceTooltipBuild() {
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
const me = Game.Objects[i];
|
||||
if (l(`product${me.id}`).onmouseover !== null) {
|
||||
TooltipBuildBackup[i] = l(`product${me.id}`).onmouseover;
|
||||
@@ -30,7 +31,7 @@ function ReplaceTooltipBuild() {
|
||||
Game.tooltip.wobble();
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,6 +130,7 @@ export default function ReplaceTooltips() {
|
||||
|
||||
// Replace Tooltips of Minigames. Nesting it in LoadMinigames makes sure to replace them even if
|
||||
// they were not loaded initially
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
LoadMinigames = Game.LoadMinigames;
|
||||
Game.LoadMinigames = function () {
|
||||
LoadMinigames();
|
||||
|
||||
@@ -15,8 +15,8 @@ export default function AddWrinklerAreaDetect() {
|
||||
l('backgroundLeftCanvas').onmouseout = function () {
|
||||
TooltipWrinklerArea = 0;
|
||||
Game.tooltip.hide();
|
||||
for (const i of Object.keys(Game.wrinklers)) {
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
TooltipWrinklerBeingShown[i] = 0;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,15 +31,15 @@ export default function CalculateGains() {
|
||||
let mult = 1;
|
||||
// Include minigame effects
|
||||
const effs = {};
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
if (Game.Objects[i].minigameLoaded && Game.Objects[i].minigame.effs) {
|
||||
const myEffs = Game.Objects[i].minigame.effs;
|
||||
for (const ii in myEffs) {
|
||||
Object.keys(myEffs).forEach((ii) => {
|
||||
if (effs[ii]) effs[ii] *= myEffs[ii];
|
||||
else effs[ii] = myEffs[ii];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
SimEffs = effs;
|
||||
|
||||
if (Game.ascensionMode !== 1)
|
||||
@@ -54,7 +54,7 @@ export default function CalculateGains() {
|
||||
if (SimHas('Heralds') && Game.ascensionMode !== 1)
|
||||
mult *= 1 + 0.01 * Game.heralds;
|
||||
|
||||
for (const i of Object.keys(Game.cookieUpgrades)) {
|
||||
Object.keys(Game.cookieUpgrades).forEach((i) => {
|
||||
const me = Game.cookieUpgrades[i];
|
||||
if (SimHas(me.name)) {
|
||||
// Some upgrades have a functio as .power (notably the valentine cookies)
|
||||
@@ -64,7 +64,7 @@ export default function CalculateGains() {
|
||||
mult *= 1 + SimUpgrades[me.name].power(SimUpgrades[me.name]) * 0.01;
|
||||
} else mult *= 1 + me.power * 0.01;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (SimHas('Specialized chocolate chips')) mult *= 1.01;
|
||||
if (SimHas('Designer cocoa beans')) mult *= 1.02;
|
||||
@@ -160,7 +160,7 @@ export default function CalculateGains() {
|
||||
if (SimHas('Kitten angels')) catMult *= 1 + milkProgress * 0.1 * milkMult;
|
||||
if (SimHas('Fortune #103')) catMult *= 1 + milkProgress * 0.05 * milkMult;
|
||||
|
||||
for (const i of Object.keys(SimObjects)) {
|
||||
Object.keys(SimObjects).forEach((i) => {
|
||||
const me = SimObjects[i];
|
||||
let storedCps = me.cps(me);
|
||||
if (Game.ascensionMode !== 1)
|
||||
@@ -171,7 +171,7 @@ export default function CalculateGains() {
|
||||
)
|
||||
storedCps *= 1 + 0.05 * milkProgress * milkMult;
|
||||
SimCookiesPs += me.amount * storedCps;
|
||||
}
|
||||
});
|
||||
|
||||
if (SimHas('"egg"')) SimCookiesPs += 9; // "egg"
|
||||
|
||||
@@ -210,14 +210,14 @@ export default function CalculateGains() {
|
||||
mult *= 1 + SimAuraMult('Radiant Appetite');
|
||||
|
||||
const rawCookiesPs = SimCookiesPs * mult;
|
||||
for (const i of Object.keys(Game.CpsAchievements)) {
|
||||
Object.keys(Game.CpsAchievements).forEach((i) => {
|
||||
if (rawCookiesPs >= Game.CpsAchievements[i].threshold)
|
||||
SimWin(Game.CpsAchievements[i].name);
|
||||
}
|
||||
});
|
||||
|
||||
SimCookiesPsRaw = rawCookiesPs;
|
||||
|
||||
const n = Game.shimmerTypes.golden.n;
|
||||
const { n } = Game.shimmerTypes.golden;
|
||||
const auraMult = SimAuraMult("Dragon's Fortune");
|
||||
for (let i = 0; i < n; i++) {
|
||||
mult *= 1 + auraMult * 1.23;
|
||||
@@ -233,9 +233,9 @@ export default function CalculateGains() {
|
||||
let goldenSwitchMult = 1.5;
|
||||
if (SimHas('Residual luck')) {
|
||||
const upgrades = Game.goldenCookieUpgrades;
|
||||
for (const i of Object.keys(upgrades)) {
|
||||
Object.keys(upgrades).forEach((i) => {
|
||||
if (SimHas(upgrades[i])) goldenSwitchMult += 0.1;
|
||||
}
|
||||
});
|
||||
}
|
||||
mult *= goldenSwitchMult;
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ import { SimObjects, SimUpgradesOwned } from '../VariablesAndData';
|
||||
*/
|
||||
export default function CheckOtherAchiev() {
|
||||
let grandmas = 0;
|
||||
for (const i of Object.keys(Game.GrandmaSynergies)) {
|
||||
if (SimHas(Game.GrandmaSynergies[i])) grandmas++;
|
||||
}
|
||||
Object.keys(Game.GrandmaSynergies).forEach((i) => {
|
||||
if (SimHas(Game.GrandmaSynergies[i])) grandmas += 1;
|
||||
});
|
||||
if (!SimHasAchiev('Elder') && grandmas >= 7) SimWin('Elder');
|
||||
if (!SimHasAchiev('Veteran') && grandmas >= 14) SimWin('Veteran');
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function CheckOtherAchiev() {
|
||||
let mathematician = 1;
|
||||
let base10 = 1;
|
||||
let minAmount = 100000;
|
||||
for (const i of Object.keys(SimObjects)) {
|
||||
Object.keys(SimObjects).forEach((i) => {
|
||||
buildingsOwned += SimObjects[i].amount;
|
||||
minAmount = Math.min(SimObjects[i].amount, minAmount);
|
||||
if (!SimHasAchiev('Mathematician')) {
|
||||
@@ -38,7 +38,7 @@ export default function CheckOtherAchiev() {
|
||||
)
|
||||
base10 = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (minAmount >= 1) SimWin('One with everything');
|
||||
if (mathematician === 1) SimWin('Mathematician');
|
||||
if (base10 === 1) SimWin('Base 10');
|
||||
@@ -76,23 +76,23 @@ export default function CheckOtherAchiev() {
|
||||
SimWin('The elder scrolls');
|
||||
|
||||
let hasAllHalloCook = true;
|
||||
for (const i of Object.keys(HalloCookies)) {
|
||||
Object.keys(HalloCookies).forEach((i) => {
|
||||
if (!SimHas(HalloCookies[i])) hasAllHalloCook = false;
|
||||
}
|
||||
});
|
||||
if (hasAllHalloCook) SimWin('Spooky cookies');
|
||||
|
||||
let hasAllChristCook = true;
|
||||
for (const i of Object.keys(ChristCookies)) {
|
||||
Object.keys(ChristCookies).forEach((i) => {
|
||||
if (!SimHas(ChristCookies[i])) hasAllChristCook = false;
|
||||
}
|
||||
});
|
||||
if (hasAllChristCook) SimWin('Let it snow');
|
||||
|
||||
if (SimHas('Fortune cookies')) {
|
||||
const list = Game.Tiers.fortune.upgrades;
|
||||
let fortunes = 0;
|
||||
for (const i of Object.keys(list)) {
|
||||
if (SimHas(list[i].name)) fortunes++;
|
||||
}
|
||||
Object.keys(list).forEach((i) => {
|
||||
if (SimHas(list[i].name)) fortunes += 1;
|
||||
});
|
||||
if (fortunes >= list.length) SimWin('O Fortuna');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,20 +12,20 @@ import InitUpgrade from './InitUpgrade';
|
||||
export default function InitData() {
|
||||
// Buildings
|
||||
SimObjects = [];
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
SimObjects[i] = InitialBuildingData(i);
|
||||
}
|
||||
});
|
||||
|
||||
// Upgrades
|
||||
SimUpgrades = [];
|
||||
for (const i of Object.keys(Game.Upgrades)) {
|
||||
Object.keys(Game.Upgrades).forEach((i) => {
|
||||
SimUpgrades[i] = InitUpgrade(i);
|
||||
}
|
||||
});
|
||||
|
||||
// Achievements
|
||||
SimAchievements = [];
|
||||
for (const i of Object.keys(Game.Achievements)) {
|
||||
Object.keys(Game.Achievements).forEach((i) => {
|
||||
SimAchievements[i] = InitAchievement(i);
|
||||
}
|
||||
});
|
||||
CopyData();
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ export default function InitUpgrade(upgradeName) {
|
||||
if (me.name === 'Sugar crystal cookies') {
|
||||
you.power = function () {
|
||||
let n = 5;
|
||||
for (const i in SimObjects) {
|
||||
Object.keys(SimObjects).forEach((i) => {
|
||||
if (SimObjects[i].level >= 10) n += 1;
|
||||
}
|
||||
});
|
||||
return n;
|
||||
};
|
||||
} else {
|
||||
|
||||
@@ -29,9 +29,9 @@ export default function InitialBuildingData(buildingName) {
|
||||
if (SimHas('Nonillion fingers')) add *= 20;
|
||||
let mult = 1;
|
||||
let num = 0;
|
||||
for (const i in SimObjects) {
|
||||
Object.keys(SimObjects).forEach((i) => {
|
||||
if (SimObjects[i].name !== 'Cursor') num += SimObjects[i].amount;
|
||||
}
|
||||
});
|
||||
add *= num;
|
||||
mult *= SimGetTieredCpsMult(it);
|
||||
mult *= Game.magicCpS('Cursor');
|
||||
@@ -49,9 +49,9 @@ export default function InitialBuildingData(buildingName) {
|
||||
} else if (me.name === 'Grandma') {
|
||||
you.cps = function (it) {
|
||||
let mult = 1;
|
||||
for (const i in Game.GrandmaSynergies) {
|
||||
Object.keys(Game.GrandmaSynergies).forEach((i) => {
|
||||
if (SimHas(Game.GrandmaSynergies[i])) mult *= 2;
|
||||
}
|
||||
});
|
||||
if (SimHas('Bingo center/Research facility')) mult *= 4;
|
||||
if (SimHas('Ritual rolling pins')) mult *= 2;
|
||||
if (SimHas('Naughty list')) mult *= 2;
|
||||
@@ -75,9 +75,9 @@ export default function InitialBuildingData(buildingName) {
|
||||
if (SimHas('Elder Pact')) add += SimObjects.Portal.amount * 0.05;
|
||||
|
||||
let num = 0;
|
||||
for (const i in SimObjects) {
|
||||
Object.keys(SimObjects).forEach((i) => {
|
||||
if (SimObjects[i].name !== 'Grandma') num += SimObjects[i].amount;
|
||||
}
|
||||
});
|
||||
// if (Game.hasAura('Elder Battalion')) mult*=1+0.01*num;
|
||||
mult *= 1 + SimAuraMult('Elder Battalion') * 0.01 * num;
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@ import SimHas from './SimHas';
|
||||
*/
|
||||
export default function SimGetTieredCpsMult(me) {
|
||||
let mult = 1;
|
||||
for (const i in me.tieredUpgrades) {
|
||||
Object.keys(me.tieredUpgrades).forEach((i) => {
|
||||
if (
|
||||
!Game.Tiers[me.tieredUpgrades[i].tier].special &&
|
||||
SimHas(me.tieredUpgrades[i].name)
|
||||
)
|
||||
mult *= 2;
|
||||
}
|
||||
for (const i in me.synergies) {
|
||||
});
|
||||
Object.keys(me.synergies).forEach((i) => {
|
||||
if (SimHas(me.synergies[i].name)) {
|
||||
const syn = me.synergies[i];
|
||||
if (syn.buildingTie1.name === me.name)
|
||||
@@ -21,7 +21,7 @@ export default function SimGetTieredCpsMult(me) {
|
||||
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.grandma && SimHas(me.grandma.name))
|
||||
mult *= 1 + SimObjects.Grandma.amount * 0.01 * (1 / (me.id - 1));
|
||||
|
||||
@@ -8,26 +8,27 @@ import SimHasGod from './SimHasGod';
|
||||
* This function calculates the sell price of a building based on current "sim data"
|
||||
* @param {string} building Name of the building
|
||||
* @param {number} price Current price of building
|
||||
* @returns {number} price The modified building price
|
||||
* @returns {number} ModifiedPrice The modified building price
|
||||
*/
|
||||
export default function SimModifyBuildingPrice(building, price) {
|
||||
if (SimHas('Season savings')) price *= 0.99;
|
||||
if (SimHas("Santa's dominion")) price *= 0.99;
|
||||
if (SimHas('Faberge egg')) price *= 0.99;
|
||||
if (SimHas('Divine discount')) price *= 0.99;
|
||||
if (SimHas('Fortune #100')) price *= 0.99;
|
||||
// if (SimHasAura('Fierce Hoarder')) price *= 0.98;
|
||||
price *= 1 - SimAuraMult('Fierce Hoarder') * 0.02;
|
||||
if (Game.hasBuff('Everything must go')) price *= 0.95;
|
||||
if (Game.hasBuff('Crafty pixies')) price *= 0.98;
|
||||
if (Game.hasBuff('Nasty goblins')) price *= 1.02;
|
||||
if (building.fortune && SimHas(building.fortune.name)) price *= 0.93;
|
||||
price *= SimEff('buildingCost');
|
||||
let ModifiedPrice = price;
|
||||
if (SimHas('Season savings')) ModifiedPrice *= 0.99;
|
||||
if (SimHas("Santa's dominion")) ModifiedPrice *= 0.99;
|
||||
if (SimHas('Faberge egg')) ModifiedPrice *= 0.99;
|
||||
if (SimHas('Divine discount')) ModifiedPrice *= 0.99;
|
||||
if (SimHas('Fortune #100')) ModifiedPrice *= 0.99;
|
||||
// if (SimHasAura('Fierce Hoarder')) ModifiedPrice *= 0.98;
|
||||
ModifiedPrice *= 1 - SimAuraMult('Fierce Hoarder') * 0.02;
|
||||
if (Game.hasBuff('Everything must go')) ModifiedPrice *= 0.95;
|
||||
if (Game.hasBuff('Crafty pixies')) ModifiedPrice *= 0.98;
|
||||
if (Game.hasBuff('Nasty goblins')) ModifiedPrice *= 1.02;
|
||||
if (building.fortune && SimHas(building.fortune.name)) ModifiedPrice *= 0.93;
|
||||
ModifiedPrice *= SimEff('buildingCost');
|
||||
if (SimObjects.Temple.minigameLoaded) {
|
||||
const godLvl = SimHasGod('creation');
|
||||
if (godLvl === 1) price *= 0.93;
|
||||
else if (godLvl === 2) price *= 0.95;
|
||||
else if (godLvl === 3) price *= 0.98;
|
||||
if (godLvl === 1) ModifiedPrice *= 0.93;
|
||||
else if (godLvl === 2) ModifiedPrice *= 0.95;
|
||||
else if (godLvl === 3) ModifiedPrice *= 0.98;
|
||||
}
|
||||
return price;
|
||||
return ModifiedPrice;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export default function CopyData() {
|
||||
SimPrestige = Game.prestige;
|
||||
|
||||
// Buildings
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
const me = Game.Objects[i];
|
||||
let you = SimObjects[i];
|
||||
if (you === undefined) {
|
||||
@@ -61,10 +61,10 @@ export default function CopyData() {
|
||||
you.minigame = me.minigame;
|
||||
}
|
||||
SimObjects[i] = you;
|
||||
}
|
||||
});
|
||||
|
||||
// Upgrades
|
||||
for (const i of Object.keys(Game.Upgrades)) {
|
||||
Object.keys(Game.Upgrades).forEach((i) => {
|
||||
const me = Game.Upgrades[i];
|
||||
let you = SimUpgrades[i];
|
||||
if (you === undefined) {
|
||||
@@ -73,10 +73,10 @@ export default function CopyData() {
|
||||
}
|
||||
you.bought = me.bought;
|
||||
SimUpgrades[i] = you;
|
||||
}
|
||||
});
|
||||
|
||||
// Achievements
|
||||
for (const i of Object.keys(Game.Achievements)) {
|
||||
Object.keys(Game.Achievements).forEach((i) => {
|
||||
const me = Game.Achievements[i];
|
||||
let you = SimAchievements[i];
|
||||
if (you === undefined) {
|
||||
@@ -85,7 +85,7 @@ export default function CopyData() {
|
||||
}
|
||||
you.won = me.won;
|
||||
SimAchievements[i] = you;
|
||||
}
|
||||
});
|
||||
|
||||
// Auras
|
||||
CacheDragonAuras();
|
||||
|
||||
@@ -11,7 +11,7 @@ export default function SimWin(what) {
|
||||
if (SimAchievements[what]) {
|
||||
if (SimAchievements[what].won === 0) {
|
||||
SimAchievements[what].won = 1;
|
||||
if (Game.Achievements[what].pool !== 'shadow') SimAchievementsOwned++;
|
||||
if (Game.Achievements[what].pool !== 'shadow') SimAchievementsOwned += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,15 @@ export default function BuildingGetPrice(
|
||||
free,
|
||||
increase,
|
||||
) {
|
||||
let startingAmount = start;
|
||||
let moni = 0;
|
||||
for (let i = 0; i < increase; i++) {
|
||||
let price = basePrice * Game.priceIncrease ** Math.max(0, start - free);
|
||||
for (let i = 0; i < increase; i += 1) {
|
||||
let price =
|
||||
basePrice * Game.priceIncrease ** Math.max(0, startingAmount - free);
|
||||
price = Game.modifyBuildingPrice(build, price);
|
||||
price = Math.ceil(price);
|
||||
moni += price;
|
||||
start++;
|
||||
startingAmount += 1;
|
||||
}
|
||||
return moni;
|
||||
}
|
||||
|
||||
@@ -33,14 +33,14 @@ export default function BuyBuildingsBonusIncome(building, amount) {
|
||||
if (me.amount >= 700) SimWin('Gotta hand it to you');
|
||||
if (me.amount >= 800) SimWin("The devil's workshop");
|
||||
} else {
|
||||
for (const j in Game.Objects[me.name].tieredAchievs) {
|
||||
Object.keys(Game.Objects[me.name].tieredAchievs).forEach((j) => {
|
||||
if (
|
||||
me.amount >=
|
||||
Game.Tiers[Game.Objects[me.name].tieredAchievs[j].tier].achievUnlock
|
||||
) {
|
||||
SimWin(Game.Objects[me.name].tieredAchievs[j].name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const lastAchievementsOwned = SimAchievementsOwned;
|
||||
|
||||
@@ -34,9 +34,9 @@ function MouseCps() {
|
||||
if (SimHas('Octillion fingers')) add *= 20;
|
||||
if (SimHas('Nonillion fingers')) add *= 20;
|
||||
let num = 0;
|
||||
for (const i of Object.keys(SimObjects)) {
|
||||
Object.keys(SimObjects).forEach((i) => {
|
||||
num += SimObjects[i].amount;
|
||||
}
|
||||
});
|
||||
num -= SimObjects.Cursor.amount;
|
||||
add *= num;
|
||||
|
||||
@@ -83,10 +83,10 @@ function MouseCps() {
|
||||
}
|
||||
}
|
||||
|
||||
for (const i of Object.keys(Game.buffs)) {
|
||||
Object.keys(Game.buffs).forEach((i) => {
|
||||
if (typeof Game.buffs[i].multClick !== 'undefined')
|
||||
mult *= Game.buffs[i].multClick;
|
||||
}
|
||||
});
|
||||
|
||||
// if (CM.Sim.auraMult('Dragon Cursor')) mult*=1.05;
|
||||
mult *= 1 + SimAuraMult('Dragon Cursor') * 0.05;
|
||||
@@ -132,10 +132,10 @@ export default function BuyUpgradesBonusIncome(upgrade) {
|
||||
}
|
||||
const me = SimUpgrades[upgrade];
|
||||
if (Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool))
|
||||
SimUpgradesOwned++;
|
||||
SimUpgradesOwned += 1;
|
||||
|
||||
if (upgrade === 'Elder Pledge') {
|
||||
SimPledges++;
|
||||
SimPledges += 1;
|
||||
if (SimPledges > 0) SimWin('Elder nap');
|
||||
if (SimPledges >= 5) SimWin('Elder slumber');
|
||||
} else if (upgrade === 'Elder Covenant') {
|
||||
|
||||
@@ -22,21 +22,26 @@ export default function BuildingSell(
|
||||
) {
|
||||
// Calculate money gains from selling buildings
|
||||
// If noSim is set, use Game methods to compute price instead of Sim ones.
|
||||
noSim = typeof noSim === 'undefined' ? 0 : noSim;
|
||||
const noSimRes = typeof noSim === 'undefined' ? 0 : noSim;
|
||||
let toChange = amount;
|
||||
let startingAmount = start;
|
||||
let moni = 0;
|
||||
if (amount === -1) amount = start;
|
||||
if (!amount) amount = Game.buyBulk;
|
||||
for (let i = 0; i < amount; i++) {
|
||||
let price = basePrice * Game.priceIncrease ** Math.max(0, start - free);
|
||||
price = noSim
|
||||
if (amount === -1) toChange = startingAmount;
|
||||
if (!amount) toChange = Game.buyBulk;
|
||||
for (let i = 0; i < toChange; i++) {
|
||||
let price =
|
||||
basePrice * Game.priceIncrease ** Math.max(0, startingAmount - free);
|
||||
price = noSimRes
|
||||
? Game.modifyBuildingPrice(build, price)
|
||||
: SimModifyBuildingPrice(build, price);
|
||||
price = Math.ceil(price);
|
||||
const giveBack = noSim ? build.getSellMultiplier() : SimGetSellMultiplier();
|
||||
const giveBack = noSimRes
|
||||
? build.getSellMultiplier()
|
||||
: SimGetSellMultiplier();
|
||||
price = Math.floor(price * giveBack);
|
||||
if (start > 0) {
|
||||
if (startingAmount > 0) {
|
||||
moni += price;
|
||||
start--;
|
||||
startingAmount -= 1;
|
||||
}
|
||||
}
|
||||
return moni;
|
||||
|
||||
@@ -21,10 +21,10 @@ export default function SellBuildingsForChoEgg() {
|
||||
// Change auras to Earth Shatterer + Reality bending to optimize money made by selling
|
||||
let buildingsToSacrifice = 2;
|
||||
if (SimDragonAura === 5 || SimDragonAura === 18) {
|
||||
--buildingsToSacrifice;
|
||||
buildingsToSacrifice -= 1;
|
||||
}
|
||||
if (SimDragonAura2 === 5 || SimDragonAura2 === 18) {
|
||||
--buildingsToSacrifice;
|
||||
buildingsToSacrifice -= 1;
|
||||
}
|
||||
SimDragonAura = 5;
|
||||
SimDragonAura2 = 18;
|
||||
@@ -32,17 +32,17 @@ export default function SellBuildingsForChoEgg() {
|
||||
// Sacrifice highest buildings for the aura switch
|
||||
for (let i = 0; i < buildingsToSacrifice; ++i) {
|
||||
let highestBuilding = 'Cursor';
|
||||
for (const j in SimObjects) {
|
||||
Object.keys(SimObjects).forEach((j) => {
|
||||
if (SimObjects[j].amount > 0) {
|
||||
highestBuilding = j;
|
||||
}
|
||||
}
|
||||
SimObjects[highestBuilding].amount--;
|
||||
SimBuildingsOwned--;
|
||||
});
|
||||
SimObjects[highestBuilding].amount -= 1;
|
||||
SimBuildingsOwned -= 1;
|
||||
}
|
||||
|
||||
// Get money made by selling all remaining buildings
|
||||
for (const i of Object.keys(SimObjects)) {
|
||||
Object.keys(SimObjects).forEach((i) => {
|
||||
const me = SimObjects[i];
|
||||
sellTotal += BuildingSell(
|
||||
Game.Objects[me.name],
|
||||
@@ -51,7 +51,7 @@ export default function SellBuildingsForChoEgg() {
|
||||
Game.Objects[i].free,
|
||||
me.amount,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return sellTotal;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user