Merge pull request #89 from daviscook477/slayer-highlight-superiors

Slayer highlight superiors
This commit is contained in:
Ganom
2019-04-24 20:41:47 -04:00
committed by GitHub
4 changed files with 60 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ import net.runelite.client.config.ConfigItem;
@ConfigGroup("slayer")
public interface SlayerConfig extends Config
{
@ConfigItem(
position = 1,
keyName = "infobox",
@@ -101,6 +102,17 @@ public interface SlayerConfig extends Config
@ConfigItem(
position = 7,
keyName = "superiorColor",
name = "Superior Color",
description = "Color of the highlighted superior slayer creatures"
)
default Color getSuperiorColor()
{
return Color.MAGENTA;
}
@ConfigItem(
position = 8,
keyName = "weaknessPrompt",
name = "Show Monster Weakness",
description = "Show an overlay on a monster when it is weak enough to finish off (Only Lizards, Gargoyles & Rockslugs)"

View File

@@ -133,6 +133,33 @@ public class SlayerPlugin extends Plugin
private static final Pattern TASK_STRING_VALIDATION = Pattern.compile("[^a-zA-Z0-9' -]");
private static final int TASK_STRING_MAX_LENGTH = 50;
// Superiors
@VisibleForTesting
static List<String> SUPERIOR_SLAYER_MONSTERS = Arrays.asList(
"crushing hand",
"chasm crawler",
"screaming banshee",
"screaming twisted banshee",
"giant rockslug",
"cockathrice",
"flaming pyrelord",
"monstrous basilisk",
"malevolent mage",
"insatiable bloodveld",
"insatiable mutated bloodveld",
"vitreous jelly",
"vitreous warped jelly",
"cave abomination",
"abhorrent spectre",
"repugnant spectre",
"choke devil",
"king kurask",
"marble gargoyle",
"nechryarch",
"greater abyssal demon",
"night beast",
"nuclear smoke devil");
@Inject
private ClientToolbar clientToolbar;
@@ -575,6 +602,11 @@ public class SlayerPlugin extends Plugin
cachedXp = slayerExp;
}
boolean isSuperior(String name)
{
return SUPERIOR_SLAYER_MONSTERS.contains(name.toLowerCase());
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{

View File

@@ -63,7 +63,13 @@ public class TargetClickboxOverlay extends Overlay
List<NPC> targets = plugin.getHighlightedTargets();
for (NPC target : targets)
{
renderTargetOverlay(graphics, target, config.getTargetColor());
Color coloration = config.getTargetColor();
if (plugin.isSuperior(target.getName()))
{
coloration = config.getSuperiorColor();
}
renderTargetOverlay(graphics, target, coloration);
}
return null;

View File

@@ -561,4 +561,13 @@ public class SlayerPluginTest
verify(chatMessageManager, never()).update(any(MessageNode.class));
}
@Test
public void testSuperiorsLowercase()
{
for (String name : SlayerPlugin.SUPERIOR_SLAYER_MONSTERS)
{
assertEquals(name, name.toLowerCase());
}
}
}