Use CookieMonsterFramework for save/load, infoMenu
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
/** General functions to format or beautify strings */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { metric, shortScale, shortScaleAbbreviated } from '../../Data/Scales.ts';
|
||||
import { BackupFunctions } from '../../Main/VariablesAndData';
|
||||
|
||||
@@ -12,14 +11,15 @@ import { BackupFunctions } from '../../Main/VariablesAndData';
|
||||
* @returns {string} Formatted number
|
||||
*/
|
||||
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) {
|
||||
return 'Infinity';
|
||||
}
|
||||
if (typeof num === 'undefined') {
|
||||
return '0';
|
||||
}
|
||||
if (CMOptions.Scale === 0) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale === 0) {
|
||||
return BackupFunctions.Beautify(num, floats);
|
||||
}
|
||||
if (Number.isFinite(num)) {
|
||||
@@ -30,12 +30,20 @@ export default function Beautify(num, floats, forced) {
|
||||
if (num === 0) {
|
||||
return num.toString();
|
||||
}
|
||||
if (num > 0.001 && num < CMOptions.ScaleCutoff) {
|
||||
if (CMOptions.ScaleSeparator) answer = num.toLocaleString('nl');
|
||||
if (
|
||||
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');
|
||||
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
|
||||
answer = num.toExponential(decimals).toString().replace('e', 'E');
|
||||
} else {
|
||||
@@ -43,22 +51,38 @@ export default function Beautify(num, floats, forced) {
|
||||
const AmountOfTenPowerThree = Math.floor(exponential.slice(exponential.indexOf('e') + 1) / 3);
|
||||
answer = (num / Number(`1e${AmountOfTenPowerThree * 3}`)).toFixed(decimals);
|
||||
// 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
|
||||
if (num >= 0.01 && num < Number(`1e${metric.length * 3}`)) {
|
||||
answer += ` ${metric[AmountOfTenPowerThree]}`;
|
||||
} 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
|
||||
if (num >= 0.01 && num < Number(`1e${shortScale.length * 3}`)) {
|
||||
answer += ` ${shortScale[AmountOfTenPowerThree]}`;
|
||||
} 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
|
||||
if (num >= 0.01 && num < Number(`1e${shortScaleAbbreviated.length * 3}`)) {
|
||||
answer += ` ${shortScaleAbbreviated[AmountOfTenPowerThree]}`;
|
||||
} 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
|
||||
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}`);
|
||||
answer = BackupFunctions.Beautify(num, floats);
|
||||
}
|
||||
if (CMOptions.ScaleSeparator) answer = answer.replace('.', ',');
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator)
|
||||
answer = answer.replace('.', ',');
|
||||
return answer;
|
||||
}
|
||||
console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`); // eslint-disable-line no-console
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function returns time as a string depending on TimeFormat setting
|
||||
* @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 s = Math.floor((((formattedTime % 31536000) % 86400) % 3600) % 60);
|
||||
let str = '';
|
||||
if (CMOptions.TimeFormat) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat) {
|
||||
if (formattedTime > 3155760000) return 'XX:XX:XX:XX:XX';
|
||||
str += `${(y < 10 ? '0' : '') + y}:`;
|
||||
str += `${(d < 10 ? '0' : '') + d}:`;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { ColourGreen, ColourOrange, ColourRed, ColourYellow } from '../VariablesAndData';
|
||||
import FormatTime from './FormatTime';
|
||||
|
||||
@@ -11,7 +10,8 @@ export default function GetTimeColour(time) {
|
||||
let color;
|
||||
let text;
|
||||
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!';
|
||||
color = ColourGreen;
|
||||
} else {
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
CacheObjects100,
|
||||
CacheObjectsNextAchievement,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
|
||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
||||
import { ColoursOrdering, LastTargetBuildings } from '../VariablesAndData';
|
||||
@@ -36,11 +35,15 @@ export default function UpdateBuildings() {
|
||||
l(`storeBulk100`).style.removeProperty('color');
|
||||
|
||||
if (Game.buyMode === 1) {
|
||||
if (CMOptions.BuildColour === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BuildColour === 1) {
|
||||
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 {
|
||||
Object.keys(Game.Objects).forEach((i) => {
|
||||
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.
|
||||
// This regulates sorting of buildings.
|
||||
let arr;
|
||||
if (Game.buyMode !== 1 || !CMOptions.SortBuildings) {
|
||||
arr = Object.keys(CacheObjects1).map(k => {
|
||||
if (
|
||||
Game.buyMode !== 1 ||
|
||||
!Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings
|
||||
) {
|
||||
arr = Object.keys(CacheObjects1).map((k) => {
|
||||
const o = {};
|
||||
o.name = k;
|
||||
o.id = Game.Objects[k].id;
|
||||
@@ -76,8 +82,10 @@ export default function UpdateBuildings() {
|
||||
});
|
||||
// Sort using default order.
|
||||
arr.sort((a, b) => a.id - b.id);
|
||||
} else if (CMOptions.SortBuildings === 1) {
|
||||
arr = Object.keys(CacheObjects1).map(k => {
|
||||
} else if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 1
|
||||
) {
|
||||
arr = Object.keys(CacheObjects1).map((k) => {
|
||||
const o = {};
|
||||
o.name = k;
|
||||
o.pp = CacheObjects1[k].pp;
|
||||
@@ -88,10 +96,12 @@ export default function UpdateBuildings() {
|
||||
arr.sort((a, b) =>
|
||||
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
|
||||
? 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) {
|
||||
arr = Object.keys(target).map(k => {
|
||||
} else if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 2
|
||||
) {
|
||||
arr = Object.keys(target).map((k) => {
|
||||
const o = {};
|
||||
o.name = k;
|
||||
o.pp = target[k].pp;
|
||||
@@ -102,10 +112,12 @@ export default function UpdateBuildings() {
|
||||
arr.sort((a, b) =>
|
||||
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
|
||||
? 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) {
|
||||
arr = Object.keys(CacheObjectsNextAchievement).map(k => {
|
||||
} else if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 3
|
||||
) {
|
||||
arr = Object.keys(CacheObjectsNextAchievement).map((k) => {
|
||||
const o = {};
|
||||
o.name = k;
|
||||
o.id = Game.Objects[k].id;
|
||||
@@ -118,9 +130,10 @@ export default function UpdateBuildings() {
|
||||
// Sort by price until next achievement.
|
||||
// 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.
|
||||
arr.sort((a, b) =>
|
||||
(a.amountUntilNext !== 101 ? a.priceUntilNext : Infinity) -
|
||||
(b.amountUntilNext !== 101 ? b.priceUntilNext : Infinity)
|
||||
arr.sort(
|
||||
(a, b) =>
|
||||
(a.amountUntilNext !== 101 ? a.priceUntilNext : Infinity) -
|
||||
(b.amountUntilNext !== 101 ? b.priceUntilNext : Infinity),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function toggles the upgrade to be always expanded
|
||||
* It is called by a change in CM.Options.ToolWarnPos
|
||||
@@ -7,7 +5,10 @@ import { CMOptions } from '../../Config/VariablesAndData';
|
||||
*/
|
||||
export default function UpdateUpgradeSectionsHeight() {
|
||||
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
|
||||
} else if (section.id === 'vaultUpgrades') {
|
||||
section.style.height = ''; // eslint-disable-line no-param-reassign
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { CacheUpgrades } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
ColourBackPre,
|
||||
ColourBlue,
|
||||
@@ -20,7 +19,7 @@ import {
|
||||
*/
|
||||
export default function UpdateUpgrades() {
|
||||
// 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 green = 0;
|
||||
let yellow = 0;
|
||||
@@ -76,12 +75,12 @@ export default function UpdateUpgrades() {
|
||||
arr.push(o);
|
||||
}
|
||||
|
||||
if (CMOptions.SortUpgrades) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortUpgrades) {
|
||||
// Sort by pp colour group, then by pp.
|
||||
arr.sort((a, b) =>
|
||||
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
|
||||
? a.pp - b.pp
|
||||
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color)
|
||||
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color),
|
||||
);
|
||||
} else {
|
||||
arr.sort((a, b) => a.price - b.price);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import CacheDragonCost from '../../Cache/Dragon/Dragon';
|
||||
import { CacheCostDragonUpgrade } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import CalculateChangeAura from '../../Sim/SimulationEvents/AuraChange';
|
||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
||||
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
|
||||
*/
|
||||
export function AddAuraInfo(aura) {
|
||||
if (CMOptions.DragonAuraInfo === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.DragonAuraInfo === 1) {
|
||||
const [bonusCPS, priceOfChange] = CalculateChangeAura(aura);
|
||||
const timeToRecover = FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs));
|
||||
let bonusCPSPercentage;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import ToggleWrinklerButtons from '../Config/Toggles/ToggleWrinklerButtons';
|
||||
import { CMOptions } from '../Config/VariablesAndData';
|
||||
import Beautify from './BeautifyAndFormatting/Beautify';
|
||||
import UpdateBuildings from './BuildingsUpgrades/Buildings';
|
||||
import UpdateUpgradeSectionsHeight from './BuildingsUpgrades/UpdateUpgradeSectionsHeight';
|
||||
@@ -20,7 +19,7 @@ export default function CMDrawHook() {
|
||||
Game.prefs.autosave &&
|
||||
Game.drawT % 10 === 0 && // with autosave ON and every 10 ticks
|
||||
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');
|
||||
if (timer) {
|
||||
@@ -53,7 +52,7 @@ export default function CMDrawHook() {
|
||||
ToggleWrinklerButtons();
|
||||
|
||||
// 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));
|
||||
if (Game.prefs.monospace) str = `<span class="monospace">${str}</span>`;
|
||||
l('cookies').innerHTML = str;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** Section: Functions related to the Golden Cookie Timers */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { GCTimers } from '../VariablesAndData';
|
||||
|
||||
/**
|
||||
@@ -21,7 +20,8 @@ export default function CreateGCTimer(cookie) {
|
||||
GCTimer.style.cursor = 'pointer';
|
||||
GCTimer.style.display = 'block';
|
||||
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.top = cookie.l.style.top;
|
||||
GCTimer.onclick = function () {
|
||||
|
||||
@@ -4,24 +4,26 @@ import {
|
||||
CacheCurrWrinklerCPSMult,
|
||||
CacheWrinklersFattest,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function returns the cps as either current or average CPS depending on CM.Options.CPSMode
|
||||
* @returns {number} The average or current cps
|
||||
*/
|
||||
export default function GetCPS() {
|
||||
if (CMOptions.CPSMode) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CPSMode) {
|
||||
return CacheAverageCPS;
|
||||
}
|
||||
if (CMOptions.CalcWrink === 0) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 0) {
|
||||
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));
|
||||
}
|
||||
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 (
|
||||
Game.cookiesPs *
|
||||
((CacheCurrWrinklerCPSMult * 3) / CacheCurrWrinklerCount +
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { CacheWrinklersFattest, CacheWrinklersTotal } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
export default function GetWrinkConfigBank() {
|
||||
if (CMOptions.CalcWrink === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 1) {
|
||||
return CacheWrinklersTotal;
|
||||
}
|
||||
if (CMOptions.CalcWrink === 2) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink === 2) {
|
||||
return CacheWrinklersFattest[0];
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ToggleTimerBar } from '../../Config/SpecificToggles';
|
||||
import ToggleBotBar from '../../Config/Toggles/ToggleBotBar';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
import UpdateBackground from './UpdateBackground';
|
||||
|
||||
/**
|
||||
@@ -10,8 +10,10 @@ import UpdateBackground from './UpdateBackground';
|
||||
export default function UpdateAscendState() {
|
||||
if (Game.OnAscend) {
|
||||
l('game').style.bottom = '0px';
|
||||
if (CMOptions.BotBar === 1) l('CMBotBar').style.display = 'none';
|
||||
if (CMOptions.TimerBar === 1) l('CMTimerBar').style.display = 'none';
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar === 1)
|
||||
l('CMBotBar').style.display = 'none';
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar === 1)
|
||||
l('CMTimerBar').style.display = 'none';
|
||||
} else {
|
||||
ToggleBotBar();
|
||||
ToggleTimerBar();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import UpdateBuildings from '../BuildingsUpgrades/Buildings';
|
||||
import {
|
||||
ColourBackPre,
|
||||
@@ -15,17 +14,23 @@ export default function UpdateColours() {
|
||||
let str = '';
|
||||
for (let i = 0; i < ColoursOrdering.length; i++) {
|
||||
str += `.${ColourTextPre}${ColoursOrdering[i]} { color: ${
|
||||
CMOptions[`Colour${ColoursOrdering[i]}`]
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
|
||||
`Colour${ColoursOrdering[i]}`
|
||||
]
|
||||
}; }\n`;
|
||||
}
|
||||
for (let i = 0; i < ColoursOrdering.length; i++) {
|
||||
str += `.${ColourBackPre}${ColoursOrdering[i]} { background-color: ${
|
||||
CMOptions[`Colour${ColoursOrdering[i]}`]
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
|
||||
`Colour${ColoursOrdering[i]}`
|
||||
]
|
||||
}; }\n`;
|
||||
}
|
||||
for (let i = 0; i < ColoursOrdering.length; i++) {
|
||||
str += `.${ColourBorderPre}${ColoursOrdering[i]} { border: 1px solid ${
|
||||
CMOptions[`Colour${ColoursOrdering[i]}`]
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
|
||||
`Colour${ColoursOrdering[i]}`
|
||||
]
|
||||
}; }\n`;
|
||||
}
|
||||
l('CMCSS').textContent = str;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** Functions related to the Bottom Bar */
|
||||
|
||||
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { VersionMajor, VersionMinor } from '../../Data/Moddata.ts';
|
||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
||||
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
|
||||
*/
|
||||
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;
|
||||
Object.keys(CacheObjects1).forEach((i) => {
|
||||
let target = Game.buyBulk;
|
||||
@@ -85,7 +88,8 @@ export function UpdateBotBar() {
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className =
|
||||
ColourTextPre + target[i].color;
|
||||
let PPString;
|
||||
if (CMOptions.PPDisplayTime) PPString = FormatTime(Math.round(target[i].pp));
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
|
||||
PPString = FormatTime(Math.round(target[i].pp));
|
||||
else PPString = Beautify(Math.round(target[i].pp), 2);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].textContent = PPString;
|
||||
const timeColour = GetTimeColour(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** Functions related to the Timer Bar */
|
||||
|
||||
import { UpdateBotTimerBarPosition } from '../../Config/SpecificToggles';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
BuffColours,
|
||||
ColourBackPre,
|
||||
@@ -55,14 +54,17 @@ export function CreateTimerBar() {
|
||||
* This function updates indivudual timers in the timer bar
|
||||
*/
|
||||
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
|
||||
const maxWidthTwoBar = l('CMTimerBar').offsetWidth - 163;
|
||||
// label width: 113, div margin: 20, calculate timer width at runtime
|
||||
const maxWidthOneBar = l('CMTimerBar').offsetWidth - 133;
|
||||
let numberOfTimers = 0;
|
||||
|
||||
if (CMOptions.AutosaveTimerBar && Game.prefs.autosave) {
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AutosaveTimerBar &&
|
||||
Game.prefs.autosave
|
||||
) {
|
||||
const timeTillNextAutosave =
|
||||
(Game.fps * 60 - (Game.OnAscend ? 0 : Game.T % (Game.fps * 60))) / Game.fps;
|
||||
l('CMTimerBarAutosave').style.display = '';
|
||||
@@ -71,7 +73,9 @@ export function UpdateTimerBar() {
|
||||
(maxWidthOneBar - Math.ceil(timeTillNextAutosave).toString().length * 8)) /
|
||||
60,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1) {
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1
|
||||
) {
|
||||
l('CMTimerBarAutosaveBar').textContent = Math.ceil(timeTillNextAutosave);
|
||||
} else l('CMTimerBarAutosaveBar').textContent = '';
|
||||
l('CMTimerBarAutosaveTime').textContent = Math.ceil(timeTillNextAutosave);
|
||||
@@ -86,7 +90,7 @@ export function UpdateTimerBar() {
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.golden.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarGCMinBar').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) / Game.fps,
|
||||
);
|
||||
@@ -106,7 +110,7 @@ export function UpdateTimerBar() {
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.golden.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarGCBar').textContent = Math.ceil(
|
||||
Math.min(
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime,
|
||||
@@ -128,7 +132,7 @@ export function UpdateTimerBar() {
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.reindeer.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarRenMinBar').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) / Game.fps,
|
||||
);
|
||||
@@ -141,7 +145,7 @@ export function UpdateTimerBar() {
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.reindeer.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarRenBar').textContent = Math.ceil(
|
||||
Math.min(
|
||||
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime,
|
||||
@@ -173,7 +177,9 @@ export function UpdateTimerBar() {
|
||||
} else classColour = ColourPurple;
|
||||
timer.lastChild.children[1].className = ColourBackPre + classColour;
|
||||
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(
|
||||
100 * (Game.buffs[i].time / Game.buffs[i].maxTime),
|
||||
)}%`;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { isInitializing } from '../../InitSaveLoad/Variables';
|
||||
|
||||
/**
|
||||
@@ -12,10 +11,14 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
|
||||
export default function Flash(mode, config, forced) {
|
||||
// The arguments check makes the sound not play upon initialization of the mod
|
||||
if (
|
||||
((CMOptions[config] === 1 || forced) && mode === 3 && isInitializing === false) ||
|
||||
((Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[config] === 1 ||
|
||||
forced) &&
|
||||
mode === 3 &&
|
||||
isInitializing === false) ||
|
||||
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';
|
||||
if (mode === 3) {
|
||||
l('CMFlashScreen').style.display = 'inline';
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/** Functions related to the flashes/sound/notifications */
|
||||
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { isInitializing } from '../../InitSaveLoad/Variables';
|
||||
|
||||
/**
|
||||
@@ -13,7 +10,7 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
|
||||
export default function CreateNotification(notifyConfig, title, message) {
|
||||
// The arguments check makes the sound not play upon initialization of the mod
|
||||
if (
|
||||
CMOptions[notifyConfig] === 1 &&
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[notifyConfig] === 1 &&
|
||||
document.visibilityState === 'hidden' &&
|
||||
isInitializing === false
|
||||
) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { isInitializing } from '../../InitSaveLoad/Variables';
|
||||
|
||||
/**
|
||||
@@ -11,11 +10,20 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
|
||||
*/
|
||||
export default function PlaySound(url, sndConfig, volConfig, forced) {
|
||||
// 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
|
||||
const sound = new Audio(url);
|
||||
if (CMOptions.GeneralSound) sound.volume = (CMOptions[volConfig] / 100) * (Game.volume / 100);
|
||||
else sound.volume = CMOptions[volConfig] / 100;
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GeneralSound)
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/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
|
||||
*/
|
||||
export function UpdateFavicon() {
|
||||
if (CMOptions.Favicon === 1 && LastGoldenCookieState > 0) {
|
||||
if (
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Favicon === 1 &&
|
||||
LastGoldenCookieState > 0
|
||||
) {
|
||||
if (CacheSpawnedGoldenShimmer.wrath)
|
||||
l('CMFavicon').href =
|
||||
'https://CookieMonsterTeam.github.io/CookieMonster/favicon/wrathCookie.ico';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** Functions related to updating the tab in the browser's tab-bar */
|
||||
|
||||
import { CacheSeasonPopShimmer, CacheSpawnedGoldenShimmer } from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
import { LastSeasonPopupState, LastTickerFortuneState } from '../../Main/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
|
||||
*/
|
||||
export default function UpdateTitle() {
|
||||
if (Game.OnAscend || CMOptions.Title === 0) {
|
||||
if (
|
||||
Game.OnAscend ||
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title === 0
|
||||
) {
|
||||
document.title = Title;
|
||||
} else if (CMOptions.Title === 1) {
|
||||
} else if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title === 1) {
|
||||
let addFC = false;
|
||||
let addSP = false;
|
||||
let titleGC;
|
||||
@@ -50,7 +53,7 @@ export default function UpdateTitle() {
|
||||
str = str.substring(str.lastIndexOf(']') + 1);
|
||||
}
|
||||
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 spawn = false;
|
||||
if (CacheSpawnedGoldenShimmer) {
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
CacheLastHeavenlyChips,
|
||||
CacheTimeTillNextPrestige,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
||||
|
||||
/**
|
||||
@@ -45,7 +44,7 @@ export default function ReplaceAscendTooltip() {
|
||||
str += '<div class="line"></div>';
|
||||
str += `You need <b>${Beautify(cookiesToNext)} more cookies</b> for the next level.<br>`;
|
||||
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(
|
||||
CacheHCPerSecond,
|
||||
2,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
ColourTextPre,
|
||||
ColourBorderPre,
|
||||
@@ -134,7 +133,7 @@ export function TooltipCreateWarningSection() {
|
||||
'CMDispTooltipWarnUser',
|
||||
ColourRed,
|
||||
'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',
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
|
||||
/**
|
||||
* This function updates the location of the tooltip
|
||||
* 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') {
|
||||
let warnOffset = 0;
|
||||
if (
|
||||
CMOptions.ToolWarnLucky === 1 &&
|
||||
CMOptions.ToolWarnPos === 1 &&
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnLucky === 1 &&
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnPos === 1 &&
|
||||
l('CMDispTooltipWarningParent') !== null
|
||||
) {
|
||||
warnOffset = l('CMDispTooltipWarningParent').clientHeight - 4;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import UpdateTooltips from './UpdateTooltips';
|
||||
import { SimpleTooltipElements, TooltipName, TooltipType } from '../VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import BuildingGetPrice from '../../Sim/SimulationEvents/BuyBuilding';
|
||||
import GetTimeColour from '../BeautifyAndFormatting/GetTimeColour';
|
||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
||||
@@ -40,7 +39,7 @@ export function CreateTooltip(type, name) {
|
||||
// Buildings
|
||||
l('tooltip').innerHTML = Game.Objects[name].tooltip();
|
||||
// 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(
|
||||
Game.Objects[name],
|
||||
Game.Objects[name].basePrice,
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
CacheObjects100,
|
||||
CacheObjectsNextAchievement,
|
||||
} from '../../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
|
||||
import BuyBuildingsBonusIncome from '../../../Sim/SimulationEvents/BuyBuildingBonusIncome';
|
||||
import { SimObjects } from '../../../Sim/VariablesAndData';
|
||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
||||
@@ -26,7 +26,10 @@ import * as Create from '../CreateTooltip';
|
||||
* This function adds extra info to the Building tooltips
|
||||
*/
|
||||
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');
|
||||
Create.TooltipCreateCalculationSection(tooltipBox);
|
||||
|
||||
@@ -43,18 +46,24 @@ export default function Building() {
|
||||
TooltipPrice = Game.Objects[TooltipName].bulkPrice;
|
||||
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);
|
||||
const increase = Math.round((TooltipBonusIncome / Game.cookiesPs) * 10000);
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
|
||||
} else {
|
||||
l('CMTooltipIncome').textContent += ` (<0${
|
||||
CMOptions.ScaleSeparator ? ',' : '.'
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator
|
||||
? ','
|
||||
: '.'
|
||||
}01% of income)`;
|
||||
}
|
||||
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);
|
||||
else l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
|
||||
l('CMTooltipPP').className = ColourTextPre + target[TooltipName].color;
|
||||
@@ -110,7 +119,8 @@ export default function Building() {
|
||||
)} / ${Beautify(ObjectsTillNext.price)} / `;
|
||||
l('CMTooltipNextAchievement').style.color = 'white';
|
||||
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);
|
||||
PPFrag.className = ColourTextPre + ColourOfPP({ pp: PPOfAmount }, ObjectsTillNext.price);
|
||||
l('CMTooltipNextAchievement').appendChild(PPFrag);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
||||
import { TooltipName } from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
@@ -9,7 +8,10 @@ import * as Create from '../CreateTooltip';
|
||||
*/
|
||||
export default function GardenPlots() {
|
||||
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 =
|
||||
minigame.plot[TooltipName[1]][TooltipName[0]][1] >
|
||||
minigame.plantsById[minigame.plot[TooltipName[1]][TooltipName[0]][0] - 1].mature;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CacheNoGoldSwitchCookiesPS } from '../../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
|
||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
||||
import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour';
|
||||
import CalculateGrimoireRefillTime from '../../HelperFunctions/CalculateGrimoireRefillTime';
|
||||
@@ -15,7 +15,10 @@ export default function Grimoire() {
|
||||
const { minigame } = Game.Objects['Wizard tower'];
|
||||
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');
|
||||
|
||||
// Time left till enough magic for spell
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
||||
import * as Create from '../CreateTooltip';
|
||||
|
||||
@@ -9,7 +8,7 @@ import * as Create from '../CreateTooltip';
|
||||
*/
|
||||
export default function HarvestAll() {
|
||||
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:'));
|
||||
let totalGain = 0;
|
||||
let mortal = 0;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { CacheGods } from '../../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
||||
import { TooltipName, TooltipType } from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
@@ -10,7 +9,7 @@ import * as Create from '../CreateTooltip';
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export default function PantheonGods() {
|
||||
if (CMOptions.TooltipPantheon === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipPantheon === 1) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
let GodID;
|
||||
if (TooltipType === 'pas') GodID = TooltipName[1];
|
||||
@@ -26,7 +25,11 @@ export default function PantheonGods() {
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
cps1.textContent += ` (${increase / 100}% of income)`;
|
||||
} 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';
|
||||
tooltipBox.appendChild(cps1);
|
||||
@@ -40,7 +43,11 @@ export default function PantheonGods() {
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
cps2.textContent += ` (${increase / 100}% of income)`;
|
||||
} 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';
|
||||
tooltipBox.appendChild(cps2);
|
||||
@@ -54,7 +61,11 @@ export default function PantheonGods() {
|
||||
if (Number.isFinite(increase) && increase !== 0) {
|
||||
cps3.textContent += ` (${increase / 100}% of income)`;
|
||||
} 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';
|
||||
tooltipBox.appendChild(cps3);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import GetLumpColour from '../../HelperFunctions/GetLumpColour';
|
||||
import { ColourTextPre } from '../../VariablesAndData';
|
||||
import * as Create from '../CreateTooltip';
|
||||
@@ -7,7 +6,7 @@ import * as Create from '../CreateTooltip';
|
||||
* It adds to the additional information to l('CMTooltipArea')
|
||||
*/
|
||||
export default function SugarLump() {
|
||||
if (CMOptions.TooltipLump === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipLump === 1) {
|
||||
const tooltipBox = l('CMTooltipBorder');
|
||||
|
||||
tooltipBox.appendChild(Create.TooltipCreateHeader('Current Sugar Lump'));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CacheLastChoEgg, CacheUpgrades } from '../../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
|
||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
||||
import FormatTime from '../../BeautifyAndFormatting/FormatTime';
|
||||
import GetTimeColour from '../../BeautifyAndFormatting/GetTimeColour';
|
||||
@@ -25,7 +25,9 @@ export default function Upgrade() {
|
||||
TooltipPrice = Game.Upgrades[Game.UpgradesInStore[TooltipName].name].getPrice();
|
||||
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);
|
||||
const increase = Math.round((TooltipBonusIncome / Game.cookiesPs) * 10000);
|
||||
// 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)`;
|
||||
} else {
|
||||
l('CMTooltipIncome').textContent += ` (<0${
|
||||
CMOptions.ScaleSeparator ? ',' : '.'
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator
|
||||
? ','
|
||||
: '.'
|
||||
}01% of income)`;
|
||||
}
|
||||
l('CMTooltipBorder').className =
|
||||
@@ -59,7 +63,7 @@ export default function Upgrade() {
|
||||
l('Payback PeriodTitle').style.display = 'block';
|
||||
l('CMTooltipPP').style.display = 'block';
|
||||
} else {
|
||||
if (CMOptions.PPDisplayTime)
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
|
||||
l('CMTooltipPP').textContent = FormatTime(
|
||||
CacheUpgrades[Game.UpgradesInStore[TooltipName].name].pp,
|
||||
);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import GetCPSBuffMult from '../../../Cache/CPS/GetCPSBuffMult';
|
||||
import { CacheEdifice, CacheLucky } from '../../../Cache/VariablesAndData';
|
||||
import ToggleToolWarnPos from '../../../Config/Toggles/ToggleToolWarnPos';
|
||||
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||
import Beautify from '../../BeautifyAndFormatting/Beautify';
|
||||
import FormatTime from '../../BeautifyAndFormatting/FormatTime';
|
||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||
@@ -19,21 +18,25 @@ export default function Warnings() {
|
||||
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`;
|
||||
|
||||
l('CMDispTooltipWarningParent').style.width = `${l('tooltip').offsetWidth - 6}px`;
|
||||
|
||||
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;
|
||||
if (CMOptions.ToolWarnBon === 1) {
|
||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnBon === 1) {
|
||||
let bonusNoFren = TooltipBonusIncome;
|
||||
bonusNoFren /= GetCPSBuffMult();
|
||||
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)) {
|
||||
l('CMDispTooltipWarnLucky').style.display = '';
|
||||
l('CMDispTooltipWarnLuckyText').textContent = `${Beautify(
|
||||
@@ -42,7 +45,9 @@ export default function Warnings() {
|
||||
} 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;
|
||||
if (amount < limitLuckyFrenzy && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnLuckyFrenzy').style.display = '';
|
||||
@@ -52,7 +57,7 @@ export default function Warnings() {
|
||||
} 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;
|
||||
if (amount < limitConjure && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnConjure').style.display = '';
|
||||
@@ -62,7 +67,10 @@ export default function Warnings() {
|
||||
} 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;
|
||||
if (amount < limitConjureFrenzy && (TooltipType !== 'b' || Game.buyMode === 1)) {
|
||||
l('CMDispTooltipWarnConjureFrenzy').style.display = '';
|
||||
@@ -72,7 +80,10 @@ export default function Warnings() {
|
||||
} 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)) {
|
||||
l('CMDispTooltipWarnEdifice').style.display = '';
|
||||
l('CMDispTooltipWarnEdificeText').textContent = `${Beautify(
|
||||
@@ -81,20 +92,27 @@ export default function Warnings() {
|
||||
} 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 (
|
||||
amount < CMOptions.ToolWarnUser * GetCPS() &&
|
||||
amount <
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser *
|
||||
GetCPS() &&
|
||||
(TooltipType !== 'b' || Game.buyMode === 1)
|
||||
) {
|
||||
l('CMDispTooltipWarnUser').style.display = '';
|
||||
// Need to update tooltip text dynamically
|
||||
l(
|
||||
'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(
|
||||
CMOptions.ToolWarnUser * GetCPS() - amount,
|
||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser *
|
||||
GetCPS() -
|
||||
amount,
|
||||
)} (${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';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { SimObjects } from '../../Sim/VariablesAndData';
|
||||
import Beautify from '../BeautifyAndFormatting/Beautify';
|
||||
import {
|
||||
@@ -13,7 +12,10 @@ import {
|
||||
* As wrinklers are not appended to the DOM we us a different system than for other tooltips
|
||||
*/
|
||||
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
|
||||
let showingTooltip = false;
|
||||
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
|
||||
*/
|
||||
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 toSuck = 1.1;
|
||||
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
|
||||
|
||||
Reference in New Issue
Block a user