agility plugin: add laps to goal to overlay

Add configuration option for laps til level
This commit is contained in:
beaumitch
2019-09-18 11:02:05 -04:00
committed by Adam
parent bcbcf638e5
commit b78bd73e91
3 changed files with 44 additions and 9 deletions

View File

@@ -54,11 +54,33 @@ public interface AgilityConfig extends Config
return 5;
}
@ConfigItem(
keyName = "lapsToLevel",
name = "Show Laps Until Level",
description = "Show number of laps remaining until next level is reached.",
position = 3
)
default boolean lapsToLevel()
{
return true;
}
@ConfigItem(
keyName = "lapsToGoal",
name = "Show Laps Until Goal",
description = "Show number of laps remaining until experience tracker goal is reached",
position = 4
)
default boolean lapsToGoal()
{
return false;
}
@ConfigItem(
keyName = "overlayColor",
name = "Overlay Color",
description = "Color of Agility overlay",
position = 3
position = 5
)
default Color getOverlayColor()
{
@@ -69,7 +91,7 @@ public interface AgilityConfig extends Config
keyName = "highlightMarks",
name = "Highlight Marks of Grace",
description = "Enable/disable the highlighting of retrievable Marks of Grace",
position = 4
position = 6
)
default boolean highlightMarks()
{
@@ -80,7 +102,7 @@ public interface AgilityConfig extends Config
keyName = "markHighlight",
name = "Mark Highlight Color",
description = "Color of highlighted Marks of Grace",
position = 5
position = 7
)
default Color getMarkColor()
{
@@ -91,7 +113,7 @@ public interface AgilityConfig extends Config
keyName = "highlightShortcuts",
name = "Highlight Agility Shortcuts",
description = "Enable/disable the highlighting of Agility shortcuts",
position = 6
position = 8
)
default boolean highlightShortcuts()
{
@@ -102,7 +124,7 @@ public interface AgilityConfig extends Config
keyName = "trapOverlay",
name = "Show Trap Overlay",
description = "Enable/disable the highlighting of traps on Agility courses",
position = 7
position = 9
)
default boolean showTrapOverlay()
{
@@ -113,7 +135,7 @@ public interface AgilityConfig extends Config
keyName = "trapHighlight",
name = "Trap Overlay Color",
description = "Color of Agility trap overlay",
position = 8
position = 10
)
default Color getTrapColor()
{
@@ -124,7 +146,7 @@ public interface AgilityConfig extends Config
keyName = "agilityArenaNotifier",
name = "Agility Arena notifier",
description = "Notify on ticket location change in Agility Arena",
position = 9
position = 11
)
default boolean notifyAgilityArena()
{
@@ -135,7 +157,7 @@ public interface AgilityConfig extends Config
keyName = "agilityArenaTimer",
name = "Agility Arena timer",
description = "Configures whether Agility Arena timer is displayed",
position = 10
position = 12
)
default boolean showAgilityArenaTimer()
{

View File

@@ -30,6 +30,7 @@ import lombok.Setter;
import net.runelite.api.Client;
import net.runelite.api.Experience;
import net.runelite.api.Skill;
import net.runelite.api.VarPlayer;
@Getter
@Setter
@@ -39,6 +40,7 @@ class AgilitySession
private Instant lastLapCompleted;
private int totalLaps;
private int lapsTillLevel;
private int lapsTillGoal;
AgilitySession(Courses course)
{
@@ -61,11 +63,14 @@ class AgilitySession
} while (remainingXp < 0);
lapsTillLevel = remainingXp > 0 ? (int) Math.ceil(remainingXp / course.getTotalXp()) : 0;
int goalRemainingXp = client.getVar(VarPlayer.AGILITY_GOAL_END) - currentExp;
lapsTillGoal = goalRemainingXp > 0 ? (int) Math.ceil(goalRemainingXp / course.getTotalXp()) : 0;
}
void resetLapCount()
{
totalLaps = 0;
lapsTillLevel = 0;
lapsTillGoal = 0;
}
}

View File

@@ -85,7 +85,7 @@ class LapCounterOverlay extends Overlay
.right(Integer.toString(session.getTotalLaps()))
.build());
if (session.getLapsTillLevel() > 0)
if (config.lapsToLevel() && session.getLapsTillLevel() > 0)
{
panelComponent.getChildren().add(LineComponent.builder()
.left("Laps until level:")
@@ -93,6 +93,14 @@ class LapCounterOverlay extends Overlay
.build());
}
if (config.lapsToGoal() && session.getLapsTillGoal() > 0)
{
panelComponent.getChildren().add(LineComponent.builder()
.left("Laps until goal:")
.right(Integer.toString(session.getLapsTillGoal()))
.build());
}
return panelComponent.render(graphics);
}
}