diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java index c730917863..ac57522a5b 100644 --- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java +++ b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java @@ -26,89 +26,93 @@ package net.runelite.http.api.hiscore; import lombok.AllArgsConstructor; import lombok.Getter; +import static net.runelite.http.api.hiscore.HiscoreSkillType.SKILL; +import static net.runelite.http.api.hiscore.HiscoreSkillType.ACTIVITY; +import static net.runelite.http.api.hiscore.HiscoreSkillType.BOSS; @AllArgsConstructor @Getter public enum HiscoreSkill { - OVERALL("Overall"), - ATTACK("Attack"), - DEFENCE("Defence"), - STRENGTH("Strength"), - HITPOINTS("Hitpoints"), - RANGED("Ranged"), - PRAYER("Prayer"), - MAGIC("Magic"), - COOKING("Cooking"), - WOODCUTTING("Woodcutting"), - FLETCHING("Fletching"), - FISHING("Fishing"), - FIREMAKING("Firemaking"), - CRAFTING("Crafting"), - SMITHING("Smithing"), - MINING("Mining"), - HERBLORE("Herblore"), - AGILITY("Agility"), - THIEVING("Thieving"), - SLAYER("Slayer"), - FARMING("Farming"), - RUNECRAFT("Runecraft"), - HUNTER("Hunter"), - CONSTRUCTION("Construction"), - LEAGUE_POINTS("League Points"), - BOUNTY_HUNTER_HUNTER("Bounty Hunter - Hunter"), - BOUNTY_HUNTER_ROGUE("Bounty Hunter - Rogue"), - CLUE_SCROLL_ALL("Clue Scrolls (all)"), - CLUE_SCROLL_BEGINNER("Clue Scrolls (beginner)"), - CLUE_SCROLL_EASY("Clue Scrolls (easy)"), - CLUE_SCROLL_MEDIUM("Clue Scrolls (medium)"), - CLUE_SCROLL_HARD("Clue Scrolls (hard)"), - CLUE_SCROLL_ELITE("Clue Scrolls (elite)"), - CLUE_SCROLL_MASTER("Clue Scrolls (master)"), - LAST_MAN_STANDING("Last Man Standing"), - ABYSSAL_SIRE("Abyssal Sire"), - ALCHEMICAL_HYDRA("Alchemical Hydra"), - BARROWS_CHESTS("Barrows Chests"), - BRYOPHYTA("Bryophyta"), - CALLISTO("Callisto"), - CERBERUS("Cerberus"), - CHAMBERS_OF_XERIC("Chambers of Xeric"), - CHAMBERS_OF_XERIC_CHALLENGE_MODE("Chambers of Xeric: Challenge Mode"), - CHAOS_ELEMENTAL("Chaos Elemental"), - CHAOS_FANATIC("Chaos Fanatic"), - COMMANDER_ZILYANA("Commander Zilyana"), - CORPOREAL_BEAST("Corporeal Beast"), - CRAZY_ARCHAEOLOGIST("Crazy Archaeologist"), - DAGANNOTH_PRIME("Dagannoth Prime"), - DAGANNOTH_REX("Dagannoth Rex"), - DAGANNOTH_SUPREME("Dagannoth Supreme"), - DERANGED_ARCHAEOLOGIST("Deranged Archaeologist"), - GENERAL_GRAARDOR("General Graardor"), - GIANT_MOLE("Giant Mole"), - GROTESQUE_GUARDIANS("Grotesque Guardians"), - HESPORI("Hespori"), - KALPHITE_QUEEN("Kalphite Queen"), - KING_BLACK_DRAGON("King Black Dragon"), - KRAKEN("Kraken"), - KREEARRA("Kree'Arra"), - KRIL_TSUTSAROTH("K'ril Tsutsaroth"), - MIMIC("Mimic"), - OBOR("Obor"), - SARACHNIS("Sarachnis"), - SCORPIA("Scorpia"), - SKOTIZO("Skotizo"), - THE_GAUNTLET("The Gauntlet"), - THE_CORRUPTED_GAUNTLET("The Corrupted Gauntlet"), - THEATRE_OF_BLOOD("Theatre of Blood"), - THERMONUCLEAR_SMOKE_DEVIL("Thermonuclear Smoke Devil"), - TZKAL_ZUK("TzKal-Zuk"), - TZTOK_JAD("TzTok-Jad"), - VENENATIS("Venenatis"), - VETION("Vet'ion"), - VORKATH("Vorkath"), - WINTERTODT("Wintertodt"), - ZALCANO("Zalcano"), - ZULRAH("Zulrah"); + OVERALL("Overall", HiscoreSkillType.OVERALL), + ATTACK("Attack", SKILL), + DEFENCE("Defence", SKILL), + STRENGTH("Strength", SKILL), + HITPOINTS("Hitpoints", SKILL), + RANGED("Ranged", SKILL), + PRAYER("Prayer", SKILL), + MAGIC("Magic", SKILL), + COOKING("Cooking", SKILL), + WOODCUTTING("Woodcutting", SKILL), + FLETCHING("Fletching", SKILL), + FISHING("Fishing", SKILL), + FIREMAKING("Firemaking", SKILL), + CRAFTING("Crafting", SKILL), + SMITHING("Smithing", SKILL), + MINING("Mining", SKILL), + HERBLORE("Herblore", SKILL), + AGILITY("Agility", SKILL), + THIEVING("Thieving", SKILL), + SLAYER("Slayer", SKILL), + FARMING("Farming", SKILL), + RUNECRAFT("Runecraft", SKILL), + HUNTER("Hunter", SKILL), + CONSTRUCTION("Construction", SKILL), + LEAGUE_POINTS("League Points", ACTIVITY), + BOUNTY_HUNTER_HUNTER("Bounty Hunter - Hunter", ACTIVITY), + BOUNTY_HUNTER_ROGUE("Bounty Hunter - Rogue", ACTIVITY), + CLUE_SCROLL_ALL("Clue Scrolls (all)", ACTIVITY), + CLUE_SCROLL_BEGINNER("Clue Scrolls (beginner)", ACTIVITY), + CLUE_SCROLL_EASY("Clue Scrolls (easy)", ACTIVITY), + CLUE_SCROLL_MEDIUM("Clue Scrolls (medium)", ACTIVITY), + CLUE_SCROLL_HARD("Clue Scrolls (hard)", ACTIVITY), + CLUE_SCROLL_ELITE("Clue Scrolls (elite)", ACTIVITY), + CLUE_SCROLL_MASTER("Clue Scrolls (master)", ACTIVITY), + LAST_MAN_STANDING("Last Man Standing", ACTIVITY), + ABYSSAL_SIRE("Abyssal Sire", BOSS), + ALCHEMICAL_HYDRA("Alchemical Hydra", BOSS), + BARROWS_CHESTS("Barrows Chests", BOSS), + BRYOPHYTA("Bryophyta", BOSS), + CALLISTO("Callisto", BOSS), + CERBERUS("Cerberus", BOSS), + CHAMBERS_OF_XERIC("Chambers of Xeric", BOSS), + CHAMBERS_OF_XERIC_CHALLENGE_MODE("Chambers of Xeric: Challenge Mode", BOSS), + CHAOS_ELEMENTAL("Chaos Elemental", BOSS), + CHAOS_FANATIC("Chaos Fanatic", BOSS), + COMMANDER_ZILYANA("Commander Zilyana", BOSS), + CORPOREAL_BEAST("Corporeal Beast", BOSS), + CRAZY_ARCHAEOLOGIST("Crazy Archaeologist", BOSS), + DAGANNOTH_PRIME("Dagannoth Prime", BOSS), + DAGANNOTH_REX("Dagannoth Rex", BOSS), + DAGANNOTH_SUPREME("Dagannoth Supreme", BOSS), + DERANGED_ARCHAEOLOGIST("Deranged Archaeologist", BOSS), + GENERAL_GRAARDOR("General Graardor", BOSS), + GIANT_MOLE("Giant Mole", BOSS), + GROTESQUE_GUARDIANS("Grotesque Guardians", BOSS), + HESPORI("Hespori", BOSS), + KALPHITE_QUEEN("Kalphite Queen", BOSS), + KING_BLACK_DRAGON("King Black Dragon", BOSS), + KRAKEN("Kraken", BOSS), + KREEARRA("Kree'Arra", BOSS), + KRIL_TSUTSAROTH("K'ril Tsutsaroth", BOSS), + MIMIC("Mimic", BOSS), + OBOR("Obor", BOSS), + SARACHNIS("Sarachnis", BOSS), + SCORPIA("Scorpia", BOSS), + SKOTIZO("Skotizo", BOSS), + THE_GAUNTLET("The Gauntlet", BOSS), + THE_CORRUPTED_GAUNTLET("The Corrupted Gauntlet", BOSS), + THEATRE_OF_BLOOD("Theatre of Blood", BOSS), + THERMONUCLEAR_SMOKE_DEVIL("Thermonuclear Smoke Devil", BOSS), + TZKAL_ZUK("TzKal-Zuk", BOSS), + TZTOK_JAD("TzTok-Jad", BOSS), + VENENATIS("Venenatis", BOSS), + VETION("Vet'ion", BOSS), + VORKATH("Vorkath", BOSS), + WINTERTODT("Wintertodt", BOSS), + ZALCANO("Zalcano", BOSS), + ZULRAH("Zulrah", BOSS); private final String name; + private final HiscoreSkillType type; } diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkillType.java b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkillType.java new file mode 100644 index 0000000000..67e695364b --- /dev/null +++ b/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkillType.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2019, Bram91 + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.http.api.hiscore; + +public enum HiscoreSkillType +{ + OVERALL, + SKILL, + ACTIVITY, + BOSS +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java index 2a11a59d2c..23ff6521d2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java @@ -1,6 +1,7 @@ /* * Copyright (c) 2017, Adam * Copyright (c) 2018, Psikoi + * Copyright (c) 2019, Bram91 * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,6 +26,7 @@ */ package net.runelite.client.plugins.hiscore; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import java.awt.Dimension; @@ -37,9 +39,10 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.IOException; -import java.util.ArrayList; import java.util.EnumSet; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.ScheduledExecutorService; import javax.annotation.Nullable; import javax.inject.Inject; @@ -64,36 +67,10 @@ import net.runelite.http.api.hiscore.HiscoreClient; import net.runelite.http.api.hiscore.HiscoreEndpoint; import net.runelite.http.api.hiscore.HiscoreResult; import net.runelite.http.api.hiscore.HiscoreSkill; -import static net.runelite.http.api.hiscore.HiscoreSkill.AGILITY; -import static net.runelite.http.api.hiscore.HiscoreSkill.ATTACK; -import static net.runelite.http.api.hiscore.HiscoreSkill.BOUNTY_HUNTER_HUNTER; -import static net.runelite.http.api.hiscore.HiscoreSkill.BOUNTY_HUNTER_ROGUE; -import static net.runelite.http.api.hiscore.HiscoreSkill.CLUE_SCROLL_ALL; -import static net.runelite.http.api.hiscore.HiscoreSkill.CONSTRUCTION; -import static net.runelite.http.api.hiscore.HiscoreSkill.COOKING; -import static net.runelite.http.api.hiscore.HiscoreSkill.CRAFTING; -import static net.runelite.http.api.hiscore.HiscoreSkill.DEFENCE; -import static net.runelite.http.api.hiscore.HiscoreSkill.FARMING; -import static net.runelite.http.api.hiscore.HiscoreSkill.FIREMAKING; -import static net.runelite.http.api.hiscore.HiscoreSkill.FISHING; -import static net.runelite.http.api.hiscore.HiscoreSkill.FLETCHING; -import static net.runelite.http.api.hiscore.HiscoreSkill.HERBLORE; -import static net.runelite.http.api.hiscore.HiscoreSkill.HITPOINTS; -import static net.runelite.http.api.hiscore.HiscoreSkill.HUNTER; -import static net.runelite.http.api.hiscore.HiscoreSkill.LAST_MAN_STANDING; -import static net.runelite.http.api.hiscore.HiscoreSkill.LEAGUE_POINTS; -import static net.runelite.http.api.hiscore.HiscoreSkill.MAGIC; -import static net.runelite.http.api.hiscore.HiscoreSkill.MINING; -import static net.runelite.http.api.hiscore.HiscoreSkill.OVERALL; -import static net.runelite.http.api.hiscore.HiscoreSkill.PRAYER; -import static net.runelite.http.api.hiscore.HiscoreSkill.RANGED; -import static net.runelite.http.api.hiscore.HiscoreSkill.RUNECRAFT; -import static net.runelite.http.api.hiscore.HiscoreSkill.SLAYER; -import static net.runelite.http.api.hiscore.HiscoreSkill.SMITHING; -import static net.runelite.http.api.hiscore.HiscoreSkill.STRENGTH; -import static net.runelite.http.api.hiscore.HiscoreSkill.THIEVING; -import static net.runelite.http.api.hiscore.HiscoreSkill.WOODCUTTING; +import static net.runelite.http.api.hiscore.HiscoreSkill.*; +import net.runelite.http.api.hiscore.HiscoreSkillType; import net.runelite.http.api.hiscore.Skill; +import org.apache.commons.lang3.StringUtils; @Slf4j public class HiscorePanel extends PluginPanel @@ -115,6 +92,27 @@ public class HiscorePanel extends PluginPanel CONSTRUCTION, HUNTER ); + /** + * Bosses, ordered in the way they should be displayed in the panel. + */ + private static final List BOSSES = ImmutableList.of( + ABYSSAL_SIRE, ALCHEMICAL_HYDRA, BARROWS_CHESTS, + BRYOPHYTA, CALLISTO, CERBERUS, + CHAMBERS_OF_XERIC, CHAMBERS_OF_XERIC_CHALLENGE_MODE, CHAOS_ELEMENTAL, + CHAOS_FANATIC, COMMANDER_ZILYANA, CORPOREAL_BEAST, + DAGANNOTH_PRIME, DAGANNOTH_REX, DAGANNOTH_SUPREME, + CRAZY_ARCHAEOLOGIST, DERANGED_ARCHAEOLOGIST, GENERAL_GRAARDOR, + GIANT_MOLE, GROTESQUE_GUARDIANS, HESPORI, + KALPHITE_QUEEN, KING_BLACK_DRAGON, KRAKEN, + KREEARRA, KRIL_TSUTSAROTH, MIMIC, + OBOR, SARACHNIS, SCORPIA, + SKOTIZO, THE_GAUNTLET, THE_CORRUPTED_GAUNTLET, + THEATRE_OF_BLOOD, THERMONUCLEAR_SMOKE_DEVIL, TZKAL_ZUK, + TZTOK_JAD, VENENATIS, VETION, + VORKATH, WINTERTODT, ZALCANO, + ZULRAH + ); + @Inject ScheduledExecutorService executor; @@ -126,9 +124,8 @@ public class HiscorePanel extends PluginPanel private final IconTextField searchBar; - private final List skillLabels = new ArrayList<>(); - - private final JPanel statsPanel = new JPanel(); + // Not an enummap because we need null keys for combat + private final Map skillLabels = new HashMap<>(); /* Container of all the selectable endpoints (ironman, deadman, etc) */ private final MaterialTabGroup tabGroup; @@ -245,15 +242,15 @@ public class HiscorePanel extends PluginPanel c.gridy++; // Panel that holds skill icons - GridLayout stats = new GridLayout(8, 3); - statsPanel.setLayout(stats); + JPanel statsPanel = new JPanel(); + statsPanel.setLayout(new GridLayout(8, 3)); statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); statsPanel.setBorder(new EmptyBorder(5, 0, 5, 0)); // For each skill on the ingame skill panel, create a Label and add it to the UI for (HiscoreSkill skill : SKILLS) { - JPanel panel = makeSkillPanel(skill); + JPanel panel = makeHiscorePanel(skill); statsPanel.add(panel); } @@ -261,11 +258,11 @@ public class HiscorePanel extends PluginPanel c.gridy++; JPanel totalPanel = new JPanel(); - totalPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); totalPanel.setLayout(new GridLayout(1, 2)); + totalPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - totalPanel.add(makeSkillPanel(null)); //combat has no hiscore skill, refered to as null - totalPanel.add(makeSkillPanel(OVERALL)); + totalPanel.add(makeHiscorePanel(null)); //combat has no hiscore skill, referred to as null + totalPanel.add(makeHiscorePanel(OVERALL)); add(totalPanel, c); c.gridy++; @@ -276,14 +273,28 @@ public class HiscorePanel extends PluginPanel minigamePanel.setLayout(new GridLayout(2, 3)); minigamePanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - minigamePanel.add(makeSkillPanel(CLUE_SCROLL_ALL)); - minigamePanel.add(makeSkillPanel(LEAGUE_POINTS)); - minigamePanel.add(makeSkillPanel(LAST_MAN_STANDING)); - minigamePanel.add(makeSkillPanel(BOUNTY_HUNTER_ROGUE)); - minigamePanel.add(makeSkillPanel(BOUNTY_HUNTER_HUNTER)); + minigamePanel.add(makeHiscorePanel(CLUE_SCROLL_ALL)); + minigamePanel.add(makeHiscorePanel(LEAGUE_POINTS)); + minigamePanel.add(makeHiscorePanel(LAST_MAN_STANDING)); + minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_ROGUE)); + minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_HUNTER)); add(minigamePanel, c); c.gridy++; + + JPanel bossPanel = new JPanel(); + bossPanel.setLayout(new GridLayout(0, 3)); + bossPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); + + // For each boss on the hi-scores, create a Label and add it to the UI + for (HiscoreSkill skill : BOSSES) + { + JPanel panel = makeHiscorePanel(skill); + bossPanel.add(panel); + } + + add(bossPanel, c); + c.gridy++; } @Override @@ -294,24 +305,29 @@ public class HiscorePanel extends PluginPanel } /* Builds a JPanel displaying an icon and level/number associated with it */ - private JPanel makeSkillPanel(HiscoreSkill skill) + private JPanel makeHiscorePanel(HiscoreSkill skill) { + HiscoreSkillType skillType = skill == null ? HiscoreSkillType.SKILL : skill.getType(); + JLabel label = new JLabel(); label.setFont(FontManager.getRunescapeSmallFont()); - label.setText("--"); + label.setText(pad("--", skillType)); - String skillName = (skill == null ? "combat" : skill.getName().toLowerCase()); - String directory = "/skill_icons"; - if (skillName.equals("combat") || skillName.equals("overall")) + String directory; + if (skill == null || skill == OVERALL) { - // Cannot use SpriteManager as HiscorePlugin loads before a Client is available - directory += "/"; + directory = "/skill_icons/"; + } + else if (skill.getType() == HiscoreSkillType.BOSS) + { + directory = "bosses/"; } else { - directory += "_small/"; + directory = "/skill_icons_small/"; } + String skillName = (skill == null ? "combat" : skill.name().toLowerCase()); String skillIcon = directory + skillName + ".png"; log.debug("Loading skill icon from {}", skillIcon); @@ -323,8 +339,8 @@ public class HiscorePanel extends PluginPanel JPanel skillPanel = new JPanel(); skillPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); skillPanel.setBorder(new EmptyBorder(2, 0, 2, 0)); - skillLabels.add(label); - skillPanel.add(skillLabels.get(skillLabels.size() - 1)); + skillLabels.put(skill, label); + skillPanel.add(label); return skillPanel; } @@ -359,9 +375,13 @@ public class HiscorePanel extends PluginPanel searchBar.setIcon(IconTextField.Icon.LOADING_DARKER); loading = true; - for (JLabel label : skillLabels) + for (Map.Entry entry : skillLabels.entrySet()) { - label.setText("--"); + HiscoreSkill skill = entry.getKey(); + JLabel label = entry.getValue(); + HiscoreSkillType skillType = skill == null ? HiscoreSkillType.SKILL : skill.getType(); + + label.setText(pad("--", skillType)); label.setToolTipText(null); } @@ -398,10 +418,10 @@ public class HiscorePanel extends PluginPanel searchBar.setEditable(true); loading = false; - int index = 0; - for (JLabel label : skillLabels) + for (Map.Entry entry : skillLabels.entrySet()) { - HiscoreSkill skill = find(index); + HiscoreSkill skill = entry.getKey(); + JLabel label = entry.getValue(); Skill s; if (skill == null) @@ -423,7 +443,7 @@ public class HiscorePanel extends PluginPanel else if ((s = result.getSkill(skill)) != null) { final long exp = s.getExperience(); - final boolean isSkill = SKILLS.contains(skill); + final boolean isSkill = skill.getType() == HiscoreSkillType.SKILL; int level = -1; if (config.virtualLevels() && isSkill && exp > -1L) { @@ -438,12 +458,11 @@ public class HiscorePanel extends PluginPanel if (level != -1) { - label.setText(Integer.toString(level)); + label.setText(pad(formatLevel(level), skill.getType())); } } label.setToolTipText(detailsHtml(result, skill)); - index++; } } @@ -457,37 +476,6 @@ public class HiscorePanel extends PluginPanel this.searchBar.removeKeyListener(l); } - /* - Returns a hiscore skill based on it's display order. - */ - private HiscoreSkill find(int index) - { - if (index < SKILLS.size()) - { - return SKILLS.get(index); - } - - switch (index - SKILLS.size()) - { - case 0: - return null; - case 1: - return OVERALL; - case 2: - return CLUE_SCROLL_ALL; - case 3: - return LEAGUE_POINTS; - case 4: - return LAST_MAN_STANDING; - case 5: - return BOUNTY_HUNTER_ROGUE; - case 6: - return BOUNTY_HUNTER_HUNTER; - } - - return null; - } - /* Builds a html string to display on tooltip (when hovering a skill). */ @@ -584,36 +572,50 @@ public class HiscorePanel extends PluginPanel } default: { - Skill requestedSkill = result.getSkill(skill); - final long experience = requestedSkill.getExperience(); - - String rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank()); - String exp = (experience == -1L) ? "Unranked" : QuantityFormatter.formatNumber(experience); - String remainingXp; - if (experience == -1L) + if (skill.getType() == HiscoreSkillType.BOSS) { - remainingXp = "Unranked"; + Skill requestedSkill = result.getSkill(skill); + String rank = "Unranked"; + String lvl = "0"; + if (requestedSkill != null) + { + rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank()); + lvl = (requestedSkill.getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(requestedSkill.getLevel())); + } + content += "

