Package rs.kreme.ksbot.api.hooks
Class NPCs
- java.lang.Object
-
- rs.kreme.ksbot.api.hooks.NPCs
-
public class NPCs extends java.lang.Object
The NPCs class provides functionality to interact with and query NPCs (Non-Player Characters) in the game world. It supports operations such as searching for NPCs, checking NPC properties like line of sight and nearby players, and performing actions on NPCs like using items on them. It also caches NPC data to improve performance by reducing the number of calls to the game client API.
-
-
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)
Returns the number of nearby players around a given NPC within a 10-tile radius.boolean
hasLOS(net.runelite.api.NPC npc)
Checks if the NPC has a line of sight (LOS) to the player.void
itemOnNpc(KSNPC npc, KSItem item)
Uses an item on a given NPC.NPCQuery
query()
Searches and returns NPCs on the current game tick.
-
-
-
Method Detail
-
query
public NPCQuery query()
Searches and returns NPCs on the current game tick. Caches NPCs until a new game tick occurs.- Returns:
- an NPCQuery object containing all NPCs.
-
hasLOS
public boolean hasLOS(net.runelite.api.NPC npc)
Checks if the NPC has a line of sight (LOS) to the player.- Parameters:
npc
- the NPC to check.- Returns:
- true if the NPC has LOS to the player, false otherwise.
-
getNearbyPlayerCount
public long getNearbyPlayerCount(net.runelite.api.NPC npc)
Returns the number of nearby players around a given NPC within a 10-tile radius. Excludes the local player and friends.- Parameters:
npc
- the NPC to check around.- Returns:
- the number of nearby players within 10 tiles.
-
-