-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fire notification on xp milestones
- Loading branch information
Showing
5 changed files
with
161 additions
and
16 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
41 changes: 41 additions & 0 deletions
41
src/main/java/dinkplugin/notifiers/data/XpNotificationData.java
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,41 @@ | ||
package dinkplugin.notifiers.data; | ||
|
||
import dinkplugin.message.Field; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Value; | ||
import net.runelite.api.Experience; | ||
import net.runelite.api.Skill; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.SortedSet; | ||
import java.util.TreeSet; | ||
|
||
@Value | ||
@EqualsAndHashCode(callSuper = false) | ||
public class XpNotificationData extends NotificationData { | ||
Map<Skill, Integer> xpData; | ||
Collection<Skill> milestoneAchieved; | ||
int interval; | ||
transient String totalXp; | ||
|
||
@Override | ||
public List<Field> getFields() { | ||
List<Field> fields = new ArrayList<>(2); | ||
fields.add(new Field("Total XP", Field.formatBlock("", totalXp))); | ||
|
||
SortedSet<String> maxed = new TreeSet<>(); | ||
for (var entry : xpData.entrySet()) { | ||
if (entry.getValue() >= Experience.MAX_SKILL_XP) { | ||
maxed.add(entry.getKey().getName()); | ||
} | ||
} | ||
if (!maxed.isEmpty()) { | ||
fields.add(new Field("Maxed Skills", Field.formatBlock("", String.join(", ", maxed)))); | ||
} | ||
|
||
return fields; | ||
} | ||
} |
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