Package rs.kreme.ksbot.api.hooks
Class NPCs
- java.lang.Object
-
- rs.kreme.ksbot.api.hooks.NPCs
-
public class NPCs extends java.lang.Object
TheNPCs
class 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 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.boolean
hasLOS(net.runelite.api.NPC npc)
Determines if the specifiedNPC
has line of sight (LOS) to the local player.void
itemOnNpc(KSNPC npc, KSItem item)
Performs a "Use item on NPC" interaction.NPCQuery
query()
Queries all active NPCs in the game world and wraps them asKSNPC
objects.
-
-
-
Method Detail
-
query
public NPCQuery query()
Queries all active NPCs in the game world and wraps them asKSNPC
objects. Results are cached per game tick for performance.- Returns:
- an
NPCQuery
containing the list of active NPCs.
-
hasLOS
public boolean hasLOS(net.runelite.api.NPC npc)
Determines if the specifiedNPC
has line of sight (LOS) to the local player.- Parameters:
npc
- the NPC to check- Returns:
true
if 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
-
-