Class WebFinder


  • public class WebFinder
    extends java.lang.Object
    Web pathfinding class, generally shouldn't need to be accessed directly
    • 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​(AbstractWebNode start,
                                                     AbstractWebNode destination,
                                                     int maxDepth)
        Calculates a web path with a given start node, destination node, and a maximum depth
        Parameters:
        start - Starting node
        destination - Destination node
        maxDepth - Maximum depth, -1 if no max
        Returns:
        GlobalPath if found, null if not found or maximum depth reached
      • disableWebNodeType

        public void disableWebNodeType​(WebNodeType type)
        Disables a type of web nodes from being used in the pathfinder
        Parameters:
        type - the WebNodeType to disable
      • enableWebNodeType

        public void enableWebNodeType​(WebNodeType type)
        Enables a type of web nodes to be used in the pathfinder
        Parameters:
        type - the WebNodeType to 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)
      • getNodesWithin

        public java.util.ArrayList<AbstractWebNode> getNodesWithin​(int dist,
                                                                   Tile t)
      • removeNode

        public void removeNode​(int idx)
      • addCustomWebPath

        public void addCustomWebPath​(CustomWebPath customWebPath)
      • addBlacklistedNode

        public void addBlacklistedNode​(AbstractWebNode node)
      • clearBlacklist

        public void clearBlacklist()
      • clearCustomNodes

        public void clearCustomNodes()
      • 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()
      • 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.06 which allows for paths up to roughly 6% less optimal.

        Parameters:
        randomization - the randomization factor from 0.00 to 1.00
      • getPathRandomization

        public double getPathRandomization()