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();
|
||||
EnumSet enumSet = configManager.getConfiguration(cd.getGroup().value(),
|
||||
cid.getItem().keyName(), EnumSet.class) != null ? configManager.getConfiguration(cd.getGroup().value(),
|
||||
cid.getItem().keyName(), EnumSet.class) : EnumSet.noneOf(enumType);
|
||||
if (enumSet == null || enumSet.contains(null))
|
||||
cid.getItem().keyName(), EnumSet.class);
|
||||
if (enumSet == null)
|
||||
{
|
||||
enumSet = EnumSet.noneOf(enumType);
|
||||
}
|
||||
|
||||
@@ -120,107 +120,102 @@ public class PlayerIndicatorsOverlay extends Overlay
|
||||
final String builtString = nameSb.toString();
|
||||
final int x = graphics.getFontMetrics().stringWidth(builtString);
|
||||
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,
|
||||
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
|
||||
{
|
||||
OverlayUtil.renderActorTextOverlay(graphics, actor, builtString, color);
|
||||
}
|
||||
}
|
||||
if (Arrays.asList(plugin.getLocationHashMap()
|
||||
.getOrDefault(relation, NULL_OBJ))
|
||||
.contains(PlayerIndicationLocation.HULL))
|
||||
if (actor.getConvexHull() != null && indicationLocations.contains(PlayerIndicationLocation.HULL))
|
||||
{
|
||||
if (actor.getConvexHull() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
OverlayUtil.renderPolygon(graphics, actor.getConvexHull(), color);
|
||||
}
|
||||
|
||||
if (Arrays.asList(plugin.getLocationHashMap()
|
||||
.getOrDefault(relation, NULL_OBJ))
|
||||
.contains(PlayerIndicationLocation.TILE))
|
||||
if (indicationLocations.contains(PlayerIndicationLocation.TILE))
|
||||
{
|
||||
final Polygon poly = actor.getCanvasTilePoly();
|
||||
if (poly != null)
|
||||
if (actor.getCanvasTilePoly() != 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;
|
||||
}
|
||||
|
||||
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())
|
||||
if (textLocation == null)
|
||||
{
|
||||
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
|
||||
{
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
final String n = level + " " + "Agility";
|
||||
OverlayUtil.renderActorTextOverlay(graphics, actor, n, agiColor, 60);
|
||||
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,
|
||||
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
|
||||
{
|
||||
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
|
||||
@Getter(AccessLevel.NONE)
|
||||
private OverlayManager overlayManager;
|
||||
@@ -100,16 +107,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
@Inject
|
||||
@Getter(AccessLevel.NONE)
|
||||
private EventBus eventBus;
|
||||
|
||||
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.MinimapSkullLocations skullLocation;
|
||||
private String configCallers;
|
||||
@@ -307,82 +305,83 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
{
|
||||
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)
|
||||
{
|
||||
image2 = 35;
|
||||
}
|
||||
if (this.playerSkull && !player.isClanMember() && player.getSkullIcon() != null)
|
||||
{
|
||||
image2 = 35;
|
||||
}
|
||||
|
||||
if (image != -1 || color != null)
|
||||
{
|
||||
final MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
final MenuEntry lastEntry = menuEntries[menuEntries.length - 1];
|
||||
if (image != -1 || color != null)
|
||||
{
|
||||
final MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
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...
|
||||
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());
|
||||
target = target.substring(idx + 1);
|
||||
}
|
||||
|
||||
if (image2 != -1 && this.playerSkull)
|
||||
{
|
||||
lastEntry.setTarget("<img=" + image2 + ">" + lastEntry.getTarget());
|
||||
}
|
||||
|
||||
client.setMenuEntries(menuEntries);
|
||||
lastEntry.setTarget(ColorUtil.prependColorTag(target, color));
|
||||
}
|
||||
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()
|
||||
{
|
||||
if (!this.highlightCallers)
|
||||
|
||||
Reference in New Issue
Block a user