Skip to content

Commit

Permalink
npcaggro: show for current slayer task option
Browse files Browse the repository at this point in the history
Co-authored-by: OSRS-Athan <[email protected]>
  • Loading branch information
2 people authored and Adam- committed Jun 12, 2022
1 parent fcacf4d commit c669f64
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,15 @@ default boolean hideIfOutOfCombat()
{
return false;
}

@ConfigItem(
keyName = "showOnSlayerTask",
name = "Show on slayer task",
description = "Enable for current slayer task NPCs",
position = 9
)
default boolean showOnSlayerTask()
{
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDependency;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.slayer.SlayerPlugin;
import net.runelite.client.plugins.slayer.SlayerPluginService;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.client.util.WildcardMatcher;
Expand All @@ -68,6 +71,7 @@
tags = {"highlight", "lines", "unaggro", "aggro", "aggressive", "npcs", "area", "slayer"},
enabledByDefault = false
)
@PluginDependency(SlayerPlugin.class)
public class NpcAggroAreaPlugin extends Plugin
{
/*
Expand Down Expand Up @@ -114,6 +118,9 @@ public class NpcAggroAreaPlugin extends Plugin
@Inject
private Notifier notifier;

@Inject
private SlayerPluginService slayerPluginService;

@Getter
private final WorldPoint[] safeCenters = new WorldPoint[2];

Expand Down Expand Up @@ -270,6 +277,15 @@ private boolean isNpcMatch(NPC npc)
return false;
}

if (config.showOnSlayerTask())
{
List<NPC> targets = slayerPluginService.getTargets();
if (targets.contains(npc))
{
return true;
}
}

for (String pattern : npcNamePatterns)
{
if (WildcardMatcher.matches(pattern, npcName))
Expand Down Expand Up @@ -381,6 +397,7 @@ public void onConfigChanged(ConfigChanged event)
switch (key)
{
case "npcUnaggroAlwaysActive":
case "showOnSlayerTask":
recheckActive();
break;
case "npcUnaggroCollisionDetection":
Expand Down

0 comments on commit c669f64

Please sign in to comment.