From 84be2eba795366b0a4a1a127104b80447f01e373 Mon Sep 17 00:00:00 2001 From: Zrips Date: Thu, 10 Mar 2022 17:14:11 +0200 Subject: [PATCH] Fixing Dynamic payments bonus not being calculated properly --- .../jobs/config/GeneralConfigManager.java | 13 ++++++++----- .../java/com/gamingmesh/jobs/container/Job.java | 8 ++++---- .../java/com/gamingmesh/jobs/container/Quest.java | 1 - 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index 33c09964..23f9b8fb 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -620,7 +620,10 @@ public class GeneralConfigManager { } DynamicPaymentMaxPenalty = c.get("Economy.DynamicPayment.MaxPenalty", 50.0); + DynamicPaymentMaxPenalty /= -100D; DynamicPaymentMaxBonus = c.get("Economy.DynamicPayment.MaxBonus", 300.0); + DynamicPaymentMaxBonus /= 100D; + c.addComment("Economy.MaxPayment.curve.use", "Enabling this feature will mean players will still earn once they reach cap but " + "will loose a percentage the higher over cap they go. Controlled by a factor. math is ```100/((1/factor*percentOver^2)+1)```"); useMaxPaymentCurve = c.get("Economy.MaxPayment.curve.use", false); @@ -893,8 +896,8 @@ public class GeneralConfigManager { c.addComment("BossBar.Timer", "How long in sec to show BossBar for player", "If you have disabled ShowOnEachAction, then keep this number higher than payment interval for better experience"); BossBarTimer = c.get("BossBar.Timer", economyBatchDelay + 1); - c.addComment("BossBar.Async", "If enabled, bossbar creation and management will be asynchronous.", "This avoids TPS drops when the ShowOnEachAction option is activated."); - bossBarAsync = c.get("BossBar.Async", false); + c.addComment("BossBar.Async", "If enabled, bossbar creation and management will be asynchronous.", "This avoids TPS drops when the ShowOnEachAction option is activated."); + bossBarAsync = c.get("BossBar.Async", false); } c.addComment("ShowActionBars", "You can enable/disable message shown for players in action bar"); @@ -1167,7 +1170,7 @@ public class GeneralConfigManager { return InformDuplicates; } - public boolean isBossBarAsync() { - return bossBarAsync; - } + public boolean isBossBarAsync() { + return bossBarAsync; + } } diff --git a/src/main/java/com/gamingmesh/jobs/container/Job.java b/src/main/java/com/gamingmesh/jobs/container/Job.java index dd8da589..1d153c66 100644 --- a/src/main/java/com/gamingmesh/jobs/container/Job.java +++ b/src/main/java/com/gamingmesh/jobs/container/Job.java @@ -43,6 +43,7 @@ import com.gamingmesh.jobs.actions.PotionItemActionInfo; import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Equations.Parser; import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Logs.CMIDebug; public class Job { @@ -228,11 +229,10 @@ public class Job { if (now > Jobs.getGCManager().DynamicPaymentMaxBonus) now = Jobs.getGCManager().DynamicPaymentMaxBonus; - double maxPenalty = Jobs.getGCManager().DynamicPaymentMaxPenalty * -1; - if (now < maxPenalty) - now = maxPenalty; + if (now < Jobs.getGCManager().DynamicPaymentMaxPenalty) + now = Jobs.getGCManager().DynamicPaymentMaxPenalty; - this.bonus = (now / 100D); + this.bonus = now; } public double getBonus() { diff --git a/src/main/java/com/gamingmesh/jobs/container/Quest.java b/src/main/java/com/gamingmesh/jobs/container/Quest.java index efda9b53..562aca53 100644 --- a/src/main/java/com/gamingmesh/jobs/container/Quest.java +++ b/src/main/java/com/gamingmesh/jobs/container/Quest.java @@ -200,7 +200,6 @@ public class Quest { Map old = objectives.get(objective.getAction()); if (old == null) { old = new HashMap<>(); - old.put(objective.getTargetName(), objective); objectives.put(objective.getAction(), old); } old.put(objective.getTargetName(), objective);