xp tracker (onscreen): add toggle between displaying XP Left/XP Gained
This commit is contained in:
@@ -56,6 +56,7 @@ class XpInfoBoxOverlay extends Overlay
|
|||||||
private final PanelComponent panel = new PanelComponent();
|
private final PanelComponent panel = new PanelComponent();
|
||||||
private final PanelComponent iconXpSplitPanel = new PanelComponent();
|
private final PanelComponent iconXpSplitPanel = new PanelComponent();
|
||||||
private final XpTrackerPlugin plugin;
|
private final XpTrackerPlugin plugin;
|
||||||
|
private final XpTrackerConfig config;
|
||||||
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private final Skill skill;
|
private final Skill skill;
|
||||||
@@ -63,11 +64,13 @@ class XpInfoBoxOverlay extends Overlay
|
|||||||
|
|
||||||
XpInfoBoxOverlay(
|
XpInfoBoxOverlay(
|
||||||
XpTrackerPlugin plugin,
|
XpTrackerPlugin plugin,
|
||||||
|
XpTrackerConfig config,
|
||||||
Skill skill,
|
Skill skill,
|
||||||
BufferedImage icon)
|
BufferedImage icon)
|
||||||
{
|
{
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.config = config;
|
||||||
this.skill = skill;
|
this.skill = skill;
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
panel.setBorder(new Rectangle(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
|
panel.setBorder(new Rectangle(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
|
||||||
@@ -90,8 +93,9 @@ class XpInfoBoxOverlay extends Overlay
|
|||||||
final XpSnapshotSingle snapshot = plugin.getSkillSnapshot(skill);
|
final XpSnapshotSingle snapshot = plugin.getSkillSnapshot(skill);
|
||||||
|
|
||||||
final LineComponent xpLine = LineComponent.builder()
|
final LineComponent xpLine = LineComponent.builder()
|
||||||
.left("XP Gained:")
|
.left(config.displayXpLeftOnScreen() ? "XP Left:" : "XP Gained:")
|
||||||
.right(StackFormatter.quantityToRSDecimalStack(snapshot.getXpGainedInSession()))
|
.right(StackFormatter.quantityToRSDecimalStack(config.displayXpLeftOnScreen()
|
||||||
|
? snapshot.getXpRemainingToGoal() : snapshot.getXpGainedInSession()))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
final LineComponent xpHour = LineComponent.builder()
|
final LineComponent xpHour = LineComponent.builder()
|
||||||
|
|||||||
@@ -74,4 +74,15 @@ public interface XpTrackerConfig extends Config
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 4,
|
||||||
|
keyName = "onScreenXpLeft",
|
||||||
|
name = "Display XP Left on-screen",
|
||||||
|
description = "Display remaining experience instead of experience gained on on-screen trackers"
|
||||||
|
)
|
||||||
|
default boolean displayXpLeftOnScreen()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ public class XpTrackerPlugin extends Plugin
|
|||||||
void addOverlay(Skill skill)
|
void addOverlay(Skill skill)
|
||||||
{
|
{
|
||||||
removeOverlay(skill);
|
removeOverlay(skill);
|
||||||
overlayManager.add(new XpInfoBoxOverlay(this, skill, skillIconManager.getSkillImage(skill)));
|
overlayManager.add(new XpInfoBoxOverlay(this, xpTrackerConfig, skill, skillIconManager.getSkillImage(skill)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user