Class Destination

java.lang.Object
privbot.mechanics.Destination

public final class Destination extends Object
A place to travel to: a name, a tile, how close counts as "there", and optionally a teleport to try first. Immutable; pure (no game reads), safe on any thread.

What it proves: contains(net.runelite.api.coords.WorldPoint) is true only when the point is on the same plane as the tile and within radius tiles of it (square, Chebyshev distance). That is the only meaning of "arrived" in ctx.travel.go: a teleport that lands somewhere else is not arrival.

Unreadable looks like: a null point is never inside.

  • Method Details

    • at

      public static Destination at(String name, net.runelite.api.coords.WorldPoint tile, int radius)
      Parameters:
      name - a plain-words name used in job reasons; blank becomes the tile
      tile - the centre of the place
      radius - how many tiles from the centre still count as there (0 means the exact tile)
      Returns:
      a destination with no teleport
    • viaTeleport

      public Destination viaTeleport(String teleportName)
      Parameters:
      teleportName - the teleport to try once when the player starts far away, as ctx.teleports.to names it; null or blank clears it
      Returns:
      a copy that tries that teleport first
    • name

      public String name()
      Returns:
      the name used in reasons
    • tile

      public net.runelite.api.coords.WorldPoint tile()
      Returns:
      the centre tile
    • radius

      public int radius()
      Returns:
      the arrival radius in tiles
    • teleport

      public String teleport()
      Returns:
      the teleport to try first, or null
    • contains

      public boolean contains(net.runelite.api.coords.WorldPoint p)
      Parameters:
      p - a tile, or null
      Returns:
      true when p is on the same plane and within the radius; false for null
    • distance

      public int distance(net.runelite.api.coords.WorldPoint p)
      Parameters:
      p - a tile, or null
      Returns:
      the Chebyshev distance to the centre, or Integer.MAX_VALUE on another plane or for null
    • toString

      public String toString()
      Overrides:
      toString in class Object