Repository: pajlads/DinkPlugin
Pull request #369 (2023-11-18 19:55:35)

fix: report correct tasks until next area unlock
reported by @pajlada


iProdigy: Confirmed fixed

![image](https://github.com/pajlads/DinkPlugin/assets/8106344/54235586-fc25-4f49-a837-4337cf8a6830)

![image](https://github.com/pajlads/DinkPlugin/assets/8106344/b1ca96b1-31dc-43ae-8d5e-e5395f933bd9)

pajlada: ![image](https://github.com/pajlads/DinkPlugin/assets/962989/593e415b-ad9d-4678-b4f8-8a89dd6e1f83)


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a12988b..1183240 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,7 @@
 ## Unreleased
 
+- Fix: Report correct remaining tasks until next area unlock in Leagues notifications. (#369)
+
 ## 1.7.0
 
 - Major: Add leagues notifier for areas, relics, and tasks. (#366)
diff --git a/src/main/java/dinkplugin/notifiers/LeaguesNotifier.java b/src/main/java/dinkplugin/notifiers/LeaguesNotifier.java
index 375b204..81e3443 100644
--- a/src/main/java/dinkplugin/notifiers/LeaguesNotifier.java
+++ b/src/main/java/dinkplugin/notifiers/LeaguesNotifier.java
@@ -248,7 +248,7 @@ public class LeaguesNotifier extends BaseNotifier {
 
     static {
         AREA_BY_TASKS = Collections.unmodifiableNavigableMap(
-            new TreeMap<>(Map.of(0, 0, 60, 1, 200, 2, 400, 3))
+            new TreeMap<>(Map.of(0, 0, 60, 1, 140, 2, 300, 3))
         );
 
         NavigableMap<Integer, String> thresholds = new TreeMap<>();


Test patch:
diff --git a/src/test/java/dinkplugin/notifiers/LeaguesNotifierTest.java b/src/test/java/dinkplugin/notifiers/LeaguesNotifierTest.java
index af61408..4a8a88a 100644
--- a/src/test/java/dinkplugin/notifiers/LeaguesNotifierTest.java
+++ b/src/test/java/dinkplugin/notifiers/LeaguesNotifierTest.java
@@ -64,7 +64,7 @@ public class LeaguesNotifierTest extends MockedNotifierTest {
 
         // verify notification
         String area = "Kandarin";
-        int tasksUntilNextArea = 400 - tasksCompleted;
+        int tasksUntilNextArea = 300 - tasksCompleted;
         verify(messageHandler).createMessage(
             PRIMARY_WEBHOOK_URL,
             false,
@@ -162,7 +162,7 @@ public class LeaguesNotifierTest extends MockedNotifierTest {
         // verify notification
         String taskName = "The Frozen Door";
         LeagueTaskDifficulty difficulty = LeagueTaskDifficulty.HARD;
-        int tasksUntilNextArea = 200 - tasksCompleted;
+        int tasksUntilNextArea = 140 - tasksCompleted;
         int pointsUntilNextRelic = LeagueRelicTier.THREE.getPoints() - totalPoints;
         int pointsUntilNextTrophy = 2_500 - totalPoints;
         verify(messageHandler).createMessage(
@@ -197,7 +197,7 @@ public class LeaguesNotifierTest extends MockedNotifierTest {
         // verify notification
         String taskName = "The Frozen Door";
         LeagueTaskDifficulty difficulty = LeagueTaskDifficulty.HARD;
-        int tasksUntilNextArea = 200 - tasksCompleted;
+        int tasksUntilNextArea = 140 - tasksCompleted;
         int pointsUntilNextRelic = LeagueRelicTier.FIVE.getPoints() - totalPoints;
         int pointsUntilNextTrophy = 5_000 - totalPoints;
         String trophy = "Bronze";
@@ -235,7 +235,7 @@ public class LeaguesNotifierTest extends MockedNotifierTest {
         // verify notification
         String taskName = "Equip Amy's Saw";
         LeagueTaskDifficulty difficulty = LeagueTaskDifficulty.MEDIUM;
-        int tasksUntilNextArea = 400 - tasksCompleted;
+        int tasksUntilNextArea = 300 - tasksCompleted;
         int pointsUntilNextRelic = LeagueRelicTier.SIX.getPoints() - totalPoints;
         int pointsUntilNextTrophy = 10_000 - totalPoints;
         String trophy = "Iron";