checkstyle - blackjack/player indicators/shayzien infirmary
This commit is contained in:
@@ -46,88 +46,107 @@ import net.runelite.client.plugins.PluginType;
|
|||||||
* Authors gazivodag longstreet
|
* Authors gazivodag longstreet
|
||||||
*/
|
*/
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Blackjack",
|
name = "Blackjack",
|
||||||
description = "Uses chat messages and tick timers instead of animations to read",
|
description = "Uses chat messages and tick timers instead of animations to read",
|
||||||
tags = {"blackjack", "thieving"},
|
tags = {"blackjack", "thieving"},
|
||||||
type = PluginType.UTILITY
|
type = PluginType.UTILITY
|
||||||
)
|
)
|
||||||
@Singleton
|
@Singleton
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class BlackjackPlugin extends Plugin {
|
public class BlackjackPlugin extends Plugin
|
||||||
|
{
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
Client client;
|
Client client;
|
||||||
|
|
||||||
private static long timeSinceKnockout;
|
private static long timeSinceKnockout;
|
||||||
private static long timeSinceAggro;
|
private static long timeSinceAggro;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static long currentGameTick;
|
private static long currentGameTick;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(Binder binder) {
|
public void configure(Binder binder)
|
||||||
}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception {
|
protected void startUp() throws Exception
|
||||||
currentGameTick = 0;
|
{
|
||||||
}
|
currentGameTick = 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutDown() throws Exception {
|
protected void shutDown() throws Exception
|
||||||
currentGameTick = 0;
|
{
|
||||||
}
|
currentGameTick = 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameTick(GameTick gameTick) {
|
public void onGameTick(GameTick gameTick)
|
||||||
currentGameTick++;
|
{
|
||||||
}
|
currentGameTick++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onChatMessage(ChatMessage chatMessage) {
|
public void onChatMessage(ChatMessage chatMessage)
|
||||||
if (chatMessage.getType() == ChatMessageType.SPAM) {
|
{
|
||||||
if (chatMessage.getMessage().equals("You smack the bandit over the head and render them unconscious.")) {
|
if (chatMessage.getType() == ChatMessageType.SPAM)
|
||||||
timeSinceKnockout = getCurrentGameTick();
|
{
|
||||||
}
|
if (chatMessage.getMessage().equals("You smack the bandit over the head and render them unconscious."))
|
||||||
if (chatMessage.getMessage().equals("Your blow only glances off the bandit's head.")) {
|
{
|
||||||
timeSinceAggro = getCurrentGameTick();
|
timeSinceKnockout = getCurrentGameTick();
|
||||||
}
|
}
|
||||||
}
|
if (chatMessage.getMessage().equals("Your blow only glances off the bandit's head."))
|
||||||
}
|
{
|
||||||
|
timeSinceAggro = getCurrentGameTick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded) {
|
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
||||||
String target = menuEntryAdded.getTarget().toLowerCase();
|
{
|
||||||
if ((target.contains("bandit") | target.contains("menaphite thug"))) {
|
String target = menuEntryAdded.getTarget().toLowerCase();
|
||||||
Quest quest = Quest.THE_FEUD;
|
if ((target.contains("bandit") | target.contains("menaphite thug")))
|
||||||
if (quest.getState(client) == QuestState.FINISHED) {
|
{
|
||||||
if (currentGameTick < (timeSinceKnockout + 4)) {
|
Quest quest = Quest.THE_FEUD;
|
||||||
stripSpecificEntries("pickpocket");
|
if (quest.getState(client) == QuestState.FINISHED)
|
||||||
}
|
{
|
||||||
if (currentGameTick < (timeSinceAggro + 4)) {
|
if (currentGameTick < (timeSinceKnockout + 4))
|
||||||
stripSpecificEntries("pickpocket");
|
{
|
||||||
}
|
stripSpecificEntries("pickpocket");
|
||||||
stripSpecificEntries("knock-out");
|
}
|
||||||
}
|
if (currentGameTick < (timeSinceAggro + 4))
|
||||||
}
|
{
|
||||||
}
|
stripSpecificEntries("pickpocket");
|
||||||
|
}
|
||||||
|
stripSpecificEntries("knock-out");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void stripSpecificEntries(String exceptFor) {
|
private void stripSpecificEntries(String exceptFor)
|
||||||
MenuEntry[] currentEntires = client.getMenuEntries();
|
{
|
||||||
MenuEntry[] newEntries = new MenuEntry[2];
|
MenuEntry[] currentEntires = client.getMenuEntries();
|
||||||
|
MenuEntry[] newEntries = new MenuEntry[2];
|
||||||
|
|
||||||
for (MenuEntry currentEntry : currentEntires) {
|
for (MenuEntry currentEntry : currentEntires)
|
||||||
if (currentEntry.getOption().toLowerCase().equals(exceptFor.toLowerCase())) {
|
{
|
||||||
newEntries[1] = currentEntry;
|
if (currentEntry.getOption().toLowerCase().equals(exceptFor.toLowerCase()))
|
||||||
}
|
{
|
||||||
if (currentEntry.getOption().toLowerCase().equals("lure")) {
|
newEntries[1] = currentEntry;
|
||||||
newEntries[0] = currentEntry;
|
}
|
||||||
}
|
if (currentEntry.getOption().toLowerCase().equals("lure"))
|
||||||
}
|
{
|
||||||
|
newEntries[0] = currentEntry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (newEntries[0] != null && newEntries[1] != null) {
|
if (newEntries[0] != null && newEntries[1] != null)
|
||||||
client.setMenuEntries(newEntries);
|
{
|
||||||
}
|
client.setMenuEntries(newEntries);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -30,10 +30,9 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import net.runelite.api.Client;
|
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.api.SkullIcon;
|
||||||
import net.runelite.client.plugins.friendtagging.FriendTaggingPlugin;
|
import net.runelite.client.plugins.friendtagging.FriendTaggingPlugin;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
@@ -49,10 +48,6 @@ public class PlayerIndicatorsMinimapOverlay extends Overlay
|
|||||||
private final PlayerIndicatorsConfig config;
|
private final PlayerIndicatorsConfig config;
|
||||||
private final BufferedImage skullIcon = ImageUtil.getResourceStreamFromClass(PlayerIndicatorsPlugin.class,
|
private final BufferedImage skullIcon = ImageUtil.getResourceStreamFromClass(PlayerIndicatorsPlugin.class,
|
||||||
"skull.png");
|
"skull.png");
|
||||||
@Inject
|
|
||||||
private ItemManager itemManager;
|
|
||||||
@Inject
|
|
||||||
private Client client;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private PlayerIndicatorsMinimapOverlay(PlayerIndicatorsConfig config, PlayerIndicatorsService playerIndicatorsService)
|
private PlayerIndicatorsMinimapOverlay(PlayerIndicatorsConfig config, PlayerIndicatorsService playerIndicatorsService)
|
||||||
@@ -98,31 +93,23 @@ public class PlayerIndicatorsMinimapOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
if (config.drawMinimapNames())
|
if (config.drawMinimapNames())
|
||||||
{
|
{
|
||||||
if (actor.getSkullIcon() != null && config.playerSkull())
|
if (actor.getSkullIcon() != null && config.playerSkull() && actor.getSkullIcon() == SkullIcon.SKULL)
|
||||||
{
|
{
|
||||||
switch (actor.getSkullIcon())
|
int width = graphics.getFontMetrics().stringWidth(name);
|
||||||
|
int height = graphics.getFontMetrics().getHeight();
|
||||||
|
if (config.skullLocation().equals(PlayerIndicatorsPlugin.minimapSkullLocations.AFTER_NAME))
|
||||||
{
|
{
|
||||||
case SKULL:
|
OverlayUtil.renderImageLocation(graphics, new Point(minimapLocation.getX()
|
||||||
|
+ width, minimapLocation.getY() - height),
|
||||||
int width = graphics.getFontMetrics().stringWidth(name);
|
ImageUtil.resizeImage(skullIcon, height, height));
|
||||||
int height = graphics.getFontMetrics().getHeight();
|
}
|
||||||
if (config.skullLocation().equals(PlayerIndicatorsPlugin.minimapSkullLocations.AFTER_NAME))
|
else
|
||||||
{
|
{
|
||||||
OverlayUtil.renderImageLocation(graphics, new Point(minimapLocation.getX()
|
OverlayUtil.renderImageLocation(graphics, new Point(minimapLocation.getX(),
|
||||||
+ width, minimapLocation.getY() - height),
|
minimapLocation.getY() - height),
|
||||||
ImageUtil.resizeImage(skullIcon, height, height));
|
ImageUtil.resizeImage(skullIcon, height, height));
|
||||||
}
|
minimapLocation = new Point(minimapLocation.getX() + skullIcon.getWidth(),
|
||||||
else
|
minimapLocation.getY());
|
||||||
{
|
|
||||||
OverlayUtil.renderImageLocation(graphics, new Point(minimapLocation.getX(),
|
|
||||||
minimapLocation.getY() - height),
|
|
||||||
ImageUtil.resizeImage(skullIcon, height, height));
|
|
||||||
minimapLocation = new Point(minimapLocation.getX() + skullIcon.getWidth(),
|
|
||||||
minimapLocation.getY());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OverlayUtil.renderTextLocation(graphics, minimapLocation, name, color);
|
OverlayUtil.renderTextLocation(graphics, minimapLocation, name, color);
|
||||||
|
|||||||
@@ -36,12 +36,11 @@ import net.runelite.api.Client;
|
|||||||
import net.runelite.api.ItemComposition;
|
import net.runelite.api.ItemComposition;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
|
import net.runelite.api.SkullIcon;
|
||||||
import net.runelite.api.kit.KitType;
|
import net.runelite.api.kit.KitType;
|
||||||
import net.runelite.client.game.ClanManager;
|
import net.runelite.client.game.ClanManager;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.game.SpriteManager;
|
|
||||||
import net.runelite.client.plugins.friendtagging.FriendTaggingPlugin;
|
import net.runelite.client.plugins.friendtagging.FriendTaggingPlugin;
|
||||||
import net.runelite.client.plugins.pvptools.PvpToolsPlugin;
|
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
@@ -62,12 +61,9 @@ public class PlayerIndicatorsOverlay extends Overlay
|
|||||||
private final ClanManager clanManager;
|
private final ClanManager clanManager;
|
||||||
private final BufferedImage skullIcon = ImageUtil.getResourceStreamFromClass(PlayerIndicatorsPlugin.class,
|
private final BufferedImage skullIcon = ImageUtil.getResourceStreamFromClass(PlayerIndicatorsPlugin.class,
|
||||||
"skull.png");
|
"skull.png");
|
||||||
PvpToolsPlugin pvpToolsPlugin;
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
@Inject
|
@Inject
|
||||||
private SpriteManager spriteManager;
|
|
||||||
@Inject
|
|
||||||
private PlayerIndicatorsPlugin playerIndicatorsPlugin;
|
private PlayerIndicatorsPlugin playerIndicatorsPlugin;
|
||||||
@Inject
|
@Inject
|
||||||
private ItemManager itemManager;
|
private ItemManager itemManager;
|
||||||
@@ -164,7 +160,7 @@ public class PlayerIndicatorsOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String tag = "";
|
String tag;
|
||||||
String prefix = "tag_";
|
String prefix = "tag_";
|
||||||
if (FriendTaggingPlugin.taggedFriends.containsKey(prefix + name.trim().toLowerCase()))
|
if (FriendTaggingPlugin.taggedFriends.containsKey(prefix + name.trim().toLowerCase()))
|
||||||
{
|
{
|
||||||
@@ -190,13 +186,13 @@ public class PlayerIndicatorsOverlay extends Overlay
|
|||||||
if (config.targetRisk() && PvPUtil.isAttackable(client, actor) && actor.getPlayerComposition() != null)
|
if (config.targetRisk() && PvPUtil.isAttackable(client, actor) && actor.getPlayerComposition() != null)
|
||||||
{
|
{
|
||||||
long totalValue = 0;
|
long totalValue = 0;
|
||||||
int newValue = 0;
|
int newValue;
|
||||||
StringBuilder stringBuilder = new StringBuilder(" ");
|
StringBuilder stringBuilder = new StringBuilder(" ");
|
||||||
for (KitType kitType : KitType.values())
|
for (KitType kitType : KitType.values())
|
||||||
{
|
{
|
||||||
ItemComposition itemComposition =
|
ItemComposition itemComposition =
|
||||||
itemManager.getItemComposition(actor.getPlayerComposition().getEquipmentId(kitType));
|
itemManager.getItemComposition(actor.getPlayerComposition().getEquipmentId(kitType));
|
||||||
if (itemComposition != null || itemComposition.getName() != null)
|
if (itemComposition != null && itemComposition.getName() != null)
|
||||||
{
|
{
|
||||||
totalValue = totalValue + itemComposition.getPrice();
|
totalValue = totalValue + itemComposition.getPrice();
|
||||||
}
|
}
|
||||||
@@ -204,7 +200,7 @@ public class PlayerIndicatorsOverlay extends Overlay
|
|||||||
newValue = (int) (totalValue / 1000);
|
newValue = (int) (totalValue / 1000);
|
||||||
if (newValue != 0)
|
if (newValue != 0)
|
||||||
{
|
{
|
||||||
stringBuilder.append("(" + formatNumber(newValue) + "K)");
|
stringBuilder.append("(").append(formatNumber(newValue)).append("K)");
|
||||||
name = name + stringBuilder;
|
name = name + stringBuilder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,30 +212,24 @@ public class PlayerIndicatorsOverlay extends Overlay
|
|||||||
name = name + " cGLORY";
|
name = name + " cGLORY";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (actor.getSkullIcon() != null && config.playerSkull())
|
|
||||||
|
if (actor.getSkullIcon() != null && config.playerSkull() && actor.getSkullIcon() == SkullIcon.SKULL)
|
||||||
{
|
{
|
||||||
switch (actor.getSkullIcon())
|
int width = graphics.getFontMetrics().stringWidth(name);
|
||||||
|
int height = graphics.getFontMetrics().getHeight();
|
||||||
|
if (config.skullLocation().equals(PlayerIndicatorsPlugin.minimapSkullLocations.AFTER_NAME))
|
||||||
{
|
{
|
||||||
case SKULL:
|
OverlayUtil.renderImageLocation(graphics, new Point(textLocation.getX()
|
||||||
int width = graphics.getFontMetrics().stringWidth(name);
|
+ width, textLocation.getY() - height),
|
||||||
int height = graphics.getFontMetrics().getHeight();
|
ImageUtil.resizeImage(skullIcon, height, height));
|
||||||
if (config.skullLocation().equals(PlayerIndicatorsPlugin.minimapSkullLocations.AFTER_NAME))
|
}
|
||||||
{
|
else
|
||||||
OverlayUtil.renderImageLocation(graphics, new Point(textLocation.getX()
|
{
|
||||||
+ width, textLocation.getY() - height),
|
OverlayUtil.renderImageLocation(graphics, new Point(textLocation.getX(),
|
||||||
ImageUtil.resizeImage(skullIcon, height, height));
|
textLocation.getY() - height),
|
||||||
}
|
ImageUtil.resizeImage(skullIcon, height, height));
|
||||||
else
|
textLocation = new Point(textLocation.getX() + skullIcon.getWidth(),
|
||||||
{
|
textLocation.getY());
|
||||||
OverlayUtil.renderImageLocation(graphics, new Point(textLocation.getX(),
|
|
||||||
textLocation.getY() - height),
|
|
||||||
ImageUtil.resizeImage(skullIcon, height, height));
|
|
||||||
textLocation = new Point(textLocation.getX() + skullIcon.getWidth(),
|
|
||||||
textLocation.getY());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OverlayUtil.renderTextLocation(graphics, textLocation, name, color);
|
OverlayUtil.renderTextLocation(graphics, textLocation, name, color);
|
||||||
|
|||||||
@@ -31,15 +31,12 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import net.runelite.api.Actor;
|
import net.runelite.api.Actor;
|
||||||
import net.runelite.api.ClanMember;
|
import net.runelite.api.ClanMember;
|
||||||
import net.runelite.api.ClanMemberRank;
|
import net.runelite.api.ClanMemberRank;
|
||||||
import static net.runelite.api.ClanMemberRank.UNRANKED;
|
import static net.runelite.api.ClanMemberRank.UNRANKED;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import static net.runelite.api.MenuAction.*;
|
import static net.runelite.api.MenuAction.*;
|
||||||
|
|
||||||
import net.runelite.api.HeadIcon;
|
|
||||||
import net.runelite.api.MenuEntry;
|
import net.runelite.api.MenuEntry;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.events.ClanMemberJoined;
|
import net.runelite.api.events.ClanMemberJoined;
|
||||||
@@ -128,7 +125,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
for (String name:callers)
|
for (String name:callers)
|
||||||
{
|
{
|
||||||
Actor pile = null;
|
Actor pile;
|
||||||
String finalName = name.toLowerCase().replace("_", " ");
|
String finalName = name.toLowerCase().replace("_", " ");
|
||||||
if (p.getName().toLowerCase().replace("_", " ").equals(finalName))
|
if (p.getName().toLowerCase().replace("_", " ").equals(finalName))
|
||||||
{
|
{
|
||||||
@@ -160,7 +157,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
getCallerList();
|
getCallerList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getCallerList()
|
private void getCallerList()
|
||||||
{
|
{
|
||||||
callers.clear();
|
callers.clear();
|
||||||
if (config.useClanchatRanks() && client.getClanMembers() != null)
|
if (config.useClanchatRanks() && client.getClanMembers() != null)
|
||||||
@@ -187,7 +184,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
pileList = Arrays.asList(new String[callers.size()]);
|
pileList = Arrays.asList(new String[callers.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCaller(Player player)
|
boolean isCaller(Player player)
|
||||||
{
|
{
|
||||||
if (callers != null)
|
if (callers != null)
|
||||||
{
|
{
|
||||||
@@ -200,18 +197,15 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {return false;}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPile(Player player)
|
boolean isPile(Player player)
|
||||||
{
|
{
|
||||||
if (Objects.nonNull(pileList) && pileList.size() > 0)
|
if (Objects.nonNull(pileList) && pileList.size() > 0)
|
||||||
{
|
{
|
||||||
if (pileList.contains(player.getName()))
|
return pileList.contains(player.getName());
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -359,7 +353,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum minimapSkullLocations
|
public enum minimapSkullLocations
|
||||||
{
|
{
|
||||||
BEFORE_NAME,
|
BEFORE_NAME,
|
||||||
AFTER_NAME
|
AFTER_NAME
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class PlayerIndicatorsService
|
|||||||
{
|
{
|
||||||
if (!config.highlightOwnPlayer() && !config.drawClanMemberNames()
|
if (!config.highlightOwnPlayer() && !config.drawClanMemberNames()
|
||||||
&& !config.highlightFriends() && !config.highlightNonClanMembers() && !config.highlightTargets()
|
&& !config.highlightFriends() && !config.highlightNonClanMembers() && !config.highlightTargets()
|
||||||
&& !config.highlightPile() && !config.highlightCallers() && !config.highlightTeamMembers())
|
&& !config.highlightPile() && !config.highlightCallers() && !config.highlightTeamMembers())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -94,14 +94,14 @@ public class PlayerIndicatorsService
|
|||||||
else if (config.highlightTargets() && PvPUtil.isAttackable(client, player) &&
|
else if (config.highlightTargets() && PvPUtil.isAttackable(client, player) &&
|
||||||
!client.isFriended(player.getName(), false) && !player.isClanMember())
|
!client.isFriended(player.getName(), false) && !player.isClanMember())
|
||||||
{
|
{
|
||||||
if (config.skulledTargetsOnly() && player.getSkullIcon() != null)
|
if (config.skulledTargetsOnly() && player.getSkullIcon() != null)
|
||||||
{
|
{
|
||||||
consumer.accept(player, config.getTargetColor());
|
consumer.accept(player, config.getTargetColor());
|
||||||
}
|
}
|
||||||
else if (!config.skulledTargetsOnly())
|
else if (!config.skulledTargetsOnly())
|
||||||
{
|
{
|
||||||
consumer.accept(player, config.getTargetColor());
|
consumer.accept(player, config.getTargetColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.highlightCallers() && config.callers() != null && playerIndicatorsPlugin.isCaller(player))
|
if (config.highlightCallers() && config.callers() != null && playerIndicatorsPlugin.isCaller(player))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,11 +63,6 @@ public class PlayerIndicatorsTileOverlay extends Overlay
|
|||||||
Polygon objectClickbox = player.getConvexHull();
|
Polygon objectClickbox = player.getConvexHull();
|
||||||
|
|
||||||
renderPoly(graphics, config.pileColor(), objectClickbox);
|
renderPoly(graphics, config.pileColor(), objectClickbox);
|
||||||
|
|
||||||
if (objectClickbox != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,100 +1,97 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Yani <yani@xenokore.com>
|
* Copyright (c) 2019, Yani <yani@xenokore.com>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
* list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.shayzieninfirmary;
|
package net.runelite.client.plugins.shayzieninfirmary;
|
||||||
|
|
||||||
import java.awt.AlphaComposite;
|
import java.awt.AlphaComposite;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Polygon;
|
import java.awt.Polygon;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.ItemID;
|
||||||
import net.runelite.api.ItemID;
|
import net.runelite.api.NPC;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
|
||||||
|
public class ShayzienInfirmaryOverlay extends Overlay
|
||||||
public class ShayzienInfirmaryOverlay extends Overlay
|
{
|
||||||
{
|
private final ShayzienInfirmaryPlugin plugin;
|
||||||
private final ShayzienInfirmaryPlugin plugin;
|
|
||||||
private final Client client;
|
private BufferedImage medPackImage;
|
||||||
|
|
||||||
private BufferedImage medPackImage;
|
@Inject
|
||||||
|
public ShayzienInfirmaryOverlay(ShayzienInfirmaryPlugin plugin, ItemManager itemManager)
|
||||||
@Inject
|
{
|
||||||
public ShayzienInfirmaryOverlay(ShayzienInfirmaryPlugin plugin, Client client, ItemManager itemManager)
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
{
|
this.plugin = plugin;
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
|
||||||
this.plugin = plugin;
|
medPackImage = itemManager.getImage(ItemID.SHAYZIEN_MEDPACK);
|
||||||
this.client = client;
|
}
|
||||||
|
|
||||||
medPackImage = itemManager.getImage(ItemID.SHAYZIEN_MEDPACK);
|
@Override
|
||||||
}
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
@Override
|
if (!plugin.isAtInfirmary())
|
||||||
public Dimension render(Graphics2D graphics)
|
{
|
||||||
{
|
return null;
|
||||||
if (!plugin.isAtInfirmary())
|
}
|
||||||
{
|
|
||||||
return null;
|
for (NPC npc : plugin.getUnhealedSoldiers())
|
||||||
}
|
{
|
||||||
|
|
||||||
for (NPC npc : plugin.getUnhealedSoldiers())
|
Polygon tilePoly = npc.getCanvasTilePoly();
|
||||||
{
|
|
||||||
|
if (tilePoly == null)
|
||||||
Polygon tilePoly = npc.getCanvasTilePoly();
|
{
|
||||||
|
continue;
|
||||||
if (tilePoly == null)
|
}
|
||||||
{
|
|
||||||
continue;
|
OverlayUtil.renderPolygon(graphics, npc.getCanvasTilePoly(), Color.ORANGE);
|
||||||
}
|
|
||||||
|
Point imageLocation = npc.getCanvasImageLocation(medPackImage, 25);
|
||||||
OverlayUtil.renderPolygon(graphics, npc.getCanvasTilePoly(), Color.ORANGE);
|
|
||||||
|
if (imageLocation == null)
|
||||||
Point imageLocation = npc.getCanvasImageLocation(medPackImage, 25);
|
{
|
||||||
|
continue;
|
||||||
if (imageLocation == null)
|
}
|
||||||
{
|
|
||||||
continue;
|
Composite originalComposite = graphics.getComposite();
|
||||||
}
|
Composite translucentComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f);
|
||||||
|
|
||||||
Composite originalComposite = graphics.getComposite();
|
graphics.setComposite(translucentComposite);
|
||||||
Composite translucentComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f);
|
|
||||||
|
OverlayUtil.renderImageLocation(graphics, imageLocation, medPackImage);
|
||||||
graphics.setComposite(translucentComposite);
|
|
||||||
|
graphics.setComposite(originalComposite);
|
||||||
OverlayUtil.renderImageLocation(graphics, imageLocation, medPackImage);
|
}
|
||||||
|
|
||||||
graphics.setComposite(originalComposite);
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,123 +1,118 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Yani <yani@xenokore.com>
|
* Copyright (c) 2019, Yani <yani@xenokore.com>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
* list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.shayzieninfirmary;
|
package net.runelite.client.plugins.shayzieninfirmary;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.NPC;
|
||||||
import net.runelite.api.events.GameTick;
|
import net.runelite.api.events.GameTick;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.plugins.PluginType;
|
import net.runelite.client.plugins.PluginType;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Shayzien Infirmary",
|
name = "Shayzien Infirmary",
|
||||||
description = "Shows the status of wounded soldiers",
|
description = "Shows the status of wounded soldiers",
|
||||||
tags = {"shayzien", "infirmary", "soldiers"},
|
tags = {"shayzien", "infirmary", "soldiers"},
|
||||||
type = PluginType.UTILITY
|
type = PluginType.UTILITY
|
||||||
)
|
)
|
||||||
public class ShayzienInfirmaryPlugin extends Plugin
|
public class ShayzienInfirmaryPlugin extends Plugin
|
||||||
{
|
{
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private List<NPC> unhealedSoldiers = new ArrayList<NPC>();
|
private List<NPC> unhealedSoldiers = new ArrayList<NPC>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ShayzienInfirmaryOverlay overlay;
|
private ShayzienInfirmaryOverlay overlay;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
loadPlugin();
|
loadPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutDown() throws Exception
|
protected void shutDown() throws Exception
|
||||||
{
|
{
|
||||||
unloadPlugin();
|
unloadPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadPlugin()
|
private void loadPlugin()
|
||||||
{
|
{
|
||||||
overlayManager.add(overlay);
|
overlayManager.add(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unloadPlugin()
|
private void unloadPlugin()
|
||||||
{
|
{
|
||||||
overlayManager.remove(overlay);
|
overlayManager.remove(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameTick(GameTick event)
|
public void onGameTick(GameTick event)
|
||||||
{
|
{
|
||||||
if(!isAtInfirmary())
|
if (!isAtInfirmary())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unhealedSoldiers.clear();
|
unhealedSoldiers.clear();
|
||||||
|
|
||||||
for (NPC npc : client.getNpcs())
|
for (NPC npc : client.getNpcs())
|
||||||
{
|
{
|
||||||
if (isUnhealedSoldierId(npc.getId()))
|
if (isUnhealedSoldierId(npc.getId()))
|
||||||
{
|
{
|
||||||
unhealedSoldiers.add(npc);
|
unhealedSoldiers.add(npc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSoldierId(int npcId)
|
private boolean isSoldierId(int npcId)
|
||||||
{
|
{
|
||||||
return (npcId >= 6826 && npcId <= 6857);
|
return (npcId >= 6826 && npcId <= 6857);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUnhealedSoldierId(int npcId)
|
private boolean isUnhealedSoldierId(int npcId)
|
||||||
{
|
{
|
||||||
return (isSoldierId(npcId) && npcId % 2 == 0);
|
return (isSoldierId(npcId) && npcId % 2 == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHealedSoldierId(int npcId)
|
boolean isAtInfirmary()
|
||||||
{
|
{
|
||||||
return (isSoldierId(npcId) && npcId % 2 == 1);
|
return client.getLocalPlayer().getWorldLocation().getRegionID() == 6200;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAtInfirmary()
|
|
||||||
{
|
|
||||||
return client.getLocalPlayer().getWorldLocation().getRegionID() == 6200;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user