Skip to content

Commit

Permalink
xpglobes: add time to level to tooltip
Browse files Browse the repository at this point in the history
Co-authored-by: Shaun Dreclin <[email protected]>
  • Loading branch information
Adam- and ShaunDreclin committed Jun 16, 2022
1 parent 0c4f355 commit 9b65558
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,22 @@ default boolean showXpHour()
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()
{
Expand All @@ -93,7 +104,7 @@ default boolean hideMaxed()
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()
{
Expand All @@ -104,7 +115,7 @@ default boolean showVirtualLevel()
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()
{
Expand All @@ -116,7 +127,7 @@ default boolean enableCustomArcColor()
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()
{
Expand All @@ -128,7 +139,7 @@ default Color progressArcColor()
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()
{
Expand All @@ -140,7 +151,7 @@ default Color progressOrbOutLineColor()
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()
{
Expand All @@ -151,7 +162,7 @@ default Color progressOrbBackgroundColor()
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()
Expand All @@ -163,7 +174,7 @@ default int progressArcStrokeWidth()
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()
Expand All @@ -175,7 +186,7 @@ default int xpOrbSize()
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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,16 @@ private void drawTooltip(XpGlobe mouseOverSkill, int goalXp)
.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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ else if (durationHoursTotal == 1)
// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,10 @@ public int getEndGoalXp(Skill skill)
{
return plugin.getSkillSnapshot(skill).getEndGoalXp();
}

@Override
public String getTimeTilGoal(Skill skill)
{
return plugin.getSkillSnapshot(skill).getTimeTillGoalShort();
}
}

0 comments on commit 9b65558

Please sign in to comment.