Merge pull request #583 from DanielNoord/annotate/sim

This commit is contained in:
Daniël van Noord
2021-02-20 13:37:34 +01:00
committed by GitHub
11 changed files with 679 additions and 503 deletions

View File

@@ -1,7 +1,13 @@
name: Check build of CookieMonster.js name: CI
on: pull_request on: [push, pull_request]
jobs: jobs:
build: Check_ESLint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ESLint
run: npx eslint src
Check_main_file:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@@ -1,9 +0,0 @@
name: ESLint
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ESLint
run: npx eslint src

File diff suppressed because one or more lines are too long

View File

@@ -9,7 +9,6 @@
* This functions runs all cache-functions to generate all "full" cache * This functions runs all cache-functions to generate all "full" cache
* The declaration follows the structure of the CM.Cache.js file * The declaration follows the structure of the CM.Cache.js file
* It is called by CM.Main.DelayInit * It is called by CM.Main.DelayInit
* TODO: Add all functions that should be here and remove them from CM.Main.Loop()
*/ */
CM.Cache.InitCache = function() { CM.Cache.InitCache = function() {
CM.Cache.CacheDragonAuras(); CM.Cache.CacheDragonAuras();
@@ -63,7 +62,7 @@ CM.Cache.CacheWrinklers = function() {
sucked *= toSuck; sucked *= toSuck;
if (Game.Has('Wrinklerspawn')) sucked *= 1.05; if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
if (CM.Sim.Objects.Temple.minigameLoaded) { if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = CM.Sim.hasGod('scorn'); var godLvl = Game.hasGod('scorn');
if (godLvl === 1) sucked *= 1.15; if (godLvl === 1) sucked *= 1.15;
else if (godLvl === 2) sucked *= 1.1; else if (godLvl === 2) sucked *= 1.1;
else if (godLvl === 3) sucked *= 1.05; else if (godLvl === 3) sucked *= 1.05;
@@ -96,7 +95,7 @@ CM.Cache.CacheWrinklers = function() {
CM.Cache.CacheStats = function() { CM.Cache.CacheStats = function() {
CM.Cache.Lucky = (CM.Cache.NoGoldSwitchCookiesPS * 900) / 0.15; CM.Cache.Lucky = (CM.Cache.NoGoldSwitchCookiesPS * 900) / 0.15;
CM.Cache.Lucky *= CM.Cache.DragonsFortuneMultAdjustment; CM.Cache.Lucky *= CM.Cache.DragonsFortuneMultAdjustment;
let cpsBuffMult = CM.Sim.getCPSBuffMult(); let cpsBuffMult = CM.Cache.getCPSBuffMult();
if (cpsBuffMult > 0) CM.Cache.Lucky /= cpsBuffMult; if (cpsBuffMult > 0) CM.Cache.Lucky /= cpsBuffMult;
else CM.Cache.Lucky = 0; else CM.Cache.Lucky = 0;
CM.Cache.LuckyReward = CM.Cache.GoldenCookiesMult * (CM.Cache.Lucky * 0.15) + 13; CM.Cache.LuckyReward = CM.Cache.GoldenCookiesMult * (CM.Cache.Lucky * 0.15) + 13;
@@ -146,10 +145,10 @@ CM.Cache.CacheGoldenAndWrathCookiesMults = function() {
if (CM.Sim.Has('Green yeast digestives')) mult *= 1.01; if (CM.Sim.Has('Green yeast digestives')) mult *= 1.01;
if (CM.Sim.Has('Dragon fang')) mult *= 1.03; if (CM.Sim.Has('Dragon fang')) mult *= 1.03;
goldenMult *= 1 + CM.Sim.auraMult('Ancestral Metamorphosis') * 0.1; goldenMult *= 1 + Game.auraMult('Ancestral Metamorphosis') * 0.1;
goldenMult *= CM.Sim.eff('goldenCookieGain'); goldenMult *= Game.eff('goldenCookieGain');
wrathMult *= 1 + CM.Sim.auraMult('Unholy Dominion') * 0.1; wrathMult *= 1 + Game.auraMult('Unholy Dominion') * 0.1;
wrathMult *= CM.Sim.eff('wrathCookieGain'); wrathMult *= Game.eff('wrathCookieGain');
// Calculate final golden and wrath multipliers // Calculate final golden and wrath multipliers
CM.Cache.GoldenCookiesMult = mult * goldenMult; CM.Cache.GoldenCookiesMult = mult * goldenMult;
@@ -161,7 +160,7 @@ CM.Cache.CacheGoldenAndWrathCookiesMults = function() {
// Otherwise, the aura effect will be factored in the base CPS making the multiplier not requiring adjustment. // Otherwise, the aura effect will be factored in the base CPS making the multiplier not requiring adjustment.
CM.Cache.DragonsFortuneMultAdjustment = 1; CM.Cache.DragonsFortuneMultAdjustment = 1;
if (Game.shimmerTypes.golden.n === 0) { if (Game.shimmerTypes.golden.n === 0) {
CM.Cache.DragonsFortuneMultAdjustment *= 1 + CM.Sim.auraMult('Dragon\'s Fortune') * 1.23; CM.Cache.DragonsFortuneMultAdjustment *= 1 + Game.auraMult('Dragon\'s Fortune') * 1.23;
} }
} }
}; };
@@ -208,7 +207,7 @@ CM.Cache.MaxChainMoni = function(digit, maxPayout, mult) {
CM.Cache.CacheChain = function() { CM.Cache.CacheChain = function() {
let maxPayout = CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6 * CM.Cache.DragonsFortuneMultAdjustment; let maxPayout = CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6 * CM.Cache.DragonsFortuneMultAdjustment;
// Removes effect of Frenzy etc. // Removes effect of Frenzy etc.
let cpsBuffMult = CM.Sim.getCPSBuffMult(); let cpsBuffMult = CM.Cache.getCPSBuffMult();
if (cpsBuffMult > 0) maxPayout /= cpsBuffMult; if (cpsBuffMult > 0) maxPayout /= cpsBuffMult;
else maxPayout = 0; else maxPayout = 0;
@@ -429,7 +428,7 @@ CM.Cache.CacheCurrWrinklerCPS = function() {
} }
let godMult = 1; let godMult = 1;
if (CM.Sim.Objects.Temple.minigameLoaded) { if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = CM.Sim.hasGod('scorn'); var godLvl = Game.hasGod('scorn');
if (godLvl === 1) godMult *= 1.15; if (godLvl === 1) godMult *= 1.15;
else if (godLvl === 2) godMult *= 1.1; else if (godLvl === 2) godMult *= 1.1;
else if (godLvl === 3) godMult *= 1.05; else if (godLvl === 3) godMult *= 1.05;
@@ -438,6 +437,31 @@ CM.Cache.CacheCurrWrinklerCPS = function() {
CM.Cache.CurrWrinklerCPSMult = count * (count * 0.05 * 1.1) * (Game.Has('Sacrilegious corruption') * 0.05 + 1) * (Game.Has('Wrinklerspawn') * 0.05 + 1) * godMult; CM.Cache.CurrWrinklerCPSMult = count * (count * 0.05 * 1.1) * (Game.Has('Sacrilegious corruption') * 0.05 + 1) * (Game.Has('Wrinklerspawn') * 0.05 + 1) * godMult;
}; };
/**
* This function returns the current CPS buff
* It is called by CM.Sim.CalculateGains(), CM.Disp.UpdateTooltipWarnings(), CM.Cache.CacheStats() and CM.Cache.CacheChain()
* @returns {number} mult The multiplier
*/
CM.Cache.getCPSBuffMult = function() {
var mult = 1;
for (let i of Object.keys(Game.buffs)) {
if (typeof Game.buffs[i].multCpS != 'undefined') mult *= Game.buffs[i].multCpS;
}
return mult;
};
/**
* This function calculates CPS without the Golden Switch as it might be needed in other functions
* If so it CM.Sim.Win()'s them and the caller function will know to recall CM.Sim.CalculateGains()
* It is called at the end of any functions that simulates certain behaviour
*/
CM.Cache.NoGoldSwitchCPS = function() {
if (Game.Has('Golden switch [off]')) {
CM.Cache.NoGoldSwitchCookiesPS = CM.Sim.NoGoldSwitchCPS();
}
else CM.Cache.NoGoldSwitchCookiesPS = Game.cookiesPs;
};
/******** /********
* Section: Functions related to "Specials" (Dragon and Santa) */ * Section: Functions related to "Specials" (Dragon and Santa) */
@@ -505,14 +529,45 @@ CM.Cache.CacheDragonCost = function() {
*/ */
CM.Cache.CacheIncome = function() { CM.Cache.CacheIncome = function() {
// Simulate Building Buys for 1, 10 and 100 amount // Simulate Building Buys for 1, 10 and 100 amount
CM.Sim.BuyBuildings(1, 'Objects1'); CM.Cache.CacheBuildingIncome(1, 'Objects1');
CM.Sim.BuyBuildings(10, 'Objects10'); CM.Cache.CacheBuildingIncome(10, 'Objects10');
CM.Sim.BuyBuildings(100, 'Objects100'); CM.Cache.CacheBuildingIncome(100, 'Objects100');
// Simulate Upgrade Buys // Simulate Upgrade Buys
CM.Sim.BuyUpgrades(); CM.Cache.CacheUpgradeIncome();
}; };
/**
* This functions starts the calculation/simulation of the bonus income of buildings
* It is called by CM.Cache.CacheIncome()
* @param {amount} amount Amount to be bought
* @parem {string} target The target Cache object ("Objects1", "Objects10" or "Objects100")
*/
CM.Cache.CacheBuildingIncome = function(amount, target) {
CM.Cache[target] = [];
for (let i of Object.keys(Game.Objects)) {
CM.Cache[target][i] = {};
CM.Cache[target][i].bonus = CM.Sim.BuyBuildingsBonusIncome(i, amount);
if (amount != 1) {
CM.Cache.DoRemakeBuildPrices = 1;
}
}
}
/**
* This functions starts the calculation/simulation of the bonus income of upgrades
* It is called by CM.Cache.CacheIncome()
*/
CM.Cache.CacheUpgradeIncome = function() {
CM.Cache.Upgrades = [];
for (let i of Object.keys(Game.Upgrades)) {
let bonusIncome = CM.Sim.BuyUpgradesBonusIncome(i);
CM.Cache.Upgrades[i] = {};
if (bonusIncome[0]) CM.Cache.Upgrades[i].bonus = bonusIncome[0];
if (bonusIncome[1]) CM.Cache.Upgrades[i].bonusMouse = bonusIncome[1];
}
}
/******** /********
* Section: Functions related to caching prices */ * Section: Functions related to caching prices */

View File

@@ -41,7 +41,7 @@ CM.Config.LoadConfig = function(settings) {
} }
else if (i != 'Header' && i != 'Colors') { else if (i != 'Header' && i != 'Colors') {
if (i.indexOf('SoundURL') === -1) { if (i.indexOf('SoundURL') === -1) {
if (!(CM.Options[i] > -1 && CM.Options[i] < CM.ConfigData[i].label.length)) { if (!(CM.Options[i] > -1 && CM.Options[i] < CM.Data.Config[i].label.length)) {
mod = true; mod = true;
CM.Options[i] = CM.Data.ConfigDefault[i]; CM.Options[i] = CM.Data.ConfigDefault[i];
} }
@@ -73,8 +73,8 @@ CM.Config.LoadConfig = function(settings) {
if (mod) CM.Config.SaveConfig(); if (mod) CM.Config.SaveConfig();
CM.Main.Loop(); // Do loop once CM.Main.Loop(); // Do loop once
for (let i in CM.Data.ConfigDefault) { for (let i in CM.Data.ConfigDefault) {
if (i != 'Header' && typeof CM.ConfigData[i].func !== 'undefined') { if (i != 'Header' && typeof CM.Data.Config[i].func !== 'undefined') {
CM.ConfigData[i].func(); CM.Data.Config[i].func();
} }
} }
} }
@@ -104,17 +104,17 @@ CM.Config.RestoreDefault = function() {
CM.Config.ToggleConfig = function(config) { CM.Config.ToggleConfig = function(config) {
CM.Options[config]++; CM.Options[config]++;
if (CM.Options[config] === CM.ConfigData[config].label.length) { if (CM.Options[config] === CM.Data.Config[config].label.length) {
CM.Options[config] = 0; CM.Options[config] = 0;
if (CM.ConfigData[config].toggle) l(CM.Config.ConfigPrefix + config).className = 'option off'; if (CM.Data.Config[config].toggle) l(CM.Config.ConfigPrefix + config).className = 'option off';
} }
else l(CM.Config.ConfigPrefix + config).className = 'option'; else l(CM.Config.ConfigPrefix + config).className = 'option';
if (typeof CM.ConfigData[config].func !== 'undefined') { if (typeof CM.Data.Config[config].func !== 'undefined') {
CM.ConfigData[config].func(); CM.Data.Config[config].func();
} }
l(CM.Config.ConfigPrefix + config).innerHTML = CM.ConfigData[config].label[CM.Options[config]]; l(CM.Config.ConfigPrefix + config).innerHTML = CM.Data.Config[config].label[CM.Options[config]];
CM.Config.SaveConfig(); CM.Config.SaveConfig();
}; };

View File

@@ -82,7 +82,7 @@ CM.Data.shortScaleAbbreviated = ['', 'K', 'M', 'B', 'T', 'Qa', 'Qi', 'Sx', 'Sp',
/******** /********
* Section: Two array's containing all Config groups and their to-be displayed title */ * Section: Two array's containing all Config groups and their to-be displayed title */
CM.ConfigGroups = { CM.Data.ConfigGroups = {
BarsColors: "Bars/Colors", BarsColors: "Bars/Colors",
Calculation: "Calculation", Calculation: "Calculation",
Notification: "Notification", Notification: "Notification",
@@ -92,7 +92,7 @@ CM.ConfigGroups = {
Miscellaneous: "Miscellaneous" Miscellaneous: "Miscellaneous"
}; };
CM.ConfigGroupsNotification = { CM.Data.ConfigGroupsNotification = {
NotificationGeneral: "General Notifications", NotificationGeneral: "General Notifications",
NotificationGC: "Golden Cookie", NotificationGC: "Golden Cookie",
NotificationFC: "Fortune Cookie", NotificationFC: "Fortune Cookie",
@@ -104,7 +104,7 @@ CM.ConfigGroupsNotification = {
}; };
/******** /********
* Section: An array (CM.ConfigData) containing all Config options and an array of default settings */ * Section: An array (CM.Data.Config) containing all Config options and an array of default settings */
/** /**
* This includes all options of CookieMonster and relevant data * This includes all options of CookieMonster and relevant data
@@ -117,17 +117,17 @@ CM.ConfigGroupsNotification = {
* @item {function} func A function to be called when the option is toggled * @item {function} func A function to be called when the option is toggled
*/ */
// Barscolors // Barscolors
CM.ConfigData.BotBar = {type: 'bool', group: 'BarsColors', label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', toggle: true, func: function() {CM.Disp.ToggleBotBar();}}; CM.Data.Config.BotBar = {type: 'bool', group: 'BarsColors', label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', toggle: true, func: function() {CM.Disp.ToggleBotBar();}};
CM.ConfigData.TimerBar = {type: 'bool', group: 'BarsColors', label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', toggle: true, func: function() {CM.Disp.ToggleTimerBar();}}; CM.Data.Config.TimerBar = {type: 'bool', group: 'BarsColors', label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', toggle: true, func: function() {CM.Disp.ToggleTimerBar();}};
CM.ConfigData.TimerBarPos = {type: 'bool', group: 'BarsColors', label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}}; CM.Data.Config.TimerBarPos = {type: 'bool', group: 'BarsColors', label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}};
CM.ConfigData.TimerBarOverlay = {type: 'bool', group: 'BarsColors', label: ['Timer Bar Overlay OFF', 'Timer Bar Overlay Only Seconds', 'Timer Bar Overlay Full'], desc: 'Overlay on timers displaying seconds and/or percentage left', toggle: true}; CM.Data.Config.TimerBarOverlay = {type: 'bool', group: 'BarsColors', label: ['Timer Bar Overlay OFF', 'Timer Bar Overlay Only Seconds', 'Timer Bar Overlay Full'], desc: 'Overlay on timers displaying seconds and/or percentage left', toggle: true};
CM.ConfigData.SortBuildings = {type: 'bool', group: 'BarsColors', label: ['Sort Buildings: Default', 'Sort Buildings: PP'], desc: 'Sort the display of buildings in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateBuildings();}}; CM.Data.Config.SortBuildings = {type: 'bool', group: 'BarsColors', label: ['Sort Buildings: Default', 'Sort Buildings: PP'], desc: 'Sort the display of buildings in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateBuildings();}};
CM.ConfigData.SortUpgrades = {type: 'bool', group: 'BarsColors', label: ['Sort Upgrades: Default', 'Sort Upgrades: PP'], desc: 'Sort the display of upgrades in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateUpgrades();}}; CM.Data.Config.SortUpgrades = {type: 'bool', group: 'BarsColors', label: ['Sort Upgrades: Default', 'Sort Upgrades: PP'], desc: 'Sort the display of upgrades in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateUpgrades();}};
CM.ConfigData.BuildColor = {type: 'bool', group: 'BarsColors', label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}}; CM.Data.Config.BuildColor = {type: 'bool', group: 'BarsColors', label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.BulkBuildColor = {type: 'bool', group: 'BarsColors', label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}}; CM.Data.Config.BulkBuildColor = {type: 'bool', group: 'BarsColors', label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.ColorPPBulkMode = {type: 'bool', group: 'BarsColors', label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false}; CM.Data.Config.ColorPPBulkMode = {type: 'bool', group: 'BarsColors', label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false};
CM.ConfigData.UpBarColor = {type: 'bool', group: 'BarsColors', label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function() {CM.Disp.ToggleUpgradeBarAndColor();}}; CM.Data.Config.UpBarColor = {type: 'bool', group: 'BarsColors', label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function() {CM.Disp.ToggleUpgradeBarAndColor();}};
CM.ConfigData.Colors = { type: 'color', group: 'BarsColors', CM.Data.Config.Colors = { type: 'color', group: 'BarsColors',
desc: { desc: {
Blue: 'Color Blue. Used to show better than best PP building, for Click Frenzy bar, and for various labels', Blue: 'Color Blue. Used to show better than best PP building, for Click Frenzy bar, and for various labels',
Green: 'Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels', Green: 'Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels',
@@ -141,108 +141,108 @@ CM.ConfigData.Colors = { type: 'color', group: 'BarsColors',
}, },
func: function() {CM.Disp.UpdateColors();} func: function() {CM.Disp.UpdateColors();}
}; };
CM.ConfigData.UpgradeBarFixedPos = {type: 'bool', group: 'BarsColors', label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'], desc: 'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling', toggle: true, func: function() {CM.Disp.ToggleUpgradeBarFixedPos();}}; CM.Data.Config.UpgradeBarFixedPos = {type: 'bool', group: 'BarsColors', label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'], desc: 'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling', toggle: true, func: function() {CM.Disp.ToggleUpgradeBarFixedPos();}};
// Calculation // Calculation
CM.ConfigData.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON', 'Calculate with Single Fattest Wrinkler ON'], desc: 'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) Wrinklers', toggle: true}; CM.Data.Config.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON', 'Calculate with Single Fattest Wrinkler ON'], desc: 'Calculate times and average Cookies Per Second with (only the single non-shiny fattest) Wrinklers', toggle: true};
CM.ConfigData.CPSMode = {type: 'bool', group: 'Calculation', label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false}; CM.Data.Config.CPSMode = {type: 'bool', group: 'Calculation', label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false};
CM.ConfigData.AvgCPSHist = {type: 'bool', group: 'Calculation', label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false}; CM.Data.Config.AvgCPSHist = {type: 'bool', group: 'Calculation', label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false};
CM.ConfigData.AvgClicksHist = {type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false}; CM.Data.Config.AvgClicksHist = {type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false};
CM.ConfigData.ToolWarnBon = {type: 'bool', group: 'Calculation', label: ['Calculate Tooltip Warning With Bonus CPS OFF', 'Calculate Tooltip Warning With Bonus CPS ON'], desc: 'Calculate the warning with or without the bonus CPS you get from buying', toggle: true}; CM.Data.Config.ToolWarnBon = {type: 'bool', group: 'Calculation', label: ['Calculate Tooltip Warning With Bonus CPS OFF', 'Calculate Tooltip Warning With Bonus CPS ON'], desc: 'Calculate the warning with or without the bonus CPS you get from buying', toggle: true};
// Notification // Notification
CM.ConfigData.Title = {type: 'bool', group: 'NotificationGeneral', label: ['Title OFF', 'Title ON', 'Title Pinned Tab Highlight'], desc: 'Update title with Golden Cookie/Season Popup timers; pinned tab highlight only changes the title when a Golden Cookie/Season Popup spawns', toggle: true}; CM.Data.Config.Title = {type: 'bool', group: 'NotificationGeneral', label: ['Title OFF', 'Title ON', 'Title Pinned Tab Highlight'], desc: 'Update title with Golden Cookie/Season Popup timers; pinned tab highlight only changes the title when a Golden Cookie/Season Popup spawns', toggle: true};
CM.ConfigData.GeneralSound = {type: 'bool', group: 'NotificationGeneral', label: ['Consider Game Volume Setting OFF', 'Consider Game Volume Setting ON'], desc: 'Turning this toggle to "off" makes Cookie Monster no longer consider the volume setting of the base game, allowing mod notifications to play with base game volume turned down', toggle: true}; CM.Data.Config.GeneralSound = {type: 'bool', group: 'NotificationGeneral', label: ['Consider Game Volume Setting OFF', 'Consider Game Volume Setting ON'], desc: 'Turning this toggle to "off" makes Cookie Monster no longer consider the volume setting of the base game, allowing mod notifications to play with base game volume turned down', toggle: true};
CM.ConfigData.GCNotification = {type: 'bool', group: 'NotificationGC', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when Golden Cookie spawns', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.GCNotification);}}; CM.Data.Config.GCNotification = {type: 'bool', group: 'NotificationGC', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when Golden Cookie spawns', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.GCNotification);}};
CM.ConfigData.GCFlash = {type: 'bool', group: 'NotificationGC', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie', toggle: true}; CM.Data.Config.GCFlash = {type: 'bool', group: 'NotificationGC', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie', toggle: true};
CM.ConfigData.GCSound = {type: 'bool', group: 'NotificationGC', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Golden Cookie', toggle: true}; CM.Data.Config.GCSound = {type: 'bool', group: 'NotificationGC', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Golden Cookie', toggle: true};
CM.ConfigData.GCVolume = {type: 'vol', group: 'NotificationGC', label: [], desc: 'Volume'}; CM.Data.Config.GCVolume = {type: 'vol', group: 'NotificationGC', label: [], desc: 'Volume'};
for (let i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.GCVolume.label[i] = i + '%'; CM.Data.Config.GCVolume.label[i] = i + '%';
} }
CM.ConfigData.GCSoundURL = {type: 'url', group: 'NotificationGC', label: 'Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns'}; CM.Data.Config.GCSoundURL = {type: 'url', group: 'NotificationGC', label: 'Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns'};
CM.ConfigData.FortuneNotification = {type: 'bool', group: 'NotificationFC', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when Fortune Cookie is on the Ticker', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.FortuneNotification);}}; CM.Data.Config.FortuneNotification = {type: 'bool', group: 'NotificationFC', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when Fortune Cookie is on the Ticker', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.FortuneNotification);}};
CM.ConfigData.FortuneFlash = {type: 'bool', group: 'NotificationFC', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Fortune Cookie', toggle: true}; CM.Data.Config.FortuneFlash = {type: 'bool', group: 'NotificationFC', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Fortune Cookie', toggle: true};
CM.ConfigData.FortuneSound = {type: 'bool', group: 'NotificationFC', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Fortune Cookie', toggle: true}; CM.Data.Config.FortuneSound = {type: 'bool', group: 'NotificationFC', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Fortune Cookie', toggle: true};
CM.ConfigData.FortuneVolume = {type: 'vol', group: 'NotificationFC', label: [], desc: 'Volume'}; CM.Data.Config.FortuneVolume = {type: 'vol', group: 'NotificationFC', label: [], desc: 'Volume'};
for (let i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.FortuneVolume.label[i] = i + '%'; CM.Data.Config.FortuneVolume.label[i] = i + '%';
} }
CM.ConfigData.FortuneSoundURL = {type: 'url', group: 'NotificationFC', label: 'Sound URL:', desc: 'URL of the sound to be played when the Ticker has a Fortune Cookie'}; CM.Data.Config.FortuneSoundURL = {type: 'url', group: 'NotificationFC', label: 'Sound URL:', desc: 'URL of the sound to be played when the Ticker has a Fortune Cookie'};
CM.ConfigData.SeaNotification = {type: 'bool', group: 'NotificationSea', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification on Season Popup', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.SeaNotification);}}; CM.Data.Config.SeaNotification = {type: 'bool', group: 'NotificationSea', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification on Season Popup', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.SeaNotification);}};
CM.ConfigData.SeaFlash = {type: 'bool', group: 'NotificationSea', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Season Popup', toggle: true}; CM.Data.Config.SeaFlash = {type: 'bool', group: 'NotificationSea', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Season Popup', toggle: true};
CM.ConfigData.SeaSound = {type: 'bool', group: 'NotificationSea', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Season Popup', toggle: true}; CM.Data.Config.SeaSound = {type: 'bool', group: 'NotificationSea', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Season Popup', toggle: true};
CM.ConfigData.SeaVolume = {type: 'vol', group: 'NotificationSea', label: [], desc: 'Volume'}; CM.Data.Config.SeaVolume = {type: 'vol', group: 'NotificationSea', label: [], desc: 'Volume'};
for (let i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.SeaVolume.label[i] = i + '%'; CM.Data.Config.SeaVolume.label[i] = i + '%';
} }
CM.ConfigData.SeaSoundURL = {type: 'url', group: 'NotificationSea', label: 'Sound URL:', desc: 'URL of the sound to be played when a Season Special spawns'}; CM.Data.Config.SeaSoundURL = {type: 'url', group: 'NotificationSea', label: 'Sound URL:', desc: 'URL of the sound to be played when a Season Special spawns'};
CM.ConfigData.GardFlash = {type: 'bool', group: 'NotificationGard', label: ['Garden Tick Flash OFF', 'Flash ON'], desc: 'Flash screen on Garden Tick', toggle: true}; CM.Data.Config.GardFlash = {type: 'bool', group: 'NotificationGard', label: ['Garden Tick Flash OFF', 'Flash ON'], desc: 'Flash screen on Garden Tick', toggle: true};
CM.ConfigData.GardSound = {type: 'bool', group: 'NotificationGard', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Garden Tick', toggle: true}; CM.Data.Config.GardSound = {type: 'bool', group: 'NotificationGard', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound on Garden Tick', toggle: true};
CM.ConfigData.GardVolume = {type: 'vol', group: 'NotificationGard', label: [], desc: 'Volume'}; CM.Data.Config.GardVolume = {type: 'vol', group: 'NotificationGard', label: [], desc: 'Volume'};
for (let i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.GardVolume.label[i] = i + '%'; CM.Data.Config.GardVolume.label[i] = i + '%';
} }
CM.ConfigData.GardSoundURL = {type: 'url', group: 'NotificationGard', label: 'Garden Tick Sound URL:', desc: 'URL of the sound to be played when the garden ticks'}; CM.Data.Config.GardSoundURL = {type: 'url', group: 'NotificationGard', label: 'Garden Tick Sound URL:', desc: 'URL of the sound to be played when the garden ticks'};
CM.ConfigData.MagicNotification = {type: 'bool', group: 'NotificationMagi', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when magic reaches maximum', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.MagicNotification);}}; CM.Data.Config.MagicNotification = {type: 'bool', group: 'NotificationMagi', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when magic reaches maximum', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.MagicNotification);}};
CM.ConfigData.MagicFlash = {type: 'bool', group: 'NotificationMagi', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when magic reaches maximum', toggle: true}; CM.Data.Config.MagicFlash = {type: 'bool', group: 'NotificationMagi', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when magic reaches maximum', toggle: true};
CM.ConfigData.MagicSound = {type: 'bool', group: 'NotificationMagi', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when magic reaches maximum', toggle: true}; CM.Data.Config.MagicSound = {type: 'bool', group: 'NotificationMagi', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when magic reaches maximum', toggle: true};
CM.ConfigData.MagicVolume = {type: 'vol', group: 'NotificationMagi', label: [], desc: 'Volume'}; CM.Data.Config.MagicVolume = {type: 'vol', group: 'NotificationMagi', label: [], desc: 'Volume'};
for (let i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.MagicVolume.label[i] = i + '%'; CM.Data.Config.MagicVolume.label[i] = i + '%';
} }
CM.ConfigData.MagicSoundURL = {type: 'url', group: 'NotificationMagi', label: 'Sound URL:', desc: 'URL of the sound to be played when magic reaches maxium'}; CM.Data.Config.MagicSoundURL = {type: 'url', group: 'NotificationMagi', label: 'Sound URL:', desc: 'URL of the sound to be played when magic reaches maxium'};
CM.ConfigData.WrinklerNotification = {type: 'bool', group: 'NotificationWrink', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when a Wrinkler appears', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.WrinklerNotification);}}; CM.Data.Config.WrinklerNotification = {type: 'bool', group: 'NotificationWrink', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when a Wrinkler appears', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.WrinklerNotification);}};
CM.ConfigData.WrinklerFlash = {type: 'bool', group: 'NotificationWrink', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when a Wrinkler appears', toggle: true}; CM.Data.Config.WrinklerFlash = {type: 'bool', group: 'NotificationWrink', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when a Wrinkler appears', toggle: true};
CM.ConfigData.WrinklerSound = {type: 'bool', group: 'NotificationWrink', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when a Wrinkler appears', toggle: true}; CM.Data.Config.WrinklerSound = {type: 'bool', group: 'NotificationWrink', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when a Wrinkler appears', toggle: true};
CM.ConfigData.WrinklerVolume = {type: 'vol', group: 'NotificationWrink', label: [], desc: 'Volume'}; CM.Data.Config.WrinklerVolume = {type: 'vol', group: 'NotificationWrink', label: [], desc: 'Volume'};
for (let i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.WrinklerVolume.label[i] = i + '%'; CM.Data.Config.WrinklerVolume.label[i] = i + '%';
} }
CM.ConfigData.WrinklerSoundURL = {type: 'url', group: 'NotificationWrink', label: 'Sound URL:', desc: 'URL of the sound to be played when a Wrinkler appears'}; CM.Data.Config.WrinklerSoundURL = {type: 'url', group: 'NotificationWrink', label: 'Sound URL:', desc: 'URL of the sound to be played when a Wrinkler appears'};
CM.ConfigData.WrinklerMaxNotification = {type: 'bool', group: 'NotificationWrinkMax', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when the maximum amount of Wrinklers has appeared', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.WrinklerMaxNotification);}}; CM.Data.Config.WrinklerMaxNotification = {type: 'bool', group: 'NotificationWrinkMax', label: ['Notification OFF', 'Notification ON'], desc: 'Create a notification when the maximum amount of Wrinklers has appeared', toggle: true, func: function () {CM.Config.CheckNotificationPermissions(CM.Options.WrinklerMaxNotification);}};
CM.ConfigData.WrinklerMaxFlash = {type: 'bool', group: 'NotificationWrinkMax', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when the maximum amount of Wrinklers has appeared', toggle: true}; CM.Data.Config.WrinklerMaxFlash = {type: 'bool', group: 'NotificationWrinkMax', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when the maximum amount of Wrinklers has appeared', toggle: true};
CM.ConfigData.WrinklerMaxSound = {type: 'bool', group: 'NotificationWrinkMax', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when the maximum amount of Wrinklers has appeared', toggle: true}; CM.Data.Config.WrinklerMaxSound = {type: 'bool', group: 'NotificationWrinkMax', label: ['Sound OFF', 'Sound ON'], desc: 'Play a sound when the maximum amount of Wrinklers has appeared', toggle: true};
CM.ConfigData.WrinklerMaxVolume = {type: 'vol', group: 'NotificationWrinkMax', label: [], desc: 'Volume'}; CM.Data.Config.WrinklerMaxVolume = {type: 'vol', group: 'NotificationWrinkMax', label: [], desc: 'Volume'};
for (let i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.WrinklerMaxVolume.label[i] = i + '%'; CM.Data.Config.WrinklerMaxVolume.label[i] = i + '%';
} }
CM.ConfigData.WrinklerMaxSoundURL = {type: 'url', group: 'NotificationWrinkMax', label: 'Sound URL:', desc: 'URL of the sound to be played when the maximum amount of Wrinklers has appeared'}; CM.Data.Config.WrinklerMaxSoundURL = {type: 'url', group: 'NotificationWrinkMax', label: 'Sound URL:', desc: 'URL of the sound to be played when the maximum amount of Wrinklers has appeared'};
// Tooltip // Tooltip
CM.ConfigData.TooltipBuildUpgrade = {type: 'bool', group: 'Tooltip', label: ['Building/Upgrade Tooltip Information OFF', 'Building/Upgrade Tooltip Information ON'], desc: 'Extra information in Building/Upgrade tooltips', toggle: true}; CM.Data.Config.TooltipBuildUpgrade = {type: 'bool', group: 'Tooltip', label: ['Building/Upgrade Tooltip Information OFF', 'Building/Upgrade Tooltip Information ON'], desc: 'Extra information in Building/Upgrade tooltips', toggle: true};
CM.ConfigData.TooltipAmor = {type: 'bool', group: 'Tooltip', label: ['Buildings Tooltip Amortization Information OFF', 'Buildings Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip', toggle: true}; CM.Data.Config.TooltipAmor = {type: 'bool', group: 'Tooltip', label: ['Buildings Tooltip Amortization Information OFF', 'Buildings Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip', toggle: true};
CM.ConfigData.ToolWarnLucky = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards', toggle: true}; CM.Data.Config.ToolWarnLucky = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards', toggle: true};
CM.ConfigData.ToolWarnLuckyFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Frenzy Warning OFF', 'Tooltip Lucky Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards', toggle: true}; CM.Data.Config.ToolWarnLuckyFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Frenzy Warning OFF', 'Tooltip Lucky Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards', toggle: true};
CM.ConfigData.ToolWarnConjure = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true}; CM.Data.Config.ToolWarnConjure = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true};
CM.ConfigData.ToolWarnConjureFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Frenzy Warning OFF', 'Tooltip Conjure Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active', toggle: true}; CM.Data.Config.ToolWarnConjureFrenzy = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Frenzy Warning OFF', 'Tooltip Conjure Frenzy Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active', toggle: true};
CM.ConfigData.ToolWarnEdifice = {type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building', toggle: true}; CM.Data.Config.ToolWarnEdifice = {type: 'bool', group: 'Tooltip', label: ['Tooltip Edifice Warning OFF', 'Tooltip Edifice Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building', toggle: true};
CM.ConfigData.ToolWarnPos = {type: 'bool', group: 'Tooltip', label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnPos();}}; CM.Data.Config.ToolWarnPos = {type: 'bool', group: 'Tooltip', label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnPos();}};
CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true}; CM.Data.Config.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true};
CM.ConfigData.TooltipWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true}; CM.Data.Config.TooltipWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true};
CM.ConfigData.TooltipLump = {type: 'bool', group: 'Tooltip', label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true}; CM.Data.Config.TooltipLump = {type: 'bool', group: 'Tooltip', label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true};
CM.ConfigData.TooltipPlots = {type: 'bool', group: 'Tooltip', label: ['Garden Plots Tooltip OFF', 'Garden Plots Tooltip ON'], desc: 'Shows a tooltip for plants that have a cookie reward.', toggle: true}; CM.Data.Config.TooltipPlots = {type: 'bool', group: 'Tooltip', label: ['Garden Plots Tooltip OFF', 'Garden Plots Tooltip ON'], desc: 'Shows a tooltip for plants that have a cookie reward.', toggle: true};
CM.ConfigData.DragonAuraInfo = {type: 'bool', group: 'Tooltip', label: ['Extra Dragon Aura Info OFF', 'Extra Dragon Aura Info ON'], desc: 'Shows information about changes in CPS and costs in the dragon aura interface.', toggle: true}; CM.Data.Config.DragonAuraInfo = {type: 'bool', group: 'Tooltip', label: ['Extra Dragon Aura Info OFF', 'Extra Dragon Aura Info ON'], desc: 'Shows information about changes in CPS and costs in the dragon aura interface.', toggle: true};
// Statistics // Statistics
CM.ConfigData.Stats = {type: 'bool', group: 'Statistics', label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true}; CM.Data.Config.Stats = {type: 'bool', group: 'Statistics', label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true};
CM.ConfigData.MissingUpgrades = {type: 'bool', group: 'Statistics', label: ['Missing Upgrades OFF', 'Missing Upgrades ON'], desc: 'Shows Missing upgrades in Stats Menu. This feature can be laggy for users with a low amount of unlocked achievements.', toggle: true}; CM.Data.Config.MissingUpgrades = {type: 'bool', group: 'Statistics', label: ['Missing Upgrades OFF', 'Missing Upgrades ON'], desc: 'Shows Missing upgrades in Stats Menu. This feature can be laggy for users with a low amount of unlocked achievements.', toggle: true};
CM.ConfigData.UpStats = {type: 'bool', group: 'Statistics', label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false}; CM.Data.Config.UpStats = {type: 'bool', group: 'Statistics', label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false};
CM.ConfigData.TimeFormat = {type: 'bool', group: 'Statistics', label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], desc: 'Change the time format', toggle: false}; CM.Data.Config.TimeFormat = {type: 'bool', group: 'Statistics', label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], desc: 'Change the time format', toggle: false};
CM.ConfigData.DetailedTime = {type: 'bool', group: 'Statistics', label: ['Detailed Time OFF', 'Detailed Time ON'], desc: 'Change how time is displayed in certain statistics and tooltips', toggle: true, func: function() {CM.Disp.ToggleDetailedTime();}}; CM.Data.Config.DetailedTime = {type: 'bool', group: 'Statistics', label: ['Detailed Time OFF', 'Detailed Time ON'], desc: 'Change how time is displayed in certain statistics and tooltips', toggle: true, func: function() {CM.Disp.ToggleDetailedTime();}};
CM.ConfigData.GrimoireBar = {type: 'bool', group: 'Statistics', label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true}; CM.Data.Config.GrimoireBar = {type: 'bool', group: 'Statistics', label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true};
// Notation // Notation
CM.ConfigData.Scale = {type: 'bool', group: 'Notation', label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Short Scale (Abbreviated)', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}}; CM.Data.Config.Scale = {type: 'bool', group: 'Notation', label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Short Scale (Abbreviated)', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}};
CM.ConfigData.ScaleDecimals = {type: 'bool', group: 'Notation', label: ['1 decimals', '2 decimals', '3 decimals'], desc: 'Set the number of decimals used when applicable', toggle: false, func: function() {CM.Disp.RefreshScale();}}; CM.Data.Config.ScaleDecimals = {type: 'bool', group: 'Notation', label: ['1 decimals', '2 decimals', '3 decimals'], desc: 'Set the number of decimals used when applicable', toggle: false, func: function() {CM.Disp.RefreshScale();}};
CM.ConfigData.ScaleSeparator = {type: 'bool', group: 'Notation', label: ['. for decimals (Standard)', '. for thousands'], desc: 'Set the separator used for decimals and thousands', toggle: false, func: function() {CM.Disp.RefreshScale();}}; CM.Data.Config.ScaleSeparator = {type: 'bool', group: 'Notation', label: ['. for decimals (Standard)', '. for thousands'], desc: 'Set the separator used for decimals and thousands', toggle: false, func: function() {CM.Disp.RefreshScale();}};
CM.ConfigData.ScaleCutoff = {type: 'numscale', group: 'Notation', label: 'Notation Cut-off Point', desc: 'The number from which CookieMonster will start formatting numbers based on chosen scale. Standard is 999,999. Setting this above 999,999,999 might break certain notations.', min: 1, max: 999999999}; CM.Data.Config.ScaleCutoff = {type: 'numscale', group: 'Notation', label: 'Notation Cut-off Point', desc: 'The number from which CookieMonster will start formatting numbers based on chosen scale. Standard is 999,999. Setting this above 999,999,999 might break certain notations.', min: 1, max: 999999999};
// Miscellaneous // Miscellaneous
CM.ConfigData.GCTimer = {type: 'bool', group: 'Miscellaneous', label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when it has been spawned', toggle: true, func: function() {CM.Disp.ToggleGCTimer();}}; CM.Data.Config.GCTimer = {type: 'bool', group: 'Miscellaneous', label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when it has been spawned', toggle: true, func: function() {CM.Disp.ToggleGCTimer();}};
CM.ConfigData.Favicon = {type: 'bool', group: 'Miscellaneous', label: ['Favicon OFF', 'Favicon ON'], desc: 'Update favicon with Golden/Wrath Cookie', toggle: true, func: function() {CM.Disp.UpdateFavicon();}}; CM.Data.Config.Favicon = {type: 'bool', group: 'Miscellaneous', label: ['Favicon OFF', 'Favicon ON'], desc: 'Update favicon with Golden/Wrath Cookie', toggle: true, func: function() {CM.Disp.UpdateFavicon();}};
CM.ConfigData.WrinklerButtons = {type: 'bool', group: 'Miscellaneous', label: ['Extra Buttons OFF', 'Extra Buttons ON'], desc: 'Show buttons for popping wrinklers at bottom of cookie section', toggle: true, func: function() {CM.Disp.UpdateWrinklerButtons();}}; CM.Data.Config.WrinklerButtons = {type: 'bool', group: 'Miscellaneous', label: ['Extra Buttons OFF', 'Extra Buttons ON'], desc: 'Show buttons for popping wrinklers at bottom of cookie section', toggle: true, func: function() {CM.Disp.UpdateWrinklerButtons();}};
CM.ConfigData.BulkBuyBlock = {type: 'bool', group: 'Miscellaneous', label: ['Block Bulk Buying OFF', 'Block Bulk Buying ON'], desc: "Block clicking bulk buying when you can't buy all. This prevents buying 7 of a building when you are in buy-10 or buy-100 mode.", toggle: true}; CM.Data.Config.BulkBuyBlock = {type: 'bool', group: 'Miscellaneous', label: ['Block Bulk Buying OFF', 'Block Bulk Buying ON'], desc: "Block clicking bulk buying when you can't buy all. This prevents buying 7 of a building when you are in buy-10 or buy-100 mode.", toggle: true};
/** /**

View File

@@ -8,7 +8,7 @@
* All calculations and data should preferrably be put in other files. */ * All calculations and data should preferrably be put in other files. */
/******** /********
* Section: Auxilirary functions used by other functions * Section: Auxilirary functions used by other functions */
/** /**
* This function returns the total amount stored in the Wrinkler Bank * This function returns the total amount stored in the Wrinkler Bank
@@ -246,6 +246,9 @@ CM.Disp.Beautify = function(num, floats, forced) {
else if (num === Infinity) { else if (num === Infinity) {
return "Infinity"; return "Infinity";
} }
else if (typeof num === "undefined") {
return 0;
}
else { else {
console.log("Could not beautify number with CM.Disp.Beautify:" + num); console.log("Could not beautify number with CM.Disp.Beautify:" + num);
return CM.Backup.Beautify(num, floats); return CM.Backup.Beautify(num, floats);
@@ -257,7 +260,7 @@ CM.Disp.Beautify = function(num, floats, forced) {
/** /**
* This function disables and shows the bars created by CookieMonster when the game is "ascending" * This function disables and shows the bars created by CookieMonster when the game is "ascending"
* It is called by CM.Main.Loop() * It is called by CM.Disp.Draw()
*/ */
CM.Disp.UpdateAscendState = function() { CM.Disp.UpdateAscendState = function() {
if (Game.OnAscend) { if (Game.OnAscend) {
@@ -310,6 +313,7 @@ CM.Disp.Draw = function () {
timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4); timer.innerText = Game.sayTime(Game.fps * 60 - (Game.T % (Game.fps * 60)), 4);
} }
} }
// Update colors // Update colors
CM.Disp.UpdateBuildings(); CM.Disp.UpdateBuildings();
CM.Disp.UpdateUpgrades(); CM.Disp.UpdateUpgrades();
@@ -404,7 +408,7 @@ CM.Disp.CreateBotBar = function() {
/** /**
* This function updates the bonus-, pp-, and time-rows in the the bottom bar * This function updates the bonus-, pp-, and time-rows in the the bottom bar
* It is called by CM.Main.Loop() * It is called by CM.Disp.Draw()
*/ */
CM.Disp.UpdateBotBar = function() { CM.Disp.UpdateBotBar = function() {
if (CM.Options.BotBar === 1 && CM.Cache.Objects1) { if (CM.Options.BotBar === 1 && CM.Cache.Objects1) {
@@ -557,7 +561,7 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) {
/** /**
* This function updates indivudual timers in the timer bar * This function updates indivudual timers in the timer bar
* It is called by CM.Main.Loop() * It is called by CM.Disp.Draw()
*/ */
CM.Disp.UpdateTimerBar = function() { CM.Disp.UpdateTimerBar = function() {
if (CM.Options.TimerBar === 1) { if (CM.Options.TimerBar === 1) {
@@ -711,8 +715,8 @@ CM.Disp.UpdateBotTimerBarPosition = function() {
/** /**
* This function adjusts some things in the column of buildings. * This function adjusts some things in the column of buildings.
* It colours them, helps display the correct sell-price and shuffles the order when CM.Options.SortBuildings is set * It colours them, helps display the correct sell-price and shuffles the order when CM.Options.SortBuildings is set
* The function is called by CM.Main.Loop(), CM.Disp.UpdateColors() & CM.Disp.RefreshScale() * The function is called by CM.Disp.Draw(), CM.Disp.UpdateColors() & CM.Disp.RefreshScale()
* And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.ConfigData.BulkBuildColor * And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.Data.Config.BulkBuildColor
*/ */
CM.Disp.UpdateBuildings = function() { CM.Disp.UpdateBuildings = function() {
let target = `Objects${Game.buyBulk}` let target = `Objects${Game.buyBulk}`
@@ -778,7 +782,7 @@ CM.Disp.UpdateBuildings = function() {
/** /**
* This function adjusts some things in the upgrades section * This function adjusts some things in the upgrades section
* It colours them and shuffles the order when CM.Options.SortBuildings is set * It colours them and shuffles the order when CM.Options.SortBuildings is set
* The function is called by CM.Main.Loop(), CM.Disp.ToggleUpgradeBarAndColor & CM.Disp.RefreshScale() * The function is called by CM.Disp.Draw(), CM.Disp.ToggleUpgradeBarAndColor & CM.Disp.RefreshScale()
* And by changes in CM.Options.SortUpgrades * And by changes in CM.Options.SortUpgrades
*/ */
CM.Disp.UpdateUpgrades = function() { CM.Disp.UpdateUpgrades = function() {
@@ -1409,7 +1413,7 @@ CM.Disp.TooltipCreateWarningSection = function() {
/** /**
* This function updates the sections of the tooltips created by CookieMonster * This function updates the sections of the tooltips created by CookieMonster
* It is called when tooltips are created by and CM.Disp.Tooltip() on every loop by CM.Main.Loop() * It is called when tooltips are created by and CM.Disp.Tooltip() on every loop by CM.Disp.Draw()
*/ */
CM.Disp.UpdateTooltip = function() { CM.Disp.UpdateTooltip = function() {
CM.Sim.CopyData(); CM.Sim.CopyData();
@@ -1482,7 +1486,7 @@ CM.Disp.UpdateTooltipBuilding = function() {
l('CMTooltipProductionHeader').style.display = "none"; l('CMTooltipProductionHeader').style.display = "none";
l('CMTooltipTime').style.marginBottom = '0px'; l('CMTooltipTime').style.marginBottom = '0px';
for (let i of Object.keys(Game.Objects[CM.Disp.tooltipName].productionAchievs)) { for (let i of Object.keys(Game.Objects[CM.Disp.tooltipName].productionAchievs)) {
if (!CM.Sim.HasAchiev(Game.Objects[CM.Disp.tooltipName].productionAchievs[i].achiev.name)) { if (!Game.HasAchiev(Game.Objects[CM.Disp.tooltipName].productionAchievs[i].achiev.name)) {
let nextProductionAchiev = Game.Objects[CM.Disp.tooltipName].productionAchievs[i]; let nextProductionAchiev = Game.Objects[CM.Disp.tooltipName].productionAchievs[i];
l('CMTooltipTime').style.marginBottom = '4px'; l('CMTooltipTime').style.marginBottom = '4px';
l('CMTooltipProductionHeader').style.display = ""; l('CMTooltipProductionHeader').style.display = "";
@@ -1722,7 +1726,7 @@ CM.Disp.UpdateTooltipWarnings = function() {
var limitLucky = CM.Cache.Lucky; var limitLucky = CM.Cache.Lucky;
if (CM.Options.ToolWarnBon === 1) { if (CM.Options.ToolWarnBon === 1) {
var bonusNoFren = CM.Disp.TooltipBonusIncome; var bonusNoFren = CM.Disp.TooltipBonusIncome;
bonusNoFren /= CM.Sim.getCPSBuffMult(); bonusNoFren /= CM.Cache.getCPSBuffMult();
limitLucky += ((bonusNoFren * 60 * 15) / 0.15); limitLucky += ((bonusNoFren * 60 * 15) / 0.15);
} }
@@ -1816,7 +1820,7 @@ CM.Disp.ToggleToolWarnPos = function() {
/** /**
* This function checks and create a tooltip for the wrinklers * This function checks and create a tooltip for the wrinklers
* It is called by CM.Main.Loop() * It is called by CM.Disp.Draw()
* TODO: Change this code to be the same as other tooltips. (i.d., create tooltip with type "w") * TODO: Change this code to be the same as other tooltips. (i.d., create tooltip with type "w")
*/ */
CM.Disp.CheckWrinklerTooltip = function() { CM.Disp.CheckWrinklerTooltip = function() {
@@ -1854,7 +1858,7 @@ CM.Disp.CheckWrinklerTooltip = function() {
/** /**
* This function updates the amount to be displayed by the wrinkler tooltip created by CM.Disp.CheckWrinklerTooltip() * This function updates the amount to be displayed by the wrinkler tooltip created by CM.Disp.CheckWrinklerTooltip()
* It is called by CM.Main.Loop() * It is called by CM.Disp.Draw()
* TODO: Change this code to be the same as other tooltips. Fit this into CM.Disp.UpdateTooltip() * TODO: Change this code to be the same as other tooltips. Fit this into CM.Disp.UpdateTooltip()
*/ */
CM.Disp.UpdateWrinklerTooltip = function() { CM.Disp.UpdateWrinklerTooltip = function() {
@@ -1866,7 +1870,7 @@ CM.Disp.UpdateWrinklerTooltip = function() {
sucked *= toSuck; sucked *= toSuck;
if (Game.Has('Wrinklerspawn')) sucked *= 1.05; if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
if (CM.Sim.Objects.Temple.minigameLoaded) { if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = CM.Sim.hasGod('scorn'); var godLvl = Game.hasGod('scorn');
if (godLvl === 1) sucked *= 1.15; if (godLvl === 1) sucked *= 1.15;
else if (godLvl === 2) sucked *= 1.1; else if (godLvl === 2) sucked *= 1.1;
else if (godLvl === 3) sucked *= 1.05; else if (godLvl === 3) sucked *= 1.05;
@@ -1949,7 +1953,7 @@ CM.Disp.AddMenu = function() {
/** /**
* This function refreshes the stats page, CM.Options.UpStats determines the rate at which that happens * This function refreshes the stats page, CM.Options.UpStats determines the rate at which that happens
* It is called by CM.Main.Loop() * It is called by CM.Disp.Draw()
*/ */
CM.Disp.RefreshMenu = function() { CM.Disp.RefreshMenu = function() {
if (CM.Options.UpStats && Game.onMenu === 'stats' && (Game.drawT - 1) % (Game.fps * 5) != 0 && (Game.drawT - 1) % Game.fps === 0) Game.UpdateMenu(); if (CM.Options.UpStats && Game.onMenu === 'stats' && (Game.drawT - 1) % (Game.fps * 5) != 0 && (Game.drawT - 1) % Game.fps === 0) Game.UpdateMenu();
@@ -1967,26 +1971,26 @@ CM.Disp.AddMenuPref = function(title) {
var frag = document.createDocumentFragment(); var frag = document.createDocumentFragment();
frag.appendChild(title()); frag.appendChild(title());
for (let group of Object.keys(CM.ConfigGroups)) { for (let group of Object.keys(CM.Data.ConfigGroups)) {
let groupObject = CM.Disp.CreatePrefHeader(group, CM.ConfigGroups[group]); // (group, display-name of group) let groupObject = CM.Disp.CreatePrefHeader(group, CM.Data.ConfigGroups[group]); // (group, display-name of group)
frag.appendChild(groupObject); frag.appendChild(groupObject);
if (CM.Options.Header[group]) { // 0 is show, 1 is collapsed if (CM.Options.Header[group]) { // 0 is show, 1 is collapsed
// Make sub-sections of Notification section // Make sub-sections of Notification section
if (group === "Notification") { if (group === "Notification") {
for (let subGroup of Object.keys(CM.ConfigGroupsNotification)) { for (let subGroup of Object.keys(CM.Data.ConfigGroupsNotification)) {
let subGroupObject = CM.Disp.CreatePrefHeader(subGroup, CM.ConfigGroupsNotification[subGroup]); // (group, display-name of group) let subGroupObject = CM.Disp.CreatePrefHeader(subGroup, CM.Data.ConfigGroupsNotification[subGroup]); // (group, display-name of group)
subGroupObject.style.fontSize = "15px"; subGroupObject.style.fontSize = "15px";
subGroupObject.style.opacity = "0.5"; subGroupObject.style.opacity = "0.5";
frag.appendChild(subGroupObject); frag.appendChild(subGroupObject);
if (CM.Options.Header[subGroup]) { if (CM.Options.Header[subGroup]) {
for (var option in CM.ConfigData) { for (var option in CM.Data.Config) {
if (CM.ConfigData[option].group === subGroup) frag.appendChild(CM.Disp.CreatePrefOption(option)); if (CM.Data.Config[option].group === subGroup) frag.appendChild(CM.Disp.CreatePrefOption(option));
} }
} }
} }
} else { } else {
for (let option of Object.keys(CM.ConfigData)) { for (let option of Object.keys(CM.Data.Config)) {
if (CM.ConfigData[option].group === group) frag.appendChild(CM.Disp.CreatePrefOption(option)); if (CM.Data.Config[option].group === group) frag.appendChild(CM.Disp.CreatePrefOption(option));
} }
} }
} }
@@ -2042,11 +2046,11 @@ CM.Disp.CreatePrefHeader = function(config, text) {
* @returns {object} div The option object * @returns {object} div The option object
*/ */
CM.Disp.CreatePrefOption = function(config) { CM.Disp.CreatePrefOption = function(config) {
if (CM.ConfigData[config].type === "bool") { if (CM.Data.Config[config].type === "bool") {
let div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
let a = document.createElement('a'); let a = document.createElement('a');
if (CM.ConfigData[config].toggle && CM.Options[config] === 0) { if (CM.Data.Config[config].toggle && CM.Options[config] === 0) {
a.className = 'option off'; a.className = 'option off';
} }
else { else {
@@ -2054,21 +2058,21 @@ CM.Disp.CreatePrefOption = function(config) {
} }
a.id = CM.Config.ConfigPrefix + config; a.id = CM.Config.ConfigPrefix + config;
a.onclick = function() {CM.Config.ToggleConfig(config);}; a.onclick = function() {CM.Config.ToggleConfig(config);};
a.textContent = CM.ConfigData[config].label[CM.Options[config]]; a.textContent = CM.Data.Config[config].label[CM.Options[config]];
div.appendChild(a); div.appendChild(a);
let label = document.createElement('label'); let label = document.createElement('label');
label.textContent = CM.ConfigData[config].desc; label.textContent = CM.Data.Config[config].desc;
div.appendChild(label); div.appendChild(label);
return div; return div;
} }
else if (CM.ConfigData[config].type === "vol") { else if (CM.Data.Config[config].type === "vol") {
let div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
var volume = document.createElement('div'); var volume = document.createElement('div');
volume.className = 'sliderBox'; volume.className = 'sliderBox';
let title = document.createElement('div'); let title = document.createElement('div');
title.style.float = "left"; title.style.float = "left";
title.innerHTML = CM.ConfigData[config].desc; title.innerHTML = CM.Data.Config[config].desc;
volume.appendChild(title); volume.appendChild(title);
var percent = document.createElement('div'); var percent = document.createElement('div');
percent.id = "slider" + config + "right"; percent.id = "slider" + config + "right";
@@ -2090,12 +2094,12 @@ CM.Disp.CreatePrefOption = function(config) {
div.appendChild(volume); div.appendChild(volume);
return div; return div;
} }
else if (CM.ConfigData[config].type === "url") { else if (CM.Data.Config[config].type === "url") {
let div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
let span = document.createElement('span'); let span = document.createElement('span');
span.className = 'option'; span.className = 'option';
span.textContent = CM.ConfigData[config].label + ' '; span.textContent = CM.Data.Config[config].label + ' ';
div.appendChild(span); div.appendChild(span);
let input = document.createElement('input'); let input = document.createElement('input');
input.id = CM.Config.ConfigPrefix + config; input.id = CM.Config.ConfigPrefix + config;
@@ -2117,11 +2121,11 @@ CM.Disp.CreatePrefOption = function(config) {
a.textContent = 'Edit'; a.textContent = 'Edit';
div.appendChild(a); div.appendChild(a);
let label = document.createElement('label'); let label = document.createElement('label');
label.textContent = CM.ConfigData[config].desc; label.textContent = CM.Data.Config[config].desc;
div.appendChild(label); div.appendChild(label);
return div; return div;
} }
else if (CM.ConfigData[config].type === "color") { else if (CM.Data.Config[config].type === "color") {
let div = document.createElement('div'); let div = document.createElement('div');
for (let i = 0; i < CM.Disp.colors.length; i++) { for (let i = 0; i < CM.Disp.colors.length; i++) {
let innerDiv = document.createElement('div'); let innerDiv = document.createElement('div');
@@ -2134,26 +2138,26 @@ CM.Disp.CreatePrefOption = function(config) {
let change = function() {CM.Options.Colors[this.targetElement.id] = this.toHEXString(); CM.Disp.UpdateColors(); CM.Config.SaveConfig(); Game.UpdateMenu();}; let change = function() {CM.Options.Colors[this.targetElement.id] = this.toHEXString(); CM.Disp.UpdateColors(); CM.Config.SaveConfig(); Game.UpdateMenu();};
new JSColor(input, {hash: true, position: "right", onInput: change}); new JSColor(input, {hash: true, position: "right", onInput: change});
let label = document.createElement('label'); let label = document.createElement('label');
label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]]; label.textContent = CM.Data.Config.Colors.desc[CM.Disp.colors[i]];
innerDiv.appendChild(label); innerDiv.appendChild(label);
div.appendChild(innerDiv); div.appendChild(innerDiv);
} }
return div; return div;
} }
else if (CM.ConfigData[config].type === "numscale") { else if (CM.Data.Config[config].type === "numscale") {
let div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
let span = document.createElement('span'); let span = document.createElement('span');
span.className = 'option'; span.className = 'option';
span.textContent = CM.ConfigData[config].label + ' '; span.textContent = CM.Data.Config[config].label + ' ';
div.appendChild(span); div.appendChild(span);
let input = document.createElement('input'); let input = document.createElement('input');
input.id = CM.Config.ConfigPrefix + config; input.id = CM.Config.ConfigPrefix + config;
input.className = 'option'; input.className = 'option';
input.type = 'number'; input.type = 'number';
input.value = (CM.Options[config]); input.value = (CM.Options[config]);
input.min = CM.ConfigData[config].min; input.min = CM.Data.Config[config].min;
input.max = CM.ConfigData[config].max; input.max = CM.Data.Config[config].max;
input.oninput = function() {if (this.value > this.max) console.log("TEST"); input.oninput = function() {if (this.value > this.max) console.log("TEST");
CM.Options[config] = this.value; CM.Options[config] = this.value;
CM.Config.SaveConfig(); CM.Config.SaveConfig();
@@ -2162,7 +2166,7 @@ CM.Disp.CreatePrefOption = function(config) {
div.appendChild(input); div.appendChild(input);
div.appendChild(document.createTextNode(' ')); div.appendChild(document.createTextNode(' '));
let label = document.createElement('label'); let label = document.createElement('label');
label.textContent = CM.ConfigData[config].desc; label.textContent = CM.Data.Config[config].desc;
div.appendChild(label); div.appendChild(label);
return div; return div;
} }
@@ -2486,7 +2490,7 @@ CM.Disp.CreateStatsMissDisp = function(theMissDisp) {
*/ */
CM.Disp.CreateStatsLuckySection = function() { CM.Disp.CreateStatsLuckySection = function() {
// This sets which tooltip to display for certain stats // This sets which tooltip to display for certain stats
var goldCookTooltip = CM.Sim.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder'; var goldCookTooltip = Game.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder';
var section = document.createElement('div'); var section = document.createElement('div');
section.className = 'CMStatsLuckySection'; section.className = 'CMStatsLuckySection';
@@ -2551,7 +2555,7 @@ CM.Disp.CreateStatsLuckySection = function() {
*/ */
CM.Disp.CreateStatsChainSection = function() { CM.Disp.CreateStatsChainSection = function() {
// This sets which tooltip to display for certain stats // This sets which tooltip to display for certain stats
var goldCookTooltip = CM.Sim.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder'; var goldCookTooltip = Game.auraMult('Dragon\'s Fortune') ? 'GoldCookDragonsFortuneTooltipPlaceholder' : 'GoldCookTooltipPlaceholder';
var section = document.createElement('div'); var section = document.createElement('div');
section.className = 'CMStatsChainSection'; section.className = 'CMStatsChainSection';

View File

@@ -65,7 +65,7 @@ CM.Footer.AddJscolor = function() {
* This functions starts the initizialization and register CookieMonster * This functions starts the initizialization and register CookieMonster
* It is called as the last function in this script's execution * It is called as the last function in this script's execution
*/ */
if (!CM.isRunning) { if (typeof CM.Footer.isInitzializing === 'undefined') {
CM.Footer.AddJscolor(); CM.Footer.AddJscolor();
var delay = setInterval(function() { var delay = setInterval(function() {
if (typeof jscolor !== 'undefined') { if (typeof jscolor !== 'undefined') {
@@ -74,6 +74,4 @@ if (!CM.isRunning) {
clearInterval(delay); clearInterval(delay);
} }
}, 500); }, 500);
CM.isRunning = 1; }
}

View File

@@ -8,8 +8,7 @@ const CM = {
Backup: {}, Backup: {},
Cache: {}, Cache: {},
Config: {}, Config: {},
ConfigData: {}, Data: {Config: {}},
Data: {},
Disp: {}, Disp: {},
Footer: {}, Footer: {},
Main: {}, Main: {},

View File

@@ -19,7 +19,7 @@ CM.Main.Loop = function() {
if (CM.Sim.DoSims) { if (CM.Sim.DoSims) {
CM.Cache.CacheIncome(); CM.Cache.CacheIncome();
CM.Sim.NoGoldSwitchCookiesPS(); // Needed first CM.Cache.NoGoldSwitchCPS(); // Needed first
CM.Cache.CacheGoldenAndWrathCookiesMults(); CM.Cache.CacheGoldenAndWrathCookiesMults();
CM.Cache.CacheStats(); CM.Cache.CacheStats();
CM.Cache.CacheMissingUpgrades(); CM.Cache.CacheMissingUpgrades();
@@ -233,7 +233,7 @@ CM.Main.ReplaceNativeGrimoire = function() {
* It is called by CM.Main.ReplaceNativeGrimoire() * It is called by CM.Main.ReplaceNativeGrimoire()
*/ */
CM.Main.ReplaceNativeGrimoireLaunch = function() { CM.Main.ReplaceNativeGrimoireLaunch = function() {
if (!CM.HasReplaceNativeGrimoireLaunch && Game.Objects['Wizard tower'].minigameLoaded) { if (!CM.Main.HasReplaceNativeGrimoireLaunch && Game.Objects['Wizard tower'].minigameLoaded) {
var minigame = Game.Objects['Wizard tower'].minigame; var minigame = Game.Objects['Wizard tower'].minigame;
CM.Backup.GrimoireLaunch = minigame.launch; CM.Backup.GrimoireLaunch = minigame.launch;
eval('CM.Backup.GrimoireLaunchMod = ' + minigame.launch.toString().split('=this').join('= Game.Objects[\'Wizard tower\'].minigame')); eval('CM.Backup.GrimoireLaunchMod = ' + minigame.launch.toString().split('=this').join('= Game.Objects[\'Wizard tower\'].minigame'));
@@ -243,7 +243,7 @@ CM.Main.ReplaceNativeGrimoireLaunch = function() {
CM.HasReplaceNativeGrimoireDraw = false; CM.HasReplaceNativeGrimoireDraw = false;
CM.Main.ReplaceNativeGrimoireDraw(); CM.Main.ReplaceNativeGrimoireDraw();
}; };
CM.HasReplaceNativeGrimoireLaunch = true; CM.Main.HasReplaceNativeGrimoireLaunch = true;
} }
}; };
@@ -252,7 +252,7 @@ CM.Main.ReplaceNativeGrimoireLaunch = function() {
* It is called by CM.Main.ReplaceNativeGrimoire() * It is called by CM.Main.ReplaceNativeGrimoire()
*/ */
CM.Main.ReplaceNativeGrimoireDraw = function() { CM.Main.ReplaceNativeGrimoireDraw = function() {
if (!CM.HasReplaceNativeGrimoireDraw && Game.Objects['Wizard tower'].minigameLoaded) { if (!CM.Main.HasReplaceNativeGrimoireDraw && Game.Objects['Wizard tower'].minigameLoaded) {
var minigame = Game.Objects['Wizard tower'].minigame; var minigame = Game.Objects['Wizard tower'].minigame;
CM.Backup.GrimoireDraw = minigame.draw; CM.Backup.GrimoireDraw = minigame.draw;
Game.Objects['Wizard tower'].minigame.draw = function() { Game.Objects['Wizard tower'].minigame.draw = function() {
@@ -261,7 +261,7 @@ CM.Main.ReplaceNativeGrimoireDraw = function() {
minigame.magicBarTextL.innerHTML += ' (' + CM.Disp.FormatTime(CM.Disp.CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM)) + ')'; minigame.magicBarTextL.innerHTML += ' (' + CM.Disp.FormatTime(CM.Disp.CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM)) + ')';
} }
}; };
CM.HasReplaceNativeGrimoireDraw = true; CM.Main.HasReplaceNativeGrimoireDraw = true;
} }
}; };
@@ -545,20 +545,3 @@ CM.Main.FixMouseY = function(target) {
target(); target();
} }
}; };
/********
* Section: Variables used in Main functions */
CM.HasReplaceNativeGrimoireLaunch = false;
CM.HasReplaceNativeGrimoireDraw = false;
/**
* TODO: See if these can me removed (probably)
*/
CM.Main.lastGoldenCookieState = 0;
CM.Main.lastSpawnedGoldenCookieState = 0;
CM.Main.lastTickerFortuneState = 0;
CM.Main.lastSeasonPopupState = 0;
CM.Main.lastGardenNextStep = 0;
CM.Main.lastMagicBarFull = 0;
CM.Main.lastWrinklerCount = 0;

File diff suppressed because it is too large Load Diff