Merge pull request #627 from f0rmatme/hide_npcs_basedonname
Added NPC hider based on name
This commit is contained in:
@@ -1426,6 +1426,13 @@ public interface Client extends GameShell
|
|||||||
*/
|
*/
|
||||||
void setNPCsHidden(boolean state);
|
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
|
* Sets whether 2D sprites (ie. overhead prayers) related to
|
||||||
* the NPCs are hidden.
|
* the NPCs are hidden.
|
||||||
|
|||||||
@@ -132,7 +132,18 @@ public interface EntityHiderConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@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",
|
keyName = "hideProjectiles",
|
||||||
name = "Hide Projectiles",
|
name = "Hide Projectiles",
|
||||||
description = "Configures whether or not projectiles are hidden"
|
description = "Configures whether or not projectiles are hidden"
|
||||||
@@ -141,4 +152,5 @@ public interface EntityHiderConfig extends Config
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,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.setAttackersHidden(config.hideAttackers());
|
client.setAttackersHidden(config.hideAttackers());
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,10 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
|||||||
@Inject
|
@Inject
|
||||||
public static boolean hideProjectiles;
|
public static boolean hideProjectiles;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public static String hideNPCsNames;
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
public void setIsHidingEntities(boolean state)
|
public void setIsHidingEntities(boolean state)
|
||||||
@@ -127,6 +131,13 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
|||||||
hideNPCs2D = state;
|
hideNPCs2D = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void setNPCsNames(String NPCs)
|
||||||
|
{
|
||||||
|
hideNPCsNames = NPCs;
|
||||||
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
public void setAttackersHidden(boolean state)
|
public void setAttackersHidden(boolean state)
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ public abstract class EntityHiderMixin implements RSScene
|
|||||||
@Shadow("hideNPCs")
|
@Shadow("hideNPCs")
|
||||||
private static boolean hideNPCs;
|
private static boolean hideNPCs;
|
||||||
|
|
||||||
|
@Shadow("hideNPCsNames")
|
||||||
|
private static String hideNPCsNames;
|
||||||
|
|
||||||
@Shadow("hideNPCs2D")
|
@Shadow("hideNPCs2D")
|
||||||
private static boolean hideNPCs2D;
|
private static boolean hideNPCs2D;
|
||||||
|
|
||||||
@@ -151,6 +154,7 @@ public abstract class EntityHiderMixin implements RSScene
|
|||||||
else if (renderable instanceof RSNPC)
|
else if (renderable instanceof RSNPC)
|
||||||
{
|
{
|
||||||
RSNPC npc = (RSNPC) renderable;
|
RSNPC npc = (RSNPC) renderable;
|
||||||
|
String[] names = hideNPCsNames.split(",");
|
||||||
|
|
||||||
if (!hideAttackers)
|
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;
|
return drawingUI ? !hideNPCs2D : !hideNPCs;
|
||||||
}
|
}
|
||||||
else if (renderable instanceof RSProjectile)
|
else if (renderable instanceof RSProjectile)
|
||||||
|
|||||||
Reference in New Issue
Block a user