Removed nearly all TODO's #485
This commit is contained in:
File diff suppressed because one or more lines are too long
78
src/Cache.js
78
src/Cache.js
@@ -125,7 +125,7 @@ CM.Cache.CacheStats = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions calculates the multipliers of Golden and Wrath cookie rewards
|
* This functions calculates the multipliers of Golden and Wrath cookie rewards
|
||||||
* It is mostly used by CM.Cache.MaxChainMoni() and CM.Cache.CacheChain()
|
* It is mostly used by CM.Cache.MaxChainCookieReward() and CM.Cache.CacheChain()
|
||||||
* It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.CacheChain()
|
* It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.CacheChain()
|
||||||
* @param {number} CM.Cache.GoldenCookiesMult Multiplier for golden cookies
|
* @param {number} CM.Cache.GoldenCookiesMult Multiplier for golden cookies
|
||||||
* @param {number} CM.Cache.WrathCookiesMult Multiplier for wrath cookies
|
* @param {number} CM.Cache.WrathCookiesMult Multiplier for wrath cookies
|
||||||
@@ -166,21 +166,21 @@ CM.Cache.CacheGoldenAndWrathCookiesMults = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions calculates the max possible payout
|
* This functions calculates the max possible payout given a set of variables
|
||||||
* It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.CacheChain()
|
* It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.CacheChain()
|
||||||
* @param {number} digit Number of Golden Cookies in chain
|
* @param {number} digit Number of Golden Cookies in chain
|
||||||
* @param {number} maxPayout Maximum payout
|
* @param {number} maxPayout Maximum payout
|
||||||
* @param {number} mult Multiplier
|
* @param {number} mult Multiplier
|
||||||
* @returns [{number, number}] Total cookies earned, and cookies needed for next level
|
* @returns [{number, number}] Total cookies earned, and cookies needed for next level
|
||||||
*/
|
*/
|
||||||
CM.Cache.MaxChainMoni = function(digit, maxPayout, mult) {
|
CM.Cache.MaxChainCookieReward = function(digit, maxPayout, mult) {
|
||||||
let totalFromChain = 0;
|
let totalFromChain = 0;
|
||||||
let moni = 0;
|
let moni = 0;
|
||||||
let nextMoni = 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);
|
||||||
while (nextMoni < maxPayout) {
|
while (nextMoni < maxPayout) {
|
||||||
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
|
// TODO: Calculate Cookies or cps needed for next level of chain. Related to issue #580
|
||||||
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;
|
totalFromChain += moni;
|
||||||
chain++;
|
chain++;
|
||||||
@@ -211,20 +211,21 @@ CM.Cache.CacheChain = 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.GoldenCookiesMult);
|
CM.Cache.ChainReward = CM.Cache.MaxChainCookieReward(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
|
// TODO: All "required" variables are incorrect. Perhaps something to do with going over the required amount during the chain.
|
||||||
|
// See issue #580 on the Github
|
||||||
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.WrathCookiesMult);
|
CM.Cache.ChainWrathReward = CM.Cache.MaxChainCookieReward(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.GoldenCookiesMult);
|
CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainCookieReward(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.WrathCookiesMult);
|
CM.Cache.ChainFrenzyWrathReward = CM.Cache.MaxChainCookieReward(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;
|
||||||
};
|
};
|
||||||
@@ -304,7 +305,11 @@ class CMAvgQueue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Might want to do this according to "https://stackoverflow.com/questions/10359907/how-to-compute-the-sum-and-average-of-elements-in-an-array"
|
/**
|
||||||
|
* This functions returns the average of the values in the queue
|
||||||
|
* @param {number} timePeriod The period in seconds to computer average over
|
||||||
|
* @returns {number} ret The average
|
||||||
|
*/
|
||||||
calcAverage (timePeriod) {
|
calcAverage (timePeriod) {
|
||||||
if (timePeriod > this.maxLength) timePeriod = this.maxLength;
|
if (timePeriod > this.maxLength) timePeriod = this.maxLength;
|
||||||
if (timePeriod > this.queue.length) timePeriod = this.queue.length;
|
if (timePeriod > this.queue.length) timePeriod = this.queue.length;
|
||||||
@@ -331,38 +336,36 @@ 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.Main.Loop()
|
* It is called by CM.Main.Loop()
|
||||||
* TODO: Check if this can be made more concise
|
|
||||||
* @global {number} CM.Cache.RealCookiesEarned Cookies earned including the Chocolate Egg
|
* @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
|
||||||
*/
|
*/
|
||||||
CM.Cache.CacheAvgCPS = function() {
|
CM.Cache.CacheAvgCPS = function() {
|
||||||
var currDate = Math.floor(Date.now() / 1000);
|
let 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;
|
let choEggTotal = Game.cookies + CM.Cache.SellForChoEgg;
|
||||||
if (Game.cpsSucked > 0) {
|
if (Game.cpsSucked > 0) choEggTotal += CM.Cache.WrinklersTotal;
|
||||||
choEggTotal += CM.Cache.WrinklersTotal;
|
|
||||||
}
|
|
||||||
CM.Cache.RealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal);
|
CM.Cache.RealCookiesEarned = Math.max(Game.cookiesEarned, choEggTotal);
|
||||||
choEggTotal *= 0.05;
|
choEggTotal *= 0.05;
|
||||||
|
|
||||||
if (CM.Cache.lastDate != -1) {
|
// Add recent gains to AvgQueue's
|
||||||
var timeDiff = currDate - CM.Cache.lastDate;
|
let timeDiff = currDate - CM.Cache.lastDate;
|
||||||
var bankDiffAvg = Math.max(0, (Game.cookies - CM.Cache.lastCookies)) / timeDiff;
|
let bankDiffAvg = Math.max(0, (Game.cookies - CM.Cache.lastCookies)) / timeDiff;
|
||||||
var wrinkDiffAvg = Math.max(0, (CM.Cache.WrinklersTotal - CM.Cache.lastWrinkCookies)) / timeDiff;
|
let wrinkDiffAvg = Math.max(0, (CM.Cache.WrinklersTotal - CM.Cache.lastWrinkCookies)) / timeDiff;
|
||||||
var wrinkFattestDiffAvg = Math.max(0, (CM.Cache.WrinklersFattest[0] - CM.Cache.lastWrinkFattestCookies)) / timeDiff;
|
let wrinkFattestDiffAvg = Math.max(0, (CM.Cache.WrinklersFattest[0] - CM.Cache.lastWrinkFattestCookies)) / timeDiff;
|
||||||
var choEggDiffAvg = Math.max(0,(choEggTotal - CM.Cache.lastChoEgg)) / timeDiff;
|
let choEggDiffAvg = Math.max(0,(choEggTotal - CM.Cache.lastChoEgg)) / timeDiff;
|
||||||
var clicksDiffAvg = (Game.cookieClicks - CM.Cache.lastClicks) / timeDiff;
|
let clicksDiffAvg = (Game.cookieClicks - CM.Cache.lastClicks) / timeDiff;
|
||||||
for (let i = 0; i < timeDiff; i++) {
|
for (let i = 0; i < timeDiff; i++) {
|
||||||
CM.Cache.CookiesDiff.addLatest(bankDiffAvg);
|
CM.Cache.CookiesDiff.addLatest(bankDiffAvg);
|
||||||
CM.Cache.WrinkDiff.addLatest(wrinkDiffAvg);
|
CM.Cache.WrinkDiff.addLatest(wrinkDiffAvg);
|
||||||
CM.Cache.WrinkFattestDiff.addLatest(wrinkFattestDiffAvg);
|
CM.Cache.WrinkFattestDiff.addLatest(wrinkFattestDiffAvg);
|
||||||
CM.Cache.ChoEggDiff.addLatest(choEggDiffAvg);
|
CM.Cache.ChoEggDiff.addLatest(choEggDiffAvg);
|
||||||
CM.Cache.ClicksDiff.addLatest(clicksDiffAvg);
|
CM.Cache.ClicksDiff.addLatest(clicksDiffAvg);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store current data for next loop
|
||||||
CM.Cache.lastDate = currDate;
|
CM.Cache.lastDate = currDate;
|
||||||
CM.Cache.lastCookies = Game.cookies;
|
CM.Cache.lastCookies = Game.cookies;
|
||||||
CM.Cache.lastWrinkCookies = CM.Cache.WrinklersTotal;
|
CM.Cache.lastWrinkCookies = CM.Cache.WrinklersTotal;
|
||||||
@@ -370,18 +373,17 @@ CM.Cache.CacheAvgCPS = function() {
|
|||||||
CM.Cache.lastChoEgg = choEggTotal;
|
CM.Cache.lastChoEgg = choEggTotal;
|
||||||
CM.Cache.lastClicks = Game.cookieClicks;
|
CM.Cache.lastClicks = Game.cookieClicks;
|
||||||
|
|
||||||
var cpsLength = CM.Disp.cookieTimes[CM.Options.AvgCPSHist];
|
// Get average gain over period of cpsLength seconds
|
||||||
|
let cpsLength = CM.Disp.cookieTimes[CM.Options.AvgCPSHist];
|
||||||
CM.Cache.AverageGainBank = CM.Cache.CookiesDiff.calcAverage(cpsLength);
|
CM.Cache.AverageGainBank = CM.Cache.CookiesDiff.calcAverage(cpsLength);
|
||||||
CM.Cache.AverageGainWrink = CM.Cache.WrinkDiff.calcAverage(cpsLength);
|
CM.Cache.AverageGainWrink = CM.Cache.WrinkDiff.calcAverage(cpsLength);
|
||||||
CM.Cache.AverageGainWrinkFattest = CM.Cache.WrinkFattestDiff.calcAverage(cpsLength);
|
CM.Cache.AverageGainWrinkFattest = CM.Cache.WrinkFattestDiff.calcAverage(cpsLength);
|
||||||
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'));
|
let 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);
|
||||||
@@ -398,13 +400,13 @@ CM.Cache.CacheAvgCPS = function() {
|
|||||||
* @global {number} CM.Cache.SellForChoEgg Total cookies to be gained from selling Chocolate egg
|
* @global {number} CM.Cache.SellForChoEgg Total cookies to be gained from selling Chocolate egg
|
||||||
*/
|
*/
|
||||||
CM.Cache.CacheSellForChoEgg = function() {
|
CM.Cache.CacheSellForChoEgg = function() {
|
||||||
var sellTotal = 0;
|
let sellTotal = 0;
|
||||||
// Compute cookies earned by selling stock market goods
|
// Compute cookies earned by selling stock market goods
|
||||||
if (Game.Objects.Bank.minigameLoaded) {
|
if (Game.Objects.Bank.minigameLoaded) {
|
||||||
var marketGoods = Game.Objects.Bank.minigame.goods;
|
let marketGoods = Game.Objects.Bank.minigame.goods;
|
||||||
var goodsVal = 0;
|
let goodsVal = 0;
|
||||||
for (let i of Object.keys(marketGoods)) {
|
for (let i of Object.keys(marketGoods)) {
|
||||||
var marketGood = marketGoods[i];
|
let marketGood = marketGoods[i];
|
||||||
goodsVal += marketGood.stock * marketGood.val;
|
goodsVal += marketGood.stock * marketGood.val;
|
||||||
}
|
}
|
||||||
sellTotal += goodsVal * Game.cookiesPsRawHighest;
|
sellTotal += goodsVal * Game.cookiesPsRawHighest;
|
||||||
|
|||||||
84
src/Disp.js
84
src/Disp.js
@@ -82,42 +82,23 @@ CM.Disp.CalculateGrimoireRefillTime = function(currentMagic, maxMagic, targetMag
|
|||||||
/**
|
/**
|
||||||
* This function returns Name and Color as object for sugar lump type that is given as input param.
|
* This function returns Name and Color as object for sugar lump type that is given as input param.
|
||||||
* It is called by CM.Disp.UpdateTooltipSugarLump()
|
* It is called by CM.Disp.UpdateTooltipSugarLump()
|
||||||
* TODO: Can't this be done with a normal array in Data.js? Or as variable-array at end of this file?
|
|
||||||
* @param {string} type Sugar Lump Type.
|
* @param {string} type Sugar Lump Type.
|
||||||
* @returns {{string}, {string}} text, color An array containing the text and display-color of the sugar lump
|
* @returns {{string}, {string}} text, color An array containing the text and display-color of the sugar lump
|
||||||
*/
|
*/
|
||||||
CM.Disp.GetLumpColor = function(type) {
|
CM.Disp.GetLumpColor = function(type) {
|
||||||
var name = "";
|
if (type === 0) {
|
||||||
var color = "";
|
return {text: "Normal", color: CM.Disp.colorGray};
|
||||||
|
} else if (type === 1) {
|
||||||
switch (type) {
|
return {text: "Bifurcated", color: CM.Disp.colorGreen};
|
||||||
case 0:
|
} else if (type === 2) {
|
||||||
name = "Normal";
|
return {text: "Golden", color: CM.Disp.colorYellow};
|
||||||
color = CM.Disp.colorGray;
|
} else if (type === 3) {
|
||||||
break;
|
return {text: "Meaty", color: CM.Disp.colorOrange};
|
||||||
case 1:
|
} else if (type === 4) {
|
||||||
name = "Bifurcated";
|
return {text: "Caramelized", color: CM.Disp.colorPurple};
|
||||||
color = CM.Disp.colorGreen;
|
} else {
|
||||||
break;
|
return {text: "Unknown Sugar Lump", color: CM.Disp.colorRed};
|
||||||
case 2:
|
}
|
||||||
name = "Golden";
|
|
||||||
color = CM.Disp.colorYellow;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
name = "Meaty";
|
|
||||||
color = CM.Disp.colorOrange;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
name = "Caramelized";
|
|
||||||
color = CM.Disp.colorPurple;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
name = "Unknown Sugar Lump";
|
|
||||||
color = CM.Disp.colorRed;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {text: name, color: color};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/********
|
/********
|
||||||
@@ -286,6 +267,18 @@ CM.Disp.CreateCssArea = function() {
|
|||||||
document.head.appendChild(CM.Disp.Css);
|
document.head.appendChild(CM.Disp.Css);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function updates the style of the building and upgrade sections to make these sortable
|
||||||
|
* It is called by CM.Main.DelayInit()
|
||||||
|
*/
|
||||||
|
CM.Disp.UpdateBuildingUpgradeStyle = function() {
|
||||||
|
l("products").style.display = "grid";
|
||||||
|
l("storeBulk").style.gridRow = "1/1";
|
||||||
|
|
||||||
|
l("upgrades").style.display = "flex";
|
||||||
|
l("upgrades").style["flex-wrap"] = "wrap";
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function sets the size of the background of the full game and the left column
|
* This function sets the size of the background of the full game and the left column
|
||||||
* depending on whether certain abrs are activated
|
* depending on whether certain abrs are activated
|
||||||
@@ -1822,7 +1815,7 @@ CM.Disp.ToggleToolWarnPos = function() {
|
|||||||
/**
|
/**
|
||||||
* This function checks and create a tooltip for the wrinklers
|
* This function checks and create a tooltip for the wrinklers
|
||||||
* It is called by CM.Disp.Draw()
|
* It is called by CM.Disp.Draw()
|
||||||
* TODO: Change this code to be the same as other tooltips. (i.d., create tooltip with type "w")
|
* As wrinklers are not appended to the DOM we us a different system than for other tooltips
|
||||||
*/
|
*/
|
||||||
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
|
||||||
@@ -1860,7 +1853,7 @@ CM.Disp.CheckWrinklerTooltip = function() {
|
|||||||
/**
|
/**
|
||||||
* This function updates the amount to be displayed by the wrinkler tooltip created by CM.Disp.CheckWrinklerTooltip()
|
* This function updates the amount to be displayed by the wrinkler tooltip created by CM.Disp.CheckWrinklerTooltip()
|
||||||
* It is called by CM.Disp.Draw()
|
* It is called by CM.Disp.Draw()
|
||||||
* TODO: Change this code to be the same as other tooltips. Fit this into CM.Disp.UpdateTooltip()
|
* As wrinklers are not appended to the DOM we us a different system than for other tooltips
|
||||||
*/
|
*/
|
||||||
CM.Disp.UpdateWrinklerTooltip = function() {
|
CM.Disp.UpdateWrinklerTooltip = function() {
|
||||||
if (CM.Options.TooltipWrink === 1 && l('CMTooltipWrinkler') != null) {
|
if (CM.Options.TooltipWrink === 1 && l('CMTooltipWrinkler') != null) {
|
||||||
@@ -2625,10 +2618,9 @@ CM.Disp.CreateStatsChainSection = function() {
|
|||||||
|
|
||||||
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode((Beautify(CM.Cache.ChainFrenzyReward[0]) + ' / ' + Beautify(CM.Cache.ChainFrenzyWrathReward[0]))), goldCookTooltip));
|
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode((Beautify(CM.Cache.ChainFrenzyReward[0]) + ' / ' + Beautify(CM.Cache.ChainFrenzyWrathReward[0]))), goldCookTooltip));
|
||||||
|
|
||||||
// TODO: Place MaxChainMoni function into CM.Cache.RemakeChain and create global variables to store it
|
|
||||||
var chainCurMax = Math.min(CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 60 * 6, (Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.5);
|
var chainCurMax = Math.min(CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 60 * 6, (Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.5);
|
||||||
var chainCur = CM.Cache.MaxChainMoni(7, chainCurMax, CM.Cache.GoldenCookiesMult)[0];
|
var chainCur = CM.Cache.MaxChainCookieReward(7, chainCurMax, CM.Cache.GoldenCookiesMult)[0];
|
||||||
var chainCurWrath = CM.Cache.MaxChainMoni(6, chainCurMax, CM.Cache.WrathCookiesMult)[0];
|
var chainCurWrath = CM.Cache.MaxChainCookieReward(6, chainCurMax, CM.Cache.WrathCookiesMult)[0];
|
||||||
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (CUR) (Golden / Wrath)', document.createTextNode((Beautify(chainCur) + ' / ' + Beautify(chainCurWrath))), goldCookTooltip));
|
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (CUR) (Golden / Wrath)', document.createTextNode((Beautify(chainCur) + ' / ' + Beautify(chainCurWrath))), goldCookTooltip));
|
||||||
return section;
|
return section;
|
||||||
};
|
};
|
||||||
@@ -2921,28 +2913,28 @@ CM.Disp.buffColors = {'Frenzy': CM.Disp.colorYellow, 'Dragon Harvest': CM.Disp.c
|
|||||||
CM.Disp.GCTimers = {};
|
CM.Disp.GCTimers = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These lists are used in the stats page to show
|
* These arrays are used in the stats page to show
|
||||||
* average cookies per {CM.Disp.cookieTimes/CM.Disp.clickTimes} seconds
|
* average cookies per {CM.Disp.cookieTimes/CM.Disp.clickTimes} seconds
|
||||||
*/
|
*/
|
||||||
CM.Disp.cookieTimes = [10, 15, 30, 60, 300, 600, 900, 1800];
|
CM.Disp.cookieTimes = [10, 15, 30, 60, 300, 600, 900, 1800];
|
||||||
CM.Disp.clickTimes = [1, 5, 10, 15, 30];
|
CM.Disp.clickTimes = [1, 5, 10, 15, 30];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This lists is used to store whether a Wrinkler tooltip is being shown or not
|
* This array is used to store whether a Wrinkler tooltip is being shown or not
|
||||||
* [i] = 1 means tooltip is being shown, [i] = 0 means hidden
|
* [i] = 1 means tooltip is being shown, [i] = 0 means hidden
|
||||||
* It is used by CM.Disp.CheckWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect()
|
* It is used by CM.Disp.CheckWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect()
|
||||||
*/
|
*/
|
||||||
CM.Disp.TooltipWrinklerBeingShown = [];
|
CM.Disp.TooltipWrinklerBeingShown = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to store the number of cookies to be displayed in the tab-title
|
* These are variables used by the functions that create tooltips for wrinklers
|
||||||
*/
|
* See CM.Disp.CheckWrinklerTooltip(), CM.Disp.UpdateWrinklerTooltip() and CM.Main.AddWrinklerAreaDetect()
|
||||||
CM.Disp.Title = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* These are variables with base-values that get initalized when initliazing CookieMonster
|
|
||||||
* TODO: See if these can be removed or moved
|
|
||||||
*/
|
*/
|
||||||
CM.Disp.TooltipWrinklerArea = 0;
|
CM.Disp.TooltipWrinklerArea = 0;
|
||||||
CM.Disp.TooltipWrinkler = -1;
|
CM.Disp.TooltipWrinkler = -1;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to store the number of cookies to be displayed in the tab-title
|
||||||
|
*/
|
||||||
|
CM.Disp.Title = '';
|
||||||
|
|||||||
12
src/Main.js
12
src/Main.js
@@ -87,6 +87,7 @@ CM.Main.DelayInit = function() {
|
|||||||
CM.Disp.CreateSimpleTooltip(CM.Disp.TooltipText[i][0], CM.Disp.TooltipText[i][1], CM.Disp.TooltipText[i][2]);
|
CM.Disp.CreateSimpleTooltip(CM.Disp.TooltipText[i][0], CM.Disp.TooltipText[i][1], CM.Disp.TooltipText[i][2]);
|
||||||
}
|
}
|
||||||
CM.Disp.CreateWrinklerButtons();
|
CM.Disp.CreateWrinklerButtons();
|
||||||
|
CM.Disp.UpdateBuildingUpgradeStyle();
|
||||||
CM.Main.ReplaceTooltips();
|
CM.Main.ReplaceTooltips();
|
||||||
CM.Main.AddWrinklerAreaDetect();
|
CM.Main.AddWrinklerAreaDetect();
|
||||||
|
|
||||||
@@ -101,14 +102,6 @@ CM.Main.DelayInit = function() {
|
|||||||
if (Game.prefs.popups) Game.Popup('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' loaded!');
|
if (Game.prefs.popups) Game.Popup('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' loaded!');
|
||||||
else Game.Notify('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' loaded!', '', '', 1, 1);
|
else Game.Notify('Cookie Monster version ' + CM.VersionMajor + '.' + CM.VersionMinor + ' loaded!', '', '', 1, 1);
|
||||||
|
|
||||||
// TODO: given the architecture of your code, you probably want these lines somewhere else,
|
|
||||||
// but I stuck them here for convenience
|
|
||||||
l("products").style.display = "grid";
|
|
||||||
l("storeBulk").style.gridRow = "1/1";
|
|
||||||
|
|
||||||
l("upgrades").style.display = "flex";
|
|
||||||
l("upgrades").style["flex-wrap"] = "wrap";
|
|
||||||
|
|
||||||
Game.Win('Third-party');
|
Game.Win('Third-party');
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -512,8 +505,7 @@ CM.Main.CheckWrinklerCount = function() {
|
|||||||
/**
|
/**
|
||||||
* This function creates .onmouseover/out events that determine if the mouse is hovering-over a Wrinkler
|
* This function creates .onmouseover/out events that determine if the mouse is hovering-over a Wrinkler
|
||||||
* It is called by CM.Main.DelayInit
|
* It is called by CM.Main.DelayInit
|
||||||
* TODO: The system for displaying wrinklers should ideally use a similar system as other tooltips
|
* As wrinklers are not appended to the DOM we us a different system than for other tooltips
|
||||||
* Thus, writing a CM.Main.ReplaceTooltipWrinkler function etc.
|
|
||||||
*/
|
*/
|
||||||
CM.Main.AddWrinklerAreaDetect = function() {
|
CM.Main.AddWrinklerAreaDetect = function() {
|
||||||
l('backgroundLeftCanvas').onmouseover = function() {CM.Disp.TooltipWrinklerArea = 1;};
|
l('backgroundLeftCanvas').onmouseover = function() {CM.Disp.TooltipWrinklerArea = 1;};
|
||||||
|
|||||||
Reference in New Issue
Block a user