add ability to hide npc by index value - andrewterra

This commit is contained in:
zeruth
2021-01-21 22:55:52 -05:00
parent 90a4c85e46
commit ceb8359ca1
3 changed files with 42 additions and 0 deletions

View File

@@ -1616,6 +1616,20 @@ public interface Client extends GameShell
*/
void forciblyUnhideNpcName(String name);
/**
* Get the list of NPC indices that are currently hidden
*
* @return all of the current hidden NPC Indices
*/
List<Integer> getHiddenNpcIndices();
/**
* If an NPC index is in this List then do not render it
*
* @param npcIndices the npc indices to hide
*/
void setHiddenNpcIndices(List<Integer> npcIndices);
/**
* Increments the counter for how many times this npc has been selected to be hidden on death
*

View File

@@ -88,6 +88,9 @@ public abstract class EntityHiderBridgeMixin implements RSClient
@Inject
public static Set<Integer> blacklistDeadNpcs = new HashSet<>();
@Inject
public static List<Integer> hiddenNpcIndices = new ArrayList<>();
@Inject
@Override
public void setIsHidingEntities(boolean state)
@@ -264,4 +267,18 @@ public abstract class EntityHiderBridgeMixin implements RSClient
{
hideDeadNPCs = state;
}
@Inject
@Override
public void setHiddenNpcIndices(List<Integer> npcIndices)
{
hiddenNpcIndices = npcIndices;
}
@Inject
@Override
public List<Integer> getHiddenNpcIndices()
{
return hiddenNpcIndices;
}
}

View File

@@ -99,6 +99,9 @@ public abstract class EntityHiderMixin implements RSScene
@Shadow("hideDeadNPCs")
private static boolean hideDeadNPCs;
@Shadow("hiddenNpcIndices")
private static List<Integer> hiddenNpcIndices;
@Copy("newGameObject")
@Replace("newGameObject")
boolean copy$addEntityMarker(int var1, int var2, int var3, int var4, int var5, int x, int y, int var8, RSRenderable entity, int var10, boolean var11, long var12, int var13)
@@ -213,6 +216,14 @@ public abstract class EntityHiderMixin implements RSScene
return false;
}
for (Integer index : hiddenNpcIndices)
{
if (index != null && npc.getIndex() == index)
{
return false;
}
}
return drawingUI ? !hideNPCs2D : !hideNPCs;
}
else if (entity instanceof RSProjectile)