Package rs.kreme.ksbot.api.hooks
Class NPCs
- java.lang.Object
-
- rs.kreme.ksbot.api.hooks.NPCs
-
public class NPCs extends java.lang.ObjectTheNPCsclass provides a high-level API for querying and interacting with NPCs (Non-Player Characters) in the RuneLite client.Features include:
- Caching of NPC lists to reduce client calls
- Line-of-sight checks between player and NPCs
- Nearby player count detection
- Item-on-NPC interaction
-
-
Constructor Summary
Constructors Constructor Description NPCs()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetNearbyPlayerCount(net.runelite.api.NPC npc)Counts the number of nearby players (excluding the local player and friends) within a 10-tile radius of the given NPC.booleanhasLOS(net.runelite.api.NPC npc)Determines if the specifiedNPChas line of sight (LOS) to the local player.voiditemOnNpc(KSNPC npc, KSItem item)Performs a "Use item on NPC" interaction.NPCQueryquery()Queries all active NPCs in the game world and wraps them asKSNPCobjects.
-
-
-
Method Detail
-
query
public NPCQuery query()
Queries all active NPCs in the game world and wraps them asKSNPCobjects. Results are cached per game tick for performance.- Returns:
- an
NPCQuerycontaining the list of active NPCs.
-
hasLOS
public boolean hasLOS(net.runelite.api.NPC npc)
Determines if the specifiedNPChas line of sight (LOS) to the local player.- Parameters:
npc- the NPC to check- Returns:
trueif LOS exists, otherwisefalse
-
getNearbyPlayerCount
public long getNearbyPlayerCount(net.runelite.api.NPC npc)
Counts the number of nearby players (excluding the local player and friends) within a 10-tile radius of the given NPC.- Parameters:
npc- the NPC around which to count players- Returns:
- the number of nearby players
-
-