Interface IWalkingAPI


  • public interface IWalkingAPI
    • Field Detail

      • NO_SLEEP

        static final java.util.function.Function<APIContext,​java.lang.Boolean> NO_SLEEP
      • SLEEP

        static final java.util.function.Function<APIContext,​java.lang.Boolean> SLEEP
    • Method Detail

      • setSleepFunction

        void setSleepFunction​(java.util.function.Function<APIContext,​java.lang.Boolean> sleepFunction)
        Set the sleep function used after clicking on the minimap or a tile to walk to on screen. By default the API uses SLEEP and it's implementation looks like this:
        
         boolean moving = Time.sleep(1000, () -> ctx.localPlayer().isMoving(), 5);
         if(!moving)
             return false;
        	Time.sleep(500, 1200, () -> !ctx.localPlayer().isMoving(), 200);
        	return moving;
         
         }
        Use NO_SLEEP which simply returns true if you want NO sleeping at all.
        Parameters:
        sleepFunction -
      • walkTo

        boolean walkTo​(Locatable destination)
        Walks towards the destination. The path is calculated with the available collision data of the current scene. When the destination tile is outside the current scene it will attempt to walk in a straight line.
        Parameters:
        destination - the destination
        Returns:
        true if we are attempting to walk towards the destination, false otherwise
        See Also:
        findPath(Locatable)
      • walkTo

        boolean walkTo​(Locatable destination,
                       double precision)
        Walks towards the destination with precision. The path is calculated with the available collision data of the current scene. When the destination tile is outside the current scene it will attempt to walk in a straight line.
        Parameters:
        destination - the destination
        precision - how far off the destination this path is considered completed
        Returns:
        true if we are attempting to walk towards the destination, false otherwise
        See Also:
        findPath(Locatable, double)
      • walkToOnScreen

        boolean walkToOnScreen​(Locatable destination)
        Walks towards the destination by clicking on screen. The path is calculated with the available collision data of the current scene. When the destination tile is outside the current scene it will attempt to walk in a straight line.
        Parameters:
        destination - the destination
        Returns:
        true if we are attempting to walk towards the destination, false otherwise
        See Also:
        findPathOnScreen(Locatable)
      • walkToOnScreen

        boolean walkToOnScreen​(Locatable destination,
                               double precision)
        Walks towards the destination with precision by clicking on screen. The path is calculated with the available collision data of the current scene. When the destination tile is outside the current scene it will attempt to walk in a straight line.
        Parameters:
        destination - the destination
        precision - how far off the destination this path is considered completed
        Returns:
        true if we are attempting to walk towards the destination, false otherwise
        See Also:
        findPathOnScreen(Locatable, double)
      • walkOnMap

        boolean walkOnMap​(Locatable destination)
        Clicks the given destination on the minimap to walk towards it.
        Parameters:
        destination - the destination
        Returns:
        true if we are attempting to walk towards the destination, false otherwise
      • walkOnMap

        boolean walkOnMap​(Locatable destination,
                          double precision)
        Clicks the given destination on the minimap to walk towards with precision.
        Parameters:
        destination - the destination
        precision - how far off the destination this path is considered completed
        Returns:
        true if we are attempting to walk towards the destination, false otherwise
      • walkOnScreen

        boolean walkOnScreen​(Locatable destination)
        Click the given destination tile on screen.
        Parameters:
        destination - the destination on screen to click
        Returns:
        true if we are attempting to walk towards the destination, false otherwise
      • walkOnScreen

        boolean walkOnScreen​(Locatable destination,
                             double precision)
        Click the given destination tile on screen.
        Parameters:
        destination - the destination on screen to click
        precision - how far off the destination this path is considered completed
        Returns:
        true if we are attempting to walk towards the destination, false otherwise
      • walkPath

        boolean walkPath​(Tile[] tilePath)
        Walks along the given path.
        Parameters:
        tilePath - the tiles of the path to follow
        Returns:
        true if we are attempting to walk towards the destination, false otherwise
      • walkPath

        boolean walkPath​(Tile[] tilePath,
                         double precision)
        Walks along the given path with precision.
        Parameters:
        tilePath - the tiles of the path to follow
        precision - how far off the destination this path is considered completed
        Returns:
        true if we are attempting to walk towards the destination, false otherwise
      • walkPathOnScreen

        boolean walkPathOnScreen​(Tile[] tilePath)
        Walks along the given path on screen.
        Parameters:
        tilePath - the tiles of the path to follow
        Returns:
        true if we are attempting to walk towards the destination, false otherwise
      • walkPathOnScreen

        boolean walkPathOnScreen​(Tile[] tilePath,
                                 double precision)
        Walks along the given path on screen with precision.
        Parameters:
        tilePath - the tiles of the path to follow
        precision - how far off the destination this path is considered completed
        Returns:
        true if we are attempting to walk towards the destination, false otherwise
      • findPath

        LocalPath findPath​(Locatable destination)
        Finds a local path. This path is built using available collision data of the current scene.
        Parameters:
        destination - the destination
        Returns:
        the local path
        See Also:
        LocalPath
      • findPath

        LocalPath findPath​(Locatable destination,
                           double precision)
        Finds a local path. This path is built using available collision data of the current scene.
        Parameters:
        destination - the destination
        precision - how far off the destination this path is considered completed
        Returns:
        the local path
        See Also:
        LocalPath
      • findPath

        LocalPath findPath​(Locatable origin,
                           Locatable destination)
        Finds a local path. This path is built using available collision data of the current scene.
        Parameters:
        origin - the origin to calculate from
        destination - the destination
        Returns:
        the local path
        See Also:
        LocalPath
      • findPath

        LocalPath findPath​(Locatable origin,
                           Locatable destination,
                           double precision)
        Finds a local path. This path is built using available collision data of the current scene.
        Parameters:
        origin - the origin to calculate from
        destination - the destination
        precision - how far off the destination this path is considered completed
        Returns:
        the local path
        See Also:
        LocalPath
      • findPathOnScreen

        ScreenPath findPathOnScreen​(Locatable destination)
        Finds a screen path.
        Parameters:
        destination - the destination
        Returns:
        the screen path
        See Also:
        ScreenPath
      • findPathOnScreen

        ScreenPath findPathOnScreen​(Locatable destination,
                                    double precision)
        Finds a screen path.
        Parameters:
        destination - the destination
        precision - how far off the destination this path is considered completed
        Returns:
        the screen path
        See Also:
        ScreenPath
      • getNext

        Tile getNext​(Tile[] tiles)
        Gets the next best available tile to use.
        Parameters:
        tiles - the tile array
        Returns:
        the next tile or null if no tile can be used to traverse the given path
      • getNextOnScreen

        Tile getNextOnScreen​(Tile[] tiles)
        Gets the next best available tile to use on screen.
        Parameters:
        tiles - the tile array
        Returns:
        the next tile or null if no tile can be used to traverse the given path
      • getClosestTileOnMap

        Tile getClosestTileOnMap​(Locatable destination)
        Gets the closest tile on the minimap towards the given destination.
        Parameters:
        destination - the destination you want to get to
        Returns:
        closest till on screen or null
      • getClosestTileOnScreen

        Tile getClosestTileOnScreen​(Locatable destination)
        Gets the closest tile that is on screen towards the given destination.
        Parameters:
        destination - the destination you want to get to
        Returns:
        closest till on screen or null
      • getDestination

        Tile getDestination()
        Gets the current walking destination.
        Returns:
        Tile or null
      • isWalkingTo

        default boolean isWalkingTo​(Locatable destination)
        Determines if we are walking towards the given destination.
        Parameters:
        destination - the destination
        Returns:
        true if we are walking towards it, false otherwise
      • isWalkingTo

        boolean isWalkingTo​(Locatable destination,
                            double precision)
        Determines if we are walking towards the given destination with precision.
        Parameters:
        destination - the destination
        precision - how far off the destination is still considered OK
        Returns:
        true if we are walking towards it, false otherwise
      • getBlockingObjectBetween

        SceneObject getBlockingObjectBetween​(Locatable start,
                                             Locatable end)
        Searches for a local blocking object between two tiles provided and returns it if it exists.
        Parameters:
        start - The first tile to search for a blocking object at.
        end - The second tile to search for a blocking object at.
        Returns:
        The SceneObject between the 2 tiles if it exists. null otherwise.
      • getRunEnergy

        int getRunEnergy()
        Gets the current run energy.
        Returns:
        int
      • isRunEnabled

        boolean isRunEnabled()
        Gets whether or not running is enabled.
        Returns:
        true if enabled, false otherwise
      • setRun

        boolean setRun​(boolean enabled)
        Toggles running by using the running orb.
        Parameters:
        enabled - whether or not to enable running
        Returns:
        true if successful, false otherwise
      • getCollisionOffset

        Tile getCollisionOffset​(int plane)
      • getCollisionFlags

        int[][] getCollisionFlags​(int plane)
      • getTileFlags

        byte[][][] getTileFlags()
      • getTileHeights

        int[][][] getTileHeights()