Changed calculation from Base Cost per Income to Return on Investment (Issue #3 (partly), #28, #52) with the formula from @svschouw and minor README edit
This commit is contained in:
154
CookieMonster.js
154
CookieMonster.js
@@ -44,70 +44,72 @@ CM.Cache.RemakeIncome = function() {
|
|||||||
CM.Sim.BuyBuildings(100, 'Objects100');
|
CM.Sim.BuyBuildings(100, 'Objects100');
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Cache.RemakeBuildingsBCI = function() {
|
CM.Cache.RemakeBuildingsROI = function() {
|
||||||
CM.Disp.min = -1;
|
CM.Cache.min = -1;
|
||||||
CM.Disp.max = -1;
|
CM.Cache.max = -1;
|
||||||
CM.Disp.mid = -1;
|
CM.Cache.mid = -1;
|
||||||
for (var i in CM.Cache.Objects) {
|
for (var i in CM.Cache.Objects) {
|
||||||
CM.Cache.Objects[i].bci = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus;
|
//CM.Cache.Objects[i].roi = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus;
|
||||||
if (CM.Disp.min == -1 || CM.Cache.Objects[i].bci < CM.Disp.min) CM.Disp.min = CM.Cache.Objects[i].bci;
|
CM.Cache.Objects[i].roi = (Math.max(Game.Objects[i].getPrice() - Game.cookies, 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus);
|
||||||
if (CM.Disp.max == -1 || CM.Cache.Objects[i].bci > CM.Disp.max) CM.Disp.max = CM.Cache.Objects[i].bci;
|
if (CM.Cache.min == -1 || CM.Cache.Objects[i].roi < CM.Cache.min) CM.Cache.min = CM.Cache.Objects[i].roi;
|
||||||
|
if (CM.Cache.max == -1 || CM.Cache.Objects[i].roi > CM.Cache.max) CM.Cache.max = CM.Cache.Objects[i].roi;
|
||||||
}
|
}
|
||||||
CM.Disp.mid = ((CM.Disp.max - CM.Disp.min) / 2) + CM.Disp.min;
|
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
|
||||||
for (var i in CM.Cache.Objects) {
|
for (var i in CM.Cache.Objects) {
|
||||||
var color = '';
|
var color = '';
|
||||||
if (CM.Cache.Objects[i].bci == CM.Disp.min) color = CM.Disp.colorGreen;
|
if (CM.Cache.Objects[i].roi == CM.Cache.min) color = CM.Disp.colorGreen;
|
||||||
else if (CM.Cache.Objects[i].bci == CM.Disp.max) color = CM.Disp.colorRed;
|
else if (CM.Cache.Objects[i].roi == CM.Cache.max) color = CM.Disp.colorRed;
|
||||||
else if (CM.Cache.Objects[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange;
|
else if (CM.Cache.Objects[i].roi > 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.Objects[i].color = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Cache.RemakeUpgradeBCI = function() {
|
CM.Cache.RemakeUpgradeROI = function() {
|
||||||
for (var i in CM.Cache.Upgrades) {
|
for (var i in CM.Cache.Upgrades) {
|
||||||
CM.Cache.Upgrades[i].bci = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus;
|
//CM.Cache.Upgrades[i].roi = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus;
|
||||||
if (isNaN(CM.Cache.Upgrades[i].bci)) CM.Cache.Upgrades[i].bci = 'Infinity';
|
CM.Cache.Upgrades[i].roi = (Math.max(Game.Upgrades[i].getPrice() - Game.cookies, 0) / Game.cookiesPs) + (Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus);
|
||||||
|
if (isNaN(CM.Cache.Upgrades[i].roi)) CM.Cache.Upgrades[i].roi = 'Infinity';
|
||||||
var color = '';
|
var color = '';
|
||||||
if (CM.Cache.Upgrades[i].bci <= 0 || CM.Cache.Upgrades[i].bci == 'Infinity') color = CM.Disp.colorGray;
|
if (CM.Cache.Upgrades[i].roi <= 0 || CM.Cache.Upgrades[i].roi == 'Infinity') color = CM.Disp.colorGray;
|
||||||
else if (CM.Cache.Upgrades[i].bci < CM.Disp.min) color = CM.Disp.colorBlue;
|
else if (CM.Cache.Upgrades[i].roi < CM.Cache.min) color = CM.Disp.colorBlue;
|
||||||
else if (CM.Cache.Upgrades[i].bci == CM.Disp.min) color = CM.Disp.colorGreen;
|
else if (CM.Cache.Upgrades[i].roi == CM.Cache.min) color = CM.Disp.colorGreen;
|
||||||
else if (CM.Cache.Upgrades[i].bci == CM.Disp.max) color = CM.Disp.colorRed;
|
else if (CM.Cache.Upgrades[i].roi == CM.Cache.max) color = CM.Disp.colorRed;
|
||||||
else if (CM.Cache.Upgrades[i].bci > CM.Disp.max) color = CM.Disp.colorPurple;
|
else if (CM.Cache.Upgrades[i].roi > CM.Cache.max) color = CM.Disp.colorPurple;
|
||||||
else if (CM.Cache.Upgrades[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange;
|
else if (CM.Cache.Upgrades[i].roi > CM.Cache.mid) color = CM.Disp.colorOrange;
|
||||||
else color = CM.Disp.colorYellow;
|
else color = CM.Disp.colorYellow;
|
||||||
CM.Cache.Upgrades[i].color = color;
|
CM.Cache.Upgrades[i].color = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Cache.RemakeBuildingsOtherBCI = function(amount, target) {
|
CM.Cache.RemakeBuildingsOtherROI = function(amount, target) {
|
||||||
for (var i in CM.Cache[target]) {
|
for (var i in CM.Cache[target]) {
|
||||||
CM.Cache[target][i].price = CM.Sim.BuildingGetPrice(Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, amount);
|
//CM.Cache[target][i].roi = CM.Cache[target][i].price / CM.Cache[target][i].bonus;
|
||||||
CM.Cache[target][i].bci = CM.Cache[target][i].price / CM.Cache[target][i].bonus;
|
CM.Cache[target][i].roi = (Math.max(CM.Cache[target][i].price - Game.cookies, 0) / Game.cookiesPs) + (CM.Cache[target][i].price / CM.Cache[target][i].bonus);
|
||||||
var color = '';
|
var color = '';
|
||||||
if (CM.Cache[target][i].bci <= 0 || CM.Cache[target][i].bci == 'Infinity') color = CM.Disp.colorGray;
|
if (CM.Cache[target][i].roi <= 0 || CM.Cache[target][i].roi == 'Infinity') color = CM.Disp.colorGray;
|
||||||
else if (CM.Cache[target][i].bci < CM.Disp.min) color = CM.Disp.colorBlue;
|
else if (CM.Cache[target][i].roi < CM.Cache.min) color = CM.Disp.colorBlue;
|
||||||
else if (CM.Cache[target][i].bci == CM.Disp.min) color = CM.Disp.colorGreen;
|
else if (CM.Cache[target][i].roi == CM.Cache.min) color = CM.Disp.colorGreen;
|
||||||
else if (CM.Cache[target][i].bci == CM.Disp.max) color = CM.Disp.colorRed;
|
else if (CM.Cache[target][i].roi == CM.Cache.max) color = CM.Disp.colorRed;
|
||||||
else if (CM.Cache[target][i].bci > CM.Disp.max) color = CM.Disp.colorPurple;
|
else if (CM.Cache[target][i].roi > CM.Cache.max) color = CM.Disp.colorPurple;
|
||||||
else if (CM.Cache[target][i].bci > CM.Disp.mid) color = CM.Disp.colorOrange;
|
else if (CM.Cache[target][i].roi > CM.Cache.mid) color = CM.Disp.colorOrange;
|
||||||
else color = CM.Disp.colorYellow;
|
else color = CM.Disp.colorYellow;
|
||||||
CM.Cache[target][i].color = color;
|
CM.Cache[target][i].color = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Cache.RemakeBCI = function() {
|
CM.Cache.RemakeROI = function() {
|
||||||
// Buildings for 1 amount
|
// Buildings for 1 amount
|
||||||
CM.Cache.RemakeBuildingsBCI();
|
CM.Cache.RemakeBuildingsROI();
|
||||||
|
|
||||||
// Upgrades
|
// Upgrades
|
||||||
CM.Cache.RemakeUpgradeBCI();
|
CM.Cache.RemakeUpgradeROI();
|
||||||
|
|
||||||
// Buildings for 10 amount
|
// Buildings for 10 amount
|
||||||
CM.Cache.RemakeBuildingsOtherBCI(10, 'Objects10');
|
CM.Cache.RemakeBuildingsOtherROI(10, 'Objects10');
|
||||||
|
|
||||||
// Buildings for 100 amount
|
// Buildings for 100 amount
|
||||||
CM.Cache.RemakeBuildingsOtherBCI(100, 'Objects100');
|
CM.Cache.RemakeBuildingsOtherROI(100, 'Objects100');
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Cache.RemakeLucky = function() {
|
CM.Cache.RemakeLucky = function() {
|
||||||
@@ -209,6 +211,9 @@ CM.Cache.RemakeSellForChoEgg = function() {
|
|||||||
CM.Cache.SellForChoEgg = sellTotal;
|
CM.Cache.SellForChoEgg = sellTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CM.Cache.min = -1;
|
||||||
|
CM.Cache.max = -1;
|
||||||
|
CM.Cache.mid = -1;
|
||||||
CM.Cache.Lucky = 0;
|
CM.Cache.Lucky = 0;
|
||||||
CM.Cache.LuckyReward = 0;
|
CM.Cache.LuckyReward = 0;
|
||||||
CM.Cache.LuckyFrenzy = 0;
|
CM.Cache.LuckyFrenzy = 0;
|
||||||
@@ -345,7 +350,7 @@ CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timer
|
|||||||
CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}};
|
CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}};
|
||||||
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}};
|
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}};
|
||||||
CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', toggle: true, func: function() {CM.Disp.ToggleUpBarColor();}};
|
CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', toggle: true, func: function() {CM.Disp.ToggleUpBarColor();}};
|
||||||
CM.ConfigData.Colors = {desc: {Blue: 'Color Blue. Used to show better than best BCI building, for Click Frenzy bar, and for various labels', Green: 'Color Green. Used to show best BCI building, for Blood Frenzy bar, and for various labels', Yellow: 'Color Yellow. Used to show between best and worst BCI buildings closer to best, for Frenzy bar, and for various labels', Orange: 'Color Orange. Used to show between best and worst BCI buildings closer to worst, for Next Reindeer bar, and for various labels', Red: 'Color Red. Used to show worst BCI building, for Clot bar, and for various labels', Purple: 'Color Purple. Used to show worse than worst BCI building, for Next Cookie bar, and for various labels', Gray: 'Color Gray. Used to show negative or infinity BCI, and for Next Cookie/Next Reindeer bar', Pink: 'Color Pink. Used for Dragonflight bar', Brown: 'Color Brown. Used for Dragon Harvest bar'}, func: function() {CM.Disp.UpdateColors();}};
|
CM.ConfigData.Colors = {desc: {Blue: 'Color Blue. Used to show better than best ROI building, for Click Frenzy bar, and for various labels', Green: 'Color Green. Used to show best ROI building, for Blood Frenzy bar, and for various labels', Yellow: 'Color Yellow. Used to show between best and worst ROI buildings closer to best, for Frenzy bar, and for various labels', Orange: 'Color Orange. Used to show between best and worst ROI buildings closer to worst, for Next Reindeer bar, and for various labels', Red: 'Color Red. Used to show worst ROI building, for Clot bar, and for various labels', Purple: 'Color Purple. Used to show worse than worst ROI building, for Next Cookie bar, and for various labels', Gray: 'Color Gray. Used to show negative or infinity ROI, and for Next Cookie/Next Reindeer bar', Pink: 'Color Pink. Used for Dragonflight bar', Brown: 'Color Brown. Used for Dragon Harvest bar'}, func: function() {CM.Disp.UpdateColors();}};
|
||||||
CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup', toggle: true};
|
CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup', toggle: true};
|
||||||
CM.ConfigData.Sound = {label: ['Sounds OFF', 'Sounds ON'], desc: 'Play a sound on Golden Cookie/Season Popup', toggle: true};
|
CM.ConfigData.Sound = {label: ['Sounds OFF', 'Sounds ON'], desc: 'Play a sound on Golden Cookie/Season Popup', toggle: true};
|
||||||
CM.ConfigData.Volume = {label: [], desc: 'Volume of the sound'};
|
CM.ConfigData.Volume = {label: [], desc: 'Volume of the sound'};
|
||||||
@@ -526,9 +531,9 @@ CM.Disp.CreateBotBar = function() {
|
|||||||
var bonus = document.createElement('tr');
|
var bonus = document.createElement('tr');
|
||||||
bonus.appendChild(firstCol('Bonus Income', CM.Disp.colorBlue));
|
bonus.appendChild(firstCol('Bonus Income', CM.Disp.colorBlue));
|
||||||
tbody.appendChild(bonus);
|
tbody.appendChild(bonus);
|
||||||
var bci = document.createElement('tr');
|
var roi = document.createElement('tr');
|
||||||
bci.appendChild(firstCol('Base Cost Per Income', CM.Disp.colorBlue));
|
roi.appendChild(firstCol('Return On Investment', CM.Disp.colorBlue));
|
||||||
tbody.appendChild(bci);
|
tbody.appendChild(roi);
|
||||||
var time = document.createElement('tr');
|
var time = document.createElement('tr');
|
||||||
time.appendChild(firstCol('Time Left', CM.Disp.colorBlue));
|
time.appendChild(firstCol('Time Left', CM.Disp.colorBlue));
|
||||||
tbody.appendChild(time);
|
tbody.appendChild(time);
|
||||||
@@ -542,7 +547,7 @@ CM.Disp.CreateBotBar = function() {
|
|||||||
header.appendChild(document.createTextNode(')'));
|
header.appendChild(document.createTextNode(')'));
|
||||||
type.appendChild(header);
|
type.appendChild(header);
|
||||||
bonus.appendChild(document.createElement('td'));
|
bonus.appendChild(document.createElement('td'));
|
||||||
bci.appendChild(document.createElement('td'));
|
roi.appendChild(document.createElement('td'));
|
||||||
time.appendChild(document.createElement('td'));
|
time.appendChild(document.createElement('td'));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -572,7 +577,7 @@ CM.Disp.UpdateBotBarOther = function() {
|
|||||||
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.Objects[i].bonus, 2);
|
CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].bonus, 2);
|
||||||
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache.Objects[i].color;
|
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache.Objects[i].color;
|
||||||
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].bci, 2);
|
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].roi, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -824,13 +829,13 @@ CM.Disp.UpdateBuildings = function() {
|
|||||||
if (CM.Config.BuildColor == 1 && Game.buyMode == 1) {
|
if (CM.Config.BuildColor == 1 && Game.buyMode == 1) {
|
||||||
var target = '';
|
var target = '';
|
||||||
if (Game.buyBulk == 10) {
|
if (Game.buyBulk == 10) {
|
||||||
target = 'Objects10'
|
target = 'Objects10';
|
||||||
}
|
}
|
||||||
else if (Game.buyBulk == 100) {
|
else if (Game.buyBulk == 100) {
|
||||||
target = 'Objects100'
|
target = 'Objects100';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
target = 'Objects'
|
target = 'Objects';
|
||||||
}
|
}
|
||||||
for (var i in CM.Cache[target]) {
|
for (var i in CM.Cache[target]) {
|
||||||
l('productPrice' + Game.Objects[i].id).style.color = CM.Config.Colors[CM.Cache[target][i].color];
|
l('productPrice' + Game.Objects[i].id).style.color = CM.Config.Colors[CM.Cache[target][i].color];
|
||||||
@@ -877,13 +882,13 @@ CM.Disp.CreateUpgradeBar = function() {
|
|||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
|
|
||||||
legend.appendChild(legendLine(CM.Disp.colorBlue, 'Better than best BCI building'));
|
legend.appendChild(legendLine(CM.Disp.colorBlue, 'Better than best ROI building'));
|
||||||
legend.appendChild(legendLine(CM.Disp.colorGreen, 'Same as best BCI building'));
|
legend.appendChild(legendLine(CM.Disp.colorGreen, 'Same as best ROI building'));
|
||||||
legend.appendChild(legendLine(CM.Disp.colorYellow, 'Between best and worst BCI buildings closer to best'));
|
legend.appendChild(legendLine(CM.Disp.colorYellow, 'Between best and worst ROI buildings closer to best'));
|
||||||
legend.appendChild(legendLine(CM.Disp.colorOrange, 'Between best and worst BCI buildings closer to worst'));
|
legend.appendChild(legendLine(CM.Disp.colorOrange, 'Between best and worst ROI buildings closer to worst'));
|
||||||
legend.appendChild(legendLine(CM.Disp.colorRed, 'Same as worst BCI building'));
|
legend.appendChild(legendLine(CM.Disp.colorRed, 'Same as worst ROI building'));
|
||||||
legend.appendChild(legendLine(CM.Disp.colorPurple, 'Worse than worst BCI building'));
|
legend.appendChild(legendLine(CM.Disp.colorPurple, 'Worse than worst ROI building'));
|
||||||
legend.appendChild(legendLine(CM.Disp.colorGray, 'Negative or infinity BCI'));
|
legend.appendChild(legendLine(CM.Disp.colorGray, 'Negative or infinity ROI'));
|
||||||
placeholder.appendChild(legend);
|
placeholder.appendChild(legend);
|
||||||
|
|
||||||
CM.Disp.UpgradeBar.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');};
|
CM.Disp.UpgradeBar.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');};
|
||||||
@@ -1864,11 +1869,11 @@ CM.Disp.Tooltip = function(type, name) {
|
|||||||
income.style.color = 'white';
|
income.style.color = 'white';
|
||||||
income.id = 'CMTooltipIncome';
|
income.id = 'CMTooltipIncome';
|
||||||
tooltip.appendChild(income);
|
tooltip.appendChild(income);
|
||||||
tooltip.appendChild(header('Base Cost Per Income'));
|
tooltip.appendChild(header('Return On Investment'));
|
||||||
var bci = document.createElement('div');
|
var roi = document.createElement('div');
|
||||||
bci.style.marginBottom = '4px';
|
roi.style.marginBottom = '4px';
|
||||||
bci.id = 'CMTooltipBCI';
|
roi.id = 'CMTooltipROI';
|
||||||
tooltip.appendChild(bci);
|
tooltip.appendChild(roi);
|
||||||
tooltip.appendChild(header('Time Left'));
|
tooltip.appendChild(header('Time Left'));
|
||||||
var time = document.createElement('div');
|
var time = document.createElement('div');
|
||||||
time.id = 'CMTooltipTime';
|
time.id = 'CMTooltipTime';
|
||||||
@@ -1906,8 +1911,8 @@ CM.Disp.UpdateTooltip = function() {
|
|||||||
bonus = CM.Cache[target][CM.Disp.tooltipName].bonus;
|
bonus = CM.Cache[target][CM.Disp.tooltipName].bonus;
|
||||||
if (CM.Config.Tooltip == 1 && Game.buyMode == 1) {
|
if (CM.Config.Tooltip == 1 && Game.buyMode == 1) {
|
||||||
l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color;
|
l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color;
|
||||||
l('CMTooltipBCI').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].bci, 2);
|
l('CMTooltipROI').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].roi, 2);
|
||||||
l('CMTooltipBCI').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color;
|
l('CMTooltipROI').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // Upgrades
|
else { // Upgrades
|
||||||
@@ -1915,8 +1920,8 @@ CM.Disp.UpdateTooltip = function() {
|
|||||||
price = Game.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].getPrice();
|
price = Game.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].getPrice();
|
||||||
if (CM.Config.Tooltip == 1) {
|
if (CM.Config.Tooltip == 1) {
|
||||||
l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color;
|
l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color;
|
||||||
l('CMTooltipBCI').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].bci, 2);
|
l('CMTooltipROI').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].roi, 2);
|
||||||
l('CMTooltipBCI').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color;
|
l('CMTooltipROI').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CM.Config.Tooltip == 1 && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
|
if (CM.Config.Tooltip == 1 && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
|
||||||
@@ -2090,9 +2095,6 @@ CM.Disp.RefreshScale = function() {
|
|||||||
CM.Disp.UpdateUpgrades();
|
CM.Disp.UpdateUpgrades();
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Disp.min = -1;
|
|
||||||
CM.Disp.max = -1;
|
|
||||||
CM.Disp.mid = -1;
|
|
||||||
CM.Disp.colorTextPre = 'CMText';
|
CM.Disp.colorTextPre = 'CMText';
|
||||||
CM.Disp.colorBackPre = 'CMBack';
|
CM.Disp.colorBackPre = 'CMBack';
|
||||||
CM.Disp.colorBorderPre = 'CMBorder';
|
CM.Disp.colorBorderPre = 'CMBorder';
|
||||||
@@ -2108,8 +2110,6 @@ CM.Disp.colorBrown = 'Brown';
|
|||||||
CM.Disp.colors = [CM.Disp.colorBlue, CM.Disp.colorGreen, CM.Disp.colorYellow, CM.Disp.colorOrange, CM.Disp.colorRed, CM.Disp.colorPurple, CM.Disp.colorGray, CM.Disp.colorPink, CM.Disp.colorBrown];
|
CM.Disp.colors = [CM.Disp.colorBlue, CM.Disp.colorGreen, CM.Disp.colorYellow, CM.Disp.colorOrange, CM.Disp.colorRed, CM.Disp.colorPurple, CM.Disp.colorGray, CM.Disp.colorPink, CM.Disp.colorBrown];
|
||||||
CM.Disp.lastGoldenCookieState = 'none';
|
CM.Disp.lastGoldenCookieState = 'none';
|
||||||
CM.Disp.lastAscendState = -1;
|
CM.Disp.lastAscendState = -1;
|
||||||
CM.Disp.lastBuyMode = -1;
|
|
||||||
CM.Disp.lastBuyBulk = -1;
|
|
||||||
|
|
||||||
CM.Disp.metric = ['M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
|
CM.Disp.metric = ['M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
|
||||||
CM.Disp.shortScale = ['M', 'B', 'Tr', 'Quadr', 'Quint', 'Sext', 'Sept', 'Oct', 'Non', 'Dec', 'Undec', 'Duodec', 'Tredec'];
|
CM.Disp.shortScale = ['M', 'B', 'Tr', 'Quadr', 'Quint', 'Sext', 'Sept', 'Oct', 'Non', 'Dec', 'Undec', 'Duodec', 'Tredec'];
|
||||||
@@ -2211,32 +2211,21 @@ CM.Loop = function() {
|
|||||||
if (!Game.OnAscend && Game.AscendTimer == 0) {
|
if (!Game.OnAscend && Game.AscendTimer == 0) {
|
||||||
if (CM.Sim.DoSims) {
|
if (CM.Sim.DoSims) {
|
||||||
CM.Cache.RemakeIncome();
|
CM.Cache.RemakeIncome();
|
||||||
CM.Cache.RemakeBCI();
|
|
||||||
CM.Cache.RemakeLucky();
|
CM.Cache.RemakeLucky();
|
||||||
CM.Cache.RemakeChain();
|
CM.Cache.RemakeChain();
|
||||||
CM.Cache.RemakeSeaSpec();
|
CM.Cache.RemakeSeaSpec();
|
||||||
CM.Cache.RemakeSellForChoEgg();
|
CM.Cache.RemakeSellForChoEgg();
|
||||||
|
|
||||||
CM.Disp.UpdateBotBarOther();
|
|
||||||
CM.Disp.UpdateBuildings();
|
|
||||||
CM.Disp.UpdateUpgrades();
|
|
||||||
|
|
||||||
CM.Sim.DoSims = 0;
|
CM.Sim.DoSims = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Buildings Color for different buy/sell modes
|
// Calculate ROI
|
||||||
var updateBuildings = false;
|
CM.Cache.RemakeROI();
|
||||||
if (CM.Disp.lastBuyMode != Game.buyMode) {
|
|
||||||
CM.Disp.lastBuyMode = Game.buyMode;
|
// Update colors
|
||||||
updateBuildings = true;
|
CM.Disp.UpdateBotBarOther();
|
||||||
}
|
|
||||||
if (CM.Disp.lastBuyBulk != Game.buyBulk) {
|
|
||||||
CM.Disp.lastBuyBulk = Game.buyBulk;
|
|
||||||
updateBuildings = true;
|
|
||||||
}
|
|
||||||
if (updateBuildings) {
|
|
||||||
CM.Disp.UpdateBuildings();
|
CM.Disp.UpdateBuildings();
|
||||||
}
|
CM.Disp.UpdateUpgrades();
|
||||||
|
|
||||||
// Redraw timers
|
// Redraw timers
|
||||||
CM.Disp.UpdateBotBarTime();
|
CM.Disp.UpdateBotBarTime();
|
||||||
@@ -2669,6 +2658,9 @@ CM.Sim.BuyBuildings = function(amount, target) {
|
|||||||
|
|
||||||
CM.Cache[target][i] = {};
|
CM.Cache[target][i] = {};
|
||||||
CM.Cache[target][i].bonus = CM.Sim.cookiesPs - Game.cookiesPs;
|
CM.Cache[target][i].bonus = CM.Sim.cookiesPs - Game.cookiesPs;
|
||||||
|
if (amount != 1) {
|
||||||
|
CM.Cache[target][i].price = CM.Sim.BuildingGetPrice(Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, amount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ All suggestions are welcome, even the smallest ones.
|
|||||||
|
|
||||||
* **[Raving_Kumquat](http://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author
|
* **[Raving_Kumquat](http://cookieclicker.wikia.com/wiki/User:Raving_Kumquat)**: Original author
|
||||||
* **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer
|
* **[Maxime Fabre](https://github.com/Anahkiasen)**: Previous maintainer
|
||||||
* **Alderi Tokori**: ROI calculations (unused now)
|
|
||||||
* **[Alhifar](https://github.com/Alhifar)**: Missed Golden Cookie Stat
|
* **[Alhifar](https://github.com/Alhifar)**: Missed Golden Cookie Stat
|
||||||
* **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons
|
* **[BlackenedGem](https://github.com/BlackenedGem)**: Golden/Wrath Cookie Favicons
|
||||||
* **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer
|
* **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer
|
||||||
73
src/Cache.js
73
src/Cache.js
@@ -24,70 +24,72 @@ CM.Cache.RemakeIncome = function() {
|
|||||||
CM.Sim.BuyBuildings(100, 'Objects100');
|
CM.Sim.BuyBuildings(100, 'Objects100');
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Cache.RemakeBuildingsBCI = function() {
|
CM.Cache.RemakeBuildingsROI = function() {
|
||||||
CM.Disp.min = -1;
|
CM.Cache.min = -1;
|
||||||
CM.Disp.max = -1;
|
CM.Cache.max = -1;
|
||||||
CM.Disp.mid = -1;
|
CM.Cache.mid = -1;
|
||||||
for (var i in CM.Cache.Objects) {
|
for (var i in CM.Cache.Objects) {
|
||||||
CM.Cache.Objects[i].bci = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus;
|
//CM.Cache.Objects[i].roi = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus;
|
||||||
if (CM.Disp.min == -1 || CM.Cache.Objects[i].bci < CM.Disp.min) CM.Disp.min = CM.Cache.Objects[i].bci;
|
CM.Cache.Objects[i].roi = (Math.max(Game.Objects[i].getPrice() - Game.cookies, 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus);
|
||||||
if (CM.Disp.max == -1 || CM.Cache.Objects[i].bci > CM.Disp.max) CM.Disp.max = CM.Cache.Objects[i].bci;
|
if (CM.Cache.min == -1 || CM.Cache.Objects[i].roi < CM.Cache.min) CM.Cache.min = CM.Cache.Objects[i].roi;
|
||||||
|
if (CM.Cache.max == -1 || CM.Cache.Objects[i].roi > CM.Cache.max) CM.Cache.max = CM.Cache.Objects[i].roi;
|
||||||
}
|
}
|
||||||
CM.Disp.mid = ((CM.Disp.max - CM.Disp.min) / 2) + CM.Disp.min;
|
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
|
||||||
for (var i in CM.Cache.Objects) {
|
for (var i in CM.Cache.Objects) {
|
||||||
var color = '';
|
var color = '';
|
||||||
if (CM.Cache.Objects[i].bci == CM.Disp.min) color = CM.Disp.colorGreen;
|
if (CM.Cache.Objects[i].roi == CM.Cache.min) color = CM.Disp.colorGreen;
|
||||||
else if (CM.Cache.Objects[i].bci == CM.Disp.max) color = CM.Disp.colorRed;
|
else if (CM.Cache.Objects[i].roi == CM.Cache.max) color = CM.Disp.colorRed;
|
||||||
else if (CM.Cache.Objects[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange;
|
else if (CM.Cache.Objects[i].roi > 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.Objects[i].color = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Cache.RemakeUpgradeBCI = function() {
|
CM.Cache.RemakeUpgradeROI = function() {
|
||||||
for (var i in CM.Cache.Upgrades) {
|
for (var i in CM.Cache.Upgrades) {
|
||||||
CM.Cache.Upgrades[i].bci = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus;
|
//CM.Cache.Upgrades[i].roi = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus;
|
||||||
if (isNaN(CM.Cache.Upgrades[i].bci)) CM.Cache.Upgrades[i].bci = 'Infinity';
|
CM.Cache.Upgrades[i].roi = (Math.max(Game.Upgrades[i].getPrice() - Game.cookies, 0) / Game.cookiesPs) + (Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus);
|
||||||
|
if (isNaN(CM.Cache.Upgrades[i].roi)) CM.Cache.Upgrades[i].roi = 'Infinity';
|
||||||
var color = '';
|
var color = '';
|
||||||
if (CM.Cache.Upgrades[i].bci <= 0 || CM.Cache.Upgrades[i].bci == 'Infinity') color = CM.Disp.colorGray;
|
if (CM.Cache.Upgrades[i].roi <= 0 || CM.Cache.Upgrades[i].roi == 'Infinity') color = CM.Disp.colorGray;
|
||||||
else if (CM.Cache.Upgrades[i].bci < CM.Disp.min) color = CM.Disp.colorBlue;
|
else if (CM.Cache.Upgrades[i].roi < CM.Cache.min) color = CM.Disp.colorBlue;
|
||||||
else if (CM.Cache.Upgrades[i].bci == CM.Disp.min) color = CM.Disp.colorGreen;
|
else if (CM.Cache.Upgrades[i].roi == CM.Cache.min) color = CM.Disp.colorGreen;
|
||||||
else if (CM.Cache.Upgrades[i].bci == CM.Disp.max) color = CM.Disp.colorRed;
|
else if (CM.Cache.Upgrades[i].roi == CM.Cache.max) color = CM.Disp.colorRed;
|
||||||
else if (CM.Cache.Upgrades[i].bci > CM.Disp.max) color = CM.Disp.colorPurple;
|
else if (CM.Cache.Upgrades[i].roi > CM.Cache.max) color = CM.Disp.colorPurple;
|
||||||
else if (CM.Cache.Upgrades[i].bci > CM.Disp.mid) color = CM.Disp.colorOrange;
|
else if (CM.Cache.Upgrades[i].roi > CM.Cache.mid) color = CM.Disp.colorOrange;
|
||||||
else color = CM.Disp.colorYellow;
|
else color = CM.Disp.colorYellow;
|
||||||
CM.Cache.Upgrades[i].color = color;
|
CM.Cache.Upgrades[i].color = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Cache.RemakeBuildingsOtherBCI = function(amount, target) {
|
CM.Cache.RemakeBuildingsOtherROI = function(amount, target) {
|
||||||
for (var i in CM.Cache[target]) {
|
for (var i in CM.Cache[target]) {
|
||||||
CM.Cache[target][i].price = CM.Sim.BuildingGetPrice(Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, amount);
|
//CM.Cache[target][i].roi = CM.Cache[target][i].price / CM.Cache[target][i].bonus;
|
||||||
CM.Cache[target][i].bci = CM.Cache[target][i].price / CM.Cache[target][i].bonus;
|
CM.Cache[target][i].roi = (Math.max(CM.Cache[target][i].price - Game.cookies, 0) / Game.cookiesPs) + (CM.Cache[target][i].price / CM.Cache[target][i].bonus);
|
||||||
var color = '';
|
var color = '';
|
||||||
if (CM.Cache[target][i].bci <= 0 || CM.Cache[target][i].bci == 'Infinity') color = CM.Disp.colorGray;
|
if (CM.Cache[target][i].roi <= 0 || CM.Cache[target][i].roi == 'Infinity') color = CM.Disp.colorGray;
|
||||||
else if (CM.Cache[target][i].bci < CM.Disp.min) color = CM.Disp.colorBlue;
|
else if (CM.Cache[target][i].roi < CM.Cache.min) color = CM.Disp.colorBlue;
|
||||||
else if (CM.Cache[target][i].bci == CM.Disp.min) color = CM.Disp.colorGreen;
|
else if (CM.Cache[target][i].roi == CM.Cache.min) color = CM.Disp.colorGreen;
|
||||||
else if (CM.Cache[target][i].bci == CM.Disp.max) color = CM.Disp.colorRed;
|
else if (CM.Cache[target][i].roi == CM.Cache.max) color = CM.Disp.colorRed;
|
||||||
else if (CM.Cache[target][i].bci > CM.Disp.max) color = CM.Disp.colorPurple;
|
else if (CM.Cache[target][i].roi > CM.Cache.max) color = CM.Disp.colorPurple;
|
||||||
else if (CM.Cache[target][i].bci > CM.Disp.mid) color = CM.Disp.colorOrange;
|
else if (CM.Cache[target][i].roi > CM.Cache.mid) color = CM.Disp.colorOrange;
|
||||||
else color = CM.Disp.colorYellow;
|
else color = CM.Disp.colorYellow;
|
||||||
CM.Cache[target][i].color = color;
|
CM.Cache[target][i].color = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Cache.RemakeBCI = function() {
|
CM.Cache.RemakeROI = function() {
|
||||||
// Buildings for 1 amount
|
// Buildings for 1 amount
|
||||||
CM.Cache.RemakeBuildingsBCI();
|
CM.Cache.RemakeBuildingsROI();
|
||||||
|
|
||||||
// Upgrades
|
// Upgrades
|
||||||
CM.Cache.RemakeUpgradeBCI();
|
CM.Cache.RemakeUpgradeROI();
|
||||||
|
|
||||||
// Buildings for 10 amount
|
// Buildings for 10 amount
|
||||||
CM.Cache.RemakeBuildingsOtherBCI(10, 'Objects10');
|
CM.Cache.RemakeBuildingsOtherROI(10, 'Objects10');
|
||||||
|
|
||||||
// Buildings for 100 amount
|
// Buildings for 100 amount
|
||||||
CM.Cache.RemakeBuildingsOtherBCI(100, 'Objects100');
|
CM.Cache.RemakeBuildingsOtherROI(100, 'Objects100');
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Cache.RemakeLucky = function() {
|
CM.Cache.RemakeLucky = function() {
|
||||||
@@ -189,6 +191,9 @@ CM.Cache.RemakeSellForChoEgg = function() {
|
|||||||
CM.Cache.SellForChoEgg = sellTotal;
|
CM.Cache.SellForChoEgg = sellTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CM.Cache.min = -1;
|
||||||
|
CM.Cache.max = -1;
|
||||||
|
CM.Cache.mid = -1;
|
||||||
CM.Cache.Lucky = 0;
|
CM.Cache.Lucky = 0;
|
||||||
CM.Cache.LuckyReward = 0;
|
CM.Cache.LuckyReward = 0;
|
||||||
CM.Cache.LuckyFrenzy = 0;
|
CM.Cache.LuckyFrenzy = 0;
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timer
|
|||||||
CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}};
|
CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}};
|
||||||
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}};
|
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}};
|
||||||
CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', toggle: true, func: function() {CM.Disp.ToggleUpBarColor();}};
|
CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', toggle: true, func: function() {CM.Disp.ToggleUpBarColor();}};
|
||||||
CM.ConfigData.Colors = {desc: {Blue: 'Color Blue. Used to show better than best BCI building, for Click Frenzy bar, and for various labels', Green: 'Color Green. Used to show best BCI building, for Blood Frenzy bar, and for various labels', Yellow: 'Color Yellow. Used to show between best and worst BCI buildings closer to best, for Frenzy bar, and for various labels', Orange: 'Color Orange. Used to show between best and worst BCI buildings closer to worst, for Next Reindeer bar, and for various labels', Red: 'Color Red. Used to show worst BCI building, for Clot bar, and for various labels', Purple: 'Color Purple. Used to show worse than worst BCI building, for Next Cookie bar, and for various labels', Gray: 'Color Gray. Used to show negative or infinity BCI, and for Next Cookie/Next Reindeer bar', Pink: 'Color Pink. Used for Dragonflight bar', Brown: 'Color Brown. Used for Dragon Harvest bar'}, func: function() {CM.Disp.UpdateColors();}};
|
CM.ConfigData.Colors = {desc: {Blue: 'Color Blue. Used to show better than best ROI building, for Click Frenzy bar, and for various labels', Green: 'Color Green. Used to show best ROI building, for Blood Frenzy bar, and for various labels', Yellow: 'Color Yellow. Used to show between best and worst ROI buildings closer to best, for Frenzy bar, and for various labels', Orange: 'Color Orange. Used to show between best and worst ROI buildings closer to worst, for Next Reindeer bar, and for various labels', Red: 'Color Red. Used to show worst ROI building, for Clot bar, and for various labels', Purple: 'Color Purple. Used to show worse than worst ROI building, for Next Cookie bar, and for various labels', Gray: 'Color Gray. Used to show negative or infinity ROI, and for Next Cookie/Next Reindeer bar', Pink: 'Color Pink. Used for Dragonflight bar', Brown: 'Color Brown. Used for Dragon Harvest bar'}, func: function() {CM.Disp.UpdateColors();}};
|
||||||
CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup', toggle: true};
|
CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup', toggle: true};
|
||||||
CM.ConfigData.Sound = {label: ['Sounds OFF', 'Sounds ON'], desc: 'Play a sound on Golden Cookie/Season Popup', toggle: true};
|
CM.ConfigData.Sound = {label: ['Sounds OFF', 'Sounds ON'], desc: 'Play a sound on Golden Cookie/Season Popup', toggle: true};
|
||||||
CM.ConfigData.Volume = {label: [], desc: 'Volume of the sound'};
|
CM.ConfigData.Volume = {label: [], desc: 'Volume of the sound'};
|
||||||
|
|||||||
53
src/Disp.js
53
src/Disp.js
@@ -148,9 +148,9 @@ CM.Disp.CreateBotBar = function() {
|
|||||||
var bonus = document.createElement('tr');
|
var bonus = document.createElement('tr');
|
||||||
bonus.appendChild(firstCol('Bonus Income', CM.Disp.colorBlue));
|
bonus.appendChild(firstCol('Bonus Income', CM.Disp.colorBlue));
|
||||||
tbody.appendChild(bonus);
|
tbody.appendChild(bonus);
|
||||||
var bci = document.createElement('tr');
|
var roi = document.createElement('tr');
|
||||||
bci.appendChild(firstCol('Base Cost Per Income', CM.Disp.colorBlue));
|
roi.appendChild(firstCol('Return On Investment', CM.Disp.colorBlue));
|
||||||
tbody.appendChild(bci);
|
tbody.appendChild(roi);
|
||||||
var time = document.createElement('tr');
|
var time = document.createElement('tr');
|
||||||
time.appendChild(firstCol('Time Left', CM.Disp.colorBlue));
|
time.appendChild(firstCol('Time Left', CM.Disp.colorBlue));
|
||||||
tbody.appendChild(time);
|
tbody.appendChild(time);
|
||||||
@@ -164,7 +164,7 @@ CM.Disp.CreateBotBar = function() {
|
|||||||
header.appendChild(document.createTextNode(')'));
|
header.appendChild(document.createTextNode(')'));
|
||||||
type.appendChild(header);
|
type.appendChild(header);
|
||||||
bonus.appendChild(document.createElement('td'));
|
bonus.appendChild(document.createElement('td'));
|
||||||
bci.appendChild(document.createElement('td'));
|
roi.appendChild(document.createElement('td'));
|
||||||
time.appendChild(document.createElement('td'));
|
time.appendChild(document.createElement('td'));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -194,7 +194,7 @@ CM.Disp.UpdateBotBarOther = function() {
|
|||||||
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.Objects[i].bonus, 2);
|
CM.Disp.BotBar.firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].bonus, 2);
|
||||||
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache.Objects[i].color;
|
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].className = CM.Disp.colorTextPre + CM.Cache.Objects[i].color;
|
||||||
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].bci, 2);
|
CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].roi, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -446,13 +446,13 @@ CM.Disp.UpdateBuildings = function() {
|
|||||||
if (CM.Config.BuildColor == 1 && Game.buyMode == 1) {
|
if (CM.Config.BuildColor == 1 && Game.buyMode == 1) {
|
||||||
var target = '';
|
var target = '';
|
||||||
if (Game.buyBulk == 10) {
|
if (Game.buyBulk == 10) {
|
||||||
target = 'Objects10'
|
target = 'Objects10';
|
||||||
}
|
}
|
||||||
else if (Game.buyBulk == 100) {
|
else if (Game.buyBulk == 100) {
|
||||||
target = 'Objects100'
|
target = 'Objects100';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
target = 'Objects'
|
target = 'Objects';
|
||||||
}
|
}
|
||||||
for (var i in CM.Cache[target]) {
|
for (var i in CM.Cache[target]) {
|
||||||
l('productPrice' + Game.Objects[i].id).style.color = CM.Config.Colors[CM.Cache[target][i].color];
|
l('productPrice' + Game.Objects[i].id).style.color = CM.Config.Colors[CM.Cache[target][i].color];
|
||||||
@@ -499,13 +499,13 @@ CM.Disp.CreateUpgradeBar = function() {
|
|||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
|
|
||||||
legend.appendChild(legendLine(CM.Disp.colorBlue, 'Better than best BCI building'));
|
legend.appendChild(legendLine(CM.Disp.colorBlue, 'Better than best ROI building'));
|
||||||
legend.appendChild(legendLine(CM.Disp.colorGreen, 'Same as best BCI building'));
|
legend.appendChild(legendLine(CM.Disp.colorGreen, 'Same as best ROI building'));
|
||||||
legend.appendChild(legendLine(CM.Disp.colorYellow, 'Between best and worst BCI buildings closer to best'));
|
legend.appendChild(legendLine(CM.Disp.colorYellow, 'Between best and worst ROI buildings closer to best'));
|
||||||
legend.appendChild(legendLine(CM.Disp.colorOrange, 'Between best and worst BCI buildings closer to worst'));
|
legend.appendChild(legendLine(CM.Disp.colorOrange, 'Between best and worst ROI buildings closer to worst'));
|
||||||
legend.appendChild(legendLine(CM.Disp.colorRed, 'Same as worst BCI building'));
|
legend.appendChild(legendLine(CM.Disp.colorRed, 'Same as worst ROI building'));
|
||||||
legend.appendChild(legendLine(CM.Disp.colorPurple, 'Worse than worst BCI building'));
|
legend.appendChild(legendLine(CM.Disp.colorPurple, 'Worse than worst ROI building'));
|
||||||
legend.appendChild(legendLine(CM.Disp.colorGray, 'Negative or infinity BCI'));
|
legend.appendChild(legendLine(CM.Disp.colorGray, 'Negative or infinity ROI'));
|
||||||
placeholder.appendChild(legend);
|
placeholder.appendChild(legend);
|
||||||
|
|
||||||
CM.Disp.UpgradeBar.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');};
|
CM.Disp.UpgradeBar.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');};
|
||||||
@@ -1486,11 +1486,11 @@ CM.Disp.Tooltip = function(type, name) {
|
|||||||
income.style.color = 'white';
|
income.style.color = 'white';
|
||||||
income.id = 'CMTooltipIncome';
|
income.id = 'CMTooltipIncome';
|
||||||
tooltip.appendChild(income);
|
tooltip.appendChild(income);
|
||||||
tooltip.appendChild(header('Base Cost Per Income'));
|
tooltip.appendChild(header('Return On Investment'));
|
||||||
var bci = document.createElement('div');
|
var roi = document.createElement('div');
|
||||||
bci.style.marginBottom = '4px';
|
roi.style.marginBottom = '4px';
|
||||||
bci.id = 'CMTooltipBCI';
|
roi.id = 'CMTooltipROI';
|
||||||
tooltip.appendChild(bci);
|
tooltip.appendChild(roi);
|
||||||
tooltip.appendChild(header('Time Left'));
|
tooltip.appendChild(header('Time Left'));
|
||||||
var time = document.createElement('div');
|
var time = document.createElement('div');
|
||||||
time.id = 'CMTooltipTime';
|
time.id = 'CMTooltipTime';
|
||||||
@@ -1528,8 +1528,8 @@ CM.Disp.UpdateTooltip = function() {
|
|||||||
bonus = CM.Cache[target][CM.Disp.tooltipName].bonus;
|
bonus = CM.Cache[target][CM.Disp.tooltipName].bonus;
|
||||||
if (CM.Config.Tooltip == 1 && Game.buyMode == 1) {
|
if (CM.Config.Tooltip == 1 && Game.buyMode == 1) {
|
||||||
l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color;
|
l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color;
|
||||||
l('CMTooltipBCI').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].bci, 2);
|
l('CMTooltipROI').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].roi, 2);
|
||||||
l('CMTooltipBCI').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color;
|
l('CMTooltipROI').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // Upgrades
|
else { // Upgrades
|
||||||
@@ -1537,8 +1537,8 @@ CM.Disp.UpdateTooltip = function() {
|
|||||||
price = Game.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].getPrice();
|
price = Game.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].getPrice();
|
||||||
if (CM.Config.Tooltip == 1) {
|
if (CM.Config.Tooltip == 1) {
|
||||||
l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color;
|
l('CMTooltipBorder').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color;
|
||||||
l('CMTooltipBCI').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].bci, 2);
|
l('CMTooltipROI').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].roi, 2);
|
||||||
l('CMTooltipBCI').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color;
|
l('CMTooltipROI').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CM.Config.Tooltip == 1 && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
|
if (CM.Config.Tooltip == 1 && (CM.Disp.tooltipType != 'b' || Game.buyMode == 1)) {
|
||||||
@@ -1712,9 +1712,6 @@ CM.Disp.RefreshScale = function() {
|
|||||||
CM.Disp.UpdateUpgrades();
|
CM.Disp.UpdateUpgrades();
|
||||||
}
|
}
|
||||||
|
|
||||||
CM.Disp.min = -1;
|
|
||||||
CM.Disp.max = -1;
|
|
||||||
CM.Disp.mid = -1;
|
|
||||||
CM.Disp.colorTextPre = 'CMText';
|
CM.Disp.colorTextPre = 'CMText';
|
||||||
CM.Disp.colorBackPre = 'CMBack';
|
CM.Disp.colorBackPre = 'CMBack';
|
||||||
CM.Disp.colorBorderPre = 'CMBorder';
|
CM.Disp.colorBorderPre = 'CMBorder';
|
||||||
@@ -1730,8 +1727,6 @@ CM.Disp.colorBrown = 'Brown';
|
|||||||
CM.Disp.colors = [CM.Disp.colorBlue, CM.Disp.colorGreen, CM.Disp.colorYellow, CM.Disp.colorOrange, CM.Disp.colorRed, CM.Disp.colorPurple, CM.Disp.colorGray, CM.Disp.colorPink, CM.Disp.colorBrown];
|
CM.Disp.colors = [CM.Disp.colorBlue, CM.Disp.colorGreen, CM.Disp.colorYellow, CM.Disp.colorOrange, CM.Disp.colorRed, CM.Disp.colorPurple, CM.Disp.colorGray, CM.Disp.colorPink, CM.Disp.colorBrown];
|
||||||
CM.Disp.lastGoldenCookieState = 'none';
|
CM.Disp.lastGoldenCookieState = 'none';
|
||||||
CM.Disp.lastAscendState = -1;
|
CM.Disp.lastAscendState = -1;
|
||||||
CM.Disp.lastBuyMode = -1;
|
|
||||||
CM.Disp.lastBuyBulk = -1;
|
|
||||||
|
|
||||||
CM.Disp.metric = ['M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
|
CM.Disp.metric = ['M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
|
||||||
CM.Disp.shortScale = ['M', 'B', 'Tr', 'Quadr', 'Quint', 'Sext', 'Sept', 'Oct', 'Non', 'Dec', 'Undec', 'Duodec', 'Tredec'];
|
CM.Disp.shortScale = ['M', 'B', 'Tr', 'Quadr', 'Quint', 'Sext', 'Sept', 'Oct', 'Non', 'Dec', 'Undec', 'Duodec', 'Tredec'];
|
||||||
|
|||||||
23
src/Main.js
23
src/Main.js
@@ -86,32 +86,21 @@ CM.Loop = function() {
|
|||||||
if (!Game.OnAscend && Game.AscendTimer == 0) {
|
if (!Game.OnAscend && Game.AscendTimer == 0) {
|
||||||
if (CM.Sim.DoSims) {
|
if (CM.Sim.DoSims) {
|
||||||
CM.Cache.RemakeIncome();
|
CM.Cache.RemakeIncome();
|
||||||
CM.Cache.RemakeBCI();
|
|
||||||
CM.Cache.RemakeLucky();
|
CM.Cache.RemakeLucky();
|
||||||
CM.Cache.RemakeChain();
|
CM.Cache.RemakeChain();
|
||||||
CM.Cache.RemakeSeaSpec();
|
CM.Cache.RemakeSeaSpec();
|
||||||
CM.Cache.RemakeSellForChoEgg();
|
CM.Cache.RemakeSellForChoEgg();
|
||||||
|
|
||||||
CM.Disp.UpdateBotBarOther();
|
|
||||||
CM.Disp.UpdateBuildings();
|
|
||||||
CM.Disp.UpdateUpgrades();
|
|
||||||
|
|
||||||
CM.Sim.DoSims = 0;
|
CM.Sim.DoSims = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Buildings Color for different buy/sell modes
|
// Calculate ROI
|
||||||
var updateBuildings = false;
|
CM.Cache.RemakeROI();
|
||||||
if (CM.Disp.lastBuyMode != Game.buyMode) {
|
|
||||||
CM.Disp.lastBuyMode = Game.buyMode;
|
// Update colors
|
||||||
updateBuildings = true;
|
CM.Disp.UpdateBotBarOther();
|
||||||
}
|
|
||||||
if (CM.Disp.lastBuyBulk != Game.buyBulk) {
|
|
||||||
CM.Disp.lastBuyBulk = Game.buyBulk;
|
|
||||||
updateBuildings = true;
|
|
||||||
}
|
|
||||||
if (updateBuildings) {
|
|
||||||
CM.Disp.UpdateBuildings();
|
CM.Disp.UpdateBuildings();
|
||||||
}
|
CM.Disp.UpdateUpgrades();
|
||||||
|
|
||||||
// Redraw timers
|
// Redraw timers
|
||||||
CM.Disp.UpdateBotBarTime();
|
CM.Disp.UpdateBotBarTime();
|
||||||
|
|||||||
@@ -357,6 +357,9 @@ CM.Sim.BuyBuildings = function(amount, target) {
|
|||||||
|
|
||||||
CM.Cache[target][i] = {};
|
CM.Cache[target][i] = {};
|
||||||
CM.Cache[target][i].bonus = CM.Sim.cookiesPs - Game.cookiesPs;
|
CM.Cache[target][i].bonus = CM.Sim.cookiesPs - Game.cookiesPs;
|
||||||
|
if (amount != 1) {
|
||||||
|
CM.Cache[target][i].price = CM.Sim.BuildingGetPrice(Game.Objects[i].basePrice, Game.Objects[i].amount, Game.Objects[i].free, amount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user