Package rs.kreme.ksbot.api.game.pathing
Class Reachable
- java.lang.Object
-
- rs.kreme.ksbot.api.game.pathing.Reachable
-
public class Reachable extends java.lang.ObjectUtility class for determining reachable areas, pathfinding around obstacles, and calculating interaction points for NPCs and objects.
-
-
Constructor Summary
Constructors Constructor Description Reachable(rs.kreme.ksbot.api.KSContext ctx)Creates a new ReachableArea instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanMelee(net.runelite.api.coords.WorldArea first, net.runelite.api.coords.WorldArea other)Checks if two areas are in melee distance of each other Considers walls and obstacles between the areasbooleancanTravelInDirection(net.runelite.api.coords.WorldArea w1, int dx, int dy)Checks if travel is possible in a specific direction from an areabooleancanTravelInDirection(net.runelite.api.coords.WorldArea w1, int dx, int dy, java.util.function.Predicate<? super net.runelite.api.coords.WorldPoint> extraCondition)Checks if travel is possible in a specific direction from an area with an additional custom conditionjava.util.List<net.runelite.api.coords.WorldPoint>findSafePath(net.runelite.api.coords.WorldPoint npcLocation, int npcSize, java.util.Collection<DangerousTile> dangerous)Finds a safe path to an NPC that avoids dangerous areasnet.runelite.api.PointgetComparisonPoint(net.runelite.api.coords.WorldArea first, net.runelite.api.coords.WorldArea other)Gets the closest point on the first area to the second area Used for determining interaction points between areasjava.util.List<net.runelite.api.coords.WorldPoint>getHitSquares(net.runelite.api.coords.WorldPoint npcLoc, int npcSize, int thickness, boolean includeUnder)Gets all tiles within a specified distance of a square NPC or objectjava.util.List<net.runelite.api.coords.WorldPoint>getHitSquares(net.runelite.api.coords.WorldPoint npcLoc, int width, int height, int thickness, boolean includeUnder)Gets all tiles within a specified distance of an NPC or objectjava.util.List<net.runelite.api.coords.WorldPoint>getInteractable(net.runelite.api.coords.WorldArea locatableArea)Gets all tiles that can interact with the specified area (melee range)booleanisInteractable(net.runelite.api.coords.WorldArea locatableArea)Checks if any tile in the specified area can be interacted withbooleanisObstacle(net.runelite.api.coords.WorldPoint worldPoint)Checks if a tile is an obstacle based on its collision flag
-
-
-
Method Detail
-
isInteractable
public boolean isInteractable(net.runelite.api.coords.WorldArea locatableArea)
Checks if any tile in the specified area can be interacted with- Parameters:
locatableArea- The area to check for interactability- Returns:
- true if any tile in the area can be interacted with
-
getInteractable
public java.util.List<net.runelite.api.coords.WorldPoint> getInteractable(net.runelite.api.coords.WorldArea locatableArea)
Gets all tiles that can interact with the specified area (melee range)- Parameters:
locatableArea- The area to find interttaction tiles for- Returns:
- List of tiles that can interact with the specified area
-
canMelee
public boolean canMelee(net.runelite.api.coords.WorldArea first, net.runelite.api.coords.WorldArea other)Checks if two areas are in melee distance of each other Considers walls and obstacles between the areas- Parameters:
first- The first areaother- The second area- Returns:
- true if the areas can melee each other
-
getHitSquares
public java.util.List<net.runelite.api.coords.WorldPoint> getHitSquares(net.runelite.api.coords.WorldPoint npcLoc, int width, int height, int thickness, boolean includeUnder)Gets all tiles within a specified distance of an NPC or object- Parameters:
npcLoc- Location of the NPC or objectwidth- Width of the NPC or objectheight- Height of the NPC or objectthickness- Distance from the NPC or object edges to includeincludeUnder- Whether to include tiles underneath the NPC/object- Returns:
- List of tiles within the specified range
-
getHitSquares
public java.util.List<net.runelite.api.coords.WorldPoint> getHitSquares(net.runelite.api.coords.WorldPoint npcLoc, int npcSize, int thickness, boolean includeUnder)Gets all tiles within a specified distance of a square NPC or object- Parameters:
npcLoc- Location of the NPC or objectnpcSize- Size of the NPC or object (both width and height)thickness- Distance from the NPC or object edges to includeincludeUnder- Whether to include tiles underneath the NPC/object- Returns:
- List of tiles within the specified range
-
getComparisonPoint
public net.runelite.api.Point getComparisonPoint(net.runelite.api.coords.WorldArea first, net.runelite.api.coords.WorldArea other)Gets the closest point on the first area to the second area Used for determining interaction points between areas- Parameters:
first- The first areaother- The second area- Returns:
- The closest point on the first area to the second area
-
isObstacle
public boolean isObstacle(net.runelite.api.coords.WorldPoint worldPoint)
Checks if a tile is an obstacle based on its collision flag- Parameters:
worldPoint- The world point to check- Returns:
- true if the point is an obstacle
-
canTravelInDirection
public boolean canTravelInDirection(net.runelite.api.coords.WorldArea w1, int dx, int dy)Checks if travel is possible in a specific direction from an area- Parameters:
w1- The starting areadx- X direction (positive = east, negative = west)dy- Y direction (positive = north, negative = south)- Returns:
- true if travel is possible
-
canTravelInDirection
public boolean canTravelInDirection(net.runelite.api.coords.WorldArea w1, int dx, int dy, java.util.function.Predicate<? super net.runelite.api.coords.WorldPoint> extraCondition)Checks if travel is possible in a specific direction from an area with an additional custom condition- Parameters:
w1- The starting areadx- X direction (positive = east, negative = west)dy- Y direction (positive = north, negative = south)extraCondition- Additional condition that must be true for all tiles- Returns:
- true if travel is possible
-
findSafePath
public java.util.List<net.runelite.api.coords.WorldPoint> findSafePath(net.runelite.api.coords.WorldPoint npcLocation, int npcSize, java.util.Collection<DangerousTile> dangerous)Finds a safe path to an NPC that avoids dangerous areas- Parameters:
npcLocation- The location of the NPCnpcSize- The size of the NPCdangerous- Collection of dangerous tiles to avoid- Returns:
- List of world points forming a path to the NPC
-
-