opponent info: add config opt to show health as percent
This commit is contained in:
@@ -34,10 +34,22 @@ public interface OpponentInfoConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "lookupOnInteraction",
|
keyName = "lookupOnInteraction",
|
||||||
name = "Lookup players on interaction",
|
name = "Lookup players on interaction",
|
||||||
description = "Display a combat stat comparison panel on player interaction. (follow, trade, challenge, attack, etc.)"
|
description = "Display a combat stat comparison panel on player interaction. (follow, trade, challenge, attack, etc.)",
|
||||||
|
position = 0
|
||||||
)
|
)
|
||||||
default boolean lookupOnInteraction()
|
default boolean lookupOnInteraction()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "showPercent",
|
||||||
|
name = "Show percent",
|
||||||
|
description = "Shows hitpoints as a percentage even if hitpoints are known",
|
||||||
|
position = 1
|
||||||
|
)
|
||||||
|
default boolean showPercent()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class OpponentInfoOverlay extends Overlay
|
|||||||
|
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final OpponentInfoPlugin opponentInfoPlugin;
|
private final OpponentInfoPlugin opponentInfoPlugin;
|
||||||
|
private final OpponentInfoConfig opponentInfoConfig;
|
||||||
private final HiscoreManager hiscoreManager;
|
private final HiscoreManager hiscoreManager;
|
||||||
|
|
||||||
private final PanelComponent panelComponent = new PanelComponent();
|
private final PanelComponent panelComponent = new PanelComponent();
|
||||||
@@ -65,10 +66,12 @@ class OpponentInfoOverlay extends Overlay
|
|||||||
private String opponentsOpponentName;
|
private String opponentsOpponentName;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private OpponentInfoOverlay(Client client, OpponentInfoPlugin opponentInfoPlugin, HiscoreManager hiscoreManager)
|
private OpponentInfoOverlay(Client client, OpponentInfoPlugin opponentInfoPlugin,
|
||||||
|
OpponentInfoConfig opponentInfoConfig, HiscoreManager hiscoreManager)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.opponentInfoPlugin = opponentInfoPlugin;
|
this.opponentInfoPlugin = opponentInfoPlugin;
|
||||||
|
this.opponentInfoConfig = opponentInfoConfig;
|
||||||
this.hiscoreManager = hiscoreManager;
|
this.hiscoreManager = hiscoreManager;
|
||||||
|
|
||||||
setPosition(OverlayPosition.TOP_LEFT);
|
setPosition(OverlayPosition.TOP_LEFT);
|
||||||
@@ -147,7 +150,7 @@ class OpponentInfoOverlay extends Overlay
|
|||||||
progressBarComponent.setBackgroundColor(HP_RED);
|
progressBarComponent.setBackgroundColor(HP_RED);
|
||||||
progressBarComponent.setForegroundColor(HP_GREEN);
|
progressBarComponent.setForegroundColor(HP_GREEN);
|
||||||
|
|
||||||
if (lastMaxHealth != null)
|
if (lastMaxHealth != null && !opponentInfoConfig.showPercent())
|
||||||
{
|
{
|
||||||
progressBarComponent.setLabelDisplayMode(ProgressBarComponent.LabelDisplayMode.FULL);
|
progressBarComponent.setLabelDisplayMode(ProgressBarComponent.LabelDisplayMode.FULL);
|
||||||
progressBarComponent.setMaximum(lastMaxHealth);
|
progressBarComponent.setMaximum(lastMaxHealth);
|
||||||
|
|||||||
Reference in New Issue
Block a user