Allow ignoring 1, 2 or 3 best build with PP #155
This commit is contained in:
File diff suppressed because one or more lines are too long
24
src/Cache.js
24
src/Cache.js
@@ -681,6 +681,7 @@ CM.Cache.ColourOfPP = function(me, price) {
|
|||||||
CM.Cache.CacheBuildingsPP = function() {
|
CM.Cache.CacheBuildingsPP = function() {
|
||||||
CM.Cache.min = Infinity;
|
CM.Cache.min = Infinity;
|
||||||
CM.Cache.max = 1;
|
CM.Cache.max = 1;
|
||||||
|
CM.Cache.ArrayOfPPs = [];
|
||||||
|
|
||||||
// Calculate PP and colors when compared to purchase of optimal building in single-purchase mode
|
// Calculate PP and colors when compared to purchase of optimal building in single-purchase mode
|
||||||
if (CM.Options.ColorPPBulkMode === 0) {
|
if (CM.Options.ColorPPBulkMode === 0) {
|
||||||
@@ -688,12 +689,19 @@ CM.Cache.CacheBuildingsPP = function() {
|
|||||||
if (Game.cookiesPs) {
|
if (Game.cookiesPs) {
|
||||||
CM.Cache.Objects1[i].pp = (Math.max(Game.Objects[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus);
|
CM.Cache.Objects1[i].pp = (Math.max(Game.Objects[i].getPrice() - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus);
|
||||||
} else CM.Cache.Objects1[i].pp = (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus);
|
} else CM.Cache.Objects1[i].pp = (Game.Objects[i].getPrice() / CM.Cache.Objects1[i].bonus);
|
||||||
if (CM.Cache.Objects1[i].pp < CM.Cache.min) CM.Cache.min = CM.Cache.Objects1[i].pp;
|
CM.Cache.ArrayOfPPs.push(CM.Cache.Objects1[i].pp)
|
||||||
if (CM.Cache.Objects1[i].pp > CM.Cache.max) CM.Cache.max = CM.Cache.Objects1[i].pp;
|
|
||||||
}
|
}
|
||||||
|
// Set CM.Cache.min to best non-excluded buidliung
|
||||||
|
CM.Cache.ArrayOfPPs.sort((a, b) => a - b)
|
||||||
|
CM.Cache.min = CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop]
|
||||||
|
CM.Cache.max = CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length - 1];
|
||||||
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
|
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
|
||||||
for (let i of Object.keys(CM.Cache.Objects1)) {
|
for (let i of Object.keys(CM.Cache.Objects1)) {
|
||||||
CM.Cache.Objects1[i].color = CM.Cache.ColourOfPP(CM.Cache.Objects1[i], Game.Objects[i].getPrice());
|
CM.Cache.Objects1[i].color = CM.Cache.ColourOfPP(CM.Cache.Objects1[i], Game.Objects[i].getPrice());
|
||||||
|
// Colour based on excluding certain top-buildings
|
||||||
|
for (let j = 0; j < CM.Options.PPExcludeTop; j++) {
|
||||||
|
if (CM.Cache.Objects1[i].pp === CM.Cache.ArrayOfPPs[j]) CM.Cache.Objects1[i].color = CM.Disp.colorGray;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Calculate PP of bulk-buy modes
|
// Calculate PP of bulk-buy modes
|
||||||
CM.Cache.CacheBuildingsBulkPP('Objects10');
|
CM.Cache.CacheBuildingsBulkPP('Objects10');
|
||||||
@@ -706,12 +714,20 @@ CM.Cache.CacheBuildingsPP = function() {
|
|||||||
if (Game.cookiesPs) {
|
if (Game.cookiesPs) {
|
||||||
CM.Cache[target][i].pp = (Math.max(Game.Objects[i].bulkPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].bulkPrice / CM.Cache[target][i].bonus);
|
CM.Cache[target][i].pp = (Math.max(Game.Objects[i].bulkPrice - (Game.cookies + CM.Disp.GetWrinkConfigBank()), 0) / Game.cookiesPs) + (Game.Objects[i].bulkPrice / CM.Cache[target][i].bonus);
|
||||||
} else CM.Cache[target][i].pp = (Game.Objects[i].bulkPrice / CM.Cache[target][i].bonus);
|
} else CM.Cache[target][i].pp = (Game.Objects[i].bulkPrice / CM.Cache[target][i].bonus);
|
||||||
if (CM.Cache.min === -1 || CM.Cache[target][i].pp < CM.Cache.min) CM.Cache.min = CM.Cache[target][i].pp;
|
CM.Cache.ArrayOfPPs.push(CM.Cache[target][i].pp)
|
||||||
if (CM.Cache.max === -1 || CM.Cache[target][i].pp > CM.Cache.max) CM.Cache.max = CM.Cache[target][i].pp;
|
|
||||||
}
|
}
|
||||||
|
// Set CM.Cache.min to best non-excluded buidliung
|
||||||
|
CM.Cache.ArrayOfPPs.sort((a, b) => a - b)
|
||||||
|
CM.Cache.min = CM.Cache.ArrayOfPPs[CM.Options.PPExcludeTop]
|
||||||
|
CM.Cache.max = CM.Cache.ArrayOfPPs[CM.Cache.ArrayOfPPs.length - 1];
|
||||||
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
|
CM.Cache.mid = ((CM.Cache.max - CM.Cache.min) / 2) + CM.Cache.min;
|
||||||
|
|
||||||
for (let i of Object.keys(CM.Cache.Objects1)) {
|
for (let i of Object.keys(CM.Cache.Objects1)) {
|
||||||
CM.Cache[target][i].color = CM.Cache.ColourOfPP(CM.Cache[target][i], Game.Objects[i].bulkPrice);
|
CM.Cache[target][i].color = CM.Cache.ColourOfPP(CM.Cache[target][i], Game.Objects[i].bulkPrice);
|
||||||
|
// Colour based on excluding certain top-buildings
|
||||||
|
for (let j = 0; j < CM.Options.PPExcludeTop; j++) {
|
||||||
|
if (CM.Cache[target][i].pp === CM.Cache.ArrayOfPPs[j]) CM.Cache[target][i].color = CM.Disp.colorGray;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ CM.Data.Config.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calcula
|
|||||||
CM.Data.Config.CPSMode = {type: 'bool', group: 'Calculation', label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false};
|
CM.Data.Config.CPSMode = {type: 'bool', group: 'Calculation', label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false};
|
||||||
CM.Data.Config.AvgCPSHist = {type: 'bool', group: 'Calculation', label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false};
|
CM.Data.Config.AvgCPSHist = {type: 'bool', group: 'Calculation', label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false};
|
||||||
CM.Data.Config.AvgClicksHist = {type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false};
|
CM.Data.Config.AvgClicksHist = {type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false};
|
||||||
CM.Data.Config.ColorPPBulkMode = {type: 'bool', group: 'Calculation', label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false};
|
CM.Data.Config.ColorPPBulkMode = {type: 'bool', group: 'Calculation', label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false, func: function () {CM.Cache.CachePP();}};
|
||||||
CM.Data.Config.PPExcludeTop = {type: 'bool', group: 'Calculation', label: ["Don't Ignore Any", 'Ignore 1st Best', 'Ignore 1st and 2nd Best', 'Ignore 1st, 2nd and 3rd Best'], desc: 'Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values', toggle: true};
|
CM.Data.Config.PPExcludeTop = {type: 'bool', group: 'Calculation', label: ["Don't Ignore Any", 'Ignore 1st Best', 'Ignore 1st and 2nd Best', 'Ignore 1st, 2nd and 3rd Best'], desc: 'Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values', toggle: true};
|
||||||
CM.Data.Config.PPSecondsLowerLimit = {type: 'numscale', group: 'Calculation', label: 'Lower limit for PP (in seconds): ', desc: 'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option', min: 0, max: Infinity};
|
CM.Data.Config.PPSecondsLowerLimit = {type: 'numscale', group: 'Calculation', label: 'Lower limit for PP (in seconds): ', desc: 'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option', min: 0, max: Infinity};
|
||||||
CM.Data.Config.ToolWarnBon = {type: 'bool', group: 'Calculation', label: ['Calculate Tooltip Warning With Bonus CPS OFF', 'Calculate Tooltip Warning With Bonus CPS ON'], desc: 'Calculate the warning with or without the bonus CPS you get from buying', toggle: true};
|
CM.Data.Config.ToolWarnBon = {type: 'bool', group: 'Calculation', label: ['Calculate Tooltip Warning With Bonus CPS OFF', 'Calculate Tooltip Warning With Bonus CPS ON'], desc: 'Calculate the warning with or without the bonus CPS you get from buying', toggle: true};
|
||||||
|
|||||||
@@ -748,7 +748,7 @@ CM.Disp.UpdateBuildings = function() {
|
|||||||
return o;
|
return o;
|
||||||
});
|
});
|
||||||
|
|
||||||
arr.sort(function(a, b){ return (CM.Disp.colors.indexOf(a.color) > CM.Disp.colors.indexOf(b.color) ? 1 : (CM.Disp.colors.indexOf(a.color) < CM.Disp.colors.indexOf(b.color) ? -1 : 0)); });
|
arr.sort(function(a, b){ return (CM.Disp.colors.indexOf(a.color) > CM.Disp.colors.indexOf(b.color) ? 1 : (a.pp < b.pp) ? -1 : 0); });
|
||||||
|
|
||||||
for (let x = 0; x < arr.length; x++) {
|
for (let x = 0; x < arr.length; x++) {
|
||||||
Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2);
|
Game.Objects[arr[x].name].l.style.gridRow = (x + 2) + "/" + (x + 2);
|
||||||
@@ -2908,7 +2908,7 @@ CM.Disp.colorPurple = 'Purple';
|
|||||||
CM.Disp.colorGray = 'Gray';
|
CM.Disp.colorGray = 'Gray';
|
||||||
CM.Disp.colorPink = 'Pink';
|
CM.Disp.colorPink = 'Pink';
|
||||||
CM.Disp.colorBrown = 'Brown';
|
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.colorGray, CM.Disp.colorBlue, CM.Disp.colorGreen, CM.Disp.colorYellow, CM.Disp.colorOrange, CM.Disp.colorRed, CM.Disp.colorPurple, CM.Disp.colorPink, CM.Disp.colorBrown];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user