Use CookieMonsterFramework for save/load, infoMenu
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import AddMenuStats from './Statistics/AddStatsPage';
|
||||
import AddMenuInfo from './Info/InfoPage';
|
||||
import AddMenuPref from './Settings/SettingsPage';
|
||||
|
||||
/**
|
||||
@@ -14,12 +12,9 @@ export default function AddMenu() {
|
||||
title.textContent = 'Cookie Monster Settings';
|
||||
AddMenuPref(title);
|
||||
} else if (Game.onMenu === 'stats') {
|
||||
if (CMOptions.Stats) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Stats) {
|
||||
title.textContent = 'Cookie Monster Statistics';
|
||||
AddMenuStats(title);
|
||||
}
|
||||
} else if (Game.onMenu === 'log') {
|
||||
title.textContent = 'Cookie Monster '; // To create space between name and button
|
||||
AddMenuInfo(title);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
@@ -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
|
||||
* It is called by CM.Disp.Draw()
|
||||
*/
|
||||
export default function RefreshMenu() {
|
||||
if (
|
||||
CMOptions.UpStats &&
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpStats &&
|
||||
Game.onMenu === 'stats' &&
|
||||
(Game.drawT - 1) % (Game.fps * 5) !== 0 &&
|
||||
(Game.drawT - 1) % Game.fps === 0
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ToggleHeader } from '../../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
* 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.fontSize = '13px';
|
||||
span.style.verticalAlign = 'middle';
|
||||
span.textContent = CMOptions.Header[config] ? '-' : '+';
|
||||
span.textContent = Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[config]
|
||||
? '-'
|
||||
: '+';
|
||||
span.onclick = function () {
|
||||
ToggleHeader(config);
|
||||
Game.UpdateMenu();
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import saveFramework from '@cookiemonsterteam/cookiemonsterframework/src/saveDataFunctions/saveFramework';
|
||||
import jscolor, * as JsColor from '@eastdesire/jscolor';
|
||||
import ToggleFavouriteSetting from '../../../Config/Toggles/ToggleFavourites';
|
||||
import { SaveConfig } from '../../../Config/SaveLoadReload/SaveLoadReloadSettings';
|
||||
import { ConfigPrefix, ToggleConfig, ToggleConfigVolume } from '../../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import {} from '../../../Data/Sectionheaders.ts';
|
||||
import Config from '../../../Data/SettingsData';
|
||||
import settings from '../../../Data/settings';
|
||||
import RefreshScale from '../../HelperFunctions/RefreshScale';
|
||||
import UpdateColours from '../../HelperFunctions/UpdateColours';
|
||||
import Flash from '../../Notifications/Flash';
|
||||
@@ -26,7 +25,7 @@ function CreateFavouriteStar(config) {
|
||||
FavStar.className = 'option';
|
||||
FavStar.onclick = function () {
|
||||
ToggleFavouriteSetting(config);
|
||||
SaveConfig();
|
||||
saveFramework();
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
FavStar.onmouseover = function () {
|
||||
@@ -47,12 +46,15 @@ function CreateFavouriteStar(config) {
|
||||
export default function CreatePrefOption(config) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'listing';
|
||||
if (CMOptions.FavouriteSettings === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FavouriteSettings === 1) {
|
||||
div.appendChild(CreateFavouriteStar(config));
|
||||
}
|
||||
if (Config[config].type === 'bool') {
|
||||
if (settings[config].type === 'bool') {
|
||||
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';
|
||||
} else {
|
||||
a.className = 'option';
|
||||
@@ -62,25 +64,28 @@ export default function CreatePrefOption(config) {
|
||||
ToggleConfig(config);
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
a.textContent = Config[config].label[CMOptions[config]];
|
||||
a.textContent =
|
||||
settings[config].label[
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config]
|
||||
];
|
||||
div.appendChild(a);
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
label.textContent = settings[config].desc;
|
||||
label.style.lineHeight = '1.6';
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'vol') {
|
||||
if (settings[config].type === 'vol') {
|
||||
const volume = document.createElement('div');
|
||||
volume.className = 'sliderBox';
|
||||
const title = document.createElement('div');
|
||||
title.style.float = 'left';
|
||||
title.innerHTML = Config[config].desc;
|
||||
title.innerHTML = settings[config].desc;
|
||||
volume.appendChild(title);
|
||||
const percent = document.createElement('div');
|
||||
percent.id = `slider${config}right`;
|
||||
percent.style.float = 'right';
|
||||
percent.innerHTML = `${CMOptions[config]}%`;
|
||||
percent.innerHTML = `${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config]}%`;
|
||||
volume.appendChild(percent);
|
||||
const slider = document.createElement('input');
|
||||
slider.className = 'slider';
|
||||
@@ -90,7 +95,7 @@ export default function CreatePrefOption(config) {
|
||||
slider.min = '0';
|
||||
slider.max = '100';
|
||||
slider.step = '1';
|
||||
slider.value = CMOptions[config];
|
||||
slider.value = Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config];
|
||||
slider.oninput = function () {
|
||||
ToggleConfigVolume(config);
|
||||
Game.UpdateMenu();
|
||||
@@ -105,7 +110,9 @@ export default function CreatePrefOption(config) {
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
PlaySound(
|
||||
CMOptions[config.replace('Volume', 'SoundURL')],
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
|
||||
config.replace('Volume', 'SoundURL')
|
||||
],
|
||||
config.replace('Volume', 'Sound'),
|
||||
config,
|
||||
true,
|
||||
@@ -115,10 +122,10 @@ export default function CreatePrefOption(config) {
|
||||
div.appendChild(a);
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'url') {
|
||||
if (settings[config].type === 'url') {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'option';
|
||||
span.textContent = `${Config[config].label} `;
|
||||
span.textContent = `${settings[config].label} `;
|
||||
span.style.lineHeight = '1.6';
|
||||
div.appendChild(span);
|
||||
const input = document.createElement('input');
|
||||
@@ -126,7 +133,10 @@ export default function CreatePrefOption(config) {
|
||||
input.className = 'option';
|
||||
input.type = 'text';
|
||||
input.readOnly = true;
|
||||
input.setAttribute('value', CMOptions[config]);
|
||||
input.setAttribute(
|
||||
'value',
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config],
|
||||
);
|
||||
input.style.width = '300px';
|
||||
div.appendChild(input);
|
||||
div.appendChild(document.createTextNode(' '));
|
||||
@@ -134,7 +144,10 @@ export default function CreatePrefOption(config) {
|
||||
inputPrompt.id = `${ConfigPrefix + config}Prompt`;
|
||||
inputPrompt.className = 'option';
|
||||
inputPrompt.type = 'text';
|
||||
inputPrompt.setAttribute('value', CMOptions[config]);
|
||||
inputPrompt.setAttribute(
|
||||
'value',
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config],
|
||||
);
|
||||
const a = document.createElement('a');
|
||||
a.className = 'option';
|
||||
a.onclick = function () {
|
||||
@@ -142,8 +155,10 @@ export default function CreatePrefOption(config) {
|
||||
[
|
||||
'Save',
|
||||
function () {
|
||||
CMOptions[config] = l(`${ConfigPrefix}${config}Prompt`).value;
|
||||
SaveConfig();
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config] = l(
|
||||
`${ConfigPrefix}${config}Prompt`,
|
||||
).value;
|
||||
saveFramework();
|
||||
Game.ClosePrompt();
|
||||
Game.UpdateMenu();
|
||||
},
|
||||
@@ -159,29 +174,33 @@ export default function CreatePrefOption(config) {
|
||||
a.textContent = 'Edit';
|
||||
div.appendChild(a);
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
label.textContent = settings[config].desc;
|
||||
label.style.lineHeight = '1.6';
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'colour') {
|
||||
if (settings[config].type === 'colour') {
|
||||
const innerSpan = document.createElement('span');
|
||||
innerSpan.className = 'option';
|
||||
const input = document.createElement('input');
|
||||
input.id = config;
|
||||
input.style.width = '65px';
|
||||
input.setAttribute('value', CMOptions[config]);
|
||||
input.setAttribute(
|
||||
'value',
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config],
|
||||
);
|
||||
innerSpan.appendChild(input);
|
||||
const change = function () {
|
||||
CMOptions[this.targetElement.id] = this.toHEXString();
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[this.targetElement.id] =
|
||||
this.toHEXString();
|
||||
UpdateColours();
|
||||
SaveConfig();
|
||||
saveFramework();
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
// eslint-disable-next-line no-new
|
||||
new JsColor(input, { hash: true, position: 'right', onInput: change });
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
label.textContent = settings[config].desc;
|
||||
label.style.lineHeight = '1.6';
|
||||
innerSpan.appendChild(label);
|
||||
if (config.includes('Flash')) {
|
||||
@@ -197,29 +216,29 @@ export default function CreatePrefOption(config) {
|
||||
jscolor.init();
|
||||
return div;
|
||||
}
|
||||
if (Config[config].type === 'numscale') {
|
||||
if (settings[config].type === 'numscale') {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'option';
|
||||
span.textContent = `${Config[config].label} `;
|
||||
span.textContent = `${settings[config].label} `;
|
||||
span.style.lineHeight = '1.6';
|
||||
div.appendChild(span);
|
||||
const input = document.createElement('input');
|
||||
input.id = ConfigPrefix + config;
|
||||
input.className = 'option';
|
||||
input.type = 'number';
|
||||
input.value = CMOptions[config];
|
||||
input.min = Config[config].min;
|
||||
input.max = Config[config].max;
|
||||
input.value = Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config];
|
||||
input.min = settings[config].min;
|
||||
input.max = settings[config].max;
|
||||
input.oninput = function () {
|
||||
CMOptions[config] = this.value;
|
||||
SaveConfig();
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config] = this.value;
|
||||
saveFramework();
|
||||
RefreshScale();
|
||||
Game.UpdateMenu();
|
||||
};
|
||||
div.appendChild(input);
|
||||
div.appendChild(document.createTextNode(' '));
|
||||
const label = document.createElement('label');
|
||||
label.textContent = Config[config].desc;
|
||||
label.textContent = settings[config].desc;
|
||||
label.style.lineHeight = '1.6';
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { LoadConfig } from '../../../Config/SaveLoadReload/SaveLoadReloadSettings';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import { ConfigGroups, ConfigGroupsNotification } from '../../../Data/Sectionheaders.ts';
|
||||
import Config from '../../../Data/SettingsData';
|
||||
import ConfigDefault from '../../../Data/SettingsDefault.ts';
|
||||
import settings from '../../../Data/settings';
|
||||
import { FavouriteSettings } from '../../VariablesAndData';
|
||||
import CreatePrefHeader from './CreateHeader';
|
||||
import CreatePrefOption from './CreateOption';
|
||||
@@ -18,16 +15,19 @@ export default function AddMenuPref(title) {
|
||||
|
||||
Object.keys(ConfigGroups).forEach((group) => {
|
||||
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)
|
||||
if (CMOptions.Header[group])
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[group])
|
||||
for (let index = 0; index < FavouriteSettings.length; index++) {
|
||||
frag.appendChild(CreatePrefOption(FavouriteSettings[index]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
frag.appendChild(CreatePrefHeader(group, ConfigGroups[group])); // (group, display-name of group)
|
||||
if (CMOptions.Header[group]) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[group]) {
|
||||
// 0 is show, 1 is collapsed
|
||||
// Make sub-sections of Notification section
|
||||
if (group === 'Notification') {
|
||||
@@ -36,32 +36,21 @@ export default function AddMenuPref(title) {
|
||||
subGroupObject.style.fontSize = '15px';
|
||||
subGroupObject.style.opacity = '0.5';
|
||||
frag.appendChild(subGroupObject);
|
||||
if (CMOptions.Header[subGroup]) {
|
||||
Object.keys(Config).forEach((option) => {
|
||||
if (Config[option].group === subGroup) frag.appendChild(CreatePrefOption(option));
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[subGroup]) {
|
||||
Object.keys(settings).forEach((option) => {
|
||||
if (settings[option].group === subGroup) frag.appendChild(CreatePrefOption(option));
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Object.keys(Config).forEach((option) => {
|
||||
if (Config[option].group === group) frag.appendChild(CreatePrefOption(option));
|
||||
Object.keys(settings).forEach((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(
|
||||
frag,
|
||||
l('menu').childNodes[2].childNodes[l('menu').childNodes[2].childNodes.length - 1],
|
||||
|
||||
@@ -4,7 +4,6 @@ import { AddMissingUpgrades } from './CreateMissingUpgrades';
|
||||
import * as CreateSections from './CreateStatsSections';
|
||||
import * as CreateElements from './CreateDOMElements';
|
||||
import * as GameData from '../../../Data/Gamedata.ts';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
|
||||
import {
|
||||
CacheAverageClicks,
|
||||
@@ -31,37 +30,37 @@ export default function AddMenuStats(title) {
|
||||
stats.appendChild(title);
|
||||
|
||||
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(CreateElements.StatsHeader('Chain Cookies', 'Chain'));
|
||||
if (CMOptions.Header.Chain) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Chain) {
|
||||
stats.appendChild(CreateSections.ChainSection());
|
||||
}
|
||||
|
||||
if (Game.Objects['Wizard tower'].minigameLoaded) {
|
||||
stats.appendChild(CreateElements.StatsHeader('Spells', 'Spells'));
|
||||
if (CMOptions.Header.Spells) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Spells) {
|
||||
stats.appendChild(CreateSections.SpellsSection());
|
||||
}
|
||||
}
|
||||
|
||||
if (Game.Objects.Farm.minigameLoaded) {
|
||||
stats.appendChild(CreateElements.StatsHeader('Garden', 'Garden'));
|
||||
if (CMOptions.Header.Garden) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Garden) {
|
||||
stats.appendChild(CreateSections.GardenSection());
|
||||
}
|
||||
}
|
||||
|
||||
stats.appendChild(CreateElements.StatsHeader('Prestige', 'Prestige'));
|
||||
if (CMOptions.Header.Prestige) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Prestige) {
|
||||
stats.appendChild(CreateSections.PrestigeSection());
|
||||
}
|
||||
|
||||
if (Game.cpsSucked > 0) {
|
||||
stats.appendChild(CreateElements.StatsHeader('Wrinklers', 'Wrink'));
|
||||
if (CMOptions.Header.Wrink) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Wrink) {
|
||||
const popAllFrag = document.createDocumentFragment();
|
||||
popAllFrag.appendChild(
|
||||
document.createTextNode(
|
||||
@@ -102,7 +101,7 @@ export default function AddMenuStats(title) {
|
||||
stats.appendChild(CreateSections.SeasonSection());
|
||||
|
||||
stats.appendChild(CreateElements.StatsHeader('Achievements', 'Achievs'));
|
||||
if (CMOptions.Header.Achievs) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Achievs) {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
const ObjectsTillNext = CacheObjectsNextAchievement[i];
|
||||
stats.appendChild(
|
||||
@@ -110,7 +109,11 @@ export default function AddMenuStats(title) {
|
||||
'basic',
|
||||
i,
|
||||
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'),
|
||||
),
|
||||
);
|
||||
@@ -118,15 +121,26 @@ export default function AddMenuStats(title) {
|
||||
}
|
||||
|
||||
stats.appendChild(CreateElements.StatsHeader('Miscellaneous', 'Misc'));
|
||||
if (CMOptions.Header.Misc) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Misc) {
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
`Average cookies per second (past ${
|
||||
CookieTimes[CMOptions.AvgCPSHist] < 60
|
||||
? `${CookieTimes[CMOptions.AvgCPSHist]} seconds`
|
||||
: CookieTimes[CMOptions.AvgCPSHist] / 60 +
|
||||
(CMOptions.AvgCPSHist === 3 ? ' minute' : ' minutes')
|
||||
CookieTimes[
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist
|
||||
] < 60
|
||||
? `${
|
||||
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)),
|
||||
),
|
||||
@@ -134,8 +148,14 @@ export default function AddMenuStats(title) {
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
`Average cookie clicks per second (past ${ClickTimes[CMOptions.AvgClicksHist]}${
|
||||
CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds'
|
||||
`Average cookie clicks per second (past ${
|
||||
ClickTimes[
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist
|
||||
]
|
||||
}${
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist === 0
|
||||
? ' second'
|
||||
: ' seconds'
|
||||
})`,
|
||||
document.createTextNode(Beautify(CacheAverageClicks, 1)),
|
||||
),
|
||||
@@ -143,13 +163,22 @@ export default function AddMenuStats(title) {
|
||||
stats.appendChild(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
`Cookies from clicking (past ${ClickTimes[CMOptions.AvgClicksHist]}${
|
||||
CMOptions.AvgClicksHist === 0 ? ' second' : ' seconds'
|
||||
`Cookies from clicking (past ${
|
||||
ClickTimes[
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist
|
||||
]
|
||||
}${
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist === 0
|
||||
? ' second'
|
||||
: ' seconds'
|
||||
})`,
|
||||
document.createTextNode(
|
||||
Beautify(
|
||||
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(
|
||||
CreateElements.StatsListing(
|
||||
'basic',
|
||||
@@ -193,10 +222,10 @@ export default function AddMenuStats(title) {
|
||||
|
||||
l('menu').insertBefore(stats, l('menu').childNodes[2]);
|
||||
|
||||
if (CMOptions.MissingUpgrades) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingUpgrades) {
|
||||
AddMissingUpgrades();
|
||||
}
|
||||
if (CMOptions.MissingAchievements) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingAchievements) {
|
||||
AddMissingAchievements();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** Section: Functions related to the creation of basic DOM elements page */
|
||||
|
||||
import { ToggleHeader } from '../../../Config/ToggleSetting';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
|
||||
import { SimpleTooltipElements } from '../../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,9 @@ export function StatsHeader(text, config) {
|
||||
span.style.color = 'black';
|
||||
span.style.fontSize = '13px';
|
||||
span.style.verticalAlign = 'middle';
|
||||
span.textContent = CMOptions.Header[config] ? '-' : '+';
|
||||
span.textContent = Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[config]
|
||||
? '-'
|
||||
: '+';
|
||||
span.onclick = function () {
|
||||
ToggleHeader(config);
|
||||
Game.UpdateMenu();
|
||||
@@ -99,7 +101,9 @@ export function StatsMissDispListing(type, name, text, current) {
|
||||
|
||||
const listingName = document.createElement('b');
|
||||
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(document.createTextNode(': '));
|
||||
div.appendChild(text);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
|
||||
function CrateTooltipLockedAchievements(me) {
|
||||
const tags = [];
|
||||
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];
|
||||
}
|
||||
});
|
||||
if (CMOptions.MissingAchievements) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingAchievements) {
|
||||
Object.values(achievs.children).forEach((achievsCrate) => {
|
||||
if (!achievsCrate.className.includes('enabled')) {
|
||||
const id = achievsCrate.onclick.toString().split(/\[(.*)\]/gi)[1];
|
||||
|
||||
@@ -36,7 +36,6 @@ import {
|
||||
CacheWrathCookiesMult,
|
||||
CacheWrinklersTotal,
|
||||
} from '../../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import ResetBonus from '../../../Sim/SimulationEvents/ResetAscension';
|
||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||
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)) {
|
||||
const CookiesTillTarget =
|
||||
HCTarget - Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
|
||||
@@ -699,7 +700,7 @@ export function SeasonSection() {
|
||||
|
||||
if (Game.season === 'christmas' || specDisp || choEgg || centEgg) {
|
||||
section.appendChild(StatsHeader('Season Specials', 'Sea'));
|
||||
if (CMOptions.Header.Sea) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Sea) {
|
||||
if (missingHalloweenCookies.length !== 0) {
|
||||
section.appendChild(
|
||||
StatsMissDispListing(
|
||||
|
||||
21
src/Disp/MenuSections/createMenuInfo.js
Normal file
21
src/Disp/MenuSections/createMenuInfo.js
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user