com.epicbot.api.os.methods

Class Calculations

• java.lang.Object
• com.epicbot.api.os.methods.Calculations

• public class Calculations
extends java.lang.Object
Game world and projection calculations.
• Constructor Summary

Constructors
Constructor and Description
Calculations()
• Method Summary

Methods
Modifier and Type Method and Description
static double distance(int x1, int y1, int x2, int y2)
Calculates the distance between two tiles.
static double distance(Locatable loc1, Locatable loc2)
Calculates the distance between two locatables.
static double distance(java.awt.Point curr, java.awt.Point dest)
Calculates the distance between two points.
static double distance(RegionOffset tile1, RegionOffset tile2)
Calculates the distance between two region offsets.
static double distanceTo(int x, int y)
Calculates the distance between the local player and a tile.
static double distanceTo(Locatable locatable)
Calculates the distance between the local player and a locatable.
static double distanceTo(RegionOffset offset)
Calculates the distance between the local player and a region offset.
static void drawOnScreenArea(java.awt.Graphics g)
static Tile getTileOnScreen(Tile tile)
Will return the closest tile that is on screen to the given tile.
static java.awt.Point groundToScreen(int x, int z, int height)
Returns the screen location of a given point on the ground.
static boolean pointOnScreen(int x, int y)
Checks whether a point is within the rectangle that determines the bounds of game screen.
static boolean pointOnScreen(java.awt.Point check)
Checks whether a point is within the rectangle that determines the bounds of game screen.
static int tileHeight(int x, int z)
Returns the height of the ground at the given location in the game world.
static boolean tileOnMap(Tile t)
Checks whether or not a given tile is on the minimap.
static boolean tileOnScreen(Tile t)
Checks whether or not a given tile is on the screen.
static java.awt.Point tileToMinimap(Tile t)
Returns the Point on screen where a given tile is shown on the minimap.
static java.awt.Point tileToScreen(Tile tile)
Returns the screen location of the south-west corner of the given tile.
static java.awt.Point tileToScreen(Tile tile, double dX, double dY, int height)
Returns the screen location of a Tile with given 3D x, y and height offset values.
static java.awt.Point tileToScreen(Tile tile, int height)
Returns the screen location of a Tile with a given 3D height offset.
static java.awt.Point worldToMinimap(double x, double y)
Returns the screen Point of given absolute x and y values in the game's 3D plane.
static java.awt.Point worldToScreen(int x, int y, int z)
Returns the screen location of a given 3D point in the game world.
static void worldToScreen(int x, int y, int z, int[] buffer)
• Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• Field Detail

• CURVE_SIN

public static final int[] CURVE_SIN
• CURVE_COS

public static final int[] CURVE_COS
• Constructor Detail

• Calculations

public Calculations()
• Method Detail

• tileOnMap

public static boolean tileOnMap(Tile t)
Checks whether or not a given tile is on the minimap.
Parameters:
t - The Tile to check.
Returns:
true if the Tile is on the minimap; otherwise false.
tileToMinimap(Tile)
• tileOnScreen

public static boolean tileOnScreen(Tile t)
Checks whether or not a given tile is on the screen.
Parameters:
t - The Tile to check.
Returns:
true if the Tile is on the screen; otherwise false.
• tileToMinimap

public static java.awt.Point tileToMinimap(Tile t)
Returns the Point on screen where a given tile is shown on the minimap.
Parameters:
t - The Tile to check.
Returns:
Point within minimap; otherwise new Point(-1, -1).
• pointOnScreen

public static boolean pointOnScreen(java.awt.Point check)
Checks whether a point is within the rectangle that determines the bounds of game screen.
Parameters:
check - The point to check.
Returns:
true if the point is within the rectangle; otherwise false.
pointOnScreen(int, int)
• pointOnScreen

public static boolean pointOnScreen(int x,
int y)
Checks whether a point is within the rectangle that determines the bounds of game screen. This will work fine when in fixed mode. In resizeable mode it will exclude any points that are less than 253 pixels from the right of the screen or less than 169 pixels from the bottom of the screen, giving a rough area.
Parameters:
x - x-coordinate
y - y-coordinate
Returns:
true if the point is within the rectangle; otherwise false.
• drawOnScreenArea

public static void drawOnScreenArea(java.awt.Graphics g)
• getTileOnScreen

