Merge pull request #8818 from deathbeam/more-config

Add options for actions left and done for on screen XP
This commit is contained in:
Lotto
2019-05-12 20:52:20 +02:00
committed by GitHub
2 changed files with 51 additions and 10 deletions

View File

@@ -96,15 +96,38 @@ class XpInfoBoxOverlay extends Overlay
final XpSnapshotSingle snapshot = plugin.getSkillSnapshot(skill); final XpSnapshotSingle snapshot = plugin.getSkillSnapshot(skill);
final String leftStr;
final int rightNum;
switch (config.onScreenDisplayMode())
{
case ACTIONS_DONE:
leftStr = snapshot.getActionType().getLabel() + " Done";
rightNum = snapshot.getActionsInSession();
break;
case ACTIONS_LEFT:
leftStr = snapshot.getActionType().getLabel() + " Left";
rightNum = snapshot.getActionsRemainingToGoal();
break;
case XP_LEFT:
leftStr = config.onScreenDisplayMode().toString();
rightNum = snapshot.getXpRemainingToGoal();
break;
case XP_GAINED:
default:
leftStr = config.onScreenDisplayMode().toString();
rightNum = snapshot.getXpGainedInSession();
break;
}
final LineComponent xpLine = LineComponent.builder() final LineComponent xpLine = LineComponent.builder()
.left(config.displayXpLeftOnScreen() ? "XP Left:" : "XP Gained:") .left(leftStr + ":")
.right(StackFormatter.quantityToRSDecimalStack(config.displayXpLeftOnScreen() .right(StackFormatter.quantityToRSDecimalStack(rightNum, true))
? snapshot.getXpRemainingToGoal() : snapshot.getXpGainedInSession())) .build();
.build();
final LineComponent xpHour = LineComponent.builder() final LineComponent xpHour = LineComponent.builder()
.left("XP/Hour:") .left("XP/Hour:")
.right(StackFormatter.quantityToRSDecimalStack(snapshot.getXpPerHour())) .right(StackFormatter.quantityToRSDecimalStack(snapshot.getXpPerHour(), true))
.build(); .build();
final SplitComponent xpSplit = SplitComponent.builder() final SplitComponent xpSplit = SplitComponent.builder()

View File

@@ -24,6 +24,7 @@
*/ */
package net.runelite.client.plugins.xptracker; package net.runelite.client.plugins.xptracker;
import lombok.AllArgsConstructor;
import net.runelite.client.config.Config; import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem; import net.runelite.client.config.ConfigItem;
@@ -31,6 +32,23 @@ import net.runelite.client.config.ConfigItem;
@ConfigGroup("xpTracker") @ConfigGroup("xpTracker")
public interface XpTrackerConfig extends Config public interface XpTrackerConfig extends Config
{ {
@AllArgsConstructor
enum OnScreenDisplayMode
{
XP_GAINED("XP Gained"),
XP_LEFT("XP Left"),
ACTIONS_DONE("Actions Done"),
ACTIONS_LEFT("Actions Left");
private final String name;
@Override
public String toString()
{
return name;
}
}
@ConfigItem( @ConfigItem(
position = 0, position = 0,
keyName = "hideMaxed", keyName = "hideMaxed",
@@ -77,12 +95,12 @@ public interface XpTrackerConfig extends Config
@ConfigItem( @ConfigItem(
position = 4, position = 4,
keyName = "onScreenXpLeft", keyName = "onScreenDisplayMode",
name = "Display XP Left on-screen", name = "On-screen tracker display mode",
description = "Display remaining experience instead of experience gained on on-screen trackers" description = "Configures the information displayed in the first line of on-screen XP overlays"
) )
default boolean displayXpLeftOnScreen() default OnScreenDisplayMode onScreenDisplayMode()
{ {
return false; return OnScreenDisplayMode.XP_GAINED;
} }
} }