NPC hider based on name
This commit is contained in:
@@ -1426,6 +1426,13 @@ public interface Client extends GameShell
|
||||
*/
|
||||
void setNPCsHidden(boolean state);
|
||||
|
||||
/**
|
||||
* Sets which NPCs are hidden
|
||||
*
|
||||
* @param names the names of the npcs seperated by ','
|
||||
*/
|
||||
void setNPCsNames(String names);
|
||||
|
||||
/**
|
||||
* Sets whether 2D sprites (ie. overhead prayers) related to
|
||||
* the NPCs are hidden.
|
||||
|
||||
@@ -132,7 +132,18 @@ public interface EntityHiderConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
position = 10,
|
||||
keyName = "hideNPCsNames",
|
||||
name = "Hide NPCs Names",
|
||||
description = "Configures which NPCs to hide"
|
||||
)
|
||||
default String hideNPCsNames()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 11,
|
||||
keyName = "hideProjectiles",
|
||||
name = "Hide Projectiles",
|
||||
description = "Configures whether or not projectiles are hidden"
|
||||
@@ -141,4 +152,5 @@ public interface EntityHiderConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ public class EntityHiderPlugin extends Plugin
|
||||
|
||||
client.setNPCsHidden(config.hideNPCs());
|
||||
client.setNPCsHidden2D(config.hideNPCs2D());
|
||||
client.setNPCsNames(config.hideNPCsNames());
|
||||
|
||||
client.setAttackersHidden(config.hideAttackers());
|
||||
|
||||
|
||||
@@ -64,6 +64,10 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
@Inject
|
||||
public static boolean hideProjectiles;
|
||||
|
||||
@Inject
|
||||
public static String hideNPCsNames;
|
||||
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setIsHidingEntities(boolean state)
|
||||
@@ -127,6 +131,13 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
hideNPCs2D = state;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setNPCsNames(String NPCs)
|
||||
{
|
||||
hideNPCsNames = NPCs;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setAttackersHidden(boolean state)
|
||||
|
||||
@@ -67,6 +67,9 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
@Shadow("hideNPCs")
|
||||
private static boolean hideNPCs;
|
||||
|
||||
@Shadow("hideNPCsNames")
|
||||
private static String hideNPCsNames;
|
||||
|
||||
@Shadow("hideNPCs2D")
|
||||
private static boolean hideNPCs2D;
|
||||
|
||||
@@ -151,6 +154,7 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
else if (renderable instanceof RSNPC)
|
||||
{
|
||||
RSNPC npc = (RSNPC) renderable;
|
||||
String[] names = hideNPCsNames.split(",");
|
||||
|
||||
if (!hideAttackers)
|
||||
{
|
||||
@@ -160,6 +164,14 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
}
|
||||
}
|
||||
|
||||
for(String name: names)
|
||||
{
|
||||
if(names.equals(npc.getName()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return drawingUI ? !hideNPCs2D : !hideNPCs;
|
||||
}
|
||||
else if (renderable instanceof RSProjectile)
|
||||
|
||||
Reference in New Issue
Block a user