public static Tile getTileOnScreen(Tile tile)
Will return the closest tile that is on screen to the given tile.
Parameters:
tile - Tile you want to get to.
Returns:
Tile that is onScreen.
• tileToScreen

public static java.awt.Point tileToScreen(Tile tile,
double dX,
double dY,
int height)
Returns the screen location of a Tile with given 3D x, y and height offset values.
Parameters:
tile - Tile for which the screen location should be calculated.
dX - Distance from bottom left of the tile to bottom right. Ranges from 0-1;
dY - Distance from bottom left of the tile to top left. Ranges from 0-1;
height - Height to return the Point at. Use 1 for tables, 0 by default.
Returns:
Point based on position on the game plane; otherwise new Point(-1, -1).
• tileToScreen

public static java.awt.Point tileToScreen(Tile tile,
int height)
Returns the screen location of a Tile with a given 3D height offset.
Parameters:
tile - Tile for which the screen location should be calculated.
height - Height to return the Point at. Use 1 for tables, 0 by default.
Returns:
Point based on position on the game plane; if null new Point(-1, -1).
tileToScreen(Tile, double, double, int)
• tileToScreen

public static java.awt.Point tileToScreen(Tile tile)
Returns the screen location of the south-west corner of the given tile.
Parameters:
tile - Tile for which the screen location should be calculated.
Returns:
Center Point of the Tile at a height of 0; if null new Point(-1, -1).
tileToScreen(Tile, int)
• distance

public static double distance(Locatable loc1,
Locatable loc2)
Calculates the distance between two locatables.
Parameters:
loc1 - first locatable
loc2 - second locatable
Returns:
the distance between the two locatables or 0 if any of them are invalid
• distance

public static double distance(RegionOffset tile1,
RegionOffset tile2)
Calculates the distance between two region offsets.
Parameters:
tile1 - first region offset
tile2 - second region offset
Returns:
the distance between the two region offsets
• distance

public static double distance(java.awt.Point curr,
java.awt.Point dest)
Calculates the distance between two points.
Parameters:
curr - The first point.
dest - The second point.
Returns:
The distance between the two points, using the distance formula.
• distance

public static double distance(int x1,
int y1,
int x2,
int y2)
Calculates the distance between two tiles.
Parameters:
x1 - first x-coordinate
y1 - first y-coordinate
x2 - second x-coordinate
y2 - second y-coordinate
Returns:
the distance between the two tiles
• distanceTo

public static double distanceTo(Locatable locatable)
Calculates the distance between the local player and a locatable.
Parameters:
locatable - target to calculate distance to
Returns:
the distance between the local player and the locatable
• distanceTo

public static double distanceTo(RegionOffset offset)
Calculates the distance between the local player and a region offset.
Parameters:
offset - target to calculate distance to
Returns:
the distance between the local player and the region offset
• distanceTo

public static double distanceTo(int x,
int y)
Calculates the distance between the local player and a tile.
Parameters:
x - x-coordinate of the tile
y - y-coordinate of the tile
Returns:
the distance between the local player and the tile
• worldToMinimap

public static java.awt.Point worldToMinimap(double x,
double y)
Returns the screen Point of given absolute x and y values in the game's 3D plane.
Parameters:
x - x value based on the game plane.
y - y value based on the game plane.
Returns:
Point within minimap; otherwise new Point(-1, -1).
• groundToScreen

public static java.awt.Point groundToScreen(int x,
int z,
int height)
Returns the screen location of a given point on the ground. This accounts for the height of the ground at the given location.
Parameters:
x - x value based on the game plane.
z - z value based on the game plane.
height - height offset.
Returns:
Point based on screen; otherwise new Point(-1, -1).
• tileHeight

public static int tileHeight(int x,
int z)
Returns the height of the ground at the given location in the game world.
Parameters:
x - x value based on the game plane.
z - z value based on the game plane.
Returns:
The ground height at the given location; otherwise 0.
• worldToScreen

public static java.awt.Point worldToScreen(int x,
int y,
int z)
Returns the screen location of a given 3D point in the game world.
Parameters:
x - x value on the game plane.
y - y value on the game plane.
z - z value on the game plane.
Returns:
Point based on screen; otherwise new Point(-1, -1).
• worldToScreen

public static void worldToScreen(int x,
int y,
int z,
int[] buffer)