Package com.kraken.api.query.gameobject
Class GameObjectQuery
- java.lang.Object
-
- com.kraken.api.core.AbstractQuery<GameObjectEntity,GameObjectQuery,net.runelite.api.GameObject>
-
- com.kraken.api.query.gameobject.GameObjectQuery
-
public class GameObjectQuery extends AbstractQuery<GameObjectEntity,GameObjectQuery,net.runelite.api.GameObject>
-
-
Field Summary
-
Fields inherited from class com.kraken.api.core.AbstractQuery
ctx
-
-
Constructor Summary
Constructors Constructor Description GameObjectQuery(Context ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GameObjectQueryat(net.runelite.api.coords.WorldPoint point)Filters by exact WorldPoint.GameObjectQueryinteractable()Filters game objects to only contain objects which can be interacted with (non Examine) actions.GameObjectQuerynameContains(java.lang.String name)Filters the stream of game objects for objects which match a specific substring of a name.GameObjectEntitynearest()Sorts the stream of game objects to order them by manhattan distance to the local player.GameObjectQueryreachable()Filters for only game objects which are reachable from the players current tile.GameObjectQuerysortByDistance()Sorts the game object stream by distance from the local players current location.protected java.util.function.Supplier<java.util.stream.Stream<GameObjectEntity>>source()GameObjectQuerywithAction(java.lang.String action)Filters for objects that have a specific action available.GameObjectQuerywithin(int distance)Filters for only objects whose location is within the specified distance from the players current local point.GameObjectQuerywithin(net.runelite.api.coords.LocalPoint anchor, int distance)Filters for only objects whose location is within the specified distance from the anchor point.GameObjectQuerywithinArea(net.runelite.api.coords.WorldPoint min, net.runelite.api.coords.WorldPoint max)Finds game objects within a specified area.GameObjectQuerywithName(java.lang.String name)Filters the stream of game objects for objects with a specific nameGameObjectQuerywithPartialAction(java.lang.String actionSubstring)Filters the game objects to include only those with at least one action containing the specified substring.
-
-
-
Constructor Detail
-
GameObjectQuery
public GameObjectQuery(Context ctx)
-
-
Method Detail
-
source
protected java.util.function.Supplier<java.util.stream.Stream<GameObjectEntity>> source()
- Specified by:
sourcein classAbstractQuery<GameObjectEntity,GameObjectQuery,net.runelite.api.GameObject>
-
withName
public GameObjectQuery withName(java.lang.String name)
Filters the stream of game objects for objects with a specific name- Overrides:
withNamein classAbstractQuery<GameObjectEntity,GameObjectQuery,net.runelite.api.GameObject>- Parameters:
name- The name of the object to filter for- Returns:
- GameObjectQuery
-
nameContains
public GameObjectQuery nameContains(java.lang.String name)
Filters the stream of game objects for objects which match a specific substring of a name. For example:ctx.gameObjects().nameContains("Oak")will find Oak tree game objects in the scene.- Overrides:
nameContainsin classAbstractQuery<GameObjectEntity,GameObjectQuery,net.runelite.api.GameObject>- Parameters:
name- The name to match against- Returns:
- GameObjectQuery
-
interactable
public GameObjectQuery interactable()
Filters game objects to only contain objects which can be interacted with (non Examine) actions. i.e. Trees, Ore, Doors, Stairs etc...- Returns:
- GameObjectQuery
-
withAction
public GameObjectQuery withAction(java.lang.String action)
Filters for objects that have a specific action available. Usage: ctx.objects().withAction("Mine").nearest().first();- Parameters:
action- The action to check for i.e "Mine", "Chop", "Examine".- Returns:
- GameObjectQuery
-
withPartialAction
public GameObjectQuery withPartialAction(java.lang.String actionSubstring)
Filters the game objects to include only those with at least one action containing the specified substring.This method is case-insensitive and matches the specified substring against all non-null action strings associated with the game object.
- Parameters:
actionSubstring- The substring to search for within the actions of the game objects. Must not benull.- Returns:
- A
GameObjectQuerywith the applied filter to include only objects with actions matching the specified substring.
-
withinArea
public GameObjectQuery withinArea(net.runelite.api.coords.WorldPoint min, net.runelite.api.coords.WorldPoint max)
Finds game objects within a specified area. The min WorldPoint should be the southwest tile of the area and the max WorldPoint should be the northeast tile of the area.- Parameters:
min- The southwest minimum world point of the area to checkmax- The northeast maximum world point of the area to check- Returns:
- GameObjectQuery
-
reachable
public GameObjectQuery reachable()
Filters for only game objects which are reachable from the players current tile.- Returns:
- GroundObjectQuery
-
nearest
public GameObjectEntity nearest()
Sorts the stream of game objects to order them by manhattan distance to the local player.- Returns:
- GameObjectQuery
-
sortByDistance
public GameObjectQuery sortByDistance()
Sorts the game object stream by distance from the local players current location.- Returns:
- GameObjectQuery
-
within
public GameObjectQuery within(net.runelite.api.coords.LocalPoint anchor, int distance)
Filters for only objects whose location is within the specified distance from the anchor point.- Parameters:
anchor- The anchor local point.distance- The maximum distance from the anchor point (in local units).- Returns:
- True if the object is within the specified distance from the anchor point, false otherwise.
-
within
public GameObjectQuery within(int distance)
Filters for only objects whose location is within the specified distance from the players current local point.- Parameters:
distance- The maximum distance from the anchor point (in local units).- Returns:
- True if the object is within the specified distance from the anchor point, false otherwise.
-
at
public GameObjectQuery at(net.runelite.api.coords.WorldPoint point)
Filters by exact WorldPoint.- Parameters:
point- The world point to filter for entities on- Returns:
- GameObjectQuery
-
-