implement changes

Signed-off-by: PKLite <stonewall@pklite.xyz>
(cherry picked from commit 7c0bd47ded9bb7d2cf86f2c96b9656404d2dfc4c)
This commit is contained in:
PKLite
2019-09-11 02:48:10 -04:00
parent 98bb51dc09
commit f779434444
3 changed files with 137 additions and 144 deletions

View File

@@ -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);
} }

View File

@@ -120,50 +120,44 @@ 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)
{
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 (plugin.isHighlightClan() && actor.isClanMember() && plugin.isShowClanRanks() && relation == PlayerRelation.CLAN)
{ {
if (clanManager.getRank(actor.getName()) == null) if (clanManager.getRank(actor.getName()) != null)
{ {
return;
}
OverlayUtil.renderActorTextAndImage(graphics, actor, builtString, color, OverlayUtil.renderActorTextAndImage(graphics, actor, builtString, color,
ImageUtil.resizeImage(Objects.requireNonNull(clanManager ImageUtil.resizeImage(Objects.requireNonNull(clanManager
.getClanImage(clanManager.getRank(actor.getName()))), y, y), 0, ACTOR_HORIZONTAL_TEXT_MARGIN); .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);
}
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 (relation.equals(PlayerRelation.TARGET))
{
if (plugin.isShowAgilityLevel() && checkWildy() && plugin.getResultCache().containsKey(actor.getName())) if (plugin.isShowAgilityLevel() && checkWildy() && plugin.getResultCache().containsKey(actor.getName()))
{ {
if (textLocation == null) if (textLocation == null)
@@ -187,14 +181,14 @@ public class PlayerIndicatorsOverlay extends Overlay
textLocation.getY() - height), textLocation.getY() - height),
ImageUtil.resizeImage(agilityIcon, height, height)); ImageUtil.resizeImage(agilityIcon, height, height));
} }
if (level >= plugin.getAgilitySecondThreshold()) else if (level >= plugin.getAgilitySecondThreshold())
{ {
OverlayUtil.renderImageLocation(graphics, OverlayUtil.renderImageLocation(graphics,
new Point(textLocation.getX() + agilityIcon.getWidth() + width, new Point(textLocation.getX() + agilityIcon.getWidth() + width,
textLocation.getY() - height), textLocation.getY() - height),
ImageUtil.resizeImage(agilityIcon, height, height)); ImageUtil.resizeImage(agilityIcon, height, height));
} }
if (level < plugin.getAgilityFirstThreshold()) else if (level < plugin.getAgilityFirstThreshold())
{ {
OverlayUtil.renderImageLocation(graphics, OverlayUtil.renderImageLocation(graphics,
new Point(textLocation.getX() + 5 + width, new Point(textLocation.getX() + 5 + width,
@@ -224,6 +218,7 @@ public class PlayerIndicatorsOverlay extends Overlay
} }
} }
} }
}
private boolean checkWildy() private boolean checkWildy()
{ {

View File

@@ -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,6 +305,7 @@ 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))
@@ -381,7 +380,7 @@ public class PlayerIndicatorsPlugin extends Plugin
} }
} }
} }
}
private void getCallerList() private void getCallerList()
{ {