-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add leagues notifier for areas, relics, and tasks (#366)
* feat: add leagues notifier for areas, relics, and tasks * chore(relic): update rich embed field name * feat: add tasksUntilNextArea to LeaguesTaskNotificationData * chore: add mock tests * chore: update changelog * chore(region): update rich embed field name * chore: update readme * chore(readme): clarify area index * chore(readme): markdown formatting * feat: add requiredPoints to relic metadata * chore(readme): add trophy unlock json example * chore: link task names to general league tasks wiki article * refactor: move some varbit ids to constant fields * chore: clarify leagues webhook override * chore: loosen default leaguesTaskMinTier * fix: handle unknown relic names more gracefully * fix: ensure computeEmbeds can read seasonal status * unrelated commit: add some tests for Utils.sanitize * docs: clarify more metadata field nullability * refactor: prefer nested if over assignment within conditional * chore: add another test case --------- Co-authored-by: Rasmus Karlsson <[email protected]>
- Loading branch information
Showing
15 changed files
with
1,064 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package dinkplugin.domain; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.Collections; | ||
import java.util.NavigableMap; | ||
import java.util.TreeMap; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum LeagueRelicTier { | ||
ONE(0), | ||
TWO(500), | ||
THREE(1_200), | ||
FOUR(2_000), | ||
FIVE(4_000), | ||
SIX(7_500), | ||
SEVEN(15_000), | ||
EIGHT(24_000); | ||
|
||
/** | ||
* Points required to unlock a relic of a given tier. | ||
* | ||
* @see <a href="https://oldschool.runescape.wiki/w/Trailblazer_Reloaded_League/Relics">Wiki Reference</a> | ||
*/ | ||
private final int points; | ||
|
||
public static final NavigableMap<Integer, LeagueRelicTier> TIER_BY_POINTS; | ||
|
||
static { | ||
NavigableMap<Integer, LeagueRelicTier> tiers = new TreeMap<>(); | ||
for (LeagueRelicTier tier : values()) { | ||
tiers.put(tier.getPoints(), tier); | ||
} | ||
TIER_BY_POINTS = Collections.unmodifiableNavigableMap(tiers); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package dinkplugin.domain; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
import java.util.function.Function; | ||
import java.util.stream.Collectors; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum LeagueTaskDifficulty { | ||
EASY(10), | ||
MEDIUM(40), | ||
HARD(80), | ||
ELITE(200), | ||
MASTER(400); | ||
|
||
/** | ||
* Points earned from completed a task of the given difficulty. | ||
* | ||
* @see <a href="https://oldschool.runescape.wiki/w/Trailblazer_Reloaded_League/Tasks">Wiki Reference</a> | ||
*/ | ||
private final int points; | ||
private final String displayName = this.name().charAt(0) + this.name().substring(1).toLowerCase(); | ||
|
||
@Override | ||
public String toString() { | ||
return this.displayName; | ||
} | ||
|
||
public static final Map<String, LeagueTaskDifficulty> TIER_BY_LOWER_NAME = Collections.unmodifiableMap( | ||
Arrays.stream(values()).collect(Collectors.toMap(t -> t.name().toLowerCase(), Function.identity())) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.