Class Area

java.lang.Object
com.epicbot.api.shared.model.Area

public class Area extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Area(int swX, int swY, int neX, int neY)
    Creates a ground-level (plane = 0) rectangular area from x,y pairs representing south-west and north-east corners.
    Area(int plane, int swX, int swY, int neX, int neY)
    Creates a rectangular area from x,y pairs representing south-west and north-east corners.
    Area(int plane, Locatable... locatables)
    Creates a polygonal area from the given locatables.
    Area(int plane, Locatable sw, Locatable ne)
    Creates a rectangular area from south-west and north-east locatables.
    Area(Locatable... locatables)
    Creates polygonal area from the given locatables.
    Area(Locatable center, int radius)
    Creates a rectangular area (plane = center.getPlane()) with a radius around the given center.
    Creates a rectangular area from south-west and north-east locatables.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(int x, int y)
    Appends a point to this area.
    void
    add(Locatable locatable)
    Appends a locatable to this area.
    boolean
    contains(int x, int y)
    Determines if the x,y pair is contained in this area.
    boolean
    contains(int plane, int x, int y)
    Determines if the x,y pair is contained in this area.
    boolean
    contains(int plane, Locatable... locatables)
    Determines if at least one of the given locatables is contained in this area.
    boolean
    contains(Locatable... locatables)
    Determines if at least one of the given locatables is contained in this area.
    boolean
    containsAll(int plane, Locatable... locatables)
    Determines if every given locatable is contained in this area.
    boolean
    containsAll(Locatable... locatables)
    Determines if every given locatable is contained in this area.
    void
    draw(PaintContext paintContext)
     
    void
    draw(PaintContext paintContext, Color color)
     
     
    Gets the averaged center tile of this area.
    int
     
    Finds the nearest tile in this area to the local player.
    Finds the nearest tile in this area to the base tile.
    int
     
    Gets a random tile within this area.
     
     
    int
     
    int
     
    int
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Area

      public Area(Locatable sw, Locatable ne)
      Creates a rectangular area from south-west and north-east locatables. The plane of this area will be taken from the first locatable.
      Parameters:
      sw - the south-west locatable of this area.
      ne - the north-east locatable of this area.
    • Area

      public Area(Locatable... locatables)
      Creates polygonal area from the given locatables. The plane of this area will be taken from the first locatable.
      Parameters:
      locatables - the locatables to create the area from.
    • Area

      public Area(Locatable center, int radius)
      Creates a rectangular area (plane = center.getPlane()) with a radius around the given center.
      Parameters:
      center - the center.
      radius - the radius of the area
    • Area

      public Area(int swX, int swY, int neX, int neY)
      Creates a ground-level (plane = 0) rectangular area from x,y pairs representing south-west and north-east corners.
      Parameters:
      swX - the x coordinate of the south-west corner, or the left side.
      swY - the y coordinate of the south-west corner, or the bottom side.
      neX - the x coordinate of the north-east corner, or the right side.
      neY - the y coordinate of the north-east corner, or the top side.
    • Area

      public Area(int plane, int swX, int swY, int neX, int neY)
      Creates a rectangular area from x,y pairs representing south-west and north-east corners.
      Parameters:
      plane - the z-plane of this area.
      swX - the x coordinate of the south-west corner, or the left side.
      swY - the y coordinate of the south-west corner, or the bottom side.
      neX - the x coordinate of the north-east corner, or the right side.
      neY - the y coordinate of the north-east corner, or the top side.
    • Area

      public Area(int plane, Locatable sw, Locatable ne)
      Creates a rectangular area from south-west and north-east locatables.
      Parameters:
      plane - the z-plane of this area.
      sw - the south-west locatable of this area.
      ne - the north-east locatable of this area.
    • Area

      public Area(int plane, Locatable... locatables)
      Creates a polygonal area from the given locatables.
      Parameters:
      plane - the z-plane of this area.
      locatables - the locatables to create the area from.
  • Method Details

    • add

      public void add(Locatable locatable)
      Appends a locatable to this area.
      Parameters:
      locatable - the locatable to add.
    • add

      public void add(int x, int y)
      Appends a point to this area.
      Parameters:
      x - the x coordinate.
      y - the y coordinate.
    • contains

      public boolean contains(int x, int y)
      Determines if the x,y pair is contained in this area.
      Parameters:
      x - the x coordinate.
      y - the y coordinate.
      Returns:
      whether the given x,y pair exists inside this area.
    • contains

      public boolean contains(int plane, int x, int y)
      Determines if the x,y pair is contained in this area.
      Parameters:
      plane - the z-plane to test on, can be -1
      x - the x coordinate.
      y - the y coordinate.
      Returns:
      whether the given x,y pair exists inside this area on the given plane.
    • contains

      public boolean contains(int plane, Locatable... locatables)
      Determines if at least one of the given locatables is contained in this area.
      Parameters:
      plane - the z-plane to test the locatables on.
      locatables - the locatables to assess.
      Returns:
      whether any of the locatables exists inside this area on the given plane.
    • contains

      public boolean contains(Locatable... locatables)
      Determines if at least one of the given locatables is contained in this area.
      Parameters:
      locatables - the locatables to assess.
      Returns:
      whether any of the locatables exists inside this area.
    • containsAll

      public boolean containsAll(int plane, Locatable... locatables)
      Determines if every given locatable is contained in this area.
      Parameters:
      plane - the z-plane to test the locatables on.
      locatables - the locatables to assess.
      Returns:
      whether all the locatables exist inside this area on the given plane.
    • containsAll

      public boolean containsAll(Locatable... locatables)
      Determines if every given locatable is contained in this area.
      Parameters:
      locatables - the locatables to assess.
      Returns:
      whether all the locatables exist inside this area.
    • getCentralTile

      public Tile getCentralTile()
      Gets the averaged center tile of this area.
      Returns:
      Tile
    • getRandomTile

      public Tile getRandomTile()
      Gets a random tile within this area.
      Returns:
      Tile
    • getHeight

      public int getHeight()
      Returns:
      the difference between the two vertical maximums of this area.
    • getBounds

      public Rectangle getBounds()
      Returns:
      a Rectangle which completely envelops this area.
    • getNearestTile

      public Tile getNearestTile(APIContext ctx)
      Finds the nearest tile in this area to the local player.
      Parameters:
      ctx - APIContext
      Returns:
      the nearest tile contained in this area relative to the local player.
    • getNearestTile

      public Tile getNearestTile(Tile base, APIContext ctx)
      Finds the nearest tile in this area to the base tile.
      Parameters:
      base - the tile to act as relative tile.
      ctx - APIContext
      Returns:
      the nearest tile contained in this area relative to the base tile.
    • getTiles

      public Tile[] getTiles()
      Returns:
      an array of all the contained tiles in this area.
    • getPlane

      public int getPlane()
      Returns:
      the plane of this area.
    • getTileArray

      public Tile[] getTileArray()
      Returns:
      an array of the bounding tiles used to make the area.
    • getWidth

      public int getWidth()
      Returns:
      the difference between the two horizontal maximums of this area.
    • getX

      public int getX()
      Returns:
      the left most side of this area.
    • getY

      public int getY()
      Returns:
      the top most side of this area.
    • draw

      public void draw(PaintContext paintContext)
    • draw

      public void draw(PaintContext paintContext, Color color)