agility plugin: highlight Sepulchre arrows and swords
This commit is contained in:
@@ -220,4 +220,26 @@ public interface AgilityConfig extends Config
|
|||||||
{
|
{
|
||||||
return Color.RED;
|
return Color.RED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "highlightSepulchreNpcs",
|
||||||
|
name = "Highlight Sepulchre Projectiles",
|
||||||
|
description = "Highlights arrows and swords in the Sepulchre",
|
||||||
|
position = 15
|
||||||
|
)
|
||||||
|
default boolean highlightSepulchreNpcs()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "sepulchreHighlightColor",
|
||||||
|
name = "Sepulchre Highlight",
|
||||||
|
description = "Overlay color for arrows and swords",
|
||||||
|
position = 16
|
||||||
|
)
|
||||||
|
default Color sepulchreHighlightColor()
|
||||||
|
{
|
||||||
|
return Color.GREEN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,12 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.Polygon;
|
import java.awt.Polygon;
|
||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.NPC;
|
||||||
|
import net.runelite.api.NPCComposition;
|
||||||
|
import net.runelite.api.Perspective;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.Tile;
|
import net.runelite.api.Tile;
|
||||||
import net.runelite.api.coords.LocalPoint;
|
import net.runelite.api.coords.LocalPoint;
|
||||||
@@ -138,6 +142,24 @@ class AgilityOverlay extends Overlay
|
|||||||
highlightTile(graphics, playerLocation, stickTile, config.stickHighlightColor());
|
highlightTile(graphics, playerLocation, stickTile, config.stickHighlightColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set<NPC> npcs = plugin.getNpcs();
|
||||||
|
if (!npcs.isEmpty() && config.highlightSepulchreNpcs())
|
||||||
|
{
|
||||||
|
Color color = config.getOverlayColor();
|
||||||
|
for (NPC npc : npcs)
|
||||||
|
{
|
||||||
|
NPCComposition npcComposition = npc.getComposition();
|
||||||
|
int size = npcComposition.getSize();
|
||||||
|
LocalPoint lp = npc.getLocalLocation();
|
||||||
|
|
||||||
|
Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size);
|
||||||
|
if (tilePoly != null)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderPolygon(graphics, tilePoly, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,15 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.agility;
|
package net.runelite.client.plugins.agility;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -38,6 +41,8 @@ import net.runelite.api.Client;
|
|||||||
import net.runelite.api.ItemID;
|
import net.runelite.api.ItemID;
|
||||||
import static net.runelite.api.ItemID.AGILITY_ARENA_TICKET;
|
import static net.runelite.api.ItemID.AGILITY_ARENA_TICKET;
|
||||||
import net.runelite.api.MenuAction;
|
import net.runelite.api.MenuAction;
|
||||||
|
import net.runelite.api.NPC;
|
||||||
|
import net.runelite.api.NullNpcID;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
import static net.runelite.api.Skill.AGILITY;
|
import static net.runelite.api.Skill.AGILITY;
|
||||||
@@ -58,6 +63,8 @@ import net.runelite.api.events.GroundObjectDespawned;
|
|||||||
import net.runelite.api.events.GroundObjectSpawned;
|
import net.runelite.api.events.GroundObjectSpawned;
|
||||||
import net.runelite.api.events.ItemDespawned;
|
import net.runelite.api.events.ItemDespawned;
|
||||||
import net.runelite.api.events.ItemSpawned;
|
import net.runelite.api.events.ItemSpawned;
|
||||||
|
import net.runelite.api.events.NpcDespawned;
|
||||||
|
import net.runelite.api.events.NpcSpawned;
|
||||||
import net.runelite.api.events.StatChanged;
|
import net.runelite.api.events.StatChanged;
|
||||||
import net.runelite.api.events.WallObjectChanged;
|
import net.runelite.api.events.WallObjectChanged;
|
||||||
import net.runelite.api.events.WallObjectDespawned;
|
import net.runelite.api.events.WallObjectDespawned;
|
||||||
@@ -81,13 +88,17 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
|||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Agility",
|
name = "Agility",
|
||||||
description = "Show helpful information about agility courses and obstacles",
|
description = "Show helpful information about agility courses and obstacles",
|
||||||
tags = {"grace", "marks", "overlay", "shortcuts", "skilling", "traps"}
|
tags = {"grace", "marks", "overlay", "shortcuts", "skilling", "traps", "sepulchre"}
|
||||||
)
|
)
|
||||||
@PluginDependency(XpTrackerPlugin.class)
|
@PluginDependency(XpTrackerPlugin.class)
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AgilityPlugin extends Plugin
|
public class AgilityPlugin extends Plugin
|
||||||
{
|
{
|
||||||
private static final int AGILITY_ARENA_REGION_ID = 11157;
|
private static final int AGILITY_ARENA_REGION_ID = 11157;
|
||||||
|
private static final Set<Integer> SEPULCHRE_NPCS = ImmutableSet.of(
|
||||||
|
NullNpcID.NULL_9672, NullNpcID.NULL_9673, NullNpcID.NULL_9674, // arrows
|
||||||
|
NullNpcID.NULL_9669, NullNpcID.NULL_9670, NullNpcID.NULL_9671 // swords
|
||||||
|
);
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final Map<TileObject, Obstacle> obstacles = new HashMap<>();
|
private final Map<TileObject, Obstacle> obstacles = new HashMap<>();
|
||||||
@@ -95,6 +106,9 @@ public class AgilityPlugin extends Plugin
|
|||||||
@Getter
|
@Getter
|
||||||
private final List<Tile> marksOfGrace = new ArrayList<>();
|
private final List<Tile> marksOfGrace = new ArrayList<>();
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final Set<NPC> npcs = new HashSet<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@@ -158,6 +172,7 @@ public class AgilityPlugin extends Plugin
|
|||||||
session = null;
|
session = null;
|
||||||
agilityLevel = 0;
|
agilityLevel = 0;
|
||||||
stickTile = null;
|
stickTile = null;
|
||||||
|
npcs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -182,6 +197,7 @@ public class AgilityPlugin extends Plugin
|
|||||||
session = null;
|
session = null;
|
||||||
lastArenaTicketPosition = null;
|
lastArenaTicketPosition = null;
|
||||||
removeAgilityArenaTimer();
|
removeAgilityArenaTimer();
|
||||||
|
npcs.clear();
|
||||||
break;
|
break;
|
||||||
case LOADING:
|
case LOADING:
|
||||||
marksOfGrace.clear();
|
marksOfGrace.clear();
|
||||||
@@ -457,4 +473,22 @@ public class AgilityPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onNpcSpawned(NpcSpawned npcSpawned)
|
||||||
|
{
|
||||||
|
NPC npc = npcSpawned.getNpc();
|
||||||
|
|
||||||
|
if (SEPULCHRE_NPCS.contains(npc.getId()))
|
||||||
|
{
|
||||||
|
npcs.add(npc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onNpcDespawned(NpcDespawned npcDespawned)
|
||||||
|
{
|
||||||
|
NPC npc = npcDespawned.getNpc();
|
||||||
|
npcs.remove(npc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user