Merge pull request #1601 from devLotto/hiscore-virtual-levels-fix
hiscore panel: fix not displaying total level correctly
This commit is contained in:
@@ -27,29 +27,29 @@ package net.runelite.http.api.hiscore;
|
|||||||
public enum HiscoreSkill
|
public enum HiscoreSkill
|
||||||
{
|
{
|
||||||
OVERALL("Overall"),
|
OVERALL("Overall"),
|
||||||
ATTACK("Attack", true),
|
ATTACK("Attack"),
|
||||||
DEFENCE("Defence", true),
|
DEFENCE("Defence"),
|
||||||
STRENGTH("Strength", true),
|
STRENGTH("Strength"),
|
||||||
HITPOINTS("Hitpoints", true),
|
HITPOINTS("Hitpoints"),
|
||||||
RANGED("Ranged", true),
|
RANGED("Ranged"),
|
||||||
PRAYER("Prayer", true),
|
PRAYER("Prayer"),
|
||||||
MAGIC("Magic", true),
|
MAGIC("Magic"),
|
||||||
COOKING("Cooking", true),
|
COOKING("Cooking"),
|
||||||
WOODCUTTING("Woodcutting", true),
|
WOODCUTTING("Woodcutting"),
|
||||||
FLETCHING("Fletching", true),
|
FLETCHING("Fletching"),
|
||||||
FISHING("Fishing", true),
|
FISHING("Fishing"),
|
||||||
FIREMAKING("Firemaking", true),
|
FIREMAKING("Firemaking"),
|
||||||
CRAFTING("Crafting", true),
|
CRAFTING("Crafting"),
|
||||||
SMITHING("Smithing", true),
|
SMITHING("Smithing"),
|
||||||
MINING("Mining", true),
|
MINING("Mining"),
|
||||||
HERBLORE("Herblore", true),
|
HERBLORE("Herblore"),
|
||||||
AGILITY("Agility", true),
|
AGILITY("Agility"),
|
||||||
THIEVING("Thieving", true),
|
THIEVING("Thieving"),
|
||||||
SLAYER("Slayer", true),
|
SLAYER("Slayer"),
|
||||||
FARMING("Farming", true),
|
FARMING("Farming"),
|
||||||
RUNECRAFT("Runecraft", true),
|
RUNECRAFT("Runecraft"),
|
||||||
HUNTER("Hunter", true),
|
HUNTER("Hunter"),
|
||||||
CONSTRUCTION("Construction", true),
|
CONSTRUCTION("Construction"),
|
||||||
CLUE_SCROLL_EASY("Clue Scrolls (easy)"),
|
CLUE_SCROLL_EASY("Clue Scrolls (easy)"),
|
||||||
CLUE_SCROLL_MEDIUM("Clue Scrolls (medium)"),
|
CLUE_SCROLL_MEDIUM("Clue Scrolls (medium)"),
|
||||||
CLUE_SCROLL_ALL("Clue Scrolls (all)"),
|
CLUE_SCROLL_ALL("Clue Scrolls (all)"),
|
||||||
@@ -61,26 +61,14 @@ public enum HiscoreSkill
|
|||||||
CLUE_SCROLL_MASTER("Clue Scrolls (master)");
|
CLUE_SCROLL_MASTER("Clue Scrolls (master)");
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final boolean virtualLevels;
|
|
||||||
|
|
||||||
HiscoreSkill(String name)
|
HiscoreSkill(String name)
|
||||||
{
|
|
||||||
this(name, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
HiscoreSkill(String name, boolean virtualLevels)
|
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.virtualLevels = virtualLevels;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasVirtualLevels()
|
|
||||||
{
|
|
||||||
return virtualLevels;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,10 @@ import java.awt.event.MouseEvent;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@@ -100,8 +103,10 @@ public class HiscorePanel extends PluginPanel
|
|||||||
private static final String SKILL_NAME = "SKILL_NAME";
|
private static final String SKILL_NAME = "SKILL_NAME";
|
||||||
private static final String SKILL = "SKILL";
|
private static final String SKILL = "SKILL";
|
||||||
|
|
||||||
private static final HiscoreSkill[] SKILL_PANEL_ORDER = new HiscoreSkill[]
|
/**
|
||||||
{
|
* Real skills, ordered in the way they should be displayed in the panel.
|
||||||
|
*/
|
||||||
|
private static final Set<HiscoreSkill> SKILLS = new LinkedHashSet<>(Arrays.asList(
|
||||||
ATTACK, HITPOINTS, MINING,
|
ATTACK, HITPOINTS, MINING,
|
||||||
STRENGTH, AGILITY, SMITHING,
|
STRENGTH, AGILITY, SMITHING,
|
||||||
DEFENCE, HERBLORE, FISHING,
|
DEFENCE, HERBLORE, FISHING,
|
||||||
@@ -110,7 +115,7 @@ public class HiscorePanel extends PluginPanel
|
|||||||
MAGIC, FLETCHING, WOODCUTTING,
|
MAGIC, FLETCHING, WOODCUTTING,
|
||||||
RUNECRAFT, SLAYER, FARMING,
|
RUNECRAFT, SLAYER, FARMING,
|
||||||
CONSTRUCTION, HUNTER
|
CONSTRUCTION, HUNTER
|
||||||
};
|
));
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ScheduledExecutorService executor;
|
ScheduledExecutorService executor;
|
||||||
@@ -214,7 +219,7 @@ public class HiscorePanel extends PluginPanel
|
|||||||
statsPanel.setBorder(subPanelBorder);
|
statsPanel.setBorder(subPanelBorder);
|
||||||
|
|
||||||
// For each skill on the ingame skill panel, create a Label and add it to the UI
|
// For each skill on the ingame skill panel, create a Label and add it to the UI
|
||||||
for (HiscoreSkill skill : SKILL_PANEL_ORDER)
|
for (HiscoreSkill skill : SKILLS)
|
||||||
{
|
{
|
||||||
JPanel panel = makeSkillPanel(skill.getName(), skill);
|
JPanel panel = makeSkillPanel(skill.getName(), skill);
|
||||||
statsPanel.add(panel);
|
statsPanel.add(panel);
|
||||||
@@ -550,7 +555,7 @@ public class HiscorePanel extends PluginPanel
|
|||||||
Skill s = result.getSkill(skill);
|
Skill s = result.getSkill(skill);
|
||||||
|
|
||||||
int level;
|
int level;
|
||||||
if (config.virtualLevels() && skill.hasVirtualLevels())
|
if (config.virtualLevels() && SKILLS.contains(skill))
|
||||||
{
|
{
|
||||||
level = Experience.getLevelForXp((int) s.getExperience());
|
level = Experience.getLevelForXp((int) s.getExperience());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user