entityhider: Hide npcs on death. (#1195)

This commit is contained in:
Ganom
2019-07-30 10:34:04 -04:00
committed by Kyleeld
parent 659bfe889c
commit 252b3bb06b
5 changed files with 49 additions and 9 deletions

View File

@@ -70,6 +70,8 @@ public abstract class EntityHiderBridgeMixin implements RSClient
@Inject
public static String hideNPCsNames;
@Inject
public static String hideNPCsOnDeath;
@Inject
@Override
@@ -141,6 +143,13 @@ public abstract class EntityHiderBridgeMixin implements RSClient
hideNPCsNames = NPCs;
}
@Inject
@Override
public void setNPCsHiddenOnDeath(String NPCs)
{
hideNPCsOnDeath = NPCs;
}
@Inject
@Override
public void setAttackersHidden(boolean state)

View File

@@ -68,7 +68,10 @@ public abstract class EntityHiderMixin implements RSScene
private static boolean hideNPCs;
@Shadow("hideNPCsNames")
private static String hideNPCsNames;
private static String hideNPCsNames;
@Shadow("hideNPCsOnDeath")
private static String hideNPCsOnDeath;
@Shadow("hideNPCs2D")
private static boolean hideNPCs2D;
@@ -158,6 +161,7 @@ public abstract class EntityHiderMixin implements RSScene
{
RSNPC npc = (RSNPC) renderable;
String[] names = hideNPCsNames.split(",");
String[] removeOnDeath = hideNPCsOnDeath.split(",");
if (!hideAttackers)
{
@@ -176,12 +180,20 @@ public abstract class EntityHiderMixin implements RSScene
{
if (name != null && !name.equals(""))
{
if (npc.getName() != null)
if (npc.getName() != null && npc.getName().startsWith(name))
{
if (npc.getName().startsWith(name))
{
return false;
}
return false;
}
}
}
for (String name : removeOnDeath)
{
if (name != null && !name.equals(""))
{
if (npc.getName() != null && npc.getName().startsWith(name) && npc.getHealthRatio() == 0)
{
return false;
}
}
}