entityhider: Hide npcs on death. (#1195)
This commit is contained in:
@@ -1456,6 +1456,13 @@ public interface Client extends GameShell
|
|||||||
*/
|
*/
|
||||||
void setNPCsNames(String names);
|
void setNPCsNames(String names);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets which NPCs are hidden on death
|
||||||
|
*
|
||||||
|
* @param names the names of the npcs seperated by ','
|
||||||
|
*/
|
||||||
|
void setNPCsHiddenOnDeath(String names);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether 2D sprites (ie. overhead prayers) related to
|
* Sets whether 2D sprites (ie. overhead prayers) related to
|
||||||
* the NPCs are hidden.
|
* the NPCs are hidden.
|
||||||
@@ -1685,9 +1692,9 @@ public interface Client extends GameShell
|
|||||||
MouseRecorder getMouseRecorder();
|
MouseRecorder getMouseRecorder();
|
||||||
|
|
||||||
void setPrintMenuActions(boolean b);
|
void setPrintMenuActions(boolean b);
|
||||||
|
|
||||||
String getSelectedSpellName();
|
String getSelectedSpellName();
|
||||||
|
|
||||||
boolean isSpellSelected();
|
boolean isSpellSelected();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1714,7 +1721,7 @@ public interface Client extends GameShell
|
|||||||
* Set spells excluded from above hiding
|
* Set spells excluded from above hiding
|
||||||
*/
|
*/
|
||||||
void setUnhiddenCasts(Set<String> casts);
|
void setUnhiddenCasts(Set<String> casts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the current menu entries in the same way the client does this.
|
* Sorts the current menu entries in the same way the client does this.
|
||||||
* The last entry will be the left click one after this.
|
* The last entry will be the left click one after this.
|
||||||
|
|||||||
@@ -142,6 +142,17 @@ public interface EntityHiderConfig extends Config
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 10,
|
||||||
|
keyName = "hideNPCsOnDeath",
|
||||||
|
name = "Hide NPCs On Death",
|
||||||
|
description = "Configures which NPCs to hide when they die"
|
||||||
|
)
|
||||||
|
default String hideNPCsOnDeath()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 11,
|
position = 11,
|
||||||
keyName = "hideProjectiles",
|
keyName = "hideProjectiles",
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ public class EntityHiderPlugin extends Plugin
|
|||||||
client.setNPCsHidden(config.hideNPCs());
|
client.setNPCsHidden(config.hideNPCs());
|
||||||
client.setNPCsHidden2D(config.hideNPCs2D());
|
client.setNPCsHidden2D(config.hideNPCs2D());
|
||||||
client.setNPCsNames(config.hideNPCsNames());
|
client.setNPCsNames(config.hideNPCsNames());
|
||||||
|
client.setNPCsHiddenOnDeath(config.hideNPCsOnDeath());
|
||||||
|
|
||||||
client.setAttackersHidden(config.hideAttackers());
|
client.setAttackersHidden(config.hideAttackers());
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
|||||||
@Inject
|
@Inject
|
||||||
public static String hideNPCsNames;
|
public static String hideNPCsNames;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public static String hideNPCsOnDeath;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
@@ -141,6 +143,13 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
|||||||
hideNPCsNames = NPCs;
|
hideNPCsNames = NPCs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void setNPCsHiddenOnDeath(String NPCs)
|
||||||
|
{
|
||||||
|
hideNPCsOnDeath = NPCs;
|
||||||
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
public void setAttackersHidden(boolean state)
|
public void setAttackersHidden(boolean state)
|
||||||
|
|||||||
@@ -68,7 +68,10 @@ public abstract class EntityHiderMixin implements RSScene
|
|||||||
private static boolean hideNPCs;
|
private static boolean hideNPCs;
|
||||||
|
|
||||||
@Shadow("hideNPCsNames")
|
@Shadow("hideNPCsNames")
|
||||||
private static String hideNPCsNames;
|
private static String hideNPCsNames;
|
||||||
|
|
||||||
|
@Shadow("hideNPCsOnDeath")
|
||||||
|
private static String hideNPCsOnDeath;
|
||||||
|
|
||||||
@Shadow("hideNPCs2D")
|
@Shadow("hideNPCs2D")
|
||||||
private static boolean hideNPCs2D;
|
private static boolean hideNPCs2D;
|
||||||
@@ -158,6 +161,7 @@ public abstract class EntityHiderMixin implements RSScene
|
|||||||
{
|
{
|
||||||
RSNPC npc = (RSNPC) renderable;
|
RSNPC npc = (RSNPC) renderable;
|
||||||
String[] names = hideNPCsNames.split(",");
|
String[] names = hideNPCsNames.split(",");
|
||||||
|
String[] removeOnDeath = hideNPCsOnDeath.split(",");
|
||||||
|
|
||||||
if (!hideAttackers)
|
if (!hideAttackers)
|
||||||
{
|
{
|
||||||
@@ -176,12 +180,20 @@ public abstract class EntityHiderMixin implements RSScene
|
|||||||
{
|
{
|
||||||
if (name != null && !name.equals(""))
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user