Merge pull request #887 from DanielNoord/framework

Start using the CookieMonsterFramework
This commit is contained in:
Daniël van Noord
2021-07-11 12:57:12 +02:00
committed by GitHub
99 changed files with 1254 additions and 1070 deletions

View File

@@ -3,9 +3,13 @@ on: pull_request
jobs: jobs:
Check_linting_test_and_build: Check_linting_test_and_build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps: steps:
- name: Check out repository code - uses: actions/checkout@v2
uses: actions/checkout@v2 - uses: actions/setup-node@v2
with:
node-version: 12
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Run ESLint - name: Run ESLint

4
.npmrc Normal file
View File

@@ -0,0 +1,4 @@
always-auth=true
registry=https://registry.npmjs.org/
@cookiemonsterteam:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

825
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -70,6 +70,7 @@
"name": "Cookie Monster" "name": "Cookie Monster"
}, },
"dependencies": { "dependencies": {
"@eastdesire/jscolor": "^2.4.5" "@eastdesire/jscolor": "^2.4.5",
"@cookiemonsterteam/cookiemonsterframework": "^0.1.0"
} }
} }

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData'; import { ClickTimes, CookieTimes } from '../../Disp/VariablesAndData';
import { import {
CacheAverageClicks, // eslint-disable-line no-unused-vars CacheAverageClicks, // eslint-disable-line no-unused-vars
@@ -67,23 +66,31 @@ export default function CacheAvgCPS() {
CacheLastClicks = Game.cookieClicks; CacheLastClicks = Game.cookieClicks;
// Get average gain over period of cpsLength seconds // Get average gain over period of cpsLength seconds
const cpsLength = CookieTimes[CMOptions.AvgCPSHist]; const cpsLength =
CookieTimes[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist];
CacheAverageGainBank = CookiesDiff.calcAverage(cpsLength); CacheAverageGainBank = CookiesDiff.calcAverage(cpsLength);
CacheAverageGainWrink = WrinkDiff.calcAverage(cpsLength); CacheAverageGainWrink = WrinkDiff.calcAverage(cpsLength);
CacheAverageGainWrinkFattest = WrinkFattestDiff.calcAverage(cpsLength); CacheAverageGainWrinkFattest = WrinkFattestDiff.calcAverage(cpsLength);
CacheAverageGainChoEgg = ChoEggDiff.calcAverage(cpsLength); CacheAverageGainChoEgg = ChoEggDiff.calcAverage(cpsLength);
CacheAverageCPS = CacheAverageGainBank; CacheAverageCPS = CacheAverageGainBank;
if (CMOptions.CalcWrink === 1) CacheAverageCPS += CacheAverageGainWrink; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 1)
if (CMOptions.CalcWrink === 2) CacheAverageCPS += CacheAverageGainWrinkFattest; CacheAverageCPS += CacheAverageGainWrink;
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 2)
CacheAverageCPS += CacheAverageGainWrinkFattest;
const choEgg = Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg'); const choEgg = Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
if (choEgg || CMOptions.CalcWrink === 0) { if (
choEgg ||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 0
) {
CacheAvgCPSWithChoEgg = CacheAvgCPSWithChoEgg =
CacheAverageGainBank + CacheAverageGainWrink + (choEgg ? CacheAverageGainChoEgg : 0); CacheAverageGainBank + CacheAverageGainWrink + (choEgg ? CacheAverageGainChoEgg : 0);
} else CacheAvgCPSWithChoEgg = CacheAverageCPS; } else CacheAvgCPSWithChoEgg = CacheAverageCPS;
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
CacheAverageClicks = ClicksDiff.calcAverage(ClickTimes[CMOptions.AvgClicksHist]); CacheAverageClicks = ClicksDiff.calcAverage(
ClickTimes[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist],
);
} }
} }

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank'; import GetWrinkConfigBank from '../../Disp/HelperFunctions/GetWrinkConfigBank';
import { ColourGray } from '../../Disp/VariablesAndData'; import { ColourGray } from '../../Disp/VariablesAndData';
import { import {
@@ -18,14 +17,21 @@ import ColourOfPP from './ColourOfPP';
*/ */
function CacheColour(target, amount) { function CacheColour(target, amount) {
Object.keys(target).forEach((i) => { Object.keys(target).forEach((i) => {
if (CMOptions.PPRigidelMode && amount === 1) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode &&
amount === 1
) {
target[i].color = ColourGray; // eslint-disable-line no-param-reassign target[i].color = ColourGray; // eslint-disable-line no-param-reassign
return; return;
} }
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
target[i].color = ColourOfPP(target[i], Game.Objects[i].getSumPrice(amount)); target[i].color = ColourOfPP(target[i], Game.Objects[i].getSumPrice(amount));
// Colour based on excluding certain top-buildings // Colour based on excluding certain top-buildings
for (let j = 0; j < CMOptions.PPExcludeTop; j++) { for (
let j = 0;
j < Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop;
j++
) {
if (target[i].pp === CachePPArray[j][0]) target[i].color = ColourGray; // eslint-disable-line no-param-reassign if (target[i].pp === CachePPArray[j][0]) target[i].color = ColourGray; // eslint-disable-line no-param-reassign
} }
}); });
@@ -39,7 +45,12 @@ function CachePP(target, amount) {
Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs + Math.max(price - (Game.cookies + GetWrinkConfigBank()), 0) / Game.cookiesPs +
price / target[i].bonus; price / target[i].bonus;
} else target[i].pp = price / target[i].bonus; // eslint-disable-line no-param-reassign } else target[i].pp = price / target[i].bonus; // eslint-disable-line no-param-reassign
if (!(CMOptions.PPRigidelMode && amount === 1)) if (
!(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode &&
amount === 1
)
)
CachePPArray.push([target[i].pp, amount, price]); CachePPArray.push([target[i].pp, amount, price]);
}); });
} }
@@ -51,7 +62,11 @@ function CachePP(target, amount) {
export default function CacheBuildingsPP() { export default function CacheBuildingsPP() {
CacheMinPP = Infinity; CacheMinPP = Infinity;
CachePPArray = []; CachePPArray = [];
if (typeof CMOptions.PPExcludeTop === 'undefined') CMOptions.PPExcludeTop = 0; // Otherwise breaks during initialization if (
typeof Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop ===
'undefined'
)
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop = 0; // Otherwise breaks during initialization
// Calculate PP and colors // Calculate PP and colors
CachePP(CacheObjects1, 1); CachePP(CacheObjects1, 1);
@@ -60,8 +75,8 @@ export default function CacheBuildingsPP() {
// Set CM.Cache.min to best non-excluded buidliung // Set CM.Cache.min to best non-excluded buidliung
CachePPArray.sort((a, b) => a[0] - b[0]); CachePPArray.sort((a, b) => a[0] - b[0]);
let indexOfMin = CMOptions.PPExcludeTop; let indexOfMin = Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop;
if (CMOptions.PPOnlyConsiderBuyable) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPOnlyConsiderBuyable) {
while (CachePPArray[indexOfMin][2] > Game.cookies) { while (CachePPArray[indexOfMin][2] > Game.cookies) {
indexOfMin += 1; indexOfMin += 1;
if (CachePPArray.length === indexOfMin + 1) { if (CachePPArray.length === indexOfMin + 1) {

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import GetCPS from '../../Disp/HelperFunctions/GetCPS'; import GetCPS from '../../Disp/HelperFunctions/GetCPS';
import { import {
ColourBlue, ColourBlue,
@@ -30,11 +29,21 @@ export default function ColourOfPP(me, price) {
else color = ColourPurple; else color = ColourPurple;
// Colour based on price in terms of CPS // Colour based on price in terms of CPS
if (Number(CMOptions.PPSecondsLowerLimit) !== 0) { if (
if (price / GetCPS() < Number(CMOptions.PPSecondsLowerLimit)) color = ColourBlue; Number(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPSecondsLowerLimit,
) !== 0
) {
if (
price / GetCPS() <
Number(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPSecondsLowerLimit,
)
)
color = ColourBlue;
} }
// Colour based on being able to purchase // Colour based on being able to purchase
if (CMOptions.PPOnlyConsiderBuyable) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPOnlyConsiderBuyable) {
if (price - Game.cookies > 0) color = ColourRed; if (price - Game.cookies > 0) color = ColourRed;
} }
return color; return color;

View File

@@ -1,6 +1,5 @@
/** Section: Functions related to caching income */ /** Section: Functions related to caching income */
import { CMOptions } from '../../Config/VariablesAndData';
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding'; import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome'; import BuyBuildingsBonusIncome from '../../Sim/SimulationEvents/BuyBuildingBonusIncome';
import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades'; import BuyUpgradesBonusIncome from '../../Sim/SimulationEvents/BuyUpgrades';
@@ -44,8 +43,10 @@ function CacheUpgradeIncome() {
const bonusIncome = BuyUpgradesBonusIncome(i); const bonusIncome = BuyUpgradesBonusIncome(i);
if (i === 'Elder Pledge') { if (i === 'Elder Pledge') {
CacheUpgrades[i] = { bonus: Game.cookiesPs - CacheAverageGainBank }; CacheUpgrades[i] = { bonus: Game.cookiesPs - CacheAverageGainBank };
if (CMOptions.CalcWrink === 1) CacheUpgrades[i].bonus -= CacheAverageGainWrink; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 1)
else if (CMOptions.CalcWrink === 2) CacheUpgrades[i].bonus -= CacheAverageGainWrinkFattest; CacheUpgrades[i].bonus -= CacheAverageGainWrink;
else if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 2)
CacheUpgrades[i].bonus -= CacheAverageGainWrinkFattest;
if (!Number.isFinite(CacheUpgrades[i].bonus)) CacheUpgrades[i].bonus = 0; if (!Number.isFinite(CacheUpgrades[i].bonus)) CacheUpgrades[i].bonus = 0;
} else { } else {
CacheUpgrades[i] = {}; CacheUpgrades[i] = {};

View File

@@ -1,77 +0,0 @@
import ConfigDefault from '../../Data/SettingsDefault.ts';
import ConfigData from '../../Data/SettingsData';
import { CMOptions } from '../VariablesAndData';
import save from '../../InitSaveLoad/save';
import CMLoopHook from '../../Main/LoopHook';
import UpdateColours from '../../Disp/HelperFunctions/UpdateColours';
/** Functions related to saving, loading and restoring all settings */
/**
* This function saves the config of CookieMonster without saving any of the other save-data
* This allows saving in between the autosave intervals
* It is called by CM.Config.LoadConfig(), CM.Config.RestoreDefault(), CM.Config.ToggleConfig(),
* CM.ToggleConfigVolume() and changes in options with type "url", "color" or "numscale"
*/
export function SaveConfig() {
const saveString = b64_to_utf8(
unescape(localStorage.getItem('CookieClickerGame')).split('!END!')[0],
);
const CookieMonsterSave = saveString.match(/CookieMonster.*(;|$)/);
if (CookieMonsterSave !== null) {
const newSaveString = saveString.replace(CookieMonsterSave[0], `CookieMonster:${save()}`);
localStorage.setItem('CookieClickerGame', escape(`${utf8_to_b64(newSaveString)}!END!`));
}
}
/**
* This function loads the config of CookieMonster saved in localStorage and loads it into CMOptions
* It is called by CM.Main.DelayInit() and CM.Config.RestoreDefault()
*/
export function LoadConfig(settings) {
// This removes cookies left from earlier versions of CookieMonster
if (typeof localStorage.CMConfig !== 'undefined') {
delete localStorage.CMConfig;
}
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') {
Object.keys(ConfigDefault.Header).forEach((j) => {
if (
typeof CMOptions[i][j] === 'undefined' ||
!(CMOptions[i][j] > -1 && CMOptions[i][j] < 2)
) {
mod = true;
CMOptions[i][j] = ConfigDefault[i][j];
}
});
}
});
if (mod) SaveConfig();
CMLoopHook(); // Do loop once
Object.keys(ConfigDefault).forEach((i) => {
if (i !== 'Header' && typeof ConfigData[i].func !== 'undefined') {
ConfigData[i].func();
}
});
} else {
// Default values
LoadConfig(ConfigDefault);
}
Game.UpdateMenu();
UpdateColours();
}

View File

@@ -1,26 +1,35 @@
/** Called by the "func" of individual settings */ /** Called by the "func" of individual settings */
import UpdateBackground from '../Disp/HelperFunctions/UpdateBackground'; import UpdateBackground from '../Disp/HelperFunctions/UpdateBackground';
import { CMOptions } from './VariablesAndData';
/** /**
* This function changes the position of both the bottom and timer bar * This function changes the position of both the bottom and timer bar
*/ */
export function UpdateBotTimerBarPosition() { export function UpdateBotTimerBarPosition() {
if (CMOptions.BotBar === 1 && CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 1) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar === 1 &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1 &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos === 1
) {
l('CMBotBar').style.bottom = l('CMTimerBar').style.height; l('CMBotBar').style.bottom = l('CMTimerBar').style.height;
l('game').style.bottom = `${Number(l('CMTimerBar').style.height.replace('px', '')) + 70}px`; l('game').style.bottom = `${Number(l('CMTimerBar').style.height.replace('px', '')) + 70}px`;
} else if (CMOptions.BotBar === 1) { } else if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar === 1) {
l('CMBotBar').style.bottom = '0px'; l('CMBotBar').style.bottom = '0px';
l('game').style.bottom = '70px'; l('game').style.bottom = '70px';
} else if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 1) { } else if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1 &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos === 1
) {
l('game').style.bottom = l('CMTimerBar').style.height; l('game').style.bottom = l('CMTimerBar').style.height;
} else { } else {
// No bars // No bars
l('game').style.bottom = '0px'; l('game').style.bottom = '0px';
} }
if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 0) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1 &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos === 0
) {
l('sectionLeft').style.top = l('CMTimerBar').style.height; l('sectionLeft').style.top = l('CMTimerBar').style.height;
} else { } else {
l('sectionLeft').style.top = ''; l('sectionLeft').style.top = '';
@@ -33,7 +42,8 @@ export function UpdateBotTimerBarPosition() {
* This function changes the visibility of the timer bar * This function changes the visibility of the timer bar
*/ */
export function ToggleTimerBar() { export function ToggleTimerBar() {
if (CMOptions.TimerBar === 1) l('CMTimerBar').style.display = ''; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1)
l('CMTimerBar').style.display = '';
else l('CMTimerBar').style.display = 'none'; else l('CMTimerBar').style.display = 'none';
UpdateBotTimerBarPosition(); UpdateBotTimerBarPosition();
} }
@@ -42,7 +52,7 @@ export function ToggleTimerBar() {
* This function changes the position of the timer bar * This function changes the position of the timer bar
*/ */
export function ToggleTimerBarPos() { export function ToggleTimerBarPos() {
if (CMOptions.TimerBarPos === 0) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos === 0) {
l('CMTimerBar').style.width = '30%'; l('CMTimerBar').style.width = '30%';
l('CMTimerBar').style.bottom = ''; l('CMTimerBar').style.bottom = '';
l('game').insertBefore(l('CMTimerBar'), l('sectionLeft')); l('game').insertBefore(l('CMTimerBar'), l('sectionLeft'));

View File

@@ -1,6 +1,5 @@
import ConfigData from '../Data/SettingsData'; import saveFramework from '@cookiemonsterteam/cookiemonsterframework/src/saveDataFunctions/saveFramework';
import { SaveConfig } from './SaveLoadReload/SaveLoadReloadSettings'; import settings from '../Data/settings';
import { CMOptions } from './VariablesAndData';
/** Functions related to toggling or changing an individual setting */ /** Functions related to toggling or changing an individual setting */
@@ -13,18 +12,21 @@ export const ConfigPrefix = 'CMConfig';
* @param {string} config The name of the option * @param {string} config The name of the option
*/ */
export function ToggleConfig(config) { export function ToggleConfig(config) {
CMOptions[config] += 1; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config] += 1;
if (CMOptions[config] === ConfigData[config].label.length) { if (
CMOptions[config] = 0; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config] ===
if (ConfigData[config].toggle) l(ConfigPrefix + config).className = 'option off'; settings[config].label.length
) {
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config] = 0;
if (settings[config].toggle) l(ConfigPrefix + config).className = 'option off';
} else l(ConfigPrefix + config).className = 'option'; } else l(ConfigPrefix + config).className = 'option';
if (typeof ConfigData[config].func !== 'undefined') { if (typeof settings[config].func !== 'undefined') {
ConfigData[config].func(); settings[config].func();
} }
SaveConfig(); saveFramework();
} }
/** /**
@@ -35,9 +37,11 @@ export function ToggleConfig(config) {
export function ToggleConfigVolume(config) { export function ToggleConfigVolume(config) {
if (l(`slider${config}`) !== null) { if (l(`slider${config}`) !== null) {
l(`slider${config}right`).innerHTML = `${l(`slider${config}`).value}%`; l(`slider${config}right`).innerHTML = `${l(`slider${config}`).value}%`;
CMOptions[config] = Math.round(l(`slider${config}`).value); Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config] = Math.round(
l(`slider${config}`).value,
);
} }
SaveConfig(); saveFramework();
} }
/** /**
@@ -46,7 +50,8 @@ export function ToggleConfigVolume(config) {
* @param {string} config The name of the header * @param {string} config The name of the header
*/ */
export function ToggleHeader(config) { export function ToggleHeader(config) {
CMOptions.Header[config] += 1; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[config] += 1;
if (CMOptions.Header[config] > 1) CMOptions.Header[config] = 0; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[config] > 1)
SaveConfig(); Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[config] = 0;
saveFramework();
} }

View File

