Class WebFinder
- java.lang.Object
-
- org.dreambot.api.methods.walking.pathfinding.impl.web.WebFinder
-
public class WebFinder extends java.lang.Object
Web pathfinding class, generally shouldn't need to be accessed directly
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addBlacklistedNode(AbstractWebNode node)
void
addCustomWebPath(CustomWebPath customWebPath)
boolean
addNode(Tile newNodeTarget)
Creates and adds a new BasicWebNode at the provided tile and connects it to the nearest web node in our webvoid
addWebNode(AbstractWebNode node)
This adds a custom web node to our standard web nodes without adding any connections automaticallyvoid
addWebNodes(AbstractWebNode... nodes)
This just calls addWebNode for each web node passed inGlobalPath<AbstractWebNode>
calculate(int x1, int y1, int z1, int x2, int y2, int z2)
GlobalPath<AbstractWebNode>
calculate(Tile start, Tile destination)
GlobalPath<AbstractWebNode>
calculate(WebPathQuery query)
GlobalPath<AbstractWebNode>
calculate(AbstractWebNode start, AbstractWebNode destination)
GlobalPath<AbstractWebNode>
calculate(AbstractWebNode start, AbstractWebNode destination, int maxDepth)
Calculates a web path with a given start node, destination node, and a maximum depthboolean
canUseEquipmentTeleports()
boolean
canUseInventoryTeleports()
void
clearBlacklist()
void
clearCustomNodes()
AbstractWebNode
createAndAddNode(Tile newNodeTarget)
Creates and adds a new BasicWebNode at the provided tile and connects it to the nearest web node in our webvoid
disableEquipmentTeleports()
void
disableInventoryTeleports()
void
disableTeleport(Teleport teleport)
Disables a teleport from being used in the pathfindervoid
disableWebNodeType(WebNodeType type)
Disables a type of web nodes from being used in the pathfindervoid
enableEquipmentTeleports()
void
enableInventoryTeleports()
void
enableTeleport(Teleport teleport)
Re-enables a previously disabled teleport to be used in the pathfindervoid
enableWebNodeType(WebNodeType type)
Re-enables a previously disabled type of web nodes to be used in the pathfinderAbstractWebNode
get(int index)
Returns the web node with the given indexjava.util.List<AbstractWebNode>
getAll()
WebPathQuery
getCurrentPathQuery()
int
getId(AbstractWebNode abstractWebNode)
GlobalPath<AbstractWebNode>
getLastCalculatedPath()
Deprecated.AbstractWebNode
getNearest(Tile target, int threshold)
Gets the closest basic web node to for given argument.AbstractWebNode
getNearest(AbstractWebNode target)
Gets the closest basic web (default 5 tile threshold) node for the given argument.AbstractWebNode
getNearest(AbstractWebNode target, int threshold)
Gets the closest basic web node to for given argument.AbstractWebNode
getNearestGlobal(Tile target, int threshold)
java.util.ArrayList<AbstractWebNode>
getNodesWithin(int dist, Tile t)
double
getPathRandomization()
static WebFinder
getWebFinder()
static boolean
isLoaded()
Checks if the base web nodes have been loaded into the clientstatic void
loadWebNodes()
void
removeNode(int idx)
void
removeNode(AbstractWebNode node)
void
resetWebNodes()
void
setPathRandomization(double randomization)
Sets the randomization factor used when web pathfinding.
-
-
-
Method Detail
-
getWebFinder
public static WebFinder getWebFinder()
-
loadWebNodes
public static void loadWebNodes()
-
isLoaded
public static boolean isLoaded()
Checks if the base web nodes have been loaded into the client- Returns:
- true if loaded, false if still loading
-
calculate
public GlobalPath<AbstractWebNode> calculate(WebPathQuery query)
-
calculate
public GlobalPath<AbstractWebNode> calculate(int x1, int y1, int z1, int x2, int y2, int z2)
-
calculate
public GlobalPath<AbstractWebNode> calculate(Tile start, Tile destination)
-
calculate
public GlobalPath<AbstractWebNode> calculate(AbstractWebNode start, AbstractWebNode destination)
-
calculate
public GlobalPath<AbstractWebNode> calculate(AbstractWebNode start, AbstractWebNode destination, int maxDepth)
Calculates a web path with a given start node, destination node, and a maximum depth- Parameters:
start
- Starting nodedestination
- Destination nodemaxDepth
- Maximum depth, -1 if no max- Returns:
- GlobalPath if found, null if not found or maximum depth reached
-
disableTeleport
public void disableTeleport(Teleport teleport)
Disables a teleport from being used in the pathfinder- Parameters:
teleport
- theTeleport
to disable
-
enableTeleport
public void enableTeleport(Teleport teleport)
Re-enables a previously disabled teleport to be used in the pathfinder- Parameters:
teleport
- theTeleport
to re-enable
-
disableWebNodeType
public void disableWebNodeType(WebNodeType type)
Disables a type of web nodes from being used in the pathfinder- Parameters:
type
- theWebNodeType
to disable
-
enableWebNodeType
public void enableWebNodeType(WebNodeType type)
Re-enables a previously disabled type of web nodes to be used in the pathfinder- Parameters:
type
- theWebNodeType
to re-enable
-
canUseInventoryTeleports
public boolean canUseInventoryTeleports()
-
canUseEquipmentTeleports
public boolean canUseEquipmentTeleports()
-
disableInventoryTeleports
public void disableInventoryTeleports()
-
enableInventoryTeleports
public void enableInventoryTeleports()
-
disableEquipmentTeleports
public void disableEquipmentTeleports()
-
enableEquipmentTeleports
public void enableEquipmentTeleports()
-
getNearest
public AbstractWebNode getNearest(AbstractWebNode target)
Gets the closest basic web (default 5 tile threshold) node for the given argument.Note: This method will only return
BasicWebNode
's.- Parameters:
target
- the target you wish to find the nearest web node of.- Returns:
- the closest basic web node to the given tile if found, otherwise null.
-
getNearest
public AbstractWebNode getNearest(AbstractWebNode target, int threshold)
Gets the closest basic web node to for given argument.Note: This method will only return
BasicWebNode
's.- Parameters:
target
- the target you wish to find the nearest web node of.threshold
- the threshold of search you would like to perform.- Returns:
- the closest basic web node to the given tile if found, otherwise null.
-
getNearest
public AbstractWebNode getNearest(Tile target, int threshold)
Gets the closest basic web node to for given argument.Note: This method will only return
BasicWebNode
's.- Parameters:
target
- the target you wish to find the nearest web node of.threshold
- the threshold of search you would like to perform.- Returns:
- the closest basic web node to the given tile if found, otherwise null.
-
addNode
public boolean addNode(Tile newNodeTarget)
Creates and adds a new BasicWebNode at the provided tile and connects it to the nearest web node in our web- Parameters:
newNodeTarget
- The tile to create a BasicWebNode at- Returns:
- true if successful
-
createAndAddNode
public AbstractWebNode createAndAddNode(Tile newNodeTarget)
Creates and adds a new BasicWebNode at the provided tile and connects it to the nearest web node in our web- Parameters:
newNodeTarget
- The tile to create a BasicWebNode at- Returns:
- the created AbstractWebNode if it successfully finds a nearby node to connect to, null otherwise
-
getNearestGlobal
public AbstractWebNode getNearestGlobal(Tile target, int threshold)
-
getNodesWithin
public java.util.ArrayList<AbstractWebNode> getNodesWithin(int dist, Tile t)
-
removeNode
public void removeNode(int idx)
-
removeNode
public void removeNode(AbstractWebNode node)
-
addCustomWebPath
public void addCustomWebPath(CustomWebPath customWebPath)
-
addBlacklistedNode
public void addBlacklistedNode(AbstractWebNode node)
-
clearBlacklist
public void clearBlacklist()
-
clearCustomNodes
public void clearCustomNodes()
-
getId
public int getId(AbstractWebNode abstractWebNode)
-
addWebNode
public void addWebNode(AbstractWebNode node)
This adds a custom web node to our standard web nodes without adding any connections automatically- Parameters:
node
- The web node to add to our web
-
addWebNodes
public void addWebNodes(AbstractWebNode... nodes)
This just calls addWebNode for each web node passed in- Parameters:
nodes
- the web nodes to add
-
get
public AbstractWebNode get(int index)
Returns the web node with the given index
NOTE: You shouldn't be connecting to our web nodes using this method, as the index can change at any time. You should use
getNearest(Tile, int)
to find the correct node.- Parameters:
index
- the index of the web node- Returns:
- The web node if it exists, null if the nodes haven't been loaded or if it's not found
-
resetWebNodes
public void resetWebNodes()
-
getLastCalculatedPath
@Deprecated public GlobalPath<AbstractWebNode> getLastCalculatedPath()
Deprecated.
-
getAll
public java.util.List<AbstractWebNode> getAll()
-
setPathRandomization
public void setPathRandomization(double randomization)
Sets the randomization factor used when web pathfinding.A value of 0.0 will disable any randomization, and any positive value will allow for less optimal paths to be generated. The default value of this is 0.005 which allows for paths up to roughly 0.5% less optimal paths per web node.
- Parameters:
randomization
- the randomization factor from 0.00 to 1.00
-
getPathRandomization
public double getPathRandomization()
-
getCurrentPathQuery
public WebPathQuery getCurrentPathQuery()
-
-