xp-tracker: add more configurable labels to canvas overlay
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, Jasper Ketelaar <Jasper0781@gmail.com>
|
* Copyright (c) 2018, Jasper Ketelaar <Jasper0781@gmail.com>
|
||||||
|
* Copyright (c) 2020, Anthony <https://github.com/while-loop>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -46,7 +47,6 @@ import net.runelite.client.ui.overlay.components.LineComponent;
|
|||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
import net.runelite.client.ui.overlay.components.ProgressBarComponent;
|
import net.runelite.client.ui.overlay.components.ProgressBarComponent;
|
||||||
import net.runelite.client.ui.overlay.components.SplitComponent;
|
import net.runelite.client.ui.overlay.components.SplitComponent;
|
||||||
import net.runelite.client.util.QuantityFormatter;
|
|
||||||
|
|
||||||
class XpInfoBoxOverlay extends OverlayPanel
|
class XpInfoBoxOverlay extends OverlayPanel
|
||||||
{
|
{
|
||||||
@@ -91,54 +91,20 @@ class XpInfoBoxOverlay extends OverlayPanel
|
|||||||
|
|
||||||
final XpSnapshotSingle snapshot = plugin.getSkillSnapshot(skill);
|
final XpSnapshotSingle snapshot = plugin.getSkillSnapshot(skill);
|
||||||
|
|
||||||
final String leftStr;
|
final String leftStr = config.onScreenDisplayMode().getActionKey(snapshot);
|
||||||
final int rightNum;
|
final String rightNum = config.onScreenDisplayMode().getValueFunc().apply(snapshot);
|
||||||
|
|
||||||
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 = "XP Left";
|
|
||||||
rightNum = snapshot.getXpRemainingToGoal();
|
|
||||||
break;
|
|
||||||
case XP_GAINED:
|
|
||||||
default:
|
|
||||||
leftStr = "XP Gained";
|
|
||||||
rightNum = snapshot.getXpGainedInSession();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
final LineComponent xpLine = LineComponent.builder()
|
final LineComponent xpLine = LineComponent.builder()
|
||||||
.left(leftStr + ":")
|
.left(leftStr + ":")
|
||||||
.right(QuantityFormatter.quantityToRSDecimalStack(rightNum, true))
|
.right(rightNum)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
final String bottemLeftStr;
|
final String bottomLeftStr = config.onScreenDisplayModeBottom().getActionKey(snapshot);
|
||||||
final int bottomRightNum;
|
final String bottomRightNum = config.onScreenDisplayModeBottom().getValueFunc().apply(snapshot);
|
||||||
|
|
||||||
switch (config.onScreenDisplayModeBottom())
|
|
||||||
{
|
|
||||||
case ACTIONS_HOUR:
|
|
||||||
bottemLeftStr = snapshot.getActionType().getLabel() + "/Hour";
|
|
||||||
bottomRightNum = snapshot.getActionsPerHour();
|
|
||||||
break;
|
|
||||||
case XP_HOUR:
|
|
||||||
default:
|
|
||||||
bottemLeftStr = "XP/Hour";
|
|
||||||
bottomRightNum = snapshot.getXpPerHour();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
final LineComponent xpLineBottom = LineComponent.builder()
|
final LineComponent xpLineBottom = LineComponent.builder()
|
||||||
.left(bottemLeftStr + ":")
|
.left(bottomLeftStr + ":")
|
||||||
.right(QuantityFormatter.quantityToRSDecimalStack(bottomRightNum, true))
|
.right(bottomRightNum)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
final SplitComponent xpSplit = SplitComponent.builder()
|
final SplitComponent xpSplit = SplitComponent.builder()
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
@@ -34,22 +33,6 @@ import net.runelite.client.config.Units;
|
|||||||
@ConfigGroup("xpTracker")
|
@ConfigGroup("xpTracker")
|
||||||
public interface XpTrackerConfig extends Config
|
public interface XpTrackerConfig extends Config
|
||||||
{
|
{
|
||||||
@AllArgsConstructor
|
|
||||||
enum OnScreenDisplayMode
|
|
||||||
{
|
|
||||||
XP_GAINED,
|
|
||||||
XP_LEFT,
|
|
||||||
ACTIONS_DONE,
|
|
||||||
ACTIONS_LEFT
|
|
||||||
}
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
enum OnScreenDisplayModeBottom
|
|
||||||
{
|
|
||||||
XP_HOUR,
|
|
||||||
ACTIONS_HOUR,
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 0,
|
position = 0,
|
||||||
keyName = "hideMaxed",
|
keyName = "hideMaxed",
|
||||||
@@ -112,9 +95,9 @@ public interface XpTrackerConfig extends Config
|
|||||||
name = "On-screen tracker display mode (top)",
|
name = "On-screen tracker display mode (top)",
|
||||||
description = "Configures the information displayed in the first line of on-screen XP overlays"
|
description = "Configures the information displayed in the first line of on-screen XP overlays"
|
||||||
)
|
)
|
||||||
default OnScreenDisplayMode onScreenDisplayMode()
|
default XpPanelLabel onScreenDisplayMode()
|
||||||
{
|
{
|
||||||
return OnScreenDisplayMode.XP_GAINED;
|
return XpPanelLabel.XP_GAINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
@@ -123,9 +106,9 @@ public interface XpTrackerConfig extends Config
|
|||||||
name = "On-screen tracker display mode (bottom)",
|
name = "On-screen tracker display mode (bottom)",
|
||||||
description = "Configures the information displayed in the second line of on-screen XP overlays"
|
description = "Configures the information displayed in the second line of on-screen XP overlays"
|
||||||
)
|
)
|
||||||
default OnScreenDisplayModeBottom onScreenDisplayModeBottom()
|
default XpPanelLabel onScreenDisplayModeBottom()
|
||||||
{
|
{
|
||||||
return OnScreenDisplayModeBottom.XP_HOUR;
|
return XpPanelLabel.XP_HOUR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
|||||||
Reference in New Issue
Block a user