Class PathFinder<T extends Locatable>
- java.lang.Object
-
- org.dreambot.api.methods.walking.pathfinding.impl.PathFinder<T>
-
- Direct Known Subclasses:
LocalPathFinder
public abstract class PathFinder<T extends Locatable> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description PathFinder(int maxDepth)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addBlacklistedTile(Tile t)
void
addObstacle(PathObstacle po)
****Used By Local Path Finders Only**** Adds an obstacle to the obstacle choices list.void
addWebOnlyObstacleTile(Tile tile)
Adds a tile for the local walker to ignore obstaclesAbstractPath<T>
calculate(int x1, int y1, int x2, int y2)
Calculate a walkable abstract path from the start tile location (sx, sy) to the destination tile location (dx, dy), using data provided by the tile map.AbstractPath<T>
calculate(int x1, int y1, int x2, int y2, int z)
Calculate a walkable abstract path from the start tile location (x1, y1,z) to the destination tile location (x2, y2,z), using data provided by the tile map.abstract AbstractPath<T>
calculate(int x1, int y1, int z1, int x2, int y2, int z2)
Calculates an AbstractPath from the start location (x1,y1,z1) to the destination tile location (x2,y2,z2)AbstractPath<T>
calculate(Tile s, Tile e)
Calculates an AbstractPath from Tile s to Tile evoid
clearBlacklist()
java.lang.String
getDirection(int sx, int sy, int ex, int ey)
float
getMovementCost(int sx, int sy, int ex, int ey, int z)
PathNode
getNode(int x, int y, int z)
PathObstacle
getObstacle(int x, int y, int z, int dir)
boolean
hasObstacle(int x, int y, int z, int dir)
boolean
isBlacklisted(Tile t)
boolean
isDirWall(java.lang.String dir, int flag)
boolean
isInPossibleObstacles(GameObject object)
boolean
isTileWebOnly(Tile tile)
void
removeBlacklistedTile(Tile t)
void
removeObstacle(PathObstacle obstacle)
****Used By Local Path Finders Only**** Removes the obstacle from the available obstacles of this pathfindervoid
removeWebOnlyObstacleTile(Tile tile)
Removes a tile from the web only obstacle tile listvoid
reset()
-
-
-
Method Detail
-
addBlacklistedTile
public void addBlacklistedTile(Tile t)
-
removeBlacklistedTile
public void removeBlacklistedTile(Tile t)
-
isBlacklisted
public boolean isBlacklisted(Tile t)
-
clearBlacklist
public void clearBlacklist()
-
calculate
public AbstractPath<T> calculate(Tile s, Tile e)
Calculates an AbstractPath from Tile s to Tile e- Parameters:
s
- Start Tilee
- End Tile- Returns:
- AbstractPath
-
calculate
public AbstractPath<T> calculate(int x1, int y1, int x2, int y2)
Calculate a walkable abstract path from the start tile location (sx, sy) to the destination tile location (dx, dy), using data provided by the tile map. Assumes z coordinate is 0- Parameters:
x1
- the starting grid X coordinate.y1
- the starting grid Y coordinate.x2
- the destination grid X coordinate.y2
- the destination grid Y coordinate.- Returns:
- the abstract path from the start to destination if a path is found, if unable to find path it will return null.
-
calculate
public AbstractPath<T> calculate(int x1, int y1, int x2, int y2, int z)
Calculate a walkable abstract path from the start tile location (x1, y1,z) to the destination tile location (x2, y2,z), using data provided by the tile map.- Parameters:
x1
- the starting grid X coordinate.y1
- the starting grid Y coordinate.x2
- the destination grid X coordinate.y2
- the destination grid Y coordinate.z
- the z coordinate- Returns:
- the abstract path from the start to destination if a path is found, if unable to find path it will return null.
-
addObstacle
public void addObstacle(PathObstacle po)
****Used By Local Path Finders Only**** Adds an obstacle to the obstacle choices list. When creating the obstacle, give it the obstacle name, action, and then set the three Tile arguments to null.Local Path Finders are AStarPathFinder and DijkstraPathFinder
- Parameters:
po
-
-
removeObstacle
public void removeObstacle(PathObstacle obstacle)
****Used By Local Path Finders Only**** Removes the obstacle from the available obstacles of this pathfinderLocal Path Finders are AStarPathFinder and DijkstraPathFinder
- Parameters:
obstacle
- the obstacle to remove from the pathfinder
-
getMovementCost
public float getMovementCost(int sx, int sy, int ex, int ey, int z)
-
getNode
public PathNode getNode(int x, int y, int z)
-
calculate
public abstract AbstractPath<T> calculate(int x1, int y1, int z1, int x2, int y2, int z2)
Calculates an AbstractPath from the start location (x1,y1,z1) to the destination tile location (x2,y2,z2)- Parameters:
x1
- the starting grid X coordinate.y1
- the starting grid Y coordinate.z1
- the starting grid Z coordinate.x2
- the destination grid X coordinate.y2
- the destination grid Y coordinate.z2
- the destination grid Z coordinate- Returns:
- AbstractPath
-
hasObstacle
public boolean hasObstacle(int x, int y, int z, int dir)
-
getObstacle
public PathObstacle getObstacle(int x, int y, int z, int dir)
-
isInPossibleObstacles
public boolean isInPossibleObstacles(GameObject object)
-
isDirWall
public boolean isDirWall(java.lang.String dir, int flag)
-
getDirection
public java.lang.String getDirection(int sx, int sy, int ex, int ey)
-
addWebOnlyObstacleTile
public void addWebOnlyObstacleTile(Tile tile)
Adds a tile for the local walker to ignore obstacles- Parameters:
tile
- The tile of the obstacle
-
removeWebOnlyObstacleTile
public void removeWebOnlyObstacleTile(Tile tile)
Removes a tile from the web only obstacle tile list- Parameters:
tile
- The tile of the obstacle to be removed
-
isTileWebOnly
public boolean isTileWebOnly(Tile tile)
-
reset
public void reset()
-
-