Merge pull request #696 from f0rmatme/updatee
Moved pile stuff in player indicators to the pileindicators
This commit is contained in:
@@ -187,4 +187,27 @@ public interface PileIndicatorsConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 13,
|
||||
keyName = "drawPileHull",
|
||||
name = "Draws the hull of the pile.",
|
||||
description = "Draws the hull of the pile for best visibility."
|
||||
)
|
||||
default boolean drawPileHull()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 14,
|
||||
keyName = "highlightPile",
|
||||
name = "Highlight Pile",
|
||||
description = "Highlights Pile Onscreen"
|
||||
)
|
||||
default boolean highlightPile()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ package net.runelite.client.plugins.pileindicators;
|
||||
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.plugins.playerindicators.PlayerIndicatorsService;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -38,14 +39,16 @@ public class PileIndicatorsOverlay extends Overlay
|
||||
private final Client client;
|
||||
private final PileIndicatorsPlugin plugin;
|
||||
private final PileIndicatorsConfig config;
|
||||
private final PlayerIndicatorsService playerIndicatorsService;
|
||||
|
||||
@Inject
|
||||
PileIndicatorsOverlay(final Client client, final PileIndicatorsPlugin plugin, final PileIndicatorsConfig config)
|
||||
PileIndicatorsOverlay(final Client client, final PileIndicatorsPlugin plugin, final PileIndicatorsConfig config, PlayerIndicatorsService playerIndicatorsService)
|
||||
{
|
||||
super(plugin);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
this.playerIndicatorsService = playerIndicatorsService;
|
||||
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
@@ -57,7 +60,18 @@ public class PileIndicatorsOverlay extends Overlay
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
ArrayList<ArrayList<Actor>> stackList = plugin.getStacks();
|
||||
if (config.drawPileHull())
|
||||
{
|
||||
playerIndicatorsService.forEachPlayer((player, color) ->
|
||||
{
|
||||
if (plugin.isPile(player))
|
||||
{
|
||||
Polygon objectClickbox = player.getConvexHull();
|
||||
|
||||
renderPoly(graphics, config.playerPileColor(), objectClickbox);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (stackList != null)
|
||||
{
|
||||
for (ArrayList<Actor> actorArrayList : stackList)
|
||||
@@ -89,4 +103,17 @@ public class PileIndicatorsOverlay extends Overlay
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderPoly(Graphics2D graphics, Color color, Polygon polygon)
|
||||
{
|
||||
if (polygon != null)
|
||||
{
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.draw(polygon);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||
graphics.fill(polygon);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,9 @@ import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
@@ -38,6 +40,8 @@ import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Pile Indicators",
|
||||
@@ -64,6 +68,9 @@ public class PileIndicatorsPlugin extends Plugin
|
||||
@Inject
|
||||
private PileIndicatorsOverlay overlay;
|
||||
|
||||
private List<String> pileList;
|
||||
private ArrayList<String> callers = new ArrayList<>();
|
||||
|
||||
@Provides
|
||||
PileIndicatorsConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -87,6 +94,35 @@ public class PileIndicatorsPlugin extends Plugin
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick gameTick)
|
||||
{
|
||||
if (config.highlightPile() && callers != null)
|
||||
{
|
||||
for (Player p : client.getPlayers())
|
||||
{
|
||||
for (String name : callers)
|
||||
{
|
||||
Actor pile;
|
||||
String finalName = name.toLowerCase().replace("_", " ");
|
||||
if (p.getName().toLowerCase().replace("_", " ").equals(finalName))
|
||||
{
|
||||
pile = p.getInteracting();
|
||||
if (pile != null)
|
||||
{
|
||||
pileList.set(callers.indexOf(name), pile.getName());
|
||||
//pileList.add(pile.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
pileList.set(callers.indexOf(name), "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected ArrayList<ArrayList<Actor>> getStacks()
|
||||
{
|
||||
ArrayList<ArrayList<Actor>> outerArrayList = new ArrayList<>();
|
||||
@@ -159,6 +195,15 @@ public class PileIndicatorsPlugin extends Plugin
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean isPile(Player player)
|
||||
{
|
||||
if (Objects.nonNull(pileList) && pileList.size() > 0)
|
||||
{
|
||||
return pileList.contains(player.getName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected PileType getPileType(ArrayList<Actor> pile)
|
||||
{
|
||||
PileType pileType = null;
|
||||
|
||||
@@ -29,7 +29,6 @@ import net.runelite.api.ClanMemberRank;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.Range;
|
||||
|
||||
@ConfigGroup("playerindicators")
|
||||
public interface PlayerIndicatorsConfig extends Config
|
||||
@@ -365,46 +364,6 @@ public interface PlayerIndicatorsConfig extends Config
|
||||
return Color.WHITE;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 27,
|
||||
keyName = "highlightPile",
|
||||
name = "Highlight Pile",
|
||||
description = "Highlights Pile Onscreen",
|
||||
group = "Callers"
|
||||
)
|
||||
default boolean highlightPile()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 29,
|
||||
keyName = "drawPileHull",
|
||||
name = "Draws the hull of the pile.",
|
||||
description = "Draws the hull of the pile for best visibility.",
|
||||
group = "Callers"
|
||||
)
|
||||
default boolean drawPileHull()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Range(
|
||||
min = 1,
|
||||
max = 10
|
||||
)
|
||||
@ConfigItem(
|
||||
position = 30,
|
||||
keyName = "pileColor",
|
||||
name = "Pile Color",
|
||||
description = "Color of Indicated Pile",
|
||||
group = "Callers"
|
||||
)
|
||||
default Color pileColor()
|
||||
{
|
||||
return Color.WHITE;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 27,
|
||||
keyName = "unchargedGlory",
|
||||
|
||||
@@ -172,10 +172,6 @@ public class PlayerIndicatorsOverlay extends Overlay
|
||||
{
|
||||
name = "[C] " + name;
|
||||
}
|
||||
if (config.highlightPile() && playerIndicatorsPlugin.isPile(actor))
|
||||
{
|
||||
name = "[P] " + name;
|
||||
}
|
||||
if (config.showCombatLevel())
|
||||
{
|
||||
|
||||
|
||||
@@ -29,9 +29,7 @@ import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.ClanMember;
|
||||
import net.runelite.api.ClanMemberRank;
|
||||
import static net.runelite.api.ClanMemberRank.UNRANKED;
|
||||
@@ -54,7 +52,6 @@ import net.runelite.api.Player;
|
||||
import net.runelite.api.events.ClanMemberJoined;
|
||||
import net.runelite.api.events.ClanMemberLeft;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
@@ -128,35 +125,6 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick gameTick)
|
||||
{
|
||||
if (config.highlightPile() && callers != null)
|
||||
{
|
||||
for (Player p : client.getPlayers())
|
||||
{
|
||||
for (String name : callers)
|
||||
{
|
||||
Actor pile;
|
||||
String finalName = name.toLowerCase().replace("_", " ");
|
||||
if (p.getName().toLowerCase().replace("_", " ").equals(finalName))
|
||||
{
|
||||
pile = p.getInteracting();
|
||||
if (pile != null)
|
||||
{
|
||||
pileList.set(callers.indexOf(name), pile.getName());
|
||||
//pileList.add(pile.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
pileList.set(callers.indexOf(name), "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onClanMemberJoined(ClanMemberJoined event)
|
||||
{
|
||||
@@ -213,14 +181,6 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean isPile(Player player)
|
||||
{
|
||||
if (Objects.nonNull(pileList) && pileList.size() > 0)
|
||||
{
|
||||
return pileList.contains(player.getName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
||||
@@ -328,10 +288,6 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
{
|
||||
color = config.callerColor();
|
||||
}
|
||||
if (config.colorPlayerMenu() && config.highlightPile() && this.isPile(player))
|
||||
{
|
||||
color = config.pileColor();
|
||||
}
|
||||
if (image != -1 || color != null)
|
||||
{
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
|
||||
@@ -50,8 +50,7 @@ public class PlayerIndicatorsService
|
||||
public void forEachPlayer(final BiConsumer<Player, Color> consumer)
|
||||
{
|
||||
if (!config.highlightOwnPlayer() && !config.drawClanMemberNames()
|
||||
&& !config.highlightFriends() && !config.highlightNonClanMembers() && !config.highlightTargets()
|
||||
&& !config.highlightPile() && !config.highlightCallers() && !config.highlightTeamMembers())
|
||||
&& !config.highlightFriends() && !config.highlightNonClanMembers() && !config.highlightTargets() && !config.highlightCallers() && !config.highlightTeamMembers())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -107,11 +106,6 @@ public class PlayerIndicatorsService
|
||||
{
|
||||
consumer.accept(player, config.callerColor());
|
||||
}
|
||||
if (config.highlightPile() && playerIndicatorsPlugin.isPile(player)
|
||||
&& !player.isClanMember())
|
||||
{
|
||||
consumer.accept(player, config.pileColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
package net.runelite.client.plugins.playerindicators;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
@@ -58,18 +56,6 @@ public class PlayerIndicatorsTileOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (config.drawPileHull())
|
||||
{
|
||||
playerIndicatorsService.forEachPlayer((player, color) ->
|
||||
{
|
||||
if (playerIndicatorsPlugin.isPile(player))
|
||||
{
|
||||
Polygon objectClickbox = player.getConvexHull();
|
||||
|
||||
renderPoly(graphics, config.pileColor(), objectClickbox);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!config.drawTiles() /*&& !config.drawPlayerHull()*/)
|
||||
{
|
||||
return null;
|
||||
@@ -89,15 +75,4 @@ public class PlayerIndicatorsTileOverlay extends Overlay
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderPoly(Graphics2D graphics, Color color, Polygon polygon)
|
||||
{
|
||||
if (polygon != null)
|
||||
{
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.draw(polygon);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||
graphics.fill(polygon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user