Package net.storm.api.query.entities
Class NPCQuery
java.lang.Object
Query class for finding and filtering NPCs (Non-Player Characters) in the game world.
This class extends ActorQuery with NPC-specific filtering capabilities,
primarily the ability to filter by NPC index. NPCs can be filtered by all criteria
available in the parent classes including:
- NPC indices
- Combat levels, animations, targets (from ActorQuery)
- IDs, names, actions, locations, distances (from SceneEntityQuery)
Example usage:
// Find all goblins within 10 tiles
NPCQuery query = new NPCQuery(npcSupplier)
.names("Goblin")
.distance(player, 10);
SceneEntityQueryResults<INPC> results = query.results();
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionindices(int... indices) Filters NPCs by their indices.protected SceneEntityQueryResults<INPC> Wraps the filtered list of NPCs in a SceneEntityQueryResults container.booleanTests whether an NPC passes all accumulated filter criteria.Methods inherited from class net.storm.api.query.entities.ActorQuery
animations, dead, levels, moving, targeting, targetlessMethods inherited from class net.storm.api.query.entities.SceneEntityQuery
actionContains, actions, distance, distance, distance, ids, localLocations, locations, nameContains, names, within, worldView
-
Constructor Details
-
NPCQuery
Constructs a new NPC query with the specified NPC supplier.- Parameters:
supplier- a supplier that provides the list of NPCs to query
-
-
Method Details
-
indices
Filters NPCs by their indices.Only NPCs with an index matching one of the specified values will be included. The NPC index is a unique identifier for an NPC within the current game scene.
- Parameters:
indices- the NPC indices to filter by- Returns:
- this query instance for method chaining
-
results
Wraps the filtered list of NPCs in a SceneEntityQueryResults container. -
test
Tests whether an NPC passes all accumulated filter criteria.This method checks the NPC against the index filter and all parent class filters.
-