Stardew-Profits
Stardew-Profits copied to clipboard
Keg "sell excess" calculations does not account crop quality
There are cases where adding kegs as an option results in less profit than just selling the crops outright
This is because the keg calculations are not considering crop quality and are instead using the base price of the crop.
My suggestion is to replace
var cropPrice = 0;
if (options.sellExcess)
cropPrice = options.skills.till ? crop.produce.price * 1.1 : crop.produce.price;
netIncome += cropsLeft * cropPrice;
with
if (options.sellExcess) {
var rawIncome = 0
rawIncome += crop.produce.price * crops_left * ratioN;
rawIncome += Math.trunc(crop.produce.price * 1.25) * crops_left * ratioS;
rawIncome += Math.trunc(crop.produce.price * 1.5) * crops_left * ratioG;
rawIncome += crop.produce.price * 2 * crops_left * ratioI;
if (options.skills.till) {
rawIncome *= 1.1;
}
netIncome += rawIncome
}
Fyi this is a hacky solution. A DRYer one would be splitting out the crop selling logic so it can be reused.