implement changes
Signed-off-by: PKLite <stonewall@pklite.xyz> (cherry picked from commit 7c0bd47ded9bb7d2cf86f2c96b9656404d2dfc4c)
This commit is contained in:
@@ -1283,9 +1283,8 @@ public class ConfigPanel extends PluginPanel
|
|||||||
|
|
||||||
Class<?extends Enum> enumType = cid.getItem().enumClass();
|
Class<?extends Enum> enumType = cid.getItem().enumClass();
|
||||||
EnumSet enumSet = configManager.getConfiguration(cd.getGroup().value(),
|
EnumSet enumSet = configManager.getConfiguration(cd.getGroup().value(),
|
||||||
cid.getItem().keyName(), EnumSet.class) != null ? configManager.getConfiguration(cd.getGroup().value(),
|
cid.getItem().keyName(), EnumSet.class);
|
||||||
cid.getItem().keyName(), EnumSet.class) : EnumSet.noneOf(enumType);
|
if (enumSet == null)
|
||||||
if (enumSet == null || enumSet.contains(null))
|
|
||||||
{
|
{
|
||||||
enumSet = EnumSet.noneOf(enumType);
|
enumSet = EnumSet.noneOf(enumType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,107 +120,102 @@ public class PlayerIndicatorsOverlay extends Overlay
|
|||||||
final String builtString = nameSb.toString();
|
final String builtString = nameSb.toString();
|
||||||
final int x = graphics.getFontMetrics().stringWidth(builtString);
|
final int x = graphics.getFontMetrics().stringWidth(builtString);
|
||||||
final int y = graphics.getFontMetrics().getHeight();
|
final int y = graphics.getFontMetrics().getHeight();
|
||||||
if (skulls && actor.getSkullIcon() != null)
|
|
||||||
|
if (plugin.isHighlightClan() && actor.isClanMember() && plugin.isShowClanRanks() && relation == PlayerRelation.CLAN)
|
||||||
|
{
|
||||||
|
if (clanManager.getRank(actor.getName()) != null)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderActorTextAndImage(graphics, actor, builtString, color,
|
||||||
|
ImageUtil.resizeImage(Objects.requireNonNull(clanManager
|
||||||
|
.getClanImage(clanManager.getRank(actor.getName()))), y, y), 0, ACTOR_HORIZONTAL_TEXT_MARGIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skulls && actor.getSkullIcon() != null && relation.equals(PlayerRelation.TARGET))
|
||||||
{
|
{
|
||||||
|
|
||||||
OverlayUtil.renderActorTextAndImage(graphics, actor, builtString, color,
|
OverlayUtil.renderActorTextAndImage(graphics, actor, builtString, color,
|
||||||
ImageUtil.resizeImage(skullIcon, y, y), ACTOR_OVERHEAD_TEXT_MARGIN, ACTOR_HORIZONTAL_TEXT_MARGIN);
|
ImageUtil.resizeImage(skullIcon, y, y), ACTOR_OVERHEAD_TEXT_MARGIN, ACTOR_HORIZONTAL_TEXT_MARGIN);
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (plugin.isHighlightClan() && actor.isClanMember() && plugin.isShowClanRanks() && relation == PlayerRelation.CLAN)
|
|
||||||
{
|
|
||||||
if (clanManager.getRank(actor.getName()) == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
OverlayUtil.renderActorTextAndImage(graphics, actor, builtString, color,
|
|
||||||
ImageUtil.resizeImage(Objects.requireNonNull(clanManager
|
|
||||||
.getClanImage(clanManager.getRank(actor.getName()))), y, y), 0, ACTOR_HORIZONTAL_TEXT_MARGIN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OverlayUtil.renderActorTextOverlay(graphics, actor, builtString, color);
|
OverlayUtil.renderActorTextOverlay(graphics, actor, builtString, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Arrays.asList(plugin.getLocationHashMap()
|
if (actor.getConvexHull() != null && indicationLocations.contains(PlayerIndicationLocation.HULL))
|
||||||
.getOrDefault(relation, NULL_OBJ))
|
|
||||||
.contains(PlayerIndicationLocation.HULL))
|
|
||||||
{
|
{
|
||||||
if (actor.getConvexHull() == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
OverlayUtil.renderPolygon(graphics, actor.getConvexHull(), color);
|
OverlayUtil.renderPolygon(graphics, actor.getConvexHull(), color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Arrays.asList(plugin.getLocationHashMap()
|
if (indicationLocations.contains(PlayerIndicationLocation.TILE))
|
||||||
.getOrDefault(relation, NULL_OBJ))
|
|
||||||
.contains(PlayerIndicationLocation.TILE))
|
|
||||||
{
|
{
|
||||||
final Polygon poly = actor.getCanvasTilePoly();
|
if (actor.getCanvasTilePoly() != null)
|
||||||
if (poly != null)
|
|
||||||
{
|
{
|
||||||
OverlayUtil.renderPolygon(graphics, poly, color);
|
OverlayUtil.renderPolygon(graphics, actor.getCanvasTilePoly(), color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.isShowAgilityLevel() && checkWildy() && plugin.getResultCache().containsKey(actor.getName()))
|
if (relation.equals(PlayerRelation.TARGET))
|
||||||
{
|
{
|
||||||
if (textLocation == null)
|
if (plugin.isShowAgilityLevel() && checkWildy() && plugin.getResultCache().containsKey(actor.getName()))
|
||||||
{
|
{
|
||||||
return;
|
if (textLocation == null)
|
||||||
}
|
|
||||||
|
|
||||||
final int level = plugin.getResultCache().get(actor.getName()).getAgility().getLevel();
|
|
||||||
|
|
||||||
if (plugin.getAgilityFormat() == PlayerIndicatorsPlugin.AgilityFormats.ICONS)
|
|
||||||
{
|
|
||||||
|
|
||||||
final int width = plugin.isShowCombatLevel() ? graphics.getFontMetrics().stringWidth(name)
|
|
||||||
+ ACTOR_HORIZONTAL_TEXT_MARGIN : graphics.getFontMetrics().stringWidth(name);
|
|
||||||
|
|
||||||
final int height = graphics.getFontMetrics().getHeight();
|
|
||||||
if (level >= plugin.getAgilityFirstThreshold())
|
|
||||||
{
|
{
|
||||||
OverlayUtil.renderImageLocation(graphics,
|
return;
|
||||||
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
|
|
||||||
{
|
|
||||||
Color agiColor = Color.WHITE;
|
|
||||||
|
|
||||||
if (level >= plugin.getAgilityFirstThreshold())
|
|
||||||
{
|
|
||||||
agiColor = Color.CYAN;
|
|
||||||
}
|
|
||||||
else if (level >= plugin.getAgilitySecondThreshold())
|
|
||||||
{
|
|
||||||
agiColor = Color.GREEN;
|
|
||||||
}
|
|
||||||
else if (level < plugin.getAgilityFirstThreshold())
|
|
||||||
{
|
|
||||||
agiColor = Color.RED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final String n = level + " " + "Agility";
|
final int level = plugin.getResultCache().get(actor.getName()).getAgility().getLevel();
|
||||||
OverlayUtil.renderActorTextOverlay(graphics, actor, n, agiColor, 60);
|
|
||||||
|
if (plugin.getAgilityFormat() == PlayerIndicatorsPlugin.AgilityFormats.ICONS)
|
||||||
|
{
|
||||||
|
|
||||||
|
final int width = plugin.isShowCombatLevel() ? graphics.getFontMetrics().stringWidth(name)
|
||||||
|
+ ACTOR_HORIZONTAL_TEXT_MARGIN : graphics.getFontMetrics().stringWidth(name);
|
||||||
|
|
||||||
|
final 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));
|
||||||
|
}
|
||||||
|
else if (level >= plugin.getAgilitySecondThreshold())
|
||||||
|
{
|
||||||
|
OverlayUtil.renderImageLocation(graphics,
|
||||||
|
new Point(textLocation.getX() + agilityIcon.getWidth() + width,
|
||||||
|
textLocation.getY() - height),
|
||||||
|
ImageUtil.resizeImage(agilityIcon, height, height));
|
||||||
|
}
|
||||||
|
else if (level < plugin.getAgilityFirstThreshold())
|
||||||
|
{
|
||||||
|
OverlayUtil.renderImageLocation(graphics,
|
||||||
|
new Point(textLocation.getX() + 5 + width,
|
||||||
|
textLocation.getY() - height),
|
||||||
|
ImageUtil.resizeImage(noAgilityIcon, height, height));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Color agiColor = Color.WHITE;
|
||||||
|
|
||||||
|
if (level >= plugin.getAgilityFirstThreshold())
|
||||||
|
{
|
||||||
|
agiColor = Color.CYAN;
|
||||||
|
}
|
||||||
|
else if (level >= plugin.getAgilitySecondThreshold())
|
||||||
|
{
|
||||||
|
agiColor = Color.GREEN;
|
||||||
|
}
|
||||||
|
else if (level < plugin.getAgilityFirstThreshold())
|
||||||
|
{
|
||||||
|
agiColor = Color.RED;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String n = level + " " + "Agility";
|
||||||
|
OverlayUtil.renderActorTextOverlay(graphics, actor, n, agiColor, 60);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,14 @@ import net.runelite.http.api.hiscore.HiscoreResult;
|
|||||||
public class PlayerIndicatorsPlugin extends Plugin
|
public class PlayerIndicatorsPlugin extends Plugin
|
||||||
{
|
{
|
||||||
private static final HiscoreClient HISCORE_CLIENT = new HiscoreClient();
|
private static final HiscoreClient HISCORE_CLIENT = new HiscoreClient();
|
||||||
|
private final List<String> callers = new ArrayList<>();
|
||||||
|
private final Map<Player, PlayerRelation> colorizedMenus = new ConcurrentHashMap<>();
|
||||||
|
private final Map<PlayerRelation, Color> relationColorHashMap = new ConcurrentHashMap<>();
|
||||||
|
private final Map<PlayerRelation, Object[]> locationHashMap = new ConcurrentHashMap<>();
|
||||||
|
private final Map<String, Actor> callerPiles = new ConcurrentHashMap<>();
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private final Map<String, HiscoreResult> resultCache = new HashMap<>();
|
||||||
|
private final ExecutorService executorService = Executors.newFixedThreadPool(100);
|
||||||
@Inject
|
@Inject
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
@@ -100,16 +107,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
|
|
||||||
private ClanMemberRank callerRank;
|
private ClanMemberRank callerRank;
|
||||||
private final List<String> callers = new ArrayList<>();
|
|
||||||
private final Map<Player, PlayerRelation> colorizedMenus = new ConcurrentHashMap<>();
|
|
||||||
private final Map<PlayerRelation, Color> relationColorHashMap = new ConcurrentHashMap<>();
|
|
||||||
private final Map<PlayerRelation, Object[]> locationHashMap = new ConcurrentHashMap<>();
|
|
||||||
private final Map<String, Actor> callerPiles = new ConcurrentHashMap<>();
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
|
||||||
private final Map<String, HiscoreResult> resultCache = new HashMap<>();
|
|
||||||
private final ExecutorService executorService = Executors.newFixedThreadPool(100);
|
|
||||||
private PlayerIndicatorsPlugin.AgilityFormats agilityFormat;
|
private PlayerIndicatorsPlugin.AgilityFormats agilityFormat;
|
||||||
private PlayerIndicatorsPlugin.MinimapSkullLocations skullLocation;
|
private PlayerIndicatorsPlugin.MinimapSkullLocations skullLocation;
|
||||||
private String configCallers;
|
private String configCallers;
|
||||||
@@ -307,82 +305,83 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
image = clanManager.getIconNumber(rank);
|
image = clanManager.getIconNumber(rank);
|
||||||
}
|
}
|
||||||
else if (this.highlightTeam && player.getTeam() > 0 && (localPlayer != null ? localPlayer.getTeam() : -1) == player.getTeam())
|
}
|
||||||
|
else if (this.highlightTeam && player.getTeam() > 0 && (localPlayer != null ? localPlayer.getTeam() : -1) == player.getTeam())
|
||||||
|
{
|
||||||
|
if (Arrays.asList(this.locationHashMap.get(PlayerRelation.TEAM)).contains(PlayerIndicationLocation.MENU))
|
||||||
{
|
{
|
||||||
if (Arrays.asList(this.locationHashMap.get(PlayerRelation.TEAM)).contains(PlayerIndicationLocation.MENU))
|
color = relationColorHashMap.get(PlayerRelation.TEAM);
|
||||||
{
|
|
||||||
color = relationColorHashMap.get(PlayerRelation.TEAM);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (this.highlightOther && !player.isClanMember() && !player.isFriend() && !PvPUtil.isAttackable(client, player))
|
}
|
||||||
|
else if (this.highlightOther && !player.isClanMember() && !player.isFriend() && !PvPUtil.isAttackable(client, player))
|
||||||
|
{
|
||||||
|
if (Arrays.asList(this.locationHashMap.get(PlayerRelation.OTHER)).contains(PlayerIndicationLocation.MENU))
|
||||||
{
|
{
|
||||||
if (Arrays.asList(this.locationHashMap.get(PlayerRelation.OTHER)).contains(PlayerIndicationLocation.MENU))
|
color = relationColorHashMap.get(PlayerRelation.OTHER);
|
||||||
{
|
|
||||||
color = relationColorHashMap.get(PlayerRelation.OTHER);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (this.highlightTargets && !player.isClanMember() && !client.isFriended(player.getName(),
|
}
|
||||||
false) && PvPUtil.isAttackable(client, player))
|
else if (this.highlightTargets && !player.isClanMember() && !client.isFriended(player.getName(),
|
||||||
|
false) && PvPUtil.isAttackable(client, player))
|
||||||
|
{
|
||||||
|
if (Arrays.asList(this.locationHashMap.get(PlayerRelation.TARGET)).contains(PlayerIndicationLocation.MENU))
|
||||||
{
|
{
|
||||||
if (Arrays.asList(this.locationHashMap.get(PlayerRelation.TARGET)).contains(PlayerIndicationLocation.MENU))
|
color = relationColorHashMap.get(PlayerRelation.TARGET);
|
||||||
{
|
|
||||||
color = relationColorHashMap.get(PlayerRelation.TARGET);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (this.highlightCallers && isCaller(player))
|
}
|
||||||
|
else if (this.highlightCallers && isCaller(player))
|
||||||
|
{
|
||||||
|
if (Arrays.asList(this.locationHashMap.get(PlayerRelation.CALLER)).contains(PlayerIndicationLocation.MENU))
|
||||||
{
|
{
|
||||||
if (Arrays.asList(this.locationHashMap.get(PlayerRelation.CALLER)).contains(PlayerIndicationLocation.MENU))
|
color = relationColorHashMap.get(PlayerRelation.CALLER);
|
||||||
{
|
|
||||||
color = relationColorHashMap.get(PlayerRelation.CALLER);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (this.highlightCallerTargets && isPile(player))
|
}
|
||||||
|
else if (this.highlightCallerTargets && isPile(player))
|
||||||
|
{
|
||||||
|
if (Arrays.asList(this.locationHashMap.get(PlayerRelation.CALLER_TARGET)).contains(PlayerIndicationLocation.MENU))
|
||||||
{
|
{
|
||||||
if (Arrays.asList(this.locationHashMap.get(PlayerRelation.CALLER_TARGET)).contains(PlayerIndicationLocation.MENU))
|
color = relationColorHashMap.get(PlayerRelation.CALLER_TARGET);
|
||||||
{
|
|
||||||
color = relationColorHashMap.get(PlayerRelation.CALLER_TARGET);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.playerSkull && !player.isClanMember() && player.getSkullIcon() != null)
|
if (this.playerSkull && !player.isClanMember() && player.getSkullIcon() != null)
|
||||||
{
|
{
|
||||||
image2 = 35;
|
image2 = 35;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image != -1 || color != null)
|
if (image != -1 || color != null)
|
||||||
{
|
{
|
||||||
final MenuEntry[] menuEntries = client.getMenuEntries();
|
final MenuEntry[] menuEntries = client.getMenuEntries();
|
||||||
final MenuEntry lastEntry = menuEntries[menuEntries.length - 1];
|
final MenuEntry lastEntry = menuEntries[menuEntries.length - 1];
|
||||||
|
|
||||||
|
|
||||||
if (color != null)
|
if (color != null)
|
||||||
|
{
|
||||||
|
// strip out existing <col...
|
||||||
|
String target = lastEntry.getTarget();
|
||||||
|
final int idx = target.indexOf('>');
|
||||||
|
if (idx != -1)
|
||||||
{
|
{
|
||||||
// strip out existing <col...
|
target = target.substring(idx + 1);
|
||||||
String target = lastEntry.getTarget();
|
|
||||||
final int idx = target.indexOf('>');
|
|
||||||
if (idx != -1)
|
|
||||||
{
|
|
||||||
target = target.substring(idx + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
lastEntry.setTarget(ColorUtil.prependColorTag(target, color));
|
|
||||||
}
|
|
||||||
if (image != -1)
|
|
||||||
{
|
|
||||||
lastEntry.setTarget("<img=" + image + ">" + lastEntry.getTarget());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image2 != -1 && this.playerSkull)
|
lastEntry.setTarget(ColorUtil.prependColorTag(target, color));
|
||||||
{
|
|
||||||
lastEntry.setTarget("<img=" + image2 + ">" + lastEntry.getTarget());
|
|
||||||
}
|
|
||||||
|
|
||||||
client.setMenuEntries(menuEntries);
|
|
||||||
}
|
}
|
||||||
|
if (image != -1)
|
||||||
|
{
|
||||||
|
lastEntry.setTarget("<img=" + image + ">" + lastEntry.getTarget());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (image2 != -1 && this.playerSkull)
|
||||||
|
{
|
||||||
|
lastEntry.setTarget("<img=" + image2 + ">" + lastEntry.getTarget());
|
||||||
|
}
|
||||||
|
|
||||||
|
client.setMenuEntries(menuEntries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void getCallerList()
|
private void getCallerList()
|
||||||
{
|
{
|
||||||
if (!this.highlightCallers)
|
if (!this.highlightCallers)
|
||||||
|
|||||||
Reference in New Issue
Block a user