Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public final class DynamicPricingManager {
private final boolean enabled;
private final double initMult, minMult, maxMult, buyStep, sellStep, perHourTowards1;
private final boolean decayEnabled;
private final double buyMultiplier, sellMultiplier;

public DynamicPricingManager(ServerShopPlugin plugin) {
this.plugin = plugin;
Expand All @@ -25,6 +26,8 @@ public DynamicPricingManager(ServerShopPlugin plugin) {
var dec = dp.getConfigurationSection("decay");
this.decayEnabled = dec.getBoolean("enabled", true);
this.perHourTowards1 = dec.getDouble("perHourTowards1", 0.02);
this.buyMultiplier = c.getDouble("buyMultiplier", 1.0);
this.sellMultiplier = c.getDouble("sellMultiplier", 0.8);

String mode = dp.getString("storage", "YAML").toUpperCase();
PriceStorage ps;
Expand Down Expand Up @@ -62,15 +65,15 @@ public synchronized double buyPrice(Material m, double base) {
double weeklyDiscount = plugin.weekly().isWeekly(m) ? plugin.getConfig().getDouble("weekly.discount", 0.80) : 1.0;
String cat = plugin.catalog().categoryOf(m);
double catMult = plugin.categorySettings().multiplier(cat);
double price = base * mult * weeklyDiscount * catMult;
double price = base * mult * weeklyDiscount * catMult * buyMultiplier;
return clampToBounds(price, base);
}

public synchronized double sellPrice(Material m, double base) {
double mult = currentMultiplier(m);
String cat = plugin.catalog().categoryOf(m);
double catMult = plugin.categorySettings().multiplier(cat);
double price = base * mult * catMult;
double price = base * mult * catMult * sellMultiplier;
return clampToBounds(price, base);
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ priceModel:
minFactor: 0.5
maxFactor: 1.5
sellStep: 0.01
buyMultiplier: 1.0 # Price multiplier when players buy from the shop
sellMultiplier: 0.8 # Price multiplier when players sell to the shop
logging:
storage: YAML # YAML or MYSQL
maxEntries: 1000
Expand Down
Loading