Version 1.5.5:

* Fixed MaxDemand bug when you buy something around 1500+ times back-to-back
This commit is contained in:
PretzelJohn 2022-05-01 08:59:38 -04:00
parent 2d97903db6
commit d328a575aa

View File

@ -146,7 +146,8 @@ public class PlayerListener implements Listener {
private int getDemand(final RecipeWrapper recipe) {
int demand = recipe.getDemand();
int maxDemand = settings.fetchInt(recipe, "MaxDemand", -1);
if(maxDemand >= 0 && demand > maxDemand) {
if(maxDemand < 0) maxDemand = 1000000;
if(demand > maxDemand) {
recipe.setDemand(maxDemand);
return maxDemand;
}
@ -165,7 +166,6 @@ public class PlayerListener implements Listener {
int demand = getDemand(recipe);
float priceMultiplier = recipe.getPriceMultiplier();
int discount = -(int)(totalReputation * priceMultiplier) - (int)(hotvDiscount * basePrice) + Math.max(0, (int)(demand * priceMultiplier * basePrice));
//discount = -(265 * 0.05) - (0.3 * 1) + max(0, 94965314 * 0.05 * 1) = -13
double maxDiscount = settings.fetchDouble(recipe, "MaxDiscount", 0.3); //0.1
if(maxDiscount >= 0.0 && maxDiscount <= 1.0) {