@@ -1,13 +1,12 @@
import { UpdateBotBar } from '../../Disp/InfoBars/BottomBar'; import { UpdateBotBar } from '../../Disp/InfoBars/BottomBar';
import { UpdateBotTimerBarPosition } from '../SpecificToggles'; import { UpdateBotTimerBarPosition } from '../SpecificToggles';
import { CMOptions } from '../VariablesAndData';
/** /**
* This function toggle the bottom bar * This function toggle the bottom bar
* It is called by CM.Disp.UpdateAscendState() and a change in CMOptions.BotBar * It is called by CM.Disp.UpdateAscendState() and a change in Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar
*/ */
export default function ToggleBotBar() { export default function ToggleBotBar() {
if (CMOptions.BotBar === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar === 1) {
l('CMBotBar').style.display = ''; l('CMBotBar').style.display = '';
UpdateBotBar(); UpdateBotBar();
} else { } else {

View File

@@ -1,12 +1,12 @@
import { CMSayTime } from '../../Disp/VariablesAndData'; import { CMSayTime } from '../../Disp/VariablesAndData';
import { BackupFunctions } from '../../Main/VariablesAndData'; import { BackupFunctions } from '../../Main/VariablesAndData';
import { CMOptions } from '../VariablesAndData';
/** /**
* This function changes some of the time-displays in the game to be more detailed * This function changes some of the time-displays in the game to be more detailed
* It is called by a change in CM.Options.DetailedTime * It is called by a change in CM.Options.DetailedTime
*/ */
export default function ToggleDetailedTime() { export default function ToggleDetailedTime() {
if (CMOptions.DetailedTime === 1) Game.sayTime = CMSayTime; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.DetailedTime === 1)
Game.sayTime = CMSayTime;
else Game.sayTime = BackupFunctions.sayTime; else Game.sayTime = BackupFunctions.sayTime;
} }

View File

@@ -1,13 +1,12 @@
import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData'; import { CacheGoldenShimmersByID } from '../../Cache/VariablesAndData';
import { GCTimers } from '../../Disp/VariablesAndData'; import { GCTimers } from '../../Disp/VariablesAndData';
import { CMOptions } from '../VariablesAndData';
/** /**
* This function toggles GC Timers are visible * This function toggles GC Timers are visible
* It is called by a change in CM.Options.GCTimer * It is called by a change in CM.Options.GCTimer
*/ */
export default function ToggleGCTimer() { export default function ToggleGCTimer() {
if (CMOptions.GCTimer === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer === 1) {
Object.keys(GCTimers).forEach((i) => { Object.keys(GCTimers).forEach((i) => {
GCTimers[i].style.display = 'block'; GCTimers[i].style.display = 'block';
GCTimers[i].style.left = CacheGoldenShimmersByID[i].l.style.left; GCTimers[i].style.left = CacheGoldenShimmersByID[i].l.style.left;

View File

@@ -1,11 +1,9 @@
import { CMOptions } from '../VariablesAndData';
/** /**
* This function updates the display setting of the two objects created by CM.Disp.CreateWrinklerButtons() * This function updates the display setting of the two objects created by CM.Disp.CreateWrinklerButtons()
* It is called by changes in CM.Options.WrinklerButtons * It is called by changes in CM.Options.WrinklerButtons
*/ */
export default function ToggleSectionHideButtons() { export default function ToggleSectionHideButtons() {
if (CMOptions.HideSectionsButtons) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.HideSectionsButtons) {
l('CMSectionHidButtons').style.display = ''; l('CMSectionHidButtons').style.display = '';
} else { } else {
l('CMSectionHidButtons').style.display = 'none'; l('CMSectionHidButtons').style.display = 'none';

View File

@@ -1,5 +1,3 @@
import { CMOptions } from '../VariablesAndData';
/** /**
* This function toggles the position of the warnings created by CM.Disp.TooltipCreateWarningSection() * This function toggles the position of the warnings created by CM.Disp.TooltipCreateWarningSection()
* It is called by a change in CM.Options.ToolWarnPos * It is called by a change in CM.Options.ToolWarnPos
@@ -7,7 +5,7 @@ import { CMOptions } from '../VariablesAndData';
*/ */
export default function ToggleToolWarnPos() { export default function ToggleToolWarnPos() {
if (l('CMDispTooltipWarningParent') !== null) { if (l('CMDispTooltipWarningParent') !== null) {
if (CMOptions.ToolWarnPos === 0) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnPos === 0) {
l('CMDispTooltipWarningParent').style.top = 'auto'; l('CMDispTooltipWarningParent').style.top = 'auto';
l('CMDispTooltipWarningParent').style.margin = '4px -4px'; l('CMDispTooltipWarningParent').style.margin = '4px -4px';
l('CMDispTooltipWarningParent').style.padding = '3px 4px'; l('CMDispTooltipWarningParent').style.padding = '3px 4px';

View File

@@ -1,16 +1,15 @@
import UpdateUpgrades from '../../Disp/BuildingsUpgrades/Upgrades'; import UpdateUpgrades from '../../Disp/BuildingsUpgrades/Upgrades';
import { CMOptions } from '../VariablesAndData';
/** /**
* This function toggles the upgrade bar and the colours of upgrades * This function toggles the upgrade bar and the colours of upgrades
* It is called by a change in CM.Options.UpBarColor * It is called by a change in CM.Options.UpBarColor
*/ */
export default function ToggleUpgradeBarAndColor() { export default function ToggleUpgradeBarAndColor() {
if (CMOptions.UpBarColor === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColor === 1) {
// Colours and bar on // Colours and bar on
l('CMUpgradeBar').style.display = ''; l('CMUpgradeBar').style.display = '';
UpdateUpgrades(); UpdateUpgrades();
} else if (CMOptions.UpBarColor === 2) { } else if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColor === 2) {
// Colours on and bar off // Colours on and bar off
l('CMUpgradeBar').style.display = 'none'; l('CMUpgradeBar').style.display = 'none';
UpdateUpgrades(); UpdateUpgrades();

View File

@@ -1,11 +1,11 @@
import { CMOptions } from '../VariablesAndData';
/** /**
* This function toggles the position of the upgrade bar from fixed or non-fixed mode * This function toggles the position of the upgrade bar from fixed or non-fixed mode
* It is called by a change in CM.Options.UpgradeBarFixedPos * It is called by a change in CM.Options.UpgradeBarFixedPos
*/ */
export default function ToggleUpgradeBarFixedPos() { export default function ToggleUpgradeBarFixedPos() {
if (CMOptions.UpgradeBarFixedPos === 1) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpgradeBarFixedPos === 1
) {
// Fix to top of screen when scrolling // Fix to top of screen when scrolling
l('CMUpgradeBar').style.position = 'sticky'; l('CMUpgradeBar').style.position = 'sticky';
l('CMUpgradeBar').style.top = '0px'; l('CMUpgradeBar').style.top = '0px';

View File

@@ -1,11 +1,12 @@
import { CMOptions } from '../VariablesAndData';
/** /**
* This function updates the display setting of the two objects created by CM.Disp.CreateWrinklerButtons() * This function updates the display setting of the two objects created by CM.Disp.CreateWrinklerButtons()
* It is called by changes in CM.Options.WrinklerButtons * It is called by changes in CM.Options.WrinklerButtons
*/ */
export default function ToggleWrinklerButtons() { export default function ToggleWrinklerButtons() {
if (CMOptions.WrinklerButtons && Game.elderWrath) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerButtons &&
Game.elderWrath
) {
l('PopAllNormalWrinklerButton').style.display = ''; l('PopAllNormalWrinklerButton').style.display = '';
l('PopFattestWrinklerButton').style.display = ''; l('PopFattestWrinklerButton').style.display = '';
} else { } else {

View File

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

View File

@@ -4,18 +4,15 @@ export const VersionMajor = '2.031';
export const VersionMinor = '9'; export const VersionMinor = '9';
/** Information about Cookie Monster to be displayed in the info section */ /** Information about Cookie Monster to be displayed in the info section */
export const ModDescription = `<div class="listing"> export const ModDescription = `<a href="https://github.com/CookieMonsterTeam/CookieMonster" target="blank">Cookie Monster</a>
<a href="https://github.com/CookieMonsterTeam/CookieMonster" target="blank">Cookie Monster</a>
offers a wide range of tools and statistics to enhance your game experience. offers a wide range of tools and statistics to enhance your game experience.
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.</br> 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.</br>
Progess on new updates and all previous release notes can be found on the GitHub page linked above!</br> Progess on new updates and all previous release notes can be found on the GitHub page linked above!</br>
Please also report any bugs you may find over there!</br> Please also report any bugs you may find over there!</br>
</div>
`; `;
/** Latest releasenotes of Cookie Monster to be displayed in the info section */ /** Latest releasenotes of Cookie Monster to be displayed in the info section */
export const LatestReleaseNotes = `<div class="listing"> export const LatestReleaseNotes = `This update implements the following functions:</br>
This update implements the following functions:</br>
- HOTFIX: Fixed the possibility of clicking Golden Cookies multiple times with autoclickers</br> - HOTFIX: Fixed the possibility of clicking Golden Cookies multiple times with autoclickers</br>
- For developers: we now expose some data calculated by Cookie Monster to the global scope. You can access it through the CookieMonsterData object</br> - For developers: we now expose some data calculated by Cookie Monster to the global scope. You can access it through the CookieMonsterData object</br>
- The column with the most optimal building now has a green coloured indicator whenever colour coding is turned on</br> - The column with the most optimal building now has a green coloured indicator whenever colour coding is turned on</br>
@@ -29,5 +26,4 @@ This update fixes the following bugs:</br>
- Fixed some issues related to "left till achievement"</br> - Fixed some issues related to "left till achievement"</br>
- Fixed some cases where upgrades and buildings were not correctly sorted</br> - Fixed some cases where upgrades and buildings were not correctly sorted</br>
- Fixed the tooltip of "Pop all normal wrinklers" displaying an incorrect reward when Shiny's are present</br> - Fixed the tooltip of "Pop all normal wrinklers" displaying an incorrect reward when Shiny's are present</br>
</div>
`; `;

View File

@@ -1,10 +1,13 @@
/** The basic setting class */ /** The basic setting class */
export default class Setting { export default class Setting {
defaultValue: string | number;
type: string; type: string;
group: string; group: string;
constructor(type: string, group: string) { constructor(defaultValue: string | number, type: string, group: string) {
this.defaultValue = defaultValue;
this.type = type; this.type = type;
this.group = group; this.group = group;
} }

View File

@@ -4,8 +4,8 @@ import Setting from './BaseSetting';
export default class SettingColours extends Setting { export default class SettingColours extends Setting {
desc: string; desc: string;
constructor(type: string, group: string, desc: string) { constructor(defaultValue: string | number,type: string, group: string, desc: string) {
super(type, group); super(defaultValue, type, group);
this.desc = desc; this.desc = desc;
} }
} }

View File

@@ -11,6 +11,7 @@ export default class SettingInputNumber extends Setting {
max: number; max: number;
constructor( constructor(
defaultValue: string | number,
type: string, type: string,
group: string, group: string,
label: string[], label: string[],
@@ -18,7 +19,7 @@ export default class SettingInputNumber extends Setting {
min: number, min: number,
max: number, max: number,
) { ) {
super(type, group); super(defaultValue, type, group);
this.label = label; this.label = label;
this.desc = desc; this.desc = desc;
this.min = min; this.min = min;

View File

@@ -11,6 +11,7 @@ export default class SettingStandard extends Setting {
func: () => void; func: () => void;
constructor( constructor(
defaultValue: string | number,
type: string, type: string,
group: string, group: string,
label: string[], label: string[],
@@ -18,7 +19,7 @@ export default class SettingStandard extends Setting {
toggle: boolean, toggle: boolean,
func?: () => void, func?: () => void,
) { ) {
super(type, group); super(defaultValue, type, group);
this.label = label; this.label = label;
this.desc = desc; this.desc = desc;
this.toggle = toggle; this.toggle = toggle;

View File

@@ -6,8 +6,8 @@ export default class SettingVolume extends Setting {
desc: string; desc: string;
constructor(type: string, group: string, label: string[], desc: string) { constructor(defaultValue: string | number,type: string, group: string, label: string[], desc: string) {
super(type, group); super(defaultValue, type, group);
this.label = label; this.label = label;
this.desc = desc; this.desc = desc;
for (let i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {

View File

@@ -1,144 +0,0 @@
/** This array describes all default settings */
const ConfigDefault: {
[index: string]: string | number | { [index: string]: number };
} = {
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,
AutosaveTimerBar: 0,
UpBarColour: 1,
UpgradeBarFixedPos: 1,
SortBuildings: 0,
SortUpgrades: 0,
UpgradesNeverCollapse: 0,
DragonAuraInfo: 1,
GrimoireBar: 1,
GCTimer: 1,
Favicon: 1,
WrinklerButtons: 1,
HideSectionsButtons: 0,
TooltipBuildUpgrade: 1,
TooltipAmor: 0,
ToolWarnLucky: 1,
ToolWarnLuckyFrenzy: 1,
ToolWarnConjure: 1,
ToolWarnConjureFrenzy: 1,
ToolWarnEdifice: 1,
ToolWarnUser: 0,
ToolWarnBon: 1,
ToolWarnPos: 1,
TooltipGrim: 1,
TooltipWrink: 1,
TooltipLump: 1,
TooltipPlots: 1,
TooltipPantheon: 1,
TooltipAscendButton: 1,
Stats: 1,
MissingUpgrades: 1,
MissingAchievements: 0,
UpStats: 1,
HeavenlyChipsTarget: 1,
ShowMissedGC: 1,
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: {
Favourite: 1,
Calculation: 1,
Notation: 1,
Colours: 1,
BarsDisplay: 1,
Tooltip: 1,
Statistics: 1,
Notification: 1,
NotificationGeneral: 1,
NotificationGC: 1,
NotificationFC: 1,
NotificationSea: 1,
NotificationGard: 1,
NotificationMagi: 1,
NotificationWrink: 1,
NotificationWrinkMax: 1,
Miscellaneous: 1,
Lucky: 1,
Chain: 1,
Spells: 1,
Garden: 1,
Prestige: 1,
Wrink: 1,
Sea: 1,
Achievs: 1,
Misc: 1,
InfoTab: 1,
},
};
export default ConfigDefault;

33
src/Data/headers.js Normal file
View File

@@ -0,0 +1,33 @@
/** This includes all headers of Cookie Monster and their relevant data */
const headers = {
Favourite: 1,
Calculation: 1,
Notation: 1,
Colours: 1,
BarsDisplay: 1,
Tooltip: 1,
Statistics: 1,
Notification: 1,
NotificationGeneral: 1,
NotificationGC: 1,
NotificationFC: 1,
NotificationSea: 1,
NotificationGard: 1,
NotificationMagi: 1,
NotificationWrink: 1,
NotificationWrinkMax: 1,
Miscellaneous: 1,
Lucky: 1,
Chain: 1,
Spells: 1,
Garden: 1,
Prestige: 1,
Wrink: 1,
Sea: 1,
Achievs: 1,
Misc: 1,
infoMenu: 1,
optionsMenu: 1,
};
export default headers;

View File

@@ -8,7 +8,6 @@ import ToggleToolWarnPos from '../Config/Toggles/ToggleToolWarnPos';
import ToggleUpgradeBarAndColour from '../Config/Toggles/ToggleUpgradeBarAndColour'; import ToggleUpgradeBarAndColour from '../Config/Toggles/ToggleUpgradeBarAndColour';
import ToggleUpgradeBarFixedPos from '../Config/Toggles/ToggleUpgradeBarFixedPos'; import ToggleUpgradeBarFixedPos from '../Config/Toggles/ToggleUpgradeBarFixedPos';
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons'; import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons';
import { CMOptions } from '../Config/VariablesAndData';
import UpdateBuildings from '../Disp/BuildingsUpgrades/Buildings'; import UpdateBuildings from '../Disp/BuildingsUpgrades/Buildings';
import UpdateUpgradeSectionsHeight from '../Disp/BuildingsUpgrades/UpdateUpgradeSectionsHeight'; import UpdateUpgradeSectionsHeight from '../Disp/BuildingsUpgrades/UpdateUpgradeSectionsHeight';
import UpdateUpgrades from '../Disp/BuildingsUpgrades/Upgrades'; import UpdateUpgrades from '../Disp/BuildingsUpgrades/Upgrades';
@@ -21,9 +20,10 @@ import SettingStandard from './SettingClasses/SettingStandard.ts';
import SettingVolume from './SettingClasses/SettingVolume.ts'; import SettingVolume from './SettingClasses/SettingVolume.ts';
/** This includes all options of CookieMonster and their relevant data */ /** This includes all options of CookieMonster and their relevant data */
const Config = { const settings = {
// Calculation // Calculation
CPSMode: new SettingStandard( CPSMode: new SettingStandard(
1,
'bool', 'bool',
'Calculation', 'Calculation',
['Current cookies per second', 'Average cookies per second'], ['Current cookies per second', 'Average cookies per second'],
@@ -31,6 +31,7 @@ const Config = {
false, false,
), ),
AvgCPSHist: new SettingStandard( AvgCPSHist: new SettingStandard(
3,
'bool', 'bool',
'Calculation', 'Calculation',
[ [
@@ -47,6 +48,7 @@ const Config = {
false, false,
), ),
AvgClicksHist: new SettingStandard( AvgClicksHist: new SettingStandard(
0,
'bool', 'bool',
'Calculation', 'Calculation',
[ [
@@ -60,6 +62,7 @@ const Config = {
false, false,
), ),
CalcWrink: new SettingStandard( CalcWrink: new SettingStandard(
0,
'bool', 'bool',
'Calculation', 'Calculation',
[ [
@@ -76,6 +79,7 @@ const Config = {
// Notation // Notation
Scale: new SettingStandard( Scale: new SettingStandard(
2,
'bool', 'bool',
'Notation', 'Notation',
[ [
@@ -93,6 +97,7 @@ const Config = {
}, },
), ),
ScaleDecimals: new SettingStandard( ScaleDecimals: new SettingStandard(
2,
'bool', 'bool',
'Notation', 'Notation',
['1 decimals', '2 decimals', '3 decimals'], ['1 decimals', '2 decimals', '3 decimals'],
@@ -103,6 +108,7 @@ const Config = {
}, },
), ),
ScaleSeparator: new SettingStandard( ScaleSeparator: new SettingStandard(
0,
'bool', 'bool',
'Notation', 'Notation',
['. for decimals (standard)', '. for thousands'], ['. for decimals (standard)', '. for thousands'],
@@ -113,6 +119,7 @@ const Config = {
}, },
), ),
ScaleCutoff: new SettingInputNumber( ScaleCutoff: new SettingInputNumber(
999999,
'numscale', 'numscale',
'Notation', 'Notation',
'Notation cut-off point: ', 'Notation cut-off point: ',
@@ -121,6 +128,7 @@ const Config = {
999999999, 999999999,
), ),
TimeFormat: new SettingStandard( TimeFormat: new SettingStandard(
0,
'bool', 'bool',
'Notation', 'Notation',
['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'],
@@ -128,6 +136,7 @@ const Config = {
false, false,
), ),
DetailedTime: new SettingStandard( DetailedTime: new SettingStandard(
1,
'bool', 'bool',
'Notation', 'Notation',
['Detailed time OFF', 'Detailed time ON'], ['Detailed time OFF', 'Detailed time ON'],
@@ -138,6 +147,7 @@ const Config = {
}, },
), ),
PPDisplayTime: new SettingStandard( PPDisplayTime: new SettingStandard(
0,
'bool', 'bool',
'Notation', 'Notation',
['PP as value (standard)', 'PP as time unit'], ['PP as value (standard)', 'PP as time unit'],
@@ -147,6 +157,7 @@ const Config = {
// Colours // Colours
BuildColour: new SettingStandard( BuildColour: new SettingStandard(
1,
'bool', 'bool',
'Colours', 'Colours',
['Building colours OFF', 'Building colours ON'], ['Building colours OFF', 'Building colours ON'],
@@ -157,6 +168,7 @@ const Config = {
}, },
), ),
PPOnlyConsiderBuyable: new SettingStandard( PPOnlyConsiderBuyable: new SettingStandard(
0,
'bool', 'bool',
'Colours', 'Colours',
["Don't ignore non-buyable", 'Ignore non-buyable'], ["Don't ignore non-buyable", 'Ignore non-buyable'],
@@ -164,6 +176,7 @@ const Config = {
true, true,
), ),
PPExcludeTop: new SettingStandard( PPExcludeTop: new SettingStandard(
0,
'bool', 'bool',
'Colours', 'Colours',
[ [
@@ -176,6 +189,7 @@ const Config = {
true, true,
), ),
PPRigidelMode: new SettingStandard( PPRigidelMode: new SettingStandard(
0,
'bool', 'bool',
'Colours', 'Colours',
['Rigidel mode OFF', 'Rigidel mode ON'], ['Rigidel mode OFF', 'Rigidel mode ON'],
@@ -183,6 +197,7 @@ const Config = {
true, true,
), ),
PPSecondsLowerLimit: new SettingInputNumber( PPSecondsLowerLimit: new SettingInputNumber(
0,
'numscale', 'numscale',
'Colours', 'Colours',
'Lower limit for PP (in seconds): ', 'Lower limit for PP (in seconds): ',
@@ -191,46 +206,55 @@ const Config = {
Infinity, Infinity,
), ),
ColourBlue: new SettingColours( ColourBlue: new SettingColours(
'#4bb8f0',
'colour', 'colour',
'Colours', 'Colours',
'Standard colour is blue. Used to show upgrades better than best PP building, for Click Frenzy bar, and for various labels', 'Standard colour is blue. Used to show upgrades better than best PP building, for Click Frenzy bar, and for various labels',
), ),
ColourGreen: new SettingColours( ColourGreen: new SettingColours(
'#00ff00',
'colour', 'colour',
'Colours', 'Colours',
'Standard colour is green. Used to show best PP building, for Blood Frenzy bar, and for various labels', 'Standard colour is green. Used to show best PP building, for Blood Frenzy bar, and for various labels',
), ),
ColourYellow: new SettingColours( ColourYellow: new SettingColours(
'#ffff00',
'colour', 'colour',
'Colours', 'Colours',
'Standard colour is yellow. Used to show buildings within the top 10 of PP, for Frenzy bar, and for various labels', 'Standard colour is yellow. Used to show buildings within the top 10 of PP, for Frenzy bar, and for various labels',
), ),
ColourOrange: new SettingColours( ColourOrange: new SettingColours(
'#ff7f00',
'colour', 'colour',
'Colours', 'Colours',
'Standard colour is orange. Used to show buildings within the top 20 of PP, for Next Reindeer bar, and for various labels', 'Standard colour is orange. Used to show buildings within the top 20 of PP, for Next Reindeer bar, and for various labels',
), ),
ColourRed: new SettingColours( ColourRed: new SettingColours(
'#ff0000',
'colour', 'colour',
'Colours', 'Colours',
'Standard colour is Red. Used to show buildings within the top 30 of PP, for Clot bar, and for various labels', 'Standard colour is Red. Used to show buildings within the top 30 of PP, for Clot bar, and for various labels',
), ),
ColourPurple: new SettingColours( ColourPurple: new SettingColours(
'#ff00ff',
'colour', 'colour',
'Colours', 'Colours',
'Standard colour is purple. Used to show buildings outside of the top 30 of PP, for Next Cookie bar, and for various labels', 'Standard colour is purple. Used to show buildings outside of the top 30 of PP, for Next Cookie bar, and for various labels',
), ),
ColourGray: new SettingColours( ColourGray: new SettingColours(
'#b3b3b3',
'colour', 'colour',
'Colours', 'Colours',
'Standard colour is gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar', 'Standard colour is gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar',
), ),
ColourPink: new SettingColours( ColourPink: new SettingColours(
'#ff1493',
'colour', 'colour',
'Colours', 'Colours',
'Standard colour is pink. Used for Dragonflight bar', 'Standard colour is pink. Used for Dragonflight bar',
), ),
ColourBrown: new SettingColours( ColourBrown: new SettingColours(
'#8b4513',
'colour', 'colour',
'Colours', 'Colours',
'Standard colour is brown. Used for Dragon Harvest bar', 'Standard colour is brown. Used for Dragon Harvest bar',
@@ -238,6 +262,7 @@ const Config = {
// BarsDisplay // BarsDisplay
BotBar: new SettingStandard( BotBar: new SettingStandard(
1,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Bottom bar OFF', 'Bottom bar ON'], ['Bottom bar OFF', 'Bottom bar ON'],
@@ -248,6 +273,7 @@ const Config = {
}, },
), ),
TimerBar: new SettingStandard( TimerBar: new SettingStandard(
1,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Timer bar OFF', 'Timer bar ON'], ['Timer bar OFF', 'Timer bar ON'],
@@ -258,6 +284,7 @@ const Config = {
}, },
), ),
TimerBarPos: new SettingStandard( TimerBarPos: new SettingStandard(
0,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Timer bar position (top left)', 'Timer bar position (bottom)'], ['Timer bar position (top left)', 'Timer bar position (bottom)'],
@@ -268,6 +295,7 @@ const Config = {
}, },
), ),
TimerBarOverlay: new SettingStandard( TimerBarOverlay: new SettingStandard(
2,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Timer bar overlay OFF', 'Timer bar overlay only seconds', 'Timer bar overlay full'], ['Timer bar overlay OFF', 'Timer bar overlay only seconds', 'Timer bar overlay full'],
@@ -275,6 +303,7 @@ const Config = {
true, true,
), ),
AutosaveTimerBar: new SettingStandard( AutosaveTimerBar: new SettingStandard(
0,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Autosave timer bar OFF', 'Autosave timer bar ON'], ['Autosave timer bar OFF', 'Autosave timer bar ON'],
@@ -282,6 +311,7 @@ const Config = {
true, true,
), ),
UpBarColour: new SettingStandard( UpBarColour: new SettingStandard(
1,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Upgrade colours/bar OFF', 'Upgrade colours with bar ON', 'Upgrade colours without bar ON'], ['Upgrade colours/bar OFF', 'Upgrade colours with bar ON', 'Upgrade colours without bar ON'],
@@ -292,6 +322,7 @@ const Config = {
}, },
), ),
UpgradeBarFixedPos: new SettingStandard( UpgradeBarFixedPos: new SettingStandard(
1,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Upgrade bar fixed position OFF', 'Upgrade bar fixed position ON'], ['Upgrade bar fixed position OFF', 'Upgrade bar fixed position ON'],
@@ -302,6 +333,7 @@ const Config = {
}, },
), ),
SortBuildings: new SettingStandard( SortBuildings: new SettingStandard(
0,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
[ [
@@ -317,6 +349,7 @@ const Config = {
}, },
), ),
SortUpgrades: new SettingStandard( SortUpgrades: new SettingStandard(
0,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Sort upgrades: default', 'Sort upgrades: PP'], ['Sort upgrades: default', 'Sort upgrades: PP'],
@@ -327,6 +360,7 @@ const Config = {
}, },
), ),
UpgradesNeverCollapse: new SettingStandard( UpgradesNeverCollapse: new SettingStandard(
0,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Upgrades always expanded OFF', 'Upgrades always expanded ON'], ['Upgrades always expanded OFF', 'Upgrades always expanded ON'],
@@ -337,6 +371,7 @@ const Config = {
}, },
), ),
DragonAuraInfo: new SettingStandard( DragonAuraInfo: new SettingStandard(
1,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Extra dragon aura info OFF', 'Extra dragon aura info ON'], ['Extra dragon aura info OFF', 'Extra dragon aura info ON'],
@@ -344,6 +379,7 @@ const Config = {
true, true,
), ),
GrimoireBar: new SettingStandard( GrimoireBar: new SettingStandard(
1,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Grimoire magic meter timer OFF', 'Grimoire magic meter timer ON'], ['Grimoire magic meter timer OFF', 'Grimoire magic meter timer ON'],
@@ -351,6 +387,7 @@ const Config = {
true, true,
), ),
GCTimer: new SettingStandard( GCTimer: new SettingStandard(
1,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Golden cookie timer OFF', 'Golden cookie timer ON'], ['Golden cookie timer OFF', 'Golden cookie timer ON'],
@@ -361,6 +398,7 @@ const Config = {
}, },
), ),
Favicon: new SettingStandard( Favicon: new SettingStandard(
1,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Favicon OFF', 'Favicon ON'], ['Favicon OFF', 'Favicon ON'],
@@ -371,6 +409,7 @@ const Config = {
}, },
), ),
WrinklerButtons: new SettingStandard( WrinklerButtons: new SettingStandard(
1,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Extra wrinkler buttons OFF', 'Extra wrinkler buttons ON'], ['Extra wrinkler buttons OFF', 'Extra wrinkler buttons ON'],
@@ -381,6 +420,7 @@ const Config = {
}, },
), ),
HideSectionsButtons: new SettingStandard( HideSectionsButtons: new SettingStandard(
0,
'bool', 'bool',
'BarsDisplay', 'BarsDisplay',
['Hide buildings/upgrades button OFF', 'Hide buildings/upgrades button ON'], ['Hide buildings/upgrades button OFF', 'Hide buildings/upgrades button ON'],
@@ -393,6 +433,7 @@ const Config = {
// Tooltip // Tooltip
TooltipBuildUpgrade: new SettingStandard( TooltipBuildUpgrade: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Building/upgrade tooltip information OFF', 'Building/upgrade tooltip information ON'], ['Building/upgrade tooltip information OFF', 'Building/upgrade tooltip information ON'],
@@ -400,6 +441,7 @@ const Config = {
true, true,
), ),
TooltipAmor: new SettingStandard( TooltipAmor: new SettingStandard(
0,
'bool', 'bool',
'Tooltip', 'Tooltip',
[ [
@@ -410,6 +452,7 @@ const Config = {
true, true,
), ),
ToolWarnLucky: new SettingStandard( ToolWarnLucky: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Tooltip lucky warning OFF', 'Tooltip lucky warning ON'], ['Tooltip lucky warning OFF', 'Tooltip lucky warning ON'],
@@ -417,6 +460,7 @@ const Config = {
true, true,
), ),
ToolWarnLuckyFrenzy: new SettingStandard( ToolWarnLuckyFrenzy: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Tooltip lucky frenzy warning OFF', 'Tooltip lucky frenzy warning ON'], ['Tooltip lucky frenzy warning OFF', 'Tooltip lucky frenzy warning ON'],
@@ -424,6 +468,7 @@ const Config = {
true, true,
), ),
ToolWarnConjure: new SettingStandard( ToolWarnConjure: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Tooltip conjure warning OFF', 'Tooltip conjure warning ON'], ['Tooltip conjure warning OFF', 'Tooltip conjure warning ON'],
@@ -431,6 +476,7 @@ const Config = {
true, true,
), ),
ToolWarnConjureFrenzy: new SettingStandard( ToolWarnConjureFrenzy: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Tooltip conjure frenzy warning OFF', 'Tooltip conjure frenzy warning ON'], ['Tooltip conjure frenzy warning OFF', 'Tooltip conjure frenzy warning ON'],
@@ -438,6 +484,7 @@ const Config = {
true, true,
), ),
ToolWarnEdifice: new SettingStandard( ToolWarnEdifice: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Tooltip edifice warning OFF', 'Tooltip edifice warning ON'], ['Tooltip edifice warning OFF', 'Tooltip edifice warning ON'],
@@ -445,6 +492,7 @@ const Config = {
true, true,
), ),
ToolWarnUser: new SettingInputNumber( ToolWarnUser: new SettingInputNumber(
0,
'numscale', 'numscale',
'Tooltip', 'Tooltip',
'Tooltip warning at x times CPS: ', 'Tooltip warning at x times CPS: ',
@@ -453,6 +501,7 @@ const Config = {
Infinity, Infinity,
), ),
ToolWarnBon: new SettingStandard( ToolWarnBon: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Calculate tooltip warning with bonus CPS OFF', 'Calculate tooltip warning with bonus CPS ON'], ['Calculate tooltip warning with bonus CPS OFF', 'Calculate tooltip warning with bonus CPS ON'],
@@ -460,6 +509,7 @@ const Config = {
true, true,
), ),
ToolWarnPos: new SettingStandard( ToolWarnPos: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Tooltip warning position (left)', 'Tooltip warning position (bottom)'], ['Tooltip warning position (left)', 'Tooltip warning position (bottom)'],
@@ -470,6 +520,7 @@ const Config = {
}, },
), ),
TooltipGrim: new SettingStandard( TooltipGrim: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Grimoire tooltip information OFF', 'Grimoire tooltip information ON'], ['Grimoire tooltip information OFF', 'Grimoire tooltip information ON'],
@@ -477,6 +528,7 @@ const Config = {
true, true,
), ),
TooltipWrink: new SettingStandard( TooltipWrink: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Wrinkler tooltip OFF', 'Wrinkler tooltip ON'], ['Wrinkler tooltip OFF', 'Wrinkler tooltip ON'],
@@ -484,6 +536,7 @@ const Config = {
true, true,
), ),
TooltipLump: new SettingStandard( TooltipLump: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Sugar lump tooltip OFF', 'Sugar lump tooltip ON'], ['Sugar lump tooltip OFF', 'Sugar lump tooltip ON'],
@@ -491,6 +544,7 @@ const Config = {
true, true,
), ),
TooltipPlots: new SettingStandard( TooltipPlots: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Garden plots tooltip OFF', 'Garden plots tooltip ON'], ['Garden plots tooltip OFF', 'Garden plots tooltip ON'],
@@ -498,6 +552,7 @@ const Config = {
true, true,
), ),
TooltipPantheon: new SettingStandard( TooltipPantheon: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Pantheon tooltip OFF', 'Pantheon tooltip ON'], ['Pantheon tooltip OFF', 'Pantheon tooltip ON'],
@@ -505,6 +560,7 @@ const Config = {
true, true,
), ),
TooltipAscendButton: new SettingStandard( TooltipAscendButton: new SettingStandard(
1,
'bool', 'bool',
'Tooltip', 'Tooltip',
['Show Extra Info Ascend Tooltip OFF', 'Show Extra Info Ascend Tooltip ON'], ['Show Extra Info Ascend Tooltip OFF', 'Show Extra Info Ascend Tooltip ON'],
@@ -514,6 +570,7 @@ const Config = {
// Statistics // Statistics
Stats: new SettingStandard( Stats: new SettingStandard(
1,
'bool', 'bool',
'Statistics', 'Statistics',
['Statistics OFF', 'Statistics ON'], ['Statistics OFF', 'Statistics ON'],
@@ -521,6 +578,7 @@ const Config = {
true, true,
), ),
MissingUpgrades: new SettingStandard( MissingUpgrades: new SettingStandard(
1,
'bool', 'bool',
'Statistics', 'Statistics',
['Missing upgrades OFF', 'Missing upgrades ON'], ['Missing upgrades OFF', 'Missing upgrades ON'],
@@ -528,6 +586,7 @@ const Config = {
true, true,
), ),
MissingAchievements: new SettingStandard( MissingAchievements: new SettingStandard(
0,
'bool', 'bool',
'Statistics', 'Statistics',
['Missing Achievements OFF', 'Missing Normal Achievements ON'], ['Missing Achievements OFF', 'Missing Normal Achievements ON'],
@@ -535,6 +594,7 @@ const Config = {
true, true,
), ),
UpStats: new SettingStandard( UpStats: new SettingStandard(
1,
'bool', 'bool',
'Statistics', 'Statistics',
['Statistics update rate (default)', 'Statistics update rate (1s)'], ['Statistics update rate (default)', 'Statistics update rate (1s)'],
@@ -542,6 +602,7 @@ const Config = {
false, false,
), ),
HeavenlyChipsTarget: new SettingInputNumber( HeavenlyChipsTarget: new SettingInputNumber(
1,
'numscale', 'numscale',
'Statistics', 'Statistics',
'Heavenly chips target: ', 'Heavenly chips target: ',
@@ -550,6 +611,7 @@ const Config = {
Infinity, Infinity,
), ),
ShowMissedGC: new SettingStandard( ShowMissedGC: new SettingStandard(
1,
'bool', 'bool',
'Statistics', 'Statistics',
['Missed GC OFF', 'Missed GC ON'], ['Missed GC OFF', 'Missed GC ON'],
@@ -559,6 +621,7 @@ const Config = {
// Notification // Notification
Title: new SettingStandard( Title: new SettingStandard(
1,
'bool', 'bool',
'NotificationGeneral', 'NotificationGeneral',
['Title OFF', 'Title ON', 'Title pinned tab highlight'], ['Title OFF', 'Title ON', 'Title pinned tab highlight'],
@@ -566,6 +629,7 @@ const Config = {
true, true,
), ),
GeneralSound: new SettingStandard( GeneralSound: new SettingStandard(
1,
'bool', 'bool',
'NotificationGeneral', 'NotificationGeneral',
['Consider game volume setting OFF', 'Consider game volume setting ON'], ['Consider game volume setting OFF', 'Consider game volume setting ON'],
@@ -573,16 +637,20 @@ const Config = {
true, true,
), ),
GCNotification: new SettingStandard( GCNotification: new SettingStandard(
0,
'bool', 'bool',
'NotificationGC', 'NotificationGC',
['Notification OFF', 'Notification ON'], ['Notification OFF', 'Notification ON'],
'Create a notification when golden cookie spawns', 'Create a notification when golden cookie spawns',
true, true,
() => { () => {
CheckNotificationPermissions(CMOptions.GCNotification); CheckNotificationPermissions(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCNotification,
);
}, },
), ),
GCFlash: new SettingStandard( GCFlash: new SettingStandard(
1,
'bool', 'bool',
'NotificationGC', 'NotificationGC',
['Flash OFF', 'Flash ON'], ['Flash OFF', 'Flash ON'],
@@ -590,35 +658,42 @@ const Config = {
true, true,
), ),
ColourGCFlash: new SettingColours( ColourGCFlash: new SettingColours(
'#ffffff',
'colour', 'colour',
'NotificationGC', 'NotificationGC',
'The colour of the GC flash, standard colour is white', 'The colour of the GC flash, standard colour is white',
), ),
GCSound: new SettingStandard( GCSound: new SettingStandard(
1,
'bool', 'bool',
'NotificationGC', 'NotificationGC',
['Sound OFF', 'Sound ON'], ['Sound OFF', 'Sound ON'],
'Play a sound on golden cookie', 'Play a sound on golden cookie',
true, true,
), ),
GCVolume: new SettingVolume('vol', 'NotificationGC', [], 'Volume'), GCVolume: new SettingVolume(100, 'vol', 'NotificationGC', [], 'Volume'),
GCSoundURL: new SettingStandard( GCSoundURL: new SettingStandard(
'https://freesound.org/data/previews/66/66717_931655-lq.mp3',
'url', 'url',
'NotificationGC', 'NotificationGC',
'Sound URL:', 'Sound URL:',
'URL of the sound to be played when a golden cookie spawns', 'URL of the sound to be played when a golden cookie spawns',
), ),
FortuneNotification: new SettingStandard( FortuneNotification: new SettingStandard(
0,
'bool', 'bool',
'NotificationFC', 'NotificationFC',
['Notification OFF', 'Notification ON'], ['Notification OFF', 'Notification ON'],
'Create a notification when fortune cookie is on the ticker', 'Create a notification when fortune cookie is on the ticker',
true, true,
() => { () => {
CheckNotificationPermissions(CMOptions.FortuneNotification); CheckNotificationPermissions(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FortuneNotification,
);
}, },
), ),
FortuneFlash: new SettingStandard( FortuneFlash: new SettingStandard(
1,
'bool', 'bool',
'NotificationFC', 'NotificationFC',
['Flash OFF', 'Flash ON'], ['Flash OFF', 'Flash ON'],
@@ -626,35 +701,42 @@ const Config = {
true, true,
), ),
ColourFortuneFlash: new SettingColours( ColourFortuneFlash: new SettingColours(
'#ffffff',
'colour', 'colour',
'NotificationFC', 'NotificationFC',
'The colour of the fortune flash, standard colour is white', 'The colour of the fortune flash, standard colour is white',
), ),
FortuneSound: new SettingStandard( FortuneSound: new SettingStandard(
1,
'bool', 'bool',
'NotificationFC', 'NotificationFC',
['Sound OFF', 'Sound ON'], ['Sound OFF', 'Sound ON'],
'Play a sound on fortune cookie spawn', 'Play a sound on fortune cookie spawn',
true, true,
), ),
FortuneVolume: new SettingVolume('vol', 'NotificationFC', [], 'Volume'), FortuneVolume: new SettingVolume(100, 'vol', 'NotificationFC', [], 'Volume'),
FortuneSoundURL: new SettingStandard( FortuneSoundURL: new SettingStandard(
'https://freesound.org/data/previews/174/174027_3242494-lq.mp3',
'url', 'url',
'NotificationFC', 'NotificationFC',
'Sound URL:', 'Sound URL:',
'URL of the sound to be played when the ticker has a fortune cookie', 'URL of the sound to be played when the ticker has a fortune cookie',
), ),
SeaNotification: new SettingStandard( SeaNotification: new SettingStandard(
0,
'bool', 'bool',
'NotificationSea', 'NotificationSea',
['Notification OFF', 'Notification ON'], ['Notification OFF', 'Notification ON'],
'Create a notification on season popup', 'Create a notification on season popup',
true, true,
() => { () => {
CheckNotificationPermissions(CMOptions.SeaNotification); CheckNotificationPermissions(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SeaNotification,
);
}, },
), ),
SeaFlash: new SettingStandard( SeaFlash: new SettingStandard(
1,
'bool', 'bool',
'NotificationSea', 'NotificationSea',
['Flash OFF', 'Flash ON'], ['Flash OFF', 'Flash ON'],
@@ -662,25 +744,29 @@ const Config = {
true, true,
), ),
ColourSeaFlash: new SettingColours( ColourSeaFlash: new SettingColours(
'#ffffff',
'colour', 'colour',
'NotificationSea', 'NotificationSea',
'The colour of the season popup flash, standard colour is white', 'The colour of the season popup flash, standard colour is white',
), ),
SeaSound: new SettingStandard( SeaSound: new SettingStandard(
1,
'bool', 'bool',
'NotificationSea', 'NotificationSea',
['Sound OFF', 'Sound ON'], ['Sound OFF', 'Sound ON'],
'Play a sound on season popup', 'Play a sound on season popup',
true, true,
), ),
SeaVolume: new SettingVolume('vol', 'NotificationSea', [], 'Volume'), SeaVolume: new SettingVolume(100, 'vol', 'NotificationSea', [], 'Volume'),
SeaSoundURL: new SettingStandard( SeaSoundURL: new SettingStandard(
'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
'url', 'url',
'NotificationSea', 'NotificationSea',
'Sound URL:', 'Sound URL:',
'URL of the sound to be played when on season popup spawns', 'URL of the sound to be played when on season popup spawns',
), ),
GardFlash: new SettingStandard( GardFlash: new SettingStandard(
1,
'bool', 'bool',
'NotificationGard', 'NotificationGard',
['Garden Tick Flash OFF', 'Flash ON'], ['Garden Tick Flash OFF', 'Flash ON'],
@@ -688,35 +774,42 @@ const Config = {
true, true,
), ),
ColourGardFlash: new SettingColours( ColourGardFlash: new SettingColours(
'#ffffff',
'colour', 'colour',
'NotificationGard', 'NotificationGard',
'The colour of the garden flash, standard colour is white', 'The colour of the garden flash, standard colour is white',
), ),
GardSound: new SettingStandard( GardSound: new SettingStandard(
1,
'bool', 'bool',
'NotificationGard', 'NotificationGard',
['Sound OFF', 'Sound ON'], ['Sound OFF', 'Sound ON'],
'Play a sound on garden tick', 'Play a sound on garden tick',
true, true,
), ),
GardVolume: new SettingVolume('vol', 'NotificationGard', [], 'Volume'), GardVolume: new SettingVolume(100, 'vol', 'NotificationGard', [], 'Volume'),
GardSoundURL: new SettingStandard( GardSoundURL: new SettingStandard(
'https://freesound.org/data/previews/103/103046_861714-lq.mp3',
'url', 'url',
'NotificationGard', 'NotificationGard',
'Garden Tick Sound URL:', 'Garden Tick Sound URL:',
'URL of the sound to be played when the garden ticks', 'URL of the sound to be played when the garden ticks',
), ),
MagicNotification: new SettingStandard( MagicNotification: new SettingStandard(
0,
'bool', 'bool',
'NotificationMagi', 'NotificationMagi',
['Notification OFF', 'Notification ON'], ['Notification OFF', 'Notification ON'],
'Create a notification when magic reaches maximum', 'Create a notification when magic reaches maximum',
true, true,
() => { () => {
CheckNotificationPermissions(CMOptions.MagicNotification); CheckNotificationPermissions(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MagicNotification,
);
}, },
), ),
MagicFlash: new SettingStandard( MagicFlash: new SettingStandard(
1,
'bool', 'bool',
'NotificationMagi', 'NotificationMagi',
['Flash OFF', 'Flash ON'], ['Flash OFF', 'Flash ON'],
@@ -724,35 +817,42 @@ const Config = {
true, true,
), ),
ColourMagicFlash: new SettingColours( ColourMagicFlash: new SettingColours(
'#ffffff',
'colour', 'colour',
'NotificationMagi', 'NotificationMagi',
'The colour of the magic flash, standard colour is white', 'The colour of the magic flash, standard colour is white',
), ),
MagicSound: new SettingStandard( MagicSound: new SettingStandard(
1,
'bool', 'bool',
'NotificationMagi', 'NotificationMagi',
['Sound OFF', 'Sound ON'], ['Sound OFF', 'Sound ON'],
'Play a sound when magic reaches maximum', 'Play a sound when magic reaches maximum',
true, true,
), ),
MagicVolume: new SettingVolume('vol', 'NotificationMagi', [], 'Volume'), MagicVolume: new SettingVolume(100, 'vol', 'NotificationMagi', [], 'Volume'),
MagicSoundURL: new SettingStandard( MagicSoundURL: new SettingStandard(
'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
'url', 'url',
'NotificationMagi', 'NotificationMagi',
'Sound URL:', 'Sound URL:',
'URL of the sound to be played when magic reaches maxium', 'URL of the sound to be played when magic reaches maxium',
), ),
WrinklerNotification: new SettingStandard( WrinklerNotification: new SettingStandard(
0,
'bool', 'bool',
'NotificationWrink', 'NotificationWrink',
['Notification OFF', 'Notification ON'], ['Notification OFF', 'Notification ON'],
'Create a notification when a wrinkler appears', 'Create a notification when a wrinkler appears',
true, true,
() => { () => {
CheckNotificationPermissions(CMOptions.WrinklerNotification); CheckNotificationPermissions(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerNotification,
);
}, },
), ),
WrinklerFlash: new SettingStandard( WrinklerFlash: new SettingStandard(
1,
'bool', 'bool',
'NotificationWrink', 'NotificationWrink',
['Flash OFF', 'Flash ON'], ['Flash OFF', 'Flash ON'],
@@ -760,35 +860,42 @@ const Config = {
true, true,
), ),
ColourWrinklerFlash: new SettingColours( ColourWrinklerFlash: new SettingColours(
'#ffffff',
'colour', 'colour',
'NotificationWrink', 'NotificationWrink',
'The colour of the wrinkler flash, standard colour is white', 'The colour of the wrinkler flash, standard colour is white',
), ),
WrinklerSound: new SettingStandard( WrinklerSound: new SettingStandard(
1,
'bool', 'bool',
'NotificationWrink', 'NotificationWrink',
['Sound OFF', 'Sound ON'], ['Sound OFF', 'Sound ON'],
'Play a sound when a wrinkler appears', 'Play a sound when a wrinkler appears',
true, true,
), ),
WrinklerVolume: new SettingVolume('vol', 'NotificationWrink', [], 'Volume'), WrinklerVolume: new SettingVolume(100, 'vol', 'NotificationWrink', [], 'Volume'),
WrinklerSoundURL: new SettingStandard( WrinklerSoundURL: new SettingStandard(
'https://freesound.org/data/previews/124/124186_8043-lq.mp3',
'url', 'url',
'NotificationWrink', 'NotificationWrink',
'Sound URL:', 'Sound URL:',
'URL of the sound to be played when a wrinkler appears', 'URL of the sound to be played when a wrinkler appears',
), ),
WrinklerMaxNotification: new SettingStandard( WrinklerMaxNotification: new SettingStandard(
0,
'bool', 'bool',
'NotificationWrinkMax', 'NotificationWrinkMax',
['Notification OFF', 'Notification ON'], ['Notification OFF', 'Notification ON'],
'Create a notification when the maximum amount of wrinklers has appeared', 'Create a notification when the maximum amount of wrinklers has appeared',
true, true,
() => { () => {
CheckNotificationPermissions(CMOptions.WrinklerMaxNotification); CheckNotificationPermissions(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxNotification,
);
}, },
), ),
WrinklerMaxFlash: new SettingStandard( WrinklerMaxFlash: new SettingStandard(
1,
'bool', 'bool',
'NotificationWrinkMax', 'NotificationWrinkMax',
['Flash OFF', 'Flash ON'], ['Flash OFF', 'Flash ON'],
@@ -796,19 +903,22 @@ const Config = {
true, true,
), ),
ColourWrinklerMaxFlash: new SettingColours( ColourWrinklerMaxFlash: new SettingColours(
'#ffffff',
'colour', 'colour',
'NotificationWrinkMax', 'NotificationWrinkMax',
'The colour of the maximum wrinkler flash, standard colour is white', 'The colour of the maximum wrinkler flash, standard colour is white',
), ),
WrinklerMaxSound: new SettingStandard( WrinklerMaxSound: new SettingStandard(
1,
'bool', 'bool',
'NotificationWrinkMax', 'NotificationWrinkMax',
['Sound OFF', 'Sound ON'], ['Sound OFF', 'Sound ON'],
'Play a sound when the maximum amount of wrinklers has appeared', 'Play a sound when the maximum amount of wrinklers has appeared',
true, true,
), ),
WrinklerMaxVolume: new SettingVolume('vol', 'NotificationWrinkMax', [], 'Volume'), WrinklerMaxVolume: new SettingVolume(100, 'vol', 'NotificationWrinkMax', [], 'Volume'),
WrinklerMaxSoundURL: new SettingStandard( WrinklerMaxSoundURL: new SettingStandard(
'https://freesound.org/data/previews/152/152743_15663-lq.mp3',
'url', 'url',
'NotificationWrinkMax', 'NotificationWrinkMax',
'Sound URL:', 'Sound URL:',
@@ -817,6 +927,7 @@ const Config = {
// Miscellaneous // Miscellaneous
BulkBuyBlock: new SettingStandard( BulkBuyBlock: new SettingStandard(
1,
'bool', 'bool',
'Miscellaneous', 'Miscellaneous',
['Block bulk buying OFF', 'Block bulk buying ON'], ['Block bulk buying OFF', 'Block bulk buying ON'],
@@ -824,6 +935,7 @@ const Config = {
true, true,
), ),
FavouriteSettings: new SettingStandard( FavouriteSettings: new SettingStandard(
1,
'bool', 'bool',
'Miscellaneous', 'Miscellaneous',
[ [
@@ -839,4 +951,4 @@ const Config = {
), ),
}; };
export default Config; export default settings;

View File

@@ -1,6 +1,5 @@
/** General functions to format or beautify strings */ /** General functions to format or beautify strings */
import { CMOptions } from '../../Config/VariablesAndData';
import { metric, shortScale, shortScaleAbbreviated } from '../../Data/Scales.ts'; import { metric, shortScale, shortScaleAbbreviated } from '../../Data/Scales.ts';
import { BackupFunctions } from '../../Main/VariablesAndData'; import { BackupFunctions } from '../../Main/VariablesAndData';
@@ -12,14 +11,15 @@ import { BackupFunctions } from '../../Main/VariablesAndData';
* @returns {string} Formatted number * @returns {string} Formatted number
*/ */
export default function Beautify(num, floats, forced) { export default function Beautify(num, floats, forced) {
const decimals = CMOptions.ScaleDecimals + 1; const decimals =
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleDecimals + 1;
if (num === Infinity) { if (num === Infinity) {
return 'Infinity'; return 'Infinity';
} }
if (typeof num === 'undefined') { if (typeof num === 'undefined') {
return '0'; return '0';
} }
if (CMOptions.Scale === 0) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale === 0) {
return BackupFunctions.Beautify(num, floats); return BackupFunctions.Beautify(num, floats);
} }
if (Number.isFinite(num)) { if (Number.isFinite(num)) {
@@ -30,12 +30,20 @@ export default function Beautify(num, floats, forced) {
if (num === 0) { if (num === 0) {
return num.toString(); return num.toString();
} }
if (num > 0.001 && num < CMOptions.ScaleCutoff) { if (
if (CMOptions.ScaleSeparator) answer = num.toLocaleString('nl'); num > 0.001 &&
num < Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleCutoff
) {
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator)
answer = num.toLocaleString('nl');
else answer = num.toLocaleString('en'); else answer = num.toLocaleString('en');
return answer; return answer;
} }
if ((CMOptions.Scale === 4 && !forced) || forced === 4) { if (
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale === 4 &&
!forced) ||
forced === 4
) {
// Scientific notation, 123456789 => 1.235E+8 // Scientific notation, 123456789 => 1.235E+8
answer = num.toExponential(decimals).toString().replace('e', 'E'); answer = num.toExponential(decimals).toString().replace('e', 'E');
} else { } else {
@@ -43,22 +51,38 @@ export default function Beautify(num, floats, forced) {
const AmountOfTenPowerThree = Math.floor(exponential.slice(exponential.indexOf('e') + 1) / 3); const AmountOfTenPowerThree = Math.floor(exponential.slice(exponential.indexOf('e') + 1) / 3);
answer = (num / Number(`1e${AmountOfTenPowerThree * 3}`)).toFixed(decimals); answer = (num / Number(`1e${AmountOfTenPowerThree * 3}`)).toFixed(decimals);
// answer is now "xxx.xx" (e.g., 123456789 would be 123.46) // answer is now "xxx.xx" (e.g., 123456789 would be 123.46)
if ((CMOptions.Scale === 1 && !forced) || forced === 1) { if (
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale === 1 &&
!forced) ||
forced === 1
) {
// Metric scale, 123456789 => 123.457 M // Metric scale, 123456789 => 123.457 M
if (num >= 0.01 && num < Number(`1e${metric.length * 3}`)) { if (num >= 0.01 && num < Number(`1e${metric.length * 3}`)) {
answer += ` ${metric[AmountOfTenPowerThree]}`; answer += ` ${metric[AmountOfTenPowerThree]}`;
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation } else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
} else if ((CMOptions.Scale === 2 && !forced) || forced === 2) { } else if (
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale === 2 &&
!forced) ||
forced === 2
) {
// Short scale, 123456789 => 123.457 M // Short scale, 123456789 => 123.457 M
if (num >= 0.01 && num < Number(`1e${shortScale.length * 3}`)) { if (num >= 0.01 && num < Number(`1e${shortScale.length * 3}`)) {
answer += ` ${shortScale[AmountOfTenPowerThree]}`; answer += ` ${shortScale[AmountOfTenPowerThree]}`;
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation } else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
} else if ((CMOptions.Scale === 3 && !forced) || forced === 3) { } else if (
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale === 3 &&
!forced) ||
forced === 3
) {
// Short scale, 123456789 => 123.457 M // Short scale, 123456789 => 123.457 M
if (num >= 0.01 && num < Number(`1e${shortScaleAbbreviated.length * 3}`)) { if (num >= 0.01 && num < Number(`1e${shortScaleAbbreviated.length * 3}`)) {
answer += ` ${shortScaleAbbreviated[AmountOfTenPowerThree]}`; answer += ` ${shortScaleAbbreviated[AmountOfTenPowerThree]}`;
} else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation } else answer = Beautify(num, 0, 4); // If number is too large or little, revert to scientific notation
} else if ((CMOptions.Scale === 5 && !forced) || forced === 5) { } else if (
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale === 5 &&
!forced) ||
forced === 5
) {
// Engineering notation, 123456789 => 123.457E+6 // Engineering notation, 123456789 => 123.457E+6
answer += `E${AmountOfTenPowerThree * 3}`; answer += `E${AmountOfTenPowerThree * 3}`;
} }
@@ -68,7 +92,8 @@ export default function Beautify(num, floats, forced) {
console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`); console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`);
answer = BackupFunctions.Beautify(num, floats); answer = BackupFunctions.Beautify(num, floats);
} }
if (CMOptions.ScaleSeparator) answer = answer.replace('.', ','); if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator)
answer = answer.replace('.', ',');
return answer; return answer;
} }
console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`); // eslint-disable-line no-console console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`); // eslint-disable-line no-console

View File

@@ -1,5 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
/** /**
* This function returns time as a string depending on TimeFormat setting * This function returns time as a string depending on TimeFormat setting
* @param {number} time Time to be formatted * @param {number} time Time to be formatted
@@ -17,7 +15,7 @@ export default function FormatTime(time, longFormat) {
const m = Math.floor((((formattedTime % 31536000) % 86400) % 3600) / 60); const m = Math.floor((((formattedTime % 31536000) % 86400) % 3600) / 60);
const s = Math.floor((((formattedTime % 31536000) % 86400) % 3600) % 60); const s = Math.floor((((formattedTime % 31536000) % 86400) % 3600) % 60);
let str = ''; let str = '';
if (CMOptions.TimeFormat) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat) {
if (formattedTime > 3155760000) return 'XX:XX:XX:XX:XX'; if (formattedTime > 3155760000) return 'XX:XX:XX:XX:XX';
str += `${(y < 10 ? '0' : '') + y}:`; str += `${(y < 10 ? '0' : '') + y}:`;
str += `${(d < 10 ? '0' : '') + d}:`; str += `${(d < 10 ? '0' : '') + d}:`;

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import { ColourGreen, ColourOrange, ColourRed, ColourYellow } from '../VariablesAndData'; import { ColourGreen, ColourOrange, ColourRed, ColourYellow } from '../VariablesAndData';
import FormatTime from './FormatTime'; import FormatTime from './FormatTime';
@@ -11,7 +10,8 @@ export default function GetTimeColour(time) {
let color; let color;
let text; let text;
if (time <= 0) { if (time <= 0) {
if (CMOptions.TimeFormat) text = '00:00:00:00:00'; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat)
text = '00:00:00:00:00';
else text = 'Done!'; else text = 'Done!';
color = ColourGreen; color = ColourGreen;
} else { } else {

View File

@@ -5,7 +5,6 @@ import {
CacheObjects100, CacheObjects100,
CacheObjectsNextAchievement, CacheObjectsNextAchievement,
} from '../../Cache/VariablesAndData'; } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding'; import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
import Beautify from '../BeautifyAndFormatting/Beautify'; import Beautify from '../BeautifyAndFormatting/Beautify';
import { ColoursOrdering, LastTargetBuildings } from '../VariablesAndData'; import { ColoursOrdering, LastTargetBuildings } from '../VariablesAndData';
@@ -36,11 +35,15 @@ export default function UpdateBuildings() {
l(`storeBulk100`).style.removeProperty('color'); l(`storeBulk100`).style.removeProperty('color');
if (Game.buyMode === 1) { if (Game.buyMode === 1) {
if (CMOptions.BuildColour === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BuildColour === 1) {
Object.keys(target).forEach((i) => { Object.keys(target).forEach((i) => {
l(`productPrice${Game.Objects[i].id}`).style.color = CMOptions[`Colour${target[i].color}`]; l(`productPrice${Game.Objects[i].id}`).style.color =
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
`Colour${target[i].color}`
];
}); });
l(`storeBulk${CacheMinPPBulk}`).style.color = CMOptions.ColourGreen; l(`storeBulk${CacheMinPPBulk}`).style.color =
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ColourGreen;
} else { } else {
Object.keys(Game.Objects).forEach((i) => { Object.keys(Game.Objects).forEach((i) => {
l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color'); l(`productPrice${Game.Objects[i].id}`).style.removeProperty('color');
@@ -67,8 +70,11 @@ export default function UpdateBuildings() {
// Build array of pointers and sort according to the user's configured sort option. // Build array of pointers and sort according to the user's configured sort option.
// This regulates sorting of buildings. // This regulates sorting of buildings.
let arr; let arr;
if (Game.buyMode !== 1 || !CMOptions.SortBuildings) { if (
arr = Object.keys(CacheObjects1).map(k => { Game.buyMode !== 1 ||
!Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings
) {
arr = Object.keys(CacheObjects1).map((k) => {
const o = {}; const o = {};
o.name = k; o.name = k;
o.id = Game.Objects[k].id; o.id = Game.Objects[k].id;
@@ -76,8 +82,10 @@ export default function UpdateBuildings() {
}); });
// Sort using default order. // Sort using default order.
arr.sort((a, b) => a.id - b.id); arr.sort((a, b) => a.id - b.id);
} else if (CMOptions.SortBuildings === 1) { } else if (
arr = Object.keys(CacheObjects1).map(k => { Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 1
) {
arr = Object.keys(CacheObjects1).map((k) => {
const o = {}; const o = {};
o.name = k; o.name = k;
o.pp = CacheObjects1[k].pp; o.pp = CacheObjects1[k].pp;
@@ -88,10 +96,12 @@ export default function UpdateBuildings() {
arr.sort((a, b) => arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color) ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
? a.pp - b.pp ? a.pp - b.pp
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color) : ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color),
); );
} else if (CMOptions.SortBuildings === 2) { } else if (
arr = Object.keys(target).map(k => { Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 2
) {
arr = Object.keys(target).map((k) => {
const o = {}; const o = {};
o.name = k; o.name = k;
o.pp = target[k].pp; o.pp = target[k].pp;
@@ -102,10 +112,12 @@ export default function UpdateBuildings() {
arr.sort((a, b) => arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color) ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
? a.pp - b.pp ? a.pp - b.pp
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color) : ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color),
); );
} else if (CMOptions.SortBuildings === 3) { } else if (
arr = Object.keys(CacheObjectsNextAchievement).map(k => { Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 3
) {
arr = Object.keys(CacheObjectsNextAchievement).map((k) => {
const o = {}; const o = {};
o.name = k; o.name = k;
o.id = Game.Objects[k].id; o.id = Game.Objects[k].id;
@@ -118,9 +130,10 @@ export default function UpdateBuildings() {
// Sort by price until next achievement. // Sort by price until next achievement.
// Buildings that aren't within 100 of an achievement are placed at the end, still in // Buildings that aren't within 100 of an achievement are placed at the end, still in
// default order relative to each other because sort() is guaranteed stable. // default order relative to each other because sort() is guaranteed stable.
arr.sort((a, b) => arr.sort(
(a.amountUntilNext !== 101 ? a.priceUntilNext : Infinity) - (a, b) =>
(b.amountUntilNext !== 101 ? b.priceUntilNext : Infinity) (a.amountUntilNext !== 101 ? a.priceUntilNext : Infinity) -
(b.amountUntilNext !== 101 ? b.priceUntilNext : Infinity),
); );
} }

View File

@@ -1,5 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
/** /**
* This function toggles the upgrade to be always expanded * This function toggles the upgrade to be always expanded
* It is called by a change in CM.Options.ToolWarnPos * It is called by a change in CM.Options.ToolWarnPos
@@ -7,7 +5,10 @@ import { CMOptions } from '../../Config/VariablesAndData';
*/ */
export default function UpdateUpgradeSectionsHeight() { export default function UpdateUpgradeSectionsHeight() {
Object.values(document.getElementsByClassName('storeSection')).forEach((section) => { Object.values(document.getElementsByClassName('storeSection')).forEach((section) => {
if (CMOptions.UpgradesNeverCollapse || section.id === 'products') { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpgradesNeverCollapse ||
section.id === 'products'
) {
section.style.height = 'auto'; // eslint-disable-line no-param-reassign section.style.height = 'auto'; // eslint-disable-line no-param-reassign
} else if (section.id === 'vaultUpgrades') { } else if (section.id === 'vaultUpgrades') {
section.style.height = ''; // eslint-disable-line no-param-reassign section.style.height = ''; // eslint-disable-line no-param-reassign

View File

@@ -1,5 +1,4 @@
import { CacheUpgrades } from '../../Cache/VariablesAndData'; import { CacheUpgrades } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import { import {
ColourBackPre, ColourBackPre,
ColourBlue, ColourBlue,
@@ -20,7 +19,7 @@ import {
*/ */
export default function UpdateUpgrades() { export default function UpdateUpgrades() {
// This counts the amount of upgrades for each pp group and updates the Upgrade Bar // This counts the amount of upgrades for each pp group and updates the Upgrade Bar
if (CMOptions.UpBarColour > 0) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour > 0) {
let blue = 0; let blue = 0;
let green = 0; let green = 0;
let yellow = 0; let yellow = 0;
@@ -76,12 +75,12 @@ export default function UpdateUpgrades() {
arr.push(o); arr.push(o);
} }
if (CMOptions.SortUpgrades) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortUpgrades) {
// Sort by pp colour group, then by pp. // Sort by pp colour group, then by pp.
arr.sort((a, b) => arr.sort((a, b) =>
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color) ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
? a.pp - b.pp ? a.pp - b.pp
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color) : ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color),
); );
} else { } else {
arr.sort((a, b) => a.price - b.price); arr.sort((a, b) => a.price - b.price);

View File

@@ -2,7 +2,6 @@
import CacheDragonCost from '../../Cache/Dragon/Dragon'; import CacheDragonCost from '../../Cache/Dragon/Dragon';
import { CacheCostDragonUpgrade } from '../../Cache/VariablesAndData'; import { CacheCostDragonUpgrade } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import CalculateChangeAura from '../../Sim/SimulationEvents/AuraChange'; import CalculateChangeAura from '../../Sim/SimulationEvents/AuraChange';
import Beautify from '../BeautifyAndFormatting/Beautify'; import Beautify from '../BeautifyAndFormatting/Beautify';
import FormatTime from '../BeautifyAndFormatting/FormatTime'; import FormatTime from '../BeautifyAndFormatting/FormatTime';
@@ -12,7 +11,7 @@ import FormatTime from '../BeautifyAndFormatting/FormatTime';
* @param {number} aura The number of the aura currently selected by the mouse/user * @param {number} aura The number of the aura currently selected by the mouse/user
*/ */
export function AddAuraInfo(aura) { export function AddAuraInfo(aura) {
if (CMOptions.DragonAuraInfo === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.DragonAuraInfo === 1) {
const [bonusCPS, priceOfChange] = CalculateChangeAura(aura); const [bonusCPS, priceOfChange] = CalculateChangeAura(aura);
const timeToRecover = FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs)); const timeToRecover = FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs));
let bonusCPSPercentage; let bonusCPSPercentage;

View File

@@ -1,5 +1,4 @@
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons'; import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons';
import { CMOptions } from '../Config/VariablesAndData';
import Beautify from './BeautifyAndFormatting/Beautify'; import Beautify from './BeautifyAndFormatting/Beautify';
import UpdateBuildings from './BuildingsUpgrades/Buildings'; import UpdateBuildings from './BuildingsUpgrades/Buildings';
import UpdateUpgradeSectionsHeight from './BuildingsUpgrades/UpdateUpgradeSectionsHeight'; import UpdateUpgradeSectionsHeight from './BuildingsUpgrades/UpdateUpgradeSectionsHeight';
@@ -20,7 +19,7 @@ export default function CMDrawHook() {
Game.prefs.autosave && Game.prefs.autosave &&
Game.drawT % 10 === 0 && // with autosave ON and every 10 ticks Game.drawT % 10 === 0 && // with autosave ON and every 10 ticks
Game.onMenu === 'stats' && Game.onMenu === 'stats' &&
CMOptions.Stats // while being on the stats menu only Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Stats // while being on the stats menu only
) { ) {
const timer = document.getElementById('CMStatsAutosaveTimer'); const timer = document.getElementById('CMStatsAutosaveTimer');
if (timer) { if (timer) {
@@ -53,7 +52,7 @@ export default function CMDrawHook() {
ToggleWrinklerButtons(); ToggleWrinklerButtons();
// Replace Cookies counter because Orteil uses very weird code to "pad" it... // Replace Cookies counter because Orteil uses very weird code to "pad" it...
if (CMOptions.Scale) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale) {
let str = l('cookies').innerHTML.replace(/.*(?=<br>)/i, Beautify(Game.cookies)); let str = l('cookies').innerHTML.replace(/.*(?=<br>)/i, Beautify(Game.cookies));
if (Game.prefs.monospace) str = `<span class="monospace">${str}</span>`; if (Game.prefs.monospace) str = `<span class="monospace">${str}</span>`;
l('cookies').innerHTML = str; l('cookies').innerHTML = str;

View File

@@ -1,6 +1,5 @@
/** Section: Functions related to the Golden Cookie Timers */ /** Section: Functions related to the Golden Cookie Timers */
import { CMOptions } from '../../Config/VariablesAndData';
import { GCTimers } from '../VariablesAndData'; import { GCTimers } from '../VariablesAndData';
/** /**
@@ -21,7 +20,8 @@ export default function CreateGCTimer(cookie) {
GCTimer.style.cursor = 'pointer'; GCTimer.style.cursor = 'pointer';
GCTimer.style.display = 'block'; GCTimer.style.display = 'block';
GCTimer.style.pointerEvents = 'none'; GCTimer.style.pointerEvents = 'none';
if (CMOptions.GCTimer === 0) GCTimer.style.display = 'none'; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer === 0)
GCTimer.style.display = 'none';
GCTimer.style.left = cookie.l.style.left; GCTimer.style.left = cookie.l.style.left;
GCTimer.style.top = cookie.l.style.top; GCTimer.style.top = cookie.l.style.top;
GCTimer.onclick = function () { GCTimer.onclick = function () {

View File

@@ -4,24 +4,26 @@ import {
CacheCurrWrinklerCPSMult, CacheCurrWrinklerCPSMult,
CacheWrinklersFattest, CacheWrinklersFattest,
} from '../../Cache/VariablesAndData'; } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
/** /**
* This function returns the cps as either current or average CPS depending on CM.Options.CPSMode * This function returns the cps as either current or average CPS depending on CM.Options.CPSMode
* @returns {number} The average or current cps * @returns {number} The average or current cps
*/ */
export default function GetCPS() { export default function GetCPS() {
if (CMOptions.CPSMode) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CPSMode) {
return CacheAverageCPS; return CacheAverageCPS;
} }
if (CMOptions.CalcWrink === 0) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 0) {
return Game.cookiesPs * (1 - Game.cpsSucked); return Game.cookiesPs * (1 - Game.cpsSucked);
} }
if (CMOptions.CalcWrink === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 1) {
return Game.cookiesPs * (CacheCurrWrinklerCPSMult + (1 - CacheCurrWrinklerCount * 0.05)); return Game.cookiesPs * (CacheCurrWrinklerCPSMult + (1 - CacheCurrWrinklerCount * 0.05));
} }
if (CacheWrinklersFattest[1] !== null) if (CacheWrinklersFattest[1] !== null)
if (CMOptions.CalcWrink === 2 && Game.wrinklers[CacheWrinklersFattest[1]].type === 1) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 2 &&
Game.wrinklers[CacheWrinklersFattest[1]].type === 1
) {
return ( return (
Game.cookiesPs * Game.cookiesPs *
((CacheCurrWrinklerCPSMult * 3) / CacheCurrWrinklerCount + ((CacheCurrWrinklerCPSMult * 3) / CacheCurrWrinklerCount +

View File

@@ -1,5 +1,4 @@
import { CacheWrinklersFattest, CacheWrinklersTotal } from '../../Cache/VariablesAndData'; import { CacheWrinklersFattest, CacheWrinklersTotal } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
/** /**
* This function returns the total amount stored in the Wrinkler Bank * This function returns the total amount stored in the Wrinkler Bank
@@ -7,10 +6,10 @@ import { CMOptions } from '../../Config/VariablesAndData';
* @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinklersTotal) * @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinklersTotal)
*/ */
export default function GetWrinkConfigBank() { export default function GetWrinkConfigBank() {
if (CMOptions.CalcWrink === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 1) {
return CacheWrinklersTotal; return CacheWrinklersTotal;
} }
if (CMOptions.CalcWrink === 2) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 2) {
return CacheWrinklersFattest[0]; return CacheWrinklersFattest[0];
} }
return 0; return 0;

View File

@@ -1,6 +1,6 @@
import { ToggleTimerBar } from '../../Config/SpecificToggles'; import { ToggleTimerBar } from '../../Config/SpecificToggles';
import ToggleBotBar from '../../Config/Toggles/ToggleBotBar'; import ToggleBotBar from '../../Config/Toggles/ToggleBotBar';
import { CMOptions } from '../../Config/VariablesAndData';
import UpdateBackground from './UpdateBackground'; import UpdateBackground from './UpdateBackground';
/** /**
@@ -10,8 +10,10 @@ import UpdateBackground from './UpdateBackground';
export default function UpdateAscendState() { export default function UpdateAscendState() {
if (Game.OnAscend) { if (Game.OnAscend) {
l('game').style.bottom = '0px'; l('game').style.bottom = '0px';
if (CMOptions.BotBar === 1) l('CMBotBar').style.display = 'none'; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar === 1)
if (CMOptions.TimerBar === 1) l('CMTimerBar').style.display = 'none'; l('CMBotBar').style.display = 'none';
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1)
l('CMTimerBar').style.display = 'none';
} else { } else {
ToggleBotBar(); ToggleBotBar();
ToggleTimerBar(); ToggleTimerBar();

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import UpdateBuildings from '../BuildingsUpgrades/Buildings'; import UpdateBuildings from '../BuildingsUpgrades/Buildings';
import { import {
ColourBackPre, ColourBackPre,
@@ -15,17 +14,23 @@ export default function UpdateColours() {
let str = ''; let str = '';
for (let i = 0; i < ColoursOrdering.length; i++) { for (let i = 0; i < ColoursOrdering.length; i++) {
str += `.${ColourTextPre}${ColoursOrdering[i]} { color: ${ str += `.${ColourTextPre}${ColoursOrdering[i]} { color: ${
CMOptions[`Colour${ColoursOrdering[i]}`] Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
`Colour${ColoursOrdering[i]}`
]
}; }\n`; }; }\n`;
} }
for (let i = 0; i < ColoursOrdering.length; i++) { for (let i = 0; i < ColoursOrdering.length; i++) {
str += `.${ColourBackPre}${ColoursOrdering[i]} { background-color: ${ str += `.${ColourBackPre}${ColoursOrdering[i]} { background-color: ${
CMOptions[`Colour${ColoursOrdering[i]}`] Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
`Colour${ColoursOrdering[i]}`
]
}; }\n`; }; }\n`;
} }
for (let i = 0; i < ColoursOrdering.length; i++) { for (let i = 0; i < ColoursOrdering.length; i++) {
str += `.${ColourBorderPre}${ColoursOrdering[i]} { border: 1px solid ${ str += `.${ColourBorderPre}${ColoursOrdering[i]} { border: 1px solid ${
CMOptions[`Colour${ColoursOrdering[i]}`] Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
`Colour${ColoursOrdering[i]}`
]
}; }\n`; }; }\n`;
} }
l('CMCSS').textContent = str; l('CMCSS').textContent = str;

View File

@@ -1,7 +1,6 @@
/** Functions related to the Bottom Bar */ /** Functions related to the Bottom Bar */
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData'; import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import { VersionMajor, VersionMinor } from '../../Data/Moddata.ts'; import { VersionMajor, VersionMinor } from '../../Data/Moddata.ts';
import Beautify from '../BeautifyAndFormatting/Beautify'; import Beautify from '../BeautifyAndFormatting/Beautify';
import FormatTime from '../BeautifyAndFormatting/FormatTime'; import FormatTime from '../BeautifyAndFormatting/FormatTime';
@@ -62,7 +61,11 @@ export function CreateBotBar() {
* This function updates the bonus-, pp-, and time-rows in the the bottom bar * This function updates the bonus-, pp-, and time-rows in the the bottom bar
*/ */
export function UpdateBotBar() { export function UpdateBotBar() {
if (CMOptions.BotBar === 1 && CacheObjects1 && Game.buyMode === 1) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar === 1 &&
CacheObjects1 &&
Game.buyMode === 1
) {
let count = 0; let count = 0;
Object.keys(CacheObjects1).forEach((i) => { Object.keys(CacheObjects1).forEach((i) => {
let target = Game.buyBulk; let target = Game.buyBulk;
@@ -85,7 +88,8 @@ export function UpdateBotBar() {
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className = l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className =
ColourTextPre + target[i].color; ColourTextPre + target[i].color;
let PPString; let PPString;
if (CMOptions.PPDisplayTime) PPString = FormatTime(Math.round(target[i].pp)); if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
PPString = FormatTime(Math.round(target[i].pp));
else PPString = Beautify(Math.round(target[i].pp), 2); else PPString = Beautify(Math.round(target[i].pp), 2);
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].textContent = PPString; l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].textContent = PPString;
const timeColour = GetTimeColour( const timeColour = GetTimeColour(

View File

@@ -1,7 +1,6 @@
/** Functions related to the Timer Bar */ /** Functions related to the Timer Bar */
import { UpdateBotTimerBarPosition } from '../../Config/SpecificToggles'; import { UpdateBotTimerBarPosition } from '../../Config/SpecificToggles';
import { CMOptions } from '../../Config/VariablesAndData';
import { import {
BuffColours, BuffColours,
ColourBackPre, ColourBackPre,
@@ -55,14 +54,17 @@ export function CreateTimerBar() {
* This function updates indivudual timers in the timer bar * This function updates indivudual timers in the timer bar
*/ */
export function UpdateTimerBar() { export function UpdateTimerBar() {
if (CMOptions.TimerBar === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1) {
// label width: 113, timer width: 30, div margin: 20 // label width: 113, timer width: 30, div margin: 20
const maxWidthTwoBar = l('CMTimerBar').offsetWidth - 163; const maxWidthTwoBar = l('CMTimerBar').offsetWidth - 163;
// label width: 113, div margin: 20, calculate timer width at runtime // label width: 113, div margin: 20, calculate timer width at runtime
const maxWidthOneBar = l('CMTimerBar').offsetWidth - 133; const maxWidthOneBar = l('CMTimerBar').offsetWidth - 133;
let numberOfTimers = 0; let numberOfTimers = 0;
if (CMOptions.AutosaveTimerBar && Game.prefs.autosave) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AutosaveTimerBar &&
Game.prefs.autosave
) {
const timeTillNextAutosave = const timeTillNextAutosave =
(Game.fps * 60 - (Game.OnAscend ? 0 : Game.T % (Game.fps * 60))) / Game.fps; (Game.fps * 60 - (Game.OnAscend ? 0 : Game.T % (Game.fps * 60))) / Game.fps;
l('CMTimerBarAutosave').style.display = ''; l('CMTimerBarAutosave').style.display = '';
@@ -71,7 +73,9 @@ export function UpdateTimerBar() {
(maxWidthOneBar - Math.ceil(timeTillNextAutosave).toString().length * 8)) / (maxWidthOneBar - Math.ceil(timeTillNextAutosave).toString().length * 8)) /
60, 60,
)}px`; )}px`;
if (CMOptions.TimerBarOverlay >= 1) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1
) {
l('CMTimerBarAutosaveBar').textContent = Math.ceil(timeTillNextAutosave); l('CMTimerBarAutosaveBar').textContent = Math.ceil(timeTillNextAutosave);
} else l('CMTimerBarAutosaveBar').textContent = ''; } else l('CMTimerBarAutosaveBar').textContent = '';
l('CMTimerBarAutosaveTime').textContent = Math.ceil(timeTillNextAutosave); l('CMTimerBarAutosaveTime').textContent = Math.ceil(timeTillNextAutosave);
@@ -86,7 +90,7 @@ export function UpdateTimerBar() {
maxWidthTwoBar) / maxWidthTwoBar) /
Game.shimmerTypes.golden.maxTime, Game.shimmerTypes.golden.maxTime,
)}px`; )}px`;
if (CMOptions.TimerBarOverlay >= 1) if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1)
l('CMTimerBarGCMinBar').textContent = Math.ceil( l('CMTimerBarGCMinBar').textContent = Math.ceil(
(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) / Game.fps, (Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) / Game.fps,
); );
@@ -106,7 +110,7 @@ export function UpdateTimerBar() {
maxWidthTwoBar) / maxWidthTwoBar) /
Game.shimmerTypes.golden.maxTime, Game.shimmerTypes.golden.maxTime,
)}px`; )}px`;
if (CMOptions.TimerBarOverlay >= 1) if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1)
l('CMTimerBarGCBar').textContent = Math.ceil( l('CMTimerBarGCBar').textContent = Math.ceil(
Math.min( Math.min(
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime, Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime,
@@ -128,7 +132,7 @@ export function UpdateTimerBar() {
maxWidthTwoBar) / maxWidthTwoBar) /
Game.shimmerTypes.reindeer.maxTime, Game.shimmerTypes.reindeer.maxTime,
)}px`; )}px`;
if (CMOptions.TimerBarOverlay >= 1) if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1)
l('CMTimerBarRenMinBar').textContent = Math.ceil( l('CMTimerBarRenMinBar').textContent = Math.ceil(
(Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) / Game.fps, (Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) / Game.fps,
); );
@@ -141,7 +145,7 @@ export function UpdateTimerBar() {
maxWidthTwoBar) / maxWidthTwoBar) /
Game.shimmerTypes.reindeer.maxTime, Game.shimmerTypes.reindeer.maxTime,
)}px`; )}px`;
if (CMOptions.TimerBarOverlay >= 1) if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1)
l('CMTimerBarRenBar').textContent = Math.ceil( l('CMTimerBarRenBar').textContent = Math.ceil(
Math.min( Math.min(
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime, Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime,
@@ -173,7 +177,9 @@ export function UpdateTimerBar() {
} else classColour = ColourPurple; } else classColour = ColourPurple;
timer.lastChild.children[1].className = ColourBackPre + classColour; timer.lastChild.children[1].className = ColourBackPre + classColour;
timer.lastChild.children[1].style.color = 'black'; timer.lastChild.children[1].style.color = 'black';
if (CMOptions.TimerBarOverlay === 2) if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay === 2
)
timer.lastChild.children[1].textContent = `${Math.round( timer.lastChild.children[1].textContent = `${Math.round(
100 * (Game.buffs[i].time / Game.buffs[i].maxTime), 100 * (Game.buffs[i].time / Game.buffs[i].maxTime),
)}%`; )}%`;

View File

@@ -1,6 +1,4 @@
import { CMOptions } from '../../Config/VariablesAndData';
import AddMenuStats from './Statistics/AddStatsPage'; import AddMenuStats from './Statistics/AddStatsPage';
import AddMenuInfo from './Info/InfoPage';
import AddMenuPref from './Settings/SettingsPage'; import AddMenuPref from './Settings/SettingsPage';
/** /**
@@ -14,12 +12,9 @@ export default function AddMenu() {
title.textContent = 'Cookie Monster Settings'; title.textContent = 'Cookie Monster Settings';
AddMenuPref(title); AddMenuPref(title);
} else if (Game.onMenu === 'stats') { } else if (Game.onMenu === 'stats') {
if (CMOptions.Stats) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Stats) {
title.textContent = 'Cookie Monster Statistics'; title.textContent = 'Cookie Monster Statistics';
AddMenuStats(title); AddMenuStats(title);
} }
} else if (Game.onMenu === 'log') {
title.textContent = 'Cookie Monster '; // To create space between name and button
AddMenuInfo(title);
} }
} }

View File

@@ -1,45 +0,0 @@
/** Functions related to the Stats page */
import { ToggleHeader } from '../../../Config/ToggleSetting';
import { CMOptions } from '../../../Config/VariablesAndData';
import { LatestReleaseNotes, ModDescription } from '../../../Data/Moddata.ts';
/**
* This function adds info about by CookieMonster to the info page
* @param {object} title On object that includes the title of the menu
*/
export default function AddMenuInfo(title) {
const info = document.createElement('div');
info.className = 'subsection';
const span = document.createElement('span');
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.InfoTab ? '-' : '+';
span.onclick = function () {
ToggleHeader('InfoTab');
Game.UpdateMenu();
};
title.appendChild(span);
info.appendChild(title);
if (CMOptions.Header.InfoTab) {
const description = document.createElement('div');
description.innerHTML = ModDescription;
info.appendChild(description);
const notes = document.createElement('div');
notes.innerHTML = LatestReleaseNotes;
info.appendChild(notes);
}
const menu = l('menu').children[1];
menu.insertBefore(info, menu.children[1]);
}

View File

@@ -1,12 +1,10 @@
import { CMOptions } from '../../Config/VariablesAndData';
/** /**
* This function refreshes the stats page, CM.Options.UpStats determines the rate at which that happens * This function refreshes the stats page, CM.Options.UpStats determines the rate at which that happens
* It is called by CM.Disp.Draw() * It is called by CM.Disp.Draw()
*/ */
export default function RefreshMenu() { export default function RefreshMenu() {
if ( if (
CMOptions.UpStats && Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpStats &&
Game.onMenu === 'stats' && Game.onMenu === 'stats' &&
(Game.drawT - 1) % (Game.fps * 5) !== 0 && (Game.drawT - 1) % (Game.fps * 5) !== 0 &&
(Game.drawT - 1) % Game.fps === 0 (Game.drawT - 1) % Game.fps === 0

View File

@@ -1,5 +1,4 @@
import { ToggleHeader } from '../../../Config/ToggleSetting'; import { ToggleHeader } from '../../../Config/ToggleSetting';
import { CMOptions } from '../../../Config/VariablesAndData';
/** /**
* This function creates a header-object for the options page * This function creates a header-object for the options page
@@ -25,7 +24,9 @@ export default function CreatePrefHeader(config, text) {
span.style.color = 'black'; span.style.color = 'black';
span.style.fontSize = '13px'; span.style.fontSize = '13px';
span.style.verticalAlign = 'middle'; span.style.verticalAlign = 'middle';
span.textContent = CMOptions.Header[config] ? '-' : '+'; span.textContent = Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[config]
? '-'
: '+';
span.onclick = function () { span.onclick = function () {
ToggleHeader(config); ToggleHeader(config);
Game.UpdateMenu(); Game.UpdateMenu();

View File

@@ -1,10 +1,9 @@
import saveFramework from '@cookiemonsterteam/cookiemonsterframework/src/saveDataFunctions/saveFramework';
import jscolor, * as JsColor from '@eastdesire/jscolor'; import jscolor, * as JsColor from '@eastdesire/jscolor';
import ToggleFavouriteSetting from '../../../Config/Toggles/ToggleFavourites'; import ToggleFavouriteSetting from '../../../Config/Toggles/ToggleFavourites';
import { SaveConfig } from '../../../Config/SaveLoadReload/SaveLoadReloadSettings';
import { ConfigPrefix, ToggleConfig, ToggleConfigVolume } from '../../../Config/ToggleSetting'; import { ConfigPrefix, ToggleConfig, ToggleConfigVolume } from '../../../Config/ToggleSetting';
import { CMOptions } from '../../../Config/VariablesAndData';
import {} from '../../../Data/Sectionheaders.ts'; import {} from '../../../Data/Sectionheaders.ts';
import Config from '../../../Data/SettingsData'; import settings from '../../../Data/settings';
import RefreshScale from '../../HelperFunctions/RefreshScale'; import RefreshScale from '../../HelperFunctions/RefreshScale';
import UpdateColours from '../../HelperFunctions/UpdateColours'; import UpdateColours from '../../HelperFunctions/UpdateColours';
import Flash from '../../Notifications/Flash'; import Flash from '../../Notifications/Flash';
@@ -26,7 +25,7 @@ function CreateFavouriteStar(config) {
FavStar.className = 'option'; FavStar.className = 'option';
FavStar.onclick = function () { FavStar.onclick = function () {
ToggleFavouriteSetting(config); ToggleFavouriteSetting(config);
SaveConfig(); saveFramework();
Game.UpdateMenu(); Game.UpdateMenu();
}; };
FavStar.onmouseover = function () { FavStar.onmouseover = function () {
@@ -47,12 +46,15 @@ function CreateFavouriteStar(config) {
export default function CreatePrefOption(config) { export default function CreatePrefOption(config) {
const div = document.createElement('div'); const div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
if (CMOptions.FavouriteSettings === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FavouriteSettings === 1) {
div.appendChild(CreateFavouriteStar(config)); div.appendChild(CreateFavouriteStar(config));
} }
if (Config[config].type === 'bool') { if (settings[config].type === 'bool') {
const a = document.createElement('a'); const a = document.createElement('a');
if (Config[config].toggle && CMOptions[config] === 0) { if (
settings[config].toggle &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config] === 0
) {
a.className = 'option off'; a.className = 'option off';
} else { } else {
a.className = 'option'; a.className = 'option';
@@ -62,25 +64,28 @@ export default function CreatePrefOption(config) {
ToggleConfig(config); ToggleConfig(config);
Game.UpdateMenu(); Game.UpdateMenu();
}; };
a.textContent = Config[config].label[CMOptions[config]]; a.textContent =
settings[config].label[
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config]
];
div.appendChild(a); div.appendChild(a);
const label = document.createElement('label'); const label = document.createElement('label');
label.textContent = Config[config].desc; label.textContent = settings[config].desc;
label.style.lineHeight = '1.6'; label.style.lineHeight = '1.6';
div.appendChild(label); div.appendChild(label);
return div; return div;
} }
if (Config[config].type === 'vol') { if (settings[config].type === 'vol') {
const volume = document.createElement('div'); const volume = document.createElement('div');
volume.className = 'sliderBox'; volume.className = 'sliderBox';
const title = document.createElement('div'); const title = document.createElement('div');
title.style.float = 'left'; title.style.float = 'left';
title.innerHTML = Config[config].desc; title.innerHTML = settings[config].desc;
volume.appendChild(title); volume.appendChild(title);
const percent = document.createElement('div'); const percent = document.createElement('div');
percent.id = `slider${config}right`; percent.id = `slider${config}right`;
percent.style.float = 'right'; percent.style.float = 'right';
percent.innerHTML = `${CMOptions[config]}%`; percent.innerHTML = `${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config]}%`;
volume.appendChild(percent); volume.appendChild(percent);
const slider = document.createElement('input'); const slider = document.createElement('input');
slider.className = 'slider'; slider.className = 'slider';
@@ -90,7 +95,7 @@ export default function CreatePrefOption(config) {
slider.min = '0'; slider.min = '0';
slider.max = '100'; slider.max = '100';
slider.step = '1'; slider.step = '1';
slider.value = CMOptions[config]; slider.value = Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config];
slider.oninput = function () { slider.oninput = function () {
ToggleConfigVolume(config); ToggleConfigVolume(config);
Game.UpdateMenu(); Game.UpdateMenu();
@@ -105,7 +110,9 @@ export default function CreatePrefOption(config) {
a.className = 'option'; a.className = 'option';
a.onclick = function () { a.onclick = function () {
PlaySound( PlaySound(
CMOptions[config.replace('Volume', 'SoundURL')], Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
config.replace('Volume', 'SoundURL')
],
config.replace('Volume', 'Sound'), config.replace('Volume', 'Sound'),
config, config,
true, true,
@@ -115,10 +122,10 @@ export default function CreatePrefOption(config) {
div.appendChild(a); div.appendChild(a);
return div; return div;
} }
if (Config[config].type === 'url') { if (settings[config].type === 'url') {
const span = document.createElement('span'); const span = document.createElement('span');
span.className = 'option'; span.className = 'option';
span.textContent = `${Config[config].label} `; span.textContent = `${settings[config].label} `;
span.style.lineHeight = '1.6'; span.style.lineHeight = '1.6';
div.appendChild(span); div.appendChild(span);
const input = document.createElement('input'); const input = document.createElement('input');
@@ -126,7 +133,10 @@ export default function CreatePrefOption(config) {
input.className = 'option'; input.className = 'option';
input.type = 'text'; input.type = 'text';
input.readOnly = true; input.readOnly = true;
input.setAttribute('value', CMOptions[config]); input.setAttribute(
'value',
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config],
);
input.style.width = '300px'; input.style.width = '300px';
div.appendChild(input); div.appendChild(input);
div.appendChild(document.createTextNode(' ')); div.appendChild(document.createTextNode(' '));
@@ -134,7 +144,10 @@ export default function CreatePrefOption(config) {
inputPrompt.id = `${ConfigPrefix + config}Prompt`; inputPrompt.id = `${ConfigPrefix + config}Prompt`;
inputPrompt.className = 'option'; inputPrompt.className = 'option';
inputPrompt.type = 'text'; inputPrompt.type = 'text';
inputPrompt.setAttribute('value', CMOptions[config]); inputPrompt.setAttribute(
'value',
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config],
);
const a = document.createElement('a'); const a = document.createElement('a');
a.className = 'option'; a.className = 'option';
a.onclick = function () { a.onclick = function () {
@@ -142,8 +155,10 @@ export default function CreatePrefOption(config) {
[ [
'Save', 'Save',
function () { function () {
CMOptions[config] = l(`${ConfigPrefix}${config}Prompt`).value; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config] = l(
SaveConfig(); `${ConfigPrefix}${config}Prompt`,
).value;
saveFramework();
Game.ClosePrompt(); Game.ClosePrompt();
Game.UpdateMenu(); Game.UpdateMenu();
}, },
@@ -159,29 +174,33 @@ export default function CreatePrefOption(config) {
a.textContent = 'Edit'; a.textContent = 'Edit';
div.appendChild(a); div.appendChild(a);
const label = document.createElement('label'); const label = document.createElement('label');
label.textContent = Config[config].desc; label.textContent = settings[config].desc;
label.style.lineHeight = '1.6'; label.style.lineHeight = '1.6';
div.appendChild(label); div.appendChild(label);
return div; return div;
} }
if (Config[config].type === 'colour') { if (settings[config].type === 'colour') {
const innerSpan = document.createElement('span'); const innerSpan = document.createElement('span');
innerSpan.className = 'option'; innerSpan.className = 'option';
const input = document.createElement('input'); const input = document.createElement('input');
input.id = config; input.id = config;
input.style.width = '65px'; input.style.width = '65px';
input.setAttribute('value', CMOptions[config]); input.setAttribute(
'value',
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config],
);
innerSpan.appendChild(input); innerSpan.appendChild(input);
const change = function () { const change = function () {
CMOptions[this.targetElement.id] = this.toHEXString(); Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[this.targetElement.id] =
this.toHEXString();
UpdateColours(); UpdateColours();
SaveConfig(); saveFramework();
Game.UpdateMenu(); Game.UpdateMenu();
}; };
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new JsColor(input, { hash: true, position: 'right', onInput: change }); new JsColor(input, { hash: true, position: 'right', onInput: change });
const label = document.createElement('label'); const label = document.createElement('label');
label.textContent = Config[config].desc; label.textContent = settings[config].desc;
label.style.lineHeight = '1.6'; label.style.lineHeight = '1.6';
innerSpan.appendChild(label); innerSpan.appendChild(label);
if (config.includes('Flash')) { if (config.includes('Flash')) {
@@ -197,29 +216,29 @@ export default function CreatePrefOption(config) {
jscolor.init(); jscolor.init();
return div; return div;
} }
if (Config[config].type === 'numscale') { if (settings[config].type === 'numscale') {
const span = document.createElement('span'); const span = document.createElement('span');
span.className = 'option'; span.className = 'option';
span.textContent = `${Config[config].label} `; span.textContent = `${settings[config].label} `;
span.style.lineHeight = '1.6'; span.style.lineHeight = '1.6';
div.appendChild(span); div.appendChild(span);
const input = document.createElement('input'); const input = document.createElement('input');
input.id = ConfigPrefix + config; input.id = ConfigPrefix + config;
input.className = 'option'; input.className = 'option';
input.type = 'number'; input.type = 'number';
input.value = CMOptions[config]; input.value = Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config];
input.min = Config[config].min; input.min = settings[config].min;
input.max = Config[config].max; input.max = settings[config].max;
input.oninput = function () { input.oninput = function () {
CMOptions[config] = this.value; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config] = this.value;
SaveConfig(); saveFramework();
RefreshScale(); RefreshScale();
Game.UpdateMenu(); Game.UpdateMenu();
}; };
div.appendChild(input); div.appendChild(input);
div.appendChild(document.createTextNode(' ')); div.appendChild(document.createTextNode(' '));
const label = document.createElement('label'); const label = document.createElement('label');
label.textContent = Config[config].desc; label.textContent = settings[config].desc;
label.style.lineHeight = '1.6'; label.style.lineHeight = '1.6';
div.appendChild(label); div.appendChild(label);
return div; return div;

View File

@@ -1,8 +1,5 @@
import { LoadConfig } from '../../../Config/SaveLoadReload/SaveLoadReloadSettings';
import { CMOptions } from '../../../Config/VariablesAndData';
import { ConfigGroups, ConfigGroupsNotification } from '../../../Data/Sectionheaders.ts'; import { ConfigGroups, ConfigGroupsNotification } from '../../../Data/Sectionheaders.ts';
import Config from '../../../Data/SettingsData'; import settings from '../../../Data/settings';
import ConfigDefault from '../../../Data/SettingsDefault.ts';
import { FavouriteSettings } from '../../VariablesAndData'; import { FavouriteSettings } from '../../VariablesAndData';
import CreatePrefHeader from './CreateHeader'; import CreatePrefHeader from './CreateHeader';
import CreatePrefOption from './CreateOption'; import CreatePrefOption from './CreateOption';
@@ -18,16 +15,19 @@ export default function AddMenuPref(title) {
Object.keys(ConfigGroups).forEach((group) => { Object.keys(ConfigGroups).forEach((group) => {
if (group === 'Favourite') { if (group === 'Favourite') {
if (FavouriteSettings.length !== 0 && CMOptions.FavouriteSettings > 0) { if (
FavouriteSettings.length !== 0 &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FavouriteSettings > 0
) {
frag.appendChild(CreatePrefHeader(group, ConfigGroups[group])); // (group, display-name of group) frag.appendChild(CreatePrefHeader(group, ConfigGroups[group])); // (group, display-name of group)
if (CMOptions.Header[group]) if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[group])
for (let index = 0; index < FavouriteSettings.length; index++) { for (let index = 0; index < FavouriteSettings.length; index++) {
frag.appendChild(CreatePrefOption(FavouriteSettings[index])); frag.appendChild(CreatePrefOption(FavouriteSettings[index]));
} }
} }
} else { } else {
frag.appendChild(CreatePrefHeader(group, ConfigGroups[group])); // (group, display-name of group) frag.appendChild(CreatePrefHeader(group, ConfigGroups[group])); // (group, display-name of group)
if (CMOptions.Header[group]) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[group]) {
// 0 is show, 1 is collapsed // 0 is show, 1 is collapsed
// Make sub-sections of Notification section // Make sub-sections of Notification section
if (group === 'Notification') { if (group === 'Notification') {
@@ -36,32 +36,21 @@ export default function AddMenuPref(title) {
subGroupObject.style.fontSize = '15px'; subGroupObject.style.fontSize = '15px';
subGroupObject.style.opacity = '0.5'; subGroupObject.style.opacity = '0.5';
frag.appendChild(subGroupObject); frag.appendChild(subGroupObject);
if (CMOptions.Header[subGroup]) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[subGroup]) {
Object.keys(Config).forEach((option) => { Object.keys(settings).forEach((option) => {
if (Config[option].group === subGroup) frag.appendChild(CreatePrefOption(option)); if (settings[option].group === subGroup) frag.appendChild(CreatePrefOption(option));
}); });
} }
}); });
} else { } else {
Object.keys(Config).forEach((option) => { Object.keys(settings).forEach((option) => {
if (Config[option].group === group) frag.appendChild(CreatePrefOption(option)); if (settings[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( l('menu').childNodes[2].insertBefore(
frag, frag,
l('menu').childNodes[2].childNodes[l('menu').childNodes[2].childNodes.length - 1], l('menu').childNodes[2].childNodes[l('menu').childNodes[2].childNodes.length - 1],

View File

@@ -4,7 +4,6 @@ import { AddMissingUpgrades } from './CreateMissingUpgrades';
import * as CreateSections from './CreateStatsSections'; import * as CreateSections from './CreateStatsSections';
import * as CreateElements from './CreateDOMElements'; import * as CreateElements from './CreateDOMElements';
import * as GameData from '../../../Data/Gamedata.ts'; import * as GameData from '../../../Data/Gamedata.ts';
import { CMOptions } from '../../../Config/VariablesAndData';
import { import {
CacheAverageClicks, CacheAverageClicks,
@@ -31,37 +30,37 @@ export default function AddMenuStats(title) {
stats.appendChild(title); stats.appendChild(title);
stats.appendChild(CreateElements.StatsHeader('Lucky Cookies', 'Lucky')); stats.appendChild(CreateElements.StatsHeader('Lucky Cookies', 'Lucky'));
if (CMOptions.Header.Lucky) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Lucky) {
stats.appendChild(CreateSections.LuckySection()); stats.appendChild(CreateSections.LuckySection());
} }
stats.appendChild(CreateElements.StatsHeader('Chain Cookies', 'Chain')); stats.appendChild(CreateElements.StatsHeader('Chain Cookies', 'Chain'));
if (CMOptions.Header.Chain) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Chain) {
stats.appendChild(CreateSections.ChainSection()); stats.appendChild(CreateSections.ChainSection());
} }
if (Game.Objects['Wizard tower'].minigameLoaded) { if (Game.Objects['Wizard tower'].minigameLoaded) {
stats.appendChild(CreateElements.StatsHeader('Spells', 'Spells')); stats.appendChild(CreateElements.StatsHeader('Spells', 'Spells'));
if (CMOptions.Header.Spells) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Spells) {
stats.appendChild(CreateSections.SpellsSection()); stats.appendChild(CreateSections.SpellsSection());
} }
} }
if (Game.Objects.Farm.minigameLoaded) { if (Game.Objects.Farm.minigameLoaded) {
stats.appendChild(CreateElements.StatsHeader('Garden', 'Garden')); stats.appendChild(CreateElements.StatsHeader('Garden', 'Garden'));
if (CMOptions.Header.Garden) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Garden) {
stats.appendChild(CreateSections.GardenSection()); stats.appendChild(CreateSections.GardenSection());
} }
} }
stats.appendChild(CreateElements.StatsHeader('Prestige', 'Prestige')); stats.appendChild(CreateElements.StatsHeader('Prestige', 'Prestige'));
if (CMOptions.Header.Prestige) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Prestige) {
stats.appendChild(CreateSections.PrestigeSection()); stats.appendChild(CreateSections.PrestigeSection());
} }
if (Game.cpsSucked > 0) { if (Game.cpsSucked > 0) {
stats.appendChild(CreateElements.StatsHeader('Wrinklers', 'Wrink')); stats.appendChild(CreateElements.StatsHeader('Wrinklers', 'Wrink'));
if (CMOptions.Header.Wrink) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Wrink) {
const popAllFrag = document.createDocumentFragment(); const popAllFrag = document.createDocumentFragment();
popAllFrag.appendChild( popAllFrag.appendChild(
document.createTextNode( document.createTextNode(
@@ -102,7 +101,7 @@ export default function AddMenuStats(title) {
stats.appendChild(CreateSections.SeasonSection()); stats.appendChild(CreateSections.SeasonSection());
stats.appendChild(CreateElements.StatsHeader('Achievements', 'Achievs')); stats.appendChild(CreateElements.StatsHeader('Achievements', 'Achievs'));
if (CMOptions.Header.Achievs) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Achievs) {
Object.keys(Game.Objects).forEach((i) => { Object.keys(Game.Objects).forEach((i) => {
const ObjectsTillNext = CacheObjectsNextAchievement[i]; const ObjectsTillNext = CacheObjectsNextAchievement[i];
stats.appendChild( stats.appendChild(
@@ -110,7 +109,11 @@ export default function AddMenuStats(title) {
'basic', 'basic',
i, i,
ObjectsTillNext.AmountNeeded < 101 ObjectsTillNext.AmountNeeded < 101
? document.createTextNode(`Next achievement in ${ObjectsTillNext.AmountNeeded}, price: ${Beautify(ObjectsTillNext.price)}`) ? document.createTextNode(
`Next achievement in ${ObjectsTillNext.AmountNeeded}, price: ${Beautify(
ObjectsTillNext.price,
)}`,
)
: document.createTextNode('No new achievement for next 100 buildings'), : document.createTextNode('No new achievement for next 100 buildings'),
), ),
); );
@@ -118,15 +121,26 @@ export default function AddMenuStats(title) {
} }
stats.appendChild(CreateElements.StatsHeader('Miscellaneous', 'Misc')); stats.appendChild(CreateElements.StatsHeader('Miscellaneous', 'Misc'));
if (CMOptions.Header.Misc) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Misc) {
stats.appendChild( stats.appendChild(
CreateElements.StatsListing( CreateElements.StatsListing(
'basic', 'basic',
`Average cookies per second (past ${ `Average cookies per second (past ${
CookieTimes[CMOptions.AvgCPSHist] < 60 CookieTimes[
? `${CookieTimes[CMOptions.AvgCPSHist]} seconds` Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist
: CookieTimes[CMOptions.AvgCPSHist] / 60 + ] < 60
(CMOptions.AvgCPSHist === 3 ? ' minute' : ' minutes') ? `${
CookieTimes[
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist
]
} seconds`
: CookieTimes[
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist
] /
60 +
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist === 3
? ' minute'
: ' minutes')
})`, })`,
document.createTextNode(Beautify(GetCPS(), 3)), document.createTextNode(Beautify(GetCPS(), 3)),
), ),
@@ -134,8 +148,14 @@ export default function AddMenuStats(title) {
stats.appendChild( stats.appendChild(
CreateElements.StatsListing( CreateElements.StatsListing(
'basic', 'basic',
`Average cookie clicks per second (past ${ClickTimes[CMOptions.AvgClicksHist]}${ `Average cookie clicks per second (past ${
CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds' ClickTimes[
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist
]
}${
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist === 0
? ' second'
: ' seconds'
})`, })`,
document.createTextNode(Beautify(CacheAverageClicks, 1)), document.createTextNode(Beautify(CacheAverageClicks, 1)),
), ),
@@ -143,13 +163,22 @@ export default function AddMenuStats(title) {
stats.appendChild( stats.appendChild(
CreateElements.StatsListing( CreateElements.StatsListing(
'basic', 'basic',
`Cookies from clicking (past ${ClickTimes[CMOptions.AvgClicksHist]}${ `Cookies from clicking (past ${
CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds' ClickTimes[
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist
]
}${
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist === 0
? ' second'
: ' seconds'
})`, })`,
document.createTextNode( document.createTextNode(
Beautify( Beautify(
CacheAverageCookiesFromClicks.calcSum( CacheAverageCookiesFromClicks.calcSum(
CacheAverageClicks * ClickTimes[CMOptions.AvgClicksHist], CacheAverageClicks *
ClickTimes[
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist
],
), ),
), ),
), ),
@@ -171,7 +200,7 @@ export default function AddMenuStats(title) {
), ),
); );
} }
if (CMOptions.ShowMissedGC) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ShowMissedGC) {
stats.appendChild( stats.appendChild(
CreateElements.StatsListing( CreateElements.StatsListing(
'basic', 'basic',
@@ -193,10 +222,10 @@ export default function AddMenuStats(title) {
l('menu').insertBefore(stats, l('menu').childNodes[2]); l('menu').insertBefore(stats, l('menu').childNodes[2]);
if (CMOptions.MissingUpgrades) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingUpgrades) {
AddMissingUpgrades(); AddMissingUpgrades();
} }
if (CMOptions.MissingAchievements) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingAchievements) {
AddMissingAchievements(); AddMissingAchievements();
} }
} }

View File

@@ -1,7 +1,7 @@
/** Section: Functions related to the creation of basic DOM elements page */ /** Section: Functions related to the creation of basic DOM elements page */
import { ToggleHeader } from '../../../Config/ToggleSetting'; import { ToggleHeader } from '../../../Config/ToggleSetting';
import { CMOptions } from '../../../Config/VariablesAndData';
import { SimpleTooltipElements } from '../../VariablesAndData'; import { SimpleTooltipElements } from '../../VariablesAndData';
/** /**
@@ -30,7 +30,9 @@ export function StatsHeader(text, config) {
span.style.color = 'black'; span.style.color = 'black';
span.style.fontSize = '13px'; span.style.fontSize = '13px';
span.style.verticalAlign = 'middle'; span.style.verticalAlign = 'middle';
span.textContent = CMOptions.Header[config] ? '-' : '+'; span.textContent = Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[config]
? '-'
: '+';
span.onclick = function () { span.onclick = function () {
ToggleHeader(config); ToggleHeader(config);
Game.UpdateMenu(); Game.UpdateMenu();
@@ -99,7 +101,9 @@ export function StatsMissDispListing(type, name, text, current) {
const listingName = document.createElement('b'); const listingName = document.createElement('b');
listingName.textContent = name; listingName.textContent = name;
if (current === true) listingName.style.color = CMOptions.ColourGreen; if (current === true)
listingName.style.color =
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ColourGreen;
div.appendChild(listingName); div.appendChild(listingName);
div.appendChild(document.createTextNode(': ')); div.appendChild(document.createTextNode(': '));
div.appendChild(text); div.appendChild(text);

View File

@@ -1,5 +1,3 @@
import { CMOptions } from '../../../Config/VariablesAndData';
function CrateTooltipLockedAchievements(me) { function CrateTooltipLockedAchievements(me) {
const tags = []; const tags = [];
if (me.pool === 'shadow') tags.push('Shadow Achievement', '#9700cf'); if (me.pool === 'shadow') tags.push('Shadow Achievement', '#9700cf');
@@ -51,7 +49,7 @@ export default function AddMissingAchievements() {
achievs = i.parentElement.querySelectorAll('div.listing.crateBox')[0]; achievs = i.parentElement.querySelectorAll('div.listing.crateBox')[0];
} }
}); });
if (CMOptions.MissingAchievements) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingAchievements) {
Object.values(achievs.children).forEach((achievsCrate) => { Object.values(achievs.children).forEach((achievsCrate) => {
if (!achievsCrate.className.includes('enabled')) { if (!achievsCrate.className.includes('enabled')) {
const id = achievsCrate.onclick.toString().split(/\[(.*)\]/gi)[1]; const id = achievsCrate.onclick.toString().split(/\[(.*)\]/gi)[1];

View File

@@ -36,7 +36,6 @@ import {
CacheWrathCookiesMult, CacheWrathCookiesMult,
CacheWrinklersTotal, CacheWrinklersTotal,
} from '../../../Cache/VariablesAndData'; } from '../../../Cache/VariablesAndData';
import { CMOptions } from '../../../Config/VariablesAndData';
import ResetBonus from '../../../Sim/SimulationEvents/ResetAscension'; import ResetBonus from '../../../Sim/SimulationEvents/ResetAscension';
import GetCPS from '../../HelperFunctions/GetCPS'; import GetCPS from '../../HelperFunctions/GetCPS';
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank'; import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
@@ -567,7 +566,9 @@ export function PrestigeSection() {
), ),
); );
const HCTarget = Number(CMOptions.HeavenlyChipsTarget); const HCTarget = Number(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.HeavenlyChipsTarget,
);
if (!Number.isNaN(HCTarget)) { if (!Number.isNaN(HCTarget)) {
const CookiesTillTarget = const CookiesTillTarget =
HCTarget - Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)); HCTarget - Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
@@ -699,7 +700,7 @@ export function SeasonSection() {
if (Game.season === 'christmas' || specDisp || choEgg || centEgg) { if (Game.season === 'christmas' || specDisp || choEgg || centEgg) {
section.appendChild(StatsHeader('Season Specials', 'Sea')); section.appendChild(StatsHeader('Season Specials', 'Sea'));
if (CMOptions.Header.Sea) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Sea) {
if (missingHalloweenCookies.length !== 0) { if (missingHalloweenCookies.length !== 0) {
section.appendChild( section.appendChild(
StatsMissDispListing( StatsMissDispListing(

View File

@@ -0,0 +1,21 @@
import { menuFunctions } from '@cookiemonsterteam/cookiemonsterframework';
import { LatestReleaseNotes, ModDescription } from '../../Data/Moddata.ts';
/**
* Creates the <div> to be added to the Info section
* @returns {object} menuDiv Object of the <div> of Cookie Monster in info tab
*/
export default function createMenuInfo() {
const menuDiv = menuFunctions.createModMenuSection(
'cookieMonsterMod',
'Cookie Monster',
'infoMenu',
);
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.infoMenu) {
menuDiv.appendChild(menuFunctions.createInfoListing(ModDescription));
menuDiv.appendChild(menuFunctions.createInfoListing(LatestReleaseNotes));
}
return menuDiv;
}

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import { isInitializing } from '../../InitSaveLoad/Variables'; import { isInitializing } from '../../InitSaveLoad/Variables';
/** /**
@@ -12,10 +11,14 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
export default function Flash(mode, config, forced) { export default function Flash(mode, config, forced) {
// The arguments check makes the sound not play upon initialization of the mod // The arguments check makes the sound not play upon initialization of the mod
if ( if (
((CMOptions[config] === 1 || forced) && mode === 3 && isInitializing === false) || ((Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config] === 1 ||
forced) &&
mode === 3 &&
isInitializing === false) ||
mode === 1 mode === 1
) { ) {
l('CMFlashScreen').style.backgroundColor = CMOptions[`Colour${config}`]; l('CMFlashScreen').style.backgroundColor =
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[`Colour${config}`];
l('CMFlashScreen').style.opacity = '0.5'; l('CMFlashScreen').style.opacity = '0.5';
if (mode === 3) { if (mode === 3) {
l('CMFlashScreen').style.display = 'inline'; l('CMFlashScreen').style.display = 'inline';

View File

@@ -1,6 +1,3 @@
/** Functions related to the flashes/sound/notifications */
import { CMOptions } from '../../Config/VariablesAndData';
import { isInitializing } from '../../InitSaveLoad/Variables'; import { isInitializing } from '../../InitSaveLoad/Variables';
/** /**
@@ -13,7 +10,7 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
export default function CreateNotification(notifyConfig, title, message) { export default function CreateNotification(notifyConfig, title, message) {
// The arguments check makes the sound not play upon initialization of the mod // The arguments check makes the sound not play upon initialization of the mod
if ( if (
CMOptions[notifyConfig] === 1 && Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[notifyConfig] === 1 &&
document.visibilityState === 'hidden' && document.visibilityState === 'hidden' &&
isInitializing === false isInitializing === false
) { ) {

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import { isInitializing } from '../../InitSaveLoad/Variables'; import { isInitializing } from '../../InitSaveLoad/Variables';
/** /**
@@ -11,11 +10,20 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
*/ */
export default function PlaySound(url, sndConfig, volConfig, forced) { export default function PlaySound(url, sndConfig, volConfig, forced) {
// The arguments check makes the sound not play upon initialization of the mod // The arguments check makes the sound not play upon initialization of the mod
if ((CMOptions[sndConfig] === 1 || forced) && isInitializing === false) { if (
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[sndConfig] === 1 ||
forced) &&
isInitializing === false
) {
// eslint-disable-next-line new-cap // eslint-disable-next-line new-cap
const sound = new Audio(url); const sound = new Audio(url);
if (CMOptions.GeneralSound) sound.volume = (CMOptions[volConfig] / 100) * (Game.volume / 100); if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GeneralSound)
else sound.volume = CMOptions[volConfig] / 100; sound.volume =
(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[volConfig] / 100) *
(Game.volume / 100);
else
sound.volume =
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[volConfig] / 100;
sound.play(); sound.play();
} }
} }

View File

@@ -1,5 +1,4 @@
import { CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData'; import { CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import { LastGoldenCookieState } from '../../Main/VariablesAndData'; import { LastGoldenCookieState } from '../../Main/VariablesAndData';
/** /**
@@ -18,7 +17,10 @@ export function CreateFavicon() {
* By relying on CM.Cache.spawnedGoldenShimmer it only changes for non-user spawned cookie * By relying on CM.Cache.spawnedGoldenShimmer it only changes for non-user spawned cookie
*/ */
export function UpdateFavicon() { export function UpdateFavicon() {
if (CMOptions.Favicon === 1 && LastGoldenCookieState > 0) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Favicon === 1 &&
LastGoldenCookieState > 0
) {
if (CacheSpawnedGoldenShimmer.wrath) if (CacheSpawnedGoldenShimmer.wrath)
l('CMFavicon').href = l('CMFavicon').href =
'https://CookieMonsterTeam.github.io/CookieMonster/favicon/wrathCookie.ico'; 'https://CookieMonsterTeam.github.io/CookieMonster/favicon/wrathCookie.ico';

View File

@@ -1,7 +1,7 @@
/** Functions related to updating the tab in the browser's tab-bar */ /** Functions related to updating the tab in the browser's tab-bar */
import { CacheSeasonPopShimmer, CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData'; import { CacheSeasonPopShimmer, CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import { LastSeasonPopupState, LastTickerFortuneState } from '../../Main/VariablesAndData'; import { LastSeasonPopupState, LastTickerFortuneState } from '../../Main/VariablesAndData';
import { Title } from '../VariablesAndData'; import { Title } from '../VariablesAndData';
@@ -10,9 +10,12 @@ import { Title } from '../VariablesAndData';
* It is called on every loop by Game.Logic() which also sets CM.Disp.Title to Game.cookies * It is called on every loop by Game.Logic() which also sets CM.Disp.Title to Game.cookies
*/ */
export default function UpdateTitle() { export default function UpdateTitle() {
if (Game.OnAscend || CMOptions.Title === 0) { if (
Game.OnAscend ||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title === 0
) {
document.title = Title; document.title = Title;
} else if (CMOptions.Title === 1) { } else if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title === 1) {
let addFC = false; let addFC = false;
let addSP = false; let addSP = false;
let titleGC; let titleGC;
@@ -50,7 +53,7 @@ export default function UpdateTitle() {
str = str.substring(str.lastIndexOf(']') + 1); str = str.substring(str.lastIndexOf(']') + 1);
} }
document.title = `${titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '')} ${str}`; document.title = `${titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '')} ${str}`;
} else if (CMOptions.Title === 2) { } else if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title === 2) {
let str = ''; let str = '';
let spawn = false; let spawn = false;
if (CacheSpawnedGoldenShimmer) { if (CacheSpawnedGoldenShimmer) {

View File

@@ -3,7 +3,6 @@ import {
CacheLastHeavenlyChips, CacheLastHeavenlyChips,
CacheTimeTillNextPrestige, CacheTimeTillNextPrestige,
} from '../../Cache/VariablesAndData'; } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import Beautify from '../BeautifyAndFormatting/Beautify'; import Beautify from '../BeautifyAndFormatting/Beautify';
/** /**
@@ -45,7 +44,7 @@ export default function ReplaceAscendTooltip() {
str += '<div class="line"></div>'; str += '<div class="line"></div>';
str += `You need <b>${Beautify(cookiesToNext)} more cookies</b> for the next level.<br>`; str += `You need <b>${Beautify(cookiesToNext)} more cookies</b> for the next level.<br>`;
str += `${ str += `${
CMOptions.TooltipAscendButton Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipAscendButton
? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you were making ${Beautify( ? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you were making ${Beautify(
CacheHCPerSecond, CacheHCPerSecond,
2, 2,

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import { import {
ColourTextPre, ColourTextPre,
ColourBorderPre, ColourBorderPre,
@@ -134,7 +133,7 @@ export function TooltipCreateWarningSection() {
'CMDispTooltipWarnUser', 'CMDispTooltipWarnUser',
ColourRed, ColourRed,
'Warning: ', 'Warning: ',
`Purchase of this item will put you under the number of Cookies equal to ${CMOptions.ToolWarnUser} seconds of CPS`, `Purchase of this item will put you under the number of Cookies equal to ${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser} seconds of CPS`,
'CMDispTooltipWarnUserText', 'CMDispTooltipWarnUserText',
), ),
); );

View File

@@ -1,5 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
/** /**
* This function updates the location of the tooltip * This function updates the location of the tooltip
* It is called by Game.tooltip.update() because of CM.Main.ReplaceNative() * It is called by Game.tooltip.update() because of CM.Main.ReplaceNative()
@@ -8,8 +6,8 @@ export default function UpdateTooltipLocation() {
if (Game.tooltip.origin === 'store') { if (Game.tooltip.origin === 'store') {
let warnOffset = 0; let warnOffset = 0;
if ( if (
CMOptions.ToolWarnLucky === 1 && Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnLucky === 1 &&
CMOptions.ToolWarnPos === 1 && Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnPos === 1 &&
l('CMDispTooltipWarningParent') !== null l('CMDispTooltipWarningParent') !== null
) { ) {
warnOffset = l('CMDispTooltipWarningParent').clientHeight - 4; warnOffset = l('CMDispTooltipWarningParent').clientHeight - 4;

View File

@@ -1,6 +1,5 @@
import UpdateTooltips from './UpdateTooltips'; import UpdateTooltips from './UpdateTooltips';
import { SimpleTooltipElements, TooltipName, TooltipType } from '../VariablesAndData'; // eslint-disable-line no-unused-vars import { SimpleTooltipElements, TooltipName, TooltipType } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
import { CMOptions } from '../../Config/VariablesAndData';
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding'; import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour'; import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour';
import Beautify from '../BeautifyAndFormatting/Beautify'; import Beautify from '../BeautifyAndFormatting/Beautify';
@@ -40,7 +39,7 @@ export function CreateTooltip(type, name) {
// Buildings // Buildings
l('tooltip').innerHTML = Game.Objects[name].tooltip(); l('tooltip').innerHTML = Game.Objects[name].tooltip();
// Adds amortization info to the list of info per building // Adds amortization info to the list of info per building
if (CMOptions.TooltipAmor === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipAmor === 1) {
const buildPrice = BuildingGetPrice( const buildPrice = BuildingGetPrice(
Game.Objects[name], Game.Objects[name],
Game.Objects[name].basePrice, Game.Objects[name].basePrice,

View File

@@ -5,7 +5,7 @@ import {
CacheObjects100, CacheObjects100,
CacheObjectsNextAchievement, CacheObjectsNextAchievement,
} from '../../../Cache/VariablesAndData'; } from '../../../Cache/VariablesAndData';
import { CMOptions } from '../../../Config/VariablesAndData';
import BuyBuildingsBonusIncome from '../../../Sim/SimulationEvents/BuyBuildingBonusIncome'; import BuyBuildingsBonusIncome from '../../../Sim/SimulationEvents/BuyBuildingBonusIncome';
import { SimObjects } from '../../../Sim/VariablesAndData'; import { SimObjects } from '../../../Sim/VariablesAndData';
import Beautify from '../../BeautifyAndFormatting/Beautify'; import Beautify from '../../BeautifyAndFormatting/Beautify';
@@ -26,7 +26,10 @@ import * as Create from '../CreateTooltip';
* This function adds extra info to the Building tooltips * This function adds extra info to the Building tooltips
*/ */
export default function Building() { export default function Building() {
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipBuildUpgrade === 1 &&
Game.buyMode === 1
) {
const tooltipBox = l('CMTooltipBorder'); const tooltipBox = l('CMTooltipBorder');
Create.TooltipCreateCalculationSection(tooltipBox); Create.TooltipCreateCalculationSection(tooltipBox);
@@ -43,18 +46,24 @@ export default function Building() {
TooltipPrice = Game.Objects[TooltipName].bulkPrice; TooltipPrice = Game.Objects[TooltipName].bulkPrice;
TooltipBonusIncome = target[TooltipName].bonus; TooltipBonusIncome = target[TooltipName].bonus;
if (CMOptions.TooltipBuildUpgrade === 1 && Game.buyMode === 1) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipBuildUpgrade ===
1 &&
Game.buyMode === 1
) {
l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2); l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2);
const increase = Math.round((TooltipBonusIncome / Game.cookiesPs) * 10000); const increase = Math.round((TooltipBonusIncome / Game.cookiesPs) * 10000);
if (Number.isFinite(increase) && increase !== 0) { if (Number.isFinite(increase) && increase !== 0) {
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`; l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
} else { } else {
l('CMTooltipIncome').textContent += ` (<0${ l('CMTooltipIncome').textContent += ` (<0${
CMOptions.ScaleSeparator ? ',' : '.' Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator
? ','
: '.'
}01% of income)`; }01% of income)`;
} }
l('CMTooltipBorder').className = ColourTextPre + target[TooltipName].color; l('CMTooltipBorder').className = ColourTextPre + target[TooltipName].color;
if (CMOptions.PPDisplayTime) if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
l('CMTooltipPP').textContent = FormatTime(target[TooltipName].pp); l('CMTooltipPP').textContent = FormatTime(target[TooltipName].pp);
else l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2); else l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
l('CMTooltipPP').className = ColourTextPre + target[TooltipName].color; l('CMTooltipPP').className = ColourTextPre + target[TooltipName].color;
@@ -110,7 +119,8 @@ export default function Building() {
)} / ${Beautify(ObjectsTillNext.price)} / `; )} / ${Beautify(ObjectsTillNext.price)} / `;
l('CMTooltipNextAchievement').style.color = 'white'; l('CMTooltipNextAchievement').style.color = 'white';
const PPFrag = document.createElement('span'); const PPFrag = document.createElement('span');
if (CMOptions.PPDisplayTime) PPFrag.textContent = FormatTime(PPOfAmount); if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
PPFrag.textContent = FormatTime(PPOfAmount);
else PPFrag.textContent = Beautify(PPOfAmount); else PPFrag.textContent = Beautify(PPOfAmount);
PPFrag.className = ColourTextPre + ColourOfPP({ pp: PPOfAmount }, ObjectsTillNext.price); PPFrag.className = ColourTextPre + ColourOfPP({ pp: PPOfAmount }, ObjectsTillNext.price);
l('CMTooltipNextAchievement').appendChild(PPFrag); l('CMTooltipNextAchievement').appendChild(PPFrag);

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../../Config/VariablesAndData';
import Beautify from '../../BeautifyAndFormatting/Beautify'; import Beautify from '../../BeautifyAndFormatting/Beautify';
import { TooltipName } from '../../VariablesAndData'; import { TooltipName } from '../../VariablesAndData';
import * as Create from '../CreateTooltip'; import * as Create from '../CreateTooltip';
@@ -9,7 +8,10 @@ import * as Create from '../CreateTooltip';
*/ */
export default function GardenPlots() { export default function GardenPlots() {
const { minigame } = Game.Objects.Farm; const { minigame } = Game.Objects.Farm;
if (CMOptions.TooltipPlots && minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipPlots &&
minigame.plot[TooltipName[1]][TooltipName[0]][0] !== 0
) {
const mature = const mature =
minigame.plot[TooltipName[1]][TooltipName[0]][1] > minigame.plot[TooltipName[1]][TooltipName[0]][1] >
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].mature; minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].mature;

View File

@@ -1,5 +1,5 @@
import { CacheNoGoldSwitchCookiesPS } from '../../../Cache/VariablesAndData'; import { CacheNoGoldSwitchCookiesPS } from '../../../Cache/VariablesAndData';
import { CMOptions } from '../../../Config/VariablesAndData';
import Beautify from '../../BeautifyAndFormatting/Beautify'; import Beautify from '../../BeautifyAndFormatting/Beautify';
import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour'; import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour';
import CalculateGrimoireRefillTime from '../../HelperFunctions/CalculateGrimoireRefillTime'; import CalculateGrimoireRefillTime from '../../HelperFunctions/CalculateGrimoireRefillTime';
@@ -15,7 +15,10 @@ export default function Grimoire() {
const { minigame } = Game.Objects['Wizard tower']; const { minigame } = Game.Objects['Wizard tower'];
const spellCost = minigame.getSpellCost(minigame.spellsById[TooltipName]); const spellCost = minigame.getSpellCost(minigame.spellsById[TooltipName]);
if (CMOptions.TooltipGrim === 1 && spellCost <= minigame.magicM) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipGrim === 1 &&
spellCost <= minigame.magicM
) {
const tooltipBox = l('CMTooltipBorder'); const tooltipBox = l('CMTooltipBorder');
// Time left till enough magic for spell // Time left till enough magic for spell

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../../Config/VariablesAndData';
import Beautify from '../../BeautifyAndFormatting/Beautify'; import Beautify from '../../BeautifyAndFormatting/Beautify';
import * as Create from '../CreateTooltip'; import * as Create from '../CreateTooltip';
@@ -9,7 +8,7 @@ import * as Create from '../CreateTooltip';
*/ */
export default function HarvestAll() { export default function HarvestAll() {
const { minigame } = Game.Objects.Farm; const { minigame } = Game.Objects.Farm;
if (CMOptions.TooltipLump) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipLump) {
l('CMTooltipBorder').appendChild(Create.TooltipCreateHeader('Cookies gained from harvesting:')); l('CMTooltipBorder').appendChild(Create.TooltipCreateHeader('Cookies gained from harvesting:'));
let totalGain = 0; let totalGain = 0;
let mortal = 0; let mortal = 0;

View File

@@ -1,5 +1,4 @@
import { CacheGods } from '../../../Cache/VariablesAndData'; import { CacheGods } from '../../../Cache/VariablesAndData';
import { CMOptions } from '../../../Config/VariablesAndData';
import Beautify from '../../BeautifyAndFormatting/Beautify'; import Beautify from '../../BeautifyAndFormatting/Beautify';
import { TooltipName, TooltipType } from '../../VariablesAndData'; import { TooltipName, TooltipType } from '../../VariablesAndData';
import * as Create from '../CreateTooltip'; import * as Create from '../CreateTooltip';
@@ -10,7 +9,7 @@ import * as Create from '../CreateTooltip';
* It adds to the additional information to l('CMTooltipArea') * It adds to the additional information to l('CMTooltipArea')
*/ */
export default function PantheonGods() { export default function PantheonGods() {
if (CMOptions.TooltipPantheon === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipPantheon === 1) {
const tooltipBox = l('CMTooltipBorder'); const tooltipBox = l('CMTooltipBorder');
let GodID; let GodID;
if (TooltipType === 'pas') GodID = TooltipName[1]; if (TooltipType === 'pas') GodID = TooltipName[1];
@@ -26,7 +25,11 @@ export default function PantheonGods() {
if (Number.isFinite(increase) && increase !== 0) { if (Number.isFinite(increase) && increase !== 0) {
cps1.textContent += ` (${increase / 100}% of income)`; cps1.textContent += ` (${increase / 100}% of income)`;
} else { } else {
cps1.textContent += ` (<0${CMOptions.ScaleSeparator ? ',' : '.'}01% of income)`; cps1.textContent += ` (<0${
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator
? ','
: '.'
}01% of income)`;
} }
} else cps1.textContent = 'No effect to CPS'; } else cps1.textContent = 'No effect to CPS';
tooltipBox.appendChild(cps1); tooltipBox.appendChild(cps1);
@@ -40,7 +43,11 @@ export default function PantheonGods() {
if (Number.isFinite(increase) && increase !== 0) { if (Number.isFinite(increase) && increase !== 0) {
cps2.textContent += ` (${increase / 100}% of income)`; cps2.textContent += ` (${increase / 100}% of income)`;
} else { } else {
cps2.textContent += ` (<0${CMOptions.ScaleSeparator ? ',' : '.'}01% of income)`; cps2.textContent += ` (<0${
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator
? ','
: '.'
}01% of income)`;
} }
} else cps2.textContent = 'No effect to CPS'; } else cps2.textContent = 'No effect to CPS';
tooltipBox.appendChild(cps2); tooltipBox.appendChild(cps2);
@@ -54,7 +61,11 @@ export default function PantheonGods() {
if (Number.isFinite(increase) && increase !== 0) { if (Number.isFinite(increase) && increase !== 0) {
cps3.textContent += ` (${increase / 100}% of income)`; cps3.textContent += ` (${increase / 100}% of income)`;
} else { } else {
cps3.textContent += ` (<0${CMOptions.ScaleSeparator ? ',' : '.'}01% of income)`; cps3.textContent += ` (<0${
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator
? ','
: '.'
}01% of income)`;
} }
} else cps3.textContent = 'No effect to CPS'; } else cps3.textContent = 'No effect to CPS';
tooltipBox.appendChild(cps3); tooltipBox.appendChild(cps3);

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../../Config/VariablesAndData';
import GetLumpColour from '../../HelperFunctions/GetLumpColour'; import GetLumpColour from '../../HelperFunctions/GetLumpColour';
import { ColourTextPre } from '../../VariablesAndData'; import { ColourTextPre } from '../../VariablesAndData';
import * as Create from '../CreateTooltip'; import * as Create from '../CreateTooltip';
@@ -7,7 +6,7 @@ import * as Create from '../CreateTooltip';
* It adds to the additional information to l('CMTooltipArea') * It adds to the additional information to l('CMTooltipArea')
*/ */
export default function SugarLump() { export default function SugarLump() {
if (CMOptions.TooltipLump === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipLump === 1) {
const tooltipBox = l('CMTooltipBorder'); const tooltipBox = l('CMTooltipBorder');
tooltipBox.appendChild(Create.TooltipCreateHeader('Current Sugar Lump')); tooltipBox.appendChild(Create.TooltipCreateHeader('Current Sugar Lump'));

View File

@@ -1,5 +1,5 @@
import { CacheLastChoEgg, CacheUpgrades } from '../../../Cache/VariablesAndData'; import { CacheLastChoEgg, CacheUpgrades } from '../../../Cache/VariablesAndData';
import { CMOptions } from '../../../Config/VariablesAndData';
import Beautify from '../../BeautifyAndFormatting/Beautify'; import Beautify from '../../BeautifyAndFormatting/Beautify';
import FormatTime from '../../BeautifyAndFormatting/FormatTime'; import FormatTime from '../../BeautifyAndFormatting/FormatTime';
import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour'; import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour';
@@ -25,7 +25,9 @@ export default function Upgrade() {
TooltipPrice = Game.Upgrades[Game.UpgradesInStore[TooltipName].name].getPrice(); TooltipPrice = Game.Upgrades[Game.UpgradesInStore[TooltipName].name].getPrice();
TooltipBonusMouse = CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonusMouse; TooltipBonusMouse = CacheUpgrades[Game.UpgradesInStore[TooltipName].name].bonusMouse;
if (CMOptions.TooltipBuildUpgrade === 1) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipBuildUpgrade === 1
) {
l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2); l('CMTooltipIncome').textContent = Beautify(TooltipBonusIncome, 2);
const increase = Math.round((TooltipBonusIncome / Game.cookiesPs) * 10000); const increase = Math.round((TooltipBonusIncome / Game.cookiesPs) * 10000);
// Don't display certain parts of tooltip if not applicable // Don't display certain parts of tooltip if not applicable
@@ -39,7 +41,9 @@ export default function Upgrade() {
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`; l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
} else { } else {
l('CMTooltipIncome').textContent += ` (<0${ l('CMTooltipIncome').textContent += ` (<0${
CMOptions.ScaleSeparator ? ',' : '.' Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator
? ','
: '.'
}01% of income)`; }01% of income)`;
} }
l('CMTooltipBorder').className = l('CMTooltipBorder').className =
@@ -59,7 +63,7 @@ export default function Upgrade() {
l('Payback PeriodTitle').style.display = 'block'; l('Payback PeriodTitle').style.display = 'block';
l('CMTooltipPP').style.display = 'block'; l('CMTooltipPP').style.display = 'block';
} else { } else {
if (CMOptions.PPDisplayTime) if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
l('CMTooltipPP').textContent = FormatTime( l('CMTooltipPP').textContent = FormatTime(
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].pp, CacheUpgrades[Game.UpgradesInStore[TooltipName].name].pp,
); );

View File

@@ -1,7 +1,6 @@
import GetCPSBuffMult from '../../../Cache/CPS/GetCPSBuffMult'; import GetCPSBuffMult from '../../../Cache/CPS/GetCPSBuffMult';
import { CacheEdifice, CacheLucky } from '../../../Cache/VariablesAndData'; import { CacheEdifice, CacheLucky } from '../../../Cache/VariablesAndData';
import ToggleToolWarnPos from '../../../Config/Toggles/ToggleToolWarnPos'; import ToggleToolWarnPos from '../../../Config/Toggles/ToggleToolWarnPos';
import { CMOptions } from '../../../Config/VariablesAndData';
import Beautify from '../../BeautifyAndFormatting/Beautify'; import Beautify from '../../BeautifyAndFormatting/Beautify';
import FormatTime from '../../BeautifyAndFormatting/FormatTime'; import FormatTime from '../../BeautifyAndFormatting/FormatTime';
import GetCPS from '../../HelperFunctions/GetCPS'; import GetCPS from '../../HelperFunctions/GetCPS';
@@ -19,21 +18,25 @@ export default function Warnings() {
ToggleToolWarnPos(); ToggleToolWarnPos();
} }
if (CMOptions.ToolWarnPos === 0) l('CMDispTooltipWarningParent').style.right = '0px'; if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnPos === 0)
l('CMDispTooltipWarningParent').style.right = '0px';
else l('CMDispTooltipWarningParent').style.top = `${l('tooltip').offsetHeight}px`; else l('CMDispTooltipWarningParent').style.top = `${l('tooltip').offsetHeight}px`;
l('CMDispTooltipWarningParent').style.width = `${l('tooltip').offsetWidth - 6}px`; l('CMDispTooltipWarningParent').style.width = `${l('tooltip').offsetWidth - 6}px`;
const amount = Game.cookies + GetWrinkConfigBank() - TooltipPrice; const amount = Game.cookies + GetWrinkConfigBank() - TooltipPrice;
const bonusIncomeUsed = CMOptions.ToolWarnBon ? TooltipBonusIncome : 0; const bonusIncomeUsed = Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings
.ToolWarnBon
? TooltipBonusIncome
: 0;
let limitLucky = CacheLucky; let limitLucky = CacheLucky;
if (CMOptions.ToolWarnBon === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnBon === 1) {
let bonusNoFren = TooltipBonusIncome; let bonusNoFren = TooltipBonusIncome;
bonusNoFren /= GetCPSBuffMult(); bonusNoFren /= GetCPSBuffMult();
limitLucky += (bonusNoFren * 60 * 15) / 0.15; limitLucky += (bonusNoFren * 60 * 15) / 0.15;
} }
if (CMOptions.ToolWarnLucky === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnLucky === 1) {
if (amount < limitLucky && (TooltipType !== 'b' || Game.buyMode === 1)) { if (amount < limitLucky && (TooltipType !== 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnLucky').style.display = ''; l('CMDispTooltipWarnLucky').style.display = '';
l('CMDispTooltipWarnLuckyText').textContent = `${Beautify( l('CMDispTooltipWarnLuckyText').textContent = `${Beautify(
@@ -42,7 +45,9 @@ export default function Warnings() {
} else l('CMDispTooltipWarnLucky').style.display = 'none'; } else l('CMDispTooltipWarnLucky').style.display = 'none';
} else l('CMDispTooltipWarnLucky').style.display = 'none'; } else l('CMDispTooltipWarnLucky').style.display = 'none';
if (CMOptions.ToolWarnLuckyFrenzy === 1) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnLuckyFrenzy === 1
) {
const limitLuckyFrenzy = limitLucky * 7; const limitLuckyFrenzy = limitLucky * 7;
if (amount < limitLuckyFrenzy && (TooltipType !== 'b' || Game.buyMode === 1)) { if (amount < limitLuckyFrenzy && (TooltipType !== 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnLuckyFrenzy').style.display = ''; l('CMDispTooltipWarnLuckyFrenzy').style.display = '';
@@ -52,7 +57,7 @@ export default function Warnings() {
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none'; } else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none'; } else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
if (CMOptions.ToolWarnConjure === 1) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnConjure === 1) {
const limitConjure = limitLucky * 2; const limitConjure = limitLucky * 2;
if (amount < limitConjure && (TooltipType !== 'b' || Game.buyMode === 1)) { if (amount < limitConjure && (TooltipType !== 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnConjure').style.display = ''; l('CMDispTooltipWarnConjure').style.display = '';
@@ -62,7 +67,10 @@ export default function Warnings() {
} else l('CMDispTooltipWarnConjure').style.display = 'none'; } else l('CMDispTooltipWarnConjure').style.display = 'none';
} else l('CMDispTooltipWarnConjure').style.display = 'none'; } else l('CMDispTooltipWarnConjure').style.display = 'none';
if (CMOptions.ToolWarnConjureFrenzy === 1) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnConjureFrenzy ===
1
) {
const limitConjureFrenzy = limitLucky * 2 * 7; const limitConjureFrenzy = limitLucky * 2 * 7;
if (amount < limitConjureFrenzy && (TooltipType !== 'b' || Game.buyMode === 1)) { if (amount < limitConjureFrenzy && (TooltipType !== 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnConjureFrenzy').style.display = ''; l('CMDispTooltipWarnConjureFrenzy').style.display = '';
@@ -72,7 +80,10 @@ export default function Warnings() {
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none'; } else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none'; } else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
if (CMOptions.ToolWarnEdifice === 1 && Game.Objects['Wizard tower'].minigameLoaded) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnEdifice === 1 &&
Game.Objects['Wizard tower'].minigameLoaded
) {
if (CacheEdifice && amount < CacheEdifice && (TooltipType !== 'b' || Game.buyMode === 1)) { if (CacheEdifice && amount < CacheEdifice && (TooltipType !== 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnEdifice').style.display = ''; l('CMDispTooltipWarnEdifice').style.display = '';
l('CMDispTooltipWarnEdificeText').textContent = `${Beautify( l('CMDispTooltipWarnEdificeText').textContent = `${Beautify(
@@ -81,20 +92,27 @@ export default function Warnings() {
} else l('CMDispTooltipWarnEdifice').style.display = 'none'; } else l('CMDispTooltipWarnEdifice').style.display = 'none';
} else l('CMDispTooltipWarnEdifice').style.display = 'none'; } else l('CMDispTooltipWarnEdifice').style.display = 'none';
if (CMOptions.ToolWarnUser > 0) { if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser > 0) {
if ( if (
amount < CMOptions.ToolWarnUser * GetCPS() && amount <
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser *
GetCPS() &&
(TooltipType !== 'b' || Game.buyMode === 1) (TooltipType !== 'b' || Game.buyMode === 1)
) { ) {
l('CMDispTooltipWarnUser').style.display = ''; l('CMDispTooltipWarnUser').style.display = '';
// Need to update tooltip text dynamically // Need to update tooltip text dynamically
l( l(
'CMDispTooltipWarnUser', 'CMDispTooltipWarnUser',
).children[0].textContent = `Purchase of this item will put you under the number of Cookies equal to ${CMOptions.ToolWarnUser} seconds of CPS`; ).children[0].textContent = `Purchase of this item will put you under the number of Cookies equal to ${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser} seconds of CPS`;
l('CMDispTooltipWarnUserText').textContent = `${Beautify( l('CMDispTooltipWarnUserText').textContent = `${Beautify(
CMOptions.ToolWarnUser * GetCPS() - amount, Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser *
GetCPS() -
amount,
)} (${FormatTime( )} (${FormatTime(
(CMOptions.ToolWarnUser * GetCPS() - amount) / (GetCPS() + bonusIncomeUsed), (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser *
GetCPS() -
amount) /
(GetCPS() + bonusIncomeUsed),
)})`; )})`;
} else l('CMDispTooltipWarnUser').style.display = 'none'; } else l('CMDispTooltipWarnUser').style.display = 'none';
} else l('CMDispTooltipWarnUser').style.display = 'none'; } else l('CMDispTooltipWarnUser').style.display = 'none';

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import { SimObjects } from '../../Sim/VariablesAndData'; import { SimObjects } from '../../Sim/VariablesAndData';
import Beautify from '../BeautifyAndFormatting/Beautify'; import Beautify from '../BeautifyAndFormatting/Beautify';
import { import {
@@ -13,7 +12,10 @@ import {
* As wrinklers are not appended to the DOM we us a different system than for other tooltips * As wrinklers are not appended to the DOM we us a different system than for other tooltips
*/ */
export function CheckWrinklerTooltip() { export function CheckWrinklerTooltip() {
if (CMOptions.TooltipWrink === 1 && TooltipWrinklerArea === 1) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipWrink === 1 &&
TooltipWrinklerArea === 1
) {
// Latter is set by CM.Main.AddWrinklerAreaDetect // Latter is set by CM.Main.AddWrinklerAreaDetect
let showingTooltip = false; let showingTooltip = false;
Object.keys(Game.wrinklers).forEach((i) => { Object.keys(Game.wrinklers).forEach((i) => {
@@ -50,7 +52,10 @@ export function CheckWrinklerTooltip() {
* As wrinklers are not appended to the DOM we us a different system than for other tooltips * As wrinklers are not appended to the DOM we us a different system than for other tooltips
*/ */
export function UpdateWrinklerTooltip() { export function UpdateWrinklerTooltip() {
if (CMOptions.TooltipWrink === 1 && l('CMTooltipWrinkler') !== null) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipWrink === 1 &&
l('CMTooltipWrinkler') !== null
) {
let { sucked } = Game.wrinklers[TooltipWrinkler]; let { sucked } = Game.wrinklers[TooltipWrinkler];
let toSuck = 1.1; let toSuck = 1.1;
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05; if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;

View File

@@ -1,3 +1,4 @@
import { initFunctions } from '@cookiemonsterteam/cookiemonsterframework';
import { VersionMajor, VersionMinor } from '../Data/Moddata.ts'; import { VersionMajor, VersionMinor } from '../Data/Moddata.ts';
import CMDrawHook from '../Disp/DrawHook'; import CMDrawHook from '../Disp/DrawHook';
import CMClickHook from '../Main/ClickHook'; import CMClickHook from '../Main/ClickHook';
@@ -14,6 +15,11 @@ import { isInitializing } from './Variables'; // eslint-disable-line no-unused-v
export default function init() { export default function init() {
isInitializing = true; isInitializing = true;
let proceed = true; let proceed = true;
// Load Cookie Monster Mod Framework and register mod
initFunctions.initModFramework();
initFunctions.registerMod('cookieMonsterMod');
if (Game.version !== Number(VersionMajor)) { if (Game.version !== Number(VersionMajor)) {
// eslint-disable-next-line no-restricted-globals, no-alert // eslint-disable-next-line no-restricted-globals, no-alert
proceed = confirm( proceed = confirm(

View File

@@ -1,6 +1,10 @@
import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings'; import loadMod from '@cookiemonsterteam/cookiemonsterframework/src/saveDataFunctions/loadMod';
import headers from '../Data/headers';
import { VersionMajor, VersionMinor } from '../Data/Moddata.ts'; import { VersionMajor, VersionMinor } from '../Data/Moddata.ts';
import { FavouriteSettings } from '../Disp/VariablesAndData'; // eslint-disable-line no-unused-vars import settings from '../Data/settings';
import UpdateColours from '../Disp/HelperFunctions/UpdateColours';
import CMLoopHook from '../Main/LoopHook';
import InitData from '../Sim/InitializeData/InitData'; import InitData from '../Sim/InitializeData/InitData';
/** /**
@@ -8,12 +12,13 @@ import InitData from '../Sim/InitializeData/InitData';
* "do stuff with the string data you saved previously" * "do stuff with the string data you saved previously"
*/ */
export default function load(str) { export default function load(str) {
const save = JSON.parse(str);
InitData(); InitData();
// The if-statement is a failsafe for old saves loadMod('cookieMonsterMod', str, settings, headers, CMLoopHook);
if (typeof save.favouriteSettings !== 'undefined') FavouriteSettings = save.favouriteSettings; UpdateColours();
LoadConfig(save.settings); if (
if (save.version !== `${VersionMajor}.${VersionMinor}`) { Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.version !==
`${VersionMajor}.${VersionMinor}`
) {
if (Game.prefs.popups) if (Game.prefs.popups)
Game.Popup( Game.Popup(
'A new version of Cookie Monster has been loaded, check out the release notes in the info tab!', 'A new version of Cookie Monster has been loaded, check out the release notes in the info tab!',

View File

@@ -1,6 +1,4 @@
import { CMOptions } from '../Config/VariablesAndData';
import { VersionMajor, VersionMinor } from '../Data/Moddata.ts'; import { VersionMajor, VersionMinor } from '../Data/Moddata.ts';
import { FavouriteSettings } from '../Disp/VariablesAndData';
/** /**
* This creates a save function to the CM object. Per Game code/comments: * This creates a save function to the CM object. Per Game code/comments:
@@ -8,9 +6,7 @@ import { FavouriteSettings } from '../Disp/VariablesAndData';
* return 'a string to be saved';" * return 'a string to be saved';"
*/ */
export default function save() { export default function save() {
return JSON.stringify({ const saveObject = Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod;
favouriteSettings: FavouriteSettings, saveObject.version = `${VersionMajor}.${VersionMinor}`;
settings: CMOptions, return JSON.stringify(saveObject);
version: `${VersionMajor}.${VersionMinor}`,
});
} }

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
import PlaySound from '../../Disp/Notifications/Sound'; import PlaySound from '../../Disp/Notifications/Sound';
import { LastGardenNextStep } from '../VariablesAndData'; import { LastGardenNextStep } from '../VariablesAndData';
@@ -13,7 +12,12 @@ export default function CheckGardenTick() {
) { ) {
if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) { if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) {
Flash(3, 'GardFlash', false); Flash(3, 'GardFlash', false);
PlaySound(CMOptions.GardSoundURL, 'GardSound', 'GardVolume', false); PlaySound(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GardSoundURL,
'GardSound',
'GardVolume',
false,
);
} }
LastGardenNextStep = Game.Objects.Farm.minigame.nextStep; LastGardenNextStep = Game.Objects.Farm.minigame.nextStep;
} }

View File

@@ -1,5 +1,4 @@
import { CacheSpawnedGoldenShimmer, CacheGoldenShimmersByID } from '../../Cache/VariablesAndData'; // eslint-disable-line no-unused-vars import { CacheSpawnedGoldenShimmer, CacheGoldenShimmersByID } from '../../Cache/VariablesAndData'; // eslint-disable-line no-unused-vars
import { CMOptions } from '../../Config/VariablesAndData';
import CreateGCTimer from '../../Disp/GoldenCookieTimers/GoldenCookieTimers'; import CreateGCTimer from '../../Disp/GoldenCookieTimers/GoldenCookieTimers';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
import CreateNotification from '../../Disp/Notifications/Notification'; import CreateNotification from '../../Disp/Notifications/Notification';
@@ -46,7 +45,12 @@ export default function CheckGoldenCookie() {
if (LastGoldenCookieState) { if (LastGoldenCookieState) {
if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) { if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) {
Flash(3, 'GCFlash', false); Flash(3, 'GCFlash', false);
PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume', false); PlaySound(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCSoundURL,
'GCSound',
'GCVolume',
false,
);
CreateNotification( CreateNotification(
'GCNotification', 'GCNotification',
'Golden Cookie Spawned', 'Golden Cookie Spawned',
@@ -63,7 +67,10 @@ export default function CheckGoldenCookie() {
UpdateFavicon(); UpdateFavicon();
LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState; LastSpawnedGoldenCookieState = CurrSpawnedGoldenCookieState;
if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0; if (CurrSpawnedGoldenCookieState === 0) CacheSpawnedGoldenShimmer = 0;
} else if (CMOptions.GCTimer === 1 && LastGoldenCookieState) { } else if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer === 1 &&
LastGoldenCookieState
) {
Object.keys(GCTimers).forEach((i) => { Object.keys(GCTimers).forEach((i) => {
GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity; GCTimers[i].style.opacity = CacheGoldenShimmersByID[i].l.style.opacity;
GCTimers[i].style.transform = CacheGoldenShimmersByID[i].l.style.transform; GCTimers[i].style.transform = CacheGoldenShimmersByID[i].l.style.transform;

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
import CreateNotification from '../../Disp/Notifications/Notification'; import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound'; import PlaySound from '../../Disp/Notifications/Sound';
@@ -9,13 +8,21 @@ import { LastMagicBarFull } from '../VariablesAndData';
* It is called by CM.Main.Loop * It is called by CM.Main.Loop
*/ */
export default function CheckMagicMeter() { export default function CheckMagicMeter() {
if (Game.Objects['Wizard tower'].minigameLoaded && CMOptions.GrimoireBar === 1) { if (
Game.Objects['Wizard tower'].minigameLoaded &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GrimoireBar === 1
) {
const { minigame } = Game.Objects['Wizard tower']; const { minigame } = Game.Objects['Wizard tower'];
if (minigame.magic < minigame.magicM) LastMagicBarFull = false; if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
else if (!LastMagicBarFull) { else if (!LastMagicBarFull) {
LastMagicBarFull = true; LastMagicBarFull = true;
Flash(3, 'MagicFlash', false); Flash(3, 'MagicFlash', false);
PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume', false); PlaySound(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MagicSoundURL,
'MagicSound',
'MagicVolume',
false,
);
CreateNotification( CreateNotification(
'MagicNotification', 'MagicNotification',
'Magic Meter full', 'Magic Meter full',

View File

@@ -1,5 +1,4 @@
import { CacheSeasonPopShimmer } from '../../Cache/VariablesAndData'; // eslint-disable-line no-unused-vars import { CacheSeasonPopShimmer } from '../../Cache/VariablesAndData'; // eslint-disable-line no-unused-vars
import { CMOptions } from '../../Config/VariablesAndData';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
import CreateNotification from '../../Disp/Notifications/Notification'; import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound'; import PlaySound from '../../Disp/Notifications/Sound';
@@ -18,7 +17,12 @@ export default function CheckSeasonPopup() {
} }
}); });
Flash(3, 'SeaFlash', false); Flash(3, 'SeaFlash', false);
PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume', false); PlaySound(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SeaSoundURL,
'SeaSound',
'SeaVolume',
false,
);
CreateNotification( CreateNotification(
'SeaNotification', 'SeaNotification',
'Reindeer sighted!', 'Reindeer sighted!',

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
import CreateNotification from '../../Disp/Notifications/Notification'; import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound'; import PlaySound from '../../Disp/Notifications/Sound';
@@ -13,7 +12,12 @@ export default function CheckTickerFortune() {
LastTickerFortuneState = Game.TickerEffect && Game.TickerEffect.type === 'fortune'; LastTickerFortuneState = Game.TickerEffect && Game.TickerEffect.type === 'fortune';
if (LastTickerFortuneState) { if (LastTickerFortuneState) {
Flash(3, 'FortuneFlash', false); Flash(3, 'FortuneFlash', false);
PlaySound(CMOptions.FortuneSoundURL, 'FortuneSound', 'FortuneVolume', false); PlaySound(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FortuneSoundURL,
'FortuneSound',
'FortuneVolume',
false,
);
CreateNotification( CreateNotification(
'FortuneNotification', 'FortuneNotification',
'Fortune Cookie found', 'Fortune Cookie found',

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
import CreateNotification from '../../Disp/Notifications/Notification'; import CreateNotification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound'; import PlaySound from '../../Disp/Notifications/Sound';
@@ -16,17 +15,36 @@ export default function CheckWrinklerCount() {
}); });
if (CurrentWrinklers > LastWrinklerCount) { if (CurrentWrinklers > LastWrinklerCount) {
LastWrinklerCount = CurrentWrinklers; LastWrinklerCount = CurrentWrinklers;
if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxFlash) { if (
CurrentWrinklers === Game.getWrinklersMax() &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxFlash
) {
Flash(3, 'WrinklerMaxFlash', false); Flash(3, 'WrinklerMaxFlash', false);
} else { } else {
Flash(3, 'WrinklerFlash', false); Flash(3, 'WrinklerFlash', false);
} }
if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxSound) { if (
PlaySound(CMOptions.WrinklerMaxSoundURL, 'WrinklerMaxSound', 'WrinklerMaxVolume', false); CurrentWrinklers === Game.getWrinklersMax() &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxSound
) {
PlaySound(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxSoundURL,
'WrinklerMaxSound',
'WrinklerMaxVolume',
false,
);
} else { } else {
PlaySound(CMOptions.WrinklerSoundURL, 'WrinklerSound', 'WrinklerVolume', false); PlaySound(
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerSoundURL,
'WrinklerSound',
'WrinklerVolume',
false,
);
} }
if (CurrentWrinklers === Game.getWrinklersMax() && CMOptions.WrinklerMaxNotification) { if (
CurrentWrinklers === Game.getWrinklersMax() &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxNotification
) {
CreateNotification( CreateNotification(
'WrinklerMaxNotification', 'WrinklerMaxNotification',
'Maximum Wrinklers Reached', 'Maximum Wrinklers Reached',

View File

@@ -1,6 +1,5 @@
import InitCache from '../Cache/CacheInit'; import InitCache from '../Cache/CacheInit';
import { CacheStatsCookies } from '../Cache/Stats/Stats'; import { CacheStatsCookies } from '../Cache/Stats/Stats';
import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings';
import { VersionMajor, VersionMinor } from '../Data/Moddata.ts'; import { VersionMajor, VersionMinor } from '../Data/Moddata.ts';
import CreateUpgradeBar from '../Disp/BuildingsUpgrades/UpgradeBar'; import CreateUpgradeBar from '../Disp/BuildingsUpgrades/UpgradeBar';
import { CreateBotBar } from '../Disp/InfoBars/BottomBar'; import { CreateBotBar } from '../Disp/InfoBars/BottomBar';
@@ -20,6 +19,7 @@ import ReplaceNative from './ReplaceGameFunctions/ReplaceNative';
import { LastModCount } from './VariablesAndData'; // eslint-disable-line no-unused-vars import { LastModCount } from './VariablesAndData'; // eslint-disable-line no-unused-vars
import AddWrinklerAreaDetect from './WrinklerArea/AddDetectArea'; import AddWrinklerAreaDetect from './WrinklerArea/AddDetectArea';
import CreateBuildingLockButtons from '../Disp/Buildings/CreateBuildingLockButtons'; import CreateBuildingLockButtons from '../Disp/Buildings/CreateBuildingLockButtons';
import createMenuInfo from '../Disp/MenuSections/createMenuInfo';
/** /**
* Initialization loop of Cookie Monster * Initialization loop of Cookie Monster
@@ -28,6 +28,9 @@ export default function InitializeCookieMonster() {
// Create global data object // Create global data object
window.CookieMonsterData = {}; window.CookieMonsterData = {};
// Register listeners in Cookie Monster Mod Framework
Game.mods.cookieMonsterFramework.listeners.infoMenu.push(createMenuInfo);
InitData(); InitData();
CacheStatsCookies(); CacheStatsCookies();
InitCache(); InitCache();
@@ -58,7 +61,6 @@ export default function InitializeCookieMonster() {
ReplaceNativeGrimoire(); ReplaceNativeGrimoire();
Game.CalculateGains(); Game.CalculateGains();
LoadConfig();
CMLastAscendState = Game.OnAscend; CMLastAscendState = Game.OnAscend;
if (Game.prefs.popups) if (Game.prefs.popups)

View File

@@ -1,4 +1,3 @@
import { CMOptions } from '../../Config/VariablesAndData';
import FormatTime from '../../Disp/BeautifyAndFormatting/FormatTime'; import FormatTime from '../../Disp/BeautifyAndFormatting/FormatTime';
import CalculateGrimoireRefillTime from '../../Disp/HelperFunctions/CalculateGrimoireRefillTime'; import CalculateGrimoireRefillTime from '../../Disp/HelperFunctions/CalculateGrimoireRefillTime';
import { import {
@@ -19,7 +18,10 @@ function ReplaceNativeGrimoireDraw() {
BackupGrimoireDraw = minigame.draw; BackupGrimoireDraw = minigame.draw;
Game.Objects['Wizard tower'].minigame.draw = function () { Game.Objects['Wizard tower'].minigame.draw = function () {
BackupGrimoireDraw(); BackupGrimoireDraw();
if (CMOptions.GrimoireBar === 1 && minigame.magic < minigame.magicM) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GrimoireBar === 1 &&
minigame.magic < minigame.magicM
) {
minigame.magicBarTextL.innerHTML += ` (${FormatTime( minigame.magicBarTextL.innerHTML += ` (${FormatTime(
CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM), CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM),
)})`; )})`;

View File

@@ -1,12 +1,13 @@
import { CMOptions } from '../../Config/VariablesAndData';
/** /**
* This function fixes Game.mouseY as a result of bars that are added by CookieMonster * This function fixes Game.mouseY as a result of bars that are added by CookieMonster
* It is called by Game.UpdateWrinklers(), Game.UpdateSpecial() and the .onmousover of the BigCookie * It is called by Game.UpdateWrinklers(), Game.UpdateSpecial() and the .onmousover of the BigCookie
* before execution of their actual function * before execution of their actual function
*/ */
export default function FixMouseY(target) { export default function FixMouseY(target) {
if (CMOptions.TimerBar === 1 && CMOptions.TimerBarPos === 0) { if (
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1 &&
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos === 0
) {
const timerBarHeight = parseInt(l('CMTimerBar').style.height, 10); const timerBarHeight = parseInt(l('CMTimerBar').style.height, 10);
Game.mouseY -= timerBarHeight; Game.mouseY -= timerBarHeight;
target(); target();

View File

@@ -1,5 +1,5 @@
import jscolor from '@eastdesire/jscolor'; import jscolor from '@eastdesire/jscolor';
import { CMOptions } from '../../Config/VariablesAndData';
import CMBeautify from '../../Disp/BeautifyAndFormatting/Beautify'; import CMBeautify from '../../Disp/BeautifyAndFormatting/Beautify';
import FormatTime from '../../Disp/BeautifyAndFormatting/FormatTime'; import FormatTime from '../../Disp/BeautifyAndFormatting/FormatTime';
import { AddAuraInfo, AddDragonLevelUpTooltip } from '../../Disp/Dragon/Dragon'; import { AddAuraInfo, AddDragonLevelUpTooltip } from '../../Disp/Dragon/Dragon';
@@ -86,7 +86,7 @@ export default function ReplaceNative() {
*/ */
Game.ClickProduct = function (what) { Game.ClickProduct = function (what) {
if ( if (
!CMOptions.BulkBuyBlock || !Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BulkBuyBlock ||
Game.ObjectsById[what].bulkPrice < Game.cookies || Game.ObjectsById[what].bulkPrice < Game.cookies ||
Game.buyMode === -1 Game.buyMode === -1
) { ) {

View File

@@ -9,4 +9,5 @@ export const Game = {
LeftBackground: { canvas: { parentNode: {} } }, LeftBackground: { canvas: { parentNode: {} } },
RebuildUpgrades() {}, RebuildUpgrades() {},
UpgradesInStore: {}, UpgradesInStore: {},
mods: { cookieMonsterFramework: { saveData: { cookieMonsterMod: { settings: {} } } } },
}; };

View File

@@ -3,7 +3,6 @@ import { assert } from 'chai';
import { l, Game } from '../../GlobalsForTesting'; import { l, Game } from '../../GlobalsForTesting';
import ToggleBotBar from '../../../src/Config/Toggles/ToggleBotBar'; import ToggleBotBar from '../../../src/Config/Toggles/ToggleBotBar';
import { CMOptions } from '../../../src/Config/VariablesAndData';
describe('ToggleBotBar', () => { describe('ToggleBotBar', () => {
global.l = l; global.l = l;
@@ -16,7 +15,7 @@ describe('ToggleBotBar', () => {
describe('BotBar = 0', () => { describe('BotBar = 0', () => {
before(() => { before(() => {
CMOptions.BotBar = 0; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar = 0;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(domids.CMBotBar.style.display, 'none'); // eslint-disable-line no-undef assert.equal(domids.CMBotBar.style.display, 'none'); // eslint-disable-line no-undef
@@ -24,7 +23,7 @@ describe('ToggleBotBar', () => {
}); });
describe('BotBar = 1', () => { describe('BotBar = 1', () => {
before(() => { before(() => {
CMOptions.BotBar = 1; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar = 1;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(domids.CMBotBar.style.display, ''); // eslint-disable-line no-undef assert.equal(domids.CMBotBar.style.display, ''); // eslint-disable-line no-undef

View File

@@ -2,7 +2,6 @@ import { before, beforeEach, describe, it } from 'mocha';
import { assert } from 'chai'; import { assert } from 'chai';
import { Game } from '../../GlobalsForTesting'; import { Game } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleDetailedTime from '../../../src/Config/Toggles/ToggleDetailedTime'; import ToggleDetailedTime from '../../../src/Config/Toggles/ToggleDetailedTime';
import { BackupFunctions } from '../../../src/Main/VariablesAndData'; import { BackupFunctions } from '../../../src/Main/VariablesAndData';
@@ -15,7 +14,7 @@ describe('ToggleDetailedTime', () => {
describe('DetailedTime = 0', () => { describe('DetailedTime = 0', () => {
before(() => { before(() => {
CMOptions.DetailedTime = 0; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.DetailedTime = 0;
BackupFunctions.sayTime = 'BackupFunctions.sayTime'; BackupFunctions.sayTime = 'BackupFunctions.sayTime';
}); });
it('Set correct time function', () => { it('Set correct time function', () => {
@@ -24,7 +23,7 @@ describe('ToggleDetailedTime', () => {
}); });
describe('DetailedTime = 1', () => { describe('DetailedTime = 1', () => {
before(() => { before(() => {
CMOptions.DetailedTime = 1; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.DetailedTime = 1;
}); });
it('Set correct time function', () => { it('Set correct time function', () => {
assert.equal(Game.sayTime.name, 'CMSayTime'); assert.equal(Game.sayTime.name, 'CMSayTime');

View File

@@ -2,7 +2,6 @@ import { before, beforeEach, describe, it } from 'mocha';
import { assert } from 'chai'; import { assert } from 'chai';
import { l } from '../../GlobalsForTesting'; import { l } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleGCTimer from '../../../src/Config/Toggles/ToggleGCTimer'; import ToggleGCTimer from '../../../src/Config/Toggles/ToggleGCTimer';
import { GCTimers } from '../../../src/Disp/VariablesAndData'; import { GCTimers } from '../../../src/Disp/VariablesAndData';
import { CacheGoldenShimmersByID } from '../../../src/Cache/VariablesAndData'; import { CacheGoldenShimmersByID } from '../../../src/Cache/VariablesAndData';
@@ -25,7 +24,7 @@ describe('ToggleGCTimer', () => {
describe('GCTimer = 0', () => { describe('GCTimer = 0', () => {
before(() => { before(() => {
CMOptions.GCTimer = 0; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer = 0;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(GCTimers[0].style.display, 'none'); assert.equal(GCTimers[0].style.display, 'none');
@@ -34,7 +33,7 @@ describe('ToggleGCTimer', () => {
}); });
describe('GCTimer = 1', () => { describe('GCTimer = 1', () => {
before(() => { before(() => {
CMOptions.GCTimer = 1; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer = 1;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(GCTimers[0].style.display, 'block'); assert.equal(GCTimers[0].style.display, 'block');

View File

@@ -2,7 +2,6 @@ import { before, beforeEach, describe, it } from 'mocha';
import { assert } from 'chai'; import { assert } from 'chai';
import { l } from '../../GlobalsForTesting'; import { l } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleSectionHideButtons from '../../../src/Config/Toggles/ToggleSectionHideButtons'; import ToggleSectionHideButtons from '../../../src/Config/Toggles/ToggleSectionHideButtons';
describe('ToggleSectionHideButtons', () => { describe('ToggleSectionHideButtons', () => {
@@ -15,7 +14,7 @@ describe('ToggleSectionHideButtons', () => {
describe('HideSectionsButtons = 0', () => { describe('HideSectionsButtons = 0', () => {
before(() => { before(() => {
CMOptions.HideSectionsButtons = 0; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.HideSectionsButtons = 0;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(domids.CMSectionHidButtons.style.display, 'none'); // eslint-disable-line no-undef assert.equal(domids.CMSectionHidButtons.style.display, 'none'); // eslint-disable-line no-undef
@@ -23,7 +22,7 @@ describe('ToggleSectionHideButtons', () => {
}); });
describe('HideSectionsButtons = 1', () => { describe('HideSectionsButtons = 1', () => {
before(() => { before(() => {
CMOptions.HideSectionsButtons = 1; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.HideSectionsButtons = 1;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(domids.CMSectionHidButtons.style.display, ''); // eslint-disable-line no-undef assert.equal(domids.CMSectionHidButtons.style.display, ''); // eslint-disable-line no-undef

View File

@@ -2,7 +2,6 @@ import { before, beforeEach, describe, it } from 'mocha';
import { assert } from 'chai'; import { assert } from 'chai';
import { l } from '../../GlobalsForTesting'; import { l } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleToolWarnPos from '../../../src/Config/Toggles/ToggleToolWarnPos'; import ToggleToolWarnPos from '../../../src/Config/Toggles/ToggleToolWarnPos';
describe('ToggleToolWarnPos', () => { describe('ToggleToolWarnPos', () => {
@@ -15,7 +14,7 @@ describe('ToggleToolWarnPos', () => {
describe('ToolWarnPos = 0', () => { describe('ToolWarnPos = 0', () => {
before(() => { before(() => {
CMOptions.ToolWarnPos = 0; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnPos = 0;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(domids.CMDispTooltipWarningParent.style.top, 'auto'); // eslint-disable-line no-undef assert.equal(domids.CMDispTooltipWarningParent.style.top, 'auto'); // eslint-disable-line no-undef
@@ -25,7 +24,7 @@ describe('ToggleToolWarnPos', () => {
}); });
describe('ToolWarnPos = 1', () => { describe('ToolWarnPos = 1', () => {
before(() => { before(() => {
CMOptions.ToolWarnPos = 1; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnPos = 1;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(domids.CMDispTooltipWarningParent.style.right, 'auto'); // eslint-disable-line no-undef assert.equal(domids.CMDispTooltipWarningParent.style.right, 'auto'); // eslint-disable-line no-undef

View File

@@ -2,7 +2,6 @@ import { before, beforeEach, describe, it } from 'mocha';
import { assert } from 'chai'; import { assert } from 'chai';
import { l, Game } from '../../GlobalsForTesting'; import { l, Game } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleUpgradeBarAndColor from '../../../src/Config/Toggles/ToggleUpgradeBarAndColour'; import ToggleUpgradeBarAndColor from '../../../src/Config/Toggles/ToggleUpgradeBarAndColour';
describe('ToggleUpgradeBarAndColor', () => { describe('ToggleUpgradeBarAndColor', () => {
@@ -16,7 +15,7 @@ describe('ToggleUpgradeBarAndColor', () => {
describe('UpBarColor = 0', () => { describe('UpBarColor = 0', () => {
before(() => { before(() => {
CMOptions.UpBarColor = 0; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColor = 0;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef
@@ -24,7 +23,7 @@ describe('ToggleUpgradeBarAndColor', () => {
}); });
describe('UpBarColor = 1', () => { describe('UpBarColor = 1', () => {
before(() => { before(() => {
CMOptions.UpBarColor = 1; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColor = 1;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(domids.CMUpgradeBar.style.display, ''); // eslint-disable-line no-undef assert.equal(domids.CMUpgradeBar.style.display, ''); // eslint-disable-line no-undef
@@ -32,7 +31,7 @@ describe('ToggleUpgradeBarAndColor', () => {
}); });
describe('UpBarColor = 2', () => { describe('UpBarColor = 2', () => {
before(() => { before(() => {
CMOptions.UpBarColor = 2; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColor = 2;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef

View File

@@ -2,7 +2,6 @@ import { before, beforeEach, describe, it } from 'mocha';
import { assert } from 'chai'; import { assert } from 'chai';
import { l } from '../../GlobalsForTesting'; import { l } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleUpgradeBarFixedPos from '../../../src/Config/Toggles/ToggleUpgradeBarFixedPos'; import ToggleUpgradeBarFixedPos from '../../../src/Config/Toggles/ToggleUpgradeBarFixedPos';
describe('ToggleUpgradeBarFixedPos', () => { describe('ToggleUpgradeBarFixedPos', () => {
@@ -15,7 +14,7 @@ describe('ToggleUpgradeBarFixedPos', () => {
describe('UpgradeBarFixedPos = 0', () => { describe('UpgradeBarFixedPos = 0', () => {
before(() => { before(() => {
CMOptions.UpgradeBarFixedPos = 0; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpgradeBarFixedPos = 0;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(domids.CMUpgradeBar.style.position, ''); // eslint-disable-line no-undef assert.equal(domids.CMUpgradeBar.style.position, ''); // eslint-disable-line no-undef
@@ -23,7 +22,7 @@ describe('ToggleUpgradeBarFixedPos', () => {
}); });
describe('UpgradeBarFixedPos = 1', () => { describe('UpgradeBarFixedPos = 1', () => {
before(() => { before(() => {
CMOptions.UpgradeBarFixedPos = 1; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpgradeBarFixedPos = 1;
}); });
it('Toggle style correctly', () => { it('Toggle style correctly', () => {
assert.equal(domids.CMUpgradeBar.style.position, 'sticky'); // eslint-disable-line no-undef assert.equal(domids.CMUpgradeBar.style.position, 'sticky'); // eslint-disable-line no-undef

View File

@@ -2,7 +2,6 @@ import { before, beforeEach, describe, it } from 'mocha';
import { assert } from 'chai'; import { assert } from 'chai';
import { l, Game } from '../../GlobalsForTesting'; import { l, Game } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleWrinklerButtons from '../../../src/Config/Toggles/ToggleWrinklerButtons'; import ToggleWrinklerButtons from '../../../src/Config/Toggles/ToggleWrinklerButtons';
describe('ToggleWrinklerButtons', () => { describe('ToggleWrinklerButtons', () => {
@@ -16,7 +15,7 @@ describe('ToggleWrinklerButtons', () => {
describe('WrinklerButtons = 0', () => { describe('WrinklerButtons = 0', () => {
before(() => { before(() => {
CMOptions.WrinklerButtons = 0; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerButtons = 0;
}); });
describe('Game.elderWrath = 0', () => { describe('Game.elderWrath = 0', () => {
before(() => { before(() => {
@@ -39,7 +38,7 @@ describe('ToggleWrinklerButtons', () => {
}); });
describe('WrinklerButtons = 1', () => { describe('WrinklerButtons = 1', () => {
before(() => { before(() => {
CMOptions.WrinklerButtons = 1; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerButtons = 1;
}); });
describe('Game.elderWrath = 0', () => { describe('Game.elderWrath = 0', () => {
before(() => { before(() => {

View File

@@ -2,7 +2,6 @@ import { before, describe, it } from 'mocha';
import { assert } from 'chai'; import { assert } from 'chai';
import FormatTime from '../../src/Disp/BeautifyAndFormatting/FormatTime'; import FormatTime from '../../src/Disp/BeautifyAndFormatting/FormatTime';
import { CMOptions } from '../../src/Config/VariablesAndData';
describe('FormatTime', () => { describe('FormatTime', () => {
it('Format when time is Infinity', () => { it('Format when time is Infinity', () => {
@@ -13,7 +12,7 @@ describe('FormatTime', () => {
}); });
describe('TimeFormat = 0', () => { describe('TimeFormat = 0', () => {
before(() => { before(() => {
CMOptions.TimeFormat = 0; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat = 0;
}); });
describe('Longformat = 0', () => { describe('Longformat = 0', () => {
it('Format when time is 0', () => { it('Format when time is 0', () => {
@@ -70,7 +69,7 @@ describe('FormatTime', () => {
}); });
describe('TimeFormat = 1', () => { describe('TimeFormat = 1', () => {
before(() => { before(() => {
CMOptions.TimeFormat = 1; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat = 1;
}); });
it('Format when time is 0', () => { it('Format when time is 0', () => {
assert.equal(FormatTime(0, 0), '00:00:00:00:00'); assert.equal(FormatTime(0, 0), '00:00:00:00:00');

View File

@@ -2,7 +2,6 @@ import { before, describe, it } from 'mocha';
import { expect } from 'chai'; import { expect } from 'chai';
import GetTimeColour from '../../src/Disp/BeautifyAndFormatting/GetTimeColour'; import GetTimeColour from '../../src/Disp/BeautifyAndFormatting/GetTimeColour';
import { CMOptions } from '../../src/Config/VariablesAndData';
describe('GetTimeColour', () => { describe('GetTimeColour', () => {
it('Format when time is less than 60', () => { it('Format when time is less than 60', () => {
@@ -16,7 +15,7 @@ describe('GetTimeColour', () => {
}); });
describe('TimeFormat = 0', () => { describe('TimeFormat = 0', () => {
before(() => { before(() => {
CMOptions.TimeFormat = 0; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat = 0;
}); });
it('Format when time is 0', () => { it('Format when time is 0', () => {
expect(GetTimeColour(0)).to.deep.equal({ text: 'Done!', color: 'Green' }); expect(GetTimeColour(0)).to.deep.equal({ text: 'Done!', color: 'Green' });
@@ -30,7 +29,7 @@ describe('GetTimeColour', () => {
}); });
describe('TimeFormat = 1', () => { describe('TimeFormat = 1', () => {
before(() => { before(() => {
CMOptions.TimeFormat = 1; Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat = 1;
}); });
it('Format when time is 0', () => { it('Format when time is 0', () => {
expect(GetTimeColour(0)).to.deep.equal({ expect(GetTimeColour(0)).to.deep.equal({