Show agility level overhead (either as icons or text) (#1100)
As well as some general player indicator improvements around multiple conflicting options
This commit is contained in:
@@ -277,6 +277,54 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
position = 19,
|
||||
keyName = "showAgility",
|
||||
name = "Show Agility Levels",
|
||||
description = "Show the agility level of attackable players next to their name while in the wilderness.",
|
||||
group = "Target Indicator"
|
||||
)
|
||||
default boolean showAgilityLevel()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 20,
|
||||
keyName = "agilityFormat",
|
||||
name = "Format",
|
||||
description = "Whether to show the agility level as text, or as icons (1 skull >= 1st threshold, 2 skulls >= 2nd threshold).",
|
||||
group = "Target Indicator"
|
||||
)
|
||||
default PlayerIndicatorsPlugin.AgilityFormats agilityFormat()
|
||||
{
|
||||
return PlayerIndicatorsPlugin.AgilityFormats.TEXT;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 21,
|
||||
keyName = "agilityFirstThreshold",
|
||||
name = "Format",
|
||||
description = "When showing agility as icons, show one icon for agility >= this level.",
|
||||
group = "Target Indicator"
|
||||
)
|
||||
default int agilityFirstThreshold()
|
||||
{
|
||||
return 70;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 22,
|
||||
keyName = "agilitySecondThreshold",
|
||||
name = "Format",
|
||||
description = "When showing agility as icons, show two icons for agility >= this level.",
|
||||
group = "Target Indicator"
|
||||
)
|
||||
default int agilitySecondThreshold()
|
||||
{
|
||||
return 84;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 23,
|
||||
keyName = "playerSkull",
|
||||
name = "Show Skull Information",
|
||||
description = "Indicate of the player is skulled.",
|
||||
@@ -288,7 +336,7 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 19,
|
||||
position = 24,
|
||||
keyName = "minimapSkullLocation",
|
||||
name = "Skull Icon Location",
|
||||
description = "The location of the skull icon for skulled players",
|
||||
@@ -300,7 +348,7 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 19,
|
||||
position = 25,
|
||||
keyName = "skulledTargetsOnly",
|
||||
name = "Tag Skulls Only",
|
||||
description = "Only indicate skulled targets (which are also attackable)",
|
||||
@@ -312,7 +360,7 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 19,
|
||||
position = 26,
|
||||
keyName = "targetRisk",
|
||||
name = "Indicate Target Risk",
|
||||
description = "Indicates the risk (in K GP) of the target",
|
||||
@@ -335,11 +383,11 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
}*/
|
||||
|
||||
@ConfigItem(
|
||||
position = 27,
|
||||
keyName = "useClanchatRanks",
|
||||
name = "Use Ranks as Callers",
|
||||
description = "Uses clanchat ranks as the list of callers",
|
||||
group = "Callers",
|
||||
position = 24
|
||||
group = "Callers"
|
||||
)
|
||||
default boolean useClanchatRanks()
|
||||
{
|
||||
@@ -347,11 +395,11 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 28,
|
||||
keyName = "callerRank",
|
||||
name = "Minimum rank for Clan Caller",
|
||||
description = "Chooses the minimum rank to use as clanchat callers.",
|
||||
group = "Callers",
|
||||
position = 25
|
||||
group = "Callers"
|
||||
)
|
||||
default ClanMemberRank callerRank()
|
||||
{
|
||||
@@ -359,6 +407,7 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 29,
|
||||
keyName = "callers",
|
||||
name = "List of callers to highlight",
|
||||
description = "Highlights callers, only highlights one at a time. Separate each entry with a comma and enter" +
|
||||
@@ -371,6 +420,7 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 30,
|
||||
keyName = "highlightCallers",
|
||||
name = "Highlight Callers",
|
||||
description = "Highlights Callers Onscreen",
|
||||
@@ -382,7 +432,7 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 26,
|
||||
position = 31,
|
||||
keyName = "callerColor",
|
||||
name = "Caller Color",
|
||||
description = "Color of Indicated Callers",
|
||||
@@ -394,7 +444,7 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 27,
|
||||
position = 32,
|
||||
keyName = "unchargedGlory",
|
||||
name = "Uncharged Glory Indication",
|
||||
description = "Indicates if players have an uncharged glory"
|
||||
|
||||
@@ -37,8 +37,11 @@ import net.runelite.api.ItemDefinition;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.SkullIcon;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.WorldType;
|
||||
import net.runelite.api.kit.KitType;
|
||||
import net.runelite.client.game.ClanManager;
|
||||
import net.runelite.client.game.HiscoreManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.friendtagging.FriendTaggingPlugin;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -47,6 +50,9 @@ import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.PvPUtil;
|
||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
||||
import net.runelite.http.api.hiscore.HiscoreSkill;
|
||||
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
||||
import static net.runelite.client.util.StackFormatter.formatNumber;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
@@ -58,7 +64,12 @@ public class PlayerIndicatorsOverlay extends Overlay
|
||||
|
||||
private final PlayerIndicatorsService playerIndicatorsService;
|
||||
private final ClanManager clanManager;
|
||||
private final HiscoreManager hiscoreManager;
|
||||
private final PlayerIndicatorsPlugin plugin;
|
||||
private final BufferedImage agilityIcon = ImageUtil.getResourceStreamFromClass(PlayerIndicatorsPlugin.class,
|
||||
"agility.png");
|
||||
private final BufferedImage noAgilityIcon = ImageUtil.getResourceStreamFromClass(PlayerIndicatorsPlugin.class,
|
||||
"no-agility.png");
|
||||
private final BufferedImage skullIcon = ImageUtil.getResourceStreamFromClass(PlayerIndicatorsPlugin.class,
|
||||
"skull.png");
|
||||
@Inject
|
||||
@@ -70,11 +81,12 @@ public class PlayerIndicatorsOverlay extends Overlay
|
||||
|
||||
@Inject
|
||||
private PlayerIndicatorsOverlay(final PlayerIndicatorsPlugin plugin, final PlayerIndicatorsService playerIndicatorsService,
|
||||
final ClanManager clanManager)
|
||||
final ClanManager clanManager, final HiscoreManager hiscoreManager)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.playerIndicatorsService = playerIndicatorsService;
|
||||
this.clanManager = clanManager;
|
||||
this.hiscoreManager = hiscoreManager;
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.MED);
|
||||
}
|
||||
@@ -174,10 +186,7 @@ public class PlayerIndicatorsOverlay extends Overlay
|
||||
}
|
||||
if (plugin.isShowCombatLevel())
|
||||
{
|
||||
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, name + " (" + actor.getCombatLevel() + ")",
|
||||
color);
|
||||
|
||||
name += " (" + actor.getCombatLevel() + ")";
|
||||
}
|
||||
if (plugin.isTargetRisk() && PvPUtil.isAttackable(client, actor) && actor.getPlayerAppearance() != null)
|
||||
{
|
||||
@@ -232,6 +241,58 @@ public class PlayerIndicatorsOverlay extends Overlay
|
||||
textLocation.getY());
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isShowAgilityLevel() && checkWildy())
|
||||
{
|
||||
final HiscoreResult hiscoreResult = hiscoreManager.lookupAsync(actor.getName(), HiscoreEndpoint.NORMAL);
|
||||
if (hiscoreResult != null)
|
||||
{
|
||||
int level = hiscoreResult.getSkill(HiscoreSkill.AGILITY).getLevel();
|
||||
if (plugin.getAgilityFormat() == PlayerIndicatorsPlugin.AgilityFormats.ICONS)
|
||||
{
|
||||
int width = graphics.getFontMetrics().stringWidth(name);
|
||||
int height = graphics.getFontMetrics().getHeight();
|
||||
if (level >= plugin.getAgilityFirstThreshold())
|
||||
{
|
||||
OverlayUtil.renderImageLocation(graphics,
|
||||
new Point(textLocation.getX() + 5 + width,
|
||||
textLocation.getY() - height),
|
||||
ImageUtil.resizeImage(agilityIcon, height, height));
|
||||
}
|
||||
if (level >= plugin.getAgilitySecondThreshold())
|
||||
{
|
||||
OverlayUtil.renderImageLocation(graphics,
|
||||
new Point(textLocation.getX() + agilityIcon.getWidth() + width,
|
||||
textLocation.getY() - height),
|
||||
ImageUtil.resizeImage(agilityIcon, height, height));
|
||||
}
|
||||
if (level < plugin.getAgilityFirstThreshold())
|
||||
{
|
||||
OverlayUtil.renderImageLocation(graphics,
|
||||
new Point(textLocation.getX() + 5 + width,
|
||||
textLocation.getY() - height),
|
||||
ImageUtil.resizeImage(noAgilityIcon, height, height));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
name += " " + level;
|
||||
|
||||
int width = graphics.getFontMetrics().stringWidth(name);
|
||||
int height = graphics.getFontMetrics().getHeight();
|
||||
OverlayUtil.renderImageLocation(graphics,
|
||||
new Point(textLocation.getX() + 5 + width,
|
||||
textLocation.getY() - height),
|
||||
ImageUtil.resizeImage(agilityIcon, height, height));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, name, color);
|
||||
}
|
||||
|
||||
private boolean checkWildy()
|
||||
{
|
||||
return client.getVar(Varbits.IN_WILDERNESS) == 1 || WorldType.isAllPvpWorld(client.getWorldType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +135,14 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color getTargetColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showAgilityLevel;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int agilityFirstThreshold;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int agilitySecondThreshold;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private PlayerIndicatorsPlugin.AgilityFormats agilityFormat;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showCombatLevel;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean playerSkull;
|
||||
@@ -404,6 +412,12 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
BEFORE_NAME,
|
||||
AFTER_NAME
|
||||
}
|
||||
|
||||
public enum AgilityFormats
|
||||
{
|
||||
TEXT,
|
||||
ICONS
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
@@ -427,6 +441,10 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
this.highlightTargets = config.highlightTargets();
|
||||
this.getTargetColor = config.getTargetColor();
|
||||
this.showCombatLevel = config.showCombatLevel();
|
||||
this.showAgilityLevel = config.showAgilityLevel();
|
||||
this.agilityFirstThreshold = config.agilityFirstThreshold();
|
||||
this.agilitySecondThreshold = config.agilitySecondThreshold();
|
||||
this.agilityFormat = config.agilityFormat();
|
||||
this.playerSkull = config.playerSkull();
|
||||
this.skullLocation = config.skullLocation();
|
||||
this.skulledTargetsOnly = config.skulledTargetsOnly();
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 232 B |
Binary file not shown.
|
After Width: | Height: | Size: 299 B |
Reference in New Issue
Block a user