Class AbstractWebNode
- java.lang.Object
-
- org.dreambot.api.methods.walking.web.node.AbstractWebNode
-
- All Implemented Interfaces:
Locatable
- Direct Known Subclasses:
AgilityWebNode
,BankWebNode
,BasicWebNode
,EntranceWebNode
,MagicCarpetWebNode
,SelfConnectingWebNode
,ShipWebNode
,TeleportWebNode
,TollWebNode
public abstract class AbstractWebNode extends java.lang.Object implements Locatable
This is the base class of all web nodes in our WebFinderA few important methods:
execute()
is the method called by the walker to handle this web node, and should return true if it handled the node successfully.hasRequirements()
is used by theWebFinder
to determine if the current player can use this node.isValid()
is used by theWebFinder
to determine if this web node can be used in a path.forceNext()
is checked by the walker to find which node it should execute next. If this returns true then the walker will execute this node next even if it thinks it can reach the web node after.
-
-
Constructor Summary
Constructors Constructor Description AbstractWebNode(int x, int y, int z)
AbstractWebNode(org.dreambot.internal.web.WebNodes.WebNode node)
This shouldn't be used by end users, it's used to load our internal web.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConnections(AbstractWebNode... connections)
double
distance(Tile tile)
Distance (as the crow flies) away from the given tile.boolean
equals(java.lang.Object obj)
boolean
execute()
This is called by the walker to handle the actual walking, entity handling, or whatever else needed to get past this node.boolean
forceNext()
This is used to see if the walker shouldexecute()
this node even if there's a web node further along theGlobalPath
that it can reach.java.util.List<AbstractWebNode>
getConnections()
int
getGridX()
Gets grid (local) X coordinate of the given object.int
getGridY()
Gets grid (local) Y coordinate of the given object.int
getIndex()
Tile
getTile()
Gets tile of the object.TileReference
getTileReference()
Gets tile reference of the given object.WebNodeType
getType()
Returns the WebNodeType of this node, used during path finding to ensure they're not disabled by the scriptint
getWeight()
Returns the extra weight added to the cost of this web node during path findingint
getX()
Gets X coordinate of the given object.int
getY()
Gets Y coordinate of the given object.int
getZ()
Gets Z coordinate of the given object.int
hashCode()
boolean
hasRequirements()
This is used to determine during path finding if the current player can use this nodeboolean
isValid()
Checks the validity of this web node to see if it should be considered at all during path findingvoid
removeConnections(AbstractWebNode... connections)
void
setConnections(java.util.List<AbstractWebNode> connections)
void
setWeight(int weight)
Sets the extra weight added to the cost of this web node during path findingjava.lang.String
toString()
double
walkingDistance(Tile tile)
Walking distance based on pathfinding to the given tile.
-
-
-
Method Detail
-
getWeight
public int getWeight()
Returns the extra weight added to the cost of this web node during path finding- Returns:
- the extra weight of this node
-
setWeight
public void setWeight(int weight)
Sets the extra weight added to the cost of this web node during path findingThe higher this is set, the more it costs during path finding
- Parameters:
weight
- the added cost for this node in approximate tiles
-
getType
public WebNodeType getType()
Returns the WebNodeType of this node, used during path finding to ensure they're not disabled by the script- Returns:
- the type of web node
-
getX
public int getX()
Description copied from interface:Locatable
Gets X coordinate of the given object.
-
hasRequirements
public boolean hasRequirements()
This is used to determine during path finding if the current player can use this node- Returns:
- true if it's usable by the current player, false otherwise
-
getGridX
public int getGridX()
Description copied from interface:Locatable
Gets grid (local) X coordinate of the given object.
-
getGridY
public int getGridY()
Description copied from interface:Locatable
Gets grid (local) Y coordinate of the given object.
-
getZ
public int getZ()
Description copied from interface:Locatable
Gets Z coordinate of the given object.
-
distance
public double distance(Tile tile)
Description copied from interface:Locatable
Distance (as the crow flies) away from the given tile.
-
getTileReference
public TileReference getTileReference()
Description copied from interface:Locatable
Gets tile reference of the given object.- Specified by:
getTileReference
in interfaceLocatable
- Returns:
- the object tile reference.
-
getY
public int getY()
Description copied from interface:Locatable
Gets Y coordinate of the given object.
-
getConnections
public java.util.List<AbstractWebNode> getConnections()
-
setConnections
public void setConnections(java.util.List<AbstractWebNode> connections)
-
addConnections
public void addConnections(AbstractWebNode... connections)
-
removeConnections
public void removeConnections(AbstractWebNode... connections)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getIndex
public int getIndex()
-
execute
public boolean execute()
This is called by the walker to handle the actual walking, entity handling, or whatever else needed to get past this node.- Returns:
- true if the node is successfully handled, false otherwise
-
forceNext
public boolean forceNext()
This is used to see if the walker shouldexecute()
this node even if there's a web node further along theGlobalPath
that it can reach.This defaults to false, meaning that the walker can look for another web node further in the
GlobalPath
.- Returns:
- true if the walker should execute this node next no matter what, false otherwise
-
isValid
public boolean isValid()
Checks the validity of this web node to see if it should be considered at all during path finding- Returns:
- true if it's usable, false otherwise
-
walkingDistance
public double walkingDistance(Tile tile)
Description copied from interface:Locatable
Walking distance based on pathfinding to the given tile.This is a more expensive call than
Locatable.distance(Tile)
, and should be used sparingly.- Specified by:
walkingDistance
in interfaceLocatable
- Parameters:
tile
- the destination tile.- Returns:
- return the path distance movement cost from the given tile as a double. If there isn't a path to the tile, it will return 3 times the as the crow flies distance.
-
-