Boss: " + skill.getName() + "

"; + content += "

Rank: " + rank + "

"; + content += "

KC: " + lvl + "

"; } else { - int currentLevel = Experience.getLevelForXp((int) experience); - remainingXp = (currentLevel + 1 <= Experience.MAX_VIRT_LEVEL) ? QuantityFormatter.formatNumber(Experience.getXpForLevel(currentLevel + 1) - experience) : "0"; + Skill requestedSkill = result.getSkill(skill); + final long experience = requestedSkill.getExperience(); + + String rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank()); + String exp = (experience == -1L) ? "Unranked" : QuantityFormatter.formatNumber(experience); + String remainingXp; + if (experience == -1L) + { + remainingXp = "Unranked"; + } + else + { + int currentLevel = Experience.getLevelForXp((int) experience); + remainingXp = (currentLevel + 1 <= Experience.MAX_VIRT_LEVEL) ? QuantityFormatter.formatNumber(Experience.getXpForLevel(currentLevel + 1) - experience) : "0"; + } + + content += "

Skill: " + skill.getName() + "

"; + content += "

Rank: " + rank + "

"; + content += "

Experience: " + exp + "

"; + content += "

Remaining XP: " + remainingXp + "

"; } - - content += "

Skill: " + skill.getName() + "

