Merge pull request #579 from DanielNoord/annotate

Updated Cache.js
This commit is contained in:
Daniël van Noord
2021-02-19 00:00:12 +01:00
committed by GitHub
6 changed files with 460 additions and 454 deletions

File diff suppressed because one or more lines are too long

View File

@@ -15,8 +15,13 @@ CM.Cache.InitCache = function() {
CM.Cache.CacheDragonAuras(); CM.Cache.CacheDragonAuras();
CM.Cache.CacheWrinklers(); CM.Cache.CacheWrinklers();
CM.Cache.CacheStats(); CM.Cache.CacheStats();
CM.Cache.RemakeGoldenAndWrathCookiesMults();
CM.Cache.RemakeChain(); CM.Cache.RemakeChain();
CM.Cache.CacheMissingUpgrades(); CM.Cache.CacheMissingUpgrades();
CM.Cache.RemakeSeaSpec();
CM.Cache.RemakeIncome();
CM.Cache.RemakeBuildingsPrices();
CM.Cache.RemakePP();
}; };
/******** /********
@@ -57,12 +62,12 @@ CM.Cache.CacheWrinklers = function() {
if (Game.Has('Wrinklerspawn')) sucked *= 1.05; if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
if (CM.Sim.Objects.Temple.minigameLoaded) { if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = CM.Sim.hasGod('scorn'); var godLvl = CM.Sim.hasGod('scorn');
if (godLvl == 1) sucked *= 1.15; if (godLvl === 1) sucked *= 1.15;
else if (godLvl == 2) sucked *= 1.1; else if (godLvl === 2) sucked *= 1.1;
else if (godLvl == 3) sucked *= 1.05; else if (godLvl === 3) sucked *= 1.05;
} }
CM.Cache.WrinklersTotal += sucked; CM.Cache.WrinklersTotal += sucked;
if (Game.wrinklers[i].type == 0) { if (Game.wrinklers[i].type === 0) {
CM.Cache.WrinklersNormal += sucked; CM.Cache.WrinklersNormal += sucked;
if (sucked > CM.Cache.WrinklersFattest[0]) CM.Cache.WrinklersFattest = [sucked, i]; if (sucked > CM.Cache.WrinklersFattest[0]) CM.Cache.WrinklersFattest = [sucked, i];
} }
@@ -108,7 +113,7 @@ CM.Cache.CacheStats = function() {
if (Game.Objects[i].amount > 0) n++; if (Game.Objects[i].amount > 0) n++;
} }
for (let i of Object.keys(Game.Objects)) { for (let i of Object.keys(Game.Objects)) {
if ((Game.Objects[i].amount < max || n == 1) && if ((Game.Objects[i].amount < max || n === 1) &&
Game.Objects[i].amount < 400 && Game.Objects[i].amount < 400 &&
Game.Objects[i].price * 2 > CM.Cache.Edifice) { Game.Objects[i].price * 2 > CM.Cache.Edifice) {
CM.Cache.Edifice = Game.Objects[i].price * 2; CM.Cache.Edifice = Game.Objects[i].price * 2;
@@ -117,31 +122,86 @@ CM.Cache.CacheStats = function() {
} }
}; };
/**
* This functions calculates the multipliers of Golden and Wrath cookie rewards
* It is mostly used by CM.Cache.MaxChainMoni() and CM.Cache.RemakeChain()
* It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.RemakeChain()
* @param {number} CM.Cache.GoldenCookiesMult Multiplier for golden cookies
* @param {number} CM.Cache.WrathCookiesMult Multiplier for wrath cookies
* @param {number} CM.Cache.DragonsFortuneMultAdjustment Multiplier for dragon fortune + active golden cookie
*/
CM.Cache.RemakeGoldenAndWrathCookiesMults = function() {
if (CM.Footer.isInitzializing) {
CM.Cache.GoldenCookiesMult = 1;
CM.Cache.WrathCookiesMult = 1;
CM.Cache.DragonsFortuneMultAdjustment = 1;
} else {
var goldenMult = 1;
var wrathMult = 1;
var mult = 1;
// Factor auras and upgrade in mults
if (CM.Sim.Has('Green yeast digestives')) mult *= 1.01;
if (CM.Sim.Has('Dragon fang')) mult *= 1.03;
goldenMult *= 1 + CM.Sim.auraMult('Ancestral Metamorphosis') * 0.1;
goldenMult *= CM.Sim.eff('goldenCookieGain');
wrathMult *= 1 + CM.Sim.auraMult('Unholy Dominion') * 0.1;
wrathMult *= CM.Sim.eff('wrathCookieGain');
// Calculate final golden and wrath multipliers
CM.Cache.GoldenCookiesMult = mult * goldenMult;
CM.Cache.WrathCookiesMult = mult * wrathMult;
// Calculate Dragon's Fortune multiplier adjustment:
// If Dragon's Fortune (or Reality Bending) aura is active and there are currently no golden cookies,
// compute a multiplier adjustment to apply on the current CPS to simulate 1 golden cookie on screen.
// Otherwise, the aura effect will be factored in the base CPS making the multiplier not requiring adjustment.
CM.Cache.DragonsFortuneMultAdjustment = 1;
if (Game.shimmerTypes.golden.n === 0) {
CM.Cache.DragonsFortuneMultAdjustment *= 1 + CM.Sim.auraMult('Dragon\'s Fortune') * 1.23;
}
}
};
/** /**
* This functions calculates the max possible payout * This functions calculates the max possible payout
* It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.RemakeChain() * It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.RemakeChain()
* @param {number} digit * @param {number} digit Number of Golden Cookies in chain
* @param {number} maxPayout * @param {number} maxPayout Maximum payout
* @param {number} mult * @param {number} mult Multiplier
* @returns {number} moni Cookies to be earned with Cookie Chain * @returns [{number, number}] Total cookies earned, and cookies needed for next level
*/ */
CM.Cache.MaxChainMoni = function(digit, maxPayout, mult) { CM.Cache.MaxChainMoni = function(digit, maxPayout, mult) {
let totalFromChain = 0;
let moni = 0;
let nextMoni = 0;
var chain = 1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10); var chain = 1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10);
var moni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain) * digit * mult), maxPayout));
var nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain + 1) * digit * mult), maxPayout));
while (nextMoni < maxPayout) { while (nextMoni < maxPayout) {
chain++;
moni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain) * digit * mult), maxPayout)); moni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain) * digit * mult), maxPayout));
// TODO: Calculate Cookies or cps needed for next level of chain
nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain + 1) * digit * mult), maxPayout)); nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain + 1) * digit * mult), maxPayout));
totalFromChain += moni;
chain++;
} }
return [moni, nextMoni]; return [totalFromChain, nextMoni];
}; };
/** /**
* This functions caches data related to Chain Cookies reward from Golden Cookioes * This functions caches data related to Chain Cookies reward from Golden Cookioes
* It is called by CM.Loop() upon changes to cps and CM.Cache.InitCache() * It is called by CM.Loop() upon changes to cps and CM.Cache.InitCache()
* TODO: Fairly sure this is incorrect.. * @global [{number, number}] CM.Cache.ChainReward Total cookies earned, and cookies needed for next level for normal chain
* @global {number} CM.Cache.Chain Cookies required for max Cookie Chain normal * @global {number} CM.Cache.ChainRequired Cookies needed for maximum reward for normal chain
* @global {number} CM.Cache.ChainRequiredNext Total cookies needed for next level for normal chain
* @global [{number, number}] CM.Cache.ChainWrathReward Total cookies earned, and cookies needed for next level for wrath chain
* @global {number} CM.Cache.ChainWrathRequired Cookies needed for maximum reward for wrath chain
* @global {number} CM.Cache.ChainWrathRequiredNext Total cookies needed for next level for wrath chain
* @global [{number, number}] CM.Cache.ChainFrenzyReward Total cookies earned, and cookies needed for next level for normal frenzy chain
* @global {number} CM.Cache.ChainFrenzyRequired Cookies needed for maximum reward for normal frenzy chain
* @global {number} CM.Cache.ChainFrenzyRequiredNext Total cookies needed for next level for normal frenzy chain
* @global [{number, number}] CM.Cache.ChainFrenzyWrathReward Total cookies earned, and cookies needed for next level for wrath frenzy chain
* @global {number} CM.Cache.ChainFrenzyWrathRequired Cookies needed for maximum reward for wrath frenzy chain
* @global {number} CM.Cache.ChainFrenzyWrathRequiredNext Total cookies needed for next level for wrath frenzy chain
*/ */
CM.Cache.RemakeChain = function() { CM.Cache.RemakeChain = function() {
let maxPayout = CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6 * CM.Cache.DragonsFortuneMultAdjustment; let maxPayout = CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6 * CM.Cache.DragonsFortuneMultAdjustment;
@@ -150,19 +210,20 @@ CM.Cache.RemakeChain = function() {
if (cpsBuffMult > 0) maxPayout /= cpsBuffMult; if (cpsBuffMult > 0) maxPayout /= cpsBuffMult;
else maxPayout = 0; else maxPayout = 0;
CM.Cache.ChainReward = CM.Cache.MaxChainMoni(7, maxPayout, CM.Cache.GoldenCookiesMult); CM.Cache.ChainReward = CM.Cache.MaxChainMoni(7, maxPayout * CM.Cache.GoldenCookiesMult, CM.Cache.GoldenCookiesMult);
// TODO: All "required" variables are incorrect. Perhaps something to do with going over the required amount during the chain
CM.Cache.ChainRequired = CM.Cache.ChainReward[0] * 2; CM.Cache.ChainRequired = CM.Cache.ChainReward[0] * 2;
CM.Cache.ChainRequiredNext = CM.Cache.ChainReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment; CM.Cache.ChainRequiredNext = CM.Cache.ChainReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment;
CM.Cache.ChainWrathReward = CM.Cache.MaxChainMoni(6, maxPayout, CM.Cache.WrathCookiesMult); CM.Cache.ChainWrathReward = CM.Cache.MaxChainMoni(6, maxPayout * CM.Cache.WrathCookiesMult, CM.Cache.WrathCookiesMult);
CM.Cache.ChainWrathRequired = CM.Cache.ChainWrathReward[0] * 2; CM.Cache.ChainWrathRequired = CM.Cache.ChainWrathReward[0] * 2;
CM.Cache.ChainWrathRequiredNext = CM.Cache.ChainWrathReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment; CM.Cache.ChainWrathRequiredNext = CM.Cache.ChainWrathReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment;
CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7, CM.Cache.GoldenCookiesMult); CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7 * CM.Cache.GoldenCookiesMult, CM.Cache.GoldenCookiesMult);
CM.Cache.ChainFrenzyRequired = CM.Cache.ChainFrenzyReward[0] * 2; CM.Cache.ChainFrenzyRequired = CM.Cache.ChainFrenzyReward[0] * 2;
CM.Cache.ChainFrenzyRequiredNext = CM.Cache.ChainFrenzyReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment; CM.Cache.ChainFrenzyRequiredNext = CM.Cache.ChainFrenzyReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment;
CM.Cache.ChainFrenzyWrathReward = CM.Cache.MaxChainMoni(6, maxPayout * 7, CM.Cache.WrathCookiesMult); CM.Cache.ChainFrenzyWrathReward = CM.Cache.MaxChainMoni(6, maxPayout * 7 * CM.Cache.WrathCookiesMult, CM.Cache.WrathCookiesMult);
CM.Cache.ChainFrenzyWrathRequired = CM.Cache.ChainFrenzyReward[0] * 2; CM.Cache.ChainFrenzyWrathRequired = CM.Cache.ChainFrenzyReward[0] * 2;
CM.Cache.ChainFrenzyWrathRequiredNext = CM.Cache.ChainFrenzyReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment; CM.Cache.ChainFrenzyWrathRequiredNext = CM.Cache.ChainFrenzyReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment;
}; };
@@ -193,17 +254,32 @@ CM.Cache.CacheMissingUpgrades = function() {
for (let i of Object.keys(list)) { for (let i of Object.keys(list)) {
var me = list[i]; var me = list[i];
if (me.bought == 0) { if (me.bought === 0) {
var str = ''; var str = '';
str += CM.Disp.crateMissing(me); str += CM.Disp.crateMissing(me);
if (me.pool == 'prestige') CM.Cache.MissingUpgradesPrestige += str; if (me.pool === 'prestige') CM.Cache.MissingUpgradesPrestige += str;
else if (me.pool == 'cookie') CM.Cache.MissingUpgradesCookies += str; else if (me.pool === 'cookie') CM.Cache.MissingUpgradesCookies += str;
else if (me.pool != 'toggle' && me.pool != 'unused' && me.pool != 'debug') CM.Cache.MissingUpgrades += str; else if (me.pool != 'toggle' && me.pool != 'unused' && me.pool != 'debug') CM.Cache.MissingUpgrades += str;
} }
} }
}; };
/**
* This functions caches the reward of popping a reindeer
* It is called by CM.Loop() and CM.Cache.InitCache()
* @global {number} CM.Cache.SeaSpec The reward for popping a reindeer
*/
CM.Cache.RemakeSeaSpec = function() {
if (Game.season === 'christmas') {
var val = Game.cookiesPs * 60;
if (Game.hasBuff('Elder frenzy')) val *= 0.5;
if (Game.hasBuff('Frenzy')) val *= 0.75;
CM.Cache.SeaSpec = Math.max(25, val);
if (Game.Has('Ho ho ho-flavored frosting')) CM.Cache.SeaSpec *= 2;
}
};
/******** /********
* Section: Functions related to Caching CPS */ * Section: Functions related to Caching CPS */
@@ -253,8 +329,9 @@ CM.Cache.InitCookiesDiff = function() {
/** /**
* This functions caches two variables related average CPS and Clicks * This functions caches two variables related average CPS and Clicks
* * It is called by CM.Loop() * It is called by CM.Loop()
* TODO: Check if this can be made more concise * TODO: Check if this can be made more concise
* @global {number} CM.Cache.RealCookiesEarned Cookies earned including the Chocolate Egg
* @global {number} CM.Cache.AvgCPS Average cookies over time-period as defined by AvgCPSHist * @global {number} CM.Cache.AvgCPS Average cookies over time-period as defined by AvgCPSHist
* @global {number} CM.Cache.AverageClicks Average cookies from clicking over time-period as defined by AvgClicksHist * @global {number} CM.Cache.AverageClicks Average cookies from clicking over time-period as defined by AvgClicksHist
* @global {number} CM.Cache.AvgCPSChoEgg Average cookies from combination of normal CPS and average Chocolate Cookie CPS * @global {number} CM.Cache.AvgCPSChoEgg Average cookies from combination of normal CPS and average Chocolate Cookie CPS
@@ -262,7 +339,7 @@ CM.Cache.InitCookiesDiff = function() {
CM.Cache.UpdateAvgCPS = function() { CM.Cache.UpdateAvgCPS = function() {
var currDate = Math.floor(Date.now() / 1000); var currDate = Math.floor(Date.now() / 1000);
// Only calculate every new second // Only calculate every new second
if ((Game.T / Game.fps) % 1 == 0) { if ((Game.T / Game.fps) % 1 === 0) {
var choEggTotal = Game.cookies + CM.Cache.SellForChoEgg; var choEggTotal = Game.cookies + CM.Cache.SellForChoEgg;
if (Game.cpsSucked > 0) { if (Game.cpsSucked > 0) {
choEggTotal += CM.Cache.WrinklersTotal; choEggTotal += CM.Cache.WrinklersTotal;
@@ -300,12 +377,12 @@ CM.Cache.UpdateAvgCPS = function() {
CM.Cache.AverageGainChoEgg = CM.Cache.ChoEggDiff.calcAverage(cpsLength); CM.Cache.AverageGainChoEgg = CM.Cache.ChoEggDiff.calcAverage(cpsLength);
CM.Cache.AvgCPS = CM.Cache.AverageGainBank; CM.Cache.AvgCPS = CM.Cache.AverageGainBank;
if (CM.Options.CalcWrink == 1) CM.Cache.AvgCPS += CM.Cache.AverageGainWrink; if (CM.Options.CalcWrink === 1) CM.Cache.AvgCPS += CM.Cache.AverageGainWrink;
if (CM.Options.CalcWrink == 2) CM.Cache.AvgCPS += CM.Cache.AverageGainWrinkFattest; if (CM.Options.CalcWrink === 2) CM.Cache.AvgCPS += CM.Cache.AverageGainWrinkFattest;
var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg'));
if (choEgg || CM.Options.CalcWrink == 0) { if (choEgg || CM.Options.CalcWrink === 0) {
CM.Cache.AvgCPSWithChoEgg = CM.Cache.AverageGainBank + CM.Cache.AverageGainWrink + (choEgg ? CM.Cache.AverageGainChoEgg : 0); CM.Cache.AvgCPSWithChoEgg = CM.Cache.AverageGainBank + CM.Cache.AverageGainWrink + (choEgg ? CM.Cache.AverageGainChoEgg : 0);
} }
else CM.Cache.AvgCPSWithChoEgg = CM.Cache.AvgCPS; else CM.Cache.AvgCPSWithChoEgg = CM.Cache.AvgCPS;
@@ -314,6 +391,28 @@ CM.Cache.UpdateAvgCPS = function() {
} }
}; };
/**
* This functions caches the reward for selling the Chocolate egg
* It is called by CM.Loop()
* @global {number} CM.Cache.SellForChoEgg Total cookies to be gained from selling Chocolate egg
*/
CM.Cache.RemakeSellForChoEgg = function() {
var sellTotal = 0;
// Compute cookies earned by selling stock market goods
if (Game.Objects.Bank.minigameLoaded) {
var marketGoods = Game.Objects.Bank.minigame.goods;
var goodsVal = 0;
for (let i of Object.keys(marketGoods)) {
var marketGood = marketGoods[i];
goodsVal += marketGood.stock * marketGood.val;
}
sellTotal += goodsVal * Game.cookiesPsRawHighest;
}
// Compute cookies earned by selling all buildings with optimal auras (ES + RB)
sellTotal += CM.Sim.SellBuildingsForChoEgg();
CM.Cache.SellForChoEgg = sellTotal;
};
/** /**
* This functions caches the current Wrinkler CPS multiplier * This functions caches the current Wrinkler CPS multiplier
* It is called by CM.Loop(). Variables are mostly used by CM.Disp.GetCPS(). * It is called by CM.Loop(). Variables are mostly used by CM.Disp.GetCPS().
@@ -324,14 +423,14 @@ CM.Cache.UpdateCurrWrinklerCPS = function() {
CM.Cache.CurrWrinklerCPSMult = 0; CM.Cache.CurrWrinklerCPSMult = 0;
let count = 0; let count = 0;
for (let i in Game.wrinklers) { for (let i in Game.wrinklers) {
if (Game.wrinklers[i].phase == 2) count++; if (Game.wrinklers[i].phase === 2) count++;
} }
let godMult = 1; let godMult = 1;
if (CM.Sim.Objects.Temple.minigameLoaded) { if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = CM.Sim.hasGod('scorn'); var godLvl = CM.Sim.hasGod('scorn');
if (godLvl == 1) godMult *= 1.15; if (godLvl === 1) godMult *= 1.15;
else if (godLvl == 2) godMult *= 1.1; else if (godLvl === 2) godMult *= 1.1;
else if (godLvl == 3) godMult *= 1.05; else if (godLvl === 3) godMult *= 1.05;
} }
CM.Cache.CurrWrinklerCount = count; CM.Cache.CurrWrinklerCount = count;
CM.Cache.CurrWrinklerCPSMult = count * (count * 0.05 * 1.1) * (Game.Has('Sacrilegious corruption') * 0.05 + 1) * (Game.Has('Wrinklerspawn') * 0.05 + 1) * godMult; CM.Cache.CurrWrinklerCPSMult = count * (count * 0.05 * 1.1) * (Game.Has('Sacrilegious corruption') * 0.05 + 1) * (Game.Has('Wrinklerspawn') * 0.05 + 1) * godMult;
@@ -396,11 +495,29 @@ CM.Cache.CacheDragonCost = function() {
}; };
/******** /********
* Section: ? */ * Section: Functions related to caching income */
/**
* This functions caches the income gain of each building and upgrade and stores it in the cache
* It is called by CM.Loop() and CM.Cache.InitCache()
*/
CM.Cache.RemakeIncome = function() {
// Simulate Building Buys for 1, 10 and 100 amount
CM.Sim.BuyBuildings(1, 'Objects1');
CM.Sim.BuyBuildings(10, 'Objects10');
CM.Sim.BuyBuildings(100, 'Objects100');
// Simulate Upgrade Buys
CM.Sim.BuyUpgrades();
};
/******** /********
* Section: UNSORTED */ * Section: Functions related to caching prices */
/**
* This functions caches the price of each building and stores it in the cache
* It is called by CM.Loop() and CM.Cache.InitCache()
*/
CM.Cache.RemakeBuildingsPrices = function() { CM.Cache.RemakeBuildingsPrices = function() {
for (let i of Object.keys(Game.Objects)) { for (let i of Object.keys(Game.Objects)) {
CM.Cache.Objects1[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 1); CM.Cache.Objects1[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 1);
@@ -409,157 +526,86 @@ CM.Cache.RemakeBuildingsPrices = function() {
} }
}; };
CM.Cache.RemakeIncome = function() { /********
// Simulate Building Buys for 1 amount * Section: Functions related to caching PP */
CM.Sim.BuyBuildings(1, 'Objects1');
// Simulate Upgrade Buys /**
CM.Sim.BuyUpgrades(); * This functions caches the PP of each building and upgrade and stores it in the cache
* It is called by CM.Loop() and CM.Cache.InitCache()
// Simulate Building Buys for 10 amount */
CM.Sim.BuyBuildings(10, 'Objects10'); CM.Cache.RemakePP = function() {
CM.Cache.RemakeBuildingsPP();
// Simulate Building Buys for 100 amount CM.Cache.RemakeUpgradePP();
CM.Sim.BuyBuildings(100, 'Objects100');
}; };
/**
* This functions caches the PP of each building it saves all date in CM.Cache.Objects...
* It is called by CM.Cache.RemakePP()
*/
CM.Cache.RemakeBuildingsPP = function() { CM.Cache.RemakeBuildingsPP = function() {
CM.Cache.min = -1; CM.Cache.min = -1;
CM.Cache.max = -1; CM.Cache.max = -1;
CM.Cache.mid = -1; CM.Cache.mid = -1;
// Calculate PP and colors when compared to purchase of single optimal building // Calculate PP and colors when compared to purchase of optimal building in single-purchase mode
if (CM.Options.ColorPPBulkMode == 0) { if (CM.Options.ColorPPBulkMode === 0) {
for (let i of Object.keys(CM.Cache.Objects1)) { for (let i of Object.keys(CM.Cache.Objects1)) {
//CM.Cache.Objects1[i].pp = Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus;
if (Game.cookiesPs) { if (Game.cookiesPs) {
CM.Cache.Objects1[i].pp = (Math.max(Game.Objects[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus); CM.Cache.Objects1[i].pp = (Math.max(Game.Objects[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus);
} else { } else CM.Cache.Objects1[i].pp = (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus);
CM.Cache.Objects1[i].pp = (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus); if (CM.Cache.min === -1 || CM.Cache.Objects1[i].pp < CM.Cache.min) CM.Cache.min = CM.Cache.Objects1[i].pp;
} if (CM.Cache.max === -1 || CM.Cache.Objects1[i].pp > CM.Cache.max) CM.Cache.max = CM.Cache.Objects1[i].pp;
if (CM.Cache.min == -1 || CM.Cache.Objects1[i].pp < CM.Cache.min) CM.Cache.min = CM.Cache.Objects1[i].pp;
if (CM.Cache.max == -1 || CM.Cache.Objects1[i].pp > CM.Cache.max) CM.Cache.max = CM.Cache.Objects1[i].pp;
} }
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min; CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
for (let i of Object.keys(CM.Cache.Objects1)) { for (let i of Object.keys(CM.Cache.Objects1)) {
let color = ''; let color = '';
if (CM.Cache.Objects1[i].pp == CM.Cache.min) color = CM.Disp.colorGreen; if (CM.Cache.Objects1[i].pp === CM.Cache.min) color = CM.Disp.colorGreen;
else if (CM.Cache.Objects1[i].pp == CM.Cache.max) color = CM.Disp.colorRed; else if (CM.Cache.Objects1[i].pp === CM.Cache.max) color = CM.Disp.colorRed;
else if (CM.Cache.Objects1[i].pp > CM.Cache.mid) color = CM.Disp.colorOrange; else if (CM.Cache.Objects1[i].pp > CM.Cache.mid) color = CM.Disp.colorOrange;
else color = CM.Disp.colorYellow; else color = CM.Disp.colorYellow;
CM.Cache.Objects1[i].color = color; CM.Cache.Objects1[i].color = color;
} }
// Buildings for 10 amount // Calculate PP of bulk-buy modes
CM.Cache.RemakeBuildingsOtherPP(10, 'Objects10'); CM.Cache.RemakeBuildingsBulkPP('Objects10');
CM.Cache.RemakeBuildingsBulkPP('Objects100');
// Buildings for 100 amount
CM.Cache.RemakeBuildingsOtherPP(100, 'Objects100');
} }
// Calculate PP and colors when compared to purchase of selected bulk mode // Calculate PP and colors when compared to purchase of selected bulk mode
else { else {
if (Game.buyBulk == 1) { let target = `Objects${Game.buyBulk}`
for (let i of Object.keys(CM.Cache.Objects1)) { for (let i of Object.keys(CM.Cache[target])) {
//CM.Cache.Objects1[i].pp = Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus; if (Game.cookiesPs) {
if (Game.cookiesPs) { CM.Cache[target][i].pp = (Math.max(Game.Objects[i].bulkPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].bulkPrice / CM.Cache[target][i].bonus);
CM.Cache.Objects1[i].pp = (Math.max(Game.Objects[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus); } else CM.CM.Cache[target][i].pp = (Game.Objects[i].bulkPrice / CM.Cache[target][i].bonus);
} else { if (CM.Cache.min === -1 || CM.Cache[target][i].pp < CM.Cache.min) CM.Cache.min = CM.Cache[target][i].pp;
CM.Cache.Objects1[i].pp = (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus); if (CM.Cache.max === -1 || CM.Cache[target][i].pp > CM.Cache.max) CM.Cache.max = CM.Cache[target][i].pp;
}
if (CM.Cache.min == -1 || CM.Cache.Objects1[i].pp < CM.Cache.min) CM.Cache.min = CM.Cache.Objects1[i].pp;
if (CM.Cache.max == -1 || CM.Cache.Objects1[i].pp > CM.Cache.max) CM.Cache.max = CM.Cache.Objects1[i].pp;
}
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
for (let i of Object.keys(CM.Cache.Objects1)) {
let color = '';
if (CM.Cache.Objects1[i].pp == CM.Cache.min) color = CM.Disp.colorGreen;
else if (CM.Cache.Objects1[i].pp == CM.Cache.max) color = CM.Disp.colorRed;
else if (CM.Cache.Objects1[i].pp > CM.Cache.mid) color = CM.Disp.colorOrange;
else color = CM.Disp.colorYellow;
CM.Cache.Objects1[i].color = color;
}
CM.Cache.RemakeBuildingsOtherPP(10, 'Objects10');
CM.Cache.RemakeBuildingsOtherPP(100, 'Objects100');
} }
else if (Game.buyBulk == 10) { CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
for (let i of Object.keys(CM.Cache.Objects1)) { for (let i of Object.keys(CM.Cache.Objects1)) {
if (Game.cookiesPs) { let color = '';
CM.Cache.Objects10[i].pp = (Math.max(Game.Objects[i].bulkPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].bulkPrice / CM.Cache.Objects10[i].bonus); if (CM.Cache[target][i].pp === CM.Cache.min) color = CM.Disp.colorGreen;
} else { else if (CM.Cache[target][i].pp === CM.Cache.max) color = CM.Disp.colorRed;
CM.Cache.Objects10[i].pp = (Game.Objects[i].bulkPrice / CM.Cache.Objects10[i].bonus); else if (CM.Cache[target][i].pp > CM.Cache.mid) color = CM.Disp.colorOrange;
} else color = CM.Disp.colorYellow;
if (CM.Cache.min == -1 || CM.Cache.Objects10[i].pp < CM.Cache.min) CM.Cache.min = CM.Cache.Objects10[i].pp; CM.Cache[target][i].color = color;
if (CM.Cache.max == -1 || CM.Cache.Objects10[i].pp > CM.Cache.max) CM.Cache.max = CM.Cache.Objects10[i].pp;
}
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
for (let i of Object.keys(CM.Cache.Objects1)) {
let color = '';
if (CM.Cache.Objects10[i].pp == CM.Cache.min) color = CM.Disp.colorGreen;
else if (CM.Cache.Objects10[i].pp == CM.Cache.max) color = CM.Disp.colorRed;
else if (CM.Cache.Objects10[i].pp > CM.Cache.mid) color = CM.Disp.colorOrange;
else color = CM.Disp.colorYellow;
CM.Cache.Objects10[i].color = color;
}
CM.Cache.RemakeBuildingsOtherPP(1, 'Objects');
CM.Cache.RemakeBuildingsOtherPP(100, 'Objects100');
}
else if (Game.buyBulk == 100) {
for (let i of Object.keys(CM.Cache.Objects1)) {
if (Game.cookiesPs) {
CM.Cache.Objects100[i].pp = (Math.max(Game.Objects[i].bulkPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].bulkPrice / CM.Cache.Objects100[i].bonus);
} else {
CM.Cache.Objects100[i].pp = (Game.Objects[i].bulkPrice / CM.Cache.Objects100[i].bonus);
}
if (CM.Cache.min == -1 || CM.Cache.Objects100[i].pp < CM.Cache.min) CM.Cache.min = CM.Cache.Objects100[i].pp;
if (CM.Cache.max == -1 || CM.Cache.Objects100[i].pp > CM.Cache.max) CM.Cache.max = CM.Cache.Objects100[i].pp;
}
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
for (let i of Object.keys(CM.Cache.Objects1)) {
let color = '';
if (CM.Cache.Objects100[i].pp == CM.Cache.min) color = CM.Disp.colorGreen;
else if (CM.Cache.Objects100[i].pp == CM.Cache.max) color = CM.Disp.colorRed;
else if (CM.Cache.Objects100[i].pp > CM.Cache.mid) color = CM.Disp.colorOrange;
else color = CM.Disp.colorYellow;
CM.Cache.Objects100[i].color = color;
}
CM.Cache.RemakeBuildingsOtherPP(1, 'Objects');
CM.Cache.RemakeBuildingsOtherPP(10, 'Objects10');
} }
} }
}; };
CM.Cache.RemakeUpgradePP = function() { /**
for (let i of Object.keys(CM.Cache.Upgrades)) { * This functions caches the buildings of bulk-buy mode when PP is compared against optimal single-purchase building
//CM.Cache.Upgrades[i].pp = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus; * It saves all date in CM.Cache.Objects...
if (Game.cookiesPs) { * It is called by CM.Cache.RemakeBuildingsPP()
CM.Cache.Upgrades[i].pp = (Math.max(Game.Upgrades[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus); */
} else { CM.Cache.RemakeBuildingsBulkPP = function(target) {
CM.Cache.Upgrades[i].pp = (Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus);
}
if (isNaN(CM.Cache.Upgrades[i].pp)) CM.Cache.Upgrades[i].pp = Infinity;
let color = '';
if (CM.Cache.Upgrades[i].pp <= 0 || CM.Cache.Upgrades[i].pp == Infinity) color = CM.Disp.colorGray;
else if (CM.Cache.Upgrades[i].pp < CM.Cache.min) color = CM.Disp.colorBlue;
else if (CM.Cache.Upgrades[i].pp == CM.Cache.min) color = CM.Disp.colorGreen;
else if (CM.Cache.Upgrades[i].pp == CM.Cache.max) color = CM.Disp.colorRed;
else if (CM.Cache.Upgrades[i].pp > CM.Cache.max) color = CM.Disp.colorPurple;
else if (CM.Cache.Upgrades[i].pp > CM.Cache.mid) color = CM.Disp.colorOrange;
else color = CM.Disp.colorYellow;
CM.Cache.Upgrades[i].color = color;
}
};
CM.Cache.RemakeBuildingsOtherPP = function(amount, target) {
for (let i of Object.keys(CM.Cache[target])) { for (let i of Object.keys(CM.Cache[target])) {
//CM.Cache[target][i].pp = CM.Cache[target][i].price / CM.Cache[target][i].bonus;
if (Game.cookiesPs) { if (Game.cookiesPs) {
CM.Cache[target][i].pp = (Math.max(CM.Cache[target][i].price - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (CM.Cache[target][i].price / CM.Cache[target][i].bonus); CM.Cache[target][i].pp = (Math.max(CM.Cache[target][i].price - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (CM.Cache[target][i].price / CM.Cache[target][i].bonus);
} else { } else CM.Cache[target][i].pp = (CM.Cache[target][i].price / CM.Cache[target][i].bonus);
CM.Cache[target][i].pp = (CM.Cache[target][i].price / CM.Cache[target][i].bonus);
}
let color = ''; let color = '';
if (CM.Cache[target][i].pp <= 0 || CM.Cache[target][i].pp == Infinity) color = CM.Disp.colorGray; if (CM.Cache[target][i].pp <= 0 || CM.Cache[target][i].pp === Infinity) color = CM.Disp.colorGray;
else if (CM.Cache[target][i].pp < CM.Cache.min) color = CM.Disp.colorBlue; else if (CM.Cache[target][i].pp < CM.Cache.min) color = CM.Disp.colorBlue;
else if (CM.Cache[target][i].pp == CM.Cache.min) color = CM.Disp.colorGreen; else if (CM.Cache[target][i].pp === CM.Cache.min) color = CM.Disp.colorGreen;
else if (CM.Cache[target][i].pp == CM.Cache.max) color = CM.Disp.colorRed; else if (CM.Cache[target][i].pp === CM.Cache.max) color = CM.Disp.colorRed;
else if (CM.Cache[target][i].pp > CM.Cache.max) color = CM.Disp.colorPurple; else if (CM.Cache[target][i].pp > CM.Cache.max) color = CM.Disp.colorPurple;
else if (CM.Cache[target][i].pp > CM.Cache.mid) color = CM.Disp.colorOrange; else if (CM.Cache[target][i].pp > CM.Cache.mid) color = CM.Disp.colorOrange;
else color = CM.Disp.colorYellow; else color = CM.Disp.colorYellow;
@@ -567,89 +613,42 @@ CM.Cache.RemakeBuildingsOtherPP = function(amount, target) {
} }
}; };
CM.Cache.RemakePP = function() { /**
// Buildings * This functions caches the PP of each building it saves all date in CM.Cache.Upgrades
CM.Cache.RemakeBuildingsPP(); * It is called by CM.Cache.RemakePP()
*/
// Upgrades CM.Cache.RemakeUpgradePP = function() {
CM.Cache.RemakeUpgradePP(); for (let i of Object.keys(CM.Cache.Upgrades)) {
}; if (Game.cookiesPs) {
CM.Cache.Upgrades[i].pp = (Math.max(Game.Upgrades[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus);
CM.Cache.RemakeGoldenAndWrathCookiesMults = function() { } else CM.Cache.Upgrades[i].pp = (Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus);
var goldenMult = 1; if (isNaN(CM.Cache.Upgrades[i].pp)) CM.Cache.Upgrades[i].pp = Infinity;
var wrathMult = 1; let color = '';
var mult = 1; if (CM.Cache.Upgrades[i].pp <= 0 || CM.Cache.Upgrades[i].pp === Infinity) color = CM.Disp.colorGray;
else if (CM.Cache.Upgrades[i].pp < CM.Cache.min) color = CM.Disp.colorBlue;
// Factor auras and upgrade in mults else if (CM.Cache.Upgrades[i].pp === CM.Cache.min) color = CM.Disp.colorGreen;
if (CM.Sim.Has('Green yeast digestives')) mult *= 1.01; else if (CM.Cache.Upgrades[i].pp === CM.Cache.max) color = CM.Disp.colorRed;
if (CM.Sim.Has('Dragon fang')) mult *= 1.03; else if (CM.Cache.Upgrades[i].pp > CM.Cache.max) color = CM.Disp.colorPurple;
else if (CM.Cache.Upgrades[i].pp > CM.Cache.mid) color = CM.Disp.colorOrange;
goldenMult *= 1 + CM.Sim.auraMult('Ancestral Metamorphosis') * 0.1; else color = CM.Disp.colorYellow;
goldenMult *= CM.Sim.eff('goldenCookieGain'); CM.Cache.Upgrades[i].color = color;
wrathMult *= 1 + CM.Sim.auraMult('Unholy Dominion') * 0.1;
wrathMult *= CM.Sim.eff('wrathCookieGain');
// Calculate final golden and wrath multipliers
CM.Cache.GoldenCookiesMult = mult * goldenMult;
CM.Cache.WrathCookiesMult = mult * wrathMult;
// Calculate Dragon's Fortune multiplier adjustment:
// If Dragon's Fortune (or Reality Bending) aura is active and there are currently no golden cookies,
// compute a multiplier adjustment to apply on the current CPS to simulate 1 golden cookie on screen.
// Otherwise, the aura effect will be factored in the base CPS making the multiplier not requiring adjustment.
CM.Cache.DragonsFortuneMultAdjustment = 1;
if (Game.shimmerTypes.golden.n === 0) {
CM.Cache.DragonsFortuneMultAdjustment *= 1 + CM.Sim.auraMult('Dragon\'s Fortune') * 1.23;
} }
}; };
CM.Cache.RemakeSeaSpec = function() { /********
if (Game.season == 'christmas') { * Section: Cached variables */
var val = Game.cookiesPs * 60;
if (Game.hasBuff('Elder frenzy')) val *= 0.5; // very sorry
if (Game.hasBuff('Frenzy')) val *= 0.75; // I sincerely apologize
CM.Cache.SeaSpec = Math.max(25, val);
if (Game.Has('Ho ho ho-flavored frosting')) CM.Cache.SeaSpec *= 2;
}
};
CM.Cache.RemakeSellForChoEgg = function() { /**
var sellTotal = 0; * Used to store the multiplier of the Century Egg
// Compute cookies earned by selling stock market goods */
if (Game.Objects.Bank.minigameLoaded) {
var marketGoods = Game.Objects.Bank.minigame.goods;
var goodsVal = 0;
for (let i of Object.keys(marketGoods)) {
var marketGood = marketGoods[i];
goodsVal += marketGood.stock * marketGood.val;
}
sellTotal += goodsVal * Game.cookiesPsRawHighest;
}
// Compute cookies earned by selling all buildings with optimal auras (ES + RB)
sellTotal += CM.Sim.SellBuildingsForChoEgg();
CM.Cache.SellForChoEgg = sellTotal;
};
CM.Cache.min = -1;
CM.Cache.max = -1;
CM.Cache.mid = -1;
CM.Cache.GoldenCookiesMult = 1;
CM.Cache.WrathCookiesMult = 1;
CM.Cache.DragonsFortuneMultAdjustment = 1;
CM.Cache.NoGoldSwitchCookiesPS = 0;
CM.Cache.SeaSpec = 0;
CM.Cache.Chain = 0;
CM.Cache.ChainWrath = 0;
CM.Cache.ChainReward = 0;
CM.Cache.ChainWrathReward = 0;
CM.Cache.ChainFrenzy = 0;
CM.Cache.ChainFrenzyWrath = 0;
CM.Cache.ChainFrenzyReward = 0;
CM.Cache.ChainFrenzyWrathReward = 0;
CM.Cache.CentEgg = 0; CM.Cache.CentEgg = 0;
CM.Cache.SellForChoEgg = 0;
CM.Cache.Title = ''; /**
* Used to store if there was a Build Aura (used in CM.Main)
*/
CM.Cache.HadBuildAura = false; CM.Cache.HadBuildAura = false;
CM.Cache.RealCookiesEarned = -1;
CM.Cache.goldenShimmersByID = {}; /**
CM.Cache.spawnedGoldenShimmer = 0; * Used to store CPS without Golden Cookie Switch
*/
CM.Cache.NoGoldSwitchCookiesPS = 0;

View File

@@ -40,7 +40,7 @@ CM.Config.LoadConfig = function(settings) {
CM.Options[i] = CM.Data.ConfigDefault[i]; CM.Options[i] = CM.Data.ConfigDefault[i];
} }
else if (i != 'Header' && i != 'Colors') { else if (i != 'Header' && i != 'Colors') {
if (i.indexOf('SoundURL') == -1) { if (i.indexOf('SoundURL') === -1) {
if (!(CM.Options[i] > -1 && CM.Options[i] < CM.ConfigData[i].label.length)) { if (!(CM.Options[i] > -1 && CM.Options[i] < CM.ConfigData[i].label.length)) {
mod = true; mod = true;
CM.Options[i] = CM.Data.ConfigDefault[i]; CM.Options[i] = CM.Data.ConfigDefault[i];
@@ -53,7 +53,7 @@ CM.Config.LoadConfig = function(settings) {
} }
} }
} }
else if (i == 'Header') { else if (i === 'Header') {
for (let j in CM.Data.ConfigDefault.Header) { for (let j in CM.Data.ConfigDefault.Header) {
if (typeof CM.Options[i][j] === 'undefined' || !(CM.Options[i][j] > -1 && CM.Options[i][j] < 2)) { if (typeof CM.Options[i][j] === 'undefined' || !(CM.Options[i][j] > -1 && CM.Options[i][j] < 2)) {
mod = true; mod = true;
@@ -104,7 +104,7 @@ CM.Config.RestoreDefault = function() {
CM.Config.ToggleConfig = function(config) { CM.Config.ToggleConfig = function(config) {
CM.Options[config]++; CM.Options[config]++;
if (CM.Options[config] == CM.ConfigData[config].label.length) { if (CM.Options[config] === CM.ConfigData[config].label.length) {
CM.Options[config] = 0; CM.Options[config] = 0;
if (CM.ConfigData[config].toggle) l(CM.Config.ConfigPrefix + config).className = 'option off'; if (CM.ConfigData[config].toggle) l(CM.Config.ConfigPrefix + config).className = 'option off';
} }
@@ -152,7 +152,7 @@ CM.Config.ToggleHeader = function(config) {
* @param {number} ToggleOnOff A number indicating whether the option has been turned off (0) or on (1) * @param {number} ToggleOnOff A number indicating whether the option has been turned off (0) or on (1)
*/ */
CM.Config.CheckNotificationPermissions = function(ToggleOnOff) { CM.Config.CheckNotificationPermissions = function(ToggleOnOff) {
if (ToggleOnOff == 1) { if (ToggleOnOff === 1) {
// Check if browser support Promise version of Notification Permissions // Check if browser support Promise version of Notification Permissions
let checkNotificationPromise = function () { let checkNotificationPromise = function () {
try { try {

View File

@@ -16,9 +16,9 @@
* @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinklersTotal) * @returns {number} 0 or the amount of cookies stored (CM.Cache.WrinklersTotal)
*/ */
CM.Disp.GetWrinkConfigBank = function() { CM.Disp.GetWrinkConfigBank = function() {
if (CM.Options.CalcWrink == 1) { if (CM.Options.CalcWrink === 1) {
return CM.Cache.WrinklersTotal;} return CM.Cache.WrinklersTotal;}
else if (CM.Options.CalcWrink == 2) { else if (CM.Options.CalcWrink === 2) {
return CM.Cache.WrinklersFattest[0];} return CM.Cache.WrinklersFattest[0];}
else { else {
return 0;} return 0;}
@@ -30,7 +30,7 @@ CM.Disp.GetWrinkConfigBank = function() {
*/ */
CM.Disp.PopAllNormalWrinklers = function() { CM.Disp.PopAllNormalWrinklers = function() {
for (let i of Object.keys(Game.wrinklers)) { for (let i of Object.keys(Game.wrinklers)) {
if (Game.wrinklers[i].sucked > 0 && Game.wrinklers[i].type == 0) { if (Game.wrinklers[i].sucked > 0 && Game.wrinklers[i].type === 0) {
Game.wrinklers[i].hp = 0; Game.wrinklers[i].hp = 0;
} }
} }
@@ -44,15 +44,15 @@ CM.Disp.GetCPS = function() {
if (CM.Options.CPSMode) { if (CM.Options.CPSMode) {
return CM.Cache.AvgCPS;} return CM.Cache.AvgCPS;}
else { else {
if (CM.Options.CalcWrink == 0) { if (CM.Options.CalcWrink === 0) {
return (Game.cookiesPs * (1 - Game.cpsSucked)); return (Game.cookiesPs * (1 - Game.cpsSucked));
} }
else if (CM.Options.CalcWrink == 1) { else if (CM.Options.CalcWrink === 1) {
return Game.cookiesPs * (CM.Cache.CurrWrinklerCPSMult + (1 - (CM.Cache.CurrWrinklerCount * 0.05))); return Game.cookiesPs * (CM.Cache.CurrWrinklerCPSMult + (1 - (CM.Cache.CurrWrinklerCount * 0.05)));
} }
else if (CM.Options.CalcWrink == 2) { else if (CM.Options.CalcWrink === 2) {
// Check if fattest is shiny // Check if fattest is shiny
if (Game.wrinklers[CM.Cache.WrinklersFattest[1]].type == 1) { if (Game.wrinklers[CM.Cache.WrinklersFattest[1]].type === 1) {
return Game.cookiesPs * ((CM.Cache.CurrWrinklerCPSMult * 3 / CM.Cache.CurrWrinklerCount) + (1 - (CM.Cache.CurrWrinklerCount * 0.05))); return Game.cookiesPs * ((CM.Cache.CurrWrinklerCPSMult * 3 / CM.Cache.CurrWrinklerCount) + (1 - (CM.Cache.CurrWrinklerCount * 0.05)));
} }
else { else {
@@ -130,7 +130,7 @@ CM.Disp.GetLumpColor = function(type) {
* @returns {string} Formatted time * @returns {string} Formatted time
*/ */
CM.Disp.FormatTime = function(time, longFormat) { CM.Disp.FormatTime = function(time, longFormat) {
if (time == Infinity) return time; if (time === Infinity) return time;
time = Math.ceil(time); time = Math.ceil(time);
var y = Math.floor(time / 31557600); var y = Math.floor(time / 31557600);
var d = Math.floor(time % 31557600 / 86400); var d = Math.floor(time % 31557600 / 86400);
@@ -147,11 +147,11 @@ CM.Disp.FormatTime = function(time, longFormat) {
str += (s < 10 ? '0' : '') + s; str += (s < 10 ? '0' : '') + s;
} else { } else {
if (time > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d'; if (time > 777600000) return longFormat ? 'Over 9000 days!' : '>9000d';
str += (y > 0 ? y + (longFormat ? (y == 1 ? ' year' : ' years') : 'y') + ', ': ""); str += (y > 0 ? y + (longFormat ? (y === 1 ? ' year' : ' years') : 'y') + ', ': "");
str += (d > 0 ? d + (longFormat ? (d == 1 ? ' day' : ' days') : 'd') + ', ': ""); str += (d > 0 ? d + (longFormat ? (d === 1 ? ' day' : ' days') : 'd') + ', ': "");
if (str.length > 0 || h > 0) str += h + (longFormat ? (h == 1 ? ' hour' : ' hours') : 'h') + ', '; if (str.length > 0 || h > 0) str += h + (longFormat ? (h === 1 ? ' hour' : ' hours') : 'h') + ', ';
if (str.length > 0 || m > 0) str += m + (longFormat ? (m == 1 ? ' minute' : ' minutes') : 'm') + ', '; if (str.length > 0 || m > 0) str += m + (longFormat ? (m === 1 ? ' minute' : ' minutes') : 'm') + ', ';
str += s + (longFormat ? (s == 1 ? ' second' : ' seconds') : 's'); str += s + (longFormat ? (s === 1 ? ' second' : ' seconds') : 's');
} }
return str; return str;
}; };
@@ -187,23 +187,23 @@ CM.Disp.GetTimeColor = function(time) {
*/ */
CM.Disp.Beautify = function(num, floats, forced) { CM.Disp.Beautify = function(num, floats, forced) {
var decimals = CM.Options.ScaleDecimals + 1; var decimals = CM.Options.ScaleDecimals + 1;
if (CM.Options.Scale == 0) { if (CM.Options.Scale === 0) {
return CM.Backup.Beautify(num, floats); return CM.Backup.Beautify(num, floats);
} }
else if (isFinite(num)) { else if (isFinite(num)) {
var answer = ''; var answer = '';
if (num == 0) { if (num === 0) {
return num.toString(); return num.toString();
} }
else if (0.001 < num && num < CM.Options.ScaleCutoff) { else if (0.001 < num && num < CM.Options.ScaleCutoff) {
answer = num.toFixed(2); answer = num.toFixed(2);
if (CM.Options.ScaleSeparator) answer = answer.toLocaleString('nl'); if (CM.Options.ScaleSeparator) answer = answer.toLocaleString('nl');
for (let i = 0; i < 3; i++) { for (let i = 0; i < 3; i++) {
if (answer[answer.length - 1] == "0" || answer[answer.length - 1] == ".") answer = answer.slice(0, -1); if (answer[answer.length - 1] === "0" || answer[answer.length - 1] === ".") answer = answer.slice(0, -1);
} }
return answer; return answer;
} }
else if (CM.Options.Scale == 4 && !forced || forced == 4) { // Scientific notation, 123456789 => 1.235E+8 else if (CM.Options.Scale === 4 && !forced || forced === 4) { // Scientific notation, 123456789 => 1.235E+8
answer = num.toExponential(decimals).toString().replace("e", "E"); answer = num.toExponential(decimals).toString().replace("e", "E");
} }
else { else {
@@ -211,28 +211,28 @@ CM.Disp.Beautify = function(num, floats, forced) {
let AmountOfTenPowerThree = Math.floor(exponential.slice(exponential.indexOf("e") + 1) / 3); let AmountOfTenPowerThree = Math.floor(exponential.slice(exponential.indexOf("e") + 1) / 3);
answer = (num / Number("1e" + (AmountOfTenPowerThree * 3))).toFixed(decimals); answer = (num / Number("1e" + (AmountOfTenPowerThree * 3))).toFixed(decimals);
// answer is now "xxx.xx" (e.g., 123456789 would be 123.46) // answer is now "xxx.xx" (e.g., 123456789 would be 123.46)
if (CM.Options.Scale == 1 && !forced || forced == 1) { // Metric scale, 123456789 => 123.457 M if (CM.Options.Scale === 1 && !forced || forced === 1) { // Metric scale, 123456789 => 123.457 M
if (num >= 0.01 && num < Number("1e" + CM.Data.metric.length * 3)) { if (num >= 0.01 && num < Number("1e" + CM.Data.metric.length * 3)) {
answer += ' ' + CM.Data.metric[AmountOfTenPowerThree]; answer += ' ' + CM.Data.metric[AmountOfTenPowerThree];
} }
// If number is too large or little, revert to scientific notation // If number is too large or little, revert to scientific notation
else answer = CM.Disp.Beautify(num, 0, 4); else answer = CM.Disp.Beautify(num, 0, 4);
} }
else if (CM.Options.Scale == 2 && !forced || forced == 2) { // Short scale, 123456789 => 123.457 M else if (CM.Options.Scale === 2 && !forced || forced === 2) { // Short scale, 123456789 => 123.457 M
if (num >= 0.01 && num < Number("1e" + CM.Data.shortScale.length * 3)) { if (num >= 0.01 && num < Number("1e" + CM.Data.shortScale.length * 3)) {
answer += ' ' + CM.Data.shortScale[AmountOfTenPowerThree]; answer += ' ' + CM.Data.shortScale[AmountOfTenPowerThree];
} }
// If number is too large or little, revert to scientific notation // If number is too large or little, revert to scientific notation
else answer = CM.Disp.Beautify(num, 0, 4); else answer = CM.Disp.Beautify(num, 0, 4);
} }
else if (CM.Options.Scale == 3 && !forced || forced == 3) { // Short scale, 123456789 => 123.457 M else if (CM.Options.Scale === 3 && !forced || forced === 3) { // Short scale, 123456789 => 123.457 M
if (num >= 0.01 && num < Number("1e" + CM.Data.shortScaleAbbreviated.length * 3)) { if (num >= 0.01 && num < Number("1e" + CM.Data.shortScaleAbbreviated.length * 3)) {
answer += ' ' + CM.Data.shortScaleAbbreviated[AmountOfTenPowerThree]; answer += ' ' + CM.Data.shortScaleAbbreviated[AmountOfTenPowerThree];
} }
// If number is too large or little, revert to scientific notation // If number is too large or little, revert to scientific notation
else answer = CM.Disp.Beautify(num, 0, 4); else answer = CM.Disp.Beautify(num, 0, 4);
} }
else if (CM.Options.Scale == 5 && !forced || forced == 5) { // Engineering notation, 123456789 => 123.457E+6 else if (CM.Options.Scale === 5 && !forced || forced === 5) { // Engineering notation, 123456789 => 123.457E+6
answer += 'E' + AmountOfTenPowerThree * 3; answer += 'E' + AmountOfTenPowerThree * 3;
} }
} }
@@ -243,7 +243,7 @@ CM.Disp.Beautify = function(num, floats, forced) {
if (CM.Options.ScaleSeparator) answer = answer.replace('.', ','); if (CM.Options.ScaleSeparator) answer = answer.replace('.', ',');
return answer; return answer;
} }
else if (num == Infinity) { else if (num === Infinity) {
return "Infinity"; return "Infinity";
} }
else { else {
@@ -262,8 +262,8 @@ CM.Disp.Beautify = function(num, floats, forced) {
CM.Disp.UpdateAscendState = function() { CM.Disp.UpdateAscendState = function() {
if (Game.OnAscend) { if (Game.OnAscend) {
l('game').style.bottom = '0px'; l('game').style.bottom = '0px';
if (CM.Options.BotBar == 1) CM.Disp.BotBar.style.display = 'none'; if (CM.Options.BotBar === 1) CM.Disp.BotBar.style.display = 'none';
if (CM.Options.TimerBar == 1) CM.Disp.f.style.display = 'none'; if (CM.Options.TimerBar === 1) CM.Disp.f.style.display = 'none';
} }
else { else {
CM.Disp.ToggleBotBar(); CM.Disp.ToggleBotBar();
@@ -302,8 +302,8 @@ CM.Disp.UpdateBackground = function() {
CM.Disp.Draw = function () { CM.Disp.Draw = function () {
// Draw autosave timer in stats menu, this must be done here to make it count down correctly // Draw autosave timer in stats menu, this must be done here to make it count down correctly
if ( if (
(Game.prefs.autosave && Game.drawT % 10 == 0) && // with autosave ON and every 10 ticks (Game.prefs.autosave && Game.drawT % 10 === 0) && // with autosave ON and every 10 ticks
(Game.onMenu == 'stats' && CM.Options.Stats) // while being on the stats menu only (Game.onMenu === 'stats' && CM.Options.Stats) // while being on the stats menu only
) { ) {
var timer = document.getElementById('CMStatsAutosaveTimer'); var timer = document.getElementById('CMStatsAutosaveTimer');
if (timer) { if (timer) {
@@ -339,9 +339,11 @@ CM.Disp.Draw = function () {
* It is called by CM.Disp.UpdateAscendState() and a change in CM.Options.BotBar * It is called by CM.Disp.UpdateAscendState() and a change in CM.Options.BotBar
*/ */
CM.Disp.ToggleBotBar = function() { CM.Disp.ToggleBotBar = function() {
if (CM.Options.BotBar == 1) { if (CM.Options.BotBar === 1) {
CM.Disp.BotBar.style.display = ''; CM.Disp.BotBar.style.display = '';
CM.Disp.UpdateBotBar(); if (!CM.Footer.isInitzializing) {
CM.Disp.UpdateBotBar();
}
} }
else { else {
CM.Disp.BotBar.style.display = 'none'; CM.Disp.BotBar.style.display = 'none';
@@ -405,7 +407,7 @@ CM.Disp.CreateBotBar = function() {
* It is called by CM.Loop() * It is called by CM.Loop()
*/ */
CM.Disp.UpdateBotBar = function() { CM.Disp.UpdateBotBar = function() {
if (CM.Options.BotBar == 1 && CM.Cache.Objects1) { if (CM.Options.BotBar === 1 && CM.Cache.Objects1) {
var count = 0; var count = 0;
for (let i of Object.keys(CM.Cache.Objects1)) { for (let i of Object.keys(CM.Cache.Objects1)) {
let target = `Objects${Game.buyBulk}` let target = `Objects${Game.buyBulk}`
@@ -416,7 +418,7 @@ CM.Disp.UpdateBotBar = function() {
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache[target][i].pp, 2); CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache[target][i].pp, 2);
var timeColor = CM.Disp.GetTimeColor((Game.Objects[i].bulkPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()); var timeColor = CM.Disp.GetTimeColor((Game.Objects[i].bulkPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS());
CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[count].className = CM.Disp.colorTextPre + timeColor.color; CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[count].className = CM.Disp.colorTextPre + timeColor.color;
if (timeColor.text == "Done!" && Game.cookies < Game.Objects[i].bulkPrice) { if (timeColor.text === "Done!" && Game.cookies < Game.Objects[i].bulkPrice) {
CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[count].textContent = timeColor.text + " (with Wrink)"; CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[count].textContent = timeColor.text + " (with Wrink)";
} }
else CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[count].textContent = timeColor.text; else CM.Disp.BotBar.firstChild.firstChild.childNodes[3].childNodes[count].textContent = timeColor.text;
@@ -532,7 +534,7 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) {
colorBar.style.height = '10px'; colorBar.style.height = '10px';
colorBar.style.verticalAlign = "text-top"; colorBar.style.verticalAlign = "text-top";
colorBar.style.textAlign="center"; colorBar.style.textAlign="center";
if (bars.length - 1 == i) { if (bars.length - 1 === i) {
colorBar.style.borderTopRightRadius = '10px'; colorBar.style.borderTopRightRadius = '10px';
colorBar.style.borderBottomRightRadius = '10px'; colorBar.style.borderBottomRightRadius = '10px';
} }
@@ -558,7 +560,7 @@ CM.Disp.TimerBarCreateBar = function(id, name, bars) {
* It is called by CM.Loop() * It is called by CM.Loop()
*/ */
CM.Disp.UpdateTimerBar = function() { CM.Disp.UpdateTimerBar = function() {
if (CM.Options.TimerBar == 1) { if (CM.Options.TimerBar === 1) {
// label width: 113, timer width: 30, div margin: 20 // label width: 113, timer width: 30, div margin: 20
var maxWidthTwoBar = CM.Disp.TimerBar.offsetWidth - 163; var maxWidthTwoBar = CM.Disp.TimerBar.offsetWidth - 163;
// label width: 113, div margin: 20, calculate timer width at runtime // label width: 113, div margin: 20, calculate timer width at runtime
@@ -566,12 +568,12 @@ CM.Disp.UpdateTimerBar = function() {
var numberOfTimers = 0; var numberOfTimers = 0;
// Regulates visibility of Golden Cookie timer // Regulates visibility of Golden Cookie timer
if (Game.shimmerTypes.golden.spawned == 0 && !Game.Has('Golden switch [off]')) { if (Game.shimmerTypes.golden.spawned === 0 && !Game.Has('Golden switch [off]')) {
CM.Disp.TimerBars.CMTimerBarGC.style.display = ''; CM.Disp.TimerBars.CMTimerBarGC.style.display = '';
l('CMTimerBarGCMinBar').style.width = Math.round(Math.max(0, Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) * maxWidthTwoBar / Game.shimmerTypes.golden.maxTime) + 'px'; l('CMTimerBarGCMinBar').style.width = Math.round(Math.max(0, Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) * maxWidthTwoBar / Game.shimmerTypes.golden.maxTime) + 'px';
if (CM.Options.TimerBarOverlay >= 1) l('CMTimerBarGCMinBar').textContent = Math.ceil((Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time)/ Game.fps); if (CM.Options.TimerBarOverlay >= 1) l('CMTimerBarGCMinBar').textContent = Math.ceil((Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time)/ Game.fps);
else l('CMTimerBarGCMinBar').textContent = ""; else l('CMTimerBarGCMinBar').textContent = "";
if (Game.shimmerTypes.golden.minTime == Game.shimmerTypes.golden.maxTime) { if (Game.shimmerTypes.golden.minTime === Game.shimmerTypes.golden.maxTime) {
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '10px'; l('CMTimerBarGCMinBar').style.borderTopRightRadius = '10px';
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '10px'; l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '10px';
} }
@@ -588,7 +590,7 @@ CM.Disp.UpdateTimerBar = function() {
else CM.Disp.TimerBars.CMTimerBarGC.style.display = 'none'; else CM.Disp.TimerBars.CMTimerBarGC.style.display = 'none';
// Regulates visibility of Reindeer timer // Regulates visibility of Reindeer timer
if (Game.season == 'christmas' && Game.shimmerTypes.reindeer.spawned == 0) { if (Game.season === 'christmas' && Game.shimmerTypes.reindeer.spawned === 0) {
CM.Disp.TimerBars. CMTimerBarRen.style.display = ''; CM.Disp.TimerBars. CMTimerBarRen.style.display = '';
l('CMTimerBarRenMinBar').style.width = Math.round(Math.max(0, Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) * maxWidthTwoBar / Game.shimmerTypes.reindeer.maxTime) + 'px'; l('CMTimerBarRenMinBar').style.width = Math.round(Math.max(0, Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) * maxWidthTwoBar / Game.shimmerTypes.reindeer.maxTime) + 'px';
if (CM.Options.TimerBarOverlay >= 1) l('CMTimerBarRenMinBar').textContent = Math.ceil((Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time)/ Game.fps); if (CM.Options.TimerBarOverlay >= 1) l('CMTimerBarRenMinBar').textContent = Math.ceil((Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time)/ Game.fps);
@@ -620,7 +622,7 @@ CM.Disp.UpdateTimerBar = function() {
else classColor = CM.Disp.colorPurple; else classColor = CM.Disp.colorPurple;
timer.lastChild.children[1].className = CM.Disp.colorBackPre + classColor; timer.lastChild.children[1].className = CM.Disp.colorBackPre + classColor;
timer.lastChild.children[1].style.color = "black"; timer.lastChild.children[1].style.color = "black";
if (CM.Options.TimerBarOverlay == 2) timer.lastChild.children[1].textContent = Math.round(100 * (Game.buffs[i].time / Game.buffs[i].maxTime)) + "%"; if (CM.Options.TimerBarOverlay === 2) timer.lastChild.children[1].textContent = Math.round(100 * (Game.buffs[i].time / Game.buffs[i].maxTime)) + "%";
else timer.lastChild.children[1].textContent = ""; else timer.lastChild.children[1].textContent = "";
timer.lastChild.children[1].style.width = Math.round(Game.buffs[i].time * (maxWidthOneBar - Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8) / Game.buffs[i].maxTime) + 'px'; timer.lastChild.children[1].style.width = Math.round(Game.buffs[i].time * (maxWidthOneBar - Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8) / Game.buffs[i].maxTime) + 'px';
timer.lastChild.children[2].textContent = Math.ceil(Game.buffs[i].time / Game.fps); timer.lastChild.children[2].textContent = Math.ceil(Game.buffs[i].time / Game.fps);
@@ -647,7 +649,7 @@ CM.Disp.UpdateTimerBar = function() {
* It is called by CM.Disp.UpdateAscendState() or a change in CM.Options.TimerBar * It is called by CM.Disp.UpdateAscendState() or a change in CM.Options.TimerBar
*/ */
CM.Disp.ToggleTimerBar = function() { CM.Disp.ToggleTimerBar = function() {
if (CM.Options.TimerBar == 1) CM.Disp.TimerBar.style.display = ''; if (CM.Options.TimerBar === 1) CM.Disp.TimerBar.style.display = '';
else CM.Disp.TimerBar.style.display = 'none'; else CM.Disp.TimerBar.style.display = 'none';
CM.Disp.UpdateBotTimerBarPosition(); CM.Disp.UpdateBotTimerBarPosition();
}; };
@@ -657,7 +659,7 @@ CM.Disp.ToggleTimerBar = function() {
* It is called by a change in CM.Options.TimerBarPos * It is called by a change in CM.Options.TimerBarPos
*/ */
CM.Disp.ToggleTimerBarPos = function() { CM.Disp.ToggleTimerBarPos = function() {
if (CM.Options.TimerBarPos == 0) { if (CM.Options.TimerBarPos === 0) {
CM.Disp.TimerBar.style.width = '30%'; CM.Disp.TimerBar.style.width = '30%';
CM.Disp.TimerBar.style.bottom = ''; CM.Disp.TimerBar.style.bottom = '';
l('game').insertBefore(CM.Disp.TimerBar, l('sectionLeft')); l('game').insertBefore(CM.Disp.TimerBar, l('sectionLeft'));
@@ -678,22 +680,22 @@ CM.Disp.ToggleTimerBarPos = function() {
* It is called by CM.Disp.ToggleTimerBar(), CM.Disp.ToggleTimerBarPos() and CM.Disp.ToggleBotBar() * It is called by CM.Disp.ToggleTimerBar(), CM.Disp.ToggleTimerBarPos() and CM.Disp.ToggleBotBar()
*/ */
CM.Disp.UpdateBotTimerBarPosition = function() { CM.Disp.UpdateBotTimerBarPosition = function() {
if (CM.Options.BotBar == 1 && CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 1) { if (CM.Options.BotBar === 1 && CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 1) {
CM.Disp.BotBar.style.bottom = CM.Disp.TimerBar.style.height; CM.Disp.BotBar.style.bottom = CM.Disp.TimerBar.style.height;
l('game').style.bottom = Number(CM.Disp.TimerBar.style.height.replace("px","")) + 70 + "px"; l('game').style.bottom = Number(CM.Disp.TimerBar.style.height.replace("px","")) + 70 + "px";
} }
else if (CM.Options.BotBar == 1) { else if (CM.Options.BotBar === 1) {
CM.Disp.BotBar.style.bottom = '0px'; CM.Disp.BotBar.style.bottom = '0px';
l('game').style.bottom = '70px'; l('game').style.bottom = '70px';
} }
else if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 1) { else if (CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 1) {
l('game').style.bottom = CM.Disp.TimerBar.style.height; l('game').style.bottom = CM.Disp.TimerBar.style.height;
} }
else { // No bars else { // No bars
l('game').style.bottom = '0px'; l('game').style.bottom = '0px';
} }
if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 0) { if (CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) {
l('sectionLeft').style.top = CM.Disp.TimerBar.style.height; l('sectionLeft').style.top = CM.Disp.TimerBar.style.height;
} }
else { else {
@@ -714,8 +716,8 @@ CM.Disp.UpdateBotTimerBarPosition = function() {
*/ */
CM.Disp.UpdateBuildings = function() { CM.Disp.UpdateBuildings = function() {
let target = `Objects${Game.buyBulk}` let target = `Objects${Game.buyBulk}`
if (Game.buyMode == 1) { 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];
} }
@@ -725,7 +727,7 @@ CM.Disp.UpdateBuildings = function() {
} }
} }
} }
else if (Game.buyMode == -1) { else if (Game.buyMode === -1) {
for (let i of Object.keys(CM.Cache.Objects1)) { for (let i of Object.keys(CM.Cache.Objects1)) {
var o = Game.Objects[i]; var o = Game.Objects[i];
l('productPrice' + o.id).style.color = ''; l('productPrice' + o.id).style.color = '';
@@ -744,7 +746,7 @@ CM.Disp.UpdateBuildings = function() {
// Build array of pointers, sort by pp, use array index (+2) as the grid row number // Build array of pointers, sort by pp, use array index (+2) as the grid row number
// (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options) // (grid rows are 1-based indexing, and row 1 is the bulk buy/sell options)
// This regulates sorting of buildings // This regulates sorting of buildings
if (Game.buyMode == 1 && CM.Options.SortBuildings) { if (Game.buyMode === 1 && CM.Options.SortBuildings) {
let 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];
@@ -807,13 +809,13 @@ CM.Disp.UpdateUpgrades = function() {
div.className = CM.Disp.colorBackPre + CM.Cache.Upgrades[me.name].color; div.className = CM.Disp.colorBackPre + CM.Cache.Upgrades[me.name].color;
l('upgrade' + i).appendChild(div); l('upgrade' + i).appendChild(div);
} }
if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorBlue) blue++; if (CM.Cache.Upgrades[me.name].color === CM.Disp.colorBlue) blue++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorGreen) green++; else if (CM.Cache.Upgrades[me.name].color === CM.Disp.colorGreen) green++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorYellow) yellow++; else if (CM.Cache.Upgrades[me.name].color === CM.Disp.colorYellow) yellow++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorOrange) orange++; else if (CM.Cache.Upgrades[me.name].color === CM.Disp.colorOrange) orange++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorRed) red++; else if (CM.Cache.Upgrades[me.name].color === CM.Disp.colorRed) red++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorPurple) purple++; else if (CM.Cache.Upgrades[me.name].color === CM.Disp.colorPurple) purple++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorGray) gray++; else if (CM.Cache.Upgrades[me.name].color === CM.Disp.colorGray) gray++;
} }
l('CMUpgradeBarBlue').textContent = blue; l('CMUpgradeBarBlue').textContent = blue;
@@ -859,11 +861,11 @@ CM.Disp.UpdateUpgrades = function() {
* It is called by a change in CM.Options.UpBarColor * It is called by a change in CM.Options.UpBarColor
*/ */
CM.Disp.ToggleUpgradeBarAndColor = function() { CM.Disp.ToggleUpgradeBarAndColor = function() {
if (CM.Options.UpBarColor == 1) { // Colours and bar on if (CM.Options.UpBarColor === 1) { // Colours and bar on
CM.Disp.UpgradeBar.style.display = ''; CM.Disp.UpgradeBar.style.display = '';
CM.Disp.UpdateUpgrades(); CM.Disp.UpdateUpgrades();
} }
else if (CM.Options.UpBarColor == 2) {// Colours on and bar off else if (CM.Options.UpBarColor === 2) {// Colours on and bar off
CM.Disp.UpgradeBar.style.display = 'none'; CM.Disp.UpgradeBar.style.display = 'none';
CM.Disp.UpdateUpgrades(); CM.Disp.UpdateUpgrades();
} }
@@ -878,7 +880,7 @@ CM.Disp.ToggleUpgradeBarAndColor = function() {
* It is called by a change in CM.Options.UpgradeBarFixedPos * It is called by a change in CM.Options.UpgradeBarFixedPos
*/ */
CM.Disp.ToggleUpgradeBarFixedPos = function() { CM.Disp.ToggleUpgradeBarFixedPos = function() {
if (CM.Options.UpgradeBarFixedPos == 1) { // Fix to top of screen when scrolling if (CM.Options.UpgradeBarFixedPos === 1) { // Fix to top of screen when scrolling
CM.Disp.UpgradeBar.style.position = 'sticky'; CM.Disp.UpgradeBar.style.position = 'sticky';
CM.Disp.UpgradeBar.style.top = '0px'; CM.Disp.UpgradeBar.style.top = '0px';
} }
@@ -987,14 +989,14 @@ CM.Disp.CreateWhiteScreen = function() {
* This function creates a flash depending on configs. It is called by all functions * This function creates a flash depending on configs. It is called by all functions
* that check game-events and which have settings for Flashes (e.g., Golden Cookies appearing, Magic meter being full) * that check game-events and which have settings for Flashes (e.g., Golden Cookies appearing, Magic meter being full)
* @param {number} mode Sets the intensity of the flash, used to recursively dim flash * @param {number} mode Sets the intensity of the flash, used to recursively dim flash
* All calls of function have use mode == 3 * All calls of function have use mode === 3
* @param {string} config The setting in CM.Options that is checked before creating the flash * @param {string} config The setting in CM.Options that is checked before creating the flash
*/ */
CM.Disp.Flash = function(mode, config) { CM.Disp.Flash = function(mode, config) {
// 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 && CM.Footer.isInitzializing === false) || mode == 1) { if ((CM.Options[config] === 1 && mode === 3 && CM.Footer.isInitzializing === false) || 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';
setTimeout(function() {CM.Disp.Flash(2, config);}, 1000/Game.fps); setTimeout(function() {CM.Disp.Flash(2, config);}, 1000/Game.fps);
} }
@@ -1002,11 +1004,11 @@ CM.Disp.Flash = function(mode, config) {
setTimeout(function() {CM.Disp.Flash(0, config);}, 1000/Game.fps); setTimeout(function() {CM.Disp.Flash(0, config);}, 1000/Game.fps);
} }
} }
else if (mode == 2) { else if (mode === 2) {
CM.Disp.WhiteScreen.style.opacity = '1'; CM.Disp.WhiteScreen.style.opacity = '1';
setTimeout(function() {CM.Disp.Flash(1, config);}, 1000/Game.fps); setTimeout(function() {CM.Disp.Flash(1, config);}, 1000/Game.fps);
} }
else if (mode == 0) CM.Disp.WhiteScreen.style.display = 'none'; else if (mode === 0) CM.Disp.WhiteScreen.style.display = 'none';
}; };
/** /**
@@ -1018,7 +1020,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 && CM.Footer.isInitzializing === false) { if (CM.Options[sndConfig] === 1 && CM.Footer.isInitzializing === false) {
var sound = new realAudio(url); var sound = new realAudio(url);
if (CM.Options.GeneralSound) sound.volume = (CM.Options[volConfig] / 100) * (Game.volume / 100); if (CM.Options.GeneralSound) sound.volume = (CM.Options[volConfig] / 100) * (Game.volume / 100);
else sound.volume = (CM.Options[volConfig] / 100); else sound.volume = (CM.Options[volConfig] / 100);
@@ -1035,7 +1037,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' && CM.Footer.isInitzializing === false) { if (CM.Options[notifyConfig] === 1 && document.visibilityState === 'hidden' && CM.Footer.isInitzializing === false) {
var CookieIcon = 'https://orteil.dashnet.org/cookieclicker/favicon.ico'; var CookieIcon = 'https://orteil.dashnet.org/cookieclicker/favicon.ico';
new Notification(title, {body: message, badge: CookieIcon}); new Notification(title, {body: message, badge: CookieIcon});
} }
@@ -1061,7 +1063,7 @@ CM.Disp.CreateFavicon = function() {
* By relying on CM.Cache.spawnedGoldenShimmer it only changes for non-user spawned cookie * By relying on CM.Cache.spawnedGoldenShimmer it only changes for non-user spawned cookie
*/ */
CM.Disp.UpdateFavicon = function() { CM.Disp.UpdateFavicon = function() {
if (CM.Options.Favicon == 1 && CM.Main.lastGoldenCookieState > 0) { if (CM.Options.Favicon === 1 && CM.Main.lastGoldenCookieState > 0) {
if (CM.Cache.spawnedGoldenShimmer.wrath) CM.Disp.Favicon.href = 'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico'; if (CM.Cache.spawnedGoldenShimmer.wrath) CM.Disp.Favicon.href = 'https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico';
else CM.Disp.Favicon.href = 'https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico'; else CM.Disp.Favicon.href = 'https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico';
} }
@@ -1070,13 +1072,13 @@ CM.Disp.UpdateFavicon = function() {
/** /**
* This function updates the tab title * This function updates the tab title
* It is called on every loop by Game.Logic() which also sets CM.Cache.Title to Game.cookies * It is called on every loop by Game.Logic() which also sets CM.Disp.Title to Game.cookies
*/ */
CM.Disp.UpdateTitle = function() { CM.Disp.UpdateTitle = function() {
if (Game.OnAscend || CM.Options.Title == 0) { if (Game.OnAscend || CM.Options.Title === 0) {
document.title = CM.Cache.Title; document.title = CM.Disp.Title;
} }
else if (CM.Options.Title == 1) { else if (CM.Options.Title === 1) {
let addFC = false; let addFC = false;
let addSP = false; let addSP = false;
let titleGC; let titleGC;
@@ -1097,7 +1099,7 @@ CM.Disp.UpdateTitle = function() {
titleFC = '[F]'; titleFC = '[F]';
} }
if (Game.season == 'christmas') { if (Game.season === 'christmas') {
addSP = true; addSP = true;
if (CM.Main.lastSeasonPopupState) titleSP = '[R ' + Math.ceil(CM.Cache.seasonPopShimmer.life / Game.fps) + ']'; if (CM.Main.lastSeasonPopupState) titleSP = '[R ' + Math.ceil(CM.Cache.seasonPopShimmer.life / Game.fps) + ']';
else { else {
@@ -1106,13 +1108,13 @@ CM.Disp.UpdateTitle = function() {
} }
// Remove previous timers and add current cookies // Remove previous timers and add current cookies
let str = CM.Cache.Title; let str = CM.Disp.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) {
let str = ''; let str = '';
let spawn = false; let spawn = false;
if (CM.Cache.spawnedGoldenShimmer) { if (CM.Cache.spawnedGoldenShimmer) {
@@ -1124,13 +1126,13 @@ CM.Disp.UpdateTitle = function() {
spawn = true; spawn = true;
str += '[F]'; str += '[F]';
} }
if (Game.season == 'christmas' && CM.Main.lastSeasonPopupState) { if (Game.season === 'christmas' && CM.Main.lastSeasonPopupState) {
str += '[R ' + Math.ceil(CM.Cache.seasonPopShimmer.life / Game.fps) + ']'; str += '[R ' + Math.ceil(CM.Cache.seasonPopShimmer.life / Game.fps) + ']';
spawn = true; spawn = true;
} }
if (spawn) str += ' - '; if (spawn) str += ' - ';
let 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;
} }
@@ -1157,7 +1159,7 @@ CM.Disp.CreateGCTimer = function(cookie) {
GCTimer.style.fontSize = '35px'; GCTimer.style.fontSize = '35px';
GCTimer.style.cursor = 'pointer'; GCTimer.style.cursor = 'pointer';
GCTimer.style.display = 'block'; GCTimer.style.display = 'block';
if (CM.Options.GCTimer == 0) GCTimer.style.display = 'none'; if (CM.Options.GCTimer === 0) GCTimer.style.display = 'none';
GCTimer.style.left = cookie.l.style.left; GCTimer.style.left = cookie.l.style.left;
GCTimer.style.top = cookie.l.style.top; GCTimer.style.top = cookie.l.style.top;
GCTimer.onclick = function () {cookie.pop();}; GCTimer.onclick = function () {cookie.pop();};
@@ -1173,7 +1175,7 @@ CM.Disp.CreateGCTimer = function(cookie) {
* It is called by a change in CM.Options.GCTimer * It is called by a change in CM.Options.GCTimer
*/ */
CM.Disp.ToggleGCTimer = function() { CM.Disp.ToggleGCTimer = function() {
if (CM.Options.GCTimer == 1) { if (CM.Options.GCTimer === 1) {
for (let i of Object.keys(CM.Disp.GCTimers)) { for (let i of Object.keys(CM.Disp.GCTimers)) {
CM.Disp.GCTimers[i].style.display = 'block'; CM.Disp.GCTimers[i].style.display = 'block';
CM.Disp.GCTimers[i].style.left = CM.Cache.goldenShimmersByID[i].l.style.left; CM.Disp.GCTimers[i].style.left = CM.Cache.goldenShimmersByID[i].l.style.left;
@@ -1231,19 +1233,19 @@ CM.Disp.ReplaceTooltipUpgrade = function() {
* @returns {string} l('tooltip').innerHTML The HTML of the l('tooltip')-object * @returns {string} l('tooltip').innerHTML The HTML of the l('tooltip')-object
*/ */
CM.Disp.Tooltip = function(type, name) { CM.Disp.Tooltip = function(type, name) {
if (type == 'b') { // Buildings if (type === 'b') { // Buildings
l('tooltip').innerHTML = Game.Objects[name].tooltip(); l('tooltip').innerHTML = Game.Objects[name].tooltip();
// Adds amortization info to the list of info per building // Adds amortization info to the list of info per building
if (CM.Options.TooltipAmor == 1) { if (CM.Options.TooltipAmor === 1) {
var buildPrice = CM.Sim.BuildingGetPrice(Game.Objects[name], Game.Objects[name].basePrice, 0, Game.Objects[name].free, Game.Objects[name].amount); var buildPrice = CM.Sim.BuildingGetPrice(Game.Objects[name], Game.Objects[name].basePrice, 0, Game.Objects[name].free, Game.Objects[name].amount);
var amortizeAmount = buildPrice - Game.Objects[name].totalCookies; var amortizeAmount = buildPrice - Game.Objects[name].totalCookies;
if (amortizeAmount > 0) { if (amortizeAmount > 0) {
l('tooltip').innerHTML = l('tooltip').innerHTML l('tooltip').innerHTML = l('tooltip').innerHTML
.split('so far</div>') .split('so far</div>')
.join('so far<br/>&bull; <b>' + Beautify(amortizeAmount) + '</b> ' + (Math.floor(amortizeAmount) == 1 ? 'cookie' : 'cookies') + ' left to amortize (' + CM.Disp.GetTimeColor((buildPrice - Game.Objects[name].totalCookies) / (Game.Objects[name].storedTotalCps * Game.globalCpsMult)).text + ')</div>'); .join('so far<br/>&bull; <b>' + Beautify(amortizeAmount) + '</b> ' + (Math.floor(amortizeAmount) === 1 ? 'cookie' : 'cookies') + ' left to amortize (' + CM.Disp.GetTimeColor((buildPrice - Game.Objects[name].totalCookies) / (Game.Objects[name].storedTotalCps * Game.globalCpsMult)).text + ')</div>');
} }
} }
if (Game.buyMode == -1) { if (Game.buyMode === -1) {
/* /*
* Fix sell price displayed in the object tooltip. * Fix sell price displayed in the object tooltip.
* *
@@ -1255,17 +1257,17 @@ CM.Disp.Tooltip = function(type, name) {
l('tooltip').innerHTML = l('tooltip').innerHTML.split(Beautify(Game.Objects[name].bulkPrice)).join(Beautify(CM.Sim.BuildingSell(Game.Objects[name], Game.Objects[name].basePrice, Game.Objects[name].amount, Game.Objects[name].free, Game.buyBulk, 1))); l('tooltip').innerHTML = l('tooltip').innerHTML.split(Beautify(Game.Objects[name].bulkPrice)).join(Beautify(CM.Sim.BuildingSell(Game.Objects[name], Game.Objects[name].basePrice, Game.Objects[name].amount, Game.Objects[name].free, Game.buyBulk, 1)));
} }
} }
else if (type == 'u') { // Upgrades else if (type === 'u') { // Upgrades
if (!Game.UpgradesInStore[name]) return ''; if (!Game.UpgradesInStore[name]) return '';
l('tooltip').innerHTML = Game.crateTooltip(Game.UpgradesInStore[name], 'store'); l('tooltip').innerHTML = Game.crateTooltip(Game.UpgradesInStore[name], 'store');
} }
else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip(); // Sugar Lumps else if (type === 's') l('tooltip').innerHTML = Game.lumpTooltip(); // Sugar Lumps
else if (type === 'g') l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); // Grimoire else if (type === 'g') l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)(); // Grimoire
else if (type == 'p') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])(); // Garden plots else if (type === 'p') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.tileTooltip(name[0], name[1])(); // Garden plots
else if (type == 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)(); // Harvest all button in garden else if (type === 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)(); // Harvest all button in garden
// Adds area for extra tooltip-sections // Adds area for extra tooltip-sections
if ((type == 'b' && Game.buyMode == 1) || type == 'u' || type == 's' || type == 'g' || type == 'p' || type == 'ha') { if ((type === 'b' && Game.buyMode === 1) || type === 'u' || type === 's' || type === 'g' || type === 'p' || type === 'ha') {
var area = document.createElement('div'); var area = document.createElement('div');
area.id = 'CMTooltipArea'; area.id = 'CMTooltipArea';
l('tooltip').appendChild(area); l('tooltip').appendChild(area);
@@ -1344,7 +1346,7 @@ CM.Disp.TooltipCreateCalculationSection = function(tooltip) {
time.id = 'CMTooltipTime'; time.id = 'CMTooltipTime';
tooltip.appendChild(time); tooltip.appendChild(time);
if (CM.Disp.tooltipType == 'b') { if (CM.Disp.tooltipType === 'b') {
tooltip.appendChild(CM.Disp.TooltipCreateHeader('Production left till next achievement')); tooltip.appendChild(CM.Disp.TooltipCreateHeader('Production left till next achievement'));
tooltip.lastChild.id = 'CMTooltipProductionHeader'; // Assign a id in order to hid when no achiev's are left tooltip.lastChild.id = 'CMTooltipProductionHeader'; // Assign a id in order to hid when no achiev's are left
var production = document.createElement('div'); var production = document.createElement('div');
@@ -1416,10 +1418,10 @@ CM.Disp.UpdateTooltip = function() {
let tooltipBox = CM.Disp.TooltipCreateTooltipBox(); let tooltipBox = CM.Disp.TooltipCreateTooltipBox();
l('CMTooltipArea').appendChild(tooltipBox); l('CMTooltipArea').appendChild(tooltipBox);
if (CM.Disp.tooltipType == 'b') { if (CM.Disp.tooltipType === 'b') {
CM.Disp.UpdateTooltipBuilding(); CM.Disp.UpdateTooltipBuilding();
} }
else if (CM.Disp.tooltipType == 'u') { else if (CM.Disp.tooltipType === 'u') {
CM.Disp.UpdateTooltipUpgrade(); CM.Disp.UpdateTooltipUpgrade();
} }
else if (CM.Disp.tooltipType === 's') { else if (CM.Disp.tooltipType === 's') {
@@ -1436,7 +1438,7 @@ CM.Disp.UpdateTooltip = function() {
} }
CM.Disp.UpdateTooltipWarnings(); CM.Disp.UpdateTooltipWarnings();
} }
else if (l('CMTooltipArea') == null) { // Remove warnings if its a basic tooltip else if (l('CMTooltipArea') === null) { // Remove warnings if its a basic tooltip
if (l('CMDispTooltipWarningParent') != null) { if (l('CMDispTooltipWarningParent') != null) {
l('CMDispTooltipWarningParent').remove(); l('CMDispTooltipWarningParent').remove();
} }
@@ -1448,7 +1450,7 @@ CM.Disp.UpdateTooltip = function() {
* It is called when Building tooltips are created or refreshed by CM.Disp.UpdateTooltip() * It is called when Building tooltips are created or refreshed by CM.Disp.UpdateTooltip()
*/ */
CM.Disp.UpdateTooltipBuilding = function() { CM.Disp.UpdateTooltipBuilding = function() {
if (CM.Options.TooltipBuildUpgrade == 1 && Game.buyMode == 1) { if (CM.Options.TooltipBuildUpgrade === 1 && Game.buyMode === 1) {
let tooltipBox = l('CMTooltipBorder'); let tooltipBox = l('CMTooltipBorder');
CM.Disp.TooltipCreateCalculationSection(tooltipBox); CM.Disp.TooltipCreateCalculationSection(tooltipBox);
@@ -1458,7 +1460,7 @@ CM.Disp.UpdateTooltipBuilding = function() {
CM.Disp.TooltipBonusIncome = CM.Cache[target][CM.Disp.tooltipName].bonus; CM.Disp.TooltipBonusIncome = CM.Cache[target][CM.Disp.tooltipName].bonus;
if (CM.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);
let 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) {
@@ -1469,7 +1471,7 @@ CM.Disp.UpdateTooltipBuilding = function() {
l('CMTooltipPP').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color; l('CMTooltipPP').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color;
var timeColor = CM.Disp.GetTimeColor((CM.Disp.TooltipPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()); var timeColor = CM.Disp.GetTimeColor((CM.Disp.TooltipPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS());
l('CMTooltipTime').textContent = timeColor.text; l('CMTooltipTime').textContent = timeColor.text;
if (timeColor.text == "Done!" && Game.cookies < CM.Cache[target][CM.Disp.tooltipName].price) { if (timeColor.text === "Done!" && Game.cookies < CM.Cache[target][CM.Disp.tooltipName].price) {
l('CMTooltipTime').textContent = timeColor.text + " (with Wrink)"; l('CMTooltipTime').textContent = timeColor.text + " (with Wrink)";
} }
else l('CMTooltipTime').textContent = timeColor.text; else l('CMTooltipTime').textContent = timeColor.text;
@@ -1506,7 +1508,7 @@ CM.Disp.UpdateTooltipUpgrade = function() {
CM.Disp.TooltipPrice = Game.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].getPrice(); CM.Disp.TooltipPrice = Game.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].getPrice();
CM.Disp.TooltipBonusMouse = CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].bonusMouse; CM.Disp.TooltipBonusMouse = CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].bonusMouse;
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);
let 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) {
@@ -1520,7 +1522,7 @@ CM.Disp.UpdateTooltipUpgrade = function() {
l('CMTooltipCookiePerClick').previousSibling.style.display = "block"; l('CMTooltipCookiePerClick').previousSibling.style.display = "block";
} }
// If only a clicking power upgrade change PP to click-based period // If only a clicking power upgrade change PP to click-based period
if (CM.Disp.TooltipBonusIncome == 0 && CM.Disp.TooltipBonusMouse) { if (CM.Disp.TooltipBonusIncome === 0 && CM.Disp.TooltipBonusMouse) {
l('CMTooltipPP').textContent = Beautify(CM.Disp.TooltipPrice / CM.Disp.TooltipBonusMouse) + ' Clicks'; l('CMTooltipPP').textContent = Beautify(CM.Disp.TooltipPrice / CM.Disp.TooltipBonusMouse) + ' Clicks';
l('CMTooltipPP').style.color = "white"; l('CMTooltipPP').style.color = "white";
} }
@@ -1530,14 +1532,14 @@ CM.Disp.UpdateTooltipUpgrade = function() {
} }
var timeColor = CM.Disp.GetTimeColor((CM.Disp.TooltipPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()); var timeColor = CM.Disp.GetTimeColor((CM.Disp.TooltipPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS());
l('CMTooltipTime').textContent = timeColor.text; l('CMTooltipTime').textContent = timeColor.text;
if (timeColor.text == "Done!" && Game.cookies < Game.UpgradesInStore[CM.Disp.tooltipName].getPrice()) { if (timeColor.text === "Done!" && Game.cookies < Game.UpgradesInStore[CM.Disp.tooltipName].getPrice()) {
l('CMTooltipTime').textContent = timeColor.text + " (with Wrink)"; l('CMTooltipTime').textContent = timeColor.text + " (with Wrink)";
} }
else l('CMTooltipTime').textContent = timeColor.text; else l('CMTooltipTime').textContent = timeColor.text;
l('CMTooltipTime').className = CM.Disp.colorTextPre + timeColor.color; l('CMTooltipTime').className = CM.Disp.colorTextPre + timeColor.color;
// Add extra info to Chocolate egg tooltip // Add extra info to Chocolate egg tooltip
if (Game.UpgradesInStore[CM.Disp.tooltipName].name == "Chocolate egg") { if (Game.UpgradesInStore[CM.Disp.tooltipName].name === "Chocolate egg") {
l('CMTooltipBorder').lastChild.style.marginBottom = '4px'; l('CMTooltipBorder').lastChild.style.marginBottom = '4px';
l('CMTooltipBorder').appendChild(CM.Disp.TooltipCreateHeader('Cookies to be gained (Currently/Max)')); l('CMTooltipBorder').appendChild(CM.Disp.TooltipCreateHeader('Cookies to be gained (Currently/Max)'));
var chocolate = document.createElement('div'); var chocolate = document.createElement('div');
@@ -1579,7 +1581,7 @@ CM.Disp.UpdateTooltipGrimoire = function() {
var minigame = Game.Objects['Wizard tower'].minigame; var minigame = Game.Objects['Wizard tower'].minigame;
var spellCost = minigame.getSpellCost(minigame.spellsById[CM.Disp.tooltipName]); var spellCost = minigame.getSpellCost(minigame.spellsById[CM.Disp.tooltipName]);
if (CM.Options.TooltipGrim == 1 && spellCost <= minigame.magicM) { if (CM.Options.TooltipGrim === 1 && spellCost <= minigame.magicM) {
let tooltipBox = l('CMTooltipBorder'); let tooltipBox = l('CMTooltipBorder');
// Time left till enough magic for spell // Time left till enough magic for spell
@@ -1602,8 +1604,8 @@ CM.Disp.UpdateTooltipGrimoire = function() {
recover.className = CM.Disp.colorTextPre + recoverColor.color; recover.className = CM.Disp.colorTextPre + recoverColor.color;
} }
// Extra information on cookies gained when spell is Conjure Baked Goods (Name == 0) // Extra information on cookies gained when spell is Conjure Baked Goods (Name === 0)
if (CM.Disp.tooltipName == 0) { if (CM.Disp.tooltipName === 0) {
tooltipBox.appendChild(CM.Disp.TooltipCreateHeader('Cookies to be gained/lost')); tooltipBox.appendChild(CM.Disp.TooltipCreateHeader('Cookies to be gained/lost'));
var conjure = document.createElement('div'); var conjure = document.createElement('div');
conjure.id = 'CMTooltipConjure'; conjure.id = 'CMTooltipConjure';
@@ -1640,16 +1642,16 @@ CM.Disp.UpdateTooltipGardenPlots = function() {
var reward = document.createElement('div'); var reward = document.createElement('div');
reward.id = 'CMTooltipPlantReward'; reward.id = 'CMTooltipPlantReward';
l('CMTooltipBorder').appendChild(reward); l('CMTooltipBorder').appendChild(reward);
if (plantName == "Bakeberry") { if (plantName === "Bakeberry") {
l('CMTooltipPlantReward').textContent = (mature ? CM.Disp.Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30)) : "0") + " / " + CM.Disp.Beautify(Game.cookiesPs * 60 * 30); l('CMTooltipPlantReward').textContent = (mature ? CM.Disp.Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30)) : "0") + " / " + CM.Disp.Beautify(Game.cookiesPs * 60 * 30);
} }
else if (plantName == "Chocoroot" || plantName == "White chocoroot") { else if (plantName === "Chocoroot" || plantName === "White chocoroot") {
l('CMTooltipPlantReward').textContent = (mature ? CM.Disp.Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3)) : "0") + " / " + CM.Disp.Beautify(Game.cookiesPs * 60 * 3); l('CMTooltipPlantReward').textContent = (mature ? CM.Disp.Beautify(Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3)) : "0") + " / " + CM.Disp.Beautify(Game.cookiesPs * 60 * 3);
} }
else if (plantName == "Queenbeet") { else if (plantName === "Queenbeet") {
l('CMTooltipPlantReward').textContent = (mature ? CM.Disp.Beautify(Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60)) : "0") + " / " + CM.Disp.Beautify(Game.cookiesPs * 60 * 60); l('CMTooltipPlantReward').textContent = (mature ? CM.Disp.Beautify(Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60)) : "0") + " / " + CM.Disp.Beautify(Game.cookiesPs * 60 * 60);
} }
else if (plantName == "Duketater") { else if (plantName === "Duketater") {
l('CMTooltipPlantReward').textContent = (mature ? CM.Disp.Beautify(Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120)) : "0") + " / " + CM.Disp.Beautify(Game.cookiesPs * 60 * 120); l('CMTooltipPlantReward').textContent = (mature ? CM.Disp.Beautify(Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120)) : "0") + " / " + CM.Disp.Beautify(Game.cookiesPs * 60 * 120);
} }
else l('CMTooltipArea').style.display = "none"; else l('CMTooltipArea').style.display = "none";
@@ -1679,16 +1681,16 @@ CM.Disp.UpdateTooltipHarvestAll = function() {
let count = true; let count = true;
if (mortal && me.immortal) count = false; if (mortal && me.immortal) count = false;
if (tile[1] < me.matureBase) count = false; if (tile[1] < me.matureBase) count = false;
if (count && plantName == "Bakeberry") { if (count && plantName === "Bakeberry") {
totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30); totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 30);
} }
else if (count && plantName == "Chocoroot" || plantName == "White chocoroot") { else if (count && plantName === "Chocoroot" || plantName === "White chocoroot") {
totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3); totalGain += Math.min(Game.cookies * 0.03, Game.cookiesPs * 60 * 3);
} }
else if (count && plantName == "Queenbeet") { else if (count && plantName === "Queenbeet") {
totalGain += Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60); totalGain += Math.min(Game.cookies * 0.04, Game.cookiesPs * 60 * 60);
} }
else if (count && plantName == "Duketater") { else if (count && plantName === "Duketater") {
totalGain += Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120); totalGain += Math.min(Game.cookies * 0.08, Game.cookiesPs * 60 * 120);
} }
} }
@@ -1704,63 +1706,63 @@ CM.Disp.UpdateTooltipHarvestAll = function() {
* It is called by CM.Disp.UpdateTooltip() * It is called by CM.Disp.UpdateTooltip()
*/ */
CM.Disp.UpdateTooltipWarnings = function() { CM.Disp.UpdateTooltipWarnings = function() {
if (CM.Disp.tooltipType == "b" || CM.Disp.tooltipType == "u") { if (CM.Disp.tooltipType === "b" || CM.Disp.tooltipType === "u") {
if (document.getElementById("CMDispTooltipWarningParent") == null) { if (document.getElementById("CMDispTooltipWarningParent") === null) {
let warningTooltip = CM.Disp.TooltipCreateWarningSection(); let warningTooltip = CM.Disp.TooltipCreateWarningSection();
l('tooltipAnchor').appendChild(warningTooltip); l('tooltipAnchor').appendChild(warningTooltip);
CM.Disp.ToggleToolWarnPos(); CM.Disp.ToggleToolWarnPos();
} }
if (CM.Options.ToolWarnPos == 0) CM.Disp.TooltipWarn.style.right = '0px'; if (CM.Options.ToolWarnPos === 0) CM.Disp.TooltipWarn.style.right = '0px';
else CM.Disp.TooltipWarn.style.top = (l('tooltip').offsetHeight) + 'px'; else CM.Disp.TooltipWarn.style.top = (l('tooltip').offsetHeight) + 'px';
CM.Disp.TooltipWarn.style.width = (l('tooltip').offsetWidth - 6) + 'px'; CM.Disp.TooltipWarn.style.width = (l('tooltip').offsetWidth - 6) + 'px';
var amount = (Game.cookies + CM.Disp.GetWrinkConfigBank()) - CM.Disp.TooltipPrice; var amount = (Game.cookies + CM.Disp.GetWrinkConfigBank()) - CM.Disp.TooltipPrice;
var limitLucky = CM.Cache.Lucky; var limitLucky = CM.Cache.Lucky;
if (CM.Options.ToolWarnBon == 1) { if (CM.Options.ToolWarnBon === 1) {
var bonusNoFren = CM.Disp.TooltipBonusIncome; var bonusNoFren = CM.Disp.TooltipBonusIncome;
bonusNoFren /= CM.Sim.getCPSBuffMult(); bonusNoFren /= CM.Sim.getCPSBuffMult();
limitLucky += ((bonusNoFren * 60 * 15) / 0.15); limitLucky += ((bonusNoFren * 60 * 15) / 0.15);
} }
if (CM.Options.ToolWarnLucky == 1) { if (CM.Options.ToolWarnLucky === 1) {
if (amount < limitLucky && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) { if (amount < limitLucky && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnLucky').style.display = ''; l('CMDispTooltipWarnLucky').style.display = '';
l('CMDispTooltipWarnLuckyText').textContent = Beautify(limitLucky - amount) + ' (' + CM.Disp.FormatTime((limitLucky - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')'; l('CMDispTooltipWarnLuckyText').textContent = Beautify(limitLucky - amount) + ' (' + CM.Disp.FormatTime((limitLucky - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnLucky').style.display = 'none'; } else l('CMDispTooltipWarnLucky').style.display = 'none';
} }
else l('CMDispTooltipWarnLucky').style.display = 'none'; else l('CMDispTooltipWarnLucky').style.display = 'none';
if (CM.Options.ToolWarnLuckyFrenzy == 1) { if (CM.Options.ToolWarnLuckyFrenzy === 1) {
let limitLuckyFrenzy = limitLucky * 7; let limitLuckyFrenzy = limitLucky * 7;
if (amount < limitLuckyFrenzy && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) { if (amount < limitLuckyFrenzy && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnLuckyFrenzy').style.display = ''; l('CMDispTooltipWarnLuckyFrenzy').style.display = '';
l('CMDispTooltipWarnLuckyFrenzyText').textContent = Beautify(limitLuckyFrenzy - amount) + ' (' + CM.Disp.FormatTime((limitLuckyFrenzy - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')'; l('CMDispTooltipWarnLuckyFrenzyText').textContent = Beautify(limitLuckyFrenzy - amount) + ' (' + CM.Disp.FormatTime((limitLuckyFrenzy - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none'; } else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
} }
else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none'; else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
if (CM.Options.ToolWarnConjure == 1) { if (CM.Options.ToolWarnConjure === 1) {
var limitConjure = limitLucky * 2; var limitConjure = limitLucky * 2;
if ((amount < limitConjure) && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) { if ((amount < limitConjure) && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnConjure').style.display = ''; l('CMDispTooltipWarnConjure').style.display = '';
l('CMDispTooltipWarnConjureText').textContent = Beautify(limitConjure - amount) + ' (' + CM.Disp.FormatTime((limitConjure - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')'; l('CMDispTooltipWarnConjureText').textContent = Beautify(limitConjure - amount) + ' (' + CM.Disp.FormatTime((limitConjure - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnConjure').style.display = 'none'; } else l('CMDispTooltipWarnConjure').style.display = 'none';
} }
else l('CMDispTooltipWarnConjure').style.display = 'none'; else l('CMDispTooltipWarnConjure').style.display = 'none';
if (CM.Options.ToolWarnConjureFrenzy == 1) { if (CM.Options.ToolWarnConjureFrenzy === 1) {
var limitConjureFrenzy = limitLucky * 2 * 7; var limitConjureFrenzy = limitLucky * 2 * 7;
if ((amount < limitConjureFrenzy) && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) { if ((amount < limitConjureFrenzy) && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnConjureFrenzy').style.display = ''; l('CMDispTooltipWarnConjureFrenzy').style.display = '';
l('CMDispTooltipWarnConjureFrenzyText').textContent = Beautify(limitConjureFrenzy - amount) + ' (' + CM.Disp.FormatTime((limitConjureFrenzy - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')'; l('CMDispTooltipWarnConjureFrenzyText').textContent = Beautify(limitConjureFrenzy - amount) + ' (' + CM.Disp.FormatTime((limitConjureFrenzy - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none'; } else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
} }
else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none'; else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
if (CM.Options.ToolWarnEdifice == 1) { if (CM.Options.ToolWarnEdifice === 1) {
if (CM.Cache.Edifice && amount < CM.Cache.Edifice && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) { if (CM.Cache.Edifice && amount < CM.Cache.Edifice && (CM.Disp.tooltipType != 'b' || Game.buyMode === 1)) {
l('CMDispTooltipWarnEdifice').style.display = ''; l('CMDispTooltipWarnEdifice').style.display = '';
l('CMDispTooltipWarnEdificeText').textContent = Beautify(CM.Cache.Edifice - amount) + ' (' + CM.Disp.FormatTime((CM.Cache.Edifice - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')'; l('CMDispTooltipWarnEdificeText').textContent = Beautify(CM.Cache.Edifice - amount) + ' (' + CM.Disp.FormatTime((CM.Cache.Edifice - amount) / (CM.Disp.GetCPS() + CM.Disp.TooltipBonusIncome)) + ')';
} else l('CMDispTooltipWarnEdifice').style.display = 'none'; } else l('CMDispTooltipWarnEdifice').style.display = 'none';
@@ -1779,15 +1781,15 @@ CM.Disp.UpdateTooltipWarnings = function() {
* It is called by Game.tooltip.update() because of CM.ReplaceNative() * It is called by Game.tooltip.update() because of CM.ReplaceNative()
*/ */
CM.Disp.UpdateTooltipLocation = function() { CM.Disp.UpdateTooltipLocation = function() {
if (Game.tooltip.origin == 'store') { if (Game.tooltip.origin === 'store') {
var warnOffset = 0; var warnOffset = 0;
if (CM.Options.ToolWarnLucky == 1 && CM.Options.ToolWarnPos == 1 && typeof CM.Disp.TooltipWarn != "undefined") { if (CM.Options.ToolWarnLucky === 1 && CM.Options.ToolWarnPos === 1 && typeof CM.Disp.TooltipWarn != "undefined") {
warnOffset = CM.Disp.TooltipWarn.clientHeight - 4; warnOffset = CM.Disp.TooltipWarn.clientHeight - 4;
} }
Game.tooltip.tta.style.top = Math.min(parseInt(Game.tooltip.tta.style.top), (l('game').clientHeight + l('topBar').clientHeight) - Game.tooltip.tt.clientHeight - warnOffset - 46) + 'px'; Game.tooltip.tta.style.top = Math.min(parseInt(Game.tooltip.tta.style.top), (l('game').clientHeight + l('topBar').clientHeight) - Game.tooltip.tt.clientHeight - warnOffset - 46) + 'px';
} }
// Kept for future possible use if the code changes again // Kept for future possible use if the code changes again
/*else if (!Game.onCrate && !Game.OnAscend && CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 0) { /*else if (!Game.onCrate && !Game.OnAscend && CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) {
Game.tooltip.tta.style.top = (parseInt(Game.tooltip.tta.style.top) + parseInt(CM.Disp.TimerBar.style.height)) + 'px'; Game.tooltip.tta.style.top = (parseInt(Game.tooltip.tta.style.top) + parseInt(CM.Disp.TimerBar.style.height)) + 'px';
}*/ }*/
}; };
@@ -1799,7 +1801,7 @@ CM.Disp.UpdateTooltipLocation = function() {
*/ */
CM.Disp.ToggleToolWarnPos = function() { CM.Disp.ToggleToolWarnPos = function() {
if (typeof CM.Disp.TooltipWarn != "undefined") { if (typeof CM.Disp.TooltipWarn != "undefined") {
if (CM.Options.ToolWarnPos == 0) { if (CM.Options.ToolWarnPos === 0) {
CM.Disp.TooltipWarn.style.top = 'auto'; CM.Disp.TooltipWarn.style.top = 'auto';
CM.Disp.TooltipWarn.style.margin = '4px -4px'; CM.Disp.TooltipWarn.style.margin = '4px -4px';
CM.Disp.TooltipWarn.style.padding = '3px 4px'; CM.Disp.TooltipWarn.style.padding = '3px 4px';
@@ -1818,13 +1820,13 @@ CM.Disp.ToggleToolWarnPos = function() {
* TODO: Change this code to be the same as other tooltips. (i.d., create tooltip with type "w") * TODO: Change this code to be the same as other tooltips. (i.d., create tooltip with type "w")
*/ */
CM.Disp.CheckWrinklerTooltip = function() { CM.Disp.CheckWrinklerTooltip = function() {
if (CM.Options.TooltipWrink == 1 && CM.Disp.TooltipWrinklerArea == 1) { // Latter is set by CM.Main.AddWrinklerAreaDetect if (CM.Options.TooltipWrink === 1 && CM.Disp.TooltipWrinklerArea === 1) { // Latter is set by CM.Main.AddWrinklerAreaDetect
var showingTooltip = false; var showingTooltip = false;
for (let i of Object.keys(Game.wrinklers)) { for (let i of Object.keys(Game.wrinklers)) {
var me = Game.wrinklers[i]; var me = Game.wrinklers[i];
if (me.phase > 0 && me.selected) { if (me.phase > 0 && me.selected) {
showingTooltip = true; showingTooltip = true;
if (CM.Disp.TooltipWrinklerBeingShown[i] == 0 || CM.Disp.TooltipWrinklerBeingShown[i] == undefined) { if (CM.Disp.TooltipWrinklerBeingShown[i] === 0 || CM.Disp.TooltipWrinklerBeingShown[i] === undefined) {
var placeholder = document.createElement('div'); var placeholder = document.createElement('div');
var wrinkler = document.createElement('div'); var wrinkler = document.createElement('div');
wrinkler.style.minWidth = '120px'; wrinkler.style.minWidth = '120px';
@@ -1856,18 +1858,18 @@ CM.Disp.CheckWrinklerTooltip = function() {
* TODO: Change this code to be the same as other tooltips. Fit this into CM.Disp.UpdateTooltip() * TODO: Change this code to be the same as other tooltips. Fit this into CM.Disp.UpdateTooltip()
*/ */
CM.Disp.UpdateWrinklerTooltip = function() { CM.Disp.UpdateWrinklerTooltip = function() {
if (CM.Options.TooltipWrink == 1 && l('CMTooltipWrinkler') != null) { if (CM.Options.TooltipWrink === 1 && l('CMTooltipWrinkler') != null) {
var sucked = Game.wrinklers[CM.Disp.TooltipWrinkler].sucked; var sucked = Game.wrinklers[CM.Disp.TooltipWrinkler].sucked;
var toSuck = 1.1; var toSuck = 1.1;
if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05; if (Game.Has('Sacrilegious corruption')) toSuck *= 1.05;
if (Game.wrinklers[CM.Disp.TooltipWrinkler].type == 1) toSuck *= 3; // Shiny wrinklers if (Game.wrinklers[CM.Disp.TooltipWrinkler].type === 1) toSuck *= 3; // Shiny wrinklers
sucked *= toSuck; sucked *= toSuck;
if (Game.Has('Wrinklerspawn')) sucked *= 1.05; if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
if (CM.Sim.Objects.Temple.minigameLoaded) { if (CM.Sim.Objects.Temple.minigameLoaded) {
var godLvl = CM.Sim.hasGod('scorn'); var godLvl = CM.Sim.hasGod('scorn');
if (godLvl == 1) sucked *= 1.15; if (godLvl === 1) sucked *= 1.15;
else if (godLvl == 2) sucked *= 1.1; else if (godLvl === 2) sucked *= 1.1;
else if (godLvl == 3) sucked *= 1.05; else if (godLvl === 3) sucked *= 1.05;
} }
l('CMTooltipWrinkler').textContent = Beautify(sucked); l('CMTooltipWrinkler').textContent = Beautify(sucked);
} }
@@ -1882,7 +1884,7 @@ CM.Disp.UpdateWrinklerTooltip = function() {
* @param {number} aura The number of the aura currently selected by the mouse/user * @param {number} aura The number of the aura currently selected by the mouse/user
*/ */
CM.Disp.AddAuraInfo = function(aura) { CM.Disp.AddAuraInfo = function(aura) {
if (CM.Options.DragonAuraInfo == 1) { if (CM.Options.DragonAuraInfo === 1) {
var [bonusCPS, priceOfChange] = CM.Sim.CalculateChangeAura(aura); var [bonusCPS, priceOfChange] = CM.Sim.CalculateChangeAura(aura);
var timeToRecover = CM.Disp.FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs)); var timeToRecover = CM.Disp.FormatTime(priceOfChange / (bonusCPS + Game.cookiesPs));
var bonusCPSPercentage = CM.Disp.Beautify(bonusCPS / Game.cookiesPs); var bonusCPSPercentage = CM.Disp.Beautify(bonusCPS / Game.cookiesPs);
@@ -1912,7 +1914,7 @@ CM.Disp.AddDragonLevelUpTooltip = function() {
// Check if it is the dragon popup that is on screen // Check if it is the dragon popup that is on screen
if ((l('specialPopup').className.match(/onScreen/) && l('specialPopup').children[0].style.background.match(/dragon/)) != null) { if ((l('specialPopup').className.match(/onScreen/) && l('specialPopup').children[0].style.background.match(/dragon/)) != null) {
for (let i = 0; i < l('specialPopup').childNodes.length; i++) { for (let i = 0; i < l('specialPopup').childNodes.length; i++) {
if (l('specialPopup').childNodes[i].className == "optionBox") { if (l('specialPopup').childNodes[i].className === "optionBox") {
l('specialPopup').children[i].onmouseover = function() {CM.Cache.CacheDragonCost(); Game.tooltip.dynamic = 1; Game.tooltip.draw(l('specialPopup'), `<div style="min-width:200px;text-align:center;">${CM.Cache.CostDragonUpgrade}</div>`, 'this'); Game.tooltip.wobble();}; l('specialPopup').children[i].onmouseover = function() {CM.Cache.CacheDragonCost(); Game.tooltip.dynamic = 1; Game.tooltip.draw(l('specialPopup'), `<div style="min-width:200px;text-align:center;">${CM.Cache.CostDragonUpgrade}</div>`, 'this'); Game.tooltip.wobble();};
l('specialPopup').children[i].onmouseout = function() {Game.tooltip.shouldHide = 1;}; l('specialPopup').children[i].onmouseout = function() {Game.tooltip.shouldHide = 1;};
} }
@@ -1935,10 +1937,10 @@ CM.Disp.AddMenu = function() {
return div; return div;
}; };
if (Game.onMenu == 'prefs') { if (Game.onMenu === 'prefs') {
CM.Disp.AddMenuPref(title); CM.Disp.AddMenuPref(title);
} }
else if (Game.onMenu == 'stats') { else if (Game.onMenu === 'stats') {
if (CM.Options.Stats) { if (CM.Options.Stats) {
CM.Disp.AddMenuStats(title); CM.Disp.AddMenuStats(title);
} }
@@ -1950,7 +1952,7 @@ CM.Disp.AddMenu = function() {
* It is called by CM.Loop() * It is called by CM.Loop()
*/ */
CM.Disp.RefreshMenu = function() { CM.Disp.RefreshMenu = function() {
if (CM.Options.UpStats && Game.onMenu == 'stats' && (Game.drawT - 1) % (Game.fps * 5) != 0 && (Game.drawT - 1) % Game.fps == 0) Game.UpdateMenu(); if (CM.Options.UpStats && Game.onMenu === 'stats' && (Game.drawT - 1) % (Game.fps * 5) != 0 && (Game.drawT - 1) % Game.fps === 0) Game.UpdateMenu();
}; };
/******** /********
@@ -1970,7 +1972,7 @@ CM.Disp.AddMenuPref = function(title) {
frag.appendChild(groupObject); frag.appendChild(groupObject);
if (CM.Options.Header[group]) { // 0 is show, 1 is collapsed if (CM.Options.Header[group]) { // 0 is show, 1 is collapsed
// Make sub-sections of Notification section // Make sub-sections of Notification section
if (group == "Notification") { if (group === "Notification") {
for (let subGroup of Object.keys(CM.ConfigGroupsNotification)) { for (let subGroup of Object.keys(CM.ConfigGroupsNotification)) {
let subGroupObject = CM.Disp.CreatePrefHeader(subGroup, CM.ConfigGroupsNotification[subGroup]); // (group, display-name of group) let subGroupObject = CM.Disp.CreatePrefHeader(subGroup, CM.ConfigGroupsNotification[subGroup]); // (group, display-name of group)
subGroupObject.style.fontSize = "15px"; subGroupObject.style.fontSize = "15px";
@@ -1978,13 +1980,13 @@ CM.Disp.AddMenuPref = function(title) {
frag.appendChild(subGroupObject); frag.appendChild(subGroupObject);
if (CM.Options.Header[subGroup]) { if (CM.Options.Header[subGroup]) {
for (var option in CM.ConfigData) { for (var option in CM.ConfigData) {
if (CM.ConfigData[option].group == subGroup) frag.appendChild(CM.Disp.CreatePrefOption(option)); if (CM.ConfigData[option].group === subGroup) frag.appendChild(CM.Disp.CreatePrefOption(option));
} }
} }
} }
} else { } else {
for (let option of Object.keys(CM.ConfigData)) { for (let option of Object.keys(CM.ConfigData)) {
if (CM.ConfigData[option].group == group) frag.appendChild(CM.Disp.CreatePrefOption(option)); if (CM.ConfigData[option].group === group) frag.appendChild(CM.Disp.CreatePrefOption(option));
} }
} }
} }
@@ -2040,11 +2042,11 @@ CM.Disp.CreatePrefHeader = function(config, text) {
* @returns {object} div The option object * @returns {object} div The option object
*/ */
CM.Disp.CreatePrefOption = function(config) { CM.Disp.CreatePrefOption = function(config) {
if (CM.ConfigData[config].type == "bool") { if (CM.ConfigData[config].type === "bool") {
let div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
let a = document.createElement('a'); let a = document.createElement('a');
if (CM.ConfigData[config].toggle && CM.Options[config] == 0) { if (CM.ConfigData[config].toggle && CM.Options[config] === 0) {
a.className = 'option off'; a.className = 'option off';
} }
else { else {
@@ -2059,7 +2061,7 @@ CM.Disp.CreatePrefOption = function(config) {
div.appendChild(label); div.appendChild(label);
return div; return div;
} }
else if (CM.ConfigData[config].type == "vol") { else if (CM.ConfigData[config].type === "vol") {
let div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
var volume = document.createElement('div'); var volume = document.createElement('div');
@@ -2088,7 +2090,7 @@ CM.Disp.CreatePrefOption = function(config) {
div.appendChild(volume); div.appendChild(volume);
return div; return div;
} }
else if (CM.ConfigData[config].type == "url") { else if (CM.ConfigData[config].type === "url") {
let div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
let span = document.createElement('span'); let span = document.createElement('span');
@@ -2119,7 +2121,7 @@ CM.Disp.CreatePrefOption = function(config) {
div.appendChild(label); div.appendChild(label);
return div; return div;
} }
else if (CM.ConfigData[config].type == "color") { else if (CM.ConfigData[config].type === "color") {
let div = document.createElement('div'); let div = document.createElement('div');
for (let i = 0; i < CM.Disp.colors.length; i++) { for (let i = 0; i < CM.Disp.colors.length; i++) {
let innerDiv = document.createElement('div'); let innerDiv = document.createElement('div');
@@ -2138,7 +2140,7 @@ CM.Disp.CreatePrefOption = function(config) {
} }
return div; return div;
} }
else if (CM.ConfigData[config].type == "numscale") { else if (CM.ConfigData[config].type === "numscale") {
let div = document.createElement('div'); let div = document.createElement('div');
div.className = 'listing'; div.className = 'listing';
let span = document.createElement('span'); let span = document.createElement('span');
@@ -2171,7 +2173,7 @@ CM.Disp.CreatePrefOption = function(config) {
* It is called by a change in CM.Options.DetailedTime * It is called by a change in CM.Options.DetailedTime
*/ */
CM.Disp.ToggleDetailedTime = function() { CM.Disp.ToggleDetailedTime = function() {
if (CM.Options.DetailedTime == 1) Game.sayTime = CM.Disp.sayTime; if (CM.Options.DetailedTime === 1) Game.sayTime = CM.Disp.sayTime;
else Game.sayTime = CM.Backup.sayTime; else Game.sayTime = CM.Backup.sayTime;
}; };
@@ -2310,7 +2312,7 @@ CM.Disp.AddMenuStats = function(title) {
var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg'));
var centEgg = Game.Has('Century egg'); var centEgg = Game.Has('Century egg');
if (Game.season == 'christmas' || specDisp || choEgg || centEgg) { if (Game.season === 'christmas' || specDisp || choEgg || centEgg) {
stats.appendChild(CM.Disp.CreateStatsHeader('Season Specials', 'Sea')); stats.appendChild(CM.Disp.CreateStatsHeader('Season Specials', 'Sea'));
if (CM.Options.Header.Sea) { if (CM.Options.Header.Sea) {
if (missingHalloweenCookies.length != 0) stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Halloween Cookies Left to Buy', CM.Disp.CreateStatsMissDisp(missingHalloweenCookies))); if (missingHalloweenCookies.length != 0) stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Halloween Cookies Left to Buy', CM.Disp.CreateStatsMissDisp(missingHalloweenCookies)));
@@ -2320,7 +2322,7 @@ CM.Disp.AddMenuStats = function(title) {
if (missingRareEggs.length != 0) stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rare Easter Eggs Left to Unlock', CM.Disp.CreateStatsMissDisp(missingRareEggs))); if (missingRareEggs.length != 0) stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rare Easter Eggs Left to Unlock', CM.Disp.CreateStatsMissDisp(missingRareEggs)));
if (missingPlantDrops.length != 0) stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rare Plant Drops Left to Unlock', CM.Disp.CreateStatsMissDisp(missingPlantDrops))); if (missingPlantDrops.length != 0) stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rare Plant Drops Left to Unlock', CM.Disp.CreateStatsMissDisp(missingPlantDrops)));
if (Game.season == 'christmas') stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Reindeer Reward', document.createTextNode(Beautify(CM.Cache.SeaSpec)))); if (Game.season === 'christmas') stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Reindeer Reward', document.createTextNode(Beautify(CM.Cache.SeaSpec))));
if (choEgg) { if (choEgg) {
stats.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'Chocolate Egg Cookies', document.createTextNode(Beautify(CM.Cache.lastChoEgg)), 'ChoEggTooltipPlaceholder')); stats.appendChild(CM.Disp.CreateStatsListing("withTooltip", 'Chocolate Egg Cookies', document.createTextNode(Beautify(CM.Cache.lastChoEgg)), 'ChoEggTooltipPlaceholder'));
} }
@@ -2333,10 +2335,10 @@ CM.Disp.AddMenuStats = function(title) {
stats.appendChild(CM.Disp.CreateStatsHeader('Miscellaneous', 'Misc')); stats.appendChild(CM.Disp.CreateStatsHeader('Miscellaneous', 'Misc'));
if (CM.Options.Header.Misc) { if (CM.Options.Header.Misc) {
stats.appendChild(CM.Disp.CreateStatsListing("basic", stats.appendChild(CM.Disp.CreateStatsListing("basic",
'Average Cookies Per Second (Past ' + (CM.Disp.cookieTimes[CM.Options.AvgCPSHist] < 60 ? (CM.Disp.cookieTimes[CM.Options.AvgCPSHist] + ' seconds') : ((CM.Disp.cookieTimes[CM.Options.AvgCPSHist] / 60) + (CM.Options.AvgCPSHist == 3 ? ' minute' : ' minutes'))) + ')', 'Average Cookies Per Second (Past ' + (CM.Disp.cookieTimes[CM.Options.AvgCPSHist] < 60 ? (CM.Disp.cookieTimes[CM.Options.AvgCPSHist] + ' seconds') : ((CM.Disp.cookieTimes[CM.Options.AvgCPSHist] / 60) + (CM.Options.AvgCPSHist === 3 ? ' minute' : ' minutes'))) + ')',
document.createTextNode(Beautify(CM.Cache.AvgCPS, 3)) document.createTextNode(Beautify(CM.Cache.AvgCPS, 3))
)); ));
stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Average Cookie Clicks Per Second (Past ' + CM.Disp.clickTimes[CM.Options.AvgClicksHist] + (CM.Options.AvgClicksHist == 0 ? ' second' : ' seconds') + ')', document.createTextNode(Beautify(CM.Cache.AverageClicks, 1)))); stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Average Cookie Clicks Per Second (Past ' + CM.Disp.clickTimes[CM.Options.AvgClicksHist] + (CM.Options.AvgClicksHist === 0 ? ' second' : ' seconds') + ')', document.createTextNode(Beautify(CM.Cache.AverageClicks, 1))));
if (Game.Has('Fortune cookies')) { if (Game.Has('Fortune cookies')) {
var fortunes = []; var fortunes = [];
for (let i of Object.keys(CM.Data.Fortunes)) { for (let i of Object.keys(CM.Data.Fortunes)) {
@@ -2410,7 +2412,7 @@ CM.Disp.CreateStatsListing = function(type, name, text, placeholder) {
var listingName = document.createElement('b'); var listingName = document.createElement('b');
listingName.textContent = name; listingName.textContent = name;
div.appendChild(listingName); div.appendChild(listingName);
if (type == "withTooltip") { if (type === "withTooltip") {
div.className = 'listing'; div.className = 'listing';
var tooltip = document.createElement('span'); var tooltip = document.createElement('span');
@@ -2809,7 +2811,7 @@ CM.Disp.AddMissingUpgrades = function() {
*/ */
CM.Disp.crateMissing = function(me) { CM.Disp.crateMissing = function(me) {
var classes = 'crate upgrade missing'; var classes = 'crate upgrade missing';
if (me.pool == 'prestige') classes+=' heavenly'; if (me.pool === 'prestige') classes+=' heavenly';
var noFrame = 0; var noFrame = 0;
if (!Game.prefs.crates) noFrame = 1; if (!Game.prefs.crates) noFrame = 1;
@@ -2924,6 +2926,11 @@ CM.Disp.clickTimes = [1, 5, 10, 15, 30];
*/ */
CM.Disp.TooltipWrinklerBeingShown = []; CM.Disp.TooltipWrinklerBeingShown = [];
/**
* Used to store the number of cookies to be displayed in the tab-title
*/
CM.Disp.Title = '';
/** /**
* These are variables with base-values that get initalized when initliazing CookieMonster * These are variables with base-values that get initalized when initliazing CookieMonster
* TODO: See if these can be removed or moved * TODO: See if these can be removed or moved

View File

@@ -94,7 +94,7 @@ CM.ReplaceNative = function() {
}; };
CM.Backup.Logic = Game.Logic; CM.Backup.Logic = Game.Logic;
eval('CM.Backup.LogicMod = ' + Game.Logic.toString().split('document.title').join('CM.Cache.Title')); eval('CM.Backup.LogicMod = ' + Game.Logic.toString().split('document.title').join('CM.Disp.Title'));
Game.Logic = function() { Game.Logic = function() {
CM.Backup.LogicMod(); CM.Backup.LogicMod();
@@ -129,7 +129,7 @@ CM.ReplaceNativeGrimoireDraw = function() {
CM.Backup.GrimoireDraw = minigame.draw; CM.Backup.GrimoireDraw = minigame.draw;
Game.Objects['Wizard tower'].minigame.draw = function() { Game.Objects['Wizard tower'].minigame.draw = function() {
CM.Backup.GrimoireDraw(); CM.Backup.GrimoireDraw();
if (CM.Options.GrimoireBar == 1 && minigame.magic < minigame.magicM) { if (CM.Options.GrimoireBar === 1 && minigame.magic < minigame.magicM) {
minigame.magicBarTextL.innerHTML += ' (' + CM.Disp.FormatTime(CM.Disp.CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM)) + ')'; minigame.magicBarTextL.innerHTML += ' (' + CM.Disp.FormatTime(CM.Disp.CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, minigame.magicM)) + ')';
} }
}; };
@@ -142,7 +142,7 @@ CM.Loop = function() {
CM.Disp.lastAscendState = Game.OnAscend; CM.Disp.lastAscendState = Game.OnAscend;
CM.Disp.UpdateAscendState(); CM.Disp.UpdateAscendState();
} }
if (!Game.OnAscend && Game.AscendTimer == 0) { if (!Game.OnAscend && Game.AscendTimer === 0) {
// CM.Sim.DoSims is set whenever CPS has changed // CM.Sim.DoSims is set whenever CPS has changed
if (CM.Sim.DoSims) { if (CM.Sim.DoSims) {
CM.Cache.RemakeIncome(); CM.Cache.RemakeIncome();
@@ -334,7 +334,7 @@ CM.Main.FindShimmer = function() {
CM.Cache.goldenShimmersByID = {}; CM.Cache.goldenShimmersByID = {};
for (let i of Object.keys(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];
CM.Main.currSpawnedGoldenCookieState += 1; CM.Main.currSpawnedGoldenCookieState += 1;
} }
@@ -348,7 +348,7 @@ CM.Main.FindShimmer = function() {
CM.Main.CheckGoldenCookie = function() { CM.Main.CheckGoldenCookie = function() {
CM.Main.FindShimmer(); CM.Main.FindShimmer();
for (let i of Object.keys(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]);
delete CM.Disp.GCTimers[i]; delete CM.Disp.GCTimers[i];
} }
@@ -363,16 +363,16 @@ CM.Main.CheckGoldenCookie = function() {
} }
for (let i of Object.keys(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]);
} }
} }
} }
CM.Disp.UpdateFavicon(); CM.Disp.UpdateFavicon();
CM.Main.lastSpawnedGoldenCookieState = CM.Main.currSpawnedGoldenCookieState; CM.Main.lastSpawnedGoldenCookieState = CM.Main.currSpawnedGoldenCookieState;
if (CM.Main.currSpawnedGoldenCookieState == 0) CM.Cache.spawnedGoldenShimmer = 0; if (CM.Main.currSpawnedGoldenCookieState === 0) CM.Cache.spawnedGoldenShimmer = 0;
} }
else if (CM.Options.GCTimer == 1 && CM.Main.lastGoldenCookieState) { else if (CM.Options.GCTimer === 1 && CM.Main.lastGoldenCookieState) {
for (let i of Object.keys(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;
@@ -389,7 +389,7 @@ 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 (let i of Object.keys(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;
} }
@@ -405,8 +405,8 @@ CM.Main.CheckSeasonPopup = function() {
* It is called by CM.Loop * It is called by CM.Loop
*/ */
CM.Main.CheckTickerFortune = function() { CM.Main.CheckTickerFortune = function() {
if (CM.Main.lastTickerFortuneState != (Game.TickerEffect && Game.TickerEffect.type == 'fortune')) { if (CM.Main.lastTickerFortuneState != (Game.TickerEffect && Game.TickerEffect.type === 'fortune')) {
CM.Main.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type == 'fortune'); CM.Main.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type === 'fortune');
if (CM.Main.lastTickerFortuneState) { if (CM.Main.lastTickerFortuneState) {
CM.Disp.Flash(3, 'FortuneFlash'); CM.Disp.Flash(3, 'FortuneFlash');
CM.Disp.PlaySound(CM.Options.FortuneSoundURL, 'FortuneSound', 'FortuneVolume'); CM.Disp.PlaySound(CM.Options.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
@@ -434,7 +434,7 @@ CM.Main.CheckGardenTick = function() {
* It is called by CM.Loop * It is called by CM.Loop
*/ */
CM.Main.CheckMagicMeter = function() { CM.Main.CheckMagicMeter = function() {
if (Game.Objects['Wizard tower'].minigameLoaded && CM.Options.GrimoireBar == 1) { if (Game.Objects['Wizard tower'].minigameLoaded && CM.Options.GrimoireBar === 1) {
var minigame = Game.Objects['Wizard tower'].minigame; var minigame = Game.Objects['Wizard tower'].minigame;
if (minigame.magic < minigame.magicM) CM.Main.lastMagicBarFull = false; if (minigame.magic < minigame.magicM) CM.Main.lastMagicBarFull = false;
else if (!CM.Main.lastMagicBarFull) { else if (!CM.Main.lastMagicBarFull) {
@@ -454,21 +454,21 @@ CM.Main.CheckWrinklerCount = function() {
if (Game.elderWrath > 0) { if (Game.elderWrath > 0) {
var CurrentWrinklers = 0; var CurrentWrinklers = 0;
for (let 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) {
CM.Main.lastWrinklerCount = CurrentWrinklers; CM.Main.lastWrinklerCount = CurrentWrinklers;
if (CurrentWrinklers == Game.getWrinklersMax() && CM.Options.WrinklerMaxFlash) { if (CurrentWrinklers === Game.getWrinklersMax() && CM.Options.WrinklerMaxFlash) {
CM.Disp.Flash(3, 'WrinklerMaxFlash'); CM.Disp.Flash(3, 'WrinklerMaxFlash');
} else { } else {
CM.Disp.Flash(3, 'WrinklerFlash'); CM.Disp.Flash(3, 'WrinklerFlash');
} }
if (CurrentWrinklers == Game.getWrinklersMax() && CM.Options.WrinklerMaxSound) { if (CurrentWrinklers === Game.getWrinklersMax() && CM.Options.WrinklerMaxSound) {
CM.Disp.PlaySound(CM.Options.WrinklerMaxSoundURL, 'WrinklerMaxSound', 'WrinklerMaxVolume'); CM.Disp.PlaySound(CM.Options.WrinklerMaxSoundURL, 'WrinklerMaxSound', 'WrinklerMaxVolume');
} else { } else {
CM.Disp.PlaySound(CM.Options.WrinklerSoundURL, 'WrinklerSound', 'WrinklerVolume'); CM.Disp.PlaySound(CM.Options.WrinklerSoundURL, 'WrinklerSound', 'WrinklerVolume');
} }
if (CurrentWrinklers == Game.getWrinklersMax() && CM.Options.WrinklerMaxNotification) { if (CurrentWrinklers === Game.getWrinklersMax() && CM.Options.WrinklerMaxNotification) {
CM.Disp.Notification('WrinklerMaxNotification', "Maximum Wrinklers Reached", "You have reached your maximum ammount of wrinklers"); CM.Disp.Notification('WrinklerMaxNotification', "Maximum Wrinklers Reached", "You have reached your maximum ammount of wrinklers");
} else { } else {
CM.Disp.Notification('WrinklerNotification', "A Wrinkler appeared", "A new wrinkler has appeared"); CM.Disp.Notification('WrinklerNotification', "A Wrinkler appeared", "A new wrinkler has appeared");
@@ -505,7 +505,7 @@ CM.Main.AddWrinklerAreaDetect = function() {
* before execution of their actual function * before execution of their actual function
*/ */
CM.Main.FixMouseY = function(target) { CM.Main.FixMouseY = function(target) {
if (CM.Options.TimerBar == 1 && CM.Options.TimerBarPos == 0) { if (CM.Options.TimerBar === 1 && CM.Options.TimerBarPos === 0) {
var timerBarHeight = parseInt(CM.Disp.TimerBar.style.height); var timerBarHeight = parseInt(CM.Disp.TimerBar.style.height);
Game.mouseY -= timerBarHeight; Game.mouseY -= timerBarHeight;
target(); target();

View File

@@ -47,7 +47,7 @@ CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, noSim) {
// If noSim is set, use Game methods to compute price instead of Sim ones. // If noSim is set, use Game methods to compute price instead of Sim ones.
noSim = typeof noSim === "undefined" ? 0 : noSim; noSim = typeof noSim === "undefined" ? 0 : 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 (let i = 0; i < amount; i++) { for (let i = 0; i < amount; i++) {
let price = basePrice * Math.pow(Game.priceIncrease, Math.max(0, start - free)); let price = basePrice * Math.pow(Game.priceIncrease, Math.max(0, start - free));
@@ -65,14 +65,14 @@ CM.Sim.BuildingSell = function(build, basePrice, start, free, amount, noSim) {
CM.Sim.Has = function(what) { CM.Sim.Has = function(what) {
let 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);
}; };
CM.Sim.Win = function(what) { CM.Sim.Win = function(what) {
if (CM.Sim.Achievements[what]) { if (CM.Sim.Achievements[what]) {
if (CM.Sim.Achievements[what].won == 0) { if (CM.Sim.Achievements[what].won === 0) {
CM.Sim.Achievements[what].won = 1; CM.Sim.Achievements[what].won = 1;
if (Game.Achievements[what].pool != 'shadow') CM.Sim.AchievementsOwned++; if (Game.Achievements[what].pool != 'shadow') CM.Sim.AchievementsOwned++;
} }
@@ -85,7 +85,7 @@ eval('CM.Sim.GetHeavenlyMultiplier = ' + Game.GetHeavenlyMultiplier.toString().s
// Check for Pantheon Auras // Check for Pantheon Auras
CM.Sim.hasAura = function(what) { CM.Sim.hasAura = function(what) {
if (Game.dragonAuras[CM.Sim.dragonAura].name == what || Game.dragonAuras[CM.Sim.dragonAura2].name == what) if (Game.dragonAuras[CM.Sim.dragonAura].name === what || Game.dragonAuras[CM.Sim.dragonAura2].name === what)
return true; return true;
else else
return false; return false;
@@ -95,9 +95,9 @@ CM.Sim.hasAura = function(what) {
// Used as CM.Sim.auraMult('Aura') * mult, i.e. CM.Sim.auraMult('Dragon God) * 0.05 // Used as CM.Sim.auraMult('Aura') * mult, i.e. CM.Sim.auraMult('Dragon God) * 0.05
CM.Sim.auraMult = function(what) { CM.Sim.auraMult = function(what) {
var n = 0; var n = 0;
if (Game.dragonAuras[CM.Sim.dragonAura].name == what || Game.dragonAuras[CM.Sim.dragonAura2].name == what) if (Game.dragonAuras[CM.Sim.dragonAura].name === what || Game.dragonAuras[CM.Sim.dragonAura2].name === what)
n = 1; n = 1;
if (Game.dragonAuras[CM.Sim.dragonAura].name == 'Reality Bending' || Game.dragonAuras[CM.Sim.dragonAura2].name == 'Reality Bending') if (Game.dragonAuras[CM.Sim.dragonAura].name === 'Reality Bending' || Game.dragonAuras[CM.Sim.dragonAura2].name === 'Reality Bending')
n += 0.1; n += 0.1;
return n; return n;
}; };
@@ -228,7 +228,7 @@ CM.Sim.CopyData = function() {
for (let i of Object.keys(Game.Objects)) { for (let i of Object.keys(Game.Objects)) {
let me = Game.Objects[i]; let me = Game.Objects[i];
let 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
} }
@@ -244,7 +244,7 @@ CM.Sim.CopyData = function() {
for (let i of Object.keys(Game.Upgrades)) { for (let i of Object.keys(Game.Upgrades)) {
let me = Game.Upgrades[i]; let me = Game.Upgrades[i];
let 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);
} }
you.bought = me.bought; you.bought = me.bought;
@@ -254,7 +254,7 @@ CM.Sim.CopyData = function() {
for (let i of Object.keys(Game.Achievements)) { for (let i of Object.keys(Game.Achievements)) {
let me = Game.Achievements[i]; let me = Game.Achievements[i];
let 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);
} }
you.won = me.won; you.won = me.won;
@@ -295,7 +295,7 @@ CM.Sim.CalculateGains = function() {
for (let i of Object.keys(Game.cookieUpgrades)) { for (let i of Object.keys(Game.cookieUpgrades)) {
let 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);
} }
} }
@@ -320,29 +320,29 @@ CM.Sim.CalculateGains = function() {
var buildMult = 1; var buildMult = 1;
if (CM.Sim.Objects.Temple.minigameLoaded) { if (CM.Sim.Objects.Temple.minigameLoaded) {
let 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;
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);
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;
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;
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;
} }
if (CM.Sim.Has('Santa\'s legacy')) mult *= 1 + (Game.santaLevel + 1) * 0.03; if (CM.Sim.Has('Santa\'s legacy')) mult *= 1 + (Game.santaLevel + 1) * 0.03;
@@ -354,9 +354,9 @@ CM.Sim.CalculateGains = function() {
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) {
let 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;
} }
// TODO Store minigame buffs? // TODO Store minigame buffs?
milkMult *= CM.Sim.eff('milk'); milkMult *= CM.Sim.eff('milk');
@@ -381,9 +381,9 @@ CM.Sim.CalculateGains = function() {
for (let i of Object.keys(CM.Sim.Objects)) { for (let i of Object.keys(CM.Sim.Objects)) {
let 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;
CM.Sim.cookiesPs += me.amount * storedCps; CM.Sim.cookiesPs += me.amount * storedCps;
} }
@@ -432,8 +432,8 @@ CM.Sim.CalculateGains = function() {
} }
var name = Game.bakeryName.toLowerCase(); var name = Game.bakeryName.toLowerCase();
if (name == 'orteil') mult *= 0.99; if (name === 'orteil') mult *= 0.99;
else if (name == 'ortiel') mult *= 0.98; else if (name === 'ortiel') mult *= 0.98;
// TODO: Move CalcWink option and calculation here from CM.Disp // TODO: Move CalcWink option and calculation here from CM.Disp
@@ -490,8 +490,8 @@ CM.Sim.CheckOtherAchiev = function() {
} }
} }
if (minAmount >= 1) CM.Sim.Win('One with everything'); if (minAmount >= 1) CM.Sim.Win('One with everything');
if (mathematician == 1) CM.Sim.Win('Mathematician'); if (mathematician === 1) CM.Sim.Win('Mathematician');
if (base10 == 1) CM.Sim.Win('Base 10'); if (base10 === 1) CM.Sim.Win('Base 10');
if (minAmount >= 100) CM.Sim.Win('Centennial'); if (minAmount >= 100) CM.Sim.Win('Centennial');
if (minAmount >= 150) CM.Sim.Win('Centennial and a half'); if (minAmount >= 150) CM.Sim.Win('Centennial and a half');
if (minAmount >= 200) CM.Sim.Win('Bicentennial'); if (minAmount >= 200) CM.Sim.Win('Bicentennial');
@@ -552,7 +552,7 @@ CM.Sim.BuyBuildings = function(amount, target) {
let me = CM.Sim.Objects[i]; let me = CM.Sim.Objects[i];
me.amount += amount; me.amount += amount;
if (i == 'Cursor') { if (i === 'Cursor') {
if (me.amount >= 1) CM.Sim.Win('Click'); if (me.amount >= 1) CM.Sim.Win('Click');
if (me.amount >= 2) CM.Sim.Win('Double-click'); if (me.amount >= 2) CM.Sim.Win('Double-click');
if (me.amount >= 50) CM.Sim.Win('Mouse wheel'); if (me.amount >= 50) CM.Sim.Win('Mouse wheel');
@@ -593,24 +593,24 @@ CM.Sim.BuyBuildings = function(amount, target) {
CM.Sim.BuyUpgrades = function() { CM.Sim.BuyUpgrades = function() {
CM.Cache.Upgrades = []; CM.Cache.Upgrades = [];
for (let i of Object.keys(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();
let 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++;
if (i == 'Elder Pledge') { if (i === 'Elder Pledge') {
CM.Sim.pledges++; CM.Sim.pledges++;
if (CM.Sim.pledges > 0) CM.Sim.Win('Elder nap'); if (CM.Sim.pledges > 0) CM.Sim.Win('Elder nap');
if (CM.Sim.pledges >= 5) CM.Sim.Win('Elder slumber'); if (CM.Sim.pledges >= 5) CM.Sim.Win('Elder slumber');
} }
else if (i == 'Elder Covenant') { else if (i === 'Elder Covenant') {
CM.Sim.Win('Elder calm'); CM.Sim.Win('Elder calm');
} }
else if (i == 'Prism heart biscuits') { else if (i === 'Prism heart biscuits') {
CM.Sim.Win('Lovely cookies'); CM.Sim.Win('Lovely cookies');
} }
else if (i == 'Heavenly key') { else if (i === 'Heavenly key') {
CM.Sim.Win('Wholesome'); CM.Sim.Win('Wholesome');
} }
@@ -693,7 +693,7 @@ CM.Sim.ResetBonus = function(possiblePresMax) {
CM.Sim.CopyData(); CM.Sim.CopyData();
if (CM.Sim.Upgrades['Heavenly key'].bought == 0) { if (CM.Sim.Upgrades['Heavenly key'].bought === 0) {
CM.Sim.Upgrades['Heavenly chip secret'].bought = 1; CM.Sim.Upgrades['Heavenly chip secret'].bought = 1;
CM.Sim.Upgrades['Heavenly cookie stand'].bought = 1; CM.Sim.Upgrades['Heavenly cookie stand'].bought = 1;
CM.Sim.Upgrades['Heavenly bakery'].bought = 1; CM.Sim.Upgrades['Heavenly bakery'].bought = 1;
@@ -772,9 +772,9 @@ CM.Sim.modifyBuildingPrice = function(building,price) {
price *= CM.Sim.eff('buildingCost'); price *= CM.Sim.eff('buildingCost');
if (CM.Sim.Objects.Temple.minigameLoaded) { if (CM.Sim.Objects.Temple.minigameLoaded) {
let 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;
} }
return price; return price;
}; };
@@ -883,9 +883,9 @@ CM.Sim.mouseCps = function() {
if (CM.Sim.hasGod) if (CM.Sim.hasGod)
{ {
var godLvl = CM.Sim.hasGod('labor'); var godLvl = CM.Sim.hasGod('labor');
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;
} }
} }