xpglobes: add configs for globe tooltips

Co-authored-by: Adam <Adam@sigterm.info>
This commit is contained in:
Gustavo Rodrigues
2019-07-29 17:00:52 -03:00
committed by Adam
parent d066ca97a3
commit 3701a57606
2 changed files with 74 additions and 32 deletions

View File

@@ -44,11 +44,44 @@ public interface XpGlobesConfig extends Config
return true; return true;
} }
@ConfigItem(
keyName = "showXpLeft",
name = "Show XP Left",
description = "Shows XP Left inside the globe tooltip box",
position = 1
)
default boolean showXpLeft()
{
return true;
}
@ConfigItem(
keyName = "showActionsLeft",
name = "Show actions left",
description = "Shows the number of actions left inside the globe tooltip box",
position = 2
)
default boolean showActionsLeft()
{
return true;
}
@ConfigItem(
keyName = "showXpHour",
name = "Show XP/hr",
description = "Shows XP per hour inside the globe tooltip box",
position = 3
)
default boolean showXpHour()
{
return true;
}
@ConfigItem( @ConfigItem(
keyName = "hideMaxed", keyName = "hideMaxed",
name = "Hide maxed skills", name = "Hide maxed skills",
description = "Stop globes from showing up for level 99 skills ", description = "Stop globes from showing up for level 99 skills",
position = 1 position = 4
) )
default boolean hideMaxed() default boolean hideMaxed()
{ {
@@ -59,7 +92,7 @@ public interface XpGlobesConfig extends Config
keyName = "enableCustomArcColor", keyName = "enableCustomArcColor",
name = "Enable custom arc color", name = "Enable custom arc color",
description = "Enables the custom coloring of the globe's arc instead of using the skill's default color.", description = "Enables the custom coloring of the globe's arc instead of using the skill's default color.",
position = 2 position = 5
) )
default boolean enableCustomArcColor() default boolean enableCustomArcColor()
{ {
@@ -71,7 +104,7 @@ public interface XpGlobesConfig extends Config
keyName = "Progress arc color", keyName = "Progress arc color",
name = "Progress arc color", name = "Progress arc color",
description = "Change the color of the progress arc in the xp orb", description = "Change the color of the progress arc in the xp orb",
position = 3 position = 6
) )
default Color progressArcColor() default Color progressArcColor()
{ {
@@ -83,7 +116,7 @@ public interface XpGlobesConfig extends Config
keyName = "Progress orb outline color", keyName = "Progress orb outline color",
name = "Progress orb outline color", name = "Progress orb outline color",
description = "Change the color of the progress orb outline", description = "Change the color of the progress orb outline",
position = 4 position = 7
) )
default Color progressOrbOutLineColor() default Color progressOrbOutLineColor()
{ {
@@ -95,7 +128,7 @@ public interface XpGlobesConfig extends Config
keyName = "Progress orb background color", keyName = "Progress orb background color",
name = "Progress orb background color", name = "Progress orb background color",
description = "Change the color of the progress orb background", description = "Change the color of the progress orb background",
position = 5 position = 8
) )
default Color progressOrbBackgroundColor() default Color progressOrbBackgroundColor()
{ {
@@ -106,7 +139,7 @@ public interface XpGlobesConfig extends Config
keyName = "Progress arc width", keyName = "Progress arc width",
name = "Progress arc width", name = "Progress arc width",
description = "Change the stroke width of the progress arc", description = "Change the stroke width of the progress arc",
position = 6 position = 9
) )
default int progressArcStrokeWidth() default int progressArcStrokeWidth()
{ {
@@ -117,7 +150,7 @@ public interface XpGlobesConfig extends Config
keyName = "Orb size", keyName = "Orb size",
name = "Size of orbs", name = "Size of orbs",
description = "Change the size of the xp orbs", description = "Change the size of the xp orbs",
position = 7 position = 10
) )
default int xpOrbSize() default int xpOrbSize()
{ {
@@ -128,7 +161,7 @@ public interface XpGlobesConfig extends Config
keyName = "Orb duration", keyName = "Orb duration",
name = "Duration of orbs", name = "Duration of orbs",
description = "Change the duration the xp orbs are visible", description = "Change the duration the xp orbs are visible",
position = 8 position = 11
) )
default int xpOrbDuration() default int xpOrbDuration()
{ {

View File

@@ -263,34 +263,43 @@ public class XpGlobesOverlay extends Overlay
{ {
XpActionType xpActionType = xpTrackerService.getActionType(mouseOverSkill.getSkill()); XpActionType xpActionType = xpTrackerService.getActionType(mouseOverSkill.getSkill());
int actionsLeft = xpTrackerService.getActionsLeft(mouseOverSkill.getSkill()); if (config.showActionsLeft())
if (actionsLeft != Integer.MAX_VALUE)
{ {
String actionsLeftString = decimalFormat.format(actionsLeft); int actionsLeft = xpTrackerService.getActionsLeft(mouseOverSkill.getSkill());
xpTooltip.getChildren().add(LineComponent.builder() if (actionsLeft != Integer.MAX_VALUE)
.left(xpActionType.getLabel() + " left:") {
.leftColor(Color.ORANGE) String actionsLeftString = decimalFormat.format(actionsLeft);
.right(actionsLeftString) xpTooltip.getChildren().add(LineComponent.builder()
.build()); .left(xpActionType.getLabel() + " left:")
.leftColor(Color.ORANGE)
.right(actionsLeftString)
.build());
}
} }
int xpLeft = goalXp - mouseOverSkill.getCurrentXp(); if (config.showXpLeft())
String skillXpToLvl = decimalFormat.format(xpLeft);
xpTooltip.getChildren().add(LineComponent.builder()
.left("XP left:")
.leftColor(Color.ORANGE)
.right(skillXpToLvl)
.build());
int xpHr = xpTrackerService.getXpHr(mouseOverSkill.getSkill());
if (xpHr != 0)
{ {
String xpHrString = decimalFormat.format(xpHr); int xpLeft = goalXp - mouseOverSkill.getCurrentXp();
String skillXpToLvl = decimalFormat.format(xpLeft);
xpTooltip.getChildren().add(LineComponent.builder() xpTooltip.getChildren().add(LineComponent.builder()
.left("XP per hour:") .left("XP left:")
.leftColor(Color.ORANGE) .leftColor(Color.ORANGE)
.right(xpHrString) .right(skillXpToLvl)
.build()); .build());
}
if (config.showXpHour())
{
int xpHr = xpTrackerService.getXpHr(mouseOverSkill.getSkill());
if (xpHr != 0)
{
String xpHrString = decimalFormat.format(xpHr);
xpTooltip.getChildren().add(LineComponent.builder()
.left("XP per hour:")
.leftColor(Color.ORANGE)
.right(xpHrString)
.build());
}
} }
} }