"; - content += "

Rank: " + rank + "

"; - content += "

Experience: " + exp + "

"; - content += "

Remaining XP: " + remainingXp + "

"; - break; } } } - /** - * Adds a html progress bar to the hover information - */ - if (SKILLS.contains(skill)) + // Add a html progress bar to the hover information + if (skill != null && skill.getType() == HiscoreSkillType.SKILL) { long experience = result.getSkill(skill).getExperience(); if (experience >= 0) @@ -668,4 +670,24 @@ public class HiscorePanel extends PluginPanel } return HiscoreEndpoint.NORMAL; } + + @VisibleForTesting + static String formatLevel(int level) + { + if (level < 10000) + { + return Integer.toString(level); + } + else + { + return (level / 1000) + "k"; + } + } + + private static String pad(String str, HiscoreSkillType type) + { + // Left pad label text to keep labels aligned + int pad = type == HiscoreSkillType.BOSS ? 4 : 2; + return StringUtils.leftPad(str, pad); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java b/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java index afe7054d43..2d4246a041 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java @@ -380,9 +380,13 @@ public class ImageUtil return ImageIO.read(c.getResourceAsStream(path)); } } + catch (IllegalArgumentException e) + { + throw new IllegalArgumentException(path, e); + } catch (IOException e) { - throw new RuntimeException(e); + throw new RuntimeException(path, e); } } diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/abyssal_sire.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/abyssal_sire.png new file mode 100644 index 0000000000..3e41077561 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/abyssal_sire.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/alchemical_hydra.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/alchemical_hydra.png new file mode 100644 index 0000000000..3032e57ec4 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/alchemical_hydra.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/barrows_chests.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/barrows_chests.png new file mode 100644 index 0000000000..ba5c55efae Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/barrows_chests.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/bryophyta.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/bryophyta.png new file mode 100644 index 0000000000..8cebd91ecf Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/bryophyta.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/callisto.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/callisto.png new file mode 100644 index 0000000000..6f307a26d5 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/callisto.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/cerberus.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/cerberus.png new file mode 100644 index 0000000000..4f7ef937cd Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/cerberus.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric.png new file mode 100644 index 0000000000..a7240d11f0 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric_challenge_mode.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric_challenge_mode.png new file mode 100644 index 0000000000..c298966a16 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric_challenge_mode.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_elemental.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_elemental.png new file mode 100644 index 0000000000..cc36114993 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_elemental.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_fanatic.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_fanatic.png new file mode 100644 index 0000000000..73e680aef6 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_fanatic.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/commander_zilyana.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/commander_zilyana.png new file mode 100644 index 0000000000..e207d7e791 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/commander_zilyana.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/corporeal_beast.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/corporeal_beast.png new file mode 100644 index 0000000000..cd113c8ad9 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/corporeal_beast.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/crazy_archaeologist.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/crazy_archaeologist.png new file mode 100644 index 0000000000..53d758bf8e Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/crazy_archaeologist.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_prime.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_prime.png new file mode 100644 index 0000000000..6b5543b5e1 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_prime.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_rex.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_rex.png new file mode 100644 index 0000000000..fc2bcbc3a0 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_rex.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_supreme.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_supreme.png new file mode 100644 index 0000000000..044291cc4a Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_supreme.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/deranged_archaeologist.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/deranged_archaeologist.png new file mode 100644 index 0000000000..8dfae8c2fb Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/deranged_archaeologist.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/general_graardor.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/general_graardor.png new file mode 100644 index 0000000000..1d8e4334fa Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/general_graardor.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/giant_mole.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/giant_mole.png new file mode 100644 index 0000000000..f814bbd2d5 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/giant_mole.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/grotesque_guardians.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/grotesque_guardians.png new file mode 100644 index 0000000000..98606aed11 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/grotesque_guardians.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/hespori.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/hespori.png new file mode 100644 index 0000000000..dffc71404c Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/hespori.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kalphite_queen.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kalphite_queen.png new file mode 100644 index 0000000000..a6b77f9426 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kalphite_queen.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/king_black_dragon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/king_black_dragon.png new file mode 100644 index 0000000000..3bc8a77466 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/king_black_dragon.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kraken.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kraken.png new file mode 100644 index 0000000000..c42e5d3fc9 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kraken.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kreearra.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kreearra.png new file mode 100644 index 0000000000..74b9eae788 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kreearra.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kril_tsutsaroth.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kril_tsutsaroth.png new file mode 100644 index 0000000000..dfe129ae77 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kril_tsutsaroth.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/mimic.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/mimic.png new file mode 100644 index 0000000000..3d2c0a4606 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/mimic.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/obor.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/obor.png new file mode 100644 index 0000000000..8c9ea13036 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/obor.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/sarachnis.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/sarachnis.png new file mode 100644 index 0000000000..e74c398976 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/sarachnis.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/scorpia.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/scorpia.png new file mode 100644 index 0000000000..eeb6310454 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/scorpia.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/skotizo.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/skotizo.png new file mode 100644 index 0000000000..cd96bbcca0 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/skotizo.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_corrupted_gauntlet.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_corrupted_gauntlet.png new file mode 100644 index 0000000000..9553dde2c1 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_corrupted_gauntlet.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_gauntlet.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_gauntlet.png new file mode 100644 index 0000000000..e34fbe3d15 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_gauntlet.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/theatre_of_blood.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/theatre_of_blood.png new file mode 100644 index 0000000000..0d05a8ab1e Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/theatre_of_blood.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/thermonuclear_smoke_devil.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/thermonuclear_smoke_devil.png new file mode 100644 index 0000000000..7869a9a817 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/thermonuclear_smoke_devil.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tzkal_zuk.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tzkal_zuk.png new file mode 100644 index 0000000000..8b3262cd8b Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tzkal_zuk.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tztok_jad.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tztok_jad.png new file mode 100644 index 0000000000..6ccee5515e Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tztok_jad.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/venenatis.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/venenatis.png new file mode 100644 index 0000000000..df08980743 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/venenatis.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vetion.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vetion.png new file mode 100644 index 0000000000..383d30a119 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vetion.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vorkath.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vorkath.png new file mode 100644 index 0000000000..03bcc75ed4 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vorkath.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/wintertodt.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/wintertodt.png new file mode 100644 index 0000000000..eb1d8f47bb Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/wintertodt.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zalcano.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zalcano.png new file mode 100644 index 0000000000..c4d6e21be0 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zalcano.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zulrah.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zulrah.png new file mode 100644 index 0000000000..83d939a1ac Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zulrah.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/overall.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/overall.png new file mode 100644 index 0000000000..50e4458e8e Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/overall.png differ diff --git a/runelite-client/src/main/resources/skill_icons_small/bounty hunter - hunter.png b/runelite-client/src/main/resources/skill_icons_small/bounty_hunter_hunter.png similarity index 100% rename from runelite-client/src/main/resources/skill_icons_small/bounty hunter - hunter.png rename to runelite-client/src/main/resources/skill_icons_small/bounty_hunter_hunter.png diff --git a/runelite-client/src/main/resources/skill_icons_small/bounty hunter - rogue.png b/runelite-client/src/main/resources/skill_icons_small/bounty_hunter_rogue.png similarity index 100% rename from runelite-client/src/main/resources/skill_icons_small/bounty hunter - rogue.png rename to runelite-client/src/main/resources/skill_icons_small/bounty_hunter_rogue.png diff --git a/runelite-client/src/main/resources/skill_icons_small/clue scrolls (all).png b/runelite-client/src/main/resources/skill_icons_small/clue_scroll_all.png similarity index 100% rename from runelite-client/src/main/resources/skill_icons_small/clue scrolls (all).png rename to runelite-client/src/main/resources/skill_icons_small/clue_scroll_all.png diff --git a/runelite-client/src/main/resources/skill_icons_small/last man standing.png b/runelite-client/src/main/resources/skill_icons_small/last_man_standing.png similarity index 100% rename from runelite-client/src/main/resources/skill_icons_small/last man standing.png rename to runelite-client/src/main/resources/skill_icons_small/last_man_standing.png diff --git a/runelite-client/src/main/resources/skill_icons_small/league points.png b/runelite-client/src/main/resources/skill_icons_small/league_points.png similarity index 100% rename from runelite-client/src/main/resources/skill_icons_small/league points.png rename to runelite-client/src/main/resources/skill_icons_small/league_points.png diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java index c814cbd6a7..3d5255f088 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java @@ -24,6 +24,8 @@ */ package net.runelite.client.plugins.hiscore; +import static net.runelite.client.plugins.hiscore.HiscorePanel.formatLevel; +import static org.junit.Assert.assertEquals; import org.junit.Test; public class HiscorePanelTest @@ -35,4 +37,14 @@ public class HiscorePanelTest { }); } + + @Test + public void testFormatLevel() + { + assertEquals("398", formatLevel(398)); + assertEquals("5000", formatLevel(5000)); + assertEquals("7682", formatLevel(7682)); + assertEquals("12k", formatLevel(12398)); + assertEquals("219k", formatLevel(219824)); + } }