Class NPCQuery


  • public class NPCQuery
    extends Query<KSNPC,​NPCQuery>
    A specialized query class for filtering and retrieving NPC entities in the game. Extends the generic Query class and integrates contextual game utilities.
    • Constructor Detail

      • NPCQuery

        public NPCQuery​(java.util.Collection<KSNPC> npcs)
        Constructs a new NPCQuery instance.
        Parameters:
        npcs - the collection of NPCs to query.
    • Method Detail

      • atLocation

        public NPCQuery atLocation​(net.runelite.api.coords.WorldPoint wp)
        Filters NPCs located at a specific world point.
        Parameters:
        wp - the world point to filter by.
        Returns:
        the updated NPCQuery instance.
      • withIndex

        public NPCQuery withIndex​(int index)
        Filters NPCs by their index.
        Parameters:
        index - the NPC index to filter by.
        Returns:
        the updated NPCQuery instance.
      • interactingWithLocal

        public NPCQuery interactingWithLocal()
        Filters NPCs that are interacting with the local player.
        Returns:
        the updated NPCQuery instance.
      • interactingWith

        public NPCQuery interactingWith​(net.runelite.api.Actor actor)
        Filters NPCs that are interacting with a specific actor.
        Parameters:
        actor - the actor to filter by.
        Returns:
        the updated NPCQuery instance.
      • interacting

        public NPCQuery interacting()
        Filters NPCs that are interacting with any actor.
        Returns:
        the updated NPCQuery instance.
      • notInteracting

        public NPCQuery notInteracting()
        Filters NPCs that are not interacting with any actor.
        Returns:
        the updated NPCQuery instance.
      • noOneInteractingWith

        public NPCQuery noOneInteractingWith()
        Filters NPCs that no player is interacting with.
        Returns:
        the updated NPCQuery instance.
      • hasHintArrow

        public NPCQuery hasHintArrow()
        Filters NPCs that have a hint arrow above their head.
        Returns:
        the updated NPCQuery instance.
      • meleeable

        public NPCQuery meleeable()
        Filters NPCs that are meleeable (can be attacked in melee combat).
        Returns:
        the updated NPCQuery instance.
      • alive

        public NPCQuery alive()
        Filters NPCs that are alive (not dead).
        Returns:
        the updated NPCQuery instance.
      • withLoS

        public NPCQuery withLoS()
        Filters NPCs that have a line of sight to the local player.
        Returns:
        the updated NPCQuery instance.
      • withinLevel

        public NPCQuery withinLevel​(int low,
                                    int high)
        Filters NPCs within a specific combat level range.
        Parameters:
        low - the minimum combat level.
        high - the maximum combat level.
        Returns:
        the updated NPCQuery instance.
      • withinDistance

        public NPCQuery withinDistance​(int distance)
        Filters NPCs within a certain distance from the local player.
        Parameters:
        distance - the maximum distance to filter by.
        Returns:
        the updated NPCQuery instance.
      • aboveDistance

        public NPCQuery aboveDistance​(int distance)
        Filters NPCs above a certain distance from the local player.
        Parameters:
        distance - the minimum distance to filter by.
        Returns:
        the updated NPCQuery instance.
      • withoutGraphic

        public NPCQuery withoutGraphic​(int graphic)
        Filters NPCs that do not have a specific graphic.
        Parameters:
        graphic - the graphic ID to exclude.
        Returns:
        the updated NPCQuery instance.
      • withGraphic

        public NPCQuery withGraphic​(int graphic)
        Filters NPCs by a specific graphic.
        Parameters:
        graphic - the graphic ID to include.
        Returns:
        the updated NPCQuery instance.
      • withAnimation

        public NPCQuery withAnimation​(int id)
        Filters NPCs by a specific animation.
        Parameters:
        id - the animation ID to filter by.
        Returns:
        the updated NPCQuery instance.
      • withoutAnimation

        public NPCQuery withoutAnimation​(int id)
        Filters NPCs excluding a specific animation.
        Parameters:
        id - the animation ID to exclude.
        Returns:
        the updated NPCQuery instance.
      • closest

        public KSNPC closest()
        Retrieves the closest npc to the local player.
        Returns:
        the closest KSNPC, or null if no npcs are found.
      • furthest

        public KSNPC furthest()
        Retrieves the furthest npc to the local player.
        Returns:
        the furthest KSNPC, or null if no npcs are found.