ESLint compliant

This commit is contained in:
Daniel van Noord
2021-01-31 13:33:34 +01:00
parent 416637bac3
commit 2d9af222c1
6 changed files with 438 additions and 440 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -305,7 +305,7 @@ CM.Cache.CacheDragonCost = function() {
var target = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1]; var target = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1];
var amount = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/sacrifice\((.*?)\)/)[1]; var amount = Game.dragonLevels[Game.dragonLevel].buy.toString().match(/sacrifice\((.*?)\)/)[1];
if (target != "i") { if (target != "i") {
target = target.replaceAll("\'", ""); target = target.replaceAll("'", "");
if (Game.Objects[target].amount < amount) { if (Game.Objects[target].amount < amount) {
CM.Cache.CostDragonUpgrade = "Not enough buildings to sell"; CM.Cache.CostDragonUpgrade = "Not enough buildings to sell";
} }
@@ -671,4 +671,3 @@ CM.Cache.HadBuildAura = false;
CM.Cache.RealCookiesEarned = -1; CM.Cache.RealCookiesEarned = -1;
CM.Cache.goldenShimmersByID = {}; CM.Cache.goldenShimmersByID = {};
CM.Cache.spawnedGoldenShimmer = 0; CM.Cache.spawnedGoldenShimmer = 0;

View File

@@ -154,7 +154,7 @@ CM.ConfigData.GCNotification = {type: 'bool', group: 'NotificationGC', label: ['
CM.ConfigData.GCFlash = {type: 'bool', group: 'NotificationGC', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie', toggle: true}; CM.ConfigData.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.ConfigData.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.ConfigData.GCVolume = {type: 'vol', group: 'NotificationGC', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.GCVolume.label[i] = i + '%'; CM.ConfigData.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.ConfigData.GCSoundURL = {type: 'url', group: 'NotificationGC', label: 'Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns'};
@@ -162,7 +162,7 @@ CM.ConfigData.FortuneNotification = {type: 'bool', group: 'NotificationFC', labe
CM.ConfigData.FortuneFlash = {type: 'bool', group: 'NotificationFC', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Fortune Cookie', toggle: true}; CM.ConfigData.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.ConfigData.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.ConfigData.FortuneVolume = {type: 'vol', group: 'NotificationFC', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.FortuneVolume.label[i] = i + '%'; CM.ConfigData.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.ConfigData.FortuneSoundURL = {type: 'url', group: 'NotificationFC', label: 'Sound URL:', desc: 'URL of the sound to be played when the Ticker has a Fortune Cookie'};
@@ -170,14 +170,14 @@ CM.ConfigData.SeaNotification = {type: 'bool', group: 'NotificationSea', label:
CM.ConfigData.SeaFlash = {type: 'bool', group: 'NotificationSea', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Season Popup', toggle: true}; CM.ConfigData.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.ConfigData.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.ConfigData.SeaVolume = {type: 'vol', group: 'NotificationSea', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.SeaVolume.label[i] = i + '%'; CM.ConfigData.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.ConfigData.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.ConfigData.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.ConfigData.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.ConfigData.GardVolume = {type: 'vol', group: 'NotificationGard', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.GardVolume.label[i] = i + '%'; CM.ConfigData.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.ConfigData.GardSoundURL = {type: 'url', group: 'NotificationGard', label: 'Garden Tick Sound URL:', desc: 'URL of the sound to be played when the garden ticks'};
@@ -185,7 +185,7 @@ CM.ConfigData.MagicNotification = {type: 'bool', group: 'NotificationMagi', labe
CM.ConfigData.MagicFlash = {type: 'bool', group: 'NotificationMagi', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when magic reaches maximum', toggle: true}; CM.ConfigData.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.ConfigData.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.ConfigData.MagicVolume = {type: 'vol', group: 'NotificationMagi', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.MagicVolume.label[i] = i + '%'; CM.ConfigData.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.ConfigData.MagicSoundURL = {type: 'url', group: 'NotificationMagi', label: 'Sound URL:', desc: 'URL of the sound to be played when magic reaches maxium'};
@@ -193,7 +193,7 @@ CM.ConfigData.WrinklerNotification = {type: 'bool', group: 'NotificationWrink',
CM.ConfigData.WrinklerFlash = {type: 'bool', group: 'NotificationWrink', label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen when a Wrinkler appears', toggle: true}; CM.ConfigData.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.ConfigData.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.ConfigData.WrinklerVolume = {type: 'vol', group: 'NotificationWrink', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.WrinklerVolume.label[i] = i + '%'; CM.ConfigData.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.ConfigData.WrinklerSoundURL = {type: 'url', group: 'NotificationWrink', label: 'Sound URL:', desc: 'URL of the sound to be played when a Wrinkler appears'};
@@ -201,7 +201,7 @@ CM.ConfigData.WrinklerMaxNotification = {type: 'bool', group: 'NotificationWrink
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.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.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.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.ConfigData.WrinklerMaxVolume = {type: 'vol', group: 'NotificationWrinkMax', label: [], desc: 'Volume'}; CM.ConfigData.WrinklerMaxVolume = {type: 'vol', group: 'NotificationWrinkMax', label: [], desc: 'Volume'};
for (var i = 0; i < 101; i++) { for (let i = 0; i < 101; i++) {
CM.ConfigData.WrinklerMaxVolume.label[i] = i + '%'; CM.ConfigData.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.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'};

View File

@@ -137,7 +137,7 @@ CM.Disp.FormatTime = function(time, longFormat) {
var h = Math.floor(time % 86400 / 3600); var h = Math.floor(time % 86400 / 3600);
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 = ''; let str = '';
if (CM.Options.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 + ':';
@@ -424,11 +424,11 @@ CM.Disp.CreateBotBarBuildingColumn = function(buildingName) {
var pp = CM.Disp.BotBar.firstChild.firstChild.childNodes[2]; var pp = CM.Disp.BotBar.firstChild.firstChild.childNodes[2];
var time = CM.Disp.BotBar.firstChild.firstChild.childNodes[3]; var time = CM.Disp.BotBar.firstChild.firstChild.childNodes[3];
var i = buildingName; let i = buildingName;
var header = type.appendChild(document.createElement('td')); var header = type.appendChild(document.createElement('td'));
header.appendChild(document.createTextNode((i.indexOf(' ') != -1 ? i.substring(0, i.indexOf(' ')) : i) + ' (')); header.appendChild(document.createTextNode((i.indexOf(' ') != -1 ? i.substring(0, i.indexOf(' ')) : i) + ' ('));
var span = header.appendChild(document.createElement('span')); let span = header.appendChild(document.createElement('span'));
span.className = CM.Disp.colorTextPre + CM.Disp.colorBlue; span.className = CM.Disp.colorTextPre + CM.Disp.colorBlue;
header.appendChild(document.createTextNode(')')); header.appendChild(document.createTextNode(')'));
@@ -488,7 +488,7 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) {
timerBar.style.margin = '0px 10px'; timerBar.style.margin = '0px 10px';
timerBar.style.position = 'relative'; timerBar.style.position = 'relative';
var div = document.createElement('div'); let div = document.createElement('div');
div.style.width = '100%'; div.style.width = '100%';
div.style.height = '10px'; div.style.height = '10px';
div.style.margin = 'auto'; div.style.margin = 'auto';
@@ -508,7 +508,7 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) {
type.textContent = name; type.textContent = name;
div.appendChild(type); div.appendChild(type);
for (var i = 0; i < bars.length; i++) { for (let i = 0; i < bars.length; i++) {
var colorBar = document.createElement('span'); var colorBar = document.createElement('span');
colorBar.id = bars[i].id; colorBar.id = bars[i].id;
colorBar.style.display = 'inline-block'; colorBar.style.display = 'inline-block';
@@ -696,11 +696,10 @@ CM.Disp.UpdateBotTimerBarPosition = function() {
* And by changes in CM.Options.BuildColor, CM.Options.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 (Game.buyMode == 1) { let target = 'Objects';
var target = '';
if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10'; if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10';
else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100'; else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100';
else target = 'Objects'; if (Game.buyMode == 1) {
if (CM.Options.BuildColor == 1) { if (CM.Options.BuildColor == 1) {
for (let i of Object.keys(CM.Cache[target])) { for (let i of Object.keys(CM.Cache[target])) {
l('productPrice' + Game.Objects[i].id).style.color = CM.Options.Colors[CM.Cache[target][i].color]; l('productPrice' + Game.Objects[i].id).style.color = CM.Options.Colors[CM.Cache[target][i].color];
@@ -731,7 +730,7 @@ CM.Disp.UpdateBuildings = function() {
// (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.Options.SortBuildings) { if (Game.buyMode == 1 && CM.Options.SortBuildings) {
var arr = Object.keys(CM.Cache[target]).map(k => let arr = Object.keys(CM.Cache[target]).map(k =>
{ {
var o = CM.Cache[target][k]; var o = CM.Cache[target][k];
o.name = k; o.name = k;
@@ -741,11 +740,11 @@ CM.Disp.UpdateBuildings = function() {
arr.sort(function(a, b){ return (a.pp > b.pp ? 1 : (a.pp < b.pp ? -1 : 0)); }); arr.sort(function(a, b){ return (a.pp > b.pp ? 1 : (a.pp < b.pp ? -1 : 0)); });
for (var x = 0; x < arr.length; x++) { for (let x = 0; x < arr.length; x++) {
Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2); Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2);
} }
} else { } else {
var arr = Object.keys(CM.Cache.Objects).map(k => let arr = Object.keys(CM.Cache.Objects).map(k =>
{ {
var o = CM.Cache.Objects[k]; var o = CM.Cache.Objects[k];
o.name = k; o.name = k;
@@ -753,7 +752,7 @@ CM.Disp.UpdateBuildings = function() {
return o; return o;
}); });
arr.sort((a, b) => a.id - b.id); arr.sort((a, b) => a.id - b.id);
for (var x = 0; x < arr.length; x++) { for (let x = 0; x < arr.length; x++) {
Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2); Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2);
} }
} }
@@ -779,7 +778,7 @@ CM.Disp.UpdateUpgrades = function() {
for (let i of Object.keys(Game.UpgradesInStore)) { for (let i of Object.keys(Game.UpgradesInStore)) {
var me = Game.UpgradesInStore[i]; var me = Game.UpgradesInStore[i];
var addedColor = false; var addedColor = false;
for (var j = 0; j < l('upgrade' + i).childNodes.length; j++) { for (let j = 0; j < l('upgrade' + i).childNodes.length; j++) {
if (l('upgrade' + i).childNodes[j].className.indexOf(CM.Disp.colorBackPre) != -1) { if (l('upgrade' + i).childNodes[j].className.indexOf(CM.Disp.colorBackPre) != -1) {
l('upgrade' + i).childNodes[j].className = CM.Disp.colorBackPre + CM.Cache.Upgrades[me.name].color; l('upgrade' + i).childNodes[j].className = CM.Disp.colorBackPre + CM.Cache.Upgrades[me.name].color;
addedColor = true; addedColor = true;
@@ -787,7 +786,7 @@ CM.Disp.UpdateUpgrades = function() {
} }
} }
if (!addedColor) { if (!addedColor) {
var div = document.createElement('div'); let div = document.createElement('div');
div.style.width = '10px'; div.style.width = '10px';
div.style.height = '10px'; div.style.height = '10px';
div.className = CM.Disp.colorBackPre + CM.Cache.Upgrades[me.name].color; div.className = CM.Disp.colorBackPre + CM.Cache.Upgrades[me.name].color;
@@ -813,8 +812,8 @@ CM.Disp.UpdateUpgrades = function() {
// Build array of pointers, sort by pp, set flex positions // Build array of pointers, sort by pp, set flex positions
// This regulates sorting of upgrades // This regulates sorting of upgrades
var arr = []; let arr = [];
for (var x = 0; x < Game.UpgradesInStore.length; x++){ for (let x = 0; x < Game.UpgradesInStore.length; x++){
var o = {}; var o = {};
o.name = Game.UpgradesInStore[x].name; o.name = Game.UpgradesInStore[x].name;
o.price = Game.UpgradesInStore[x].basePrice; o.price = Game.UpgradesInStore[x].basePrice;
@@ -829,8 +828,11 @@ CM.Disp.UpdateUpgrades = function() {
arr.sort((a, b) => a.price - b.price); arr.sort((a, b) => a.price - b.price);
} }
for (var x = 0; x < Game.UpgradesInStore.length; x++){ let nameChecker = function(arr, upgrade) {
l("upgrade" + x).style.order = arr.findIndex(e => e.name === Game.UpgradesInStore[x].name) + 1; return arr.findIndex(e => e.name === upgrade.name);
};
for (let x = 0; x < Game.UpgradesInStore.length; x++){
l("upgrade" + x).style.order = nameChecker(arr, Game.UpgradesInStore[x]) + 1;
} }
}; };
@@ -890,7 +892,7 @@ CM.Disp.CreateUpgradeBar = function() {
CM.Disp.UpgradeBar.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');}; CM.Disp.UpgradeBar.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');};
var upgradeNumber = function(id, color) { var upgradeNumber = function(id, color) {
var span = document.createElement('span'); let span = document.createElement('span');
span.id = id; span.id = id;
span.className = CM.Disp.colorTextPre + color; span.className = CM.Disp.colorTextPre + color;
span.style.width = '14.28571428571429%'; span.style.width = '14.28571428571429%';
@@ -917,16 +919,16 @@ CM.Disp.CreateUpgradeBarLegend = function() {
var legend = document.createElement('div'); var legend = document.createElement('div');
legend.style.minWidth = '330px'; legend.style.minWidth = '330px';
legend.style.marginBottom = '4px'; legend.style.marginBottom = '4px';
var title = document.createElement('div'); let title = document.createElement('div');
title.className = 'name'; title.className = 'name';
title.style.marginBottom = '4px'; title.style.marginBottom = '4px';
title.textContent = 'Legend'; title.textContent = 'Legend';
legend.appendChild(title); legend.appendChild(title);
var legendLine = function(color, text) { var legendLine = function(color, text) {
var div = document.createElement('div'); let div = document.createElement('div');
div.style.verticalAlign = 'middle'; div.style.verticalAlign = 'middle';
var span = document.createElement('span'); let span = document.createElement('span');
span.className = CM.Disp.colorBackPre + color; span.className = CM.Disp.colorBackPre + color;
span.style.display = 'inline-block'; span.style.display = 'inline-block';
span.style.height = '10px'; span.style.height = '10px';
@@ -975,7 +977,7 @@ CM.Disp.CreateWhiteScreen = function() {
*/ */
CM.Disp.Flash = function(mode, config) { CM.Disp.Flash = function(mode, config) {
// The arguments check makes the sound not play upon initialization of the mod // The arguments check makes the sound not play upon initialization of the mod
if ((CM.Options[config] == 1 && mode == 3 && arguments.callee.caller.caller.caller.caller == null) || mode == 1) { if ((CM.Options[config] == 1 && mode == 3 && CM.Disp.Flash.caller.caller.caller.caller == null) || 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';
@@ -1001,7 +1003,7 @@ CM.Disp.Flash = function(mode, config) {
*/ */
CM.Disp.PlaySound = function(url, sndConfig, volConfig) { CM.Disp.PlaySound = function(url, sndConfig, volConfig) {
// The arguments check makes the sound not play upon initialization of the mod // The arguments check makes the sound not play upon initialization of the mod
if (CM.Options[sndConfig] == 1 && arguments.callee.caller.caller.caller.caller == null) { if (CM.Options[sndConfig] == 1 && CM.Disp.PlaySound.caller.caller.caller.caller == null) {
var sound = new realAudio(url); var sound = new realAudio(url);
sound.volume = (CM.Options[volConfig] / 100) * (Game.volume / 100); sound.volume = (CM.Options[volConfig] / 100) * (Game.volume / 100);
sound.play(); sound.play();
@@ -1017,7 +1019,7 @@ CM.Disp.PlaySound = function(url, sndConfig, volConfig) {
*/ */
CM.Disp.Notification = function(notifyConfig, title, message) { CM.Disp.Notification = function(notifyConfig, title, message) {
// The arguments check makes the sound not play upon initialization of the mod // The arguments check makes the sound not play upon initialization of the mod
if (CM.Options[notifyConfig] == 1 && document.visibilityState == 'hidden' && arguments.callee.caller.caller.caller.caller == null) { if (CM.Options[notifyConfig] == 1 && document.visibilityState == 'hidden' && CM.Disp.Notification.caller.caller.caller.caller == null) {
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});
} }
@@ -1059,11 +1061,11 @@ CM.Disp.UpdateTitle = function() {
document.title = CM.Cache.Title; document.title = CM.Cache.Title;
} }
else if (CM.Options.Title == 1) { else if (CM.Options.Title == 1) {
var addFC = false; let addFC = false;
var addSP = false; let addSP = false;
var titleGC; let titleGC;
var titleFC; let titleFC;
var titleSP; let titleSP;
if (CM.Cache.spawnedGoldenShimmer) { if (CM.Cache.spawnedGoldenShimmer) {
if (CM.Cache.spawnedGoldenShimmer.wrath) titleGC = '[W ' + Math.ceil(CM.Cache.spawnedGoldenShimmer.life / Game.fps) + ']'; if (CM.Cache.spawnedGoldenShimmer.wrath) titleGC = '[W ' + Math.ceil(CM.Cache.spawnedGoldenShimmer.life / Game.fps) + ']';
@@ -1088,15 +1090,15 @@ CM.Disp.UpdateTitle = function() {
} }
// Remove previous timers and add current cookies // Remove previous timers and add current cookies
var str = CM.Cache.Title; let str = CM.Cache.Title;
if (str.charAt(0) == '[') { if (str.charAt(0) == '[') {
str = str.substring(str.lastIndexOf(']') + 1); str = str.substring(str.lastIndexOf(']') + 1);
} }
document.title = titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '') + ' ' + str; document.title = titleGC + (addFC ? titleFC : '') + (addSP ? titleSP : '') + ' ' + str;
} }
else if (CM.Options.Title == 2) { else if (CM.Options.Title == 2) {
var str = ''; let str = '';
var spawn = false; let spawn = false;
if (CM.Cache.spawnedGoldenShimmer) { if (CM.Cache.spawnedGoldenShimmer) {
spawn = true; spawn = true;
if (CM.Cache.spawnedGoldenShimmer.wrath) str += '[W ' + Math.ceil(CM.Cache.spawnedGoldenShimmer.life / Game.fps) + ']'; if (CM.Cache.spawnedGoldenShimmer.wrath) str += '[W ' + Math.ceil(CM.Cache.spawnedGoldenShimmer.life / Game.fps) + ']';
@@ -1111,7 +1113,7 @@ CM.Disp.UpdateTitle = function() {
spawn = true; spawn = true;
} }
if (spawn) str += ' - '; if (spawn) str += ' - ';
var title = 'Cookie Clicker'; let title = 'Cookie Clicker';
if (Game.season == 'fools') title = 'Cookie Baker'; if (Game.season == 'fools') title = 'Cookie Baker';
str += title; str += title;
document.title = str; document.title = str;
@@ -1135,7 +1137,7 @@ CM.Disp.CreateGCTimer = function(cookie) {
GCTimer.style.zIndex = '10000000001'; GCTimer.style.zIndex = '10000000001';
GCTimer.style.textAlign = 'center'; GCTimer.style.textAlign = 'center';
GCTimer.style.lineHeight = '96px'; GCTimer.style.lineHeight = '96px';
GCTimer.style.fontFamily = '\"Kavoon\", Georgia, serif'; GCTimer.style.fontFamily = '"Kavoon", Georgia, serif';
GCTimer.style.fontSize = '35px'; GCTimer.style.fontSize = '35px';
GCTimer.style.cursor = 'pointer'; GCTimer.style.cursor = 'pointer';
GCTimer.style.display = 'block'; GCTimer.style.display = 'block';
@@ -1183,7 +1185,7 @@ CM.Disp.CreateSimpleTooltip = function(placeholder, text, minWidth) {
var desc = document.createElement('div'); var desc = document.createElement('div');
desc.style.minWidth = minWidth; desc.style.minWidth = minWidth;
desc.style.marginBottom = '4px'; desc.style.marginBottom = '4px';
var div = document.createElement('div'); let div = document.createElement('div');
div.style.textAlign = 'left'; div.style.textAlign = 'left';
div.textContent = text; div.textContent = text;
desc.appendChild(div); desc.appendChild(div);
@@ -1198,10 +1200,9 @@ CM.Disp.CreateSimpleTooltip = function(placeholder, text, minWidth) {
CM.Disp.ReplaceTooltipUpgrade = function() { CM.Disp.ReplaceTooltipUpgrade = function() {
CM.Disp.TooltipUpgradeBackup = []; CM.Disp.TooltipUpgradeBackup = [];
for (let i of Object.keys(Game.UpgradesInStore)) { for (let i of Object.keys(Game.UpgradesInStore)) {
var me = Game.UpgradesInStore[i];
if (l('upgrade' + i).onmouseover != null) { if (l('upgrade' + i).onmouseover != null) {
CM.Disp.TooltipUpgradeBackup[i] = l('upgrade' + i).onmouseover; CM.Disp.TooltipUpgradeBackup[i] = l('upgrade' + i).onmouseover;
eval('l(\'upgrade\' + i).onmouseover = function() {if (!Game.mouseDown) {Game.setOnCrate(this); Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'u\', \'' + i + '\');}, \'store\'); Game.tooltip.wobble();}}'); l('upgrade' + i).onmouseover = function() {if (!Game.mouseDown) {Game.setOnCrate(this); Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('u', `${i}`);}, 'store'); Game.tooltip.wobble();}};
} }
} }
}; };
@@ -1286,7 +1287,7 @@ CM.Disp.TooltipCreateTooltipBox = function() {
* @returns {object} div An object containing the stylized header * @returns {object} div An object containing the stylized header
*/ */
CM.Disp.TooltipCreateHeader = function(text) { CM.Disp.TooltipCreateHeader = function(text) {
var div = document.createElement('div'); let div = document.createElement('div');
div.style.fontWeight = 'bold'; div.style.fontWeight = 'bold';
div.className = CM.Disp.colorTextPre + CM.Disp.colorBlue; div.className = CM.Disp.colorTextPre + CM.Disp.colorBlue;
div.textContent = text; div.textContent = text;
@@ -1301,7 +1302,7 @@ CM.Disp.TooltipCreateHeader = function(text) {
*/ */
CM.Disp.TooltipCreateCalculationSection = function(tooltip) { CM.Disp.TooltipCreateCalculationSection = function(tooltip) {
tooltip.appendChild(CM.Disp.TooltipCreateHeader('Bonus Income')); tooltip.appendChild(CM.Disp.TooltipCreateHeader('Bonus Income'));
var income = document.createElement('div'); let income = document.createElement('div');
income.style.marginBottom = '4px'; income.style.marginBottom = '4px';
income.style.color = 'white'; income.style.color = 'white';
income.id = 'CMTooltipIncome'; income.id = 'CMTooltipIncome';
@@ -1448,7 +1449,7 @@ CM.Disp.UpdateTooltipBuilding = function() {
if (CM.Options.TooltipBuildUpgrade == 1 && Game.buyMode == 1) { if (CM.Options.TooltipBuildUpgrade == 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); let increase = Math.round(CM.Disp.TooltipBonusIncome / Game.cookiesPs * 10000);
if (isFinite(increase) && increase != 0) { if (isFinite(increase) && increase != 0) {
l('CMTooltipIncome').textContent += ' (' + (increase / 100) + '% of income)'; l('CMTooltipIncome').textContent += ' (' + (increase / 100) + '% of income)';
} }
@@ -1465,21 +1466,18 @@ CM.Disp.UpdateTooltipBuilding = function() {
} }
// Add "production left till next achievement"-bar // Add "production left till next achievement"-bar
l('CMTooltipProductionHeader').style.display = "none";
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 (!CM.Sim.HasAchiev(Game.Objects[CM.Disp.tooltipName].productionAchievs[i].achiev.name)) {
var nextProductionAchiev = Game.Objects[CM.Disp.tooltipName].productionAchievs[i]; let nextProductionAchiev = Game.Objects[CM.Disp.tooltipName].productionAchievs[i];
break;
}
}
if (typeof nextProductionAchiev != "undefined") {
l('CMTooltipTime').style.marginBottom = '4px'; l('CMTooltipTime').style.marginBottom = '4px';
l('CMTooltipProductionHeader').style.display = ""; l('CMTooltipProductionHeader').style.display = "";
l('CMTooltipProduction').className = "ProdAchievement" + CM.Disp.tooltipName; l('CMTooltipProduction').className = "ProdAchievement" + CM.Disp.tooltipName;
l('CMTooltipProduction').textContent = Beautify(nextProductionAchiev.pow - CM.Sim.Objects[CM.Disp.tooltipName].totalCookies, 15); l('CMTooltipProduction').textContent = Beautify(nextProductionAchiev.pow - CM.Sim.Objects[CM.Disp.tooltipName].totalCookies, 15);
l('CMTooltipProduction').style.color = "white"; l('CMTooltipProduction').style.color = "white";
} else { break;
l('CMTooltipProductionHeader').style.display = "none"; }
l('CMTooltipTime').style.marginBottom = '0px';
} }
} }
else l('CMTooltipArea').style.display = "none"; else l('CMTooltipArea').style.display = "none";
@@ -1499,7 +1497,7 @@ CM.Disp.UpdateTooltipUpgrade = function() {
if (CM.Options.TooltipBuildUpgrade == 1) { if (CM.Options.TooltipBuildUpgrade == 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); let increase = Math.round(CM.Disp.TooltipBonusIncome / Game.cookiesPs * 10000);
if (isFinite(increase) && increase != 0) { if (isFinite(increase) && increase != 0) {
l('CMTooltipIncome').textContent += ' (' + (increase / 100) + '% of income)'; l('CMTooltipIncome').textContent += ' (' + (increase / 100) + '% of income)';
} }
@@ -1654,13 +1652,14 @@ CM.Disp.UpdateTooltipGardenPlots = function() {
* It adds to the additional information to l('CMTooltipArea') * It adds to the additional information to l('CMTooltipArea')
*/ */
CM.Disp.UpdateTooltipHarvestAll = function() { CM.Disp.UpdateTooltipHarvestAll = function() {
var minigame = Game.Objects.Farm.minigame; let minigame = Game.Objects.Farm.minigame;
if (CM.Options.TooltipLump) { if (CM.Options.TooltipLump) {
l('CMTooltipBorder').appendChild(CM.Disp.TooltipCreateHeader('Cookies gained from harvesting:')); l('CMTooltipBorder').appendChild(CM.Disp.TooltipCreateHeader('Cookies gained from harvesting:'));
var totalGain = 0; let totalGain = 0;
if (Game.keys[16] && Game.keys[17]) var mortal = 1; let mortal = 0;
for (var y=0;y<6;y++) { if (Game.keys[16] && Game.keys[17]) mortal = 1;
for (var x=0;x<6;x++) { for (let y=0;y<6;y++) {
for (let x=0; x<6; x++) {
if (minigame.plot[y][x][0]>=1) { if (minigame.plot[y][x][0]>=1) {
let tile = minigame.plot[y][x]; let tile = minigame.plot[y][x];
let me = minigame.plantsById[tile[0] - 1]; let me = minigame.plantsById[tile[0] - 1];
@@ -1819,7 +1818,7 @@ CM.Disp.CheckWrinklerTooltip = function() {
var wrinkler = document.createElement('div'); var wrinkler = document.createElement('div');
wrinkler.style.minWidth = '120px'; wrinkler.style.minWidth = '120px';
wrinkler.style.marginBottom = '4px'; wrinkler.style.marginBottom = '4px';
var div = document.createElement('div'); let div = document.createElement('div');
div.style.textAlign = 'center'; div.style.textAlign = 'center';
div.id = 'CMTooltipWrinkler'; div.id = 'CMTooltipWrinkler';
wrinkler.appendChild(div); wrinkler.appendChild(div);
@@ -1881,12 +1880,12 @@ CM.Disp.AddAuraInfo = function(aura) {
l('dragonAuraInfo').style.minHeight = "60px"; l('dragonAuraInfo').style.minHeight = "60px";
l('dragonAuraInfo').style.margin = "8px"; l('dragonAuraInfo').style.margin = "8px";
l('dragonAuraInfo').appendChild(document.createElement("div")).className = "line"; l('dragonAuraInfo').appendChild(document.createElement("div")).className = "line";
var div = document.createElement("div"); let div = document.createElement("div");
div.style.minWidth = "200px"; div.style.minWidth = "200px";
div.style.textAlign = "center"; div.style.textAlign = "center";
div.textContent = "Picking this aura will change CPS by " + bonusCPS + " (" + bonusCPSPercentage + "% of current CPS)."; div.textContent = "Picking this aura will change CPS by " + bonusCPS + " (" + bonusCPSPercentage + "% of current CPS).";
l('dragonAuraInfo').appendChild(div); l('dragonAuraInfo').appendChild(div);
var div2 = document.createElement("div"); let div2 = document.createElement("div");
div2.style.minWidth = "200px"; div2.style.minWidth = "200px";
div2.style.textAlign = "center"; div2.style.textAlign = "center";
div2.textContent = "It will take " + timeToRecover + " to recover the cost."; div2.textContent = "It will take " + timeToRecover + " to recover the cost.";
@@ -1918,8 +1917,8 @@ CM.Disp.AddDragonLevelUpTooltip = function() {
* It is called by Game.UpdateMenu() * It is called by Game.UpdateMenu()
*/ */
CM.Disp.AddMenu = function() { CM.Disp.AddMenu = function() {
var title = function() { let title = function() {
var div = document.createElement('div'); let div = document.createElement('div');
div.className = 'title ' + CM.Disp.colorTextPre + CM.Disp.colorBlue; div.className = 'title ' + CM.Disp.colorTextPre + CM.Disp.colorBlue;
div.textContent = 'Cookie Monster Goodies'; div.textContent = 'Cookie Monster Goodies';
return div; return div;
@@ -2000,13 +1999,13 @@ CM.Disp.AddMenuPref = function(title) {
* @returns {object} div The header object * @returns {object} div The header object
*/ */
CM.Disp.CreatePrefHeader = function(config, text) { CM.Disp.CreatePrefHeader = function(config, text) {
var div = document.createElement('div'); let 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 + ' '));
var span = document.createElement('span'); // Creates the +/- button let span = document.createElement('span'); // Creates the +/- button
span.style.cursor = 'pointer'; span.style.cursor = 'pointer';
span.style.display = 'inline-block'; span.style.display = 'inline-block';
span.style.height = '14px'; span.style.height = '14px';
@@ -2031,9 +2030,9 @@ CM.Disp.CreatePrefHeader = function(config, text) {
*/ */
CM.Disp.CreatePrefOption = function(config) { CM.Disp.CreatePrefOption = function(config) {
if (CM.ConfigData[config].type == "bool") { if (CM.ConfigData[config].type == "bool") {
var div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
var a = document.createElement('a'); let a = document.createElement('a');
if (CM.ConfigData[config].toggle && CM.Options[config] == 0) { if (CM.ConfigData[config].toggle && CM.Options[config] == 0) {
a.className = 'option off'; a.className = 'option off';
} }
@@ -2044,21 +2043,21 @@ CM.Disp.CreatePrefOption = function(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.ConfigData[config].label[CM.Options[config]];
div.appendChild(a); div.appendChild(a);
var label = document.createElement('label'); let label = document.createElement('label');
label.textContent = CM.ConfigData[config].desc; label.textContent = CM.ConfigData[config].desc;
div.appendChild(label); div.appendChild(label);
return div; return div;
} }
else if (CM.ConfigData[config].type == "vol") { else if (CM.ConfigData[config].type == "vol") {
var 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';
var 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.ConfigData[config].desc;
volume.appendChild(title); volume.appendChild(title);
var percent = title = document.createElement('div'); var percent = document.createElement('div');
percent.id = "slider" + config + "right"; percent.id = "slider" + config + "right";
percent.style.float = "right"; percent.style.float = "right";
percent.innerHTML = CM.Options[config] + "%"; percent.innerHTML = CM.Options[config] + "%";
@@ -2079,13 +2078,13 @@ CM.Disp.CreatePrefOption = function(config) {
return div; return div;
} }
else if (CM.ConfigData[config].type == "url") { else if (CM.ConfigData[config].type == "url") {
var div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
var span = document.createElement('span'); let span = document.createElement('span');
span.className = 'option'; span.className = 'option';
span.textContent = CM.ConfigData[config].label + ' '; span.textContent = CM.ConfigData[config].label + ' ';
div.appendChild(span); div.appendChild(span);
var input = document.createElement('input'); let input = document.createElement('input');
input.id = CM.ConfigPrefix + config; input.id = CM.ConfigPrefix + config;
input.className = 'option'; input.className = 'option';
input.type = 'text'; input.type = 'text';
@@ -2094,34 +2093,34 @@ CM.Disp.CreatePrefOption = function(config) {
input.style.width = '300px'; input.style.width = '300px';
div.appendChild(input); div.appendChild(input);
div.appendChild(document.createTextNode(' ')); div.appendChild(document.createTextNode(' '));
var inputPrompt = document.createElement('input'); let inputPrompt = document.createElement('input');
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.Options[config]); inputPrompt.setAttribute('value', CM.Options[config]);
var a = document.createElement('a'); let a = document.createElement('a');
a.className = 'option'; a.className = 'option';
a.onclick = function() {Game.Prompt(inputPrompt.outerHTML, [['Save', 'CM.Options[\'' + config + '\'] = l(CM.ConfigPrefix + \'' + config + '\' + \'Prompt\').value; CM.Config.SaveConfig(); Game.ClosePrompt(); Game.UpdateMenu();'], 'Cancel']);}; a.onclick = function() {Game.Prompt(inputPrompt.outerHTML, [['Save', 'CM.Options[\'' + config + '\'] = l(CM.ConfigPrefix + \'' + config + '\' + \'Prompt\').value; CM.Config.SaveConfig(); Game.ClosePrompt(); Game.UpdateMenu();'], 'Cancel']);};
a.textContent = 'Edit'; a.textContent = 'Edit';
div.appendChild(a); div.appendChild(a);
var label = document.createElement('label'); let label = document.createElement('label');
label.textContent = CM.ConfigData[config].desc; label.textContent = CM.ConfigData[config].desc;
div.appendChild(label); div.appendChild(label);
return div; return div;
} }
else if (CM.ConfigData[config].type == "color") { else if (CM.ConfigData[config].type == "color") {
var div = document.createElement('div'); let div = document.createElement('div');
for (var i = 0; i < CM.Disp.colors.length; i++) { for (let i = 0; i < CM.Disp.colors.length; i++) {
var innerDiv = document.createElement('div'); let innerDiv = document.createElement('div');
innerDiv.className = 'listing'; innerDiv.className = 'listing';
var input = document.createElement('input'); let input = document.createElement('input');
input.id = CM.Disp.colors[i]; input.id = CM.Disp.colors[i];
input.style.width = '65px'; input.style.width = '65px';
input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]); input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]);
innerDiv.appendChild(input); innerDiv.appendChild(input);
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();};
let picker = new JSColor(input, {hash: true, position: "right", onInput: change}); let = new JSColor(input, {hash: true, position: "right", onInput: change});
var label = document.createElement('label'); let label = document.createElement('label');
label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]]; label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]];
innerDiv.appendChild(label); innerDiv.appendChild(label);
div.appendChild(innerDiv); div.appendChild(innerDiv);
@@ -2129,13 +2128,13 @@ CM.Disp.CreatePrefOption = function(config) {
return div; return div;
} }
else if (CM.ConfigData[config].type == "numscale") { else if (CM.ConfigData[config].type == "numscale") {
var div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
var span = document.createElement('span'); let span = document.createElement('span');
span.className = 'option'; span.className = 'option';
span.textContent = CM.ConfigData[config].label + ' '; span.textContent = CM.ConfigData[config].label + ' ';
div.appendChild(span); div.appendChild(span);
var input = document.createElement('input'); let input = document.createElement('input');
input.id = CM.ConfigPrefix + config; input.id = CM.ConfigPrefix + config;
input.className = 'option'; input.className = 'option';
input.type = 'number'; input.type = 'number';
@@ -2149,7 +2148,7 @@ CM.Disp.CreatePrefOption = function(config) {
}; };
div.appendChild(input); div.appendChild(input);
div.appendChild(document.createTextNode(' ')); div.appendChild(document.createTextNode(' '));
var label = document.createElement('label'); let label = document.createElement('label');
label.textContent = CM.ConfigData[config].desc; label.textContent = CM.ConfigData[config].desc;
div.appendChild(label); div.appendChild(label);
return div; return div;
@@ -2184,14 +2183,14 @@ CM.Disp.RefreshScale = function() {
* The function is therefore called by a change in CM.Options.Colors * The function is therefore called by a change in CM.Options.Colors
*/ */
CM.Disp.UpdateColors = function() { CM.Disp.UpdateColors = function() {
var str = ''; let str = '';
for (var i = 0; i < CM.Disp.colors.length; i++) { for (let i = 0; i < CM.Disp.colors.length; i++) {
str += '.' + CM.Disp.colorTextPre + CM.Disp.colors[i] + ' { color: ' + CM.Options.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 (let i = 0; i < CM.Disp.colors.length; i++) {
str += '.' + CM.Disp.colorBackPre + CM.Disp.colors[i] + ' { background-color: ' + CM.Options.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 (let i = 0; i < CM.Disp.colors.length; i++) {
str += '.' + CM.Disp.colorBorderPre + CM.Disp.colors[i] + ' { border: 1px solid ' + CM.Options.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;
@@ -2360,14 +2359,14 @@ CM.Disp.AddMenuStats = function(title) {
* @returns {object} div The header object * @returns {object} div The header object
*/ */
CM.Disp.CreateStatsHeader = function(text, config) { CM.Disp.CreateStatsHeader = function(text, config) {
var div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
div.style.padding = '5px 16px'; div.style.padding = '5px 16px';
div.style.opacity = '0.7'; div.style.opacity = '0.7';
div.style.fontSize = '17px'; div.style.fontSize = '17px';
div.style.fontFamily = '\"Kavoon\", Georgia, serif'; div.style.fontFamily = '"Kavoon", Georgia, serif';
div.appendChild(document.createTextNode(text + ' ')); div.appendChild(document.createTextNode(text + ' '));
var span = document.createElement('span'); let span = document.createElement('span');
span.style.cursor = 'pointer'; span.style.cursor = 'pointer';
span.style.display = 'inline-block'; span.style.display = 'inline-block';
span.style.height = '14px'; span.style.height = '14px';
@@ -2394,7 +2393,7 @@ CM.Disp.CreateStatsHeader = function(text, config) {
* @returns {object} div The option object * @returns {object} div The option object
*/ */
CM.Disp.CreateStatsListing = function(type, name, text, placeholder) { CM.Disp.CreateStatsListing = function(type, name, text, placeholder) {
var div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
var listingName = document.createElement('b'); var listingName = document.createElement('b');
@@ -2433,20 +2432,20 @@ CM.Disp.CreateStatsListing = function(type, name, text, placeholder) {
CM.Disp.CreateStatsMissDisp = function(theMissDisp) { CM.Disp.CreateStatsMissDisp = function(theMissDisp) {
var frag = document.createDocumentFragment(); var frag = document.createDocumentFragment();
frag.appendChild(document.createTextNode(theMissDisp.length + ' ')); frag.appendChild(document.createTextNode(theMissDisp.length + ' '));
var span = document.createElement('span'); let span = document.createElement('span');
span.onmouseout = function() { Game.tooltip.hide(); }; span.onmouseout = function() { Game.tooltip.hide(); };
var placeholder = document.createElement('div'); var placeholder = document.createElement('div');
var missing = document.createElement('div'); var missing = document.createElement('div');
missing.style.minWidth = '140px'; missing.style.minWidth = '140px';
missing.style.marginBottom = '4px'; missing.style.marginBottom = '4px';
var title = document.createElement('div'); let title = document.createElement('div');
title.className = 'name'; title.className = 'name';
title.style.marginBottom = '4px'; title.style.marginBottom = '4px';
title.style.textAlign = 'center'; title.style.textAlign = 'center';
title.textContent = 'Missing'; title.textContent = 'Missing';
missing.appendChild(title); missing.appendChild(title);
for (let i of Object.keys(theMissDisp)) { for (let i of Object.keys(theMissDisp)) {
var div = document.createElement('div'); let div = document.createElement('div');
div.style.textAlign = 'center'; div.style.textAlign = 'center';
div.appendChild(document.createTextNode(theMissDisp[i])); div.appendChild(document.createTextNode(theMissDisp[i]));
missing.appendChild(div); missing.appendChild(div);
@@ -2492,7 +2491,7 @@ CM.Disp.CreateStatsLuckySection = function() {
luckyReqSmall.textContent = ' (' + luckyTime + ')'; luckyReqSmall.textContent = ' (' + luckyTime + ')';
luckyReqFrag.appendChild(luckyReqSmall); luckyReqFrag.appendChild(luckyReqSmall);
} }
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Lucky!\" Cookies Required', luckyReqFrag, goldCookTooltip)); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Lucky!" Cookies Required', luckyReqFrag, goldCookTooltip));
var luckyColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.LuckyFrenzy) ? CM.Disp.colorRed : CM.Disp.colorGreen; var luckyColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.LuckyFrenzy) ? CM.Disp.colorRed : CM.Disp.colorGreen;
@@ -2508,7 +2507,7 @@ CM.Disp.CreateStatsLuckySection = function() {
luckyReqFrenSmall.textContent = ' (' + luckyTimeFrenzy + ')'; luckyReqFrenSmall.textContent = ' (' + luckyTimeFrenzy + ')';
luckyReqFrenFrag.appendChild(luckyReqFrenSmall); luckyReqFrenFrag.appendChild(luckyReqFrenSmall);
} }
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Lucky!\" Cookies Required (Frenzy)', luckyReqFrenFrag, goldCookTooltip)); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Lucky!" Cookies Required (Frenzy)', luckyReqFrenFrag, goldCookTooltip));
var luckySplit = CM.Cache.LuckyReward != CM.Cache.LuckyWrathReward; var luckySplit = CM.Cache.LuckyReward != CM.Cache.LuckyWrathReward;
@@ -2516,20 +2515,20 @@ CM.Disp.CreateStatsLuckySection = function() {
luckyRewardMaxSpan.style.fontWeight = 'bold'; luckyRewardMaxSpan.style.fontWeight = 'bold';
luckyRewardMaxSpan.className = CM.Disp.colorTextPre + CM.Cache.LuckyReward; luckyRewardMaxSpan.className = CM.Disp.colorTextPre + CM.Cache.LuckyReward;
luckyRewardMaxSpan.textContent = Beautify(CM.Cache.LuckyReward) + (luckySplit ? (' / ' + Beautify(CM.Cache.LuckyWrathReward)) : ''); luckyRewardMaxSpan.textContent = Beautify(CM.Cache.LuckyReward) + (luckySplit ? (' / ' + Beautify(CM.Cache.LuckyWrathReward)) : '');
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Lucky!\" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : ''), luckyRewardMaxSpan, goldCookTooltip)); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Lucky!" Reward (MAX)' + (luckySplit ? ' (Golden / Wrath)' : ''), luckyRewardMaxSpan, goldCookTooltip));
var luckyRewardFrenzyMaxSpan = document.createElement('span'); var luckyRewardFrenzyMaxSpan = document.createElement('span');
luckyRewardFrenzyMaxSpan.style.fontWeight = 'bold'; luckyRewardFrenzyMaxSpan.style.fontWeight = 'bold';
luckyRewardFrenzyMaxSpan.className = CM.Disp.colorTextPre + luckyRewardFrenzyMaxSpan; luckyRewardFrenzyMaxSpan.className = CM.Disp.colorTextPre + luckyRewardFrenzyMaxSpan;
luckyRewardFrenzyMaxSpan.textContent = Beautify(CM.Cache.LuckyRewardFrenzy) + (luckySplit ? (' / ' + Beautify(CM.Cache.LuckyWrathRewardFrenzy)) : ''); luckyRewardFrenzyMaxSpan.textContent = Beautify(CM.Cache.LuckyRewardFrenzy) + (luckySplit ? (' / ' + Beautify(CM.Cache.LuckyWrathRewardFrenzy)) : '');
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Lucky!\" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : ''), luckyRewardFrenzyMaxSpan , goldCookTooltip)); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Lucky!" Reward (MAX) (Frenzy)' + (luckySplit ? ' (Golden / Wrath)' : ''), luckyRewardFrenzyMaxSpan , goldCookTooltip));
var luckyCurBase = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 15) + 13; var luckyCurBase = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 15) + 13;
var luckyCurSpan = document.createElement('span'); var luckyCurSpan = document.createElement('span');
luckyCurSpan.style.fontWeight = 'bold'; luckyCurSpan.style.fontWeight = 'bold';
luckyCurSpan.className = CM.Disp.colorTextPre + luckyCurSpan; luckyCurSpan.className = CM.Disp.colorTextPre + luckyCurSpan;
luckyCurSpan.textContent = Beautify(CM.Cache.GoldenCookiesMult * luckyCurBase) + (luckySplit ? (' / ' + Beautify(CM.Cache.WrathCookiesMult * luckyCurBase)) : ''); luckyCurSpan.textContent = Beautify(CM.Cache.GoldenCookiesMult * luckyCurBase) + (luckySplit ? (' / ' + Beautify(CM.Cache.WrathCookiesMult * luckyCurBase)) : '');
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Lucky!\" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : ''), luckyCurSpan, goldCookTooltip)); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Lucky!" Reward (CUR)' + (luckySplit ? ' (Golden / Wrath)' : ''), luckyCurSpan, goldCookTooltip));
return section; return section;
}; };
@@ -2557,7 +2556,7 @@ CM.Disp.CreateStatsChainSection = function() {
chainReqSmall.textContent = ' (' + chainTime + ')'; chainReqSmall.textContent = ' (' + chainTime + ')';
chainReqFrag.appendChild(chainReqSmall); chainReqFrag.appendChild(chainReqSmall);
} }
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Chain\" Cookies Required', chainReqFrag, goldCookTooltip)); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required', chainReqFrag, goldCookTooltip));
var chainWrathColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrath) ? CM.Disp.colorRed : CM.Disp.colorGreen; var chainWrathColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrath) ? CM.Disp.colorRed : CM.Disp.colorGreen;
var chainWrathTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrath) ? CM.Disp.FormatTime((CM.Cache.ChainWrath - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; var chainWrathTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrath) ? CM.Disp.FormatTime((CM.Cache.ChainWrath - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
@@ -2572,7 +2571,7 @@ CM.Disp.CreateStatsChainSection = function() {
chainWrathReqSmall.textContent = ' (' + chainWrathTime + ')'; chainWrathReqSmall.textContent = ' (' + chainWrathTime + ')';
chainWrathReqFrag.appendChild(chainWrathReqSmall); chainWrathReqFrag.appendChild(chainWrathReqSmall);
} }
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Chain\" Cookies Required (Wrath)', chainWrathReqFrag, goldCookTooltip)); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Wrath)', chainWrathReqFrag, goldCookTooltip));
var chainColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzy) ? CM.Disp.colorRed : CM.Disp.colorGreen; var chainColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzy) ? CM.Disp.colorRed : CM.Disp.colorGreen;
var chainTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzy) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzy - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; var chainTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzy) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzy - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
@@ -2587,7 +2586,7 @@ CM.Disp.CreateStatsChainSection = function() {
chainReqFrenSmall.textContent = ' (' + chainTimeFrenzy + ')'; chainReqFrenSmall.textContent = ' (' + chainTimeFrenzy + ')';
chainReqFrenFrag.appendChild(chainReqFrenSmall); chainReqFrenFrag.appendChild(chainReqFrenSmall);
} }
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Chain\" Cookies Required (Frenzy)', chainReqFrenFrag, goldCookTooltip)); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Frenzy)', chainReqFrenFrag, goldCookTooltip));
var chainWrathColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrath) ? CM.Disp.colorRed : CM.Disp.colorGreen; var chainWrathColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrath) ? CM.Disp.colorRed : CM.Disp.colorGreen;
var chainWrathTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrath) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzyWrath - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; var chainWrathTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrath) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzyWrath - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
@@ -2602,17 +2601,17 @@ CM.Disp.CreateStatsChainSection = function() {
chainWrathReqFrenSmall.textContent = ' (' + chainWrathTimeFrenzy + ')'; chainWrathReqFrenSmall.textContent = ' (' + chainWrathTimeFrenzy + ')';
chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSmall); chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSmall);
} }
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Chain\" Cookies Required (Frenzy) (Wrath)', chainWrathReqFrenFrag, goldCookTooltip)); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Frenzy) (Wrath)', chainWrathReqFrenFrag, goldCookTooltip));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Chain\" Reward (MAX) (Golden / Wrath)', document.createTextNode(Beautify(CM.Cache.ChainReward) + ' / ' + Beautify(CM.Cache.ChainWrathReward)), goldCookTooltip)); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (MAX) (Golden / Wrath)', document.createTextNode(Beautify(CM.Cache.ChainReward) + ' / ' + Beautify(CM.Cache.ChainWrathReward)), goldCookTooltip));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Chain\" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode((Beautify(CM.Cache.ChainFrenzyReward) + ' / ' + Beautify(CM.Cache.ChainFrenzyWrathReward))), goldCookTooltip)); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode((Beautify(CM.Cache.ChainFrenzyReward) + ' / ' + Beautify(CM.Cache.ChainFrenzyWrathReward))), goldCookTooltip));
// TODO: Place MaxChainMoni function into CM.Cache.RemakeChain and create global variables to store it // TODO: Place MaxChainMoni function into CM.Cache.RemakeChain and create global variables to store it
var chainCurMax = Math.min(CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 60 * 6, (Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.5); var chainCurMax = Math.min(CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 60 * 6, (Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.5);
var chainCur = CM.Cache.MaxChainMoni(7, chainCurMax, CM.Cache.GoldenCookiesMult); var chainCur = CM.Cache.MaxChainMoni(7, chainCurMax, CM.Cache.GoldenCookiesMult);
var chainCurWrath = CM.Cache.MaxChainMoni(6, chainCurMax, CM.Cache.WrathCookiesMult); var chainCurWrath = CM.Cache.MaxChainMoni(6, chainCurMax, CM.Cache.WrathCookiesMult);
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Chain\" Reward (CUR) (Golden / Wrath)', document.createTextNode((Beautify(chainCur) + ' / ' + Beautify(chainCurWrath))), goldCookTooltip)); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (CUR) (Golden / Wrath)', document.createTextNode((Beautify(chainCur) + ' / ' + Beautify(chainCurWrath))), goldCookTooltip));
return section; return section;
}; };
@@ -2625,7 +2624,6 @@ CM.Disp.CreateStatsSpellsSection = function() {
section.className = 'CMStatsSpellsSection'; section.className = 'CMStatsSpellsSection';
var conjureColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure) ? CM.Disp.colorRed : CM.Disp.colorGreen; var conjureColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure) ? CM.Disp.colorRed : CM.Disp.colorGreen;
var conjureCur = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 30);
var conjureTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure) ? CM.Disp.FormatTime((CM.Cache.Conjure - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : ''; var conjureTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure) ? CM.Disp.FormatTime((CM.Cache.Conjure - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
var conjureReqFrag = document.createDocumentFragment(); var conjureReqFrag = document.createDocumentFragment();
@@ -2639,8 +2637,8 @@ CM.Disp.CreateStatsSpellsSection = function() {
conjureReqSmall.textContent = ' (' + conjureTime + ')'; conjureReqSmall.textContent = ' (' + conjureTime + ')';
conjureReqFrag.appendChild(conjureReqSmall); conjureReqFrag.appendChild(conjureReqSmall);
} }
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Cookies Required', conjureReqFrag, 'GoldCookTooltipPlaceholder')); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Conjure Baked Goods" Cookies Required', conjureReqFrag, 'GoldCookTooltipPlaceholder'));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (MAX)', document.createTextNode(CM.Disp.Beautify(CM.Cache.ConjureReward)), 'GoldCookTooltipPlaceholder')); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Conjure Baked Goods" Reward (MAX)', document.createTextNode(CM.Disp.Beautify(CM.Cache.ConjureReward)), 'GoldCookTooltipPlaceholder'));
var conjureFrenzyColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.colorRed : CM.Disp.colorGreen; var conjureFrenzyColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Conjure * 7) ? CM.Disp.colorRed : CM.Disp.colorGreen;
var conjureFrenzyCur = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 30); var conjureFrenzyCur = Math.min((Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.15, CM.Cache.NoGoldSwitchCookiesPS * 60 * 30);
@@ -2657,11 +2655,11 @@ CM.Disp.CreateStatsSpellsSection = function() {
conjureFrenzyReqSmall.textContent = ' (' + conjureFrenzyTime + ')'; conjureFrenzyReqSmall.textContent = ' (' + conjureFrenzyTime + ')';
conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSmall); conjureFrenzyReqFrag.appendChild(conjureFrenzyReqSmall);
} }
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Cookies Required (Frenzy)', conjureFrenzyReqFrag, 'GoldCookTooltipPlaceholder')); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Conjure Baked Goods" Cookies Required (Frenzy)', conjureFrenzyReqFrag, 'GoldCookTooltipPlaceholder'));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (MAX) (Frenzy)', document.createTextNode(CM.Disp.Beautify(CM.Cache.ConjureReward * 7)), 'GoldCookTooltipPlaceholder')); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Conjure Baked Goods" Reward (MAX) (Frenzy)', document.createTextNode(CM.Disp.Beautify(CM.Cache.ConjureReward * 7)), 'GoldCookTooltipPlaceholder'));
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Conjure Baked Goods\" Reward (CUR)', document.createTextNode(CM.Disp.Beautify(conjureFrenzyCur)), 'GoldCookTooltipPlaceholder')); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Conjure Baked Goods" Reward (CUR)', document.createTextNode(CM.Disp.Beautify(conjureFrenzyCur)), 'GoldCookTooltipPlaceholder'));
if (CM.Cache.Edifice) { if (CM.Cache.Edifice) {
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '\"Spontaneous Edifice\" Cookies Required (most expensive building)', document.createTextNode(CM.Disp.Beautify(CM.Cache.Edifice) + ' (' + CM.Cache.EdificeBuilding + ")"), 'GoldCookTooltipPlaceholder')); section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Spontaneous Edifice" Cookies Required (most expensive building)', document.createTextNode(CM.Disp.Beautify(CM.Cache.Edifice) + ' (' + CM.Cache.EdificeBuilding + ")"), 'GoldCookTooltipPlaceholder'));
} }
return section; return section;
}; };
@@ -2692,7 +2690,7 @@ CM.Disp.CreateStatsPrestigeSection = function() {
var resetBonus = CM.Sim.ResetBonus(possiblePresMax); var resetBonus = CM.Sim.ResetBonus(possiblePresMax);
var resetFrag = document.createDocumentFragment(); var resetFrag = document.createDocumentFragment();
resetFrag.appendChild(document.createTextNode(Beautify(resetBonus))); resetFrag.appendChild(document.createTextNode(Beautify(resetBonus)));
var increase = Math.round(resetBonus / Game.cookiesPs * 10000); let increase = Math.round(resetBonus / Game.cookiesPs * 10000);
if (isFinite(increase) && increase != 0) { if (isFinite(increase) && increase != 0) {
var resetSmall = document.createElement('small'); var resetSmall = document.createElement('small');
resetSmall.textContent = ' (' + (increase / 100) + '% of income)'; resetSmall.textContent = ' (' + (increase / 100) + '% of income)';
@@ -2743,7 +2741,7 @@ CM.Disp.CreateStatsPrestigeSection = function() {
CM.Disp.AddMissingUpgrades = function() { CM.Disp.AddMissingUpgrades = function() {
if (CM.Cache.MissingUpgradesPrestige) { if (CM.Cache.MissingUpgradesPrestige) {
var prestigeUpgradesOwned = Game.PrestigeUpgrades.length - l('menu').children[5].children[3].children.length; var prestigeUpgradesOwned = Game.PrestigeUpgrades.length - l('menu').children[5].children[3].children.length;
var title = document.createElement('div'); let title = document.createElement('div');
title.id = "CMMissingUpgradesPrestigeTitle"; title.id = "CMMissingUpgradesPrestigeTitle";
title.className = "listing"; title.className = "listing";
titlefrag = document.createElement('div'); titlefrag = document.createElement('div');
@@ -2756,10 +2754,9 @@ CM.Disp.AddMissingUpgrades = function() {
l('menu').children[5].appendChild(upgrades); l('menu').children[5].appendChild(upgrades);
} }
if (CM.Cache.MissingUpgrades) { if (CM.Cache.MissingUpgrades) {
if (Game.UpgradesOwned) { let normalUpgradesOwned = 0;
var normalUpgradesOwned = Game.UpgradesByPool[""].length + Game.UpgradesByPool.tech.length - l('menu').children[6].childNodes[2].children.length; if (Game.UpgradesOwned) normalUpgradesOwned = Game.UpgradesByPool[""].length + Game.UpgradesByPool.tech.length - l('menu').children[6].childNodes[2].children.length;
} else var normalUpgradesOwned = 0; let title = document.createElement('div');
var title = document.createElement('div');
title.id = "CMMissingUpgradesTitle"; title.id = "CMMissingUpgradesTitle";
title.className = "listing"; title.className = "listing";
titlefrag = document.createElement('div'); titlefrag = document.createElement('div');
@@ -2773,7 +2770,7 @@ CM.Disp.AddMissingUpgrades = function() {
} }
if (CM.Cache.MissingUpgradesCookies) { if (CM.Cache.MissingUpgradesCookies) {
var cookieUpgradesOwned = Game.UpgradesByPool.cookie.length - l('menu').children[6].lastChild.children.length; var cookieUpgradesOwned = Game.UpgradesByPool.cookie.length - l('menu').children[6].lastChild.children.length;
var title = document.createElement('div'); let title = document.createElement('div');
title.id = "CMMissingUpgradesCookiesTitle"; title.id = "CMMissingUpgradesCookiesTitle";
title.className = "listing"; title.className = "listing";
titlefrag = document.createElement('div'); titlefrag = document.createElement('div');
@@ -2803,7 +2800,7 @@ CM.Disp.crateMissing = function(me) {
if (!Game.prefs.crates) noFrame = 1; if (!Game.prefs.crates) noFrame = 1;
if (noFrame) classes += ' noFrame'; if (noFrame) classes += ' noFrame';
var icon = me.icon; let icon = me.icon;
if (me.iconFunction) icon = me.iconFunction(); if (me.iconFunction) icon = me.iconFunction();
tooltip = `function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`; tooltip = `function() {return Game.crateTooltip(Game.UpgradesById[${me.id}], 'stats');}`;
return `<div class="${classes}" return `<div class="${classes}"

View File

@@ -221,7 +221,7 @@ CM.DelayInit = function() {
CM.Disp.CreateUpgradeBar(); CM.Disp.CreateUpgradeBar();
CM.Disp.CreateWhiteScreen(); CM.Disp.CreateWhiteScreen();
CM.Disp.CreateFavicon(); CM.Disp.CreateFavicon();
for (var i in CM.Disp.TooltipText) { for (let i of Object.keys(CM.Disp.TooltipText)) {
CM.Disp.CreateSimpleTooltip(CM.Disp.TooltipText[i][0], CM.Disp.TooltipText[i][1], CM.Disp.TooltipText[i][2]); CM.Disp.CreateSimpleTooltip(CM.Disp.TooltipText[i][0], CM.Disp.TooltipText[i][1], CM.Disp.TooltipText[i][2]);
} }
CM.Disp.CreateWrinklerButtons(); CM.Disp.CreateWrinklerButtons();
@@ -276,7 +276,6 @@ CM.Main.ReplaceTooltips = function() {
/******** /********
* Section: Functions related to replacing tooltips */ * Section: Functions related to replacing tooltips */
/** /**
* This function replaces the original .onmouseover functions of buildings so that it calls CM.Disp.Tooltip() * This function replaces the original .onmouseover functions of buildings so that it calls CM.Disp.Tooltip()
* CM.Disp.Tooltip() sets the tooltip type to 'b' * CM.Disp.Tooltip() sets the tooltip type to 'b'
@@ -284,7 +283,7 @@ CM.Main.ReplaceTooltips = function() {
*/ */
CM.Main.ReplaceTooltipBuild = function() { CM.Main.ReplaceTooltipBuild = function() {
CM.Main.TooltipBuildBackup = []; CM.Main.TooltipBuildBackup = [];
for (var i in Game.Objects) { for (let i of Object.keys(Game.Objects)) {
var me = Game.Objects[i]; var me = Game.Objects[i];
if (l('product' + me.id).onmouseover != null) { if (l('product' + me.id).onmouseover != null) {
CM.Main.TooltipBuildBackup[i] = l('product' + me.id).onmouseover; CM.Main.TooltipBuildBackup[i] = l('product' + me.id).onmouseover;
@@ -301,7 +300,7 @@ CM.Main.ReplaceTooltipBuild = function() {
CM.Main.ReplaceTooltipGrimoire = function() { CM.Main.ReplaceTooltipGrimoire = function() {
if (Game.Objects['Wizard tower'].minigameLoaded) { if (Game.Objects['Wizard tower'].minigameLoaded) {
CM.Main.TooltipGrimoireBackup = []; CM.Main.TooltipGrimoireBackup = [];
for (var i in Game.Objects['Wizard tower'].minigame.spellsById) { for (let i in Game.Objects['Wizard tower'].minigame.spellsById) {
if (l('grimoireSpell' + i).onmouseover != null) { if (l('grimoireSpell' + i).onmouseover != null) {
CM.Main.TooltipGrimoireBackup[i] = l('grimoireSpell' + i).onmouseover; CM.Main.TooltipGrimoireBackup[i] = l('grimoireSpell' + i).onmouseover;
eval('l(\'grimoireSpell\' + i).onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'g\', \'' + i + '\');}, \'this\'); Game.tooltip.wobble();}'); eval('l(\'grimoireSpell\' + i).onmouseover = function() {Game.tooltip.dynamic = 1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip(\'g\', \'' + i + '\');}, \'this\'); Game.tooltip.wobble();}');
@@ -330,7 +329,7 @@ CM.Main.ReplaceTooltipLump = function() {
CM.Main.ReplaceTooltipGarden = function() { CM.Main.ReplaceTooltipGarden = function() {
if (Game.Objects.Farm.minigameLoaded) { if (Game.Objects.Farm.minigameLoaded) {
l('gardenTool-1').onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('ha', 'HarvestAllButton');}, 'this'); Game.tooltip.wobble();}; l('gardenTool-1').onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('ha', 'HarvestAllButton');}, 'this'); Game.tooltip.wobble();};
Array.from(l('gardenPlot').children).forEach((child, index) => { Array.from(l('gardenPlot').children).forEach((child) => {
var coords = child.id.slice(-3,); var coords = child.id.slice(-3,);
child.onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('p', [`${coords[0]}`,`${coords[2]}`]);}, 'this'); Game.tooltip.wobble();}; child.onmouseover = function() {Game.tooltip.dynamic=1; Game.tooltip.draw(this, function() {return CM.Disp.Tooltip('p', [`${coords[0]}`,`${coords[2]}`]);}, 'this'); Game.tooltip.wobble();};
}); });
@@ -349,7 +348,7 @@ CM.Main.ReplaceTooltipGarden = function() {
CM.Main.FindShimmer = function() { CM.Main.FindShimmer = function() {
CM.Main.currSpawnedGoldenCookieState = 0; CM.Main.currSpawnedGoldenCookieState = 0;
CM.Cache.goldenShimmersByID = {}; CM.Cache.goldenShimmersByID = {};
for (var i in Game.shimmers) { for (let i of Object.keys(Game.shimmers)) {
CM.Cache.goldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i]; CM.Cache.goldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i];
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type == 'golden') { if (Game.shimmers[i].spawnLead && Game.shimmers[i].type == 'golden') {
CM.Cache.spawnedGoldenShimmer = Game.shimmers[i]; CM.Cache.spawnedGoldenShimmer = Game.shimmers[i];
@@ -365,7 +364,7 @@ CM.Main.FindShimmer = function() {
*/ */
CM.Main.CheckGoldenCookie = function() { CM.Main.CheckGoldenCookie = function() {
CM.Main.FindShimmer(); CM.Main.FindShimmer();
for (var i in CM.Disp.GCTimers) { for (let i of Object.keys(CM.Disp.GCTimers)) {
if (typeof CM.Cache.goldenShimmersByID[i] == "undefined") { if (typeof CM.Cache.goldenShimmersByID[i] == "undefined") {
CM.Disp.GCTimers[i].parentNode.removeChild(CM.Disp.GCTimers[i]); CM.Disp.GCTimers[i].parentNode.removeChild(CM.Disp.GCTimers[i]);
// TODO remove delete here // TODO remove delete here
@@ -381,7 +380,7 @@ CM.Main.CheckGoldenCookie = function() {
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!");
} }
for (var i in Game.shimmers) { for (let i of Object.keys(Game.shimmers)) {
if (typeof CM.Disp.GCTimers[Game.shimmers[i].id] == "undefined") { if (typeof CM.Disp.GCTimers[Game.shimmers[i].id] == "undefined") {
CM.Disp.CreateGCTimer(Game.shimmers[i]); CM.Disp.CreateGCTimer(Game.shimmers[i]);
} }
@@ -392,7 +391,7 @@ CM.Main.CheckGoldenCookie = function() {
if (CM.Main.currSpawnedGoldenCookieState == 0) CM.Cache.spawnedGoldenShimmer = 0; if (CM.Main.currSpawnedGoldenCookieState == 0) CM.Cache.spawnedGoldenShimmer = 0;
} }
else if (CM.Options.GCTimer == 1 && CM.Main.lastGoldenCookieState) { else if (CM.Options.GCTimer == 1 && CM.Main.lastGoldenCookieState) {
for (var i in CM.Disp.GCTimers) { for (let i of Object.keys(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;
CM.Disp.GCTimers[i].textContent = Math.ceil(CM.Cache.goldenShimmersByID[i].life / Game.fps); CM.Disp.GCTimers[i].textContent = Math.ceil(CM.Cache.goldenShimmersByID[i].life / Game.fps);
@@ -407,7 +406,7 @@ CM.Main.CheckGoldenCookie = function() {
CM.Main.CheckSeasonPopup = function() { CM.Main.CheckSeasonPopup = function() {
if (CM.Main.lastSeasonPopupState != Game.shimmerTypes.reindeer.spawned) { if (CM.Main.lastSeasonPopupState != Game.shimmerTypes.reindeer.spawned) {
CM.Main.lastSeasonPopupState = Game.shimmerTypes.reindeer.spawned; CM.Main.lastSeasonPopupState = Game.shimmerTypes.reindeer.spawned;
for (var i in Game.shimmers) { for (let i of Object.keys(Game.shimmers)) {
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type == 'reindeer') { if (Game.shimmers[i].spawnLead && Game.shimmers[i].type == 'reindeer') {
CM.Cache.seasonPopShimmer = Game.shimmers[i]; CM.Cache.seasonPopShimmer = Game.shimmers[i];
break; break;
@@ -472,7 +471,7 @@ CM.Main.CheckMagicMeter = function() {
CM.Main.CheckWrinklerCount = function() { CM.Main.CheckWrinklerCount = function() {
if (Game.elderWrath > 0) { if (Game.elderWrath > 0) {
var CurrentWrinklers = 0; var CurrentWrinklers = 0;
for (var i in Game.wrinklers) { for (let i in Game.wrinklers) {
if (Game.wrinklers[i].phase == 2) CurrentWrinklers++; if (Game.wrinklers[i].phase == 2) CurrentWrinklers++;
} }
if (CurrentWrinklers > CM.Main.lastWrinklerCount) { if (CurrentWrinklers > CM.Main.lastWrinklerCount) {
@@ -509,7 +508,7 @@ CM.Main.AddWrinklerAreaDetect = function() {
l('backgroundLeftCanvas').onmouseout = function() { l('backgroundLeftCanvas').onmouseout = function() {
CM.Disp.TooltipWrinklerArea = 0; CM.Disp.TooltipWrinklerArea = 0;
Game.tooltip.hide(); Game.tooltip.hide();
for (var i in Game.wrinklers) { for (let i of Object.keys(Game.wrinklers)) {
CM.Disp.TooltipWrinklerBeingShown[i] = 0; CM.Disp.TooltipWrinklerBeingShown[i] = 0;
} }
}; };
@@ -540,7 +539,6 @@ CM.HasReplaceNativeGrimoireDraw = false;
CM.Main.lastGoldenCookieState = 0; CM.Main.lastGoldenCookieState = 0;
CM.Main.lastSpawnedGoldenCookieState = 0; CM.Main.lastSpawnedGoldenCookieState = 0;
CM.Main.currSpawnedGoldenCookieState;
CM.Main.lastTickerFortuneState = 0; CM.Main.lastTickerFortuneState = 0;
CM.Main.lastSeasonPopupState = 0; CM.Main.lastSeasonPopupState = 0;
CM.Main.lastGardenNextStep = 0; CM.Main.lastGardenNextStep = 0;

View File

@@ -3,8 +3,8 @@
*******/ *******/
CM.Sim.BuildingGetPrice = function(build, basePrice, start, free, increase) { CM.Sim.BuildingGetPrice = function(build, basePrice, start, free, increase) {
/*var price=0; /*let price=0;
for (var i = Math.max(0 , start); i < Math.max(0, start + increase); i++) { for (let i = Math.max(0 , start); i < Math.max(0, start + increase); i++) {
price += basePrice * Math.pow(Game.priceIncrease, Math.max(0, i - free)); price += basePrice * Math.pow(Game.priceIncrease, Math.max(0, i - free));
} }
if (Game.Has('Season savings')) price *= 0.99; if (Game.Has('Season savings')) price *= 0.99;
@@ -15,8 +15,8 @@ CM.Sim.BuildingGetPrice = function(build, basePrice, start, free, increase) {
return Math.ceil(price);*/ return Math.ceil(price);*/
var moni = 0; var moni = 0;
for (var i = 0; i < increase; i++) { for (let i = 0; i < increase; i++) {
var price = basePrice * Math.pow(Game.priceIncrease, Math.max(0, start - free)); let price = basePrice * Math.pow(Game.priceIncrease, Math.max(0, start - free));
price = Game.modifyBuildingPrice(build, price); price = Game.modifyBuildingPrice(build, price);
price = Math.ceil(price); price = Math.ceil(price);
moni += price; moni += price;
@@ -26,8 +26,8 @@ CM.Sim.BuildingGetPrice = function(build, basePrice, start, free, increase) {
}; };
CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, noSim) { CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, noSim) {
/*var price=0; /*let price=0;
for (var i = Math.max(0, start - amount); i < Math.max(0, start); i++) { for (let i = Math.max(0, start - amount); i < Math.max(0, start); i++) {
price += basePrice * Math.pow(Game.priceIncrease, Math.max(0, i - free)); price += basePrice * Math.pow(Game.priceIncrease, Math.max(0, i - free));
} }
if (Game.Has('Season savings')) price*=0.99; if (Game.Has('Season savings')) price*=0.99;
@@ -49,8 +49,8 @@ CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, noSim) {
var moni = 0; var moni = 0;
if (amount == -1) amount = start; if (amount == -1) amount = start;
if (!amount) amount = Game.buyBulk; if (!amount) amount = Game.buyBulk;
for (var i = 0; i < amount; i++) { for (let i = 0; i < amount; i++) {
var price = basePrice * Math.pow(Game.priceIncrease, Math.max(0, start - free)); let price = basePrice * Math.pow(Game.priceIncrease, Math.max(0, start - free));
price = noSim ? Game.modifyBuildingPrice(build, price) : CM.Sim.modifyBuildingPrice(build, price); price = noSim ? Game.modifyBuildingPrice(build, price) : CM.Sim.modifyBuildingPrice(build, price);
price = Math.ceil(price); price = Math.ceil(price);
var giveBack = noSim ? build.getSellMultiplier() : CM.Sim.getSellMultiplier(); var giveBack = noSim ? build.getSellMultiplier() : CM.Sim.getSellMultiplier();
@@ -64,7 +64,7 @@ CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, noSim) {
}; };
CM.Sim.Has = function(what) { CM.Sim.Has = function(what) {
var it = CM.Sim.Upgrades[what]; let it = CM.Sim.Upgrades[what];
if (Game.ascensionMode == 1 && (it.pool == 'prestige' || it.tier == 'fortune')) return 0; if (Game.ascensionMode == 1 && (it.pool == 'prestige' || it.tier == 'fortune')) return 0;
return (it ? it.bought : 0); return (it ? it.bought : 0);
}; };
@@ -108,7 +108,7 @@ CM.Sim.hasGod=function(what) {
} }
var possibleGods = CM.Sim.Objects.Temple.minigame.gods; var possibleGods = CM.Sim.Objects.Temple.minigame.gods;
var god=possibleGods[what]; var god=possibleGods[what];
for (var i=0;i<3;i++) for (let i=0;i<3;i++)
{ {
if (CM.Sim.Objects.Temple.minigame.slot[i]==god.id) return (i+1); if (CM.Sim.Objects.Temple.minigame.slot[i]==god.id) return (i+1);
} }
@@ -139,7 +139,7 @@ eval('CM.Sim.GetTieredCpsMult = ' + Game.GetTieredCpsMult.toString()
CM.Sim.getCPSBuffMult = function() { CM.Sim.getCPSBuffMult = function() {
var mult = 1; var mult = 1;
for (var i in Game.buffs) { for (let i of Object.keys(Game.buffs)) {
if (typeof Game.buffs[i].multCpS != 'undefined') mult *= Game.buffs[i].multCpS; if (typeof Game.buffs[i].multCpS != 'undefined') mult *= Game.buffs[i].multCpS;
} }
return mult; return mult;
@@ -155,8 +155,8 @@ CM.Sim.getCPSBuffMult = function() {
* are set by CM.Sim.CopyData. * are set by CM.Sim.CopyData.
*/ */
CM.Sim.InitialBuildingData = function(buildingName) { CM.Sim.InitialBuildingData = function(buildingName) {
var me = Game.Objects[buildingName]; let me = Game.Objects[buildingName];
var you = {}; let you = {};
eval('you.cps = ' + me.cps.toString() eval('you.cps = ' + me.cps.toString()
.split('Game.Has').join('CM.Sim.Has') .split('Game.Has').join('CM.Sim.Has')
.split('Game.hasAura').join('CM.Sim.hasAura') .split('Game.hasAura').join('CM.Sim.hasAura')
@@ -176,8 +176,8 @@ CM.Sim.InitialBuildingData = function(buildingName) {
* so this function just returns an empty object. * so this function just returns an empty object.
*/ */
CM.Sim.InitUpgrade = function(upgradeName) { CM.Sim.InitUpgrade = function(upgradeName) {
var me = Game.Upgrades[upgradeName]; let me = Game.Upgrades[upgradeName];
var you = {}; let you = {};
you.pool = me.pool; you.pool = me.pool;
you.name = me.name; you.name = me.name;
return you; return you;
@@ -189,28 +189,31 @@ CM.Sim.InitUpgrade = function(upgradeName) {
* so this function just returns an empty object. * so this function just returns an empty object.
*/ */
CM.Sim.InitAchievement = function(achievementName) { CM.Sim.InitAchievement = function(achievementName) {
let me = Game.Achievements[achievementName];
let you = {};
you.name = me.name;
return {}; return {};
}; };
CM.Sim.InitData = function() { CM.Sim.InitData = function() {
// Buildings // Buildings
CM.Sim.Objects = []; CM.Sim.Objects = [];
for (var i in Game.Objects) { for (let i of Object.keys(Game.Objects)) {
CM.Sim.Objects[i] = CM.Sim.InitialBuildingData(i); CM.Sim.Objects[i] = CM.Sim.InitialBuildingData(i);
} }
// Upgrades // Upgrades
CM.Sim.Upgrades = []; CM.Sim.Upgrades = [];
for (var i in Game.Upgrades) { for (let i of Object.keys(Game.Upgrades)) {
CM.Sim.Upgrades[i] = CM.Sim.InitUpgrade(i); CM.Sim.Upgrades[i] = CM.Sim.InitUpgrade(i);
} }
// Achievements // Achievements
CM.Sim.Achievements = []; CM.Sim.Achievements = [];
for (var i in Game.Achievements) { for (let i of Object.keys(Game.Achievements)) {
CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i); CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i);
} }
CM.Sim.CopyData; CM.Sim.CopyData();
}; };
CM.Sim.CopyData = function() { CM.Sim.CopyData = function() {
@@ -222,9 +225,9 @@ CM.Sim.CopyData = function() {
CM.Sim.prestige = Game.prestige; CM.Sim.prestige = Game.prestige;
// Buildings // Buildings
for (var i in Game.Objects) { for (let i of Object.keys(Game.Objects)) {
var me = Game.Objects[i]; let me = Game.Objects[i];
var you = CM.Sim.Objects[i]; let you = CM.Sim.Objects[i];
if (you == undefined) { // New building! if (you == undefined) { // New building!
you = CM.Sim.Objects[i] = CM.Sim.InitialBuildingData(i); you = CM.Sim.Objects[i] = CM.Sim.InitialBuildingData(i);
CM.Disp.CreateBotBarBuildingColumn(i); // Add new building to the bottom bar CM.Disp.CreateBotBarBuildingColumn(i); // Add new building to the bottom bar
@@ -238,9 +241,9 @@ CM.Sim.CopyData = function() {
} }
// Upgrades // Upgrades
for (var i in Game.Upgrades) { for (let i of Object.keys(Game.Upgrades)) {
var me = Game.Upgrades[i]; let me = Game.Upgrades[i];
var you = CM.Sim.Upgrades[i]; let you = CM.Sim.Upgrades[i];
if (you == undefined) { if (you == undefined) {
you = CM.Sim.Upgrades[i] = CM.Sim.InitUpgrade(i); you = CM.Sim.Upgrades[i] = CM.Sim.InitUpgrade(i);
} }
@@ -248,9 +251,9 @@ CM.Sim.CopyData = function() {
} }
// Achievements // Achievements
for (var i in Game.Achievements) { for (let i of Object.keys(Game.Achievements)) {
var me = Game.Achievements[i]; let me = Game.Achievements[i];
var you = CM.Sim.Achievements[i]; let you = CM.Sim.Achievements[i];
if (you == undefined) { if (you == undefined) {
you = CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i); you = CM.Sim.Achievements[i] = CM.Sim.InitAchievement(i);
} }
@@ -268,12 +271,12 @@ CM.Sim.CalculateGains = function() {
var mult = 1; var mult = 1;
// Include minigame effects // Include minigame effects
var effs={}; var effs={};
for (var i in Game.Objects) { for (let i of Object.keys(Game.Objects)) {
// TODO Store minigames and effects in Cache // TODO Store minigames and effects in Cache
// Include possibility of new/modded building and new/modded minigames // Include possibility of new/modded building and new/modded minigames
if (CM.Sim.Objects[i].minigameLoaded && CM.Sim.Objects[i].minigame.effs) { if (CM.Sim.Objects[i].minigameLoaded && CM.Sim.Objects[i].minigame.effs) {
var myEffs = CM.Sim.Objects[i].minigame.effs; var myEffs = CM.Sim.Objects[i].minigame.effs;
for (var ii in myEffs) { for (let ii in myEffs) {
if (effs[ii]) effs[ii]*=myEffs[ii]; if (effs[ii]) effs[ii]*=myEffs[ii];
else effs[ii]=myEffs[ii]; else effs[ii]=myEffs[ii];
} }
@@ -289,8 +292,8 @@ CM.Sim.CalculateGains = function() {
// TODO: Make function call cached function where Game.Has is replaced with CM.Has // TODO: Make function call cached function where Game.Has is replaced with CM.Has
// Related to valentine cookies // Related to valentine cookies
for (var i in Game.cookieUpgrades) { for (let i of Object.keys(Game.cookieUpgrades)) {
var me = Game.cookieUpgrades[i]; let me = Game.cookieUpgrades[i];
if (CM.Sim.Has(me.name)) { if (CM.Sim.Has(me.name)) {
mult *= (1 + (typeof(me.power) == 'function' ? me.power(me) : me.power) * 0.01); mult *= (1 + (typeof(me.power) == 'function' ? me.power(me) : me.power) * 0.01);
} }
@@ -316,28 +319,28 @@ CM.Sim.CalculateGains = function() {
// Check effect of chosen Gods // Check effect of chosen Gods
var buildMult = 1; var buildMult = 1;
if (CM.Sim.Objects.Temple.minigameLoaded) { if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = CM.Sim.hasGod('asceticism'); let godLvl = CM.Sim.hasGod('asceticism');
if (godLvl == 1) mult *= 1.15; if (godLvl == 1) mult *= 1.15;
else if (godLvl == 2) mult *= 1.1; else if (godLvl == 2) mult *= 1.1;
else if (godLvl == 3) mult *= 1.05; else if (godLvl == 3) mult *= 1.05;
// TODO: What does DateAges do? // TODO: What does DateAges do?
var godLvl = CM.Sim.hasGod('ages'); godLvl = CM.Sim.hasGod('ages');
if (godLvl == 1) mult *= 1 + 0.15 * Math.sin((CM.Sim.DateAges / 1000 / (60 * 60 * 3)) * Math.PI * 2); if (godLvl == 1) mult *= 1 + 0.15 * Math.sin((CM.Sim.DateAges / 1000 / (60 * 60 * 3)) * Math.PI * 2);
else if (godLvl == 2) mult *= 1 + 0.15 * Math.sin((CM.Sim.DateAges / 1000 / (60 * 60 * 12)) * Math.PI*2); else if (godLvl == 2) mult *= 1 + 0.15 * Math.sin((CM.Sim.DateAges / 1000 / (60 * 60 * 12)) * Math.PI*2);
else if (godLvl == 3) mult *= 1 + 0.15 * Math.sin((CM.Sim.DateAges / 1000 / (60 * 60 * 24)) * Math.PI*2); else if (godLvl == 3) mult *= 1 + 0.15 * Math.sin((CM.Sim.DateAges / 1000 / (60 * 60 * 24)) * Math.PI*2);
var godLvl = CM.Sim.hasGod('decadence'); godLvl = CM.Sim.hasGod('decadence');
if (godLvl == 1) buildMult *= 0.93; if (godLvl == 1) buildMult *= 0.93;
else if (godLvl == 2) buildMult *= 0.95; else if (godLvl == 2) buildMult *= 0.95;
else if (godLvl == 3) buildMult *= 0.98; else if (godLvl == 3) buildMult *= 0.98;
var godLvl = CM.Sim.hasGod('industry'); godLvl = CM.Sim.hasGod('industry');
if (godLvl == 1) buildMult *= 1.1; if (godLvl == 1) buildMult *= 1.1;
else if (godLvl == 2) buildMult *= 1.06; else if (godLvl == 2) buildMult *= 1.06;
else if (godLvl == 3) buildMult *= 1.03; else if (godLvl == 3) buildMult *= 1.03;
var godLvl = CM.Sim.hasGod('labor'); godLvl = CM.Sim.hasGod('labor');
if (godLvl == 1) buildMult *= 0.97; if (godLvl == 1) buildMult *= 0.97;
else if (godLvl == 2) buildMult *= 0.98; else if (godLvl == 2) buildMult *= 0.98;
else if (godLvl == 3) buildMult *= 0.99; else if (godLvl == 3) buildMult *= 0.99;
@@ -351,7 +354,7 @@ CM.Sim.CalculateGains = function() {
//if (CM.Sim.hasAura('Breath of Milk')) milkMult *= 1.05; //if (CM.Sim.hasAura('Breath of Milk')) milkMult *= 1.05;
milkMult *= 1 + CM.Sim.auraMult('Breath of Milk') * 0.05; milkMult *= 1 + CM.Sim.auraMult('Breath of Milk') * 0.05;
if (CM.Sim.Objects.Temple.minigameLoaded) { if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = CM.Sim.hasGod('mother'); let godLvl = CM.Sim.hasGod('mother');
if (godLvl == 1) milkMult *= 1.1; if (godLvl == 1) milkMult *= 1.1;
else if (godLvl == 2) milkMult *= 1.05; else if (godLvl == 2) milkMult *= 1.05;
else if (godLvl == 3) milkMult *= 1.03; else if (godLvl == 3) milkMult *= 1.03;
@@ -377,8 +380,8 @@ CM.Sim.CalculateGains = function() {
if (CM.Sim.Has('Kitten angels')) catMult *= (1 + milkProgress * 0.1 * milkMult); if (CM.Sim.Has('Kitten angels')) catMult *= (1 + milkProgress * 0.1 * milkMult);
if (CM.Sim.Has('Fortune #103')) catMult *= (1 + milkProgress * 0.05 * milkMult); if (CM.Sim.Has('Fortune #103')) catMult *= (1 + milkProgress * 0.05 * milkMult);
for (var i in CM.Sim.Objects) { for (let i of Object.keys(CM.Sim.Objects)) {
var me = CM.Sim.Objects[i]; let me = CM.Sim.Objects[i];
var storedCps = (typeof(me.cps) == 'function' ? me.cps(me) : me.cps); var storedCps = (typeof(me.cps) == 'function' ? me.cps(me) : me.cps);
if (Game.ascensionMode != 1) storedCps *= (1 + me.level * 0.01) * buildMult; if (Game.ascensionMode != 1) storedCps *= (1 + me.level * 0.01) * buildMult;
if (me.name == "Grandma" && CM.Sim.Has('Milkhelp&reg; lactose intolerance relief tablets')) storedCps *= 1 + 0.05 * milkProgress * milkMult; if (me.name == "Grandma" && CM.Sim.Has('Milkhelp&reg; lactose intolerance relief tablets')) storedCps *= 1 + 0.05 * milkProgress * milkMult;
@@ -418,7 +421,7 @@ CM.Sim.CalculateGains = function() {
mult *= 1 + CM.Sim.auraMult('Radiant Appetite'); mult *= 1 + CM.Sim.auraMult('Radiant Appetite');
var rawCookiesPs = CM.Sim.cookiesPs * mult; var rawCookiesPs = CM.Sim.cookiesPs * mult;
for (var i in Game.CpsAchievements) { for (let i of Object.keys(Game.CpsAchievements)) {
if (rawCookiesPs >= Game.CpsAchievements[i].threshold) CM.Sim.Win(Game.CpsAchievements[i].name); if (rawCookiesPs >= Game.CpsAchievements[i].threshold) CM.Sim.Win(Game.CpsAchievements[i].name);
} }
@@ -426,7 +429,7 @@ CM.Sim.CalculateGains = function() {
var n = Game.shimmerTypes.golden.n; var n = Game.shimmerTypes.golden.n;
var auraMult = CM.Sim.auraMult('Dragon\'s Fortune'); var auraMult = CM.Sim.auraMult('Dragon\'s Fortune');
for (var i = 0; i < n; i++){ for (let i = 0; i < n; i++){
mult *= 1 + auraMult * 1.23; mult *= 1 + auraMult * 1.23;
} }
@@ -442,7 +445,7 @@ CM.Sim.CalculateGains = function() {
var goldenSwitchMult = 1.5; var goldenSwitchMult = 1.5;
if (CM.Sim.Has('Residual luck')) { if (CM.Sim.Has('Residual luck')) {
var upgrades = Game.goldenCookieUpgrades; var upgrades = Game.goldenCookieUpgrades;
for (var i in upgrades) { for (let i of Object.keys(upgrades)) {
if (CM.Sim.Has(upgrades[i])) goldenSwitchMult += 0.1; if (CM.Sim.Has(upgrades[i])) goldenSwitchMult += 0.1;
} }
} }
@@ -468,7 +471,7 @@ CM.Sim.CalculateGains = function() {
CM.Sim.CheckOtherAchiev = function() { CM.Sim.CheckOtherAchiev = function() {
var grandmas = 0; var grandmas = 0;
for (var i in Game.GrandmaSynergies) { for (let i of Object.keys(Game.GrandmaSynergies)) {
if (CM.Sim.Has(Game.GrandmaSynergies[i])) grandmas++; if (CM.Sim.Has(Game.GrandmaSynergies[i])) grandmas++;
} }
if (!CM.Sim.HasAchiev('Elder') && grandmas >= 7) CM.Sim.Win('Elder'); if (!CM.Sim.HasAchiev('Elder') && grandmas >= 7) CM.Sim.Win('Elder');
@@ -478,7 +481,7 @@ CM.Sim.CheckOtherAchiev = function() {
var mathematician = 1; var mathematician = 1;
var base10 = 1; var base10 = 1;
var minAmount = 100000; var minAmount = 100000;
for (var i in CM.Sim.Objects) { for (let i of Object.keys(CM.Sim.Objects)) {
buildingsOwned += CM.Sim.Objects[i].amount; buildingsOwned += CM.Sim.Objects[i].amount;
minAmount = Math.min(CM.Sim.Objects[i].amount, minAmount); minAmount = Math.min(CM.Sim.Objects[i].amount, minAmount);
if (!CM.Sim.HasAchiev('Mathematician')) { if (!CM.Sim.HasAchiev('Mathematician')) {
@@ -523,13 +526,13 @@ CM.Sim.CheckOtherAchiev = function() {
if (CM.Sim.Objects.Cursor.amount + CM.Sim.Objects.Grandma.amount >= 777) CM.Sim.Win('The elder scrolls'); if (CM.Sim.Objects.Cursor.amount + CM.Sim.Objects.Grandma.amount >= 777) CM.Sim.Win('The elder scrolls');
var hasAllHalloCook = true; var hasAllHalloCook = true;
for (var i in CM.Data.HalloCookies) { for (let i of Object.keys(CM.Data.HalloCookies)) {
if (!CM.Sim.Has(CM.Data.HalloCookies[i])) hasAllHalloCook = false; if (!CM.Sim.Has(CM.Data.HalloCookies[i])) hasAllHalloCook = false;
} }
if (hasAllHalloCook) CM.Sim.Win('Spooky cookies'); if (hasAllHalloCook) CM.Sim.Win('Spooky cookies');
var hasAllChristCook = true; var hasAllChristCook = true;
for (var i in CM.Data.ChristCookies) { for (let i of Object.keys(CM.Data.ChristCookies)) {
if (!CM.Sim.Has(CM.Data.ChristCookies[i])) hasAllChristCook = false; if (!CM.Sim.Has(CM.Data.ChristCookies[i])) hasAllChristCook = false;
} }
if (hasAllChristCook) CM.Sim.Win('Let it snow'); if (hasAllChristCook) CM.Sim.Win('Let it snow');
@@ -537,7 +540,7 @@ CM.Sim.CheckOtherAchiev = function() {
if (CM.Sim.Has('Fortune cookies')) { if (CM.Sim.Has('Fortune cookies')) {
var list = Game.Tiers.fortune.upgrades; var list = Game.Tiers.fortune.upgrades;
var fortunes = 0; var fortunes = 0;
for (var i in list) { for (let i of Object.keys(list)) {
if (CM.Sim.Has(list[i].name)) fortunes++; if (CM.Sim.Has(list[i].name)) fortunes++;
} }
if (fortunes >= list.length) CM.Sim.Win('O Fortuna'); if (fortunes >= list.length) CM.Sim.Win('O Fortuna');
@@ -546,9 +549,9 @@ CM.Sim.CheckOtherAchiev = function() {
CM.Sim.BuyBuildings = function(amount, target) { CM.Sim.BuyBuildings = function(amount, target) {
CM.Cache[target] = []; CM.Cache[target] = [];
for (var i in Game.Objects) { for (let i of Object.keys(Game.Objects)) {
CM.Sim.CopyData(); CM.Sim.CopyData();
var me = CM.Sim.Objects[i]; let me = CM.Sim.Objects[i];
me.amount += amount; me.amount += amount;
if (i == 'Cursor') { if (i == 'Cursor') {
@@ -591,10 +594,10 @@ CM.Sim.BuyBuildings = function(amount, target) {
CM.Sim.BuyUpgrades = function() { CM.Sim.BuyUpgrades = function() {
CM.Cache.Upgrades = []; CM.Cache.Upgrades = [];
for (var i in Game.Upgrades) { for (let i of Object.keys(Game.Upgrades)) {
if (Game.Upgrades[i].pool == 'toggle' || (Game.Upgrades[i].bought == 0 && Game.Upgrades[i].unlocked && Game.Upgrades[i].pool != 'prestige')) { if (Game.Upgrades[i].pool == 'toggle' || (Game.Upgrades[i].bought == 0 && Game.Upgrades[i].unlocked && Game.Upgrades[i].pool != 'prestige')) {
CM.Sim.CopyData(); CM.Sim.CopyData();
var me = CM.Sim.Upgrades[i]; let me = CM.Sim.Upgrades[i];
me.bought = 1; me.bought = 1;
if (Game.CountsAsUpgradeOwned(Game.Upgrades[i].pool)) CM.Sim.UpgradesOwned++; if (Game.CountsAsUpgradeOwned(Game.Upgrades[i].pool)) CM.Sim.UpgradesOwned++;
@@ -647,20 +650,22 @@ CM.Sim.CalculateChangeAura = function(aura) {
else CM.Sim.dragonAura = aura; else CM.Sim.dragonAura = aura;
// Sell highest building but only if aura is different // Sell highest building but only if aura is different
let price = 0;
if (CM.Sim.dragonAura != CM.Cache.dragonAura || CM.Sim.dragonAura2 != CM.Cache.dragonAura2) { if (CM.Sim.dragonAura != CM.Cache.dragonAura || CM.Sim.dragonAura2 != CM.Cache.dragonAura2) {
for (var i = Game.ObjectsById.length; i > -1, --i;) { for (let i = Game.ObjectsById.length; i > -1, --i;) {
if (Game.ObjectsById[i].amount > 0) { if (Game.ObjectsById[i].amount > 0) {
var highestBuilding = CM.Sim.Objects[Game.ObjectsById[i].name].name; var highestBuilding = CM.Sim.Objects[Game.ObjectsById[i].name].name;
CM.Sim.Objects[highestBuilding].amount -=1; CM.Sim.Objects[highestBuilding].amount -=1;
CM.Sim.buildingsOwned -= 1; CM.Sim.buildingsOwned -= 1;
price = CM.Sim.Objects[highestBuilding].basePrice * Math.pow(Game.priceIncrease, Math.max(0, CM.Sim.Objects[highestBuilding].amount - 1 -CM.Sim.Objects[highestBuilding].free));
price = Game.modifyBuildingPrice(CM.Sim.Objects[highestBuilding], price);
price = Math.ceil(price);
break; break;
} }
} }
// This calculates price of highest building // This calculates price of highest building
var price = CM.Sim.Objects[highestBuilding].basePrice * Math.pow(Game.priceIncrease, Math.max(0, CM.Sim.Objects[highestBuilding].amount - 1 -CM.Sim.Objects[highestBuilding].free));
price = Game.modifyBuildingPrice(CM.Sim.Objects[highestBuilding], price); }
price = Math.ceil(price);
} else var price = 0;
var lastAchievementsOwned = CM.Sim.AchievementsOwned; var lastAchievementsOwned = CM.Sim.AchievementsOwned;
CM.Sim.CalculateGains(); CM.Sim.CalculateGains();
@@ -768,7 +773,7 @@ CM.Sim.modifyBuildingPrice = function(building,price) {
if (building.fortune && CM.Sim.Has(building.fortune.name)) price *= 0.93; if (building.fortune && CM.Sim.Has(building.fortune.name)) price *= 0.93;
price *= CM.Sim.eff('buildingCost'); price *= CM.Sim.eff('buildingCost');
if (CM.Sim.Objects.Temple.minigameLoaded) { if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = CM.Sim.hasGod('creation'); let godLvl = CM.Sim.hasGod('creation');
if (godLvl == 1) price *= 0.93; if (godLvl == 1) price *= 0.93;
else if (godLvl == 2) price *= 0.95; else if (godLvl == 2) price *= 0.95;
else if (godLvl == 3) price *= 0.98; else if (godLvl == 3) price *= 0.98;
@@ -792,7 +797,7 @@ CM.Sim.SellBuildingsForChoEgg = function() {
CM.Sim.dragonAura = 5; CM.Sim.dragonAura = 5;
CM.Sim.dragonAura2 = 18; CM.Sim.dragonAura2 = 18;
// Sacrifice highest buildings for the aura switch // Sacrifice highest buildings for the aura switch
for (var i = 0; i < buildingsToSacrifice; ++i) { for (let i = 0; i < buildingsToSacrifice; ++i) {
var highestBuilding = 0; var highestBuilding = 0;
for (var j in CM.Sim.Objects) { for (var j in CM.Sim.Objects) {
if (CM.Sim.Objects[j].amount > 0) { if (CM.Sim.Objects[j].amount > 0) {
@@ -804,8 +809,8 @@ CM.Sim.SellBuildingsForChoEgg = function() {
} }
// Get money made by selling all remaining buildings // Get money made by selling all remaining buildings
for (var i in CM.Sim.Objects) { for (let i of Object.keys(CM.Sim.Objects)) {
var me = CM.Sim.Objects[i]; let me = CM.Sim.Objects[i];
sellTotal += CM.Sim.BuildingSell(Game.Objects[me.name], Game.Objects[i].basePrice, me.amount, Game.Objects[i].free, me.amount); sellTotal += CM.Sim.BuildingSell(Game.Objects[me.name], Game.Objects[i].basePrice, me.amount, Game.Objects[i].free, me.amount);
} }
@@ -842,7 +847,7 @@ CM.Sim.mouseCps = function() {
if (CM.Sim.Has('Octillion fingers')) add *= 20; if (CM.Sim.Has('Octillion fingers')) add *= 20;
if (CM.Sim.Has('Nonillion fingers')) add *= 20; if (CM.Sim.Has('Nonillion fingers')) add *= 20;
var num=0; var num=0;
for (var i in CM.Sim.Objects) {num+=CM.Sim.Objects[i].amount;} for (let i of Object.keys(CM.Sim.Objects)) {num+=CM.Sim.Objects[i].amount;}
num -= CM.Sim.Objects.Cursor.amount; num -= CM.Sim.Objects.Cursor.amount;
add = add * num; add = add * num;
@@ -886,7 +891,7 @@ CM.Sim.mouseCps = function() {
} }
} }
for (var i in Game.buffs) for (let i of Object.keys(Game.buffs))
{ {
if (typeof Game.buffs[i].multClick != 'undefined') mult*=Game.buffs[i].multClick; if (typeof Game.buffs[i].multClick != 'undefined') mult*=Game.buffs[i].multClick;
} }