xpglobes: add time to level to tooltip

Co-authored-by: Shaun Dreclin <ShaunDreclin@users.noreply.github.com>
This commit is contained in:
Adam
2022-06-16 13:22:24 -04:00
parent 0c4f35560b
commit 9b655588e6
5 changed files with 42 additions and 10 deletions

View File

@@ -78,11 +78,22 @@ public interface XpGlobesConfig extends Config
return true;
}
@ConfigItem(
keyName = "showTimeTilGoal",
name = "Show time til goal",
description = "Shows the amount of time until goal level in the globe tooltip box",
position = 4
)
default boolean showTimeTilGoal()
{
return true;
}
@ConfigItem(
keyName = "hideMaxed",
name = "Hide maxed skills",
description = "Stop globes from showing up for level 99 skills",
position = 4
position = 14
)
default boolean hideMaxed()
{
@@ -93,7 +104,7 @@ public interface XpGlobesConfig extends Config
keyName = "showVirtualLevel",
name = "Show virtual level",
description = "Shows virtual level if over 99 in a skill and Hide maxed skill is not checked",
position = 5
position = 15
)
default boolean showVirtualLevel()
{
@@ -104,7 +115,7 @@ public interface XpGlobesConfig extends Config
keyName = "enableCustomArcColor",
name = "Enable custom arc color",
description = "Enables the custom coloring of the globe's arc instead of using the skill's default color.",
position = 6
position = 16
)
default boolean enableCustomArcColor()
{
@@ -116,7 +127,7 @@ public interface XpGlobesConfig extends Config
keyName = "Progress arc color",
name = "Progress arc color",
description = "Change the color of the progress arc in the xp orb",
position = 7
position = 17
)
default Color progressArcColor()
{
@@ -128,7 +139,7 @@ public interface XpGlobesConfig extends Config
keyName = "Progress orb outline color",
name = "Progress orb outline color",
description = "Change the color of the progress orb outline",
position = 8
position = 18
)
default Color progressOrbOutLineColor()
{
@@ -140,7 +151,7 @@ public interface XpGlobesConfig extends Config
keyName = "Progress orb background color",
name = "Progress orb background color",
description = "Change the color of the progress orb background",
position = 9
position = 19
)
default Color progressOrbBackgroundColor()
{
@@ -151,7 +162,7 @@ public interface XpGlobesConfig extends Config
keyName = "Progress arc width",
name = "Progress arc width",
description = "Change the stroke width of the progress arc",
position = 10
position = 20
)
@Units(Units.PIXELS)
default int progressArcStrokeWidth()
@@ -163,7 +174,7 @@ public interface XpGlobesConfig extends Config
keyName = "Orb size",
name = "Size of orbs",
description = "Change the size of the xp orbs",
position = 11
position = 21
)
@Units(Units.PIXELS)
default int xpOrbSize()
@@ -175,7 +186,7 @@ public interface XpGlobesConfig extends Config
keyName = "Orb duration",
name = "Duration of orbs",
description = "Change the duration the xp orbs are visible",
position = 12
position = 22
)
@Units(Units.SECONDS)
default int xpOrbDuration()

View File

@@ -352,6 +352,16 @@ public class XpGlobesOverlay extends Overlay
.build());
}
}
if (config.showTimeTilGoal())
{
String timeLeft = xpTrackerService.getTimeTilGoal(mouseOverSkill.getSkill());
xpTooltip.getChildren().add(LineComponent.builder()
.left("Time left:")
.leftColor(Color.ORANGE)
.right(timeLeft)
.build());
}
}
tooltipManager.add(this.xpTooltip);

View File

@@ -204,7 +204,7 @@ class XpStateSingle
// return time remaining in hh:mm:ss or mm:ss format where hh can be > 24
if (durationHoursTotal > 0)
{
return String.format("%02d:%02d:%02d", durationHoursTotal, durationMinutes, durationSeconds);
return String.format("%d:%02d:%02d", durationHoursTotal, durationMinutes, durationSeconds);
}
// Minutes and seconds will always be present

View File

@@ -62,4 +62,9 @@ public interface XpTrackerService
* Get the amount of XP left until goal level
*/
int getEndGoalXp(Skill skill);
/**
* Get the amount of time left until goal level
*/
String getTimeTilGoal(Skill skill);
}

View File

@@ -80,4 +80,10 @@ class XpTrackerServiceImpl implements XpTrackerService
{
return plugin.getSkillSnapshot(skill).getEndGoalXp();
}
@Override
public String getTimeTilGoal(Skill skill)
{
return plugin.getSkillSnapshot(skill).getTimeTillGoalShort();
}
}