Merge branch 'cache' into dev
This commit is contained in:
@@ -15,6 +15,7 @@ module.exports = {
|
|||||||
"jscolor": "readonly",
|
"jscolor": "readonly",
|
||||||
"BeautifyAll": "readonly",
|
"BeautifyAll": "readonly",
|
||||||
"CM": "writable",
|
"CM": "writable",
|
||||||
|
"unsafeWindow": "readonly",
|
||||||
},
|
},
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
|
|||||||
195
src/Cache.js
195
src/Cache.js
@@ -15,6 +15,7 @@ CM.Cache.InitCache = function() {
|
|||||||
CM.Cache.CacheDragonAuras();
|
CM.Cache.CacheDragonAuras();
|
||||||
CM.Cache.CacheWrinklers();
|
CM.Cache.CacheWrinklers();
|
||||||
CM.Cache.CacheStats();
|
CM.Cache.CacheStats();
|
||||||
|
CM.Cache.RemakeChain();
|
||||||
CM.Cache.CacheMissingUpgrades();
|
CM.Cache.CacheMissingUpgrades();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -86,25 +87,22 @@ CM.Cache.CacheWrinklers = function() {
|
|||||||
* @global {string} CM.Cache.EdificeBuilding Name of most expensive building possible with Spontaneous Edifice
|
* @global {string} CM.Cache.EdificeBuilding Name of most expensive building possible with Spontaneous Edifice
|
||||||
*/
|
*/
|
||||||
CM.Cache.CacheStats = function() {
|
CM.Cache.CacheStats = function() {
|
||||||
var goldenMult = CM.Cache.GoldenCookiesMult;
|
|
||||||
var wrathMult = CM.Cache.WrathCookiesMult;
|
|
||||||
|
|
||||||
CM.Cache.Lucky = (CM.Cache.NoGoldSwitchCookiesPS * 900) / 0.15;
|
CM.Cache.Lucky = (CM.Cache.NoGoldSwitchCookiesPS * 900) / 0.15;
|
||||||
CM.Cache.Lucky *= CM.Cache.DragonsFortuneMultAdjustment;
|
CM.Cache.Lucky *= CM.Cache.DragonsFortuneMultAdjustment;
|
||||||
var cpsBuffMult = CM.Sim.getCPSBuffMult();
|
let cpsBuffMult = CM.Sim.getCPSBuffMult();
|
||||||
if (cpsBuffMult > 0) CM.Cache.Lucky /= cpsBuffMult;
|
if (cpsBuffMult > 0) CM.Cache.Lucky /= cpsBuffMult;
|
||||||
else CM.Cache.Lucky = 0;
|
else CM.Cache.Lucky = 0;
|
||||||
CM.Cache.LuckyReward = goldenMult * (CM.Cache.Lucky * 0.15) + 13;
|
CM.Cache.LuckyReward = CM.Cache.GoldenCookiesMult * (CM.Cache.Lucky * 0.15) + 13;
|
||||||
CM.Cache.LuckyWrathReward = wrathMult * (CM.Cache.Lucky * 0.15) + 13;
|
CM.Cache.LuckyWrathReward = CM.Cache.WrathCookiesMult * (CM.Cache.Lucky * 0.15) + 13;
|
||||||
CM.Cache.LuckyFrenzy = CM.Cache.Lucky * 7;
|
CM.Cache.LuckyFrenzy = CM.Cache.Lucky * 7;
|
||||||
CM.Cache.LuckyRewardFrenzy = goldenMult * (CM.Cache.LuckyFrenzy * 0.15) + 13;
|
CM.Cache.LuckyRewardFrenzy = CM.Cache.GoldenCookiesMult * (CM.Cache.LuckyFrenzy * 0.15) + 13;
|
||||||
CM.Cache.LuckyWrathRewardFrenzy = wrathMult * (CM.Cache.LuckyFrenzy * 0.15) + 13;
|
CM.Cache.LuckyWrathRewardFrenzy = CM.Cache.WrathCookiesMult * (CM.Cache.LuckyFrenzy * 0.15) + 13;
|
||||||
CM.Cache.Conjure = CM.Cache.Lucky * 2;
|
CM.Cache.Conjure = CM.Cache.Lucky * 2;
|
||||||
CM.Cache.ConjureReward = CM.Cache.Conjure * 0.15;
|
CM.Cache.ConjureReward = CM.Cache.Conjure * 0.15;
|
||||||
|
|
||||||
CM.Cache.Edifice = 0;
|
CM.Cache.Edifice = 0;
|
||||||
var max = 0;
|
let max = 0;
|
||||||
var n = 0;
|
let n = 0;
|
||||||
for (let i of Object.keys(Game.Objects)) {
|
for (let i of Object.keys(Game.Objects)) {
|
||||||
if (Game.Objects[i].amount > max) max = Game.Objects[i].amount;
|
if (Game.Objects[i].amount > max) max = Game.Objects[i].amount;
|
||||||
if (Game.Objects[i].amount > 0) n++;
|
if (Game.Objects[i].amount > 0) n++;
|
||||||
@@ -119,6 +117,56 @@ CM.Cache.CacheStats = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This functions calculates the max possible payout
|
||||||
|
* It is called by CM.Disp.CreateStatsChainSection() and CM.Cache.RemakeChain()
|
||||||
|
* @param {number} digit
|
||||||
|
* @param {number} maxPayout
|
||||||
|
* @param {number} mult
|
||||||
|
* @returns {number} moni Cookies to be earned with Cookie Chain
|
||||||
|
*/
|
||||||
|
CM.Cache.MaxChainMoni = function(digit, maxPayout, mult) {
|
||||||
|
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) {
|
||||||
|
chain++;
|
||||||
|
moni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain) * digit * mult), maxPayout));
|
||||||
|
nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain + 1) * digit * mult), maxPayout));
|
||||||
|
}
|
||||||
|
return [moni, nextMoni];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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()
|
||||||
|
* TODO: Fairly sure this is incorrect..
|
||||||
|
* @global {number} CM.Cache.Chain Cookies required for max Cookie Chain normal
|
||||||
|
*/
|
||||||
|
CM.Cache.RemakeChain = function() {
|
||||||
|
let maxPayout = CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6 * CM.Cache.DragonsFortuneMultAdjustment;
|
||||||
|
// Removes effect of Frenzy etc.
|
||||||
|
let cpsBuffMult = CM.Sim.getCPSBuffMult();
|
||||||
|
if (cpsBuffMult > 0) maxPayout /= cpsBuffMult;
|
||||||
|
else maxPayout = 0;
|
||||||
|
|
||||||
|
CM.Cache.ChainReward = CM.Cache.MaxChainMoni(7, maxPayout, CM.Cache.GoldenCookiesMult);
|
||||||
|
CM.Cache.ChainRequired = CM.Cache.ChainReward[0] * 2;
|
||||||
|
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.ChainWrathRequired = CM.Cache.ChainWrathReward[0] * 2;
|
||||||
|
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.ChainFrenzyRequired = CM.Cache.ChainFrenzyReward[0] * 2;
|
||||||
|
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.ChainFrenzyWrathRequired = CM.Cache.ChainFrenzyReward[0] * 2;
|
||||||
|
CM.Cache.ChainFrenzyWrathRequiredNext = CM.Cache.ChainFrenzyReward[1] / 60 / 60 / 6 / CM.Cache.DragonsFortuneMultAdjustment;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This functions caches variables related to missing upgrades
|
* This functions caches variables related to missing upgrades
|
||||||
* It is called by CM.Loop() and CM.Cache.InitCache()
|
* It is called by CM.Loop() and CM.Cache.InitCache()
|
||||||
@@ -348,19 +396,14 @@ CM.Cache.CacheDragonCost = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/********
|
/********
|
||||||
* Section: UNSORTED */
|
* Section: ? */
|
||||||
|
|
||||||
CM.Cache.NextNumber = function(base) {
|
/********
|
||||||
var count = base > Math.pow(2, 53) ? Math.pow(2, Math.floor(Math.log(base) / Math.log(2)) - 53) : 1;
|
* Section: UNSORTED */
|
||||||
while (base == base + count) {
|
|
||||||
count = CM.Cache.NextNumber(count);
|
|
||||||
}
|
|
||||||
return (base + count);
|
|
||||||
};
|
|
||||||
|
|
||||||
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.Objects[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);
|
||||||
CM.Cache.Objects10[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 10);
|
CM.Cache.Objects10[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 10);
|
||||||
CM.Cache.Objects100[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 100);
|
CM.Cache.Objects100[i].price = CM.Sim.BuildingGetPrice(Game.Objects[i], Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, 100);
|
||||||
}
|
}
|
||||||
@@ -368,7 +411,7 @@ CM.Cache.RemakeBuildingsPrices = function() {
|
|||||||
|
|
||||||
CM.Cache.RemakeIncome = function() {
|
CM.Cache.RemakeIncome = function() {
|
||||||
// Simulate Building Buys for 1 amount
|
// Simulate Building Buys for 1 amount
|
||||||
CM.Sim.BuyBuildings(1, 'Objects');
|
CM.Sim.BuyBuildings(1, 'Objects1');
|
||||||
|
|
||||||
// Simulate Upgrade Buys
|
// Simulate Upgrade Buys
|
||||||
CM.Sim.BuyUpgrades();
|
CM.Sim.BuyUpgrades();
|
||||||
@@ -386,24 +429,24 @@ CM.Cache.RemakeBuildingsPP = function() {
|
|||||||
CM.Cache.mid = -1;
|
CM.Cache.mid = -1;
|
||||||
// Calculate PP and colors when compared to purchase of single optimal building
|
// Calculate PP and colors when compared to purchase of single optimal building
|
||||||
if (CM.Options.ColorPPBulkMode == 0) {
|
if (CM.Options.ColorPPBulkMode == 0) {
|
||||||
for (let i of Object.keys(CM.Cache.Objects)) {
|
for (let i of Object.keys(CM.Cache.Objects1)) {
|
||||||
//CM.Cache.Objects[i].pp = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus;
|
//CM.Cache.Objects1[i].pp = Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus;
|
||||||
if (Game.cookiesPs) {
|
if (Game.cookiesPs) {
|
||||||
CM.Cache.Objects[i].pp = (Math.max(Game.Objects[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects[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.Objects[i].pp = (Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus);
|
CM.Cache.Objects1[i].pp = (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus);
|
||||||
}
|
}
|
||||||
if (CM.Cache.min == -1 || CM.Cache.Objects[i].pp < CM.Cache.min) CM.Cache.min = CM.Cache.Objects[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.Objects[i].pp > CM.Cache.max) CM.Cache.max = CM.Cache.Objects[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.Objects)) {
|
for (let i of Object.keys(CM.Cache.Objects1)) {
|
||||||
let color = '';
|
let color = '';
|
||||||
if (CM.Cache.Objects[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.Objects[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.Objects[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.Objects[i].color = color;
|
CM.Cache.Objects1[i].color = color;
|
||||||
}
|
}
|
||||||
// Buildings for 10 amount
|
// Buildings for 10 amount
|
||||||
CM.Cache.RemakeBuildingsOtherPP(10, 'Objects10');
|
CM.Cache.RemakeBuildingsOtherPP(10, 'Objects10');
|
||||||
@@ -414,30 +457,30 @@ CM.Cache.RemakeBuildingsPP = function() {
|
|||||||
// 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) {
|
if (Game.buyBulk == 1) {
|
||||||
for (let i of Object.keys(CM.Cache.Objects)) {
|
for (let i of Object.keys(CM.Cache.Objects1)) {
|
||||||
//CM.Cache.Objects[i].pp = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus;
|
//CM.Cache.Objects1[i].pp = Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus;
|
||||||
if (Game.cookiesPs) {
|
if (Game.cookiesPs) {
|
||||||
CM.Cache.Objects[i].pp = (Math.max(Game.Objects[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects[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.Objects[i].pp = (Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus);
|
CM.Cache.Objects1[i].pp = (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus);
|
||||||
}
|
}
|
||||||
if (CM.Cache.min == -1 || CM.Cache.Objects[i].pp < CM.Cache.min) CM.Cache.min = CM.Cache.Objects[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.Objects[i].pp > CM.Cache.max) CM.Cache.max = CM.Cache.Objects[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.Objects)) {
|
for (let i of Object.keys(CM.Cache.Objects1)) {
|
||||||
let color = '';
|
let color = '';
|
||||||
if (CM.Cache.Objects[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.Objects[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.Objects[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.Objects[i].color = color;
|
CM.Cache.Objects1[i].color = color;
|
||||||
}
|
}
|
||||||
CM.Cache.RemakeBuildingsOtherPP(10, 'Objects10');
|
CM.Cache.RemakeBuildingsOtherPP(10, 'Objects10');
|
||||||
CM.Cache.RemakeBuildingsOtherPP(100, 'Objects100');
|
CM.Cache.RemakeBuildingsOtherPP(100, 'Objects100');
|
||||||
}
|
}
|
||||||
else if (Game.buyBulk == 10) {
|
else if (Game.buyBulk == 10) {
|
||||||
for (let i of Object.keys(CM.Cache.Objects)) {
|
for (let i of Object.keys(CM.Cache.Objects1)) {
|
||||||
if (Game.cookiesPs) {
|
if (Game.cookiesPs) {
|
||||||
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);
|
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);
|
||||||
} else {
|
} else {
|
||||||
@@ -447,7 +490,7 @@ CM.Cache.RemakeBuildingsPP = function() {
|
|||||||
if (CM.Cache.max == -1 || CM.Cache.Objects10[i].pp > CM.Cache.max) CM.Cache.max = CM.Cache.Objects10[i].pp;
|
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;
|
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
|
||||||
for (let i of Object.keys(CM.Cache.Objects)) {
|
for (let i of Object.keys(CM.Cache.Objects1)) {
|
||||||
let color = '';
|
let color = '';
|
||||||
if (CM.Cache.Objects10[i].pp == CM.Cache.min) color = CM.Disp.colorGreen;
|
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.max) color = CM.Disp.colorRed;
|
||||||
@@ -459,7 +502,7 @@ CM.Cache.RemakeBuildingsPP = function() {
|
|||||||
CM.Cache.RemakeBuildingsOtherPP(100, 'Objects100');
|
CM.Cache.RemakeBuildingsOtherPP(100, 'Objects100');
|
||||||
}
|
}
|
||||||
else if (Game.buyBulk == 100) {
|
else if (Game.buyBulk == 100) {
|
||||||
for (let i of Object.keys(CM.Cache.Objects)) {
|
for (let i of Object.keys(CM.Cache.Objects1)) {
|
||||||
if (Game.cookiesPs) {
|
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);
|
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 {
|
} else {
|
||||||
@@ -469,7 +512,7 @@ CM.Cache.RemakeBuildingsPP = function() {
|
|||||||
if (CM.Cache.max == -1 || CM.Cache.Objects100[i].pp > CM.Cache.max) CM.Cache.max = 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;
|
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
|
||||||
for (let i of Object.keys(CM.Cache.Objects)) {
|
for (let i of Object.keys(CM.Cache.Objects1)) {
|
||||||
let color = '';
|
let color = '';
|
||||||
if (CM.Cache.Objects100[i].pp == CM.Cache.min) color = CM.Disp.colorGreen;
|
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.max) color = CM.Disp.colorRed;
|
||||||
@@ -560,66 +603,6 @@ CM.Cache.RemakeGoldenAndWrathCookiesMults = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CM.Cache.MaxChainMoni = function(digit, maxPayout, mult) {
|
|
||||||
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) {
|
|
||||||
chain++;
|
|
||||||
moni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain) * digit * mult), maxPayout));
|
|
||||||
nextMoni = Math.max(digit, Math.min(Math.floor(1 / 9 * Math.pow(10, chain + 1) * digit * mult), maxPayout));
|
|
||||||
}
|
|
||||||
return moni;
|
|
||||||
};
|
|
||||||
|
|
||||||
CM.Cache.RemakeChain = function() {
|
|
||||||
var maxPayout = CM.Cache.NoGoldSwitchCookiesPS * 60 * 60 * 6;
|
|
||||||
maxPayout *= CM.Cache.DragonsFortuneMultAdjustment;
|
|
||||||
var cpsBuffMult = CM.Sim.getCPSBuffMult();
|
|
||||||
if (cpsBuffMult > 0) {
|
|
||||||
maxPayout /= cpsBuffMult;
|
|
||||||
} else {
|
|
||||||
maxPayout = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
var goldenMult = CM.Cache.GoldenCookiesMult;
|
|
||||||
var wrathMult = CM.Cache.WrathCookiesMult;
|
|
||||||
|
|
||||||
CM.Cache.ChainReward = CM.Cache.MaxChainMoni(7, maxPayout, goldenMult);
|
|
||||||
|
|
||||||
CM.Cache.ChainWrathReward = CM.Cache.MaxChainMoni(6, maxPayout, wrathMult);
|
|
||||||
|
|
||||||
if (maxPayout < CM.Cache.ChainReward) {
|
|
||||||
CM.Cache.Chain = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
CM.Cache.Chain = CM.Cache.NextNumber(CM.Cache.ChainReward) / 0.5;
|
|
||||||
}
|
|
||||||
if (maxPayout < CM.Cache.ChainWrathReward) {
|
|
||||||
CM.Cache.ChainWrath = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
CM.Cache.ChainWrath = CM.Cache.NextNumber(CM.Cache.ChainWrathReward) / 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
CM.Cache.ChainFrenzyReward = CM.Cache.MaxChainMoni(7, maxPayout * 7, goldenMult);
|
|
||||||
|
|
||||||
CM.Cache.ChainFrenzyWrathReward = CM.Cache.MaxChainMoni(6, maxPayout * 7, wrathMult);
|
|
||||||
|
|
||||||
if ((maxPayout * 7) < CM.Cache.ChainFrenzyReward) {
|
|
||||||
CM.Cache.ChainFrenzy = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
CM.Cache.ChainFrenzy = CM.Cache.NextNumber(CM.Cache.ChainFrenzyReward) / 0.5;
|
|
||||||
}
|
|
||||||
if ((maxPayout * 7) < CM.Cache.ChainFrenzyWrathReward) {
|
|
||||||
CM.Cache.ChainFrenzyWrath = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
CM.Cache.ChainFrenzyWrath = CM.Cache.NextNumber(CM.Cache.ChainFrenzyWrathReward) / 0.5;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CM.Cache.RemakeSeaSpec = function() {
|
CM.Cache.RemakeSeaSpec = function() {
|
||||||
if (Game.season == 'christmas') {
|
if (Game.season == 'christmas') {
|
||||||
var val = Game.cookiesPs * 60;
|
var val = Game.cookiesPs * 60;
|
||||||
|
|||||||
@@ -106,15 +106,15 @@ CM.Config.ToggleConfig = function(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.ConfigPrefix + config).className = 'option off';
|
if (CM.ConfigData[config].toggle) l(CM.Config.ConfigPrefix + config).className = 'option off';
|
||||||
}
|
}
|
||||||
else l(CM.ConfigPrefix + config).className = 'option';
|
else l(CM.Config.ConfigPrefix + config).className = 'option';
|
||||||
|
|
||||||
if (typeof CM.ConfigData[config].func !== 'undefined') {
|
if (typeof CM.ConfigData[config].func !== 'undefined') {
|
||||||
CM.ConfigData[config].func();
|
CM.ConfigData[config].func();
|
||||||
}
|
}
|
||||||
|
|
||||||
l(CM.ConfigPrefix + config).innerHTML = CM.ConfigData[config].label[CM.Options[config]];
|
l(CM.Config.ConfigPrefix + config).innerHTML = CM.ConfigData[config].label[CM.Options[config]];
|
||||||
CM.Config.SaveConfig();
|
CM.Config.SaveConfig();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -177,3 +177,11 @@ CM.Config.CheckNotificationPermissions = function(ToggleOnOff) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/********
|
||||||
|
* Section: Variables used in Config functions */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to name certain DOM elements and refer to them
|
||||||
|
*/
|
||||||
|
CM.Config.ConfigPrefix = 'CMConfig';
|
||||||
|
|||||||
67
src/Disp.js
67
src/Disp.js
@@ -405,12 +405,10 @@ 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.Objects) {
|
if (CM.Options.BotBar == 1 && CM.Cache.Objects1) {
|
||||||
var count = 0;
|
var count = 0;
|
||||||
for (let i of Object.keys(CM.Cache.Objects)) {
|
for (let i of Object.keys(CM.Cache.Objects1)) {
|
||||||
var target = 'Objects';
|
let target = `Objects${Game.buyBulk}`
|
||||||
if (Game.buyBulk == 10) {target = 'Objects10';}
|
|
||||||
if (Game.buyBulk == 100) {target = 'Objects100';}
|
|
||||||
count++;
|
count++;
|
||||||
CM.Disp.BotBar.firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount;
|
CM.Disp.BotBar.firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount;
|
||||||
CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache[target][i].bonus, 2);
|
CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache[target][i].bonus, 2);
|
||||||
@@ -715,9 +713,7 @@ CM.Disp.UpdateBotTimerBarPosition = function() {
|
|||||||
* And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.ConfigData.BulkBuildColor
|
* And by changes in CM.Options.BuildColor, CM.Options.SortBuild & CM.ConfigData.BulkBuildColor
|
||||||
*/
|
*/
|
||||||
CM.Disp.UpdateBuildings = function() {
|
CM.Disp.UpdateBuildings = function() {
|
||||||
let target = 'Objects';
|
let target = `Objects${Game.buyBulk}`
|
||||||
if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10';
|
|
||||||
else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100';
|
|
||||||
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])) {
|
||||||
@@ -730,7 +726,7 @@ CM.Disp.UpdateBuildings = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Game.buyMode == -1) {
|
else if (Game.buyMode == -1) {
|
||||||
for (let i of Object.keys(CM.Cache.Objects)) {
|
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 = '';
|
||||||
/*
|
/*
|
||||||
@@ -763,9 +759,9 @@ CM.Disp.UpdateBuildings = function() {
|
|||||||
Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2);
|
Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let arr = Object.keys(CM.Cache.Objects).map(k =>
|
let arr = Object.keys(CM.Cache.Objects1).map(k =>
|
||||||
{
|
{
|
||||||
var o = CM.Cache.Objects[k];
|
var o = CM.Cache.Objects1[k];
|
||||||
o.name = k;
|
o.name = k;
|
||||||
o.id = Game.Objects[k].id;
|
o.id = Game.Objects[k].id;
|
||||||
return o;
|
return o;
|
||||||
@@ -1455,12 +1451,7 @@ CM.Disp.UpdateTooltipBuilding = function() {
|
|||||||
let tooltipBox = l('CMTooltipBorder');
|
let tooltipBox = l('CMTooltipBorder');
|
||||||
CM.Disp.TooltipCreateCalculationSection(tooltipBox);
|
CM.Disp.TooltipCreateCalculationSection(tooltipBox);
|
||||||
|
|
||||||
var target = '';
|
let target = `Objects${Game.buyBulk}`
|
||||||
// TODO: Change the Cache code and variables to use Objects1, Objectes10, Objects100
|
|
||||||
// That would depreciate this target setting code
|
|
||||||
if (Game.buyMode == 1 && Game.buyBulk == 10) target = 'Objects10';
|
|
||||||
else if (Game.buyMode == 1 && Game.buyBulk == 100) target = 'Objects100';
|
|
||||||
else target = 'Objects';
|
|
||||||
|
|
||||||
CM.Disp.TooltipPrice = Game.Objects[CM.Disp.tooltipName].bulkPrice;
|
CM.Disp.TooltipPrice = Game.Objects[CM.Disp.tooltipName].bulkPrice;
|
||||||
CM.Disp.TooltipBonusIncome = CM.Cache[target][CM.Disp.tooltipName].bonus;
|
CM.Disp.TooltipBonusIncome = CM.Cache[target][CM.Disp.tooltipName].bonus;
|
||||||
@@ -2058,7 +2049,7 @@ CM.Disp.CreatePrefOption = function(config) {
|
|||||||
else {
|
else {
|
||||||
a.className = 'option';
|
a.className = 'option';
|
||||||
}
|
}
|
||||||
a.id = CM.ConfigPrefix + config;
|
a.id = CM.Config.ConfigPrefix + config;
|
||||||
a.onclick = function() {CM.Config.ToggleConfig(config);};
|
a.onclick = function() {CM.Config.ToggleConfig(config);};
|
||||||
a.textContent = CM.ConfigData[config].label[CM.Options[config]];
|
a.textContent = CM.ConfigData[config].label[CM.Options[config]];
|
||||||
div.appendChild(a);
|
div.appendChild(a);
|
||||||
@@ -2104,7 +2095,7 @@ CM.Disp.CreatePrefOption = function(config) {
|
|||||||
span.textContent = CM.ConfigData[config].label + ' ';
|
span.textContent = CM.ConfigData[config].label + ' ';
|
||||||
div.appendChild(span);
|
div.appendChild(span);
|
||||||
let input = document.createElement('input');
|
let input = document.createElement('input');
|
||||||
input.id = CM.ConfigPrefix + config;
|
input.id = CM.Config.ConfigPrefix + config;
|
||||||
input.className = 'option';
|
input.className = 'option';
|
||||||
input.type = 'text';
|
input.type = 'text';
|
||||||
input.readOnly = true;
|
input.readOnly = true;
|
||||||
@@ -2113,13 +2104,13 @@ CM.Disp.CreatePrefOption = function(config) {
|
|||||||
div.appendChild(input);
|
div.appendChild(input);
|
||||||
div.appendChild(document.createTextNode(' '));
|
div.appendChild(document.createTextNode(' '));
|
||||||
let inputPrompt = document.createElement('input');
|
let inputPrompt = document.createElement('input');
|
||||||
inputPrompt.id = CM.ConfigPrefix + config + 'Prompt';
|
inputPrompt.id = CM.Config.ConfigPrefix + config + 'Prompt';
|
||||||
inputPrompt.className = 'option';
|
inputPrompt.className = 'option';
|
||||||
inputPrompt.type = 'text';
|
inputPrompt.type = 'text';
|
||||||
inputPrompt.setAttribute('value', CM.Options[config]);
|
inputPrompt.setAttribute('value', CM.Options[config]);
|
||||||
let a = document.createElement('a');
|
let a = document.createElement('a');
|
||||||
a.className = 'option';
|
a.className = 'option';
|
||||||
a.onclick = function() {Game.Prompt(inputPrompt.outerHTML, [['Save', 'CM.Options[\'' + config + '\'] = l(CM.ConfigPrefix + \'' + config + '\' + \'Prompt\').value; CM.Config.SaveConfig(); Game.ClosePrompt(); Game.UpdateMenu();'], 'Cancel']);};
|
a.onclick = function() {Game.Prompt(inputPrompt.outerHTML, [['Save', 'CM.Options[\'' + config + '\'] = l(CM.Config.ConfigPrefix + \'' + config + '\' + \'Prompt\').value; CM.Config.SaveConfig(); Game.ClosePrompt(); Game.UpdateMenu();'], 'Cancel']);};
|
||||||
a.textContent = 'Edit';
|
a.textContent = 'Edit';
|
||||||
div.appendChild(a);
|
div.appendChild(a);
|
||||||
let label = document.createElement('label');
|
let label = document.createElement('label');
|
||||||
@@ -2154,7 +2145,7 @@ CM.Disp.CreatePrefOption = function(config) {
|
|||||||
span.textContent = CM.ConfigData[config].label + ' ';
|
span.textContent = CM.ConfigData[config].label + ' ';
|
||||||
div.appendChild(span);
|
div.appendChild(span);
|
||||||
let input = document.createElement('input');
|
let input = document.createElement('input');
|
||||||
input.id = CM.ConfigPrefix + config;
|
input.id = CM.Config.ConfigPrefix + config;
|
||||||
input.className = 'option';
|
input.className = 'option';
|
||||||
input.type = 'number';
|
input.type = 'number';
|
||||||
input.value = (CM.Options[config]);
|
input.value = (CM.Options[config]);
|
||||||
@@ -2562,13 +2553,13 @@ CM.Disp.CreateStatsChainSection = function() {
|
|||||||
var section = document.createElement('div');
|
var section = document.createElement('div');
|
||||||
section.className = 'CMStatsChainSection';
|
section.className = 'CMStatsChainSection';
|
||||||
|
|
||||||
var chainColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Chain) ? CM.Disp.colorRed : CM.Disp.colorGreen;
|
var chainColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen;
|
||||||
var chainTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.Chain) ? CM.Disp.FormatTime((CM.Cache.Chain - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
|
var chainTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainRequired) ? CM.Disp.FormatTime((CM.Cache.ChainRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
|
||||||
var chainReqFrag = document.createDocumentFragment();
|
var chainReqFrag = document.createDocumentFragment();
|
||||||
var chainReqSpan = document.createElement('span');
|
var chainReqSpan = document.createElement('span');
|
||||||
chainReqSpan.style.fontWeight = 'bold';
|
chainReqSpan.style.fontWeight = 'bold';
|
||||||
chainReqSpan.className = CM.Disp.colorTextPre + chainColor;
|
chainReqSpan.className = CM.Disp.colorTextPre + chainColor;
|
||||||
chainReqSpan.textContent = Beautify(CM.Cache.Chain);
|
chainReqSpan.textContent = Beautify(CM.Cache.ChainRequired);
|
||||||
chainReqFrag.appendChild(chainReqSpan);
|
chainReqFrag.appendChild(chainReqSpan);
|
||||||
if (chainTime != '') {
|
if (chainTime != '') {
|
||||||
var chainReqSmall = document.createElement('small');
|
var chainReqSmall = document.createElement('small');
|
||||||
@@ -2577,13 +2568,13 @@ CM.Disp.CreateStatsChainSection = function() {
|
|||||||
}
|
}
|
||||||
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required', chainReqFrag, goldCookTooltip));
|
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required', chainReqFrag, goldCookTooltip));
|
||||||
|
|
||||||
var chainWrathColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrath) ? CM.Disp.colorRed : CM.Disp.colorGreen;
|
var chainWrathColor = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrathRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen;
|
||||||
var chainWrathTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrath) ? CM.Disp.FormatTime((CM.Cache.ChainWrath - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
|
var chainWrathTime = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainWrathRequired) ? CM.Disp.FormatTime((CM.Cache.ChainWrathRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
|
||||||
var chainWrathReqFrag = document.createDocumentFragment();
|
var chainWrathReqFrag = document.createDocumentFragment();
|
||||||
var chainWrathReqSpan = document.createElement('span');
|
var chainWrathReqSpan = document.createElement('span');
|
||||||
chainWrathReqSpan.style.fontWeight = 'bold';
|
chainWrathReqSpan.style.fontWeight = 'bold';
|
||||||
chainWrathReqSpan.className = CM.Disp.colorTextPre + chainWrathColor;
|
chainWrathReqSpan.className = CM.Disp.colorTextPre + chainWrathColor;
|
||||||
chainWrathReqSpan.textContent = Beautify(CM.Cache.ChainWrath);
|
chainWrathReqSpan.textContent = Beautify(CM.Cache.ChainWrathRequired);
|
||||||
chainWrathReqFrag.appendChild(chainWrathReqSpan);
|
chainWrathReqFrag.appendChild(chainWrathReqSpan);
|
||||||
if (chainWrathTime != '') {
|
if (chainWrathTime != '') {
|
||||||
var chainWrathReqSmall = document.createElement('small');
|
var chainWrathReqSmall = document.createElement('small');
|
||||||
@@ -2592,13 +2583,13 @@ CM.Disp.CreateStatsChainSection = function() {
|
|||||||
}
|
}
|
||||||
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Wrath)', chainWrathReqFrag, goldCookTooltip));
|
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Wrath)', chainWrathReqFrag, goldCookTooltip));
|
||||||
|
|
||||||
var chainColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzy) ? CM.Disp.colorRed : CM.Disp.colorGreen;
|
var chainColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen;
|
||||||
var chainTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzy) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzy - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
|
var chainTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyRequired) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzyRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
|
||||||
var chainReqFrenFrag = document.createDocumentFragment();
|
var chainReqFrenFrag = document.createDocumentFragment();
|
||||||
var chainReqFrenSpan = document.createElement('span');
|
var chainReqFrenSpan = document.createElement('span');
|
||||||
chainReqFrenSpan.style.fontWeight = 'bold';
|
chainReqFrenSpan.style.fontWeight = 'bold';
|
||||||
chainReqFrenSpan.className = CM.Disp.colorTextPre + chainColorFrenzy;
|
chainReqFrenSpan.className = CM.Disp.colorTextPre + chainColorFrenzy;
|
||||||
chainReqFrenSpan.textContent = Beautify(CM.Cache.ChainFrenzy);
|
chainReqFrenSpan.textContent = Beautify(CM.Cache.ChainFrenzyRequired);
|
||||||
chainReqFrenFrag.appendChild(chainReqFrenSpan);
|
chainReqFrenFrag.appendChild(chainReqFrenSpan);
|
||||||
if (chainTimeFrenzy != '') {
|
if (chainTimeFrenzy != '') {
|
||||||
var chainReqFrenSmall = document.createElement('small');
|
var chainReqFrenSmall = document.createElement('small');
|
||||||
@@ -2607,13 +2598,13 @@ CM.Disp.CreateStatsChainSection = function() {
|
|||||||
}
|
}
|
||||||
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Frenzy)', chainReqFrenFrag, goldCookTooltip));
|
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Frenzy)', chainReqFrenFrag, goldCookTooltip));
|
||||||
|
|
||||||
var chainWrathColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrath) ? CM.Disp.colorRed : CM.Disp.colorGreen;
|
var chainWrathColorFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrathRequired) ? CM.Disp.colorRed : CM.Disp.colorGreen;
|
||||||
var chainWrathTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrath) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzyWrath - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
|
var chainWrathTimeFrenzy = ((Game.cookies + CM.Disp.GetWrinkConfigBank()) < CM.Cache.ChainFrenzyWrathRequired) ? CM.Disp.FormatTime((CM.Cache.ChainFrenzyWrathRequired - (Game.cookies + CM.Disp.GetWrinkConfigBank())) / CM.Disp.GetCPS()) : '';
|
||||||
var chainWrathReqFrenFrag = document.createDocumentFragment();
|
var chainWrathReqFrenFrag = document.createDocumentFragment();
|
||||||
var chainWrathReqFrenSpan = document.createElement('span');
|
var chainWrathReqFrenSpan = document.createElement('span');
|
||||||
chainWrathReqFrenSpan.style.fontWeight = 'bold';
|
chainWrathReqFrenSpan.style.fontWeight = 'bold';
|
||||||
chainWrathReqFrenSpan.className = CM.Disp.colorTextPre + chainWrathColorFrenzy;
|
chainWrathReqFrenSpan.className = CM.Disp.colorTextPre + chainWrathColorFrenzy;
|
||||||
chainWrathReqFrenSpan.textContent = Beautify(CM.Cache.ChainFrenzyWrath);
|
chainWrathReqFrenSpan.textContent = Beautify(CM.Cache.ChainFrenzyWrathRequired);
|
||||||
chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSpan);
|
chainWrathReqFrenFrag.appendChild(chainWrathReqFrenSpan);
|
||||||
if (chainWrathTimeFrenzy != '') {
|
if (chainWrathTimeFrenzy != '') {
|
||||||
var chainWrathReqFrenSmall = document.createElement('small');
|
var chainWrathReqFrenSmall = document.createElement('small');
|
||||||
@@ -2622,14 +2613,14 @@ CM.Disp.CreateStatsChainSection = function() {
|
|||||||
}
|
}
|
||||||
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Frenzy) (Wrath)', chainWrathReqFrenFrag, goldCookTooltip));
|
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Cookies Required (Frenzy) (Wrath)', chainWrathReqFrenFrag, goldCookTooltip));
|
||||||
|
|
||||||
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (MAX) (Golden / Wrath)', document.createTextNode(Beautify(CM.Cache.ChainReward) + ' / ' + Beautify(CM.Cache.ChainWrathReward)), goldCookTooltip));
|
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (MAX) (Golden / Wrath)', document.createTextNode(Beautify(CM.Cache.ChainReward[0]) + ' / ' + Beautify(CM.Cache.ChainWrathReward[0])), goldCookTooltip));
|
||||||
|
|
||||||
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode((Beautify(CM.Cache.ChainFrenzyReward) + ' / ' + Beautify(CM.Cache.ChainFrenzyWrathReward))), goldCookTooltip));
|
section.appendChild(CM.Disp.CreateStatsListing("withTooltip", '"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)', document.createTextNode((Beautify(CM.Cache.ChainFrenzyReward[0]) + ' / ' + Beautify(CM.Cache.ChainFrenzyWrathReward[0]))), goldCookTooltip));
|
||||||
|
|
||||||
// TODO: Place MaxChainMoni function into CM.Cache.RemakeChain and create global variables to store it
|
// TODO: Place MaxChainMoni function into CM.Cache.RemakeChain and create global variables to store it
|
||||||
var chainCurMax = Math.min(CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 60 * 6, (Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.5);
|
var chainCurMax = Math.min(CM.Cache.NoGoldSwitchCookiesPS * CM.Cache.DragonsFortuneMultAdjustment * 60 * 60 * 6, (Game.cookies + CM.Disp.GetWrinkConfigBank()) * 0.5);
|
||||||
var chainCur = CM.Cache.MaxChainMoni(7, chainCurMax, CM.Cache.GoldenCookiesMult);
|
var chainCur = CM.Cache.MaxChainMoni(7, chainCurMax, CM.Cache.GoldenCookiesMult)[0];
|
||||||
var chainCurWrath = CM.Cache.MaxChainMoni(6, chainCurMax, CM.Cache.WrathCookiesMult);
|
var chainCurWrath = CM.Cache.MaxChainMoni(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;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,4 +15,6 @@ const CM = {
|
|||||||
Main: {},
|
Main: {},
|
||||||
Options: {},
|
Options: {},
|
||||||
Sim: {},
|
Sim: {},
|
||||||
|
VersionMajor: '2.031',
|
||||||
|
VersionMinor: '3',
|
||||||
};
|
};
|
||||||
|
|||||||
12
src/Main.js
12
src/Main.js
@@ -516,9 +516,15 @@ CM.Main.FixMouseY = function(target) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/********
|
||||||
|
* Section: Variables used in Main functions */
|
||||||
|
|
||||||
CM.HasReplaceNativeGrimoireLaunch = false;
|
CM.HasReplaceNativeGrimoireLaunch = false;
|
||||||
CM.HasReplaceNativeGrimoireDraw = false;
|
CM.HasReplaceNativeGrimoireDraw = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: See if these can me removed (probably)
|
||||||
|
*/
|
||||||
CM.Main.lastGoldenCookieState = 0;
|
CM.Main.lastGoldenCookieState = 0;
|
||||||
CM.Main.lastSpawnedGoldenCookieState = 0;
|
CM.Main.lastSpawnedGoldenCookieState = 0;
|
||||||
CM.Main.lastTickerFortuneState = 0;
|
CM.Main.lastTickerFortuneState = 0;
|
||||||
@@ -526,9 +532,3 @@ CM.Main.lastSeasonPopupState = 0;
|
|||||||
CM.Main.lastGardenNextStep = 0;
|
CM.Main.lastGardenNextStep = 0;
|
||||||
CM.Main.lastMagicBarFull = 0;
|
CM.Main.lastMagicBarFull = 0;
|
||||||
CM.Main.lastWrinklerCount = 0;
|
CM.Main.lastWrinklerCount = 0;
|
||||||
|
|
||||||
CM.ConfigPrefix = 'CMConfig';
|
|
||||||
|
|
||||||
CM.VersionMajor = '2.031';
|
|
||||||
CM.VersionMinor = '3';
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user