Changed CM.Config into CM.Options

This commit is contained in:
Daniel van Noord
2020-12-18 17:26:59 +01:00
parent 73ca07a0e9
commit 367702dc00
6 changed files with 332 additions and 326 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -86,7 +86,7 @@ CM.Cache.RemakeBuildingsPP = function() {
CM.Cache.max = -1; CM.Cache.max = -1;
CM.Cache.mid = -1; CM.Cache.mid = -1;
// Calculate PP and colors when compared to purchase of single optimal building // Calculate PP and colors when compared to purchase of single optimal building
if (CM.Config.ColorPPBulkMode == 0) { if (CM.Options.ColorPPBulkMode == 0) {
for (var i in CM.Cache.Objects) { for (var i in CM.Cache.Objects) {
//CM.Cache.Objects[i].pp = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus; //CM.Cache.Objects[i].pp = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus;
if (Game.cookiesPs) { if (Game.cookiesPs) {
@@ -419,7 +419,7 @@ CM.Cache.UpdateAvgCPS = function() {
var sortedGainWrink = new Array(); var sortedGainWrink = new Array();
var sortedGainChoEgg = new Array(); var sortedGainChoEgg = new Array();
var cpsLength = Math.min(CM.Cache.CookiesDiff.getLength(), CM.Disp.cookieTimes[CM.Config.AvgCPSHist]); var cpsLength = Math.min(CM.Cache.CookiesDiff.getLength(), CM.Disp.cookieTimes[CM.Options.AvgCPSHist]);
// Assumes the queues are the same length // Assumes the queues are the same length
for (var i = CM.Cache.CookiesDiff.getLength() - cpsLength; i < CM.Cache.CookiesDiff.getLength(); i++) { for (var i = CM.Cache.CookiesDiff.getLength() - cpsLength; i < CM.Cache.CookiesDiff.getLength(); i++) {
@@ -453,11 +453,11 @@ CM.Cache.UpdateAvgCPS = function() {
totalGainWrink += sortedGainWrink[i]; totalGainWrink += sortedGainWrink[i];
totalGainChoEgg += sortedGainChoEgg[i]; totalGainChoEgg += sortedGainChoEgg[i];
} }
CM.Cache.AvgCPS = (totalGainBank + (CM.Config.CalcWrink ? totalGainWrink : 0)) / sortedGainBank.length; CM.Cache.AvgCPS = (totalGainBank + (CM.Options.CalcWrink ? totalGainWrink : 0)) / sortedGainBank.length;
var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg'));
if (choEgg || CM.Config.CalcWrink == 0) { if (choEgg || CM.Options.CalcWrink == 0) {
CM.Cache.AvgCPSChoEgg = (totalGainBank + totalGainWrink + (choEgg ? totalGainChoEgg : 0)) / sortedGainBank.length; CM.Cache.AvgCPSChoEgg = (totalGainBank + totalGainWrink + (choEgg ? totalGainChoEgg : 0)) / sortedGainBank.length;
} }
else { else {
@@ -465,7 +465,7 @@ CM.Cache.UpdateAvgCPS = function() {
} }
var totalClicks = 0; var totalClicks = 0;
var clicksLength = Math.min(CM.Cache.ClicksDiff.getLength(), CM.Disp.clickTimes[CM.Config.AvgClicksHist]); var clicksLength = Math.min(CM.Cache.ClicksDiff.getLength(), CM.Disp.clickTimes[CM.Options.AvgClicksHist]);
for (var i = CM.Cache.ClicksDiff.getLength() - clicksLength; i < CM.Cache.ClicksDiff.getLength(); i++) { for (var i = CM.Cache.ClicksDiff.getLength() - clicksLength; i < CM.Cache.ClicksDiff.getLength(); i++) {
totalClicks += CM.Cache.ClicksDiff.get(i); totalClicks += CM.Cache.ClicksDiff.get(i);
} }

View File

@@ -9,59 +9,59 @@
* This function saves the config of CookieMonster to localStorage * This function saves the config of CookieMonster to localStorage
* It is called by CM.LoadConfig(), CM.RestoreDefault(), * It is called by CM.LoadConfig(), CM.RestoreDefault(),
* any of the CM.ToggleConfig() functions and upon changes to URL or volume settings * any of the CM.ToggleConfig() functions and upon changes to URL or volume settings
* @param {object} config The Config to be saved (normally CM.Config) * @param {object} config The Config to be saved (normally CM.Options)
*/ */
CM.SaveConfig = function(config) { CM.SaveConfig = function(config) {
localStorage.setItem(CM.ConfigPrefix, JSON.stringify(config)); localStorage.setItem(CM.ConfigPrefix, JSON.stringify(config));
} }
/** /**
* This function loads the config of CookieMonster saved in localStorage and loads it into CM.Config * This function loads the config of CookieMonster saved in localStorage and loads it into CM.Options
* It is called by CM.DelayInit() and CM.RestoreDefault() * It is called by CM.DelayInit() and CM.RestoreDefault()
*/ */
CM.LoadConfig = function() { CM.LoadConfig = function() {
if (localStorage.getItem(CM.ConfigPrefix) != null) { if (localStorage.getItem(CM.ConfigPrefix) != null) {
CM.Config = JSON.parse(localStorage.getItem(CM.ConfigPrefix)); CM.Options = JSON.parse(localStorage.getItem(CM.ConfigPrefix));
// Check values // Check values
var mod = false; var mod = false;
for (var i in CM.Data.ConfigDefault) { for (var i in CM.Data.ConfigDefault) {
if (typeof CM.Config[i] === 'undefined') { if (typeof CM.Options[i] === 'undefined') {
mod = true; mod = true;
CM.Config[i] = CM.Data.ConfigDefault[i]; CM.Options[i] = CM.Data.ConfigDefault[i];
} }
else if (i != 'StatsPref' && i != 'Colors') { else if (i != 'StatsPref' && i != 'Colors') {
if (i.indexOf('SoundURL') == -1) { if (i.indexOf('SoundURL') == -1) {
if (!(CM.Config[i] > -1 && CM.Config[i] < CM.ConfigData[i].label.length)) { if (!(CM.Options[i] > -1 && CM.Options[i] < CM.ConfigData[i].label.length)) {
mod = true; mod = true;
CM.Config[i] = CM.Data.ConfigDefault[i]; CM.Options[i] = CM.Data.ConfigDefault[i];
} }
} }
else { // Sound URLs else { // Sound URLs
if (typeof CM.Config[i] != 'string') { if (typeof CM.Options[i] != 'string') {
mod = true; mod = true;
CM.Config[i] = CM.Data.ConfigDefault[i]; CM.Options[i] = CM.Data.ConfigDefault[i];
} }
} }
} }
else if (i == 'StatsPref') { else if (i == 'StatsPref') {
for (var j in CM.Data.ConfigDefault.StatsPref) { for (var j in CM.Data.ConfigDefault.StatsPref) {
if (typeof CM.Config[i][j] === 'undefined' || !(CM.Config[i][j] > -1 && CM.Config[i][j] < 2)) { if (typeof CM.Options[i][j] === 'undefined' || !(CM.Options[i][j] > -1 && CM.Options[i][j] < 2)) {
mod = true; mod = true;
CM.Config[i][j] = CM.Data.ConfigDefault[i][j]; CM.Options[i][j] = CM.Data.ConfigDefault[i][j];
} }
} }
} }
else { // Colors else { // Colors
for (var j in CM.Data.ConfigDefault.Colors) { for (var j in CM.Data.ConfigDefault.Colors) {
if (typeof CM.Config[i][j] === 'undefined' || typeof CM.Config[i][j] != 'string') { if (typeof CM.Options[i][j] === 'undefined' || typeof CM.Options[i][j] != 'string') {
mod = true; mod = true;
CM.Config[i][j] = CM.Data.ConfigDefault[i][j]; CM.Options[i][j] = CM.Data.ConfigDefault[i][j];
} }
} }
} }
} }
if (mod) CM.SaveConfig(CM.Config); if (mod) CM.SaveConfig(CM.Options);
CM.Loop(); // Do loop once CM.Loop(); // Do loop once
for (var i in CM.Data.ConfigDefault) { for (var i in CM.Data.ConfigDefault) {
if (i != 'StatsPref' && i != 'OptionsPref' && typeof CM.ConfigData[i].func !== 'undefined') { if (i != 'StatsPref' && i != 'OptionsPref' && typeof CM.ConfigData[i].func !== 'undefined') {
@@ -79,7 +79,7 @@ CM.LoadConfig = function() {
* It is called by resDefBut.onclick loaded in the options page or by CM.LoadConfig is no localStorage is found * It is called by resDefBut.onclick loaded in the options page or by CM.LoadConfig is no localStorage is found
*/ */
CM.RestoreDefault = function() { CM.RestoreDefault = function() {
CM.Config = {}; CM.Options = {};
CM.SaveConfig(CM.Data.ConfigDefault); CM.SaveConfig(CM.Data.ConfigDefault);
CM.LoadConfig(); CM.LoadConfig();
Game.UpdateMenu(); Game.UpdateMenu();
@@ -97,7 +97,7 @@ CM.RestoreDefault = function() {
CM.ToggleConfig = function(config) { CM.ToggleConfig = function(config) {
CM.ToggleConfigUp(config); CM.ToggleConfigUp(config);
if (CM.ConfigData[config].toggle) { if (CM.ConfigData[config].toggle) {
if (CM.Config[config] == 0) { if (CM.Options[config] == 0) {
l(CM.ConfigPrefix + config).className = 'option off'; l(CM.ConfigPrefix + config).className = 'option off';
} }
else { else {
@@ -107,15 +107,15 @@ CM.ToggleConfig = function(config) {
} }
CM.ToggleConfigUp = function(config) { CM.ToggleConfigUp = function(config) {
CM.Config[config]++; CM.Options[config]++;
if (CM.Config[config] == CM.ConfigData[config].label.length) { if (CM.Options[config] == CM.ConfigData[config].label.length) {
CM.Config[config] = 0; CM.Options[config] = 0;
} }
if (typeof CM.ConfigData[config].func !== 'undefined') { if (typeof CM.ConfigData[config].func !== 'undefined') {
CM.ConfigData[config].func(); CM.ConfigData[config].func();
} }
l(CM.ConfigPrefix + config).innerHTML = CM.ConfigData[config].label[CM.Config[config]]; l(CM.ConfigPrefix + config).innerHTML = CM.ConfigData[config].label[CM.Options[config]];
CM.SaveConfig(CM.Config); CM.SaveConfig(CM.Options);
} }
/** /**
@@ -126,29 +126,29 @@ CM.ToggleConfigUp = function(config) {
CM.ToggleConfigVolume = function(config) { CM.ToggleConfigVolume = function(config) {
if (l("slider" + config) != null) { if (l("slider" + config) != null) {
l("slider" + config + "right").innerHTML = l("slider" + config).value + "%"; l("slider" + config + "right").innerHTML = l("slider" + config).value + "%";
CM.Config[config] = Math.round(l("slider" + config).value); CM.Options[config] = Math.round(l("slider" + config).value);
} }
CM.SaveConfig(CM.Config); CM.SaveConfig(CM.Options);
} }
CM.ToggleStatsConfig = function(config) { CM.ToggleStatsConfig = function(config) {
if (CM.Config.StatsPref[config] == 0) { if (CM.Options.StatsPref[config] == 0) {
CM.Config.StatsPref[config]++; CM.Options.StatsPref[config]++;
} }
else { else {
CM.Config.StatsPref[config]--; CM.Options.StatsPref[config]--;
} }
CM.SaveConfig(CM.Config); CM.SaveConfig(CM.Options);
} }
CM.ToggleOptionsConfig = function(config) { CM.ToggleOptionsConfig = function(config) {
if (CM.Config.OptionsPref[config] == 0) { if (CM.Options.OptionsPref[config] == 0) {
CM.Config.OptionsPref[config]++; CM.Options.OptionsPref[config]++;
} }
else { else {
CM.Config.OptionsPref[config]--; CM.Options.OptionsPref[config]--;
} }
CM.SaveConfig(CM.Config); CM.SaveConfig(CM.Options);
} }
// Checks if the browsers has permissions to produce notifications // Checks if the browsers has permissions to produce notifications

View File

@@ -12,11 +12,11 @@
/** /**
* This function returns the total amount stored in the Wrinkler Bank * This function returns the total amount stored in the Wrinkler Bank
* as calculated by CM.Cache.RemakeWrinkBank() if CM.Config.CalcWrink is set * as calculated by CM.Cache.RemakeWrinkBank() if CM.Options.CalcWrink is set
* @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinkBankTotal) * @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinkBankTotal)
*/ */
CM.Disp.GetWrinkConfigBank = function() { CM.Disp.GetWrinkConfigBank = function() {
if (CM.Config.CalcWrink) if (CM.Options.CalcWrink)
return CM.Cache.WrinkBankTotal; return CM.Cache.WrinkBankTotal;
else else
return 0; return 0;
@@ -35,11 +35,11 @@ CM.Disp.PopAllNormalWrinklers = function() {
} }
/** /**
* This function returns the cps as either current or average CPS depending on CM.Config.CPSMode * This function returns the cps as either current or average CPS depending on CM.Options.CPSMode
* @returns {number} The average or current cps * @returns {number} The average or current cps
*/ */
CM.Disp.GetCPS = function() { CM.Disp.GetCPS = function() {
if (CM.Config.CPSMode) if (CM.Options.CPSMode)
return CM.Cache.AvgCPS; return CM.Cache.AvgCPS;
else else
return (Game.cookiesPs * (1 - Game.cpsSucked)); return (Game.cookiesPs * (1 - Game.cpsSucked));
@@ -121,7 +121,7 @@ CM.Disp.FormatTime = function(time, longFormat) {
var m = Math.floor(time % 3600 / 60); var m = Math.floor(time % 3600 / 60);
var s = Math.floor(time % 60); var s = Math.floor(time % 60);
var str = ''; var str = '';
if (CM.Config.TimeFormat) { if (CM.Options.TimeFormat) {
if (time > 3155760000) return 'XX:XX:XX:XX:XX'; if (time > 3155760000) return 'XX:XX:XX:XX:XX';
str += (y < 10 ? '0' : '') + y + ':'; str += (y < 10 ? '0' : '') + y + ':';
str += (d < 10 ? '0' : '') + d + ':'; str += (d < 10 ? '0' : '') + d + ':';
@@ -147,7 +147,7 @@ CM.Disp.GetTimeColor = function(time) {
var color; var color;
var text; var text;
if (time < 0) { if (time < 0) {
if (CM.Config.TimeFormat) text = '00:00:00:00:00'; if (CM.Options.TimeFormat) text = '00:00:00:00:00';
else text = 'Done!'; else text = 'Done!';
color = CM.Disp.colorGreen; color = CM.Disp.colorGreen;
} }
@@ -168,8 +168,8 @@ CM.Disp.GetTimeColor = function(time) {
* @returns {string} Formatted number * @returns {string} Formatted number
*/ */
CM.Disp.Beautify = function(num, frac, forced) { CM.Disp.Beautify = function(num, frac, forced) {
var decimals = CM.Config.ScaleDecimals + 1; var decimals = CM.Options.ScaleDecimals + 1;
if (CM.Config.Scale == 0) { if (CM.Options.Scale == 0) {
return CM.Backup.Beautify(num, frac); return CM.Backup.Beautify(num, frac);
} }
else if (isFinite(num)) { else if (isFinite(num)) {
@@ -187,8 +187,8 @@ CM.Disp.Beautify = function(num, frac, forced) {
// TODO: Add changing separators of thousands and making this cut-off user configurable // TODO: Add changing separators of thousands and making this cut-off user configurable
answer = Math.round(num * 100) / 100; answer = Math.round(num * 100) / 100;
} }
else if (CM.Config.Scale == 3 && !forced || forced == 3) { // Scientific notation, 123456789 => 1.235E+8 else if (CM.Options.Scale == 3 && !forced || forced == 3) { // Scientific notation, 123456789 => 1.235E+8
answer = num[0] + (CM.Config.ScaleSeparator ? ',' : '.'); answer = num[0] + (CM.Options.ScaleSeparator ? ',' : '.');
i = 0; i = 0;
while (i < decimals - 1) { while (i < decimals - 1) {
answer += num[i + 2]; // num has a 0-based index and [1] is a '.' answer += num[i + 2]; // num has a 0-based index and [1] is a '.'
@@ -213,13 +213,13 @@ CM.Disp.Beautify = function(num, frac, forced) {
numbersToAdd = (restOfNumber.indexOf('.') > -1 ? restOfNumber.indexOf('.') + 1 + decimals : (restOfNumber.length)) numbersToAdd = (restOfNumber.indexOf('.') > -1 ? restOfNumber.indexOf('.') + 1 + decimals : (restOfNumber.length))
i = 0 i = 0
while (i < numbersToAdd - 1 && i < restOfNumber.length - 1) { while (i < numbersToAdd - 1 && i < restOfNumber.length - 1) {
answer += (CM.Config.ScaleSeparator && restOfNumber[i] == '.' ? ',' : restOfNumber[i]); answer += (CM.Options.ScaleSeparator && restOfNumber[i] == '.' ? ',' : restOfNumber[i]);
i++ i++
} }
answer += (i + 1 < restOfNumber.length ? Math.round(restOfNumber[i] + '.' + restOfNumber[i + 1]) : restOfNumber[i]); answer += (i + 1 < restOfNumber.length ? Math.round(restOfNumber[i] + '.' + restOfNumber[i + 1]) : restOfNumber[i]);
// answer is now "xxx.xx" (e.g., 123456789 would be 123.46) // answer is now "xxx.xx" (e.g., 123456789 would be 123.46)
if (CM.Config.Scale == 1 && !forced || forced == 1) { // Metric scale, 123456789 => 123.457 M if (CM.Options.Scale == 1 && !forced || forced == 1) { // Metric scale, 123456789 => 123.457 M
if (timesTenToPowerThree - 1 < CM.Data.metric.length) { if (timesTenToPowerThree - 1 < CM.Data.metric.length) {
answer += ' ' + CM.Data.metric[timesTenToPowerThree - 1] answer += ' ' + CM.Data.metric[timesTenToPowerThree - 1]
} }
@@ -227,7 +227,7 @@ CM.Disp.Beautify = function(num, frac, forced) {
return CM.Disp.Beautify(num, 0, 3); return CM.Disp.Beautify(num, 0, 3);
} }
} }
else if (CM.Config.Scale == 2 && !forced || forced == 2) { // Short scale, 123456789 => 123.457 M else if (CM.Options.Scale == 2 && !forced || forced == 2) { // Short scale, 123456789 => 123.457 M
if (timesTenToPowerThree < CM.Data.shortScale.length + 1) { if (timesTenToPowerThree < CM.Data.shortScale.length + 1) {
answer += ' ' + CM.Data.shortScale[timesTenToPowerThree - 1]; answer += ' ' + CM.Data.shortScale[timesTenToPowerThree - 1];
} }
@@ -235,7 +235,7 @@ CM.Disp.Beautify = function(num, frac, forced) {
return CM.Disp.Beautify(num, 0, 3); return CM.Disp.Beautify(num, 0, 3);
} }
} }
else if (CM.Config.Scale == 4 && !forced || forced == 4) { // Engineering notation, 123456789 => 123.457E+6 else if (CM.Options.Scale == 4 && !forced || forced == 4) { // Engineering notation, 123456789 => 123.457E+6
answer += 'E+' + (timesTenToPowerThree * 3); answer += 'E+' + (timesTenToPowerThree * 3);
} }
} }
@@ -265,8 +265,8 @@ CM.Disp.Beautify = function(num, frac, forced) {
CM.Disp.UpdateAscendState = function() { CM.Disp.UpdateAscendState = function() {
if (Game.OnAscend) { if (Game.OnAscend) {
l('game').style.bottom = '0px'; l('game').style.bottom = '0px';
if (CM.Config.BotBar == 1) CM.Disp.BotBar.style.display = 'none'; if (CM.Options.BotBar == 1) CM.Disp.BotBar.style.display = 'none';
if (CM.Config.TimerBar == 1) CM.Disp.TimerBar.style.display = 'none'; if (CM.Options.TimerBar == 1) CM.Disp.TimerBar.style.display = 'none';
} }
else { else {
CM.Disp.ToggleBotBar(); CM.Disp.ToggleBotBar();
@@ -317,7 +317,7 @@ CM.Disp.Draw = function () {
// Draw autosave timer in stats menu // Draw autosave timer in stats menu
if ( if (
(Game.prefs.autosave && Game.drawT % 10 == 0) && // with autosave ON and every 10 ticks (Game.prefs.autosave && Game.drawT % 10 == 0) && // with autosave ON and every 10 ticks
(Game.onMenu == 'stats' && CM.Config.Stats) // while being on the stats menu only (Game.onMenu == 'stats' && CM.Options.Stats) // while being on the stats menu only
) { ) {
var timer = document.getElementById('CMStatsAutosaveTimer'); var timer = document.getElementById('CMStatsAutosaveTimer');
if (timer) { if (timer) {
@@ -331,10 +331,10 @@ CM.Disp.Draw = function () {
/** /**
* This function toggle the bottom bar * This function toggle the bottom bar
* It is called by CM.Disp.UpdateAscendState() and a change in CM.Config.BotBar * It is called by CM.Disp.UpdateAscendState() and a change in CM.Options.BotBar
*/ */
CM.Disp.ToggleBotBar = function() { CM.Disp.ToggleBotBar = function() {
if (CM.Config.BotBar == 1) { if (CM.Options.BotBar == 1) {
CM.Disp.BotBar.style.display = ''; CM.Disp.BotBar.style.display = '';
CM.Disp.UpdateBotBar(); CM.Disp.UpdateBotBar();
} }
@@ -346,7 +346,7 @@ CM.Disp.ToggleBotBar = function() {
/** /**
* This function creates the bottom bar and appends it to l('wrapper') * This function creates the bottom bar and appends it to l('wrapper')
* It is called by CM.DelayInit and a change in CM.Config.BotBar * It is called by CM.DelayInit and a change in CM.Options.BotBar
*/ */
CM.Disp.CreateBotBar = function() { CM.Disp.CreateBotBar = function() {
CM.Disp.BotBar = document.createElement('div'); CM.Disp.BotBar = document.createElement('div');
@@ -400,7 +400,7 @@ CM.Disp.CreateBotBar = function() {
* It is called by CM.Loop() * It is called by CM.Loop()
*/ */
CM.Disp.UpdateBotBar = function() { CM.Disp.UpdateBotBar = function() {
if (CM.Config.BotBar == 1) { if (CM.Options.BotBar == 1) {
var count = 0; var count = 0;
for (var i in CM.Cache.Objects) { for (var i in CM.Cache.Objects) {
var target = 'Objects'; var target = 'Objects';
@@ -549,7 +549,7 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) {
* It is called by CM.Loop() * It is called by CM.Loop()
*/ */
CM.Disp.UpdateTimerBar = function() { CM.Disp.UpdateTimerBar = function() {
if (CM.Config.TimerBar == 1) { if (CM.Options.TimerBar == 1) {
// label width: 113, timer width: 26, div margin: 20 // label width: 113, timer width: 26, div margin: 20
var maxWidth = CM.Disp.TimerBar.offsetWidth - 159; var maxWidth = CM.Disp.TimerBar.offsetWidth - 159;
var numberOfTimers = 0; var numberOfTimers = 0;
@@ -624,20 +624,20 @@ CM.Disp.UpdateTimerBar = function() {
/** /**
* This function changes the visibility of the timer bar * This function changes the visibility of the timer bar
* It is called by CM.Disp.UpdateAscendState() or a change in CM.Config.TimerBar * It is called by CM.Disp.UpdateAscendState() or a change in CM.Options.TimerBar
*/ */
CM.Disp.ToggleTimerBar = function() { CM.Disp.ToggleTimerBar = function() {
if (CM.Config.TimerBar == 1) CM.Disp.TimerBar.style.display = ''; if (CM.Options.TimerBar == 1) CM.Disp.TimerBar.style.display = '';
else CM.Disp.TimerBar.style.display = 'none'; else CM.Disp.TimerBar.style.display = 'none';
CM.Disp.UpdateBotTimerBarPosition(); CM.Disp.UpdateBotTimerBarPosition();
} }
/** /**
* This function changes the position of the timer bar * This function changes the position of the timer bar
* It is called by a change in CM.Config.TimerBarPos * It is called by a change in CM.Options.TimerBarPos
*/ */
CM.Disp.ToggleTimerBarPos = function() { CM.Disp.ToggleTimerBarPos = function() {
if (CM.Config.TimerBarPos == 0) { if (CM.Options.TimerBarPos == 0) {
CM.Disp.TimerBar.style.width = '30%'; CM.Disp.TimerBar.style.width = '30%';
CM.Disp.TimerBar.style.bottom = ''; CM.Disp.TimerBar.style.bottom = '';
l('game').insertBefore(CM.Disp.TimerBar, l('sectionLeft')); l('game').insertBefore(CM.Disp.TimerBar, l('sectionLeft'));
@@ -658,22 +658,22 @@ CM.Disp.ToggleTimerBarPos = function() {
* It is called by CM.Disp.ToggleTimerBar(), CM.Disp.ToggleTimerBarPos() and CM.Disp.ToggleBotBar() * It is called by CM.Disp.ToggleTimerBar(), CM.Disp.ToggleTimerBarPos() and CM.Disp.ToggleBotBar()
*/ */
CM.Disp.UpdateBotTimerBarPosition = function() { CM.Disp.UpdateBotTimerBarPosition = function() {
if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) { if (CM.Options.BotBar == 1 && CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 1) {
CM.Disp.BotBar.style.bottom = '48px'; CM.Disp.BotBar.style.bottom = '48px';
l('game').style.bottom = '118px'; l('game').style.bottom = '118px';
} }
else if (CM.Config.BotBar == 1) { else if (CM.Options.BotBar == 1) {
CM.Disp.BotBar.style.bottom = '0px'; CM.Disp.BotBar.style.bottom = '0px';
l('game').style.bottom = '70px'; l('game').style.bottom = '70px';
} }
else if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) { else if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 1) {
l('game').style.bottom = '48px'; l('game').style.bottom = '48px';
} }
else { // No bars else { // No bars
l('game').style.bottom = '0px'; l('game').style.bottom = '0px';
} }
if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 0) { if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 0) {
l('sectionLeft').style.top = '48px'; l('sectionLeft').style.top = '48px';
} }
else { else {
@@ -688,18 +688,18 @@ 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.Config.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.Loop(), CM.Disp.UpdateColors() & CM.Disp.RefreshScale() * The function is called by CM.Loop(), CM.Disp.UpdateColors() & CM.Disp.RefreshScale()
* And by changes in CM.Config.BuildColor, CM.Config.SortBuild & CM.ConfigData.BulkBuildColor * And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.ConfigData.BulkBuildColor
*/ */
CM.Disp.UpdateBuildings = function() { CM.Disp.UpdateBuildings = function() {
if (CM.Config.BuildColor == 1 && Game.buyMode == 1) { if (CM.Options.BuildColor == 1 && Game.buyMode == 1) {
var target = ''; var target = '';
if (Game.buyBulk == 10 && CM.Config.BulkBuildColor == 1) target = 'Objects10'; if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10';
else if (Game.buyBulk == 100 && CM.Config.BulkBuildColor == 1) target = 'Objects100'; else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100';
else target = 'Objects'; else target = 'Objects';
for (var i in CM.Cache[target]) { for (var i in CM.Cache[target]) {
l('productPrice' + Game.Objects[i].id).style.color = CM.Config.Colors[CM.Cache[target][i].color]; l('productPrice' + Game.Objects[i].id).style.color = CM.Options.Colors[CM.Cache[target][i].color];
} }
} }
else if (Game.buyMode == -1) { else if (Game.buyMode == -1) {
@@ -721,7 +721,7 @@ CM.Disp.UpdateBuildings = function() {
// Build array of pointers, sort by pp, use array index (+2) as the grid row number // Build array of pointers, sort by pp, use array index (+2) as the grid row number
// (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options) // (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options)
// This regulates sorting of buildings // This regulates sorting of buildings
if (Game.buyMode == 1 && CM.Config.SortBuildings) { if (Game.buyMode == 1 && CM.Options.SortBuildings) {
var arr = Object.keys(CM.Cache[target]).map(k => var arr = Object.keys(CM.Cache[target]).map(k =>
{ {
var o = CM.Cache[target][k]; var o = CM.Cache[target][k];
@@ -752,13 +752,13 @@ 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.Config.SortBuildings is set * It colours them and shuffles the order when CM.Options.SortBuildings is set
* The function is called by CM.Loop(), CM.Disp.ToggleUpgradeBarAndColor & CM.Disp.RefreshScale() * The function is called by CM.Loop(), CM.Disp.ToggleUpgradeBarAndColor & CM.Disp.RefreshScale()
* And by changes in CM.Config.SortUpgrades * And by changes in CM.Options.SortUpgrades
*/ */
CM.Disp.UpdateUpgrades = function() { CM.Disp.UpdateUpgrades = function() {
// This counts the amount of upgrades for each pp group and updates the Upgrade Bar // This counts the amount of upgrades for each pp group and updates the Upgrade Bar
if (CM.Config.UpBarColor > 0) { if (CM.Options.UpBarColor > 0) {
var blue = 0; var blue = 0;
var green = 0; var green = 0;
var yellow = 0; var yellow = 0;
@@ -813,7 +813,7 @@ CM.Disp.UpdateUpgrades = function() {
arr.push(o); arr.push(o);
} }
if (CM.Config.SortUpgrades) if (CM.Options.SortUpgrades)
arr.sort((a, b) => a.pp - b.pp); arr.sort((a, b) => a.pp - b.pp);
else else
arr.sort((a, b) => a.price - b.price); arr.sort((a, b) => a.price - b.price);
@@ -828,14 +828,14 @@ CM.Disp.UpdateUpgrades = function() {
/** /**
* This function toggles the upgrade bar and the colours of upgrades * This function toggles the upgrade bar and the colours of upgrades
* It is called by a change in CM.Config.UpBarColor * It is called by a change in CM.Options.UpBarColor
*/ */
CM.Disp.ToggleUpgradeBarAndColor = function() { CM.Disp.ToggleUpgradeBarAndColor = function() {
if (CM.Config.UpBarColor == 1) { // Colours and bar on if (CM.Options.UpBarColor == 1) { // Colours and bar on
CM.Disp.UpgradeBar.style.display = ''; CM.Disp.UpgradeBar.style.display = '';
CM.Disp.UpdateUpgrades(); CM.Disp.UpdateUpgrades();
} }
else if (CM.Config.UpBarColor == 2) {// Colours on and bar off else if (CM.Options.UpBarColor == 2) {// Colours on and bar off
CM.Disp.UpgradeBar.style.display = 'none'; CM.Disp.UpgradeBar.style.display = 'none';
CM.Disp.UpdateUpgrades(); CM.Disp.UpdateUpgrades();
} }
@@ -847,10 +847,10 @@ CM.Disp.ToggleUpgradeBarAndColor = function() {
/** /**
* This function toggles the position of the upgrade bar from fixed or non-fixed mode * This function toggles the position of the upgrade bar from fixed or non-fixed mode
* It is called by a change in CM.Config.UpgradeBarFixedPos * It is called by a change in CM.Options.UpgradeBarFixedPos
*/ */
CM.Disp.ToggleUpgradeBarFixedPos = function() { CM.Disp.ToggleUpgradeBarFixedPos = function() {
if (CM.Config.UpgradeBarFixedPos == 1) { // Fix to top of screen when scrolling if (CM.Options.UpgradeBarFixedPos == 1) { // Fix to top of screen when scrolling
CM.Disp.UpgradeBar.style.position = 'sticky'; CM.Disp.UpgradeBar.style.position = 'sticky';
CM.Disp.UpgradeBar.style.top = '0px'; CM.Disp.UpgradeBar.style.top = '0px';
} }
@@ -960,10 +960,10 @@ CM.Disp.CreateWhiteScreen = function() {
* that check game-events and which have settings for Flashes (e.g., Golden Cookies appearing, Magic meter being full) * that check game-events and which have settings for Flashes (e.g., Golden Cookies appearing, Magic meter being full)
* @param {number} mode Sets the intensity of the flash, used to recursively dim flash * @param {number} mode Sets the intensity of the flash, used to recursively dim flash
* All calls of function have use mode == 3 * All calls of function have use mode == 3
* @param {string} config The setting in CM.Config that is checked before creating the flash * @param {string} config The setting in CM.Options that is checked before creating the flash
*/ */
CM.Disp.Flash = function(mode, config) { CM.Disp.Flash = function(mode, config) {
if ((CM.Config[config] == 1 && mode == 3) || mode == 1) { if ((CM.Options[config] == 1 && mode == 3) || mode == 1) {
CM.Disp.WhiteScreen.style.opacity = '0.5'; CM.Disp.WhiteScreen.style.opacity = '0.5';
if (mode == 3) { if (mode == 3) {
CM.Disp.WhiteScreen.style.display = 'inline'; CM.Disp.WhiteScreen.style.display = 'inline';
@@ -983,14 +983,14 @@ CM.Disp.Flash = function(mode, config) {
/** /**
* This function plays a sound depending on configs. It is called by all functions * This function plays a sound depending on configs. It is called by all functions
* that check game-events and which have settings for sound (e.g., Golden Cookies appearing, Magic meter being full) * that check game-events and which have settings for sound (e.g., Golden Cookies appearing, Magic meter being full)
* @param {variable} url A variable that gives the url for the sound (e.g., CM.Config.GCSoundURL) * @param {variable} url A variable that gives the url for the sound (e.g., CM.Options.GCSoundURL)
* @param {string} sndConfig The setting in CM.Config that is checked before creating the sound * @param {string} sndConfig The setting in CM.Options that is checked before creating the sound
* @param {string} volConfig The setting in CM.Config that is checked to determine volume * @param {string} volConfig The setting in CM.Options that is checked to determine volume
*/ */
CM.Disp.PlaySound = function(url, sndConfig, volConfig) { CM.Disp.PlaySound = function(url, sndConfig, volConfig) {
if (CM.Config[sndConfig] == 1) { if (CM.Options[sndConfig] == 1) {
var sound = new realAudio(url); var sound = new realAudio(url);
sound.volume = (CM.Config[volConfig] / 100) * (Game.volume / 100); sound.volume = (CM.Options[volConfig] / 100) * (Game.volume / 100);
sound.play(); sound.play();
} }
} }
@@ -998,12 +998,12 @@ CM.Disp.PlaySound = function(url, sndConfig, volConfig) {
/** /**
* This function creates a notifcation depending on configs. It is called by all functions * This function creates a notifcation depending on configs. It is called by all functions
* that check game-events and which have settings for notifications (e.g., Golden Cookies appearing, Magic meter being full) * that check game-events and which have settings for notifications (e.g., Golden Cookies appearing, Magic meter being full)
* @param {string} notifyConfig The setting in CM.Config that is checked before creating the notification * @param {string} notifyConfig The setting in CM.Options that is checked before creating the notification
* @param {string} title The title of the to-be created notifications * @param {string} title The title of the to-be created notifications
* @param {string} message The text of the to-be created notifications * @param {string} message The text of the to-be created notifications
*/ */
CM.Disp.Notification = function(notifyConfig, title, message) { CM.Disp.Notification = function(notifyConfig, title, message) {
if (CM.Config[notifyConfig] == 1 && document.visibilityState == 'hidden') { if (CM.Options[notifyConfig] == 1 && document.visibilityState == 'hidden') {
var CookieIcon = 'https://orteil.dashnet.org/cookieclicker/favicon.ico' var CookieIcon = 'https://orteil.dashnet.org/cookieclicker/favicon.ico'
notification = new Notification(title, {body: message, badge: CookieIcon}); notification = new Notification(title, {body: message, badge: CookieIcon});
} }
@@ -1025,11 +1025,11 @@ CM.Disp.CreateFavicon = function() {
/** /**
* This function updates the Favicon depending on whether a Golden Cookie has spawned * This function updates the Favicon depending on whether a Golden Cookie has spawned
* It is called on every loop by CM.Main.CheckGoldenCookie() or by a change in CM.Config.Favicon * It is called on every loop by CM.Main.CheckGoldenCookie() or by a change in CM.Options.Favicon
* By relying on CM.Cache.spawnedGoldenShimmer it only changes for non-user spawned cookie * By relying on CM.Cache.spawnedGoldenShimmer it only changes for non-user spawned cookie
*/ */
CM.Disp.UpdateFavicon = function() { CM.Disp.UpdateFavicon = function() {
if (CM.Config.Favicon == 1 && CM.Main.lastGoldenCookieState > 0) { if (CM.Options.Favicon == 1 && CM.Main.lastGoldenCookieState > 0) {
if (CM.Cache.spawnedGoldenShimmer.wrath) CM.Disp.Favicon.href = 'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico'; if (CM.Cache.spawnedGoldenShimmer.wrath) CM.Disp.Favicon.href = 'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico';
else CM.Disp.Favicon.href = 'https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico'; else CM.Disp.Favicon.href = 'https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico';
} }
@@ -1041,10 +1041,10 @@ CM.Disp.UpdateFavicon = function() {
* It is called on every loop by Game.Logic() which also sets CM.Cache.Title to Game.cookies * It is called on every loop by Game.Logic() which also sets CM.Cache.Title to Game.cookies
*/ */
CM.Disp.UpdateTitle = function() { CM.Disp.UpdateTitle = function() {
if (Game.OnAscend || CM.Config.Title == 0) { if (Game.OnAscend || CM.Options.Title == 0) {
document.title = CM.Cache.Title; document.title = CM.Cache.Title;
} }
else if (CM.Config.Title == 1) { else if (CM.Options.Title == 1) {
var addFC = false; var addFC = false;
var addSP = false; var addSP = false;
var titleGC; var titleGC;
@@ -1080,7 +1080,7 @@ CM.Disp.UpdateTitle = function() {
} }
document.title = titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '') + ' ' + str; document.title = titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '') + ' ' + str;
} }
else if (CM.Config.Title == 2) { else if (CM.Options.Title == 2) {
var str = ''; var str = '';
var spawn = false; var spawn = false;
if (CM.Cache.spawnedGoldenShimmer) { if (CM.Cache.spawnedGoldenShimmer) {
@@ -1125,7 +1125,7 @@ CM.Disp.CreateGCTimer = function(cookie) {
GCTimer.style.fontSize = '35px'; GCTimer.style.fontSize = '35px';
GCTimer.style.cursor = 'pointer'; GCTimer.style.cursor = 'pointer';
GCTimer.style.display = 'block'; GCTimer.style.display = 'block';
if (CM.Config.GCTimer == 0) GCTimer.style.display = 'none'; if (CM.Options.GCTimer == 0) GCTimer.style.display = 'none';
GCTimer.style.left = cookie.l.style.left; GCTimer.style.left = cookie.l.style.left;
GCTimer.style.top = cookie.l.style.top; GCTimer.style.top = cookie.l.style.top;
GCTimer.onclick = function () {cookie.pop();}; GCTimer.onclick = function () {cookie.pop();};
@@ -1138,10 +1138,10 @@ CM.Disp.CreateGCTimer = function(cookie) {
/** /**
* This function toggles GC Timers are visible * This function toggles GC Timers are visible
* It is called by a change in CM.Config.GCTimer * It is called by a change in CM.Options.GCTimer
*/ */
CM.Disp.ToggleGCTimer = function() { CM.Disp.ToggleGCTimer = function() {
if (CM.Config.GCTimer == 1) { if (CM.Options.GCTimer == 1) {
for (var i in CM.Disp.GCTimers) { for (var i in CM.Disp.GCTimers) {
CM.Disp.GCTimers[i].style.display = 'block'; CM.Disp.GCTimers[i].style.display = 'block';
CM.Disp.GCTimers[i].style.left = CM.Cache.goldenShimmersByID[i].l.style.left; CM.Disp.GCTimers[i].style.left = CM.Cache.goldenShimmersByID[i].l.style.left;
@@ -1257,7 +1257,7 @@ CM.Disp.Tooltip = function(type, name) {
if (type == 'b') { // Buildings if (type == 'b') { // Buildings
l('tooltip').innerHTML = Game.Objects[name].tooltip(); l('tooltip').innerHTML = Game.Objects[name].tooltip();
// Adds amortization info to the list of info per building // Adds amortization info to the list of info per building
if (CM.Config.TooltipAmor == 1) { if (CM.Options.TooltipAmor == 1) {
var buildPrice = CM.Sim.BuildingGetPrice(Game.Objects[name], Game.Objects[name].basePrice, 0, Game.Objects[name].free, Game.Objects[name].amount); var buildPrice = CM.Sim.BuildingGetPrice(Game.Objects[name], Game.Objects[name].basePrice, 0, Game.Objects[name].free, Game.Objects[name].amount);
var amortizeAmount = buildPrice - Game.Objects[name].totalCookies; var amortizeAmount = buildPrice - Game.Objects[name].totalCookies;
if (amortizeAmount > 0) { if (amortizeAmount > 0) {
@@ -1452,7 +1452,7 @@ CM.Disp.UpdateTooltip = function() {
* It is called when Building tooltips are created or refreshed by CM.Disp.UpdateTooltip() * It is called when Building tooltips are created or refreshed by CM.Disp.UpdateTooltip()
*/ */
CM.Disp.UpdateTooltipBuilding = function() { CM.Disp.UpdateTooltipBuilding = function() {
if (CM.Config.TooltipBuildUp == 1 && Game.buyMode == 1) { if (CM.Options.TooltipBuildUp == 1 && Game.buyMode == 1) {
tooltipBox = l('CMTooltipBorder'); tooltipBox = l('CMTooltipBorder');
CM.Disp.TooltipCreateCalculationSection(tooltipBox); CM.Disp.TooltipCreateCalculationSection(tooltipBox);
@@ -1467,7 +1467,7 @@ CM.Disp.UpdateTooltipBuilding = function() {
CM.Disp.TooltipBonusIncome = CM.Cache[target][CM.Disp.tooltipName].bonus; CM.Disp.TooltipBonusIncome = CM.Cache[target][CM.Disp.tooltipName].bonus;
if (CM.Config.TooltipBuildUp == 1 && Game.buyMode == 1) { if (CM.Options.TooltipBuildUp == 1 && Game.buyMode == 1) {
l('CMTooltipIncome').textContent = Beautify(CM.Disp.TooltipBonusIncome, 2); l('CMTooltipIncome').textContent = Beautify(CM.Disp.TooltipBonusIncome, 2);
var increase = Math.round(CM.Disp.TooltipBonusIncome / Game.cookiesPs * 10000); var increase = Math.round(CM.Disp.TooltipBonusIncome / Game.cookiesPs * 10000);
if (isFinite(increase) && increase != 0) { if (isFinite(increase) && increase != 0) {
@@ -1512,7 +1512,7 @@ CM.Disp.UpdateTooltipUpgrade = function() {
CM.Disp.TooltipBonusIncome = CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].bonus; CM.Disp.TooltipBonusIncome = CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].bonus;
CM.Disp.TooltipPrice = Game.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].getPrice(); CM.Disp.TooltipPrice = Game.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].getPrice();
if (CM.Config.TooltipBuildUp == 1) { if (CM.Options.TooltipBuildUp == 1) {
l('CMTooltipIncome').textContent = Beautify(CM.Disp.TooltipBonusIncome, 2); l('CMTooltipIncome').textContent = Beautify(CM.Disp.TooltipBonusIncome, 2);
var increase = Math.round(CM.Disp.TooltipBonusIncome / Game.cookiesPs * 10000); var increase = Math.round(CM.Disp.TooltipBonusIncome / Game.cookiesPs * 10000);
if (isFinite(increase) && increase != 0) { if (isFinite(increase) && increase != 0) {
@@ -1543,7 +1543,7 @@ CM.Disp.UpdateTooltipUpgrade = function() {
* It adds to the additional information to l('CMTooltipArea') * It adds to the additional information to l('CMTooltipArea')
*/ */
CM.Disp.UpdateTooltipSugarLump = function() { CM.Disp.UpdateTooltipSugarLump = function() {
if (CM.Config.TooltipLump === 1) { if (CM.Options.TooltipLump === 1) {
tooltipBox = l('CMTooltipBorder'); tooltipBox = l('CMTooltipBorder');
tooltipBox.appendChild(CM.Disp.TooltipCreateHeader('Current Sugar Lump')); tooltipBox.appendChild(CM.Disp.TooltipCreateHeader('Current Sugar Lump'));
@@ -1566,7 +1566,7 @@ CM.Disp.UpdateTooltipGrimoire = function() {
var minigame = Game.Objects['Wizard tower'].minigame; var minigame = Game.Objects['Wizard tower'].minigame;
var spellCost = minigame.getSpellCost(minigame.spellsById[CM.Disp.tooltipName]); var spellCost = minigame.getSpellCost(minigame.spellsById[CM.Disp.tooltipName]);
if (CM.Config.TooltipGrim == 1 && spellCost <= minigame.magicM) { if (CM.Options.TooltipGrim == 1 && spellCost <= minigame.magicM) {
tooltipBox = l('CMTooltipBorder'); tooltipBox = l('CMTooltipBorder');
// Time left till enough magic for spell // Time left till enough magic for spell
@@ -1624,14 +1624,14 @@ CM.Disp.UpdateTooltipWarnings = function() {
CM.Disp.ToggleToolWarnPos(); CM.Disp.ToggleToolWarnPos();
} }
if (CM.Config.ToolWarnPos == 0) CM.Disp.TooltipWarn.style.right = '0px'; if (CM.Options.ToolWarnPos == 0) CM.Disp.TooltipWarn.style.right = '0px';
else CM.Disp.TooltipWarn.style.top = (l('tooltip').offsetHeight) + 'px'; else CM.Disp.TooltipWarn.style.top = (l('tooltip').offsetHeight) + 'px';
CM.Disp.TooltipWarn.style.width = (l('tooltip').offsetWidth - 6) + 'px'; CM.Disp.TooltipWarn.style.width = (l('tooltip').offsetWidth - 6) + 'px';
if (CM.Config.ToolWarnLucky == 1) { if (CM.Options.ToolWarnLucky == 1) {
var limitLucky = CM.Cache.Lucky; var limitLucky = CM.Cache.Lucky;
if (CM.Config.ToolWarnBon == 1) { if (CM.Options.ToolWarnBon == 1) {
var bonusNoFren = CM.Disp.TooltipBonusIncome; var bonusNoFren = CM.Disp.TooltipBonusIncome;
bonusNoFren /= CM.Sim.getCPSBuffMult(); bonusNoFren /= CM.Sim.getCPSBuffMult();
limitLucky += ((bonusNoFren * 60 * 15) / 0.15); limitLucky += ((bonusNoFren * 60 * 15) / 0.15);
@@ -1660,9 +1660,9 @@ CM.Disp.UpdateTooltipWarnings = function() {
l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none'; l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
} }
if (CM.Config.ToolWarnConjure == 1) { if (CM.Options.ToolWarnConjure == 1) {
var limitLucky = CM.Cache.Lucky; var limitLucky = CM.Cache.Lucky;
if (CM.Config.ToolWarnBon == 1) { if (CM.Options.ToolWarnBon == 1) {
var bonusNoFren = CM.Disp.TooltipBonusIncome; var bonusNoFren = CM.Disp.TooltipBonusIncome;
bonusNoFren /= CM.Sim.getCPSBuffMult(); bonusNoFren /= CM.Sim.getCPSBuffMult();
limitLucky += ((bonusNoFren * 60 * 15) / 0.15); limitLucky += ((bonusNoFren * 60 * 15) / 0.15);
@@ -1694,25 +1694,25 @@ CM.Disp.UpdateTooltipWarnings = function() {
CM.Disp.UpdateTooltipLocation = function() { CM.Disp.UpdateTooltipLocation = function() {
if (Game.tooltip.origin == 'store') { if (Game.tooltip.origin == 'store') {
var warnOffset = 0; var warnOffset = 0;
if (CM.Config.ToolWarnLucky == 1 && CM.Config.ToolWarnPos == 1 && typeof CM.Disp.TooltipWarn != "undefined") { if (CM.Options.ToolWarnLucky == 1 && CM.Options.ToolWarnPos == 1 && typeof CM.Disp.TooltipWarn != "undefined") {
warnOffset = CM.Disp.TooltipWarn.clientHeight - 4; warnOffset = CM.Disp.TooltipWarn.clientHeight - 4;
} }
Game.tooltip.tta.style.top = Math.min(parseInt(Game.tooltip.tta.style.top), (l('game').clientHeight + l('topBar').clientHeight) - Game.tooltip.tt.clientHeight - warnOffset - 46) + 'px'; Game.tooltip.tta.style.top = Math.min(parseInt(Game.tooltip.tta.style.top), (l('game').clientHeight + l('topBar').clientHeight) - Game.tooltip.tt.clientHeight - warnOffset - 46) + 'px';
} }
// Kept for future possible use if the code changes again // Kept for future possible use if the code changes again
/*else if (!Game.onCrate && !Game.OnAscend && CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 0) { /*else if (!Game.onCrate && !Game.OnAscend && CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 0) {
Game.tooltip.tta.style.top = (parseInt(Game.tooltip.tta.style.top) + parseInt(CM.Disp.TimerBar.style.height)) + 'px'; Game.tooltip.tta.style.top = (parseInt(Game.tooltip.tta.style.top) + parseInt(CM.Disp.TimerBar.style.height)) + 'px';
}*/ }*/
} }
/** /**
* This function toggles the position of the warnings created by CM.Disp.TooltipCreateWarningSection() * This function toggles the position of the warnings created by CM.Disp.TooltipCreateWarningSection()
* It is called by a change in CM.Config.ToolWarnPos * It is called by a change in CM.Options.ToolWarnPos
* and upon creation of the warning tooltip by CM.Disp.UpdateTooltipWarnings() * and upon creation of the warning tooltip by CM.Disp.UpdateTooltipWarnings()
*/ */
CM.Disp.ToggleToolWarnPos = function() { CM.Disp.ToggleToolWarnPos = function() {
if (typeof CM.Disp.TooltipWarn != "undefined") { if (typeof CM.Disp.TooltipWarn != "undefined") {
if (CM.Config.ToolWarnPos == 0) { if (CM.Options.ToolWarnPos == 0) {
CM.Disp.TooltipWarn.style.top = 'auto'; CM.Disp.TooltipWarn.style.top = 'auto';
CM.Disp.TooltipWarn.style.margin = '4px -4px'; CM.Disp.TooltipWarn.style.margin = '4px -4px';
CM.Disp.TooltipWarn.style.padding = '3px 4px'; CM.Disp.TooltipWarn.style.padding = '3px 4px';
@@ -1731,7 +1731,7 @@ CM.Disp.ToggleToolWarnPos = function() {
* 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() {
if (CM.Config.ToolWrink == 1 && CM.Disp.TooltipWrinklerArea == 1) { // Latter is set by CM.Main.AddWrinklerAreaDetect if (CM.Options.ToolWrink == 1 && CM.Disp.TooltipWrinklerArea == 1) { // Latter is set by CM.Main.AddWrinklerAreaDetect
var showingTooltip = false; var showingTooltip = false;
for (var i in Game.wrinklers) { for (var i in Game.wrinklers) {
var me = Game.wrinklers[i]; var me = Game.wrinklers[i];
@@ -1769,7 +1769,7 @@ CM.Disp.CheckWrinklerTooltip = function() {
* 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() {
if (CM.Config.ToolWrink == 1 && l('CMTooltipWrinkler') != null) { if (CM.Options.ToolWrink == 1 && l('CMTooltipWrinkler') != null) {
var sucked = Game.wrinklers[CM.Disp.TooltipWrinkler].sucked; var sucked = Game.wrinklers[CM.Disp.TooltipWrinkler].sucked;
var toSuck = 1.1; var toSuck = 1.1;
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05; if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
@@ -1795,7 +1795,7 @@ CM.Disp.UpdateWrinklerTooltip = function() {
* @param {number} aura The number of the aura currently selected by the mouse/user * @param {number} aura The number of the aura currently selected by the mouse/user
*/ */
CM.Disp.AddAuraInfo = function(aura) { CM.Disp.AddAuraInfo = function(aura) {
if (CM.Config.DragonAuraInfo == 1) { if (CM.Options.DragonAuraInfo == 1) {
var [bonusCPS, priceOfChange] = CM.Sim.CalculateChangeAura(aura); var [bonusCPS, priceOfChange] = CM.Sim.CalculateChangeAura(aura);
var timeToRecover = CM.Disp.FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs)); var timeToRecover = CM.Disp.FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs));
var bonusCPSPercentage = CM.Disp.Beautify(bonusCPS / Game.cookiesPs); var bonusCPSPercentage = CM.Disp.Beautify(bonusCPS / Game.cookiesPs);
@@ -1836,18 +1836,18 @@ CM.Disp.AddMenu = function() {
CM.Disp.AddMenuPref(title); CM.Disp.AddMenuPref(title);
} }
else if (Game.onMenu == 'stats') { else if (Game.onMenu == 'stats') {
if (CM.Config.Stats) { if (CM.Options.Stats) {
CM.Disp.AddMenuStats(title); CM.Disp.AddMenuStats(title);
} }
} }
} }
/** /**
* This function refreshes the stats page, CM.Config.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.Loop() * It is called by CM.Loop()
*/ */
CM.Disp.RefreshMenu = function() { CM.Disp.RefreshMenu = function() {
if (CM.Config.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();
} }
/******** /********
@@ -1865,7 +1865,7 @@ CM.Disp.AddMenuPref = function(title) {
for (var group in CM.ConfigGroups) { for (var group in CM.ConfigGroups) {
groupObject = CM.Disp.CreatePrefHeader(group, CM.ConfigGroups[group]) // (group, display-name of group) groupObject = CM.Disp.CreatePrefHeader(group, CM.ConfigGroups[group]) // (group, display-name of group)
frag.appendChild(groupObject) frag.appendChild(groupObject)
if (CM.Config.OptionsPref[group]) { // 0 is show, 1 is collapsed if (CM.Options.OptionsPref[group]) { // 0 is show, 1 is collapsed
for (var option in CM.ConfigData) { for (var option in CM.ConfigData) {
if (CM.ConfigData[option].group == group) frag.appendChild(CM.Disp.CreatePrefOption(option)) if (CM.ConfigData[option].group == group) frag.appendChild(CM.Disp.CreatePrefOption(option))
} }
@@ -1894,6 +1894,7 @@ CM.Disp.AddMenuPref = function(title) {
CM.Disp.CreatePrefHeader = function(config, text) { CM.Disp.CreatePrefHeader = function(config, text) {
var div = document.createElement('div'); var div = document.createElement('div');
div.className = 'title'; div.className = 'title';
div.style.opacity = '0.7'; div.style.opacity = '0.7';
div.style.fontSize = '17px'; div.style.fontSize = '17px';
div.appendChild(document.createTextNode(text + ' ')); div.appendChild(document.createTextNode(text + ' '));
@@ -1908,7 +1909,7 @@ CM.Disp.CreatePrefHeader = function(config, text) {
span.style.color = 'black'; span.style.color = 'black';
span.style.fontSize = '13px'; span.style.fontSize = '13px';
span.style.verticalAlign = 'middle'; span.style.verticalAlign = 'middle';
span.textContent = CM.Config.OptionsPref[config] ? '-' : '+'; span.textContent = CM.Options.OptionsPref[config] ? '-' : '+';
span.onclick = function() {CM.ToggleOptionsConfig(config); Game.UpdateMenu();}; span.onclick = function() {CM.ToggleOptionsConfig(config); Game.UpdateMenu();};
div.appendChild(span); div.appendChild(span);
return div; return div;
@@ -1925,7 +1926,7 @@ CM.Disp.CreatePrefOption = function(config) {
var div = document.createElement('div'); var div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
var a = document.createElement('a'); var a = document.createElement('a');
if (CM.ConfigData[config].toggle && CM.Config[config] == 0) { if (CM.ConfigData[config].toggle && CM.Options[config] == 0) {
a.className = 'option off'; a.className = 'option off';
} }
else { else {
@@ -1933,7 +1934,7 @@ CM.Disp.CreatePrefOption = function(config) {
} }
a.id = CM.ConfigPrefix + config; a.id = CM.ConfigPrefix + config;
a.onclick = function() {CM.ToggleConfig(config);}; a.onclick = function() {CM.ToggleConfig(config);};
a.textContent = CM.ConfigData[config].label[CM.Config[config]]; a.textContent = CM.ConfigData[config].label[CM.Options[config]];
div.appendChild(a); div.appendChild(a);
var label = document.createElement('label'); var label = document.createElement('label');
label.textContent = CM.ConfigData[config].desc; label.textContent = CM.ConfigData[config].desc;
@@ -1952,7 +1953,7 @@ CM.Disp.CreatePrefOption = function(config) {
var percent = title = document.createElement('div'); var percent = title = document.createElement('div');
percent.id = "slider" + config + "right"; percent.id = "slider" + config + "right";
percent.style.float = "right"; percent.style.float = "right";
percent.innerHTML = CM.Config[config] + "%"; percent.innerHTML = CM.Options[config] + "%";
volume.appendChild(percent); volume.appendChild(percent);
var slider = document.createElement('input'); var slider = document.createElement('input');
slider.className = "slider"; slider.className = "slider";
@@ -1962,7 +1963,7 @@ CM.Disp.CreatePrefOption = function(config) {
slider.min = "0"; slider.min = "0";
slider.max = "100"; slider.max = "100";
slider.step = "1"; slider.step = "1";
slider.value = CM.Config[config]; slider.value = CM.Options[config];
slider.oninput = function() {CM.ToggleConfigVolume(config)}; slider.oninput = function() {CM.ToggleConfigVolume(config)};
slider.onchange = function() {CM.ToggleConfigVolume(config)}; slider.onchange = function() {CM.ToggleConfigVolume(config)};
volume.appendChild(slider); volume.appendChild(slider);
@@ -1981,7 +1982,7 @@ CM.Disp.CreatePrefOption = function(config) {
input.className = 'option'; input.className = 'option';
input.type = 'text'; input.type = 'text';
input.readOnly = true; input.readOnly = true;
input.setAttribute('value', CM.Config[config]); input.setAttribute('value', CM.Options[config]);
input.style.width = '300px'; input.style.width = '300px';
div.appendChild(input); div.appendChild(input);
div.appendChild(document.createTextNode(' ')); div.appendChild(document.createTextNode(' '));
@@ -1989,10 +1990,10 @@ CM.Disp.CreatePrefOption = function(config) {
inputPrompt.id = CM.ConfigPrefix + config + 'Prompt'; inputPrompt.id = CM.ConfigPrefix + config + 'Prompt';
inputPrompt.className = 'option'; inputPrompt.className = 'option';
inputPrompt.type = 'text'; inputPrompt.type = 'text';
inputPrompt.setAttribute('value', CM.Config[config]); inputPrompt.setAttribute('value', CM.Options[config]);
var a = document.createElement('a'); var a = document.createElement('a');
a.className = 'option'; a.className = 'option';
a.onclick = function() {Game.Prompt(inputPrompt.outerHTML, [['Save', 'CM.Config[\'' + config + '\'] = l(CM.ConfigPrefix + \'' + config + '\' + \'Prompt\').value; CM.SaveConfig(CM.Config); Game.ClosePrompt(); Game.UpdateMenu();'], 'Cancel']);}; a.onclick = function() {Game.Prompt(inputPrompt.outerHTML, [['Save', 'CM.Options[\'' + config + '\'] = l(CM.ConfigPrefix + \'' + config + '\' + \'Prompt\').value; CM.SaveConfig(CM.Options); Game.ClosePrompt(); Game.UpdateMenu();'], 'Cancel']);};
a.textContent = 'Edit'; a.textContent = 'Edit';
div.appendChild(a); div.appendChild(a);
var label = document.createElement('label'); var label = document.createElement('label');
@@ -2008,9 +2009,9 @@ CM.Disp.CreatePrefOption = function(config) {
input.id = CM.ConfigPrefix + 'Color' + CM.Disp.colors[i]; input.id = CM.ConfigPrefix + 'Color' + CM.Disp.colors[i];
input.className = 'option'; input.className = 'option';
input.style.width = '65px'; input.style.width = '65px';
input.setAttribute('value', CM.Config.Colors[CM.Disp.colors[i]]); input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]);
div.appendChild(input); div.appendChild(input);
eval('var change = function() {CM.Config.Colors[\'' + CM.Disp.colors[i] + '\'] = l(CM.ConfigPrefix + \'Color\' + \'' + CM.Disp.colors[i] + '\').value; CM.Disp.UpdateColors(); CM.SaveConfig(CM.Config);}'); eval('var change = function() {CM.Options.Colors[\'' + CM.Disp.colors[i] + '\'] = l(CM.ConfigPrefix + \'Color\' + \'' + CM.Disp.colors[i] + '\').value; CM.Disp.UpdateColors(); CM.SaveConfig(CM.Options);}');
var jscolorpicker = new jscolor.color(input, {hash: true, caps: false, pickerZIndex: 1000000, pickerPosition: 'right', onImmediateChange: change}); var jscolorpicker = new jscolor.color(input, {hash: true, caps: false, pickerZIndex: 1000000, pickerPosition: 'right', onImmediateChange: change});
var label = document.createElement('label'); var label = document.createElement('label');
label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]]; label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]];
@@ -2022,16 +2023,16 @@ CM.Disp.CreatePrefOption = function(config) {
/** /**
* This function changes some of the time-displays in the game to be more detailed * This function changes some of the time-displays in the game to be more detailed
* It is called by a change in CM.Config.DetailedTime * It is called by a change in CM.Options.DetailedTime
*/ */
CM.Disp.ToggleDetailedTime = function() { CM.Disp.ToggleDetailedTime = function() {
if (CM.Config.DetailedTime == 1) Game.sayTime = CM.Disp.sayTime; if (CM.Options.DetailedTime == 1) Game.sayTime = CM.Disp.sayTime;
else Game.sayTime = CM.Backup.sayTime; else Game.sayTime = CM.Backup.sayTime;
} }
/** /**
* This function refreshes all numbers after a change in scale-setting * This function refreshes all numbers after a change in scale-setting
* It is therefore called by a change in CM.Config.Scale and CM.Config.ScaleDecimals * It is therefore called by a change in CM.Options.Scale and CM.Options.ScaleDecimals
*/ */
CM.Disp.RefreshScale = function() { CM.Disp.RefreshScale = function() {
BeautifyAll(); BeautifyAll();
@@ -2045,18 +2046,18 @@ CM.Disp.RefreshScale = function() {
/** /**
* This function changes/refreshes colours if the user has set new standard colours * This function changes/refreshes colours if the user has set new standard colours
* The function is therefore called by a change in CM.Config.Colors * The function is therefore called by a change in CM.Options.Colors
*/ */
CM.Disp.UpdateColors = function() { CM.Disp.UpdateColors = function() {
var str = ''; var str = '';
for (var i = 0; i < CM.Disp.colors.length; i++) { for (var i = 0; i < CM.Disp.colors.length; i++) {
str += '.' + CM.Disp.colorTextPre + CM.Disp.colors[i] + ' { color: ' + CM.Config.Colors[CM.Disp.colors[i]] + '; }\n'; str += '.' + CM.Disp.colorTextPre + CM.Disp.colors[i] + ' { color: ' + CM.Options.Colors[CM.Disp.colors[i]] + '; }\n';
} }
for (var i = 0; i < CM.Disp.colors.length; i++) { for (var i = 0; i < CM.Disp.colors.length; i++) {
str += '.' + CM.Disp.colorBackPre + CM.Disp.colors[i] + ' { background-color: ' + CM.Config.Colors[CM.Disp.colors[i]] + '; }\n'; str += '.' + CM.Disp.colorBackPre + CM.Disp.colors[i] + ' { background-color: ' + CM.Options.Colors[CM.Disp.colors[i]] + '; }\n';
} }
for (var i = 0; i < CM.Disp.colors.length; i++) { for (var i = 0; i < CM.Disp.colors.length; i++) {
str += '.' + CM.Disp.colorBorderPre + CM.Disp.colors[i] + ' { border: 1px solid ' + CM.Config.Colors[CM.Disp.colors[i]] + '; }\n'; str += '.' + CM.Disp.colorBorderPre + CM.Disp.colors[i] + ' { border: 1px solid ' + CM.Options.Colors[CM.Disp.colors[i]] + '; }\n';
} }
CM.Disp.Css.textContent = str; CM.Disp.Css.textContent = str;
CM.Disp.UpdateBuildings(); // Class has been already set CM.Disp.UpdateBuildings(); // Class has been already set
@@ -2077,28 +2078,28 @@ CM.Disp.AddMenuStats = function(title) {
stats.appendChild(title()); stats.appendChild(title());
stats.appendChild(CM.Disp.CreateStatsHeader('Lucky Cookies', 'Lucky')); stats.appendChild(CM.Disp.CreateStatsHeader('Lucky Cookies', 'Lucky'));
if (CM.Config.StatsPref.Lucky) { if (CM.Options.StatsPref.Lucky) {
stats.appendChild(CM.Disp.CreateStatsLuckySection()); stats.appendChild(CM.Disp.CreateStatsLuckySection());
} }
stats.appendChild(CM.Disp.CreateStatsHeader('Chain Cookies', 'Chain')); stats.appendChild(CM.Disp.CreateStatsHeader('Chain Cookies', 'Chain'));
if (CM.Config.StatsPref.Chain) { if (CM.Options.StatsPref.Chain) {
stats.appendChild(CM.Disp.CreateStatsChainSection()); stats.appendChild(CM.Disp.CreateStatsChainSection());
} }
stats.appendChild(CM.Disp.CreateStatsHeader('Conjure Baked Goods', 'Conjure')); stats.appendChild(CM.Disp.CreateStatsHeader('Conjure Baked Goods', 'Conjure'));
if (CM.Config.StatsPref.Conjure) { if (CM.Options.StatsPref.Conjure) {
stats.appendChild(CM.Disp.CreateStatsConjureSection()); stats.appendChild(CM.Disp.CreateStatsConjureSection());
} }
stats.appendChild(CM.Disp.CreateStatsHeader('Prestige', 'Prestige')); stats.appendChild(CM.Disp.CreateStatsHeader('Prestige', 'Prestige'));
if (CM.Config.StatsPref.Prestige) { if (CM.Options.StatsPref.Prestige) {
stats.appendChild(CM.Disp.CreateStatsPrestigeSection()); stats.appendChild(CM.Disp.CreateStatsPrestigeSection());
} }
if (Game.cpsSucked > 0) { if (Game.cpsSucked > 0) {
stats.appendChild(CM.Disp.CreateStatsHeader('Wrinklers', 'Wrink')); stats.appendChild(CM.Disp.CreateStatsHeader('Wrinklers', 'Wrink'));
if (CM.Config.StatsPref.Wrink) { if (CM.Options.StatsPref.Wrink) {
var popAllFrag = document.createDocumentFragment(); var popAllFrag = document.createDocumentFragment();
popAllFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinkBankTotal) + ' / ' + Beautify(CM.Cache.WrinkBankNormal) + ' ')); popAllFrag.appendChild(document.createTextNode(Beautify(CM.Cache.WrinkBankTotal) + ' / ' + Beautify(CM.Cache.WrinkBankNormal) + ' '));
var popAllA = document.createElement('a'); var popAllA = document.createElement('a');
@@ -2152,7 +2153,7 @@ CM.Disp.AddMenuStats = function(title) {
if (Game.season == 'christmas' || specDisp || choEgg || centEgg) { if (Game.season == 'christmas' || specDisp || choEgg || centEgg) {
stats.appendChild(CM.Disp.CreateStatsHeader('Season Specials', 'Sea')); stats.appendChild(CM.Disp.CreateStatsHeader('Season Specials', 'Sea'));
if (CM.Config.StatsPref.Sea) { if (CM.Options.StatsPref.Sea) {
if (specDisp) { if (specDisp) {
if (missingHalloweenCookies.length != 0) stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Halloween Cookies Left to Buy', CM.Disp.CreateStatsMissDisp(missingHalloweenCookies))); if (missingHalloweenCookies.length != 0) stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Halloween Cookies Left to Buy', CM.Disp.CreateStatsMissDisp(missingHalloweenCookies)));
if (missingChristmasCookies.length != 0) stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Christmas Cookies Left to Buy', CM.Disp.CreateStatsMissDisp(missingChristmasCookies))); if (missingChristmasCookies.length != 0) stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Christmas Cookies Left to Buy', CM.Disp.CreateStatsMissDisp(missingChristmasCookies)));
@@ -2172,12 +2173,12 @@ CM.Disp.AddMenuStats = function(title) {
} }
stats.appendChild(CM.Disp.CreateStatsHeader('Miscellaneous', 'Misc')); stats.appendChild(CM.Disp.CreateStatsHeader('Miscellaneous', 'Misc'));
if (CM.Config.StatsPref.Misc) { if (CM.Options.StatsPref.Misc) {
stats.appendChild(CM.Disp.CreateStatsListing("basic", stats.appendChild(CM.Disp.CreateStatsListing("basic",
'Average Cookies Per Second (Past ' + (CM.Disp.cookieTimes[CM.Config.AvgCPSHist] < 60 ? (CM.Disp.cookieTimes[CM.Config.AvgCPSHist] + ' seconds') : ((CM.Disp.cookieTimes[CM.Config.AvgCPSHist] / 60) + (CM.Config.AvgCPSHist == 3 ? ' minute' : ' minutes'))) + ')', 'Average Cookies Per Second (Past ' + (CM.Disp.cookieTimes[CM.Options.AvgCPSHist] < 60 ? (CM.Disp.cookieTimes[CM.Options.AvgCPSHist] + ' seconds') : ((CM.Disp.cookieTimes[CM.Options.AvgCPSHist] / 60) + (CM.Options.AvgCPSHist == 3 ? ' minute' : ' minutes'))) + ')',
document.createTextNode(Beautify(CM.Cache.AvgCPS, 3)) document.createTextNode(Beautify(CM.Cache.AvgCPS, 3))
)); ));
stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Average Cookie Clicks Per Second (Past ' + CM.Disp.clickTimes[CM.Config.AvgClicksHist] + (CM.Config.AvgClicksHist == 0 ? ' second' : ' seconds') + ')', document.createTextNode(Beautify(CM.Cache.AvgClicks, 1)))); stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Average Cookie Clicks Per Second (Past ' + CM.Disp.clickTimes[CM.Options.AvgClicksHist] + (CM.Options.AvgClicksHist == 0 ? ' second' : ' seconds') + ')', document.createTextNode(Beautify(CM.Cache.AvgClicks, 1))));
if (Game.Has('Fortune cookies')) { if (Game.Has('Fortune cookies')) {
var fortunes = []; var fortunes = [];
for (var i in CM.Data.Fortunes) { for (var i in CM.Data.Fortunes) {
@@ -2198,7 +2199,7 @@ CM.Disp.AddMenuStats = function(title) {
l('menu').insertBefore(stats, l('menu').childNodes[2]); l('menu').insertBefore(stats, l('menu').childNodes[2]);
if (CM.Config.MissingUpgrades) { if (CM.Options.MissingUpgrades) {
CM.Disp.AddMissingUpgrades(); CM.Disp.AddMissingUpgrades();
} }
} }
@@ -2229,7 +2230,7 @@ CM.Disp.CreateStatsHeader = function(text, config) {
span.style.color = 'black'; span.style.color = 'black';
span.style.fontSize = '13px'; span.style.fontSize = '13px';
span.style.verticalAlign = 'middle'; span.style.verticalAlign = 'middle';
span.textContent = CM.Config.StatsPref[config] ? '-' : '+'; span.textContent = CM.Options.StatsPref[config] ? '-' : '+';
span.onclick = function() {CM.ToggleStatsConfig(config); Game.UpdateMenu();}; span.onclick = function() {CM.ToggleStatsConfig(config); Game.UpdateMenu();};
div.appendChild(span); div.appendChild(span);
return div; return div;

View File

@@ -18,6 +18,8 @@ RunCookieMonsterHeader = function() {
CM.Main = {}; CM.Main = {};
CM.Options = {};
CM.Sim = {}; CM.Sim = {};
} }

View File

@@ -126,7 +126,7 @@ CM.ReplaceNativeGrimoireDraw = function() {
CM.Backup.GrimoireDraw = minigame.draw; CM.Backup.GrimoireDraw = minigame.draw;
Game.Objects['Wizard tower'].minigame.draw = function() { Game.Objects['Wizard tower'].minigame.draw = function() {
CM.Backup.GrimoireDraw(); CM.Backup.GrimoireDraw();
if (CM.Config.GrimoireBar == 1 && minigame.magic < minigame.magicM) { if (CM.Options.GrimoireBar == 1 && minigame.magic < minigame.magicM) {
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)) + ')';
} }
} }
@@ -314,7 +314,7 @@ CM.Main.CheckGoldenCookie = function() {
if (CM.Main.lastGoldenCookieState) { if (CM.Main.lastGoldenCookieState) {
if (CM.Main.lastSpawnedGoldenCookieState < CM.Main.currSpawnedGoldenCookieState) { if (CM.Main.lastSpawnedGoldenCookieState < CM.Main.currSpawnedGoldenCookieState) {
CM.Disp.Flash(3, 'GCFlash'); CM.Disp.Flash(3, 'GCFlash');
CM.Disp.PlaySound(CM.Config.GCSoundURL, 'GCSound', 'GCVolume'); CM.Disp.PlaySound(CM.Options.GCSoundURL, 'GCSound', 'GCVolume');
CM.Disp.Notification('GCNotification', "Golden Cookie Spawned", "A Golden Cookie has spawned. Click it now!") CM.Disp.Notification('GCNotification', "Golden Cookie Spawned", "A Golden Cookie has spawned. Click it now!")
} }
@@ -328,7 +328,7 @@ CM.Main.CheckGoldenCookie = function() {
CM.Main.lastSpawnedGoldenCookieState = CM.Main.currSpawnedGoldenCookieState; CM.Main.lastSpawnedGoldenCookieState = CM.Main.currSpawnedGoldenCookieState;
if (CM.Main.currSpawnedGoldenCookieState == 0) CM.Cache.spawnedGoldenShimmer = 0; if (CM.Main.currSpawnedGoldenCookieState == 0) CM.Cache.spawnedGoldenShimmer = 0;
} }
else if (CM.Config.GCTimer == 1 && CM.Main.lastGoldenCookieState) { else if (CM.Options.GCTimer == 1 && CM.Main.lastGoldenCookieState) {
for (var i in CM.Disp.GCTimers) { for (var i in CM.Disp.GCTimers) {
CM.Disp.GCTimers[i].style.opacity = CM.Cache.goldenShimmersByID[i].l.style.opacity; CM.Disp.GCTimers[i].style.opacity = CM.Cache.goldenShimmersByID[i].l.style.opacity;
CM.Disp.GCTimers[i].style.transform = CM.Cache.goldenShimmersByID[i].l.style.transform; CM.Disp.GCTimers[i].style.transform = CM.Cache.goldenShimmersByID[i].l.style.transform;
@@ -351,7 +351,7 @@ CM.Main.CheckSeasonPopup = function() {
} }
} }
CM.Disp.Flash(3, 'SeaFlash'); CM.Disp.Flash(3, 'SeaFlash');
CM.Disp.PlaySound(CM.Config.SeaSoundURL, 'SeaSound', 'SeaVolume'); CM.Disp.PlaySound(CM.Options.SeaSoundURL, 'SeaSound', 'SeaVolume');
CM.Disp.Notification('SeaNotification',"Reindeer sighted!", "A Reindeer has spawned. Click it now!") CM.Disp.Notification('SeaNotification',"Reindeer sighted!", "A Reindeer has spawned. Click it now!")
} }
} }
@@ -365,7 +365,7 @@ CM.Main.CheckTickerFortune = function() {
CM.Main.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type == 'fortune'); CM.Main.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type == 'fortune');
if (CM.Main.lastTickerFortuneState) { if (CM.Main.lastTickerFortuneState) {
CM.Disp.Flash(3, 'FortuneFlash'); CM.Disp.Flash(3, 'FortuneFlash');
CM.Disp.PlaySound(CM.Config.FortuneSoundURL, 'FortuneSound', 'FortuneVolume'); CM.Disp.PlaySound(CM.Options.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
CM.Disp.Notification('FortuneNotification', "Fortune Cookie found", "A Fortune Cookie has appeared on the Ticker.") CM.Disp.Notification('FortuneNotification', "Fortune Cookie found", "A Fortune Cookie has appeared on the Ticker.")
} }
} }
@@ -379,7 +379,7 @@ CM.Main.CheckGardenTick = function() {
if (Game.Objects['Farm'].minigameLoaded && CM.Main.lastGardenNextStep != Game.Objects['Farm'].minigame.nextStep) { if (Game.Objects['Farm'].minigameLoaded && CM.Main.lastGardenNextStep != Game.Objects['Farm'].minigame.nextStep) {
if (CM.Main.lastGardenNextStep != 0 && CM.Main.lastGardenNextStep < Date.now()) { if (CM.Main.lastGardenNextStep != 0 && CM.Main.lastGardenNextStep < Date.now()) {
CM.Disp.Flash(3, 'GardFlash'); CM.Disp.Flash(3, 'GardFlash');
CM.Disp.PlaySound(CM.Config.GardSoundURL, 'GardSound', 'GardVolume'); CM.Disp.PlaySound(CM.Options.GardSoundURL, 'GardSound', 'GardVolume');
} }
CM.Main.lastGardenNextStep = Game.Objects['Farm'].minigame.nextStep; CM.Main.lastGardenNextStep = Game.Objects['Farm'].minigame.nextStep;
} }
@@ -390,13 +390,13 @@ CM.Main.CheckGardenTick = function() {
* It is called by CM.Loop * It is called by CM.Loop
*/ */
CM.Main.CheckMagicMeter = function() { CM.Main.CheckMagicMeter = function() {
if (Game.Objects['Wizard tower'].minigameLoaded && CM.Config.GrimoireBar == 1) { if (Game.Objects['Wizard tower'].minigameLoaded && CM.Options.GrimoireBar == 1) {
var minigame = Game.Objects['Wizard tower'].minigame; var minigame = Game.Objects['Wizard tower'].minigame;
if (minigame.magic < minigame.magicM) CM.Main.lastMagicBarFull = false; if (minigame.magic < minigame.magicM) CM.Main.lastMagicBarFull = false;
else if (!CM.Main.lastMagicBarFull) { else if (!CM.Main.lastMagicBarFull) {
CM.Main.lastMagicBarFull = true; CM.Main.lastMagicBarFull = true;
CM.Disp.Flash(3, 'MagicFlash'); CM.Disp.Flash(3, 'MagicFlash');
CM.Disp.PlaySound(CM.Config.MagicSoundURL, 'MagicSound', 'MagicVolume'); CM.Disp.PlaySound(CM.Options.MagicSoundURL, 'MagicSound', 'MagicVolume');
CM.Disp.Notification('MagicNotification', "Magic Meter full", "Your Magic Meter is full. Cast a spell!") CM.Disp.Notification('MagicNotification', "Magic Meter full", "Your Magic Meter is full. Cast a spell!")
} }
} }
@@ -414,17 +414,17 @@ CM.Main.CheckWrinklerCount = function() {
} }
if (CurrentWrinklers > CM.Main.lastWrinklerCount) { if (CurrentWrinklers > CM.Main.lastWrinklerCount) {
CM.Main.lastWrinklerCount = CurrentWrinklers CM.Main.lastWrinklerCount = CurrentWrinklers
if (CurrentWrinklers == Game.getWrinklersMax() && CM.Config.WrinklerMaxFlash) { if (CurrentWrinklers == Game.getWrinklersMax() && CM.Options.WrinklerMaxFlash) {
CM.Disp.Flash(3, 'WrinklerMaxFlash'); CM.Disp.Flash(3, 'WrinklerMaxFlash');
} else { } else {
CM.Disp.Flash(3, 'WrinklerFlash'); CM.Disp.Flash(3, 'WrinklerFlash');
} }
if (CurrentWrinklers == Game.getWrinklersMax() && CM.Config.WrinklerMaxSound) { if (CurrentWrinklers == Game.getWrinklersMax() && CM.Options.WrinklerMaxSound) {
CM.Disp.PlaySound(CM.Config.WrinklerMaxSoundURL, 'WrinklerMaxSound', 'WrinklerMaxVolume'); CM.Disp.PlaySound(CM.Options.WrinklerMaxSoundURL, 'WrinklerMaxSound', 'WrinklerMaxVolume');
} else { } else {
CM.Disp.PlaySound(CM.Config.WrinklerSoundURL, 'WrinklerSound', 'WrinklerVolume'); CM.Disp.PlaySound(CM.Options.WrinklerSoundURL, 'WrinklerSound', 'WrinklerVolume');
} }
if (CurrentWrinklers == Game.getWrinklersMax() && CM.Config.WrinklerMaxNotification) { if (CurrentWrinklers == Game.getWrinklersMax() && CM.Options.WrinklerMaxNotification) {
CM.Disp.Notification('WrinklerMaxNotification', "Maximum Wrinklers Reached", "You have reached your maximum ammount of wrinklers") CM.Disp.Notification('WrinklerMaxNotification', "Maximum Wrinklers Reached", "You have reached your maximum ammount of wrinklers")
} else { } else {
CM.Disp.Notification('WrinklerNotification', "A Wrinkler appeared", "A new wrinkler has appeared") CM.Disp.Notification('WrinklerNotification', "A Wrinkler appeared", "A new wrinkler has appeared")
@@ -461,7 +461,7 @@ CM.Main.AddWrinklerAreaDetect = function() {
* before execution of their actual function * before execution of their actual function
*/ */
CM.Main.FixMouseY = function(target) { CM.Main.FixMouseY = function(target) {
if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 0) { if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 0) {
var timerBarHeight = parseInt(CM.Disp.TimerBar.style.height); var timerBarHeight = parseInt(CM.Disp.TimerBar.style.height);
Game.mouseY -= timerBarHeight; Game.mouseY -= timerBarHeight;
target(); target();