Class CustomWebPath
- java.lang.Object
-
- org.dreambot.api.methods.walking.web.node.CustomWebPath
-
public class CustomWebPath extends java.lang.Object
CustomWebPath is a helper class that makes creating and attaching custom web nodes to our standard web nodes easier
-
-
Constructor Summary
Constructors Constructor Description CustomWebPath(boolean connect, AbstractWebNode... nodes)
Adds each web node to this custom web node path If connect is true, each node will have a two way connection to the previous nodeCustomWebPath(Tile... tiles)
Creates a newBasicWebNode
for each Tile with two way connections between each nodeCustomWebPath(AbstractWebNode... nodes)
seeCustomWebPath(boolean, AbstractWebNode...)
with a default boolean of True
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNode(Tile tile)
seeaddNode(Tile, boolean)
with default of Truevoid
addNode(Tile tile, boolean twoWay)
Creates aBasicWebNode
and adds it to this custom web path usingaddNode(AbstractWebNode, boolean)
void
addNode(AbstractWebNode node)
Adds a web node to this custom path usingaddNode(AbstractWebNode, boolean)
with a default of Truevoid
addNode(AbstractWebNode node, boolean twoWay)
Adds a web node to the end of this path's list.void
addNodes(Tile... tiles)
Adds each Tile usingaddNode(Tile, boolean)
with a default of Truevoid
addNodes(AbstractWebNode... nodes)
Adds each node usingaddNode(AbstractWebNode, boolean)
with a default of Truevoid
attachToWeb()
Attaches this custom web path into the global webboolean
attachToWeb(boolean attachStart, boolean attachEnd)
Attaches this custom web path into the global web Will automatically callconnectStartToClosestNode()
andconnectEndToClosestNode()
based on the parameters passedboolean
connectEndToClosestNode()
This will connect the end of this path to the nearest BasicWebNode whenattachToWeb()
orWebFinder.addCustomWebPath(CustomWebPath)
is calledboolean
connectStartToClosestNode()
This will connect the start of this path to the nearest BasicWebNode whenattachToWeb()
orWebFinder.addCustomWebPath(CustomWebPath)
is called for this path This will NOT cadd this path to the full global web.void
connectToEnd(int nodeIndex)
This will connect the end of this path to the provided node index whenattachToWeb()
orWebFinder.addCustomWebPath(CustomWebPath)
is called for this path This will NOT connect this path to the full global webvoid
connectToStart(int nodeIndex)
This will connect the start of this path to the provided node index whenattachToWeb()
orWebFinder.addCustomWebPath(CustomWebPath)
is called for this path This will NOT add this path to the full global web.AbstractWebNode
getEnd()
java.util.ArrayList<AbstractWebNode>
getNodes()
AbstractWebNode
getStart()
-
-
-
Constructor Detail
-
CustomWebPath
public CustomWebPath(Tile... tiles)
Creates a newBasicWebNode
for each Tile with two way connections between each node- Parameters:
tiles
-Tile
s to add to the custom web path
-
CustomWebPath
public CustomWebPath(AbstractWebNode... nodes)
seeCustomWebPath(boolean, AbstractWebNode...)
with a default boolean of True
-
CustomWebPath
public CustomWebPath(boolean connect, AbstractWebNode... nodes)
Adds each web node to this custom web node path If connect is true, each node will have a two way connection to the previous node- Parameters:
connect
- If True will add two way connections, if False the connection will be one way from previous to currentnodes
-AbstractWebNode
nodes to add to this path
-
-
Method Detail
-
addNode
public void addNode(Tile tile)
seeaddNode(Tile, boolean)
with default of True
-
addNodes
public void addNodes(Tile... tiles)
Adds each Tile usingaddNode(Tile, boolean)
with a default of True
-
addNodes
public void addNodes(AbstractWebNode... nodes)
Adds each node usingaddNode(AbstractWebNode, boolean)
with a default of True
-
addNode
public void addNode(Tile tile, boolean twoWay)
Creates aBasicWebNode
and adds it to this custom web path usingaddNode(AbstractWebNode, boolean)
- Parameters:
tile
- Tile to add as aBasicWebNode
twoWay
- whether the connection should be two way or not to the current last node
-
addNode
public void addNode(AbstractWebNode node)
Adds a web node to this custom path usingaddNode(AbstractWebNode, boolean)
with a default of True
-
addNode
public void addNode(AbstractWebNode node, boolean twoWay)
Adds a web node to the end of this path's list. If twoWay is true, it will do a two way connection to the previous node.- Parameters:
node
-AbstractWebNode
to add to the end of the listtwoWay
- boolean whether the connection should be two way or one way
-
connectToStart
public void connectToStart(int nodeIndex)
This will connect the start of this path to the provided node index whenattachToWeb()
orWebFinder.addCustomWebPath(CustomWebPath)
is called for this path This will NOT add this path to the full global web.- Parameters:
nodeIndex
- The index of the AbstractWebNode to attach this path to
-
connectStartToClosestNode
public boolean connectStartToClosestNode()
This will connect the start of this path to the nearest BasicWebNode whenattachToWeb()
orWebFinder.addCustomWebPath(CustomWebPath)
is called for this path This will NOT cadd this path to the full global web.- Returns:
- true if there's a node within 32 tiles to attach it to, false otherwise
-
connectEndToClosestNode
public boolean connectEndToClosestNode()
This will connect the end of this path to the nearest BasicWebNode whenattachToWeb()
orWebFinder.addCustomWebPath(CustomWebPath)
is calledNote: This should only be called after all web nodes are added, otherwise it'll attach at the wrong point in your custom path This will NOT add this path to the full global web.
- Returns:
- true if there's a node within 32 tiles to attach it to, false otherwise
-
connectToEnd
public void connectToEnd(int nodeIndex)
This will connect the end of this path to the provided node index whenattachToWeb()
orWebFinder.addCustomWebPath(CustomWebPath)
is called for this path This will NOT connect this path to the full global web- Parameters:
nodeIndex
- The index of the AbstractWebNode to attach this path to
-
getStart
public AbstractWebNode getStart()
-
getEnd
public AbstractWebNode getEnd()
-
getNodes
public java.util.ArrayList<AbstractWebNode> getNodes()
-
attachToWeb
public void attachToWeb()
Attaches this custom web path into the global web
-
attachToWeb
public boolean attachToWeb(boolean attachStart, boolean attachEnd)
Attaches this custom web path into the global web Will automatically callconnectStartToClosestNode()
andconnectEndToClosestNode()
based on the parameters passed- Parameters:
attachStart
-attachEnd
-- Returns:
- False if attach start is requested and fails, false if attach end is requested and fails, else true
-
-