Rename Return On Investment to Payback Period to fit what the number represents better (Issue #68)

This commit is contained in:
Aktanusa
2016-03-27 17:57:50 -04:00
parent 57ab55a2c1
commit 5d0958b63a
6 changed files with 121 additions and 119 deletions

View File

@@ -51,72 +51,72 @@ CM.Cache.RemakeIncome = function() {
CM.Sim.BuyBuildings(100, 'Objects100'); CM.Sim.BuyBuildings(100, 'Objects100');
} }
CM.Cache.RemakeBuildingsROI = function() { CM.Cache.RemakeBuildingsPP = function() {
CM.Cache.min = -1; CM.Cache.min = -1;
CM.Cache.max = -1; CM.Cache.max = -1;
CM.Cache.mid = -1; CM.Cache.mid = -1;
for (var i in CM.Cache.Objects) { for (var i in CM.Cache.Objects) {
//CM.Cache.Objects[i].roi = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus; //CM.Cache.Objects[i].pp = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus;
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); CM.Cache.Objects[i].pp = (Math.max(Game.Objects[i].getPrice() - Game.cookies, 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus);
if (CM.Cache.min == -1 || CM.Cache.Objects[i].roi < CM.Cache.min) CM.Cache.min = CM.Cache.Objects[i].roi; if (CM.Cache.min == -1 || CM.Cache.Objects[i].pp < CM.Cache.min) CM.Cache.min = CM.Cache.Objects[i].pp;
if (CM.Cache.max == -1 || CM.Cache.Objects[i].roi > CM.Cache.max) CM.Cache.max = CM.Cache.Objects[i].roi; if (CM.Cache.max == -1 || CM.Cache.Objects[i].pp > CM.Cache.max) CM.Cache.max = CM.Cache.Objects[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 (var i in CM.Cache.Objects) { for (var i in CM.Cache.Objects) {
var color = ''; var color = '';
if (CM.Cache.Objects[i].roi == CM.Cache.min) color = CM.Disp.colorGreen; if (CM.Cache.Objects[i].pp == CM.Cache.min) color = CM.Disp.colorGreen;
else if (CM.Cache.Objects[i].roi == CM.Cache.max) color = CM.Disp.colorRed; else if (CM.Cache.Objects[i].pp == CM.Cache.max) color = CM.Disp.colorRed;
else if (CM.Cache.Objects[i].roi > CM.Cache.mid) color = CM.Disp.colorOrange; else if (CM.Cache.Objects[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.Objects[i].color = color;
} }
} }
CM.Cache.RemakeUpgradeROI = function() { CM.Cache.RemakeUpgradePP = function() {
for (var i in CM.Cache.Upgrades) { for (var i in CM.Cache.Upgrades) {
//CM.Cache.Upgrades[i].roi = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus; //CM.Cache.Upgrades[i].pp = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus;
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); CM.Cache.Upgrades[i].pp = (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'; if (isNaN(CM.Cache.Upgrades[i].pp)) CM.Cache.Upgrades[i].pp = 'Infinity';
var color = ''; var color = '';
if (CM.Cache.Upgrades[i].roi <= 0 || CM.Cache.Upgrades[i].roi == 'Infinity') color = CM.Disp.colorGray; if (CM.Cache.Upgrades[i].pp <= 0 || CM.Cache.Upgrades[i].pp == 'Infinity') color = CM.Disp.colorGray;
else if (CM.Cache.Upgrades[i].roi < CM.Cache.min) color = CM.Disp.colorBlue; else if (CM.Cache.Upgrades[i].pp < CM.Cache.min) color = CM.Disp.colorBlue;
else if (CM.Cache.Upgrades[i].roi == CM.Cache.min) color = CM.Disp.colorGreen; else if (CM.Cache.Upgrades[i].pp == CM.Cache.min) color = CM.Disp.colorGreen;
else if (CM.Cache.Upgrades[i].roi == CM.Cache.max) color = CM.Disp.colorRed; else if (CM.Cache.Upgrades[i].pp == CM.Cache.max) color = CM.Disp.colorRed;
else if (CM.Cache.Upgrades[i].roi > CM.Cache.max) color = CM.Disp.colorPurple; else if (CM.Cache.Upgrades[i].pp > CM.Cache.max) color = CM.Disp.colorPurple;
else if (CM.Cache.Upgrades[i].roi > CM.Cache.mid) color = CM.Disp.colorOrange; else if (CM.Cache.Upgrades[i].pp > 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.RemakeBuildingsOtherROI = function(amount, target) { CM.Cache.RemakeBuildingsOtherPP = function(amount, target) {
for (var i in CM.Cache[target]) { for (var i in CM.Cache[target]) {
//CM.Cache[target][i].roi = CM.Cache[target][i].price / CM.Cache[target][i].bonus; //CM.Cache[target][i].pp = CM.Cache[target][i].price / CM.Cache[target][i].bonus;
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); CM.Cache[target][i].pp = (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].roi <= 0 || CM.Cache[target][i].roi == 'Infinity') color = CM.Disp.colorGray; if (CM.Cache[target][i].pp <= 0 || CM.Cache[target][i].pp == 'Infinity') color = CM.Disp.colorGray;
else if (CM.Cache[target][i].roi < CM.Cache.min) color = CM.Disp.colorBlue; else if (CM.Cache[target][i].pp < CM.Cache.min) color = CM.Disp.colorBlue;
else if (CM.Cache[target][i].roi == CM.Cache.min) color = CM.Disp.colorGreen; else if (CM.Cache[target][i].pp == CM.Cache.min) color = CM.Disp.colorGreen;
else if (CM.Cache[target][i].roi == CM.Cache.max) color = CM.Disp.colorRed; else if (CM.Cache[target][i].pp == CM.Cache.max) color = CM.Disp.colorRed;
else if (CM.Cache[target][i].roi > CM.Cache.max) color = CM.Disp.colorPurple; else if (CM.Cache[target][i].pp > CM.Cache.max) color = CM.Disp.colorPurple;
else if (CM.Cache[target][i].roi > CM.Cache.mid) color = CM.Disp.colorOrange; else if (CM.Cache[target][i].pp > CM.Cache.mid) color = CM.Disp.colorOrange;
else color = CM.Disp.colorYellow; else color = CM.Disp.colorYellow;
CM.Cache[target][i].color = color; CM.Cache[target][i].color = color;
} }
} }
CM.Cache.RemakeROI = function() { CM.Cache.RemakePP = function() {
// Buildings for 1 amount // Buildings for 1 amount
CM.Cache.RemakeBuildingsROI(); CM.Cache.RemakeBuildingsPP();
// Upgrades // Upgrades
CM.Cache.RemakeUpgradeROI(); CM.Cache.RemakeUpgradePP();
// Buildings for 10 amount // Buildings for 10 amount
CM.Cache.RemakeBuildingsOtherROI(10, 'Objects10'); CM.Cache.RemakeBuildingsOtherPP(10, 'Objects10');
// Buildings for 100 amount // Buildings for 100 amount
CM.Cache.RemakeBuildingsOtherROI(100, 'Objects100'); CM.Cache.RemakeBuildingsOtherPP(100, 'Objects100');
} }
CM.Cache.RemakeLucky = function() { CM.Cache.RemakeLucky = function() {
@@ -362,7 +362,7 @@ CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar
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.BulkBuildColor = {label: ['Bulk Building Colors (Single Buildings Color)', 'Bulk Building Colors (Calculated Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.BulkBuildColor = {label: ['Bulk Building Colors (Single Buildings Color)', 'Bulk Building Colors (Calculated Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, 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 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.Colors = {desc: {Blue: 'Color Blue. Used to show better than best PP building, for Click Frenzy bar, and for various labels', Green: 'Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels', Yellow: 'Color Yellow. Used to show between best and worst PP buildings closer to best, for Frenzy bar, and for various labels', Orange: 'Color Orange. Used to show between best and worst PP buildings closer to worst, for Next Reindeer bar, and for various labels', Red: 'Color Red. Used to show worst PP building, for Clot bar, and for various labels', Purple: 'Color Purple. Used to show worse than worst PP building, for Next Cookie bar, and for various labels', Gray: 'Color Gray. Used to show negative or infinity PP, 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'};
@@ -543,9 +543,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 roi = document.createElement('tr'); var pp = document.createElement('tr');
roi.appendChild(firstCol('Return On Investment', CM.Disp.colorBlue)); pp.appendChild(firstCol('Payback Period', CM.Disp.colorBlue));
tbody.appendChild(roi); tbody.appendChild(pp);
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);
@@ -559,7 +559,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'));
roi.appendChild(document.createElement('td')); pp.appendChild(document.createElement('td'));
time.appendChild(document.createElement('td')); time.appendChild(document.createElement('td'));
} }
@@ -589,7 +589,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].roi, 2); CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].pp, 2);
} }
} }
} }
@@ -894,13 +894,13 @@ CM.Disp.CreateUpgradeBar = function() {
return div; return div;
} }
legend.appendChild(legendLine(CM.Disp.colorBlue, 'Better than best ROI building')); legend.appendChild(legendLine(CM.Disp.colorBlue, 'Better than best PP building'));
legend.appendChild(legendLine(CM.Disp.colorGreen, 'Same as best ROI building')); legend.appendChild(legendLine(CM.Disp.colorGreen, 'Same as best PP building'));
legend.appendChild(legendLine(CM.Disp.colorYellow, 'Between best and worst ROI buildings closer to best')); legend.appendChild(legendLine(CM.Disp.colorYellow, 'Between best and worst PP buildings closer to best'));
legend.appendChild(legendLine(CM.Disp.colorOrange, 'Between best and worst ROI buildings closer to worst')); legend.appendChild(legendLine(CM.Disp.colorOrange, 'Between best and worst PP buildings closer to worst'));
legend.appendChild(legendLine(CM.Disp.colorRed, 'Same as worst ROI building')); legend.appendChild(legendLine(CM.Disp.colorRed, 'Same as worst PP building'));
legend.appendChild(legendLine(CM.Disp.colorPurple, 'Worse than worst ROI building')); legend.appendChild(legendLine(CM.Disp.colorPurple, 'Worse than worst PP building'));
legend.appendChild(legendLine(CM.Disp.colorGray, 'Negative or infinity ROI')); legend.appendChild(legendLine(CM.Disp.colorGray, 'Negative or infinity PP'));
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');};
@@ -1902,11 +1902,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('Return On Investment')); tooltip.appendChild(header('Payback Period'));
var roi = document.createElement('div'); var pp = document.createElement('div');
roi.style.marginBottom = '4px'; pp.style.marginBottom = '4px';
roi.id = 'CMTooltipROI'; pp.id = 'CMTooltipPP';
tooltip.appendChild(roi); tooltip.appendChild(pp);
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';
@@ -1949,8 +1949,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('CMTooltipROI').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].roi, 2); l('CMTooltipPP').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].pp, 2);
l('CMTooltipROI').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color; l('CMTooltipPP').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color;
} }
} }
else { // Upgrades else { // Upgrades
@@ -1958,8 +1958,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('CMTooltipROI').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].roi, 2); l('CMTooltipPP').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].pp, 2);
l('CMTooltipROI').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color; l('CMTooltipPP').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)) {
@@ -2269,6 +2269,7 @@ CM.Loop = function() {
CM.Sim.DoSims = 0; CM.Sim.DoSims = 0;
} }
// Check for aura change to recalculate buildings prices
var hasFierHoard = Game.hasAura('Fierce Hoarder'); var hasFierHoard = Game.hasAura('Fierce Hoarder');
if (!CM.Cache.HadFierHoard && hasFierHoard) { if (!CM.Cache.HadFierHoard && hasFierHoard) {
CM.Cache.HadFierHoard = true; CM.Cache.HadFierHoard = true;
@@ -2284,8 +2285,8 @@ CM.Loop = function() {
CM.Cache.DoRemakeBuildPrices = 0; CM.Cache.DoRemakeBuildPrices = 0;
} }
// Calculate ROI // Calculate PP
CM.Cache.RemakeROI(); CM.Cache.RemakePP();
// Update colors // Update colors
CM.Disp.UpdateBotBarOther(); CM.Disp.UpdateBotBarOther();

View File

@@ -12,21 +12,21 @@ You can see the current version, and a full history of all versions and what the
At its core, Cookie Monster computes an index on both buildings and upgrades: At its core, Cookie Monster computes an index on both buildings and upgrades:
* **Return On Investment (ROI)**: Indicates how much a building is worth by using the formula max(cost - cookies in bank, 0)/cps + cost/Δ cps * **Payback Period (PP)**: Indicates how much a building is worth by using the formula max(cost - cookies in bank, 0)/cps + cost/Δ cps
Cookie Monster also indicates the time left before being able to buy an upgrade or building, and takes it into consideration. It will take *everything* in consideration, meaning if buying a building also unlocks an achievement which boosts your income, which unlocks an achievement, it will know and highlight that building's value. Cookie Monster also indicates the time left before being able to buy an upgrade or building, and takes it into consideration. It will take *everything* in consideration, meaning if buying a building also unlocks an achievement which boosts your income, which unlocks an achievement, it will know and highlight that building's value.
This index is computed for buildings and upgrades. If the relevant option is enabled, it will color-code each of them based on their value: This index is computed for buildings and upgrades. If the relevant option is enabled, it will color-code each of them based on their value:
* Light Blue: (upgrades) This item has a better ROI than any building * Light Blue: (upgrades) This item has a better PP than any building
* Green: This item has the best ROI * Green: This item has the best PP
* Yellow: This item is not the best, but it is closer to best than it is to worst * Yellow: This item is not the best, but it is closer to best than it is to worst
* Orange: This item is not the worst, but it is closer to worst than it is to best * Orange: This item is not the worst, but it is closer to worst than it is to best
* Red: This item has the worst ROI * Red: This item has the worst PP
* Purple: (upgrades) This item has a worse ROI than any building * Purple: (upgrades) This item has a worse PP than any building
* Gray: (upgrades) This item has not been calculated and/or cannot be calculated due to no definitive worth. * Gray: (upgrades) This item has not been calculated and/or cannot be calculated due to no definitive worth.
Note: For this index, **lower is better**, meaning a building with a ROI of 1 is more interesting than one with a ROI of 3. Note: For this index, **lower is better**, meaning a building with a PP of 1 is more interesting than one with a PP of 3.
## What it doesn't do ## What it doesn't do
@@ -134,5 +134,5 @@ All suggestions are welcome, even the smallest ones.
* **[Alderi Tokori](http://forum.dashnet.org/profile/Alderi)**: ROI calculations (unused now) * **[Alderi Tokori](http://forum.dashnet.org/profile/Alderi)**: 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
* **[Sandworm](https://github.com/svschouw)**: Modified ROI calculation * **[Sandworm](https://github.com/svschouw)**: Modified PP calculation
* **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer * **[Aktanusa](https://github.com/Aktanusa)**: Current maintainer

View File

@@ -31,72 +31,72 @@ CM.Cache.RemakeIncome = function() {
CM.Sim.BuyBuildings(100, 'Objects100'); CM.Sim.BuyBuildings(100, 'Objects100');
} }
CM.Cache.RemakeBuildingsROI = function() { CM.Cache.RemakeBuildingsPP = function() {
CM.Cache.min = -1; CM.Cache.min = -1;
CM.Cache.max = -1; CM.Cache.max = -1;
CM.Cache.mid = -1; CM.Cache.mid = -1;
for (var i in CM.Cache.Objects) { for (var i in CM.Cache.Objects) {
//CM.Cache.Objects[i].roi = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus; //CM.Cache.Objects[i].pp = Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus;
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); CM.Cache.Objects[i].pp = (Math.max(Game.Objects[i].getPrice() - Game.cookies, 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects[i].bonus);
if (CM.Cache.min == -1 || CM.Cache.Objects[i].roi < CM.Cache.min) CM.Cache.min = CM.Cache.Objects[i].roi; if (CM.Cache.min == -1 || CM.Cache.Objects[i].pp < CM.Cache.min) CM.Cache.min = CM.Cache.Objects[i].pp;
if (CM.Cache.max == -1 || CM.Cache.Objects[i].roi > CM.Cache.max) CM.Cache.max = CM.Cache.Objects[i].roi; if (CM.Cache.max == -1 || CM.Cache.Objects[i].pp > CM.Cache.max) CM.Cache.max = CM.Cache.Objects[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 (var i in CM.Cache.Objects) { for (var i in CM.Cache.Objects) {
var color = ''; var color = '';
if (CM.Cache.Objects[i].roi == CM.Cache.min) color = CM.Disp.colorGreen; if (CM.Cache.Objects[i].pp == CM.Cache.min) color = CM.Disp.colorGreen;
else if (CM.Cache.Objects[i].roi == CM.Cache.max) color = CM.Disp.colorRed; else if (CM.Cache.Objects[i].pp == CM.Cache.max) color = CM.Disp.colorRed;
else if (CM.Cache.Objects[i].roi > CM.Cache.mid) color = CM.Disp.colorOrange; else if (CM.Cache.Objects[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.Objects[i].color = color;
} }
} }
CM.Cache.RemakeUpgradeROI = function() { CM.Cache.RemakeUpgradePP = function() {
for (var i in CM.Cache.Upgrades) { for (var i in CM.Cache.Upgrades) {
//CM.Cache.Upgrades[i].roi = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus; //CM.Cache.Upgrades[i].pp = Game.Upgrades[i].getPrice() / CM.Cache.Upgrades[i].bonus;
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); CM.Cache.Upgrades[i].pp = (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'; if (isNaN(CM.Cache.Upgrades[i].pp)) CM.Cache.Upgrades[i].pp = 'Infinity';
var color = ''; var color = '';
if (CM.Cache.Upgrades[i].roi <= 0 || CM.Cache.Upgrades[i].roi == 'Infinity') color = CM.Disp.colorGray; if (CM.Cache.Upgrades[i].pp <= 0 || CM.Cache.Upgrades[i].pp == 'Infinity') color = CM.Disp.colorGray;
else if (CM.Cache.Upgrades[i].roi < CM.Cache.min) color = CM.Disp.colorBlue; else if (CM.Cache.Upgrades[i].pp < CM.Cache.min) color = CM.Disp.colorBlue;
else if (CM.Cache.Upgrades[i].roi == CM.Cache.min) color = CM.Disp.colorGreen; else if (CM.Cache.Upgrades[i].pp == CM.Cache.min) color = CM.Disp.colorGreen;
else if (CM.Cache.Upgrades[i].roi == CM.Cache.max) color = CM.Disp.colorRed; else if (CM.Cache.Upgrades[i].pp == CM.Cache.max) color = CM.Disp.colorRed;
else if (CM.Cache.Upgrades[i].roi > CM.Cache.max) color = CM.Disp.colorPurple; else if (CM.Cache.Upgrades[i].pp > CM.Cache.max) color = CM.Disp.colorPurple;
else if (CM.Cache.Upgrades[i].roi > CM.Cache.mid) color = CM.Disp.colorOrange; else if (CM.Cache.Upgrades[i].pp > 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.RemakeBuildingsOtherROI = function(amount, target) { CM.Cache.RemakeBuildingsOtherPP = function(amount, target) {
for (var i in CM.Cache[target]) { for (var i in CM.Cache[target]) {
//CM.Cache[target][i].roi = CM.Cache[target][i].price / CM.Cache[target][i].bonus; //CM.Cache[target][i].pp = CM.Cache[target][i].price / CM.Cache[target][i].bonus;
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); CM.Cache[target][i].pp = (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].roi <= 0 || CM.Cache[target][i].roi == 'Infinity') color = CM.Disp.colorGray; if (CM.Cache[target][i].pp <= 0 || CM.Cache[target][i].pp == 'Infinity') color = CM.Disp.colorGray;
else if (CM.Cache[target][i].roi < CM.Cache.min) color = CM.Disp.colorBlue; else if (CM.Cache[target][i].pp < CM.Cache.min) color = CM.Disp.colorBlue;
else if (CM.Cache[target][i].roi == CM.Cache.min) color = CM.Disp.colorGreen; else if (CM.Cache[target][i].pp == CM.Cache.min) color = CM.Disp.colorGreen;
else if (CM.Cache[target][i].roi == CM.Cache.max) color = CM.Disp.colorRed; else if (CM.Cache[target][i].pp == CM.Cache.max) color = CM.Disp.colorRed;
else if (CM.Cache[target][i].roi > CM.Cache.max) color = CM.Disp.colorPurple; else if (CM.Cache[target][i].pp > CM.Cache.max) color = CM.Disp.colorPurple;
else if (CM.Cache[target][i].roi > CM.Cache.mid) color = CM.Disp.colorOrange; else if (CM.Cache[target][i].pp > CM.Cache.mid) color = CM.Disp.colorOrange;
else color = CM.Disp.colorYellow; else color = CM.Disp.colorYellow;
CM.Cache[target][i].color = color; CM.Cache[target][i].color = color;
} }
} }
CM.Cache.RemakeROI = function() { CM.Cache.RemakePP = function() {
// Buildings for 1 amount // Buildings for 1 amount
CM.Cache.RemakeBuildingsROI(); CM.Cache.RemakeBuildingsPP();
// Upgrades // Upgrades
CM.Cache.RemakeUpgradeROI(); CM.Cache.RemakeUpgradePP();
// Buildings for 10 amount // Buildings for 10 amount
CM.Cache.RemakeBuildingsOtherROI(10, 'Objects10'); CM.Cache.RemakeBuildingsOtherPP(10, 'Objects10');
// Buildings for 100 amount // Buildings for 100 amount
CM.Cache.RemakeBuildingsOtherROI(100, 'Objects100'); CM.Cache.RemakeBuildingsOtherPP(100, 'Objects100');
} }
CM.Cache.RemakeLucky = function() { CM.Cache.RemakeLucky = function() {

View File

@@ -120,7 +120,7 @@ CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar
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.BulkBuildColor = {label: ['Bulk Building Colors (Single Buildings Color)', 'Bulk Building Colors (Calculated Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.BulkBuildColor = {label: ['Bulk Building Colors (Single Buildings Color)', 'Bulk Building Colors (Calculated Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, 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 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.Colors = {desc: {Blue: 'Color Blue. Used to show better than best PP building, for Click Frenzy bar, and for various labels', Green: 'Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels', Yellow: 'Color Yellow. Used to show between best and worst PP buildings closer to best, for Frenzy bar, and for various labels', Orange: 'Color Orange. Used to show between best and worst PP buildings closer to worst, for Next Reindeer bar, and for various labels', Red: 'Color Red. Used to show worst PP building, for Clot bar, and for various labels', Purple: 'Color Purple. Used to show worse than worst PP building, for Next Cookie bar, and for various labels', Gray: 'Color Gray. Used to show negative or infinity PP, 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'};

View File

@@ -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 roi = document.createElement('tr'); var pp = document.createElement('tr');
roi.appendChild(firstCol('Return On Investment', CM.Disp.colorBlue)); pp.appendChild(firstCol('Payback Period', CM.Disp.colorBlue));
tbody.appendChild(roi); tbody.appendChild(pp);
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'));
roi.appendChild(document.createElement('td')); pp.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].roi, 2); CM.Disp.BotBar.firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(CM.Cache.Objects[i].pp, 2);
} }
} }
} }
@@ -499,13 +499,13 @@ CM.Disp.CreateUpgradeBar = function() {
return div; return div;
} }
legend.appendChild(legendLine(CM.Disp.colorBlue, 'Better than best ROI building')); legend.appendChild(legendLine(CM.Disp.colorBlue, 'Better than best PP building'));
legend.appendChild(legendLine(CM.Disp.colorGreen, 'Same as best ROI building')); legend.appendChild(legendLine(CM.Disp.colorGreen, 'Same as best PP building'));
legend.appendChild(legendLine(CM.Disp.colorYellow, 'Between best and worst ROI buildings closer to best')); legend.appendChild(legendLine(CM.Disp.colorYellow, 'Between best and worst PP buildings closer to best'));
legend.appendChild(legendLine(CM.Disp.colorOrange, 'Between best and worst ROI buildings closer to worst')); legend.appendChild(legendLine(CM.Disp.colorOrange, 'Between best and worst PP buildings closer to worst'));
legend.appendChild(legendLine(CM.Disp.colorRed, 'Same as worst ROI building')); legend.appendChild(legendLine(CM.Disp.colorRed, 'Same as worst PP building'));
legend.appendChild(legendLine(CM.Disp.colorPurple, 'Worse than worst ROI building')); legend.appendChild(legendLine(CM.Disp.colorPurple, 'Worse than worst PP building'));
legend.appendChild(legendLine(CM.Disp.colorGray, 'Negative or infinity ROI')); legend.appendChild(legendLine(CM.Disp.colorGray, 'Negative or infinity PP'));
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');};
@@ -1507,11 +1507,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('Return On Investment')); tooltip.appendChild(header('Payback Period'));
var roi = document.createElement('div'); var pp = document.createElement('div');
roi.style.marginBottom = '4px'; pp.style.marginBottom = '4px';
roi.id = 'CMTooltipROI'; pp.id = 'CMTooltipPP';
tooltip.appendChild(roi); tooltip.appendChild(pp);
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';
@@ -1554,8 +1554,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('CMTooltipROI').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].roi, 2); l('CMTooltipPP').textContent = Beautify(CM.Cache[target][CM.Disp.tooltipName].pp, 2);
l('CMTooltipROI').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color; l('CMTooltipPP').className = CM.Disp.colorTextPre + CM.Cache[target][CM.Disp.tooltipName].color;
} }
} }
else { // Upgrades else { // Upgrades
@@ -1563,8 +1563,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('CMTooltipROI').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].roi, 2); l('CMTooltipPP').textContent = Beautify(CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].pp, 2);
l('CMTooltipROI').className = CM.Disp.colorTextPre + CM.Cache.Upgrades[Game.UpgradesInStore[CM.Disp.tooltipName].name].color; l('CMTooltipPP').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)) {

View File

@@ -106,6 +106,7 @@ CM.Loop = function() {
CM.Sim.DoSims = 0; CM.Sim.DoSims = 0;
} }
// Check for aura change to recalculate buildings prices
var hasFierHoard = Game.hasAura('Fierce Hoarder'); var hasFierHoard = Game.hasAura('Fierce Hoarder');
if (!CM.Cache.HadFierHoard && hasFierHoard) { if (!CM.Cache.HadFierHoard && hasFierHoard) {
CM.Cache.HadFierHoard = true; CM.Cache.HadFierHoard = true;
@@ -121,8 +122,8 @@ CM.Loop = function() {
CM.Cache.DoRemakeBuildPrices = 0; CM.Cache.DoRemakeBuildPrices = 0;
} }
// Calculate ROI // Calculate PP
CM.Cache.RemakeROI(); CM.Cache.RemakePP();
// Update colors // Update colors
CM.Disp.UpdateBotBarOther(); CM.Disp.UpdateBotBarOther();