@@ -1,6 +0,0 @@
|
||||
CookieMonster.js
|
||||
CookieMonster.user.js
|
||||
src/*.js
|
||||
!src/CookieMonster.js
|
||||
!src/*/*
|
||||
dist/*
|
||||
15
.eslintrc.js
15
.eslintrc.js
@@ -9,19 +9,26 @@ module.exports = {
|
||||
b64_to_utf8: 'readonly',
|
||||
utf8_to_b64: 'readonly',
|
||||
BeautifyAll: 'readonly',
|
||||
PlaySound: 'readonly',
|
||||
},
|
||||
extends: ['airbnb-base', 'plugin:prettier/recommended'],
|
||||
parserOptions: {
|
||||
ecmaVersion: 12,
|
||||
},
|
||||
ignorePatterns: ['*CookieMonster*.js', 'dist/*', 'node_modules/*'],
|
||||
rules: {
|
||||
'import/no-mutable-exports': 'off',
|
||||
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
||||
'no-new-func': 'off',
|
||||
'func-names': 'off',
|
||||
'no-console': 'off',
|
||||
'no-alert': 'off',
|
||||
'no-restricted-globals': 'off',
|
||||
'prefer-destructuring': ['error', { object: true, array: false }],
|
||||
'max-len': [
|
||||
1,
|
||||
{
|
||||
code: 100,
|
||||
ignoreComments: true,
|
||||
ignoreStrings: true,
|
||||
ignoreTemplateLiterals: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"printWidth": 80
|
||||
"trailingComma": "all"
|
||||
}
|
||||
|
||||
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
1873
package-lock.json
generated
1873
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cookiemonster-mod",
|
||||
"version": "2.031.6",
|
||||
"version": "2.031.7",
|
||||
"description": "Cookie Monster is an add-on that you can load into Cookie Clicker which offers a wide range of tools and statistics to enhance the game. It is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want. This is a helper and everything is an option.",
|
||||
"main": "CookieMonster.js",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
||||
import {
|
||||
ChoEggDiff,
|
||||
@@ -50,6 +49,14 @@ export class CMAvgQueue {
|
||||
}
|
||||
return ret / time;
|
||||
}
|
||||
|
||||
calcSum(timePeriod) {
|
||||
let time = timePeriod;
|
||||
if (time > this.maxLength) time = this.maxLength;
|
||||
if (time > this.queue.length) time = this.queue.length;
|
||||
if (time === 0) return 0;
|
||||
return this.queue.slice(-time).reduce((a, b) => a + b, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,9 +64,9 @@ export class CMAvgQueue {
|
||||
* Called by CM.Cache.InitCache()
|
||||
*/
|
||||
export function InitCookiesDiff() {
|
||||
CookiesDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
||||
WrinkDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
||||
WrinkFattestDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
||||
ChoEggDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]);
|
||||
ClicksDiff = new CMAvgQueue(ClickTimes[ClickTimes.length - 1]);
|
||||
CookiesDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); // eslint-disable-line no-unused-vars
|
||||
WrinkDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); // eslint-disable-line no-unused-vars
|
||||
WrinkFattestDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); // eslint-disable-line no-unused-vars
|
||||
ChoEggDiff = new CMAvgQueue(CookieTimes[CookieTimes.length - 1]); // eslint-disable-line no-unused-vars
|
||||
ClicksDiff = new CMAvgQueue(ClickTimes[ClickTimes.length - 1]); // eslint-disable-line no-unused-vars
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
|
||||
import {
|
||||
@@ -41,7 +39,7 @@ export default function CacheAvgCPS() {
|
||||
if ((Game.T / Game.fps) % 1 === 0) {
|
||||
let choEggTotal = Game.cookies + CacheSellForChoEgg;
|
||||
if (Game.cpsSucked > 0) choEggTotal += CacheWrinklersTotal;
|
||||
CacheRealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal);
|
||||
CacheRealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal); // eslint-disable-line no-unused-vars
|
||||
choEggTotal *= 0.05;
|
||||
|
||||
// Add recent gains to AvgQueue's
|
||||
@@ -89,8 +87,9 @@ export default function CacheAvgCPS() {
|
||||
CacheAverageGainBank +
|
||||
CacheAverageGainWrink +
|
||||
(choEgg ? CacheAverageGainChoEgg : 0);
|
||||
} else CacheAvgCPSWithChoEgg = CacheAverageCPS;
|
||||
} else CacheAvgCPSWithChoEgg = CacheAverageCPS; // eslint-disable-line no-unused-vars
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
CacheAverageClicks = ClicksDiff.calcAverage(
|
||||
ClickTimes[CMOptions.AvgClicksHist],
|
||||
);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
import {
|
||||
CacheCurrWrinklerCount,
|
||||
@@ -23,8 +22,8 @@ export default function CacheCurrWrinklerCPS() {
|
||||
else if (godLvl === 2) godMult *= 1.1;
|
||||
else if (godLvl === 3) godMult *= 1.05;
|
||||
}
|
||||
CacheCurrWrinklerCount = count;
|
||||
CacheCurrWrinklerCPSMult =
|
||||
CacheCurrWrinklerCount = count; // eslint-disable-line no-unused-vars
|
||||
CacheCurrWrinklerCPSMult = // eslint-disable-line no-unused-vars
|
||||
count *
|
||||
(count * 0.05 * 1.1) *
|
||||
(Game.Has('Sacrilegious corruption') * 0.05 + 1) *
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import CalcNoGoldSwitchCPS from '../../Sim/Calculations/NoGoldenSwitchCalc';
|
||||
import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData';
|
||||
|
||||
@@ -10,5 +9,5 @@ import { CacheNoGoldSwitchCookiesPS } from '../VariablesAndData';
|
||||
export default function CacheNoGoldSwitchCPS() {
|
||||
if (Game.Has('Golden switch [off]')) {
|
||||
CacheNoGoldSwitchCookiesPS = CalcNoGoldSwitchCPS();
|
||||
} else CacheNoGoldSwitchCookiesPS = Game.cookiesPs;
|
||||
} else CacheNoGoldSwitchCookiesPS = Game.cookiesPs; // eslint-disable-line no-unused-vars
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import SellBuildingsForChoEgg from '../../Sim/SimulationEvents/SellBuildingForChoEgg';
|
||||
import { CacheSellForChoEgg } from '../VariablesAndData';
|
||||
|
||||
@@ -21,5 +20,5 @@ export default function CacheSellAllForChoEgg() {
|
||||
}
|
||||
// Compute cookies earned by selling all buildings with optimal auras (ES + RB)
|
||||
sellTotal += SellBuildingsForChoEgg();
|
||||
CacheSellForChoEgg = sellTotal;
|
||||
CacheSellForChoEgg = sellTotal; // eslint-disable-line no-unused-vars
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { ClickTimes } from '../Disp/VariablesAndData';
|
||||
import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue';
|
||||
import CacheAvgCPS from './CPS/CPS';
|
||||
import CacheDragonAuras from './Dragon/CacheDragonAuras';
|
||||
@@ -15,7 +15,10 @@ import {
|
||||
CacheGoldenAndWrathCookiesMults,
|
||||
CacheStatsCookies,
|
||||
} from './Stats/Stats';
|
||||
import { HeavenlyChipsDiff } from './VariablesAndData';
|
||||
import {
|
||||
CacheAverageCookiesFromClicks,
|
||||
HeavenlyChipsDiff,
|
||||
} from './VariablesAndData';
|
||||
import CacheWrinklers from './Wrinklers/Wrinklers';
|
||||
|
||||
/**
|
||||
@@ -30,7 +33,11 @@ export default function InitCache() {
|
||||
CacheAllMissingUpgrades();
|
||||
CacheSeasonSpec();
|
||||
InitCookiesDiff();
|
||||
HeavenlyChipsDiff = new CMAvgQueue(5); // Used by CM.Cache.CacheHeavenlyChipsPS()
|
||||
/** Used by CM.Cache.CacheHeavenlyChipsPS() */
|
||||
HeavenlyChipsDiff = new CMAvgQueue(5); // eslint-disable-line no-unused-vars
|
||||
CacheAverageCookiesFromClicks = new CMAvgQueue( // eslint-disable-line no-unused-vars
|
||||
ClickTimes[ClickTimes.length - 1] * 20,
|
||||
);
|
||||
CacheHeavenlyChipsPS();
|
||||
CacheAvgCPS();
|
||||
CacheIncome();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { FormatTime } from '../Disp/BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../Disp/HelperFunctions/GetCPS';
|
||||
import CacheAvgCPS from './CPS/CPS';
|
||||
@@ -27,5 +26,5 @@ export default function LoopCache() {
|
||||
1,
|
||||
) -
|
||||
(Game.cookiesEarned + Game.cookiesReset);
|
||||
CacheTimeTillNextPrestige = FormatTime(cookiesToNext / GetCPS());
|
||||
CacheTimeTillNextPrestige = FormatTime(cookiesToNext / GetCPS()); // eslint-disable-line no-unused-vars
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CacheDragonAura, CacheDragonAura2 } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This functions caches the currently selected Dragon Auras
|
||||
*/
|
||||
export default function CacheDragonAuras() {
|
||||
CacheDragonAura = Game.dragonAura;
|
||||
CacheDragonAura2 = Game.dragonAura2;
|
||||
CacheDragonAura = Game.dragonAura; // eslint-disable-line no-unused-vars
|
||||
CacheDragonAura2 = Game.dragonAura2; // eslint-disable-line no-unused-vars
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Functions related to the Dragon */
|
||||
|
||||
import { Beautify } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting';
|
||||
@@ -6,8 +5,6 @@ import CopyData from '../../Sim/SimulationData/CopyData';
|
||||
import { SimDoSims, SimObjects } from '../../Sim/VariablesAndData';
|
||||
import {
|
||||
CacheCostDragonUpgrade,
|
||||
CacheDragonAura,
|
||||
CacheDragonAura2,
|
||||
CacheLastDragonLevel,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
@@ -46,7 +43,7 @@ export default function CacheDragonCost() {
|
||||
cost += price;
|
||||
SimObjects[target].amount -= 1;
|
||||
}
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${cost}`;
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`;
|
||||
}
|
||||
} else {
|
||||
let cost = 0;
|
||||
@@ -70,7 +67,7 @@ export default function CacheDragonCost() {
|
||||
cost += price;
|
||||
SimObjects[target].amount -= 1;
|
||||
}
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`;
|
||||
CacheCostDragonUpgrade = `Cost to rebuy: ${Beautify(cost)}`; // eslint-disable-line no-unused-vars
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
|
||||
import { ColorGray } from '../../Disp/VariablesAndData';
|
||||
import { ColourGray } from '../../Disp/VariablesAndData';
|
||||
import {
|
||||
CacheMinPP,
|
||||
CacheObjects1,
|
||||
@@ -17,19 +15,20 @@ import ColourOfPP from './ColourOfPP';
|
||||
* It saves all date in CM.Cache.Objects...
|
||||
* It is called by CM.Cache.CacheBuildingsPP()
|
||||
*/
|
||||
function CacheColor(target, amount) {
|
||||
function CacheColour(target, amount) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
if (CMOptions.PPRigidelMode && amount === 1) {
|
||||
target[i].color = ColorGray;
|
||||
target[i].color = ColourGray; // eslint-disable-line no-param-reassign
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
target[i].color = ColourOfPP(
|
||||
target[i],
|
||||
Game.Objects[i].getSumPrice(amount),
|
||||
);
|
||||
// Colour based on excluding certain top-buildings
|
||||
for (let j = 0; j < CMOptions.PPExcludeTop; j++) {
|
||||
if (target[i].pp === CachePPArray[j][0]) target[i].color = ColorGray;
|
||||
if (target[i].pp === CachePPArray[j][0]) target[i].color = ColourGray; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -38,11 +37,11 @@ function CachePP(target, amount) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
const price = Game.Objects[i].getSumPrice(amount);
|
||||
if (Game.cookiesPs) {
|
||||
target[i].pp =
|
||||
target[i].pp = // eslint-disable-line no-param-reassign
|
||||
Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) /
|
||||
Game.cookiesPs +
|
||||
price / target[i].bonus;
|
||||
} else target[i].pp = price / target[i].bonus;
|
||||
} else target[i].pp = price / target[i].bonus; // eslint-disable-line no-param-reassign
|
||||
if (!(CMOptions.PPRigidelMode && amount === 1))
|
||||
CachePPArray.push([target[i].pp, amount]);
|
||||
});
|
||||
@@ -73,9 +72,9 @@ export default function CacheBuildingsPP() {
|
||||
}
|
||||
}
|
||||
}
|
||||
CacheMinPP = CachePPArray[CMOptions.PPExcludeTop][indexOfMin];
|
||||
CacheMinPP = CachePPArray[CMOptions.PPExcludeTop][indexOfMin]; // eslint-disable-line no-unused-vars
|
||||
|
||||
CacheColor(CacheObjects1, 1);
|
||||
CacheColor(CacheObjects10, 10);
|
||||
CacheColor(CacheObjects100, 100);
|
||||
CacheColour(CacheObjects1, 1);
|
||||
CacheColour(CacheObjects10, 10);
|
||||
CacheColour(CacheObjects100, 100);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetCPS from '../../Disp/HelperFunctions/GetCPS';
|
||||
import {
|
||||
ColorBlue,
|
||||
ColorGray,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
ColorRed,
|
||||
ColorYellow,
|
||||
ColourBlue,
|
||||
ColourGray,
|
||||
ColourGreen,
|
||||
ColourOrange,
|
||||
ColourPurple,
|
||||
ColourRed,
|
||||
ColourYellow,
|
||||
} from '../../Disp/VariablesAndData';
|
||||
import { CacheMinPP, CachePPArray } from '../VariablesAndData';
|
||||
|
||||
@@ -21,22 +21,22 @@ import { CacheMinPP, CachePPArray } from '../VariablesAndData';
|
||||
export default function ColourOfPP(me, price) {
|
||||
let color = '';
|
||||
// Colour based on PP
|
||||
if (me.pp <= 0 || me.pp === Infinity) color = ColorGray;
|
||||
else if (me.pp < CacheMinPP) color = ColorBlue;
|
||||
else if (me.pp === CacheMinPP) color = ColorGreen;
|
||||
else if (me.pp < CachePPArray[10][0]) color = ColorYellow;
|
||||
else if (me.pp < CachePPArray[20][0]) color = ColorOrange;
|
||||
else if (me.pp > CachePPArray[30][0]) color = ColorRed;
|
||||
else color = ColorPurple;
|
||||
if (me.pp <= 0 || me.pp === Infinity) color = ColourGray;
|
||||
else if (me.pp < CacheMinPP) color = ColourBlue;
|
||||
else if (me.pp === CacheMinPP) color = ColourGreen;
|
||||
else if (me.pp < CachePPArray[10][0]) color = ColourYellow;
|
||||
else if (me.pp < CachePPArray[20][0]) color = ColourOrange;
|
||||
else if (me.pp < CachePPArray[30][0]) color = ColourRed;
|
||||
else color = ColourPurple;
|
||||
|
||||
// Colour based on price in terms of CPS
|
||||
if (Number(CMOptions.PPSecondsLowerLimit) !== 0) {
|
||||
if (price / GetCPS() < Number(CMOptions.PPSecondsLowerLimit))
|
||||
color = ColorBlue;
|
||||
color = ColourBlue;
|
||||
}
|
||||
// Colour based on being able to purchase
|
||||
if (CMOptions.PPOnlyConsiderBuyable) {
|
||||
if (price - Game.cookies > 0) color = ColorRed;
|
||||
if (price - Game.cookies > 0) color = ColourRed;
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Section: Functions related to caching income */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import GetCPS from '../../Disp/HelperFunctions/GetCPS';
|
||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
||||
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
||||
import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades';
|
||||
import {
|
||||
CacheAverageCPS,
|
||||
CacheAverageGainBank,
|
||||
CacheAverageGainWrink,
|
||||
CacheAverageGainWrinkFattest,
|
||||
@@ -30,7 +27,7 @@ function CacheBuildingIncome(amount) {
|
||||
result[i] = {};
|
||||
result[i].bonus = BuyBuildingsBonusIncome(i, amount);
|
||||
if (amount !== 1) {
|
||||
CacheDoRemakeBuildPrices = 1;
|
||||
CacheDoRemakeBuildPrices = 1; // eslint-disable-line no-unused-vars
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import GetCPSBuffMult from '../CPS/GetCPSBuffMult';
|
||||
import {
|
||||
CacheChainFrenzyMaxReward,
|
||||
@@ -89,8 +88,8 @@ export function CacheChain() {
|
||||
maxPayout,
|
||||
CacheGoldenCookiesMult,
|
||||
);
|
||||
CacheChainRequired = (CacheChainMaxReward[1] * 2) / CacheGoldenCookiesMult;
|
||||
CacheChainRequiredNext =
|
||||
CacheChainRequired = (CacheChainMaxReward[1] * 2) / CacheGoldenCookiesMult; // eslint-disable-line no-unused-vars
|
||||
CacheChainRequiredNext = // eslint-disable-line no-unused-vars
|
||||
CacheChainMaxReward[2] / 60 / 60 / 6 / CacheDragonsFortuneMultAdjustment;
|
||||
|
||||
CacheChainWrathMaxReward = MaxChainCookieReward(
|
||||
@@ -98,9 +97,9 @@ export function CacheChain() {
|
||||
maxPayout,
|
||||
CacheWrathCookiesMult,
|
||||
);
|
||||
CacheChainWrathRequired =
|
||||
CacheChainWrathRequired = // eslint-disable-line no-unused-vars
|
||||
(CacheChainWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
|
||||
CacheChainWrathRequiredNext =
|
||||
CacheChainWrathRequiredNext = // eslint-disable-line no-unused-vars
|
||||
CacheChainWrathMaxReward[2] /
|
||||
60 /
|
||||
60 /
|
||||
@@ -112,9 +111,9 @@ export function CacheChain() {
|
||||
maxPayout * 7,
|
||||
CacheGoldenCookiesMult,
|
||||
);
|
||||
CacheChainFrenzyRequired =
|
||||
CacheChainFrenzyRequired = // eslint-disable-line no-unused-vars
|
||||
(CacheChainFrenzyMaxReward[1] * 2) / CacheGoldenCookiesMult;
|
||||
CacheChainFrenzyRequiredNext =
|
||||
CacheChainFrenzyRequiredNext = // eslint-disable-line no-unused-vars
|
||||
CacheChainFrenzyMaxReward[2] /
|
||||
60 /
|
||||
60 /
|
||||
@@ -126,9 +125,9 @@ export function CacheChain() {
|
||||
maxPayout * 7,
|
||||
CacheWrathCookiesMult,
|
||||
);
|
||||
CacheChainFrenzyWrathRequired =
|
||||
CacheChainFrenzyWrathRequired = // eslint-disable-line no-unused-vars
|
||||
(CacheChainFrenzyWrathMaxReward[1] * 2) / CacheWrathCookiesMult;
|
||||
CacheChainFrenzyWrathRequiredNext =
|
||||
CacheChainFrenzyWrathRequiredNext = // eslint-disable-line no-unused-vars
|
||||
CacheChainFrenzyWrathMaxReward[2] /
|
||||
60 /
|
||||
60 /
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import {
|
||||
CacheHCPerSecond,
|
||||
CacheLastHeavenlyCheck,
|
||||
@@ -34,6 +33,6 @@ export default function CacheHeavenlyChipsPS() {
|
||||
CacheLastHeavenlyChips = ascendNowToGet;
|
||||
|
||||
// Get average gain over period of 5 seconds
|
||||
CacheHCPerSecond = HeavenlyChipsDiff.calcAverage(5);
|
||||
CacheHCPerSecond = HeavenlyChipsDiff.calcAverage(5); // eslint-disable-line no-unused-vars
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { crateMissing } from '../../Disp/MenuSections/CreateMissingUpgrades';
|
||||
import { crateMissing } from '../../Disp/MenuSections/Statistics/CreateMissingUpgrades';
|
||||
import {
|
||||
CacheMissingUpgrades,
|
||||
CacheMissingUpgradesCookies,
|
||||
@@ -36,6 +35,7 @@ export default function CacheAllMissingUpgrades() {
|
||||
let str = '';
|
||||
|
||||
str += crateMissing(me);
|
||||
/* eslint-disable no-unused-vars */
|
||||
if (me.pool === 'prestige') CacheMissingUpgradesPrestige += str;
|
||||
else if (me.pool === 'cookie') CacheMissingUpgradesCookies += str;
|
||||
else if (
|
||||
@@ -44,6 +44,7 @@ export default function CacheAllMissingUpgrades() {
|
||||
me.pool !== 'debug'
|
||||
)
|
||||
CacheMissingUpgrades += str;
|
||||
/* eslint-enable no-unused-vars */
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CacheSeaSpec } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -12,6 +11,6 @@ export default function CacheSeasonSpec() {
|
||||
if (Game.hasBuff('Elder frenzy')) val *= 0.5;
|
||||
if (Game.hasBuff('Frenzy')) val *= 0.75;
|
||||
CacheSeaSpec = Math.max(25, val);
|
||||
if (Game.Has('Ho ho ho-flavored frosting')) CacheSeaSpec *= 2;
|
||||
if (Game.Has('Ho ho ho-flavored frosting')) CacheSeaSpec *= 2; // eslint-disable-line no-unused-vars
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Functions related to Caching stats */
|
||||
|
||||
import SimHas from '../../Sim/ReplacedGameFunctions/SimHas';
|
||||
@@ -29,15 +28,15 @@ export function CacheStatsCookies() {
|
||||
const cpsBuffMult = GetCPSBuffMult();
|
||||
if (cpsBuffMult > 0) CacheLucky /= cpsBuffMult;
|
||||
else CacheLucky = 0;
|
||||
CacheLuckyReward = CacheGoldenCookiesMult * (CacheLucky * 0.15) + 13;
|
||||
CacheLuckyWrathReward = CacheWrathCookiesMult * (CacheLucky * 0.15) + 13;
|
||||
CacheLuckyReward = CacheGoldenCookiesMult * (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;
|
||||
CacheLuckyRewardFrenzy =
|
||||
CacheLuckyRewardFrenzy = // eslint-disable-line no-unused-vars
|
||||
CacheGoldenCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
|
||||
CacheLuckyWrathRewardFrenzy =
|
||||
CacheLuckyWrathRewardFrenzy = // eslint-disable-line no-unused-vars
|
||||
CacheWrathCookiesMult * (CacheLuckyFrenzy * 0.15) + 13;
|
||||
CacheConjure = CacheLucky * 2;
|
||||
CacheConjureReward = CacheConjure * 0.15;
|
||||
CacheConjureReward = CacheConjure * 0.15; // eslint-disable-line no-unused-vars
|
||||
|
||||
CacheEdifice = 0;
|
||||
let max = 0;
|
||||
@@ -53,7 +52,7 @@ export function CacheStatsCookies() {
|
||||
Game.Objects[i].price * 2 > CacheEdifice
|
||||
) {
|
||||
CacheEdifice = Game.Objects[i].price * 2;
|
||||
CacheEdificeBuilding = i;
|
||||
CacheEdificeBuilding = i; // eslint-disable-line no-unused-vars
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ export let CacheCurrWrinklerCount = 0;
|
||||
export let CacheUpgrades = {};
|
||||
|
||||
export let CacheAverageClicks = {};
|
||||
export let CacheAverageCookiesFromClicks;
|
||||
|
||||
export let CacheMissingUpgrades = {};
|
||||
export let CacheMissingUpgradesPrestige = {};
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Caches data related to Wrinklers */
|
||||
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
@@ -32,9 +31,9 @@ export default function CacheWrinklers() {
|
||||
else if (godLvl === 2) sucked *= 1.1;
|
||||
else if (godLvl === 3) sucked *= 1.05;
|
||||
}
|
||||
CacheWrinklersTotal += sucked;
|
||||
CacheWrinklersTotal += sucked; // eslint-disable-line no-unused-vars
|
||||
if (Game.wrinklers[i].type === 0) {
|
||||
CacheWrinklersNormal += sucked;
|
||||
CacheWrinklersNormal += sucked; // eslint-disable-line no-unused-vars
|
||||
if (sucked > CacheWrinklersFattest[0])
|
||||
CacheWrinklersFattest = [sucked, i];
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ function CheckNotificationPermissions(ToggleOnOff) {
|
||||
|
||||
// Check if the browser supports notifications and which type
|
||||
if (!('Notification' in window)) {
|
||||
console.log('This browser does not support notifications.');
|
||||
console.log('This browser does not support notifications.'); // eslint-disable-line no-console
|
||||
} else if (checkNotificationPromise()) {
|
||||
Notification.requestPermission().then();
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,8 @@ import ConfigDefault from '../../Data/SettingsDefault';
|
||||
import ConfigData from '../../Data/SettingsData';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
import save from '../../InitSaveLoad/save';
|
||||
import CMLoop from '../../Main/Loop';
|
||||
import CMLoopHook from '../../Main/LoopHook';
|
||||
import UpdateColours from '../../Disp/HelperFunctions/UpdateColours';
|
||||
|
||||
/** Functions related to saving, loading and restoring all settings */
|
||||
|
||||
@@ -41,25 +42,19 @@ export function LoadConfig(settings) {
|
||||
if (settings !== undefined) {
|
||||
CMOptions = settings;
|
||||
|
||||
if (typeof CMOptions.Colors !== 'undefined') {
|
||||
delete CMOptions.Colors;
|
||||
}
|
||||
if (typeof CMOptions.Colours !== 'undefined') {
|
||||
delete CMOptions.Colours;
|
||||
}
|
||||
|
||||
// Check values
|
||||
let mod = false;
|
||||
Object.keys(ConfigDefault).forEach((i) => {
|
||||
if (typeof CMOptions[i] === 'undefined') {
|
||||
mod = true;
|
||||
CMOptions[i] = ConfigDefault[i];
|
||||
} else if (i !== 'Header' && i !== 'Colors') {
|
||||
if (i.indexOf('SoundURL') === -1) {
|
||||
if (
|
||||
!(CMOptions[i] > -1 && CMOptions[i] < ConfigData[i].label.length)
|
||||
) {
|
||||
mod = true;
|
||||
CMOptions[i] = ConfigDefault[i];
|
||||
}
|
||||
} else if (typeof CMOptions[i] !== 'string') {
|
||||
// Sound URLs
|
||||
mod = true;
|
||||
CMOptions[i] = ConfigDefault[i];
|
||||
}
|
||||
} else if (i === 'Header') {
|
||||
Object.keys(ConfigDefault.Header).forEach((j) => {
|
||||
if (
|
||||
@@ -70,21 +65,10 @@ export function LoadConfig(settings) {
|
||||
CMOptions[i][j] = ConfigDefault[i][j];
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Colors
|
||||
Object.keys(ConfigDefault.Colors).forEach((j) => {
|
||||
if (
|
||||
typeof CMOptions[i][j] === 'undefined' ||
|
||||
typeof CMOptions[i][j] !== 'string'
|
||||
) {
|
||||
mod = true;
|
||||
CMOptions[i][j] = ConfigDefault[i][j];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (mod) SaveConfig();
|
||||
CMLoop(); // Do loop once
|
||||
CMLoopHook(); // Do loop once
|
||||
Object.keys(ConfigDefault).forEach((i) => {
|
||||
if (i !== 'Header' && typeof ConfigData[i].func !== 'undefined') {
|
||||
ConfigData[i].func();
|
||||
@@ -94,4 +78,6 @@ export function LoadConfig(settings) {
|
||||
// Default values
|
||||
LoadConfig(ConfigDefault);
|
||||
}
|
||||
Game.UpdateMenu();
|
||||
UpdateColours();
|
||||
}
|
||||
|
||||
13
src/Config/Toggles/ToggleFavourites.js
Normal file
13
src/Config/Toggles/ToggleFavourites.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { FavouriteSettings } from '../../Disp/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function toggles whether a setting is part of the favourites section in setting or not
|
||||
* @param {string} config The name of the toggleable config option
|
||||
*/
|
||||
export default function ToggleFavouriteSetting(config) {
|
||||
if (FavouriteSettings.includes(config))
|
||||
FavouriteSettings = FavouriteSettings.filter(function (ele) {
|
||||
return ele !== config;
|
||||
});
|
||||
else FavouriteSettings.push(config);
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-return-assign */
|
||||
import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
|
||||
import { GCTimers } from '../../Disp/VariablesAndData';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
@@ -15,6 +14,7 @@ export default function ToggleGCTimer() {
|
||||
GCTimers[i].style.top = CacheGoldenShimmersByID[i].l.style.top;
|
||||
});
|
||||
} else {
|
||||
// eslint-disable-next-line no-return-assign
|
||||
Object.keys(GCTimers).forEach((i) => (GCTimers[i].style.display = 'none'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import UpdateUpgrades from '../../Disp/BuildingsUpgrades/Upgrades';
|
||||
import { CMOptions } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* Section: Functions related to the Upgrade Bar
|
||||
|
||||
/**
|
||||
* This function toggles the upgrade bar and the colours of upgrades
|
||||
* It is called by a change in CM.Options.UpBarColor
|
||||
@@ -5,7 +5,7 @@ import { CMOptions } from '../VariablesAndData';
|
||||
* It is called by changes in CM.Options.WrinklerButtons
|
||||
*/
|
||||
export default function ToggleWrinklerButtons() {
|
||||
if (CMOptions.WrinklerButtons) {
|
||||
if (CMOptions.WrinklerButtons && Game.elderWrath) {
|
||||
l('PopAllNormalWrinklerButton').style.display = '';
|
||||
l('PopFattestWrinklerButton').style.display = '';
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
/* eslint-disable prefer-const */
|
||||
|
||||
export let CMOptions = {};
|
||||
export let CMOptions = {}; // eslint-disable-line prefer-const
|
||||
export const ConfigPrefix = 'CMConfig';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import init from './InitSaveLoad/init';
|
||||
import load from './InitSaveLoad/load';
|
||||
import save from './InitSaveLoad/save';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** Data related directly to Cookie Monster */
|
||||
|
||||
export const VersionMajor = '2.031';
|
||||
export const VersionMinor = '6';
|
||||
export const VersionMinor = '7';
|
||||
|
||||
/** Information about Cookie Monster to be displayed in the info section */
|
||||
export const ModDescription = `<div class="listing">
|
||||
@@ -15,28 +15,25 @@ export const ModDescription = `<div class="listing">
|
||||
|
||||
/** Latest releasenotes of Cookie Monster to be displayed in the info section */
|
||||
export const LatestReleaseNotes = `<div class="listing">
|
||||
The latest update (v 2.031.6) has revamped the way PP is colourcoded. In the previous versions this was not always correct and we had some settings that made it even more incorrect. With this update Cookie Monster compares the PP of a building to all other possibilities (also buying 10 or 100) of a building and colors the PP accordingly.</br>
|
||||
This means that if it is better to buy 10 of a building immediately rather than to buy in increments of 1 Cookie Monster will now show this! In this case the buy 1 option will be yellow, while the buy 10 option will be green.</br>
|
||||
This also means that you will see some more diverse colors. Rather than coloring according to arbitrary "middle values" Cookie Monster now uses a top 10, 20 and 30. While this might take some getting used to we believe the new system is much better in conveying useful information to the user while also being more correct!</br>
|
||||
These are the release notes for the latest update (v 2.031.7).</br>
|
||||
</br>
|
||||
This update also implements the following functions:</br>
|
||||
- Added a tooltip displaying the reward to the extra pop wrinkler buttons</br>
|
||||
- Added tooltips to the Gods in the Pantheon</br>
|
||||
- The tooltip for Elder Pledge now displays correctly, although it takes some time to load after Cookie Monster has been loaded</br>
|
||||
- You can now test the volume and sound of notifications in the settings screen</br>
|
||||
- The bottom bar will now flicker less and each column has received a bit of padding</br>
|
||||
- Introduced new colour scheme for PP, see the explanation of colors in the Readme or the settings</br>
|
||||
- Added option to show buttons that can hide the upgrade and building section</br>
|
||||
- Added option to display PP as a time unit, note that these are only approximations. PP does not translate directly into time (the name is deceptive, we know...)</br>
|
||||
- Statistics page now shows chance for random drops when they have not been achieved</br>
|
||||
- In a later hotfix we have added a Rigidel mode that will colour all buy 1 options grey</br>
|
||||
This update implements the following functions:</br>
|
||||
- Updated the ordering and description of all settings of Cookie Monster</br>
|
||||
- Colours of Flash notifications can now be set by the user</br>
|
||||
- You can now select a number of settings to be your 'favourite'. They will be displayed at the top of all other settings in a new section. This functionality is toggleable and you can find it in the miscellaneous section</br>
|
||||
- The statistics page now shows cookies earned by clicking for a selected time period</br>
|
||||
- The statistics page can now show missing normal achievements, this can be toggled in the settings</br>
|
||||
</br>
|
||||
This update fixes the following bugs:</br>
|
||||
- Incorrect amount for "required for max plant reward" in statistics page</br>
|
||||
- Fixed the tooltips of the '?' buttons in the statistics page not showing</br>
|
||||
- Fixed some unclear settings descriptions </br>
|
||||
</br>
|
||||
Please submit any bug reports or feature requests to the <a href="https://github.com/Aktanusa/CookieMonster">GitHub page!</a>
|
||||
</br>
|
||||
- Fixed some typo's</br>
|
||||
- No longer show the wrinkler pop buttons when wrinklers can't spawn</br>
|
||||
- Fixed incorrect calculation of plant maturity for relevant tooltips</br>
|
||||
- Fixed edit prompts not working in settings</br>
|
||||
- Fixed red and purple being switched around for PP colour coding</br>
|
||||
- Fixed incorrect notation of numbers in Dragon tooltip and interface</br>
|
||||
- Fixed incorrect calculation of changing Dragon aura cost</br>
|
||||
- Fixed incorrect calculation of changing Pantheon gods effect</br>
|
||||
- Fixed fluctuating PP values when god Cyclius was selected</br>
|
||||
- Fixed black flickering when Golden Cookies or buffs start</br>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
/** Display titles of the headers of the Cookie Monster settings section */
|
||||
export const ConfigGroups = {
|
||||
BarsColors: 'Bars/Colors',
|
||||
Favourite: 'Favourite Settings',
|
||||
Calculation: 'Calculation',
|
||||
Notification: 'Notification',
|
||||
Tooltip: 'Tooltips and additional insights',
|
||||
Statistics: 'Statistics',
|
||||
Notation: 'Notation',
|
||||
Colours: 'Colours and colour coding',
|
||||
BarsDisplay: 'Infobars and visual settings',
|
||||
Tooltip: 'Tooltips',
|
||||
Statistics: 'Statistics',
|
||||
Notification: 'Notifications',
|
||||
Miscellaneous: 'Miscellaneous',
|
||||
};
|
||||
|
||||
|
||||
@@ -23,10 +23,9 @@ export class SettingStandard extends Setting {
|
||||
}
|
||||
/** The colour picker setting class */
|
||||
export class SettingColours extends Setting {
|
||||
constructor(type, group, desc, func) {
|
||||
constructor(type, group, desc) {
|
||||
super(type, group);
|
||||
this.desc = desc;
|
||||
this.func = func;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,63 +1,44 @@
|
||||
/** This array describes all default settings */
|
||||
const ConfigDefault = {
|
||||
CPSMode: 1,
|
||||
AvgCPSHist: 3,
|
||||
AvgClicksHist: 0,
|
||||
CalcWrink: 0,
|
||||
Scale: 2,
|
||||
ScaleDecimals: 2,
|
||||
ScaleSeparator: 0,
|
||||
ScaleCutoff: 999999,
|
||||
TimeFormat: 0,
|
||||
DetailedTime: 1,
|
||||
PPDisplayTime: 0,
|
||||
BuildColour: 1,
|
||||
PPOnlyConsiderBuyable: 0,
|
||||
PPExcludeTop: 0,
|
||||
PPRigidelMode: 0,
|
||||
PPSecondsLowerLimit: 0,
|
||||
ColourBlue: '#4bb8f0',
|
||||
ColourGreen: '#00ff00',
|
||||
ColourYellow: '#ffff00',
|
||||
ColourOrange: '#ff7f00',
|
||||
ColourRed: '#ff0000',
|
||||
ColourPurple: '#ff00ff',
|
||||
ColourGray: '#b3b3b3',
|
||||
ColourPink: '#ff1493',
|
||||
ColourBrown: '#8b4513',
|
||||
BotBar: 1,
|
||||
TimerBar: 1,
|
||||
TimerBarPos: 0,
|
||||
TimerBarOverlay: 2,
|
||||
BuildColor: 1,
|
||||
PPDisplayTime: 0,
|
||||
UpBarColor: 1,
|
||||
UpBarColour: 1,
|
||||
UpgradeBarFixedPos: 1,
|
||||
CalcWrink: 0,
|
||||
CPSMode: 1,
|
||||
AvgCPSHist: 3,
|
||||
AvgClicksHist: 0,
|
||||
PPExcludeTop: 0,
|
||||
PPRigidelMode: 0,
|
||||
PPSecondsLowerLimit: 0,
|
||||
PPOnlyConsiderBuyable: 0,
|
||||
ToolWarnBon: 1,
|
||||
Title: 1,
|
||||
GeneralSound: 1,
|
||||
GCNotification: 0,
|
||||
GCFlash: 1,
|
||||
GCSound: 1,
|
||||
GCVolume: 100,
|
||||
GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3',
|
||||
FortuneNotification: 0,
|
||||
FortuneFlash: 1,
|
||||
FortuneSound: 1,
|
||||
FortuneVolume: 100,
|
||||
FortuneSoundURL:
|
||||
'https://freesound.org/data/previews/174/174027_3242494-lq.mp3',
|
||||
SeaNotification: 0,
|
||||
SeaFlash: 1,
|
||||
SeaSound: 1,
|
||||
SeaVolume: 100,
|
||||
SeaSoundURL:
|
||||
'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
||||
GardFlash: 1,
|
||||
GardSound: 1,
|
||||
GardVolume: 100,
|
||||
GardSoundURL: 'https://freesound.org/data/previews/103/103046_861714-lq.mp3',
|
||||
MagicNotification: 0,
|
||||
MagicFlash: 1,
|
||||
MagicSound: 1,
|
||||
MagicVolume: 100,
|
||||
MagicSoundURL:
|
||||
'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
|
||||
WrinklerNotification: 0,
|
||||
WrinklerFlash: 1,
|
||||
WrinklerSound: 1,
|
||||
WrinklerVolume: 100,
|
||||
WrinklerSoundURL:
|
||||
'https://freesound.org/data/previews/124/124186_8043-lq.mp3',
|
||||
WrinklerMaxNotification: 0,
|
||||
WrinklerMaxFlash: 1,
|
||||
WrinklerMaxSound: 1,
|
||||
WrinklerMaxVolume: 100,
|
||||
WrinklerMaxSoundURL:
|
||||
'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
|
||||
SortBuildings: 0,
|
||||
SortUpgrades: 0,
|
||||
DragonAuraInfo: 1,
|
||||
GrimoireBar: 1,
|
||||
GCTimer: 1,
|
||||
Favicon: 1,
|
||||
WrinklerButtons: 1,
|
||||
HideSectionsButtons: 0,
|
||||
TooltipBuildUpgrade: 1,
|
||||
TooltipAmor: 0,
|
||||
ToolWarnLucky: 1,
|
||||
@@ -66,47 +47,78 @@ const ConfigDefault = {
|
||||
ToolWarnConjureFrenzy: 1,
|
||||
ToolWarnEdifice: 1,
|
||||
ToolWarnUser: 0,
|
||||
ToolWarnBon: 1,
|
||||
ToolWarnPos: 1,
|
||||
TooltipGrim: 1,
|
||||
TooltipWrink: 1,
|
||||
TooltipLump: 1,
|
||||
TooltipPlots: 1,
|
||||
TooltipPantheon: 1,
|
||||
DragonAuraInfo: 1,
|
||||
TooltipAscendButton: 1,
|
||||
Stats: 1,
|
||||
MissingUpgrades: 1,
|
||||
MissingAchievements: 0,
|
||||
UpStats: 1,
|
||||
TimeFormat: 0,
|
||||
DetailedTime: 1,
|
||||
GrimoireBar: 1,
|
||||
HeavenlyChipsTarget: 1,
|
||||
ShowMissedGC: 1,
|
||||
Scale: 2,
|
||||
ScaleDecimals: 2,
|
||||
ScaleSeparator: 0,
|
||||
ScaleCutoff: 999999,
|
||||
Colors: {
|
||||
Blue: '#4bb8f0',
|
||||
Green: '#00ff00',
|
||||
Yellow: '#ffff00',
|
||||
Orange: '#ff7f00',
|
||||
Red: '#ff0000',
|
||||
Purple: '#ff00ff',
|
||||
Gray: '#b3b3b3',
|
||||
Pink: '#ff1493',
|
||||
Brown: '#8b4513',
|
||||
},
|
||||
SortBuildings: 0,
|
||||
SortUpgrades: 0,
|
||||
GCTimer: 1,
|
||||
Favicon: 1,
|
||||
WrinklerButtons: 1,
|
||||
HideSectionsButtons: 0,
|
||||
Title: 1,
|
||||
GeneralSound: 1,
|
||||
GCNotification: 0,
|
||||
GCFlash: 1,
|
||||
ColourGCFlash: '#ffffff',
|
||||
GCSound: 1,
|
||||
GCVolume: 100,
|
||||
GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3',
|
||||
FortuneNotification: 0,
|
||||
FortuneFlash: 1,
|
||||
ColourFortuneFlash: '#ffffff',
|
||||
FortuneSound: 1,
|
||||
FortuneVolume: 100,
|
||||
FortuneSoundURL:
|
||||
'https://freesound.org/data/previews/174/174027_3242494-lq.mp3',
|
||||
SeaNotification: 0,
|
||||
SeaFlash: 1,
|
||||
ColourSeaFlash: '#ffffff',
|
||||
SeaSound: 1,
|
||||
SeaVolume: 100,
|
||||
SeaSoundURL:
|
||||
'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
||||
GardFlash: 1,
|
||||
ColourGardFlash: '#ffffff',
|
||||
GardSound: 1,
|
||||
GardVolume: 100,
|
||||
GardSoundURL: 'https://freesound.org/data/previews/103/103046_861714-lq.mp3',
|
||||
MagicNotification: 0,
|
||||
MagicFlash: 1,
|
||||
ColourMagicFlash: '#ffffff',
|
||||
MagicSound: 1,
|
||||
MagicVolume: 100,
|
||||
MagicSoundURL:
|
||||
'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
|
||||
WrinklerNotification: 0,
|
||||
WrinklerFlash: 1,
|
||||
ColourWrinklerFlash: '#ffffff',
|
||||
WrinklerSound: 1,
|
||||
WrinklerVolume: 100,
|
||||
WrinklerSoundURL:
|
||||
'https://freesound.org/data/previews/124/124186_8043-lq.mp3',
|
||||
WrinklerMaxNotification: 0,
|
||||
WrinklerMaxFlash: 1,
|
||||
ColourWrinklerMaxFlash: '#ffffff',
|
||||
WrinklerMaxSound: 1,
|
||||
WrinklerMaxVolume: 100,
|
||||
WrinklerMaxSoundURL:
|
||||
'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
|
||||
BulkBuyBlock: 0,
|
||||
FavouriteSettings: 1,
|
||||
Header: {
|
||||
BarsColors: 1,
|
||||
Favourite: 1,
|
||||
Calculation: 1,
|
||||
Notation: 1,
|
||||
Colours: 1,
|
||||
BarsDisplay: 1,
|
||||
Tooltip: 1,
|
||||
Statistics: 1,
|
||||
Notification: 1,
|
||||
NotificationGeneral: 1,
|
||||
NotificationGC: 1,
|
||||
@@ -116,9 +128,6 @@ const ConfigDefault = {
|
||||
NotificationMagi: 1,
|
||||
NotificationWrink: 1,
|
||||
NotificationWrinkMax: 1,
|
||||
Tooltip: 1,
|
||||
Statistics: 1,
|
||||
Notation: 1,
|
||||
Miscellaneous: 1,
|
||||
Lucky: 1,
|
||||
Chain: 1,
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
/** General functions to format or beautify strings */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { metric, shortScale, shortScaleAbbreviated } from '../../Data/Scales';
|
||||
import { BackupFunctions } from '../../Main/VariablesAndData';
|
||||
import {
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorRed,
|
||||
ColorYellow,
|
||||
ColourGreen,
|
||||
ColourOrange,
|
||||
ColourRed,
|
||||
ColourYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -30,6 +29,9 @@ export function Beautify(num, floats, forced) {
|
||||
return BackupFunctions.Beautify(num, floats);
|
||||
}
|
||||
if (Number.isFinite(num)) {
|
||||
if (num < 0) {
|
||||
return `-${Beautify(Math.abs(num))}`;
|
||||
}
|
||||
let answer = '';
|
||||
if (num === 0) {
|
||||
return num.toString();
|
||||
@@ -75,6 +77,7 @@ export function Beautify(num, floats, forced) {
|
||||
}
|
||||
}
|
||||
if (answer === '') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(
|
||||
`Could not beautify number with Cookie Monster Beautify: ${num}`,
|
||||
);
|
||||
@@ -83,7 +86,7 @@ export function Beautify(num, floats, forced) {
|
||||
if (CMOptions.ScaleSeparator) answer = answer.replace('.', ',');
|
||||
return answer;
|
||||
}
|
||||
console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`);
|
||||
console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`); // eslint-disable-line no-console
|
||||
return BackupFunctions.Beautify(num, floats);
|
||||
}
|
||||
|
||||
@@ -116,15 +119,15 @@ export function FormatTime(time, longFormat) {
|
||||
return longFormat ? 'Over 9000 days!' : '>9000d';
|
||||
str +=
|
||||
y > 0
|
||||
? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, `
|
||||
? `${y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y')}, ` // eslint-disable-line no-nested-ternary
|
||||
: '';
|
||||
str +=
|
||||
d > 0 ? `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, ` : '';
|
||||
d > 0 ? `${d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd')}, ` : ''; // eslint-disable-line no-nested-ternary
|
||||
if (str.length > 0 || h > 0)
|
||||
str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `;
|
||||
str += `${h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h')}, `; // eslint-disable-line no-nested-ternary
|
||||
if (str.length > 0 || m > 0)
|
||||
str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `;
|
||||
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's');
|
||||
str += `${m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm')}, `; // eslint-disable-line no-nested-ternary
|
||||
str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's'); // eslint-disable-line no-nested-ternary
|
||||
}
|
||||
return str;
|
||||
}
|
||||
@@ -134,18 +137,18 @@ export function FormatTime(time, longFormat) {
|
||||
* @param {number} time Time to be coloured
|
||||
* @returns {{string, string}} {text, color} Both the formatted time and color as strings in an array
|
||||
*/
|
||||
export function GetTimeColor(time) {
|
||||
export function GetTimeColour(time) {
|
||||
let color;
|
||||
let text;
|
||||
if (time <= 0) {
|
||||
if (CMOptions.TimeFormat) text = '00:00:00:00:00';
|
||||
else text = 'Done!';
|
||||
color = ColorGreen;
|
||||
color = ColourGreen;
|
||||
} else {
|
||||
text = FormatTime(time);
|
||||
if (time > 300) color = ColorRed;
|
||||
else if (time > 60) color = ColorOrange;
|
||||
else color = ColorYellow;
|
||||
if (time > 300) color = ColourRed;
|
||||
else if (time > 60) color = ColourOrange;
|
||||
else color = ColourYellow;
|
||||
}
|
||||
return { text, color };
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
import {
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
@@ -7,7 +6,7 @@ import {
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
|
||||
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import { Colors, LastTargetBuildings } from '../VariablesAndData';
|
||||
import { ColoursOrdering, LastTargetBuildings } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* Section: Functions related to right column of the screen (buildings/upgrades)
|
||||
@@ -15,8 +14,8 @@ import { Colors, LastTargetBuildings } from '../VariablesAndData';
|
||||
/**
|
||||
* This function adjusts some things in the column of buildings.
|
||||
* It colours them, helps display the correct sell-price and shuffles the order when CM.Options.SortBuildings is set
|
||||
* The function is called by CM.Disp.Draw(), CM.Disp.UpdateColors() & CM.Disp.RefreshScale()
|
||||
* And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.Data.Config.BulkBuildColor
|
||||
* The function is called by CM.Disp.Draw(), CM.Disp.UpdateColours() & CM.Disp.RefreshScale()
|
||||
* And by changes in CM.Options.BuildColour, CM.Options.SortBuild & CM.Data.Config.BulkBuildColour
|
||||
*/
|
||||
export default function UpdateBuildings() {
|
||||
let target = Game.buyBulk;
|
||||
@@ -30,10 +29,10 @@ export default function UpdateBuildings() {
|
||||
else if (target === 100) target = CacheObjects100;
|
||||
|
||||
if (Game.buyMode === 1) {
|
||||
if (CMOptions.BuildColor === 1) {
|
||||
if (CMOptions.BuildColour === 1) {
|
||||
Object.keys(target).forEach((i) => {
|
||||
l(`productPrice${Game.Objects[i].id}`).style.color =
|
||||
CMOptions.Colors[target[i].color];
|
||||
CMOptions[`Colour${target[i].color}`];
|
||||
});
|
||||
} else {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
@@ -72,9 +71,10 @@ export default function UpdateBuildings() {
|
||||
});
|
||||
|
||||
arr.sort(function (a, b) {
|
||||
return Colors.indexOf(a.color) > Colors.indexOf(b.color)
|
||||
return ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
|
||||
ColoursOrdering.indexOf(b.color)
|
||||
? 1
|
||||
: Colors.indexOf(a.color) < Colors.indexOf(b.color)
|
||||
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
|
||||
? -1
|
||||
: a.pp < b.pp
|
||||
? -1
|
||||
@@ -89,9 +89,10 @@ export default function UpdateBuildings() {
|
||||
});
|
||||
|
||||
arr.sort(function (a, b) {
|
||||
return Colors.indexOf(a.color) > Colors.indexOf(b.color)
|
||||
return ColoursOrdering.indexOf(a.color) > // eslint-disable-line no-nested-ternary
|
||||
ColoursOrdering.indexOf(b.color)
|
||||
? 1
|
||||
: Colors.indexOf(a.color) < Colors.indexOf(b.color)
|
||||
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
|
||||
? -1
|
||||
: a.pp < b.pp
|
||||
? -1
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import {
|
||||
ColorBackPre,
|
||||
ColorBlue,
|
||||
ColorGray,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
ColorRed,
|
||||
ColorTextPre,
|
||||
ColorYellow,
|
||||
ColourBackPre,
|
||||
ColourBlue,
|
||||
ColourGray,
|
||||
ColourGreen,
|
||||
ColourOrange,
|
||||
ColourPurple,
|
||||
ColourRed,
|
||||
ColourTextPre,
|
||||
ColourYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -28,7 +28,7 @@ function CreateUpgradeBarLegend() {
|
||||
const div = document.createElement('div');
|
||||
div.style.verticalAlign = 'middle';
|
||||
const span = document.createElement('span');
|
||||
span.className = ColorBackPre + color;
|
||||
span.className = ColourBackPre + color;
|
||||
span.style.display = 'inline-block';
|
||||
span.style.height = '10px';
|
||||
span.style.width = '10px';
|
||||
@@ -39,24 +39,24 @@ function CreateUpgradeBarLegend() {
|
||||
};
|
||||
|
||||
legend.appendChild(
|
||||
legendLine(ColorBlue, 'Better than the best PP of a building option'),
|
||||
legendLine(ColourBlue, 'Better than the best PP of a building option'),
|
||||
);
|
||||
legend.appendChild(
|
||||
legendLine(ColorGreen, 'Same as the best PP building option'),
|
||||
legendLine(ColourGreen, 'Same as the best PP building option'),
|
||||
);
|
||||
legend.appendChild(
|
||||
legendLine(ColorYellow, 'Within the top 10 of PP for buildings'),
|
||||
legendLine(ColourYellow, 'Within the top 10 of PP for buildings'),
|
||||
);
|
||||
legend.appendChild(
|
||||
legendLine(ColorOrange, 'Within the top 20 of PP for buildings'),
|
||||
legendLine(ColourOrange, 'Within the top 20 of PP for buildings'),
|
||||
);
|
||||
legend.appendChild(
|
||||
legendLine(ColorRed, 'Within the top 30 of PP for buildings'),
|
||||
legendLine(ColourRed, 'Within the top 30 of PP for buildings'),
|
||||
);
|
||||
legend.appendChild(
|
||||
legendLine(ColorPurple, 'Outside of the top 30 of PP for buildings'),
|
||||
legendLine(ColourPurple, 'Outside of the top 30 of PP for buildings'),
|
||||
);
|
||||
legend.appendChild(legendLine(ColorGray, 'Negative or infinity PP'));
|
||||
legend.appendChild(legendLine(ColourGray, 'Negative or infinity PP'));
|
||||
return legend;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ export default function CreateUpgradeBar() {
|
||||
const UpgradeBar = document.createElement('div');
|
||||
UpgradeBar.id = 'CMUpgradeBar';
|
||||
UpgradeBar.style.width = '100%';
|
||||
UpgradeBar.style.backgroundColor = 'black';
|
||||
UpgradeBar.style.backgroundColour = 'black';
|
||||
UpgradeBar.style.textAlign = 'center';
|
||||
UpgradeBar.style.fontWeight = 'bold';
|
||||
UpgradeBar.style.display = 'none';
|
||||
@@ -85,19 +85,19 @@ export default function CreateUpgradeBar() {
|
||||
const upgradeNumber = function (id, color) {
|
||||
const span = document.createElement('span');
|
||||
span.id = id;
|
||||
span.className = ColorTextPre + color;
|
||||
span.className = ColourTextPre + color;
|
||||
span.style.width = '14.28571428571429%';
|
||||
span.style.display = 'inline-block';
|
||||
span.textContent = '0';
|
||||
return span;
|
||||
};
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarBlue', ColorBlue));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGreen', ColorGreen));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarYellow', ColorYellow));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarOrange', ColorOrange));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarRed', ColorRed));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarPurple', ColorPurple));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGray', ColorGray));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarBlue', ColourBlue));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGreen', ColourGreen));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarYellow', ColourYellow));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarOrange', ColourOrange));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarRed', ColourRed));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarPurple', ColourPurple));
|
||||
UpgradeBar.appendChild(upgradeNumber('CMUpgradeBarGray', ColourGray));
|
||||
|
||||
l('upgrades').parentNode.insertBefore(
|
||||
UpgradeBar,
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
import { CacheUpgrades } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
ColorBackPre,
|
||||
ColorBlue,
|
||||
ColorGray,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
ColorRed,
|
||||
Colors,
|
||||
ColorYellow,
|
||||
ColourBackPre,
|
||||
ColourBlue,
|
||||
ColourGray,
|
||||
ColourGreen,
|
||||
ColourOrange,
|
||||
ColourPurple,
|
||||
ColourRed,
|
||||
ColoursOrdering,
|
||||
ColourYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function adjusts some things in the upgrades section
|
||||
* It colours them and shuffles the order when CM.Options.SortBuildings is set
|
||||
* The function is called by CM.Disp.Draw(), CM.Disp.ToggleUpgradeBarAndColor & CM.Disp.RefreshScale()
|
||||
* The function is called by CM.Disp.Draw(), CM.Disp.ToggleUpgradeBarAndColour & CM.Disp.RefreshScale()
|
||||
* And by changes in CM.Options.SortUpgrades
|
||||
*/
|
||||
export default function UpdateUpgrades() {
|
||||
// This counts the amount of upgrades for each pp group and updates the Upgrade Bar
|
||||
if (CMOptions.UpBarColor > 0) {
|
||||
if (CMOptions.UpBarColour > 0) {
|
||||
let blue = 0;
|
||||
let green = 0;
|
||||
let yellow = 0;
|
||||
@@ -32,31 +31,31 @@ export default function UpdateUpgrades() {
|
||||
|
||||
Object.keys(Game.UpgradesInStore).forEach((i) => {
|
||||
const me = Game.UpgradesInStore[i];
|
||||
let addedColor = false;
|
||||
let addedColour = false;
|
||||
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
|
||||
if (
|
||||
l(`upgrade${i}`).childNodes[j].className.indexOf(ColorBackPre) !== -1
|
||||
l(`upgrade${i}`).childNodes[j].className.indexOf(ColourBackPre) !== -1
|
||||
) {
|
||||
l(`upgrade${i}`).childNodes[j].className =
|
||||
ColorBackPre + CacheUpgrades[me.name].color;
|
||||
addedColor = true;
|
||||
ColourBackPre + CacheUpgrades[me.name].color;
|
||||
addedColour = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!addedColor) {
|
||||
if (!addedColour) {
|
||||
const div = document.createElement('div');
|
||||
div.style.width = '10px';
|
||||
div.style.height = '10px';
|
||||
div.className = ColorBackPre + CacheUpgrades[me.name].color;
|
||||
div.className = ColourBackPre + CacheUpgrades[me.name].color;
|
||||
l(`upgrade${i}`).appendChild(div);
|
||||
}
|
||||
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;
|
||||
if (CacheUpgrades[me.name].color === ColourBlue) blue += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColourGreen) green += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColourYellow) yellow += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColourOrange) orange += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColourRed) red += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColourPurple) purple += 1;
|
||||
else if (CacheUpgrades[me.name].color === ColourGray) gray += 1;
|
||||
});
|
||||
|
||||
l('CMUpgradeBarBlue').textContent = blue;
|
||||
@@ -81,9 +80,9 @@ export default function UpdateUpgrades() {
|
||||
|
||||
if (CMOptions.SortUpgrades) {
|
||||
arr.sort(function (a, b) {
|
||||
return Colors.indexOf(a.color) > Colors.indexOf(b.color)
|
||||
return ColoursOrdering.indexOf(a.color) > ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
|
||||
? 1
|
||||
: Colors.indexOf(a.color) < Colors.indexOf(b.color)
|
||||
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color) // eslint-disable-line no-nested-ternary
|
||||
? -1
|
||||
: a.pp < b.pp
|
||||
? -1
|
||||
|
||||
@@ -19,7 +19,7 @@ export function AddAuraInfo(aura) {
|
||||
const timeToRecover = FormatTime(
|
||||
priceOfChange / (bonusCPS + Game.cookiesPs),
|
||||
);
|
||||
const bonusCPSPercentage = Beautify(bonusCPS / Game.cookiesPs);
|
||||
const bonusCPSPercentage = Beautify((bonusCPS / Game.cookiesPs) * 100);
|
||||
|
||||
l('dragonAuraInfo').style.minHeight = '60px';
|
||||
l('dragonAuraInfo').style.margin = '8px';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons';
|
||||
import { CMOptions } from '../Config/VariablesAndData';
|
||||
import { Beautify } from './BeautifyAndFormatting/BeautifyFormatting';
|
||||
import UpdateBuildings from './BuildingsUpgrades/Buildings';
|
||||
@@ -15,7 +16,7 @@ import {
|
||||
* This function handles all custom drawing for the Game.Draw() function.
|
||||
* It is hooked on 'draw' by CM.RegisterHooks()
|
||||
*/
|
||||
export default function Draw() {
|
||||
export default function CMDrawHook() {
|
||||
// Draw autosave timer in stats menu, this must be done here to make it count down correctly
|
||||
if (
|
||||
Game.prefs.autosave &&
|
||||
@@ -52,6 +53,9 @@ export default function Draw() {
|
||||
// Change menu refresh interval
|
||||
RefreshMenu();
|
||||
|
||||
// Update display of wrinkler buttons, this checks if Elder Pledge has been bought and if they should be disabled
|
||||
ToggleWrinklerButtons();
|
||||
|
||||
// Replace Cookies counter because Orteil uses very weird code to "pad" it...
|
||||
if (CMOptions.Scale) {
|
||||
let str = l('cookies').innerHTML.replace(
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/** Section: Functions related to the Golden Cookie Timers */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
@@ -28,14 +27,14 @@ export default function CreateGCTimer(cookie) {
|
||||
cookie.pop();
|
||||
};
|
||||
GCTimer.onmouseover = function () {
|
||||
cookie.l.style.filter =
|
||||
cookie.l.style.filter = // eslint-disable-line no-param-reassign
|
||||
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
|
||||
cookie.l.style.webkitFilter =
|
||||
cookie.l.style.webkitFilter = // eslint-disable-line no-param-reassign
|
||||
'brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))';
|
||||
};
|
||||
GCTimer.onmouseout = function () {
|
||||
cookie.l.style.filter = '';
|
||||
cookie.l.style.webkitFilter = '';
|
||||
cookie.l.style.filter = ''; // eslint-disable-line no-param-reassign
|
||||
cookie.l.style.webkitFilter = ''; // eslint-disable-line no-param-reassign
|
||||
};
|
||||
|
||||
GCTimers[cookie.id] = GCTimer;
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import {
|
||||
ColorGray,
|
||||
ColorGreen,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
ColorRed,
|
||||
ColorYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function returns Name and Color as object for sugar lump type that is given as input param.
|
||||
* It is called by CM.Disp.UpdateTooltipSugarLump()
|
||||
* @param {string} type Sugar Lump Type.
|
||||
* @returns {{string}, {string}} text, color An array containing the text and display-color of the sugar lump
|
||||
*/
|
||||
export default function GetLumpColor(type) {
|
||||
if (type === 0) {
|
||||
return { text: 'Normal', color: ColorGray };
|
||||
}
|
||||
if (type === 1) {
|
||||
return { text: 'Bifurcated', color: ColorGreen };
|
||||
}
|
||||
if (type === 2) {
|
||||
return { text: 'Golden', color: ColorYellow };
|
||||
}
|
||||
if (type === 3) {
|
||||
return { text: 'Meaty', color: ColorOrange };
|
||||
}
|
||||
if (type === 4) {
|
||||
return { text: 'Caramelized', color: ColorPurple };
|
||||
}
|
||||
return { text: 'Unknown Sugar Lump', color: ColorRed };
|
||||
}
|
||||
33
src/Disp/HelperFunctions/GetLumpColour.js
Normal file
33
src/Disp/HelperFunctions/GetLumpColour.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import {
|
||||
ColourGray,
|
||||
ColourGreen,
|
||||
ColourOrange,
|
||||
ColourPurple,
|
||||
ColourRed,
|
||||
ColourYellow,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function returns Name and Colour as object for sugar lump type that is given as input param.
|
||||
* It is called by CM.Disp.UpdateTooltipSugarLump()
|
||||
* @param {string} type Sugar Lump Type.
|
||||
* @returns {{string}, {string}} text, color An array containing the text and display-color of the sugar lump
|
||||
*/
|
||||
export default function GetLumpColour(type) {
|
||||
if (type === 0) {
|
||||
return { text: 'Normal', color: ColourGray };
|
||||
}
|
||||
if (type === 1) {
|
||||
return { text: 'Bifurcated', color: ColourGreen };
|
||||
}
|
||||
if (type === 2) {
|
||||
return { text: 'Golden', color: ColourYellow };
|
||||
}
|
||||
if (type === 3) {
|
||||
return { text: 'Meaty', color: ColourOrange };
|
||||
}
|
||||
if (type === 4) {
|
||||
return { text: 'Caramelized', color: ColourPurple };
|
||||
}
|
||||
return { text: 'Unknown Sugar Lump', color: ColourRed };
|
||||
}
|
||||
@@ -11,4 +11,5 @@ export default function UpdateBackground() {
|
||||
Game.LeftBackground.canvas.parentNode.offsetWidth;
|
||||
Game.LeftBackground.canvas.height =
|
||||
Game.LeftBackground.canvas.parentNode.offsetHeight;
|
||||
Game.DrawBackground();
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import UpdateBuildings from '../BuildingsUpgrades/Buildings';
|
||||
import {
|
||||
ColorBackPre,
|
||||
ColorBorderPre,
|
||||
Colors,
|
||||
ColorTextPre,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function changes/refreshes colours if the user has set new standard colours
|
||||
* The function is therefore called by a change in CM.Options.Colors
|
||||
*/
|
||||
export default function UpdateColors() {
|
||||
let str = '';
|
||||
for (let i = 0; i < Colors.length; i++) {
|
||||
str += `.${ColorTextPre}${Colors[i]} { color: ${
|
||||
CMOptions.Colors[Colors[i]]
|
||||
}; }\n`;
|
||||
}
|
||||
for (let i = 0; i < Colors.length; i++) {
|
||||
str += `.${ColorBackPre}${Colors[i]} { background-color: ${
|
||||
CMOptions.Colors[Colors[i]]
|
||||
}; }\n`;
|
||||
}
|
||||
for (let i = 0; i < Colors.length; i++) {
|
||||
str += `.${ColorBorderPre}${Colors[i]} { border: 1px solid ${
|
||||
CMOptions.Colors[Colors[i]]
|
||||
}; }\n`;
|
||||
}
|
||||
l('CMCSS').textContent = str;
|
||||
UpdateBuildings(); // Class has been already set
|
||||
}
|
||||
33
src/Disp/HelperFunctions/UpdateColours.js
Normal file
33
src/Disp/HelperFunctions/UpdateColours.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import UpdateBuildings from '../BuildingsUpgrades/Buildings';
|
||||
import {
|
||||
ColourBackPre,
|
||||
ColourBorderPre,
|
||||
ColoursOrdering,
|
||||
ColourTextPre,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function changes/refreshes colours if the user has set new standard colours
|
||||
* The function is therefore called by a change in CM.Options.Colours
|
||||
*/
|
||||
export default function UpdateColours() {
|
||||
let str = '';
|
||||
for (let i = 0; i < ColoursOrdering.length; i++) {
|
||||
str += `.${ColourTextPre}${ColoursOrdering[i]} { color: ${
|
||||
CMOptions[`Colour${ColoursOrdering[i]}`]
|
||||
}; }\n`;
|
||||
}
|
||||
for (let i = 0; i < ColoursOrdering.length; i++) {
|
||||
str += `.${ColourBackPre}${ColoursOrdering[i]} { background-color: ${
|
||||
CMOptions[`Colour${ColoursOrdering[i]}`]
|
||||
}; }\n`;
|
||||
}
|
||||
for (let i = 0; i < ColoursOrdering.length; i++) {
|
||||
str += `.${ColourBorderPre}${ColoursOrdering[i]} { border: 1px solid ${
|
||||
CMOptions[`Colour${ColoursOrdering[i]}`]
|
||||
}; }\n`;
|
||||
}
|
||||
l('CMCSS').textContent = str;
|
||||
UpdateBuildings(); // Class has been already set
|
||||
}
|
||||
@@ -10,14 +10,14 @@ import { VersionMajor, VersionMinor } from '../../Data/Moddata';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
GetTimeColor,
|
||||
GetTimeColour,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
|
||||
import {
|
||||
ColorBlue,
|
||||
ColorTextPre,
|
||||
ColorYellow,
|
||||
ColourBlue,
|
||||
ColourTextPre,
|
||||
ColourYellow,
|
||||
LastTargetBotBar,
|
||||
} from '../VariablesAndData';
|
||||
import { CreateBotBarBuildingColumn } from './CreateDOMElements';
|
||||
@@ -32,7 +32,7 @@ export function CreateBotBar() {
|
||||
BotBar.style.width = '100%';
|
||||
BotBar.style.position = 'absolute';
|
||||
BotBar.style.display = 'none';
|
||||
BotBar.style.backgroundColor = '#262224';
|
||||
BotBar.style.backgroundColour = '#262224';
|
||||
BotBar.style.backgroundImage = 'linear-gradient(to bottom, #4d4548, #000000)';
|
||||
BotBar.style.borderTop = '1px solid black';
|
||||
BotBar.style.overflow = 'auto';
|
||||
@@ -48,19 +48,21 @@ export function CreateBotBar() {
|
||||
const firstCol = function (text, color) {
|
||||
const td = document.createElement('td');
|
||||
td.style.textAlign = 'right';
|
||||
td.className = ColorTextPre + color;
|
||||
td.className = ColourTextPre + color;
|
||||
td.textContent = text;
|
||||
return td;
|
||||
};
|
||||
const type = tbody.appendChild(document.createElement('tr'));
|
||||
type.style.fontWeight = 'bold';
|
||||
type.appendChild(firstCol(`CM ${VersionMajor}.${VersionMinor}`, ColorYellow));
|
||||
type.appendChild(
|
||||
firstCol(`CM ${VersionMajor}.${VersionMinor}`, ColourYellow),
|
||||
);
|
||||
const bonus = tbody.appendChild(document.createElement('tr'));
|
||||
bonus.appendChild(firstCol('Bonus Income', ColorBlue));
|
||||
bonus.appendChild(firstCol('Bonus Income', ColourBlue));
|
||||
const pp = tbody.appendChild(document.createElement('tr'));
|
||||
pp.appendChild(firstCol('Payback Period', ColorBlue));
|
||||
pp.appendChild(firstCol('Payback Period', ColourBlue));
|
||||
const time = tbody.appendChild(document.createElement('tr'));
|
||||
time.appendChild(firstCol('Time Left', ColorBlue));
|
||||
time.appendChild(firstCol('Time Left', ColourBlue));
|
||||
|
||||
l('wrapper').appendChild(BotBar);
|
||||
|
||||
@@ -94,7 +96,7 @@ export function UpdateBotBar() {
|
||||
].textContent = Beautify(target[i].bonus, 2);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
|
||||
count
|
||||
].className = ColorTextPre + target[i].color;
|
||||
].className = ColourTextPre + target[i].color;
|
||||
let PPString;
|
||||
if (CMOptions.PPDisplayTime)
|
||||
PPString = FormatTime(Math.round(target[i].pp));
|
||||
@@ -102,24 +104,24 @@ export function UpdateBotBar() {
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
|
||||
count
|
||||
].textContent = PPString;
|
||||
const timeColor = GetTimeColor(
|
||||
const timeColour = GetTimeColour(
|
||||
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].className = ColorTextPre + timeColor.color;
|
||||
].className = ColourTextPre + timeColour.color;
|
||||
if (
|
||||
timeColor.text === 'Done!' &&
|
||||
timeColour.text === 'Done!' &&
|
||||
Game.cookies < Game.Objects[i].bulkPrice
|
||||
) {
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].textContent = `${timeColor.text} (with Wrink)`;
|
||||
].textContent = `${timeColour.text} (with Wrink)`;
|
||||
} else
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].textContent = timeColor.text;
|
||||
].textContent = timeColour.text;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** Functions to create various DOM elements used by the Bars */
|
||||
|
||||
import { ColorBackPre, ColorBlue, ColorTextPre } from '../VariablesAndData';
|
||||
import { ColourBackPre, ColourBlue, ColourTextPre } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates an indivudual timer for the timer bar
|
||||
@@ -47,7 +47,7 @@ export function CreateTimer(id, name, bars) {
|
||||
colorBar.style.borderBottomRightRadius = '10px';
|
||||
}
|
||||
if (typeof bars[i].color !== 'undefined') {
|
||||
colorBar.className = ColorBackPre + bars[i].color;
|
||||
colorBar.className = ColourBackPre + bars[i].color;
|
||||
}
|
||||
div.appendChild(colorBar);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ export function CreateBotBarBuildingColumn(buildingName) {
|
||||
);
|
||||
|
||||
const span = header.appendChild(document.createElement('span'));
|
||||
span.className = ColorTextPre + ColorBlue;
|
||||
span.className = ColourTextPre + ColourBlue;
|
||||
|
||||
header.appendChild(document.createTextNode(')'));
|
||||
type.lastChild.style.paddingLeft = '8px';
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
import { UpdateBotTimerBarPosition } from '../../Config/SpecificToggles';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
BuffColors,
|
||||
ColorBackPre,
|
||||
ColorGray,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
BuffColours,
|
||||
ColourBackPre,
|
||||
ColourGray,
|
||||
ColourOrange,
|
||||
ColourPurple,
|
||||
LastNumberOfTimers,
|
||||
} from '../VariablesAndData';
|
||||
import { CreateTimer } from './CreateDOMElements';
|
||||
@@ -23,19 +23,19 @@ export function CreateTimerBar() {
|
||||
TimerBar.style.height = '0px';
|
||||
TimerBar.style.fontSize = '10px';
|
||||
TimerBar.style.fontWeight = 'bold';
|
||||
TimerBar.style.backgroundColor = 'black';
|
||||
TimerBar.style.backgroundColour = 'black';
|
||||
|
||||
// Create standard Golden Cookie bar
|
||||
const CMTimerBarGC = CreateTimer('CMTimerBarGC', 'Next Cookie', [
|
||||
{ id: 'CMTimerBarGCMinBar', color: ColorGray },
|
||||
{ id: 'CMTimerBarGCBar', color: ColorPurple },
|
||||
{ id: 'CMTimerBarGCMinBar', color: ColourGray },
|
||||
{ id: 'CMTimerBarGCBar', color: ColourPurple },
|
||||
]);
|
||||
TimerBar.appendChild(CMTimerBarGC);
|
||||
|
||||
// Create standard Reindeer bar
|
||||
const CMTimerBarRen = CreateTimer('CMTimerBarRen', 'Next Reindeer', [
|
||||
{ id: 'CMTimerBarRenMinBar', color: ColorGray },
|
||||
{ id: 'CMTimerBarRenBar', color: ColorOrange },
|
||||
{ id: 'CMTimerBarRenMinBar', color: ColourGray },
|
||||
{ id: 'CMTimerBarRenBar', color: ColourOrange },
|
||||
]);
|
||||
TimerBar.appendChild(CMTimerBarRen);
|
||||
const TimerBarBuffTimers = document.createElement('div');
|
||||
@@ -166,12 +166,12 @@ export function UpdateTimerBar() {
|
||||
{ id: `${Game.buffs[i].name}Bar` },
|
||||
]);
|
||||
timer.style.display = '';
|
||||
let classColor = '';
|
||||
let classColour = '';
|
||||
// Gives specific timers specific colors
|
||||
if (typeof BuffColors[Game.buffs[i].name] !== 'undefined') {
|
||||
classColor = BuffColors[Game.buffs[i].name];
|
||||
} else classColor = ColorPurple;
|
||||
timer.lastChild.children[1].className = ColorBackPre + classColor;
|
||||
if (typeof BuffColours[Game.buffs[i].name] !== 'undefined') {
|
||||
classColour = BuffColours[Game.buffs[i].name];
|
||||
} else classColour = ColourPurple;
|
||||
timer.lastChild.children[1].className = ColourBackPre + classColour;
|
||||
timer.lastChild.children[1].style.color = 'black';
|
||||
if (CMOptions.TimerBarOverlay === 2)
|
||||
timer.lastChild.children[1].textContent = `${Math.round(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* This function creates a white square over the full screen and appends it to l('wrapper')
|
||||
*/
|
||||
export default function CreateWhiteScreen() {
|
||||
export default function CreateFlashScreen() {
|
||||
const WhiteScreen = document.createElement('div');
|
||||
WhiteScreen.id = 'CMWhiteScreen';
|
||||
WhiteScreen.id = 'CMFlashScreen';
|
||||
WhiteScreen.style.width = '100%';
|
||||
WhiteScreen.style.height = '100%';
|
||||
WhiteScreen.style.backgroundColor = 'white';
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import AddMenuStats from './AddStatsPage';
|
||||
import AddMenuInfo from './InfoPage';
|
||||
import AddMenuPref from './SettingsPage';
|
||||
import AddMenuStats from './Statistics/AddStatsPage';
|
||||
import AddMenuInfo from './Info/InfoPage';
|
||||
import AddMenuPref from './Settings/SettingsPage';
|
||||
|
||||
/**
|
||||
* This function adds the calll the functions to add extra info to the stats and options pages
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/** Functions related to the Stats page */
|
||||
|
||||
import { ToggleHeader } from '../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { LatestReleaseNotes, ModDescription } from '../../Data/Moddata';
|
||||
import { ToggleHeader } from '../../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import { LatestReleaseNotes, ModDescription } from '../../../Data/Moddata';
|
||||
|
||||
/**
|
||||
* This function adds stats created by CookieMonster to the stats page
|
||||
22
src/Disp/MenuSections/Prompt.js
Normal file
22
src/Disp/MenuSections/Prompt.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/** Creates a Prompt similar to the base game without some of the stuff breaking them */
|
||||
export default function CookieMonsterPrompt(content, options) {
|
||||
Game.promptWrapL.className = 'framed';
|
||||
const str = content;
|
||||
Game.promptL.innerHTML = `${str}<div class="optionBox"></div>`;
|
||||
Object.keys(options).forEach((i) => {
|
||||
const option = document.createElement('a');
|
||||
option.id = `promptOption${i}`;
|
||||
option.className = 'option';
|
||||
option.onclick = function () {
|
||||
PlaySound('snd/tick.mp3');
|
||||
options[i][1]();
|
||||
};
|
||||
option.textContent = options[i][0];
|
||||
Game.promptL.children[1].appendChild(option);
|
||||
});
|
||||
Game.promptAnchorL.style.display = 'block';
|
||||
Game.darkenL.style.display = 'block';
|
||||
Game.promptL.focus();
|
||||
Game.promptOn = 1;
|
||||
Game.UpdatePrompt();
|
||||
}
|
||||
35
src/Disp/MenuSections/Settings/CreateHeader.js
Normal file
35
src/Disp/MenuSections/Settings/CreateHeader.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import { ToggleHeader } from '../../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates a header-object for the options page
|
||||
* @param {string} config The name of the Config-group
|
||||
* @param {string} text The to-be displayed name of the header
|
||||
* @returns {object} div The header object
|
||||
*/
|
||||
export default function CreatePrefHeader(config, text) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'title';
|
||||
|
||||
div.style.opacity = '0.7';
|
||||
div.style.fontSize = '17px';
|
||||
div.appendChild(document.createTextNode(`${text} `));
|
||||
const span = document.createElement('span'); // Creates the +/- button
|
||||
span.style.cursor = 'pointer';
|
||||
span.style.display = 'inline-block';
|
||||
span.style.height = '14px';
|
||||
span.style.width = '14px';
|
||||
span.style.borderRadius = '7px';
|
||||
span.style.textAlign = 'center';
|
||||
span.style.backgroundColor = '#C0C0C0';
|
||||
span.style.color = 'black';
|
||||
span.style.fontSize = '13px';
|
||||
span.style.verticalAlign = 'middle';
|
||||
span.textContent = CMOptions.Header[config] ? '-' : '+';
|
||||
span.onclick = function () {
|
||||
ToggleHeader(config);
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
div.appendChild(span);
|
||||
return div;
|
||||
}
|
||||
234
src/Disp/MenuSections/Settings/CreateOption.js
Normal file
234
src/Disp/MenuSections/Settings/CreateOption.js
Normal file
@@ -0,0 +1,234 @@
|
||||
import jscolor, * as JsColor from '@eastdesire/jscolor';
|
||||
import ToggleFavouriteSetting from '../../../Config/Toggles/ToggleFavourites';
|
||||
import { SaveConfig } from '../../../Config/SaveLoadReload/SaveLoadReloadSettings';
|
||||
import {
|
||||
ConfigPrefix,
|
||||
ToggleConfig,
|
||||
ToggleConfigVolume,
|
||||
} from '../../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import {} from '../../../Data/Sectionheaders';
|
||||
import Config from '../../../Data/SettingsData';
|
||||
import RefreshScale from '../../HelperFunctions/RefreshScale';
|
||||
import UpdateColours from '../../HelperFunctions/UpdateColours';
|
||||
import Flash from '../../Notifications/Flash';
|
||||
import PlaySound from '../../Notifications/Sound';
|
||||
import {
|
||||
FavouriteSettings,
|
||||
SimpleTooltipElements,
|
||||
} from '../../VariablesAndData';
|
||||
import CookieMonsterPrompt from '../Prompt';
|
||||
|
||||
/**
|
||||
* This function creates the favourite setting star object
|
||||
* @param {string} config The name of the option
|
||||
* @returns {object} div The option object
|
||||
*/
|
||||
function CreateFavouriteStar(config) {
|
||||
const FavStar = document.createElement('a');
|
||||
if (FavouriteSettings.includes(config)) {
|
||||
FavStar.innerText = '★';
|
||||
FavStar.style.color = 'yellow';
|
||||
} else FavStar.innerText = '☆';
|
||||
FavStar.className = 'option';
|
||||
FavStar.onclick = function () {
|
||||
ToggleFavouriteSetting(config);
|
||||
SaveConfig();
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
FavStar.onmouseover = function () {
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
escape(SimpleTooltipElements.FavouriteSettingPlaceholder.innerHTML),
|
||||
);
|
||||
};
|
||||
FavStar.onmouseout = function () {
|
||||
Game.tooltip.hide();
|
||||
};
|
||||
FavStar.appendChild(document.createTextNode(' '));
|
||||
return FavStar;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates an option-object for the options page
|
||||
* @param {string} config The name of the option
|
||||
* @returns {object} div The option object
|
||||
*/
|
||||
export default function CreatePrefOption(config) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'listing';
|
||||
if (CMOptions.FavouriteSettings === 1) {
|
||||
div.appendChild(CreateFavouriteStar(config));
|
||||
}
|
||||
if (Config[config].type === 'bool') {
|
||||
const a = document.createElement('a');
|
||||
if (Config[config].toggle && CMOptions[config] === 0) {
|
||||
a.className = 'option off';
|
||||
} else {
|
||||
a.className = 'option';
|
||||
}
|
||||
a.id = ConfigPrefix + config;
|
||||
a.onclick = function () {
|
||||
ToggleConfig(config);
|
||||
};
|
||||
a.textContent = Config[config].label[CMOptions[config]];
|
||||
div.appendChild(a);
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
label.style.lineHeight = '1.6';
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'vol') {
|
||||
const volume = document.createElement('div');
|
||||
volume.className = 'sliderBox';
|
||||
const title = document.createElement('div');
|
||||
title.style.float = 'left';
|
||||
title.innerHTML = Config[config].desc;
|
||||
volume.appendChild(title);
|
||||
const percent = document.createElement('div');
|
||||
percent.id = `slider${config}right`;
|
||||
percent.style.float = 'right';
|
||||
percent.innerHTML = `${CMOptions[config]}%`;
|
||||
volume.appendChild(percent);
|
||||
const slider = document.createElement('input');
|
||||
slider.className = 'slider';
|
||||
slider.id = `slider${config}`;
|
||||
slider.style.clear = 'both';
|
||||
slider.type = 'range';
|
||||
slider.min = '0';
|
||||
slider.max = '100';
|
||||
slider.step = '1';
|
||||
slider.value = CMOptions[config];
|
||||
slider.oninput = function () {
|
||||
ToggleConfigVolume(config);
|
||||
};
|
||||
slider.onchange = function () {
|
||||
ToggleConfigVolume(config);
|
||||
};
|
||||
volume.appendChild(slider);
|
||||
div.appendChild(volume);
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
PlaySound(
|
||||
CMOptions[config.replace('Volume', 'SoundURL')],
|
||||
config.replace('Volume', 'Sound'),
|
||||
config,
|
||||
true,
|
||||
);
|
||||
};
|
||||
a.textContent = 'Test sound';
|
||||
div.appendChild(a);
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'url') {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'option';
|
||||
span.textContent = `${Config[config].label} `;
|
||||
span.style.lineHeight = '1.6';
|
||||
div.appendChild(span);
|
||||
const input = document.createElement('input');
|
||||
input.id = ConfigPrefix + config;
|
||||
input.className = 'option';
|
||||
input.type = 'text';
|
||||
input.readOnly = true;
|
||||
input.setAttribute('value', CMOptions[config]);
|
||||
input.style.width = '300px';
|
||||
div.appendChild(input);
|
||||
div.appendChild(document.createTextNode(' '));
|
||||
const inputPrompt = document.createElement('input');
|
||||
inputPrompt.id = `${ConfigPrefix + config}Prompt`;
|
||||
inputPrompt.className = 'option';
|
||||
inputPrompt.type = 'text';
|
||||
inputPrompt.setAttribute('value', CMOptions[config]);
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
CookieMonsterPrompt(inputPrompt.outerHTML, [
|
||||
[
|
||||
'Save',
|
||||
function () {
|
||||
CMOptions[config] = l(`${ConfigPrefix}${config}Prompt`).value;
|
||||
SaveConfig();
|
||||
Game.ClosePrompt();
|
||||
Game.UpdateMenu();
|
||||
},
|
||||
],
|
||||
[
|
||||
'Cancel',
|
||||
function () {
|
||||
Game.ClosePrompt();
|
||||
},
|
||||
],
|
||||
]);
|
||||
};
|
||||
a.textContent = 'Edit';
|
||||
div.appendChild(a);
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
label.style.lineHeight = '1.6';
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'colour') {
|
||||
const innerSpan = document.createElement('span');
|
||||
innerSpan.className = 'option';
|
||||
const input = document.createElement('input');
|
||||
input.id = config;
|
||||
input.style.width = '65px';
|
||||
input.setAttribute('value', CMOptions[config]);
|
||||
innerSpan.appendChild(input);
|
||||
const change = function () {
|
||||
CMOptions[this.targetElement.id] = this.toHEXString();
|
||||
UpdateColours();
|
||||
SaveConfig();
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
// eslint-disable-next-line no-new
|
||||
new JsColor(input, { hash: true, position: 'right', onInput: change });
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
label.style.lineHeight = '1.6';
|
||||
innerSpan.appendChild(label);
|
||||
if (config.includes('Flash')) {
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
Flash(3, config.replace('Colour', ''), true);
|
||||
};
|
||||
a.textContent = 'Test flash';
|
||||
innerSpan.appendChild(a);
|
||||
}
|
||||
div.appendChild(innerSpan);
|
||||
jscolor.init();
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'numscale') {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'option';
|
||||
span.textContent = `${Config[config].label} `;
|
||||
span.style.lineHeight = '1.6';
|
||||
div.appendChild(span);
|
||||
const input = document.createElement('input');
|
||||
input.id = ConfigPrefix + config;
|
||||
input.className = 'option';
|
||||
input.type = 'number';
|
||||
input.value = CMOptions[config];
|
||||
input.min = Config[config].min;
|
||||
input.max = Config[config].max;
|
||||
input.oninput = function () {
|
||||
CMOptions[config] = this.value;
|
||||
SaveConfig();
|
||||
RefreshScale();
|
||||
};
|
||||
div.appendChild(input);
|
||||
div.appendChild(document.createTextNode(' '));
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
label.style.lineHeight = '1.6';
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
}
|
||||
return div;
|
||||
}
|
||||
79
src/Disp/MenuSections/Settings/SettingsPage.js
Normal file
79
src/Disp/MenuSections/Settings/SettingsPage.js
Normal file
@@ -0,0 +1,79 @@
|
||||
import { LoadConfig } from '../../../Config/SaveLoadReload/SaveLoadReloadSettings';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import {
|
||||
ConfigGroups,
|
||||
ConfigGroupsNotification,
|
||||
} from '../../../Data/Sectionheaders';
|
||||
import Config from '../../../Data/SettingsData';
|
||||
import ConfigDefault from '../../../Data/SettingsDefault';
|
||||
import { FavouriteSettings } from '../../VariablesAndData';
|
||||
import CreatePrefHeader from './CreateHeader';
|
||||
import CreatePrefOption from './CreateOption';
|
||||
|
||||
/**
|
||||
* This function adds the options/settings of CookieMonster to the options page
|
||||
* It is called by CM.Disp.AddMenu
|
||||
* @param {object} title On object that includes the title of the menu
|
||||
*/
|
||||
export default function AddMenuPref(title) {
|
||||
const frag = document.createDocumentFragment();
|
||||
frag.appendChild(title);
|
||||
|
||||
Object.keys(ConfigGroups).forEach((group) => {
|
||||
if (group === 'Favourite') {
|
||||
if (FavouriteSettings.length !== 0 && CMOptions.FavouriteSettings > 0) {
|
||||
frag.appendChild(CreatePrefHeader(group, ConfigGroups[group])); // (group, display-name of group)
|
||||
if (CMOptions.Header[group])
|
||||
for (let index = 0; index < FavouriteSettings.length; index++) {
|
||||
frag.appendChild(CreatePrefOption(FavouriteSettings[index]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
frag.appendChild(CreatePrefHeader(group, ConfigGroups[group])); // (group, display-name of group)
|
||||
if (CMOptions.Header[group]) {
|
||||
// 0 is show, 1 is collapsed
|
||||
// Make sub-sections of Notification section
|
||||
if (group === 'Notification') {
|
||||
Object.keys(ConfigGroupsNotification).forEach((subGroup) => {
|
||||
const subGroupObject = CreatePrefHeader(
|
||||
subGroup,
|
||||
ConfigGroupsNotification[subGroup],
|
||||
); // (group, display-name of group)
|
||||
subGroupObject.style.fontSize = '15px';
|
||||
subGroupObject.style.opacity = '0.5';
|
||||
frag.appendChild(subGroupObject);
|
||||
if (CMOptions.Header[subGroup]) {
|
||||
Object.keys(Config).forEach((option) => {
|
||||
if (Config[option].group === subGroup)
|
||||
frag.appendChild(CreatePrefOption(option));
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Object.keys(Config).forEach((option) => {
|
||||
if (Config[option].group === group)
|
||||
frag.appendChild(CreatePrefOption(option));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const resDef = document.createElement('div');
|
||||
resDef.className = 'listing';
|
||||
const resDefBut = document.createElement('a');
|
||||
resDefBut.className = 'option';
|
||||
resDefBut.onclick = function () {
|
||||
LoadConfig(ConfigDefault);
|
||||
};
|
||||
resDefBut.textContent = 'Restore Default';
|
||||
resDef.appendChild(resDefBut);
|
||||
frag.appendChild(resDef);
|
||||
|
||||
l('menu').childNodes[2].insertBefore(
|
||||
frag,
|
||||
l('menu').childNodes[2].childNodes[
|
||||
l('menu').childNodes[2].childNodes.length - 1
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -1,281 +0,0 @@
|
||||
/** Functions related to the Options/Preferences page */
|
||||
|
||||
import jscolor, * as JsColor from '@eastdesire/jscolor';
|
||||
import {
|
||||
LoadConfig,
|
||||
SaveConfig,
|
||||
} from '../../Config/SaveLoadReload/SaveLoadReloadSettings';
|
||||
import {
|
||||
ConfigPrefix,
|
||||
ToggleConfig,
|
||||
ToggleConfigVolume,
|
||||
ToggleHeader,
|
||||
} from '../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
ConfigGroups,
|
||||
ConfigGroupsNotification,
|
||||
} from '../../Data/Sectionheaders';
|
||||
import Config from '../../Data/SettingsData';
|
||||
import ConfigDefault from '../../Data/SettingsDefault';
|
||||
import RefreshScale from '../HelperFunctions/RefreshScale';
|
||||
import UpdateColors from '../HelperFunctions/UpdateColors';
|
||||
import PlaySound from '../Notifications/Sound';
|
||||
import { Colors } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates a header-object for the options page
|
||||
* @param {string} config The name of the Config-group
|
||||
* @param {string} text The to-be displayed name of the header
|
||||
* @returns {object} div The header object
|
||||
*/
|
||||
function CreatePrefHeader(config, text) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'title';
|
||||
|
||||
div.style.opacity = '0.7';
|
||||
div.style.fontSize = '17px';
|
||||
div.appendChild(document.createTextNode(`${text} `));
|
||||
const span = document.createElement('span'); // Creates the +/- button
|
||||
span.style.cursor = 'pointer';
|
||||
span.style.display = 'inline-block';
|
||||
span.style.height = '14px';
|
||||
span.style.width = '14px';
|
||||
span.style.borderRadius = '7px';
|
||||
span.style.textAlign = 'center';
|
||||
span.style.backgroundColor = '#C0C0C0';
|
||||
span.style.color = 'black';
|
||||
span.style.fontSize = '13px';
|
||||
span.style.verticalAlign = 'middle';
|
||||
span.textContent = CMOptions.Header[config] ? '-' : '+';
|
||||
span.onclick = function () {
|
||||
ToggleHeader(config);
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
div.appendChild(span);
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates an option-object for the options page
|
||||
* @param {string} config The name of the option
|
||||
* @returns {object} div The option object
|
||||
*/
|
||||
function CreatePrefOption(config) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'listing';
|
||||
if (Config[config].type === 'bool') {
|
||||
const a = document.createElement('a');
|
||||
if (Config[config].toggle && CMOptions[config] === 0) {
|
||||
a.className = 'option off';
|
||||
} else {
|
||||
a.className = 'option';
|
||||
}
|
||||
a.id = ConfigPrefix + config;
|
||||
a.onclick = function () {
|
||||
ToggleConfig(config);
|
||||
};
|
||||
a.textContent = Config[config].label[CMOptions[config]];
|
||||
div.appendChild(a);
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'vol') {
|
||||
const volume = document.createElement('div');
|
||||
volume.className = 'sliderBox';
|
||||
const title = document.createElement('div');
|
||||
title.style.float = 'left';
|
||||
title.innerHTML = Config[config].desc;
|
||||
volume.appendChild(title);
|
||||
const percent = document.createElement('div');
|
||||
percent.id = `slider${config}right`;
|
||||
percent.style.float = 'right';
|
||||
percent.innerHTML = `${CMOptions[config]}%`;
|
||||
volume.appendChild(percent);
|
||||
const slider = document.createElement('input');
|
||||
slider.className = 'slider';
|
||||
slider.id = `slider${config}`;
|
||||
slider.style.clear = 'both';
|
||||
slider.type = 'range';
|
||||
slider.min = '0';
|
||||
slider.max = '100';
|
||||
slider.step = '1';
|
||||
slider.value = CMOptions[config];
|
||||
slider.oninput = function () {
|
||||
ToggleConfigVolume(config);
|
||||
};
|
||||
slider.onchange = function () {
|
||||
ToggleConfigVolume(config);
|
||||
};
|
||||
volume.appendChild(slider);
|
||||
div.appendChild(volume);
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
PlaySound(
|
||||
CMOptions[config.replace('Volume', 'SoundURL')],
|
||||
config.replace('Volume', 'Sound'),
|
||||
config,
|
||||
true,
|
||||
);
|
||||
};
|
||||
a.textContent = 'Test sound';
|
||||
div.appendChild(a);
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'url') {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'option';
|
||||
span.textContent = `${Config[config].label} `;
|
||||
div.appendChild(span);
|
||||
const input = document.createElement('input');
|
||||
input.id = ConfigPrefix + config;
|
||||
input.className = 'option';
|
||||
input.type = 'text';
|
||||
input.readOnly = true;
|
||||
input.setAttribute('value', CMOptions[config]);
|
||||
input.style.width = '300px';
|
||||
div.appendChild(input);
|
||||
div.appendChild(document.createTextNode(' '));
|
||||
const inputPrompt = document.createElement('input');
|
||||
inputPrompt.id = `${ConfigPrefix + config}Prompt`;
|
||||
inputPrompt.className = 'option';
|
||||
inputPrompt.type = 'text';
|
||||
inputPrompt.setAttribute('value', CMOptions[config]);
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
Game.Prompt(inputPrompt.outerHTML, [
|
||||
[
|
||||
'Save',
|
||||
function () {
|
||||
CMOptions[`${config}`] = l(`${ConfigPrefix}${config}Prompt`).value;
|
||||
SaveConfig();
|
||||
Game.ClosePrompt();
|
||||
Game.UpdateMenu();
|
||||
},
|
||||
],
|
||||
'Cancel',
|
||||
]);
|
||||
};
|
||||
a.textContent = 'Edit';
|
||||
div.appendChild(a);
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'color') {
|
||||
div.className = '';
|
||||
for (let i = 0; i < Colors.length; i++) {
|
||||
const innerDiv = document.createElement('div');
|
||||
innerDiv.className = 'listing';
|
||||
const input = document.createElement('input');
|
||||
input.id = Colors[i];
|
||||
input.style.width = '65px';
|
||||
input.setAttribute('value', CMOptions.Colors[Colors[i]]);
|
||||
innerDiv.appendChild(input);
|
||||
const change = function () {
|
||||
CMOptions.Colors[this.targetElement.id] = this.toHEXString();
|
||||
UpdateColors();
|
||||
SaveConfig();
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
// eslint-disable-next-line no-new
|
||||
new JsColor(input, { hash: true, position: 'right', onInput: change });
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config.Colors.desc[Colors[i]];
|
||||
innerDiv.appendChild(label);
|
||||
div.appendChild(innerDiv);
|
||||
}
|
||||
jscolor.init();
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'numscale') {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'option';
|
||||
span.textContent = `${Config[config].label} `;
|
||||
div.appendChild(span);
|
||||
const input = document.createElement('input');
|
||||
input.id = ConfigPrefix + config;
|
||||
input.className = 'option';
|
||||
input.type = 'number';
|
||||
input.value = CMOptions[config];
|
||||
input.min = Config[config].min;
|
||||
input.max = Config[config].max;
|
||||
input.oninput = function () {
|
||||
if (this.value > this.max) console.log('TEST');
|
||||
CMOptions[config] = this.value;
|
||||
SaveConfig();
|
||||
RefreshScale();
|
||||
};
|
||||
div.appendChild(input);
|
||||
div.appendChild(document.createTextNode(' '));
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
}
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function adds the options/settings of CookieMonster to the options page
|
||||
* It is called by CM.Disp.AddMenu
|
||||
* @param {object} title On object that includes the title of the menu
|
||||
*/
|
||||
export default function AddMenuPref(title) {
|
||||
const frag = document.createDocumentFragment();
|
||||
frag.appendChild(title);
|
||||
|
||||
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') {
|
||||
Object.keys(ConfigGroupsNotification).forEach((subGroup) => {
|
||||
const subGroupObject = CreatePrefHeader(
|
||||
subGroup,
|
||||
ConfigGroupsNotification[subGroup],
|
||||
); // (group, display-name of group)
|
||||
subGroupObject.style.fontSize = '15px';
|
||||
subGroupObject.style.opacity = '0.5';
|
||||
frag.appendChild(subGroupObject);
|
||||
if (CMOptions.Header[subGroup]) {
|
||||
Object.keys(Config).forEach((option) => {
|
||||
if (Config[option].group === subGroup)
|
||||
frag.appendChild(CreatePrefOption(option));
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Object.keys(Config).forEach((option) => {
|
||||
if (Config[option].group === group)
|
||||
frag.appendChild(CreatePrefOption(option));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const resDef = document.createElement('div');
|
||||
resDef.className = 'listing';
|
||||
const resDefBut = document.createElement('a');
|
||||
resDefBut.className = 'option';
|
||||
resDefBut.onclick = function () {
|
||||
LoadConfig(ConfigDefault);
|
||||
};
|
||||
resDefBut.textContent = 'Restore Default';
|
||||
resDef.appendChild(resDefBut);
|
||||
frag.appendChild(resDef);
|
||||
|
||||
l('menu').childNodes[2].insertBefore(
|
||||
frag,
|
||||
l('menu').childNodes[2].childNodes[
|
||||
l('menu').childNodes[2].childNodes.length - 1
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -3,19 +3,21 @@
|
||||
import { AddMissingUpgrades } from './CreateMissingUpgrades';
|
||||
import * as CreateSections from './CreateStatsSections';
|
||||
import * as CreateElements from './CreateDOMElements';
|
||||
import * as GameData from '../../Data/Gamedata';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import * as GameData from '../../../Data/Gamedata';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
|
||||
import {
|
||||
CacheAverageClicks,
|
||||
CacheAverageCookiesFromClicks,
|
||||
CacheWrinklersFattest,
|
||||
CacheWrinklersNormal,
|
||||
CacheWrinklersTotal,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import PopAllNormalWrinklers from '../HelperFunctions/PopWrinklers';
|
||||
import { ClickTimes, CookieTimes } from '../VariablesAndData';
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
} from '../../../Cache/VariablesAndData';
|
||||
import PopAllNormalWrinklers from '../../HelperFunctions/PopWrinklers';
|
||||
import { ClickTimes, CookieTimes } from '../../VariablesAndData';
|
||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||
import { Beautify } from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import AddMissingAchievements from './CreateMissingAchievements';
|
||||
|
||||
/**
|
||||
* This function adds stats created by CookieMonster to the stats page
|
||||
@@ -114,7 +116,7 @@ export default function AddMenuStats(title) {
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
`Average Cookies Per Second (Past ${
|
||||
`Average cookies per second (past ${
|
||||
CookieTimes[CMOptions.AvgCPSHist] < 60
|
||||
? `${CookieTimes[CMOptions.AvgCPSHist]} seconds`
|
||||
: CookieTimes[CMOptions.AvgCPSHist] / 60 +
|
||||
@@ -126,12 +128,27 @@ export default function AddMenuStats(title) {
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
`Average Cookie Clicks Per Second (Past ${
|
||||
`Average cookie clicks per second (past ${
|
||||
ClickTimes[CMOptions.AvgClicksHist]
|
||||
}${CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds'})`,
|
||||
document.createTextNode(Beautify(CacheAverageClicks, 1)),
|
||||
),
|
||||
);
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
`Cookies from clicking (past ${ClickTimes[CMOptions.AvgClicksHist]}${
|
||||
CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds'
|
||||
})`,
|
||||
document.createTextNode(
|
||||
Beautify(
|
||||
CacheAverageCookiesFromClicks.calcSum(
|
||||
CacheAverageClicks * ClickTimes[CMOptions.AvgClicksHist],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
if (Game.Has('Fortune cookies')) {
|
||||
const fortunes = [];
|
||||
Object.keys(GameData.Fortunes).forEach((i) => {
|
||||
@@ -152,7 +169,7 @@ export default function AddMenuStats(title) {
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
'Missed Golden Cookies',
|
||||
'Missed golden cookies',
|
||||
document.createTextNode(Beautify(Game.missedGoldenClicks)),
|
||||
),
|
||||
);
|
||||
@@ -175,4 +192,7 @@ export default function AddMenuStats(title) {
|
||||
if (CMOptions.MissingUpgrades) {
|
||||
AddMissingUpgrades();
|
||||
}
|
||||
if (CMOptions.MissingAchievements) {
|
||||
AddMissingAchievements();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
/** Section: Functions related to the creation of basic DOM elements page */
|
||||
|
||||
import { ToggleHeader } from '../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { SimpleTooltipElements } from '../VariablesAndData';
|
||||
import { ToggleHeader } from '../../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import { SimpleTooltipElements } from '../../VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates a header-object for the stats page
|
||||
@@ -0,0 +1,86 @@
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
|
||||
function CrateTooltipLockedAchievements(me) {
|
||||
const tags = [];
|
||||
if (me.pool === 'shadow') tags.push('Shadow Achievement', '#9700cf');
|
||||
else tags.push('Achievement', 0);
|
||||
tags.push('Locked', 0);
|
||||
|
||||
let neuromancy = 0;
|
||||
if (Game.Has('Neuromancy') || (Game.sesame && me.pool === 'debug'))
|
||||
neuromancy = 1;
|
||||
if (neuromancy && me.won === 0) tags.push('Click to win!', '#00c462');
|
||||
else if (neuromancy && me.won > 0) tags.push('Click to lose!', '#00c462');
|
||||
|
||||
let { icon } = me;
|
||||
if (me.iconFunction) icon = me.iconFunction();
|
||||
|
||||
let { desc } = me;
|
||||
if (me.descFunc) desc = me.descFunc('stats');
|
||||
|
||||
let tagsStr = '';
|
||||
for (let i = 0; i < tags.length; i += 2) {
|
||||
if (i % 2 === 0)
|
||||
tagsStr += ` <div class="tag" style="color:${
|
||||
tags[i + 1] === 0 ? '#fff' : tags[i + 1]
|
||||
};">[${tags[i]}]</div>`;
|
||||
}
|
||||
tagsStr = tagsStr.substring(1);
|
||||
|
||||
return `<div style="padding:8px 4px;min-width:350px;opacity:0.5">
|
||||
<div class="icon" style="float:left;margin-left:-8px;margin-top:-8px;background-position:${
|
||||
-icon[0] * 48
|
||||
}px ${-icon[1] * 48}px;"></div>
|
||||
<div class="name">${me.name}</div>
|
||||
${tagsStr}<div class="line"></div><div class="description">${desc}</div></div>
|
||||
${
|
||||
Game.sesame
|
||||
? `<div style="font-size:9px;">Id : ${me.id} | Order : ${Math.floor(
|
||||
me.order,
|
||||
)}${me.tier ? ` | Tier : ${me.tier}` : ''}</div>`
|
||||
: ''
|
||||
}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function overwrites the crates of missing achievements
|
||||
*/
|
||||
export default function AddMissingAchievements() {
|
||||
let achievs;
|
||||
Object.values(document.querySelectorAll('div.title')).forEach((i) => {
|
||||
if (i.textContent.includes('Achievements')) {
|
||||
achievs = i.parentElement.querySelectorAll('div.listing.crateBox')[0];
|
||||
}
|
||||
});
|
||||
if (CMOptions.MissingAchievements) {
|
||||
Object.values(achievs.children).forEach((achievsCrate) => {
|
||||
if (!achievsCrate.className.includes('enabled')) {
|
||||
const id = achievsCrate.onclick.toString().match(/(?<=\[).*(?=\])/g)[0];
|
||||
const { icon } = Game.AchievementsById[id];
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
achievsCrate.style.backgroundPosition = `${-icon[0] * 48}px ${
|
||||
-icon[1] * 48
|
||||
}px`;
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
achievsCrate.onmouseover = function () {
|
||||
if (!Game.mouseDown) {
|
||||
Game.setOnCrate(this);
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
this,
|
||||
function () {
|
||||
return (function () {
|
||||
return CrateTooltipLockedAchievements(
|
||||
Game.AchievementsById[id],
|
||||
);
|
||||
})();
|
||||
},
|
||||
'top',
|
||||
);
|
||||
Game.tooltip.wobble();
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
CacheMissingUpgrades,
|
||||
CacheMissingUpgradesCookies,
|
||||
CacheMissingUpgradesPrestige,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
} from '../../../Cache/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function creates the missing upgrades sections for prestige, normal and cookie upgrades
|
||||
@@ -1,7 +1,7 @@
|
||||
/** Functions to create the individual sections of the Statistics page */
|
||||
|
||||
import * as GameData from '../../Data/Gamedata';
|
||||
import { MaxChainCookieReward } from '../../Cache/Stats/ChainCookies';
|
||||
import * as GameData from '../../../Data/Gamedata';
|
||||
import { MaxChainCookieReward } from '../../../Cache/Stats/ChainCookies';
|
||||
import {
|
||||
CacheAvgCPSWithChoEgg,
|
||||
CacheCentEgg,
|
||||
@@ -35,17 +35,17 @@ import {
|
||||
CacheSeaSpec,
|
||||
CacheWrathCookiesMult,
|
||||
CacheWrinklersTotal,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import ResetBonus from '../../Sim/SimulationEvents/ResetAscension';
|
||||
} from '../../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import ResetBonus from '../../../Sim/SimulationEvents/ResetAscension';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
|
||||
import { ColorGreen, ColorRed, ColorTextPre } from '../VariablesAndData';
|
||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
||||
import { ColourGreen, ColourRed, ColourTextPre } from '../../VariablesAndData';
|
||||
import { StatsListing, StatsHeader, StatsMissDisp } from './CreateDOMElements';
|
||||
|
||||
/**
|
||||
@@ -61,8 +61,8 @@ export function LuckySection() {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsLuckySection';
|
||||
|
||||
const luckyColor =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLucky ? ColorRed : ColorGreen;
|
||||
const luckyColour =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLucky ? ColourRed : ColourGreen;
|
||||
const luckyTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLucky
|
||||
? FormatTime(
|
||||
@@ -72,7 +72,7 @@ export function LuckySection() {
|
||||
const luckyReqFrag = document.createDocumentFragment();
|
||||
const luckyReqSpan = document.createElement('span');
|
||||
luckyReqSpan.style.fontWeight = 'bold';
|
||||
luckyReqSpan.className = ColorTextPre + luckyColor;
|
||||
luckyReqSpan.className = ColourTextPre + luckyColour;
|
||||
luckyReqSpan.textContent = Beautify(CacheLucky);
|
||||
luckyReqFrag.appendChild(luckyReqSpan);
|
||||
if (luckyTime !== '') {
|
||||
@@ -83,16 +83,16 @@ export function LuckySection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Lucky!" Cookies Required',
|
||||
'"Lucky!" cookies required',
|
||||
luckyReqFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const luckyColorFrenzy =
|
||||
const luckyColourFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
? ColourRed
|
||||
: ColourGreen;
|
||||
const luckyTimeFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheLuckyFrenzy
|
||||
? FormatTime(
|
||||
@@ -102,7 +102,7 @@ export function LuckySection() {
|
||||
const luckyReqFrenFrag = document.createDocumentFragment();
|
||||
const luckyReqFrenSpan = document.createElement('span');
|
||||
luckyReqFrenSpan.style.fontWeight = 'bold';
|
||||
luckyReqFrenSpan.className = ColorTextPre + luckyColorFrenzy;
|
||||
luckyReqFrenSpan.className = ColourTextPre + luckyColourFrenzy;
|
||||
luckyReqFrenSpan.textContent = Beautify(CacheLuckyFrenzy);
|
||||
luckyReqFrenFrag.appendChild(luckyReqFrenSpan);
|
||||
if (luckyTimeFrenzy !== '') {
|
||||
@@ -113,7 +113,7 @@ export function LuckySection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Lucky!" Cookies Required (Frenzy)',
|
||||
'"Lucky!" cookies required (frenzy)',
|
||||
luckyReqFrenFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
@@ -123,14 +123,14 @@ export function LuckySection() {
|
||||
|
||||
const luckyRewardMaxSpan = document.createElement('span');
|
||||
luckyRewardMaxSpan.style.fontWeight = 'bold';
|
||||
luckyRewardMaxSpan.className = ColorTextPre + CacheLuckyReward;
|
||||
luckyRewardMaxSpan.className = ColourTextPre + CacheLuckyReward;
|
||||
luckyRewardMaxSpan.textContent =
|
||||
Beautify(CacheLuckyReward) +
|
||||
(luckySplit ? ` / ${Beautify(CacheLuckyWrathReward)}` : '');
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
`"Lucky!" Reward (MAX)${luckySplit ? ' (Golden / Wrath)' : ''}`,
|
||||
`"Lucky!" reward (max)${luckySplit ? ' (golden / wrath)' : ''}`,
|
||||
luckyRewardMaxSpan,
|
||||
goldCookTooltip,
|
||||
),
|
||||
@@ -138,14 +138,14 @@ export function LuckySection() {
|
||||
|
||||
const luckyRewardFrenzyMaxSpan = document.createElement('span');
|
||||
luckyRewardFrenzyMaxSpan.style.fontWeight = 'bold';
|
||||
luckyRewardFrenzyMaxSpan.className = ColorTextPre + luckyRewardFrenzyMaxSpan;
|
||||
luckyRewardFrenzyMaxSpan.className = ColourTextPre + luckyRewardFrenzyMaxSpan;
|
||||
luckyRewardFrenzyMaxSpan.textContent =
|
||||
Beautify(CacheLuckyRewardFrenzy) +
|
||||
(luckySplit ? ` / ${Beautify(CacheLuckyWrathRewardFrenzy)}` : '');
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
`"Lucky!" Reward (MAX) (Frenzy)${luckySplit ? ' (Golden / Wrath)' : ''}`,
|
||||
`"Lucky!" reward (max) (frenzy)${luckySplit ? ' (golden / wrath)' : ''}`,
|
||||
luckyRewardFrenzyMaxSpan,
|
||||
goldCookTooltip,
|
||||
),
|
||||
@@ -158,14 +158,14 @@ export function LuckySection() {
|
||||
) + 13;
|
||||
const luckyCurSpan = document.createElement('span');
|
||||
luckyCurSpan.style.fontWeight = 'bold';
|
||||
luckyCurSpan.className = ColorTextPre + luckyCurSpan;
|
||||
luckyCurSpan.className = ColourTextPre + luckyCurSpan;
|
||||
luckyCurSpan.textContent =
|
||||
Beautify(CacheGoldenCookiesMult * luckyCurBase) +
|
||||
(luckySplit ? ` / ${Beautify(CacheWrathCookiesMult * luckyCurBase)}` : '');
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
`"Lucky!" Reward (CUR)${luckySplit ? ' (Golden / Wrath)' : ''}`,
|
||||
`"Lucky!" reward (cur)${luckySplit ? ' (golden / wrath)' : ''}`,
|
||||
luckyCurSpan,
|
||||
goldCookTooltip,
|
||||
),
|
||||
@@ -186,10 +186,10 @@ export function ChainSection() {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsChainSection';
|
||||
|
||||
const chainColor =
|
||||
const chainColour =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainRequired
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
? ColourRed
|
||||
: ColourGreen;
|
||||
const chainTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainRequired
|
||||
? FormatTime(
|
||||
@@ -200,7 +200,7 @@ export function ChainSection() {
|
||||
const chainReqFrag = document.createDocumentFragment();
|
||||
const chainReqSpan = document.createElement('span');
|
||||
chainReqSpan.style.fontWeight = 'bold';
|
||||
chainReqSpan.className = ColorTextPre + chainColor;
|
||||
chainReqSpan.className = ColourTextPre + chainColour;
|
||||
chainReqSpan.textContent = Beautify(CacheChainRequired);
|
||||
chainReqFrag.appendChild(chainReqSpan);
|
||||
if (chainTime !== '') {
|
||||
@@ -211,16 +211,16 @@ export function ChainSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Cookies Required',
|
||||
'"Chain" cookies required',
|
||||
chainReqFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const chainWrathColor =
|
||||
const chainWrathColour =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
? ColourRed
|
||||
: ColourGreen;
|
||||
const chainWrathTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainWrathRequired
|
||||
? FormatTime(
|
||||
@@ -231,7 +231,7 @@ export function ChainSection() {
|
||||
const chainWrathReqFrag = document.createDocumentFragment();
|
||||
const chainWrathReqSpan = document.createElement('span');
|
||||
chainWrathReqSpan.style.fontWeight = 'bold';
|
||||
chainWrathReqSpan.className = ColorTextPre + chainWrathColor;
|
||||
chainWrathReqSpan.className = ColourTextPre + chainWrathColour;
|
||||
chainWrathReqSpan.textContent = Beautify(CacheChainWrathRequired);
|
||||
chainWrathReqFrag.appendChild(chainWrathReqSpan);
|
||||
if (chainWrathTime !== '') {
|
||||
@@ -242,16 +242,16 @@ export function ChainSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Cookies Required (Wrath)',
|
||||
'"Chain" cookies required (Wrath)',
|
||||
chainWrathReqFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const chainColorFrenzy =
|
||||
const chainColourFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
? ColourRed
|
||||
: ColourGreen;
|
||||
const chainTimeFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyRequired
|
||||
? FormatTime(
|
||||
@@ -262,7 +262,7 @@ export function ChainSection() {
|
||||
const chainReqFrenFrag = document.createDocumentFragment();
|
||||
const chainReqFrenSpan = document.createElement('span');
|
||||
chainReqFrenSpan.style.fontWeight = 'bold';
|
||||
chainReqFrenSpan.className = ColorTextPre + chainColorFrenzy;
|
||||
chainReqFrenSpan.className = ColourTextPre + chainColourFrenzy;
|
||||
chainReqFrenSpan.textContent = Beautify(CacheChainFrenzyRequired);
|
||||
chainReqFrenFrag.appendChild(chainReqFrenSpan);
|
||||
if (chainTimeFrenzy !== '') {
|
||||
@@ -273,16 +273,16 @@ export function ChainSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Cookies Required (Frenzy)',
|
||||
'"Chain" cookies required (Frenzy)',
|
||||
chainReqFrenFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
);
|
||||
|
||||
const chainWrathColorFrenzy =
|
||||
const chainWrathColourFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
? ColourRed
|
||||
: ColourGreen;
|
||||
const chainWrathTimeFrenzy =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheChainFrenzyWrathRequired
|
||||
? FormatTime(
|
||||
@@ -294,7 +294,7 @@ export function ChainSection() {
|
||||
const chainWrathReqFrenFrag = document.createDocumentFragment();
|
||||
const chainWrathReqFrenSpan = document.createElement('span');
|
||||
chainWrathReqFrenSpan.style.fontWeight = 'bold';
|
||||
chainWrathReqFrenSpan.className = ColorTextPre + chainWrathColorFrenzy;
|
||||
chainWrathReqFrenSpan.className = ColourTextPre + chainWrathColourFrenzy;
|
||||
chainWrathReqFrenSpan.textContent = Beautify(CacheChainFrenzyWrathRequired);
|
||||
chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSpan);
|
||||
if (chainWrathTimeFrenzy !== '') {
|
||||
@@ -305,7 +305,7 @@ export function ChainSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Cookies Required (Frenzy) (Wrath)',
|
||||
'"Chain" cookies required (frenzy) (Wrath)',
|
||||
chainWrathReqFrenFrag,
|
||||
goldCookTooltip,
|
||||
),
|
||||
@@ -314,7 +314,7 @@ export function ChainSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Reward (MAX) (Golden / Wrath)',
|
||||
'"Chain" reward (max) (golden / wrath)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheChainMaxReward[0])} / ${Beautify(
|
||||
CacheChainWrathMaxReward[0],
|
||||
@@ -327,7 +327,7 @@ export function ChainSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)',
|
||||
'"Chain" reward (max) (frenzy) (golden / wrath)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheChainFrenzyMaxReward[0])} / ${Beautify(
|
||||
CacheChainFrenzyMaxReward[0],
|
||||
@@ -354,7 +354,7 @@ export function ChainSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Chain" Reward (CUR) (Golden / Wrath)',
|
||||
'"Chain" reward (cur) (golden / wrath)',
|
||||
document.createTextNode(
|
||||
`${Beautify(chainCur)} / ${Beautify(chainCurWrath)}`,
|
||||
),
|
||||
@@ -365,7 +365,7 @@ export function ChainSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'CPS Needed For Next Level (G / W)',
|
||||
'CPS needed for next level (g / w)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheChainRequiredNext)} / ${Beautify(
|
||||
CacheChainWrathRequiredNext,
|
||||
@@ -377,7 +377,7 @@ export function ChainSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'CPS Needed For Next Level (Frenzy) (G / W)',
|
||||
'CPS needed for next level (frenzy) (g / w)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheChainFrenzyRequiredNext)} / ${Beautify(
|
||||
CacheChainFrenzyWrathRequiredNext,
|
||||
@@ -397,8 +397,10 @@ export function SpellsSection() {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsSpellsSection';
|
||||
|
||||
const conjureColor =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheConjure ? ColorRed : ColorGreen;
|
||||
const conjureColour =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheConjure
|
||||
? ColourRed
|
||||
: ColourGreen;
|
||||
const conjureTime =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheConjure
|
||||
? FormatTime(
|
||||
@@ -409,7 +411,7 @@ export function SpellsSection() {
|
||||
const conjureReqFrag = document.createDocumentFragment();
|
||||
const conjureReqSpan = document.createElement('span');
|
||||
conjureReqSpan.style.fontWeight = 'bold';
|
||||
conjureReqSpan.className = ColorTextPre + conjureColor;
|
||||
conjureReqSpan.className = ColourTextPre + conjureColour;
|
||||
conjureReqSpan.textContent = Beautify(CacheConjure);
|
||||
conjureReqFrag.appendChild(conjureReqSpan);
|
||||
if (conjureTime !== '') {
|
||||
@@ -420,7 +422,7 @@ export function SpellsSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Cookies Required',
|
||||
'"Conjure Baked Goods" cookies required',
|
||||
conjureReqFrag,
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
@@ -428,16 +430,16 @@ export function SpellsSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Reward (MAX)',
|
||||
'"Conjure Baked Goods" reward (max)',
|
||||
document.createTextNode(Beautify(CacheConjureReward)),
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
);
|
||||
|
||||
const conjureFrenzyColor =
|
||||
const conjureFrenzyColour =
|
||||
Game.cookies + GetWrinkConfigBank() < CacheConjure * 7
|
||||
? ColorRed
|
||||
: ColorGreen;
|
||||
? ColourRed
|
||||
: ColourGreen;
|
||||
const conjureFrenzyCur = Math.min(
|
||||
(Game.cookies + GetWrinkConfigBank()) * 0.15,
|
||||
CacheNoGoldSwitchCookiesPS * 60 * 30,
|
||||
@@ -452,7 +454,7 @@ export function SpellsSection() {
|
||||
const conjureFrenzyReqFrag = document.createDocumentFragment();
|
||||
const conjureFrenzyReqSpan = document.createElement('span');
|
||||
conjureFrenzyReqSpan.style.fontWeight = 'bold';
|
||||
conjureFrenzyReqSpan.className = ColorTextPre + conjureFrenzyColor;
|
||||
conjureFrenzyReqSpan.className = ColourTextPre + conjureFrenzyColour;
|
||||
conjureFrenzyReqSpan.textContent = Beautify(CacheConjure * 7);
|
||||
conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSpan);
|
||||
if (conjureFrenzyTime !== '') {
|
||||
@@ -463,7 +465,7 @@ export function SpellsSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Cookies Required (Frenzy)',
|
||||
'"Conjure Baked Goods" cookies required (frenzy)',
|
||||
conjureFrenzyReqFrag,
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
@@ -471,7 +473,7 @@ export function SpellsSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Reward (MAX) (Frenzy)',
|
||||
'"Conjure Baked Goods" reward (max) (frenzy)',
|
||||
document.createTextNode(Beautify(CacheConjureReward * 7)),
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
@@ -479,7 +481,7 @@ export function SpellsSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Conjure Baked Goods" Reward (CUR)',
|
||||
'"Conjure Baked Goods" reward (cur)',
|
||||
document.createTextNode(Beautify(conjureFrenzyCur)),
|
||||
'GoldCookTooltipPlaceholder',
|
||||
),
|
||||
@@ -488,7 +490,7 @@ export function SpellsSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'"Spontaneous Edifice" Cookies Required (most expensive building)',
|
||||
'"Spontaneous Edifice" cookies required (most expensive building)',
|
||||
document.createTextNode(
|
||||
`${Beautify(CacheEdifice)} (${CacheEdificeBuilding})`,
|
||||
),
|
||||
@@ -507,11 +509,11 @@ export function GardenSection() {
|
||||
const section = document.createElement('div');
|
||||
section.className = 'CMStatsGardenSection';
|
||||
|
||||
const bakeberryColor =
|
||||
Game.cookies < Game.cookiesPs * 60 * 10 * 100 ? ColorRed : ColorGreen;
|
||||
const bakeberryColour =
|
||||
Game.cookies < Game.cookiesPs * 60 * 10 * 100 ? ColourRed : ColourGreen;
|
||||
const bakeberryFrag = document.createElement('span');
|
||||
bakeberryFrag.style.fontWeight = 'bold';
|
||||
bakeberryFrag.className = ColorTextPre + bakeberryColor;
|
||||
bakeberryFrag.className = ColourTextPre + bakeberryColour;
|
||||
bakeberryFrag.textContent = Beautify(Game.cookiesPs * 60 * 10 * 100);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
@@ -521,11 +523,11 @@ export function GardenSection() {
|
||||
),
|
||||
);
|
||||
|
||||
const chocorootColor =
|
||||
Game.cookies < Game.cookiesPs * 60 * 100 ? ColorRed : ColorGreen;
|
||||
const chocorootColour =
|
||||
Game.cookies < Game.cookiesPs * 60 * 100 ? ColourRed : ColourGreen;
|
||||
const chocorootFrag = document.createElement('span');
|
||||
chocorootFrag.style.fontWeight = 'bold';
|
||||
chocorootFrag.className = ColorTextPre + chocorootColor;
|
||||
chocorootFrag.className = ColourTextPre + chocorootColour;
|
||||
chocorootFrag.textContent = Beautify(Game.cookiesPs * 60 * 100);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
@@ -535,11 +537,11 @@ export function GardenSection() {
|
||||
),
|
||||
);
|
||||
|
||||
const queenbeetColor =
|
||||
Game.cookies < Game.cookiesPs * 60 * 60 * 25 ? ColorRed : ColorGreen;
|
||||
const queenbeetColour =
|
||||
Game.cookies < Game.cookiesPs * 60 * 60 * 25 ? ColourRed : ColourGreen;
|
||||
const queenbeetFrag = document.createElement('span');
|
||||
queenbeetFrag.style.fontWeight = 'bold';
|
||||
queenbeetFrag.className = ColorTextPre + queenbeetColor;
|
||||
queenbeetFrag.className = ColourTextPre + queenbeetColour;
|
||||
queenbeetFrag.textContent = Beautify(Game.cookiesPs * 60 * 60 * 25);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
@@ -549,11 +551,11 @@ export function GardenSection() {
|
||||
),
|
||||
);
|
||||
|
||||
const duketaterColor =
|
||||
Game.cookies < Game.cookiesPs * 60 * 15 * 100 ? ColorRed : ColorGreen;
|
||||
const duketaterColour =
|
||||
Game.cookies < Game.cookiesPs * 60 * 15 * 100 ? ColourRed : ColourGreen;
|
||||
const duketaterFrag = document.createElement('span');
|
||||
duketaterFrag.style.fontWeight = 'bold';
|
||||
duketaterFrag.className = ColorTextPre + duketaterColor;
|
||||
duketaterFrag.className = ColourTextPre + duketaterColour;
|
||||
duketaterFrag.textContent = Beautify(Game.cookiesPs * 60 * 15 * 100);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
@@ -562,6 +564,21 @@ export function GardenSection() {
|
||||
duketaterFrag,
|
||||
),
|
||||
);
|
||||
const missingPlantDrops = [];
|
||||
Object.keys(GameData.PlantDrops).forEach((i) => {
|
||||
if (!Game.HasUnlocked(GameData.PlantDrops[i])) {
|
||||
missingPlantDrops.push(GameData.PlantDrops[i]);
|
||||
}
|
||||
});
|
||||
if (missingPlantDrops.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Rare plant drops left to unlock',
|
||||
StatsMissDisp(missingPlantDrops),
|
||||
),
|
||||
);
|
||||
}
|
||||
return section;
|
||||
}
|
||||
|
||||
@@ -586,7 +603,7 @@ export function PrestigeSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Prestige Level (CUR / MAX)',
|
||||
'Prestige level (cur / max)',
|
||||
document.createTextNode(
|
||||
`${Beautify(Game.prestige)} / ${Beautify(possiblePresMax)}`,
|
||||
),
|
||||
@@ -619,7 +636,7 @@ export function PrestigeSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Cookies To Next Level',
|
||||
'Cookies to next level',
|
||||
cookiesNextFrag,
|
||||
'NextPrestTooltipPlaceholder',
|
||||
),
|
||||
@@ -628,7 +645,7 @@ export function PrestigeSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Heavenly Chips (CUR / MAX)',
|
||||
'Heavenly chips (cur / max)',
|
||||
document.createTextNode(
|
||||
`${Beautify(Game.heavenlyChips)} / ${Beautify(
|
||||
possiblePresMax - Game.prestige + Game.heavenlyChips,
|
||||
@@ -641,7 +658,7 @@ export function PrestigeSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Heavenly Chips Per Second (last 5 seconds)',
|
||||
'Heavenly chips per second (last 5 seconds)',
|
||||
document.createTextNode(Beautify(CacheHCPerSecond, 2)),
|
||||
),
|
||||
);
|
||||
@@ -655,14 +672,14 @@ export function PrestigeSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Heavenly Chips To Target Set In Settings (CUR)',
|
||||
'Heavenly chips to target set in settings (cur)',
|
||||
document.createTextNode(Beautify(CookiesTillTarget)),
|
||||
),
|
||||
);
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Time To Target (CUR, Current 5 Second Average)',
|
||||
'Time till target (cur, current 5 second average)',
|
||||
document.createTextNode(
|
||||
FormatTime(CookiesTillTarget / CacheHCPerSecond),
|
||||
),
|
||||
@@ -683,7 +700,7 @@ export function PrestigeSection() {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'withTooltip',
|
||||
'Reset Bonus Income',
|
||||
'Reset bonus income',
|
||||
resetFrag,
|
||||
'ResetTooltipPlaceholder',
|
||||
),
|
||||
@@ -789,13 +806,6 @@ export function SeasonSection() {
|
||||
specDisp = true;
|
||||
}
|
||||
});
|
||||
const missingPlantDrops = [];
|
||||
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');
|
||||
@@ -821,13 +831,16 @@ export function SeasonSection() {
|
||||
else if (godLvl === 2) failRateHalloween *= 0.95;
|
||||
else if (godLvl === 3) failRateHalloween *= 0.97;
|
||||
}
|
||||
const obtainedCookiesChance = missingHalloweenCookies.length / 7;
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Chance of receiving a cookie from wrinkler/shiny wrinkler',
|
||||
document.createTextNode(
|
||||
`${Beautify((1 - failRateHalloween) * 100)}% / ${Beautify(
|
||||
(1 - failRateHalloween * 0.9) * 100,
|
||||
`${Beautify(
|
||||
(1 - failRateHalloween) * obtainedCookiesChance * 100,
|
||||
)}% / ${Beautify(
|
||||
(1 - failRateHalloween * 0.9) * obtainedCookiesChance * 100,
|
||||
)}%`,
|
||||
),
|
||||
),
|
||||
@@ -851,12 +864,15 @@ export function SeasonSection() {
|
||||
else if (godLvl === 2) failRateChristmas *= 0.95;
|
||||
else if (godLvl === 3) failRateChristmas *= 0.97;
|
||||
}
|
||||
const obtainedCookiesChance = missingChristmasCookies.length / 7;
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Chance of receiving a cookie from reindeer',
|
||||
document.createTextNode(
|
||||
`${Beautify((1 - failRateChristmas) * 100)}%`,
|
||||
`${Beautify(
|
||||
(1 - failRateChristmas) * obtainedCookiesChance * 100,
|
||||
)}%`,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -943,15 +959,6 @@ export function SeasonSection() {
|
||||
),
|
||||
);
|
||||
}
|
||||
if (missingPlantDrops.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsListing(
|
||||
'basic',
|
||||
'Rare plant drops left to unlock',
|
||||
StatsMissDisp(missingPlantDrops),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (Game.season === 'christmas')
|
||||
section.appendChild(
|
||||
@@ -7,28 +7,32 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
|
||||
* @param {number} mode Sets the intensity of the flash, used to recursively dim flash
|
||||
* All calls of function have use mode === 3
|
||||
* @param {string} config The setting in CM.Options that is checked before creating the flash
|
||||
* @param {bool} forced Whether the sound should play regardless of settings, used to test the sound
|
||||
*/
|
||||
export default function Flash(mode, config) {
|
||||
export default function Flash(mode, config, forced) {
|
||||
// The arguments check makes the sound not play upon initialization of the mod
|
||||
if (
|
||||
(CMOptions[config] === 1 && mode === 3 && isInitializing === false) ||
|
||||
((CMOptions[config] === 1 || forced) &&
|
||||
mode === 3 &&
|
||||
isInitializing === false) ||
|
||||
mode === 1
|
||||
) {
|
||||
l('CMWhiteScreen').style.opacity = '0.5';
|
||||
l('CMFlashScreen').style.backgroundColor = CMOptions[`Colour${config}`];
|
||||
l('CMFlashScreen').style.opacity = '0.5';
|
||||
if (mode === 3) {
|
||||
l('CMWhiteScreen').style.display = 'inline';
|
||||
l('CMFlashScreen').style.display = 'inline';
|
||||
setTimeout(function () {
|
||||
Flash(2, config);
|
||||
Flash(2, config, true);
|
||||
}, 1000 / Game.fps);
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
Flash(0, config);
|
||||
Flash(0, config, true);
|
||||
}, 1000 / Game.fps);
|
||||
}
|
||||
} else if (mode === 2) {
|
||||
l('CMWhiteScreen').style.opacity = '1';
|
||||
l('CMFlashScreen').style.opacity = '1';
|
||||
setTimeout(function () {
|
||||
Flash(1, config);
|
||||
Flash(1, config, true);
|
||||
}, 1000 / Game.fps);
|
||||
} else if (mode === 0) l('CMWhiteScreen').style.display = 'none';
|
||||
} else if (mode === 0) l('CMFlashScreen').style.display = 'none';
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ export default function ReplaceAscendTooltip() {
|
||||
)} more cookies</b> for the next level.<br>`;
|
||||
str += `${
|
||||
CMOptions.TooltipAscendButton
|
||||
? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you are making ${Beautify(
|
||||
? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you were making ${Beautify(
|
||||
CacheHCPerSecond,
|
||||
2,
|
||||
)} chips on average in the last 5 seconds.<br>`
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
ColorTextPre,
|
||||
ColorBorderPre,
|
||||
ColorGray,
|
||||
ColorBlue,
|
||||
ColorRed,
|
||||
ColorYellow,
|
||||
ColorPurple,
|
||||
ColourTextPre,
|
||||
ColourBorderPre,
|
||||
ColourGray,
|
||||
ColourBlue,
|
||||
ColourRed,
|
||||
ColourYellow,
|
||||
ColourPurple,
|
||||
TooltipType,
|
||||
} from '../VariablesAndData';
|
||||
|
||||
@@ -24,7 +23,7 @@ export function TooltipCreateTooltipBox() {
|
||||
tooltipBox.style.padding = '4px';
|
||||
tooltipBox.style.margin = '0px -4px';
|
||||
tooltipBox.id = 'CMTooltipBorder';
|
||||
tooltipBox.className = ColorTextPre + ColorGray;
|
||||
tooltipBox.className = ColourTextPre + ColourGray;
|
||||
return tooltipBox;
|
||||
}
|
||||
|
||||
@@ -37,7 +36,7 @@ export function TooltipCreateHeader(text) {
|
||||
const div = document.createElement('div');
|
||||
div.style.fontWeight = 'bold';
|
||||
div.id = `${text}Title`;
|
||||
div.className = ColorTextPre + ColorBlue;
|
||||
div.className = ColourTextPre + ColourBlue;
|
||||
div.textContent = text;
|
||||
return div;
|
||||
}
|
||||
@@ -66,13 +65,13 @@ export function TooltipCreateWarningSection() {
|
||||
box.id = boxId;
|
||||
box.style.display = 'none';
|
||||
box.style.transition = 'opacity 0.1s ease-out';
|
||||
box.className = ColorBorderPre + color;
|
||||
box.className = ColourBorderPre + color;
|
||||
box.style.padding = '2px';
|
||||
box.style.background = '#000 url(img/darkNoise.png)';
|
||||
const labelDiv = document.createElement('div');
|
||||
box.appendChild(labelDiv);
|
||||
const labelSpan = document.createElement('span');
|
||||
labelSpan.className = ColorTextPre + color;
|
||||
labelSpan.className = ColourTextPre + color;
|
||||
labelSpan.style.fontWeight = 'bold';
|
||||
labelSpan.textContent = labelTextFront;
|
||||
labelDiv.appendChild(labelSpan);
|
||||
@@ -89,7 +88,7 @@ export function TooltipCreateWarningSection() {
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnLucky',
|
||||
ColorRed,
|
||||
ColourRed,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies required for "Lucky!"',
|
||||
'CMDispTooltipWarnLuckyText',
|
||||
@@ -99,7 +98,7 @@ export function TooltipCreateWarningSection() {
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnLuckyFrenzy',
|
||||
ColorYellow,
|
||||
ColourYellow,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies required for "Lucky!" (Frenzy)',
|
||||
'CMDispTooltipWarnLuckyFrenzyText',
|
||||
@@ -109,7 +108,7 @@ export function TooltipCreateWarningSection() {
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnConjure',
|
||||
ColorPurple,
|
||||
ColourPurple,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"',
|
||||
'CMDispTooltipWarnConjureText',
|
||||
@@ -119,7 +118,7 @@ export function TooltipCreateWarningSection() {
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnConjureFrenzy',
|
||||
ColorPurple,
|
||||
ColourPurple,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)',
|
||||
'CMDispTooltipWarnConjureFrenzyText',
|
||||
@@ -129,7 +128,7 @@ export function TooltipCreateWarningSection() {
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnEdifice',
|
||||
ColorPurple,
|
||||
ColourPurple,
|
||||
'Warning: ',
|
||||
'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"',
|
||||
'CMDispTooltipWarnEdificeText',
|
||||
@@ -139,7 +138,7 @@ export function TooltipCreateWarningSection() {
|
||||
TooltipWarn.appendChild(
|
||||
create(
|
||||
'CMDispTooltipWarnUser',
|
||||
ColorRed,
|
||||
ColourRed,
|
||||
'Warning: ',
|
||||
`Purchase of this item will put you under the number of Cookies equal to ${CMOptions.ToolWarnUser} seconds of CPS`,
|
||||
'CMDispTooltipWarnUserText',
|
||||
@@ -163,7 +162,7 @@ export function TooltipCreateCalculationSection(tooltip) {
|
||||
tooltip.appendChild(income);
|
||||
|
||||
tooltip.appendChild(TooltipCreateHeader('Bonus Cookies per Click'));
|
||||
tooltip.lastChild.style.display = 'none';
|
||||
tooltip.lastChild.style.display = 'none'; // eslint-disable-line no-param-reassign
|
||||
const click = document.createElement('div');
|
||||
click.style.marginBottom = '4px';
|
||||
click.style.color = 'white';
|
||||
@@ -186,7 +185,8 @@ export function TooltipCreateCalculationSection(tooltip) {
|
||||
tooltip.appendChild(
|
||||
TooltipCreateHeader('Production left till next achievement'),
|
||||
);
|
||||
tooltip.lastChild.id = 'CMTooltipProductionHeader'; // Assign a id in order to hid when no achiev's are left
|
||||
// Assign a id in order to hide when no achiev's are left
|
||||
tooltip.lastChild.id = 'CMTooltipProductionHeader'; // eslint-disable-line no-param-reassign
|
||||
const production = document.createElement('div');
|
||||
production.id = 'CMTooltipProduction';
|
||||
tooltip.appendChild(production);
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import UpdateTooltips, * as UpdateTooltip from './UpdateTooltips';
|
||||
import { TooltipCreateTooltipBox } from './CreateTooltip';
|
||||
import UpdateTooltips from './UpdateTooltips';
|
||||
import {
|
||||
Beautify,
|
||||
GetTimeColor,
|
||||
GetTimeColour,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import CopyData from '../../Sim/SimulationData/CopyData';
|
||||
import {
|
||||
SimpleTooltipElements,
|
||||
TooltipName,
|
||||
@@ -65,7 +62,7 @@ export function CreateTooltip(type, name) {
|
||||
`so far<br/>• <b>${Beautify(amortizeAmount)}</b> ${
|
||||
Math.floor(amortizeAmount) === 1 ? 'cookie' : 'cookies'
|
||||
} left to amortize (${
|
||||
GetTimeColor(
|
||||
GetTimeColour(
|
||||
(buildPrice - Game.Objects[name].totalCookies) /
|
||||
(Game.Objects[name].storedTotalCps * Game.globalCpsMult),
|
||||
).text
|
||||
@@ -143,8 +140,8 @@ export function CreateTooltip(type, name) {
|
||||
}
|
||||
|
||||
// Sets global variables used by CM.Disp.UpdateTooltip()
|
||||
TooltipType = type;
|
||||
TooltipName = name;
|
||||
TooltipType = type; // eslint-disable-line no-unused-vars
|
||||
TooltipName = name; // eslint-disable-line no-unused-vars
|
||||
|
||||
UpdateTooltips();
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ import { SimObjects } from '../../../Sim/VariablesAndData';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
GetTimeColor,
|
||||
GetTimeColour,
|
||||
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
||||
import {
|
||||
ColorTextPre,
|
||||
ColourTextPre,
|
||||
LastTargetTooltipBuilding,
|
||||
TooltipBonusIncome,
|
||||
TooltipName,
|
||||
@@ -54,22 +54,23 @@ export default function Building() {
|
||||
CMOptions.ScaleSeparator ? ',' : '.'
|
||||
}01% of income)`;
|
||||
}
|
||||
l('CMTooltipBorder').className = ColorTextPre + target[TooltipName].color;
|
||||
l('CMTooltipBorder').className =
|
||||
ColourTextPre + target[TooltipName].color;
|
||||
if (CMOptions.PPDisplayTime)
|
||||
l('CMTooltipPP').textContent = FormatTime(target[TooltipName].pp);
|
||||
else l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
|
||||
l('CMTooltipPP').className = ColorTextPre + target[TooltipName].color;
|
||||
const timeColor = GetTimeColor(
|
||||
l('CMTooltipPP').className = ColourTextPre + target[TooltipName].color;
|
||||
const timeColour = GetTimeColour(
|
||||
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
);
|
||||
l('CMTooltipTime').textContent = timeColor.text;
|
||||
l('CMTooltipTime').textContent = timeColour.text;
|
||||
if (
|
||||
timeColor.text === 'Done!' &&
|
||||
timeColour.text === 'Done!' &&
|
||||
Game.cookies < target[TooltipName].price
|
||||
) {
|
||||
l('CMTooltipTime').textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else l('CMTooltipTime').textContent = timeColor.text;
|
||||
l('CMTooltipTime').className = ColorTextPre + timeColor.color;
|
||||
l('CMTooltipTime').textContent = `${timeColour.text} (with Wrink)`;
|
||||
} else l('CMTooltipTime').textContent = timeColour.text;
|
||||
l('CMTooltipTime').className = ColourTextPre + timeColour.color;
|
||||
}
|
||||
|
||||
// Add "production left till next achievement"-bar
|
||||
|
||||
@@ -16,7 +16,7 @@ export default function GardenPlots() {
|
||||
const mature =
|
||||
minigame.plot[TooltipName[1]][TooltipName[0]][1] >
|
||||
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1]
|
||||
.matureBase;
|
||||
.mature;
|
||||
const plantName =
|
||||
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1]
|
||||
.name;
|
||||
|
||||
@@ -2,11 +2,11 @@ import { CacheNoGoldSwitchCookiesPS } from '../../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import {
|
||||
Beautify,
|
||||
GetTimeColor,
|
||||
GetTimeColour,
|
||||
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import CalculateGrimoireRefillTime from '../../HelperFunctions/CalculateGrimoireRefillTime';
|
||||
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
||||
import { ColorTextPre, TooltipName } from '../../VariablesAndData';
|
||||
import { ColourTextPre, TooltipName } from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
|
||||
/**
|
||||
@@ -25,11 +25,11 @@ export default function Grimoire() {
|
||||
const time = document.createElement('div');
|
||||
time.id = 'CMTooltipTime';
|
||||
tooltipBox.appendChild(time);
|
||||
const timeColor = GetTimeColor(
|
||||
const timeColour = GetTimeColour(
|
||||
CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost),
|
||||
);
|
||||
time.textContent = timeColor.text;
|
||||
time.className = ColorTextPre + timeColor.color;
|
||||
time.textContent = timeColour.text;
|
||||
time.className = ColourTextPre + timeColour.color;
|
||||
|
||||
// Time left untill magic spent is recovered
|
||||
if (spellCost <= minigame.magic) {
|
||||
@@ -37,15 +37,15 @@ export default function Grimoire() {
|
||||
const recover = document.createElement('div');
|
||||
recover.id = 'CMTooltipRecover';
|
||||
tooltipBox.appendChild(recover);
|
||||
const recoverColor = GetTimeColor(
|
||||
const recoverColour = GetTimeColour(
|
||||
CalculateGrimoireRefillTime(
|
||||
Math.max(0, minigame.magic - spellCost),
|
||||
minigame.magicM,
|
||||
minigame.magic,
|
||||
),
|
||||
);
|
||||
recover.textContent = recoverColor.text;
|
||||
recover.className = ColorTextPre + recoverColor.color;
|
||||
recover.textContent = recoverColour.text;
|
||||
recover.className = ColourTextPre + recoverColour.color;
|
||||
}
|
||||
|
||||
// Extra information on cookies gained when spell is Conjure Baked Goods (Name === 0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import GetLumpColor from '../../HelperFunctions/GetLumpColor';
|
||||
import { ColorTextPre } from '../../VariablesAndData';
|
||||
import GetLumpColour from '../../HelperFunctions/GetLumpColour';
|
||||
import { ColourTextPre } from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
/**
|
||||
* This function adds extra info to the Sugar Lump tooltip
|
||||
@@ -15,8 +15,8 @@ export default function SugarLump() {
|
||||
const lumpType = document.createElement('div');
|
||||
lumpType.id = 'CMTooltipTime';
|
||||
tooltipBox.appendChild(lumpType);
|
||||
const lumpColor = GetLumpColor(Game.lumpCurrentType);
|
||||
lumpType.textContent = lumpColor.text;
|
||||
lumpType.className = ColorTextPre + lumpColor.color;
|
||||
const lumpColour = GetLumpColour(Game.lumpCurrentType);
|
||||
lumpType.textContent = lumpColour.text;
|
||||
lumpType.className = ColourTextPre + lumpColour.color;
|
||||
} else l('CMTooltipArea').style.display = 'none';
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import {
|
||||
Beautify,
|
||||
FormatTime,
|
||||
GetTimeColor,
|
||||
GetTimeColour,
|
||||
} from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
|
||||
import {
|
||||
ColorTextPre,
|
||||
ColourTextPre,
|
||||
TooltipBonusIncome,
|
||||
TooltipBonusMouse,
|
||||
TooltipName,
|
||||
@@ -56,7 +56,7 @@ export default function Upgrade() {
|
||||
}01% of income)`;
|
||||
}
|
||||
l('CMTooltipBorder').className =
|
||||
ColorTextPre +
|
||||
ColourTextPre +
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
||||
// If clicking power upgrade
|
||||
if (TooltipBonusMouse) {
|
||||
@@ -81,21 +81,21 @@ export default function Upgrade() {
|
||||
2,
|
||||
);
|
||||
l('CMTooltipPP').className =
|
||||
ColorTextPre +
|
||||
ColourTextPre +
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
||||
}
|
||||
}
|
||||
const timeColor = GetTimeColor(
|
||||
const timeColour = GetTimeColour(
|
||||
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||
);
|
||||
l('CMTooltipTime').textContent = timeColor.text;
|
||||
l('CMTooltipTime').textContent = timeColour.text;
|
||||
if (
|
||||
timeColor.text === 'Done!' &&
|
||||
timeColour.text === 'Done!' &&
|
||||
Game.cookies < Game.UpgradesInStore[TooltipName].getPrice()
|
||||
) {
|
||||
l('CMTooltipTime').textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else l('CMTooltipTime').textContent = timeColor.text;
|
||||
l('CMTooltipTime').className = ColorTextPre + timeColor.color;
|
||||
l('CMTooltipTime').textContent = `${timeColour.text} (with Wrink)`;
|
||||
} else l('CMTooltipTime').textContent = timeColour.text;
|
||||
l('CMTooltipTime').className = ColourTextPre + timeColour.color;
|
||||
|
||||
// Add extra info to Chocolate egg tooltip
|
||||
if (Game.UpgradesInStore[TooltipName].name === 'Chocolate egg') {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable prefer-const */
|
||||
/**
|
||||
* Section: Variables used in Disp functions */
|
||||
|
||||
@@ -7,32 +6,32 @@ export let DispCSS;
|
||||
/**
|
||||
* These are variables used to create DOM object names and id (e.g., 'CMTextTooltip)
|
||||
*/
|
||||
export const ColorTextPre = 'CMText';
|
||||
export const ColorBackPre = 'CMBack';
|
||||
export const ColorBorderPre = 'CMBorder';
|
||||
export const ColourTextPre = 'CMText';
|
||||
export const ColourBackPre = 'CMBack';
|
||||
export const ColourBorderPre = 'CMBorder';
|
||||
|
||||
/**
|
||||
* These are variables which can be set in the options by the user to standardize colours throughout CookieMonster
|
||||
*/
|
||||
export const ColorBlue = 'Blue';
|
||||
export const ColorGreen = 'Green';
|
||||
export const ColorYellow = 'Yellow';
|
||||
export const ColorOrange = 'Orange';
|
||||
export const ColorRed = 'Red';
|
||||
export const ColorPurple = 'Purple';
|
||||
export const ColorGray = 'Gray';
|
||||
export const ColorPink = 'Pink';
|
||||
export const ColorBrown = 'Brown';
|
||||
export const Colors = [
|
||||
ColorGray,
|
||||
ColorBlue,
|
||||
ColorGreen,
|
||||
ColorYellow,
|
||||
ColorOrange,
|
||||
ColorRed,
|
||||
ColorPurple,
|
||||
ColorPink,
|
||||
ColorBrown,
|
||||
export const ColourBlue = 'Blue';
|
||||
export const ColourGreen = 'Green';
|
||||
export const ColourYellow = 'Yellow';
|
||||
export const ColourOrange = 'Orange';
|
||||
export const ColourRed = 'Red';
|
||||
export const ColourPurple = 'Purple';
|
||||
export const ColourGray = 'Gray';
|
||||
export const ColourPink = 'Pink';
|
||||
export const ColourBrown = 'Brown';
|
||||
export const ColoursOrdering = [
|
||||
ColourGray,
|
||||
ColourBlue,
|
||||
ColourGreen,
|
||||
ColourYellow,
|
||||
ColourOrange,
|
||||
ColourRed,
|
||||
ColourPurple,
|
||||
ColourPink,
|
||||
ColourBrown,
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -79,6 +78,11 @@ export const TooltipText = [
|
||||
'Cheated cookies might break this formula',
|
||||
'250px',
|
||||
],
|
||||
[
|
||||
'FavouriteSettingPlaceholder',
|
||||
"Click to set this setting as favourite and show it in 'favourite' settings at the top of the Cookie Monster Settings",
|
||||
'250px',
|
||||
],
|
||||
];
|
||||
export const SimpleTooltipElements = {};
|
||||
|
||||
@@ -86,15 +90,15 @@ export const SimpleTooltipElements = {};
|
||||
* These are variables used by the functions that create tooltips for wrinklers
|
||||
* See CM.Disp.CheckWrinklerTooltip(), CM.Disp.UpdateWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect()
|
||||
*/
|
||||
export let TooltipWrinklerArea = 0;
|
||||
export let TooltipWrinkler = -1;
|
||||
export let TooltipWrinklerArea = 0; // eslint-disable-line prefer-const
|
||||
export let TooltipWrinkler = -1; // eslint-disable-line prefer-const
|
||||
|
||||
/**
|
||||
* This array is used to store whether a Wrinkler tooltip is being shown or not
|
||||
* [i] = 1 means tooltip is being shown, [i] = 0 means hidden
|
||||
* It is used by CM.Disp.CheckWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect()
|
||||
*/
|
||||
export let TooltipWrinklerBeingShown = [];
|
||||
export let TooltipWrinklerBeingShown = []; // eslint-disable-line prefer-const
|
||||
|
||||
export let CMLastAscendState;
|
||||
export let CMSayTime;
|
||||
@@ -102,9 +106,9 @@ export let CMSayTime;
|
||||
/**
|
||||
* These are variables used to create various displays when the game is loaded on the "sell all" screen
|
||||
*/
|
||||
export let LastTargetBotBar = 1;
|
||||
export let LastTargetBuildings = 1;
|
||||
export let LastTargetTooltipBuilding = 1;
|
||||
export let LastTargetBotBar = 1; // eslint-disable-line prefer-const
|
||||
export let LastTargetBuildings = 1; // eslint-disable-line prefer-const
|
||||
export let LastTargetTooltipBuilding = 1; // eslint-disable-line prefer-const
|
||||
|
||||
/**
|
||||
* These arrays are used in the stats page to show
|
||||
@@ -116,24 +120,24 @@ export const ClickTimes = [1, 5, 10, 15, 30];
|
||||
/**
|
||||
* This array is used to give certain timers specific colours
|
||||
*/
|
||||
export const BuffColors = {
|
||||
Frenzy: ColorYellow,
|
||||
'Dragon Harvest': ColorBrown,
|
||||
'Elder frenzy': ColorGreen,
|
||||
Clot: ColorRed,
|
||||
'Click frenzy': ColorBlue,
|
||||
Dragonflight: ColorPink,
|
||||
export const BuffColours = {
|
||||
Frenzy: ColourYellow,
|
||||
'Dragon Harvest': ColourBrown,
|
||||
'Elder frenzy': ColourGreen,
|
||||
Clot: ColourRed,
|
||||
'Click frenzy': ColourBlue,
|
||||
Dragonflight: ColourPink,
|
||||
};
|
||||
|
||||
/**
|
||||
* This array is used to track GC timers
|
||||
*/
|
||||
export let GCTimers = {};
|
||||
export let GCTimers = {}; // eslint-disable-line prefer-const
|
||||
|
||||
/**
|
||||
* Used to store the number of cookies to be displayed in the tab-title
|
||||
*/
|
||||
export let Title = '';
|
||||
export let Title = ''; // eslint-disable-line prefer-const
|
||||
|
||||
export let TooltipPrice;
|
||||
export let TooltipBonusIncome;
|
||||
@@ -143,3 +147,8 @@ export let TooltipBonusMouse;
|
||||
|
||||
export let LastAscendState;
|
||||
export let LastNumberOfTimers;
|
||||
|
||||
/**
|
||||
* This stores the names of settings shown in the favourites section
|
||||
*/
|
||||
export let FavouriteSettings = []; // eslint-disable-line prefer-const
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable prefer-const */
|
||||
/** Variable that shows if Cookie Moonster is initzializing */
|
||||
export let isInitializing = false;
|
||||
export let isInitializing = false; // eslint-disable-line prefer-const
|
||||
export let test;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { VersionMajor, VersionMinor } from '../Data/Moddata';
|
||||
import Draw from '../Disp/Draw';
|
||||
import CMDrawHook from '../Disp/DrawHook';
|
||||
import CMClickHook from '../Main/ClickHook';
|
||||
import InitializeCookieMonster from '../Main/Initialization';
|
||||
import CMLoop from '../Main/Loop';
|
||||
import CMLoopHook from '../Main/LoopHook';
|
||||
import { isInitializing } from './Variables';
|
||||
|
||||
/**
|
||||
@@ -15,14 +15,16 @@ export default function init() {
|
||||
isInitializing = true;
|
||||
let proceed = true;
|
||||
if (Game.version !== Number(VersionMajor)) {
|
||||
// eslint-disable-next-line no-restricted-globals, no-alert
|
||||
proceed = confirm(
|
||||
`Cookie Monster version ${VersionMajor}.${VersionMinor} is meant for Game version ${VersionMajor}. Loading a different version may cause errors. Do you still want to load Cookie Monster?`,
|
||||
);
|
||||
}
|
||||
if (proceed) {
|
||||
InitializeCookieMonster();
|
||||
Game.registerHook('draw', Draw);
|
||||
Game.registerHook('logic', CMLoop);
|
||||
isInitializing = false;
|
||||
Game.registerHook('draw', CMDrawHook);
|
||||
Game.registerHook('logic', CMLoopHook);
|
||||
Game.registerHook('click', CMClickHook);
|
||||
isInitializing = false; // eslint-disable-line no-unused-vars
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings';
|
||||
import { VersionMajor, VersionMinor } from '../Data/Moddata';
|
||||
import { FavouriteSettings } from '../Disp/VariablesAndData';
|
||||
import InitData from '../Sim/InitializeData/InitData';
|
||||
|
||||
/**
|
||||
@@ -9,6 +10,9 @@ import InitData from '../Sim/InitializeData/InitData';
|
||||
export default function load(str) {
|
||||
const save = JSON.parse(str);
|
||||
InitData();
|
||||
// The if-statement is a failsafe for old saves
|
||||
if (typeof save.favouriteSettings !== 'undefined')
|
||||
FavouriteSettings = save.favouriteSettings; // eslint-disable-line no-unused-vars
|
||||
LoadConfig(save.settings);
|
||||
if (save.version !== `${VersionMajor}.${VersionMinor}`) {
|
||||
if (Game.prefs.popups)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { CMOptions } from '../Config/VariablesAndData';
|
||||
import { VersionMajor, VersionMinor } from '../Data/Moddata';
|
||||
import { FavouriteSettings } from '../Disp/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This creates a save function to the CM object. Per Game code/comments:
|
||||
@@ -8,6 +9,7 @@ import { VersionMajor, VersionMinor } from '../Data/Moddata';
|
||||
*/
|
||||
export default function save() {
|
||||
return JSON.stringify({
|
||||
favouriteSettings: FavouriteSettings,
|
||||
settings: CMOptions,
|
||||
version: `${VersionMajor}.${VersionMinor}`,
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function CheckGardenTick() {
|
||||
LastGardenNextStep !== Game.Objects.Farm.minigame.nextStep
|
||||
) {
|
||||
if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) {
|
||||
Flash(3, 'GardFlash');
|
||||
Flash(3, 'GardFlash', false);
|
||||
PlaySound(CMOptions.GardSoundURL, 'GardSound', 'GardVolume', false);
|
||||
}
|
||||
LastGardenNextStep = Game.Objects.Farm.minigame.nextStep;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import {
|
||||
CacheSpawnedGoldenShimmer,
|
||||
CacheGoldenShimmersByID,
|
||||
@@ -49,7 +48,7 @@ export default function CheckGoldenCookie() {
|
||||
LastGoldenCookieState = Game.shimmerTypes.golden.n;
|
||||
if (LastGoldenCookieState) {
|
||||
if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) {
|
||||
Flash(3, 'GCFlash');
|
||||
Flash(3, 'GCFlash', false);
|
||||
PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume', false);
|
||||
CreateNotification(
|
||||
'GCNotification',
|
||||
@@ -66,7 +65,7 @@ export default function CheckGoldenCookie() {
|
||||
}
|
||||
UpdateFavicon();
|
||||
LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState;
|
||||
if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0;
|
||||
if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0; // eslint-disable-line no-unused-vars
|
||||
} else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) {
|
||||
Object.keys(GCTimers).forEach((i) => {
|
||||
GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity;
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function CheckMagicMeter() {
|
||||
if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
|
||||
else if (!LastMagicBarFull) {
|
||||
LastMagicBarFull = true;
|
||||
Flash(3, 'MagicFlash');
|
||||
Flash(3, 'MagicFlash', false);
|
||||
PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume', false);
|
||||
CreateNotification(
|
||||
'MagicNotification',
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CacheSeasonPopShimmer } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import Flash from '../../Disp/Notifications/Flash';
|
||||
@@ -15,10 +14,10 @@ export default function CheckSeasonPopup() {
|
||||
LastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
|
||||
Object.keys(Game.shimmers).forEach((i) => {
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type === 'reindeer') {
|
||||
CacheSeasonPopShimmer = Game.shimmers[i];
|
||||
CacheSeasonPopShimmer = Game.shimmers[i]; // eslint-disable-line no-unused-vars
|
||||
}
|
||||
});
|
||||
Flash(3, 'SeaFlash');
|
||||
Flash(3, 'SeaFlash', false);
|
||||
PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume', false);
|
||||
CreateNotification(
|
||||
'SeaNotification',
|
||||
|
||||
@@ -16,7 +16,7 @@ export default function CheckTickerFortune() {
|
||||
LastTickerFortuneState =
|
||||
Game.TickerEffect && Game.TickerEffect.type === 'fortune';
|
||||
if (LastTickerFortuneState) {
|
||||
Flash(3, 'FortuneFlash');
|
||||
Flash(3, 'FortuneFlash', false);
|
||||
PlaySound(
|
||||
CMOptions.FortuneSoundURL,
|
||||
'FortuneSound',
|
||||
|
||||
@@ -20,9 +20,9 @@ export default function CheckWrinklerCount() {
|
||||
CurrentWrinklers === Game.getWrinklersMax() &&
|
||||
CMOptions.WrinklerMaxFlash
|
||||
) {
|
||||
Flash(3, 'WrinklerMaxFlash');
|
||||
Flash(3, 'WrinklerMaxFlash', false);
|
||||
} else {
|
||||
Flash(3, 'WrinklerFlash');
|
||||
Flash(3, 'WrinklerFlash', false);
|
||||
}
|
||||
if (
|
||||
CurrentWrinklers === Game.getWrinklersMax() &&
|
||||
|
||||
6
src/Main/ClickHook.js
Normal file
6
src/Main/ClickHook.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import { CacheAverageCookiesFromClicks } from '../Cache/VariablesAndData';
|
||||
|
||||
export default function CMClickHook() {
|
||||
// Add cookies from click to array that stores average
|
||||
CacheAverageCookiesFromClicks.addLatest(Game.computedMouseCps);
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import InitCache from '../Cache/CacheInit';
|
||||
import { CacheStatsCookies } from '../Cache/Stats/Stats';
|
||||
import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings';
|
||||
@@ -10,7 +9,7 @@ import CreateSectionHideButtons from '../Disp/Initialization/CreateSectionHideBu
|
||||
import CreateWrinklerButtons from '../Disp/Initialization/CreateWrinklerButton';
|
||||
import CreateCssArea from '../Disp/Initialization/CssArea';
|
||||
import UpdateBuildingUpgradeStyle from '../Disp/Initialization/UpdateBuildingUpgradeStyle';
|
||||
import CreateWhiteScreen from '../Disp/Initialization/WhiteScreen';
|
||||
import CreateFlashScreen from '../Disp/Initialization/FlashScreen';
|
||||
import { CreateFavicon } from '../Disp/TabTitle/FavIcon';
|
||||
import { CreateSimpleTooltip } from '../Disp/Tooltips/Tooltip';
|
||||
import { CMLastAscendState, TooltipText } from '../Disp/VariablesAndData';
|
||||
@@ -30,14 +29,14 @@ export default function InitializeCookieMonster() {
|
||||
InitCache();
|
||||
|
||||
// Stored to check if we need to re-initiliaze data
|
||||
LastModCount = Object.keys(Game.mods).length;
|
||||
LastModCount = Object.keys(Game.mods).length; // eslint-disable-line no-unused-vars
|
||||
|
||||
// Creating visual elements
|
||||
CreateCssArea();
|
||||
CreateBotBar();
|
||||
CreateTimerBar();
|
||||
CreateUpgradeBar();
|
||||
CreateWhiteScreen();
|
||||
CreateFlashScreen();
|
||||
CreateSectionHideButtons();
|
||||
CreateFavicon();
|
||||
Object.keys(TooltipText).forEach((i) => {
|
||||
@@ -58,8 +57,8 @@ export default function InitializeCookieMonster() {
|
||||
ReplaceNativeGrimoire();
|
||||
Game.CalculateGains();
|
||||
|
||||
LoadConfig(); // Must be after all things are created!
|
||||
CMLastAscendState = Game.OnAscend;
|
||||
LoadConfig();
|
||||
CMLastAscendState = Game.OnAscend; // eslint-disable-line no-unused-vars
|
||||
|
||||
if (Game.prefs.popups)
|
||||
Game.Popup(
|
||||
|
||||
@@ -35,7 +35,7 @@ import { LastModCount } from './VariablesAndData';
|
||||
* Main loop of Cookie Monster
|
||||
* CM.init registers it to the "logic" hook provided by the modding api
|
||||
*/
|
||||
export default function CMLoop() {
|
||||
export default function CMLoopHook() {
|
||||
if (LastAscendState !== Game.OnAscend) {
|
||||
LastAscendState = Game.OnAscend;
|
||||
UpdateAscendState();
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { FormatTime } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting';
|
||||
|
||||
@@ -47,8 +46,8 @@ function ReplaceNativeGrimoireLaunch() {
|
||||
Game.Objects['Wizard tower'].minigameLoaded
|
||||
) {
|
||||
const { minigame } = Game.Objects['Wizard tower'];
|
||||
BackupGrimoireLaunch = minigame.launch;
|
||||
BackupGrimoireLaunchMod = new Function(
|
||||
BackupGrimoireLaunch = minigame.launch; // eslint-disable-line no-unused-vars
|
||||
BackupGrimoireLaunchMod = new Function( // eslint-disable-line no-new-func
|
||||
`return ${minigame.launch
|
||||
.toString()
|
||||
.split('=this')
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable no-unused-vars */
|
||||
/** Functions related to replacing tooltips */
|
||||
|
||||
import { CreateTooltip } from '../../Disp/Tooltips/Tooltip';
|
||||
@@ -39,7 +37,7 @@ function ReplaceTooltipBuild() {
|
||||
*/
|
||||
function ReplaceTooltipLump() {
|
||||
if (Game.canLumps()) {
|
||||
TooltipLumpBackup = l('lumps').onmouseover;
|
||||
TooltipLumpBackup = l('lumps').onmouseover; // eslint-disable-line no-unused-vars
|
||||
l('lumps').onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
@@ -72,6 +70,7 @@ function ReplaceTooltipGarden() {
|
||||
};
|
||||
Array.from(l('gardenPlot').children).forEach((child) => {
|
||||
const coords = child.id.slice(-3);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
child.onmouseover = function () {
|
||||
Game.tooltip.dynamic = 1;
|
||||
Game.tooltip.draw(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import jscolor from '@eastdesire/jscolor';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
@@ -13,7 +12,11 @@ import UpdateTooltipLocation from '../../Disp/Tooltips/PositionLocation';
|
||||
import { CMSayTime, Title } from '../../Disp/VariablesAndData';
|
||||
import { SimDoSims } from '../../Sim/VariablesAndData';
|
||||
import ReplaceTooltipUpgrade from '../ReplaceGameElements/TooltipUpgrades';
|
||||
import { BackupFunctions } from '../VariablesAndData';
|
||||
import {
|
||||
BackupFunctions,
|
||||
CenturyDateAtBeginLoop,
|
||||
CycliusDateAtBeginLoop,
|
||||
} from '../VariablesAndData';
|
||||
import FixMouseY from './FixMouse';
|
||||
|
||||
/**
|
||||
@@ -28,12 +31,14 @@ export default function ReplaceNative() {
|
||||
BackupFunctions.CalculateGains = Game.CalculateGains;
|
||||
Game.CalculateGains = function () {
|
||||
BackupFunctions.CalculateGains();
|
||||
SimDoSims = 1;
|
||||
SimDoSims = 1; // eslint-disable-line no-unused-vars
|
||||
CycliusDateAtBeginLoop = Date.now(); // eslint-disable-line no-unused-vars
|
||||
CenturyDateAtBeginLoop = Date.now(); // eslint-disable-line no-unused-vars
|
||||
};
|
||||
|
||||
BackupFunctions.tooltip = {};
|
||||
BackupFunctions.tooltip.draw = Game.tooltip.draw;
|
||||
BackupFunctions.tooltip.drawMod = new Function(
|
||||
BackupFunctions.tooltip.drawMod = new Function( // eslint-disable-line no-new-func
|
||||
`return ${Game.tooltip.draw.toString().split('this').join('Game.tooltip')}`,
|
||||
)();
|
||||
Game.tooltip.draw = function (from, text, origin) {
|
||||
@@ -41,7 +46,7 @@ export default function ReplaceNative() {
|
||||
};
|
||||
|
||||
BackupFunctions.tooltip.update = Game.tooltip.update;
|
||||
BackupFunctions.tooltip.updateMod = new Function(
|
||||
BackupFunctions.tooltip.updateMod = new Function( // eslint-disable-line no-new-func
|
||||
`return ${Game.tooltip.update
|
||||
.toString()
|
||||
.split('this.')
|
||||
@@ -126,6 +131,7 @@ export default function ReplaceNative() {
|
||||
};
|
||||
|
||||
BackupFunctions.sayTime = Game.sayTime;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
CMSayTime = function (time, detail) {
|
||||
if (Number.isNaN(time) || time <= 0)
|
||||
return BackupFunctions.sayTime(time, detail);
|
||||
@@ -139,6 +145,7 @@ export default function ReplaceNative() {
|
||||
// Update tab title
|
||||
let title = 'Cookie Clicker';
|
||||
if (Game.season === 'fools') title = 'Cookie Baker';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
Title = `${Game.OnAscend ? 'Ascending! ' : ''}${CMBeautify(Game.cookies)} ${
|
||||
Game.cookies === 1 ? 'cookie' : 'cookies'
|
||||
} - ${title}`;
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
/* eslint-disable prefer-const */
|
||||
|
||||
export let LastModCount;
|
||||
export let TooltipBuildBackup = [];
|
||||
export let TooltipBuildBackup = []; // eslint-disable-line prefer-const
|
||||
export let TooltipLumpBackup;
|
||||
export let TooltipGrimoireBackup = [];
|
||||
export let TooltipUpgradeBackup = [];
|
||||
export let TooltipGrimoireBackup = []; // eslint-disable-line prefer-const
|
||||
export let TooltipUpgradeBackup = []; // eslint-disable-line prefer-const
|
||||
export let BackupGrimoireLaunch;
|
||||
export let BackupGrimoireLaunchMod;
|
||||
export let BackupGrimoireDraw;
|
||||
export let HasReplaceNativeGrimoireLaunch;
|
||||
export let HasReplaceNativeGrimoireDraw;
|
||||
export let LoadMinigames;
|
||||
export let BackupFunctions = {};
|
||||
export let BackupFunctions = {}; // eslint-disable-line prefer-const
|
||||
|
||||
export let LastSeasonPopupState;
|
||||
export let LastTickerFortuneState;
|
||||
@@ -21,3 +19,11 @@ export let LastSpawnedGoldenCookieState;
|
||||
export let LastMagicBarFull;
|
||||
export let CurrSpawnedGoldenCookieState;
|
||||
export let LastWrinklerCount;
|
||||
|
||||
/** Stores the date at Game.CalculateGains for God Cyclius
|
||||
*/
|
||||
export let CycliusDateAtBeginLoop = Date.now(); // eslint-disable-line prefer-const
|
||||
|
||||
/** Stores the date at Game.CalculateGains for the Century egg
|
||||
*/
|
||||
export let CenturyDateAtBeginLoop = Date.now(); // eslint-disable-line prefer-const
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import {
|
||||
TooltipWrinklerArea,
|
||||
TooltipWrinklerBeingShown,
|
||||
@@ -13,7 +12,7 @@ export default function AddWrinklerAreaDetect() {
|
||||
TooltipWrinklerArea = 1;
|
||||
};
|
||||
l('backgroundLeftCanvas').onmouseout = function () {
|
||||
TooltipWrinklerArea = 0;
|
||||
TooltipWrinklerArea = 0; // eslint-disable-line no-unused-vars
|
||||
Game.tooltip.hide();
|
||||
Object.keys(Game.wrinklers).forEach((i) => {
|
||||
TooltipWrinklerBeingShown[i] = 0;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import GetCPSBuffMult from '../../Cache/CPS/GetCPSBuffMult';
|
||||
import { CacheCentEgg } from '../../Cache/VariablesAndData';
|
||||
import {
|
||||
CenturyDateAtBeginLoop,
|
||||
CycliusDateAtBeginLoop,
|
||||
} from '../../Main/VariablesAndData';
|
||||
import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult';
|
||||
import SimEff from '../ReplacedGameFunctions/SimEff';
|
||||
import SimGetHeavenlyMultiplier from '../ReplacedGameFunctions/SimGetHeavenlyMultiplier';
|
||||
@@ -38,7 +41,7 @@ export default function CalculateGains() {
|
||||
});
|
||||
}
|
||||
});
|
||||
SimEffs = effs;
|
||||
SimEffs = effs; // eslint-disable-line no-unused-vars
|
||||
|
||||
if (Game.ascensionMode !== 1)
|
||||
mult +=
|
||||
@@ -92,13 +95,25 @@ export default function CalculateGains() {
|
||||
godLvl = SimHasGod('ages');
|
||||
if (godLvl === 1)
|
||||
mult *=
|
||||
1 + 0.15 * Math.sin((Date.now() / 1000 / (60 * 60 * 3)) * Math.PI * 2);
|
||||
1 +
|
||||
0.15 *
|
||||
Math.sin(
|
||||
(CycliusDateAtBeginLoop / 1000 / (60 * 60 * 3)) * Math.PI * 2,
|
||||
);
|
||||
else if (godLvl === 2)
|
||||
mult *=
|
||||
1 + 0.15 * Math.sin((Date.now() / 1000 / (60 * 60 * 12)) * Math.PI * 2);
|
||||
1 +
|
||||
0.15 *
|
||||
Math.sin(
|
||||
(CycliusDateAtBeginLoop / 1000 / (60 * 60 * 12)) * Math.PI * 2,
|
||||
);
|
||||
else if (godLvl === 3)
|
||||
mult *=
|
||||
1 + 0.15 * Math.sin((Date.now() / 1000 / (60 * 60 * 24)) * Math.PI * 2);
|
||||
1 +
|
||||
0.15 *
|
||||
Math.sin(
|
||||
(CycliusDateAtBeginLoop / 1000 / (60 * 60 * 24)) * Math.PI * 2,
|
||||
);
|
||||
|
||||
godLvl = SimHasGod('decadence');
|
||||
if (godLvl === 1) buildMult *= 0.93;
|
||||
@@ -189,7 +204,7 @@ export default function CalculateGains() {
|
||||
if (SimHas('Century egg')) {
|
||||
// The boost increases a little every day, with diminishing returns up to +10% on the 100th day
|
||||
let day =
|
||||
(Math.floor((Date.now() - Game.startDate) / 1000 / 10) * 10) /
|
||||
(Math.floor((CenturyDateAtBeginLoop - Game.startDate) / 1000 / 10) * 10) /
|
||||
60 /
|
||||
60 /
|
||||
24;
|
||||
@@ -211,7 +226,7 @@ export default function CalculateGains() {
|
||||
SimWin(Game.CpsAchievements[i].name);
|
||||
});
|
||||
|
||||
SimCookiesPsRaw = rawCookiesPs;
|
||||
SimCookiesPsRaw = rawCookiesPs; // eslint-disable-line no-unused-vars
|
||||
|
||||
const { n } = Game.shimmerTypes.golden;
|
||||
const auraMult = SimAuraMult("Dragon's Fortune");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import CacheDragonAuras from '../../Cache/Dragon/CacheDragonAuras';
|
||||
import {
|
||||
CacheDragonAura,
|
||||
@@ -30,11 +29,11 @@ import {
|
||||
*/
|
||||
export default function CopyData() {
|
||||
// Other variables
|
||||
SimUpgradesOwned = Game.UpgradesOwned;
|
||||
SimPledges = Game.pledges;
|
||||
SimAchievementsOwned = Game.AchievementsOwned;
|
||||
SimHeavenlyPower = Game.heavenlyPower;
|
||||
SimPrestige = Game.prestige;
|
||||
SimUpgradesOwned = Game.UpgradesOwned; // eslint-disable-line no-unused-vars
|
||||
SimPledges = Game.pledges; // eslint-disable-line no-unused-vars
|
||||
SimAchievementsOwned = Game.AchievementsOwned; // eslint-disable-line no-unused-vars
|
||||
SimHeavenlyPower = Game.heavenlyPower; // eslint-disable-line no-unused-vars
|
||||
SimPrestige = Game.prestige; // eslint-disable-line no-unused-vars
|
||||
|
||||
// Buildings
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
@@ -53,9 +52,9 @@ export default function CopyData() {
|
||||
you.free = me.free;
|
||||
if (me.minigameLoaded) {
|
||||
if (me.name === 'Temple') {
|
||||
SimGod1 = me.minigame.slot[0];
|
||||
SimGod2 = me.minigame.slot[1];
|
||||
SimGod3 = me.minigame.slot[2];
|
||||
SimGod1 = me.minigame.slot[0]; // eslint-disable-line no-unused-vars
|
||||
SimGod2 = me.minigame.slot[1]; // eslint-disable-line no-unused-vars
|
||||
SimGod3 = me.minigame.slot[2]; // eslint-disable-line no-unused-vars
|
||||
}
|
||||
you.minigameLoaded = me.minigameLoaded;
|
||||
you.minigame = me.minigame;
|
||||
@@ -89,6 +88,6 @@ export default function CopyData() {
|
||||
|
||||
// Auras
|
||||
CacheDragonAuras();
|
||||
SimDragonAura = CacheDragonAura;
|
||||
SimDragonAura2 = CacheDragonAura2;
|
||||
SimDragonAura = CacheDragonAura; // eslint-disable-line no-unused-vars
|
||||
SimDragonAura2 = CacheDragonAura2; // eslint-disable-line no-unused-vars
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { SimAchievements, SimAchievementsOwned } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -11,7 +10,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 += 1;
|
||||
if (Game.Achievements[what].pool !== 'shadow') SimAchievementsOwned += 1; // eslint-disable-line no-unused-vars
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import {
|
||||
CacheDragonAura,
|
||||
CacheDragonAura2,
|
||||
@@ -38,10 +37,10 @@ export default function CalculateChangeAura(aura) {
|
||||
SimDragonAura2 !== CacheDragonAura2
|
||||
) {
|
||||
for (let i = Game.ObjectsById.length - 1; i > -1; --i) {
|
||||
if (Game.ObjectsById[i - 1].amount > 0) {
|
||||
if (Game.ObjectsById[i].amount > 0) {
|
||||
const highestBuilding = SimObjects[Game.ObjectsById[i].name].name;
|
||||
SimObjects[highestBuilding].amount -= 1;
|
||||
SimBuildingsOwned -= 1;
|
||||
SimBuildingsOwned -= 1; // eslint-disable-line no-unused-vars
|
||||
price =
|
||||
SimObjects[highestBuilding].basePrice *
|
||||
Game.priceIncrease **
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user