Package org.dreambot.api.methods
Class ViewportTools
- java.lang.Object
-
- org.dreambot.api.methods.ViewportTools
-
-
Field Summary
Fields Modifier and Type Field Description static int[]
CURVE_COS
static int[]
CURVE_SIN
static int
LOCAL_XY_SHIFT
-
Constructor Summary
Constructors Constructor Description ViewportTools()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
drawModel(java.awt.Graphics2D g, int gridX, int gridY, int z, Model model)
static int
getAbsoluteXCoordinate()
static int
getAbsoluteYCoordinate()
java.awt.Rectangle
getBoundingBox(int[][] vertex)
static java.awt.Rectangle
getCanvasRectangle()
static java.awt.Shape
getClickableArea()
static java.awt.Rectangle
getFullCanvasRectangle()
java.awt.Point
getMiniMapCoordinate(int destinationX, int destinationY)
java.awt.geom.Area
getModelArea(int gridX, int gridY, int z, Model model)
java.awt.geom.Area
getModelArea(int gridX, int gridY, int z, Model model, boolean predictMovement)
java.awt.geom.Area
getModelArea(Entity target)
java.awt.geom.Area
getModelArea(Entity target, boolean predictMovement)
java.awt.Rectangle
getModelBoundingBox(int gridX, int gridY, int z, Model model)
java.util.List<java.awt.Point>
getPoints(java.awt.geom.Area area)
static java.awt.Point
getRandomPointOnCanvas()
static int
getRandomXCoordOnCanvas()
static int
getRandomYCoordOnCanvas()
int[]
getScreenCoordinates(int gridX, int gridY, int plane, int height)
int[][]
getScreenCoordinates(int gridX, int gridY, int plane, Model model)
java.awt.Point
getScreenCoordinatesPoint(int gridX, int gridY, int plane, int height)
java.awt.Point
getSuitablePointFor(java.awt.geom.Area area)
java.awt.Point
getSuitablePointFor(java.awt.Rectangle box)
java.awt.Point
getSuitablePointForModel(int gridX, int gridY, int z, Model model, boolean predictMovement)
int
getTileHeight(int tileX, int tileY, int tilePlane)
Calculates the tile height for offset specified tileint[][]
getTriangluatedFaces(int gridX, int gridY, int plane, Model model, int triangle)
java.util.List<java.awt.Point>
getVertices(Model structure)
boolean
isOnGameScreen(double x, double y)
boolean
isOnGameScreen(java.awt.Point point)
Determines if point is on the game screen.boolean
isVisibleOnCanvas(java.awt.geom.Area area)
boolean
isVisibleOnCanvas(java.awt.Rectangle rectangle)
boolean
isVisibleOnMainScreen(int x, int y)
boolean
isVisibleOnMainScreen(java.awt.Point p)
boolean
isVisibleOnMainScreen(java.awt.Shape shape)
java.awt.Point
localTileToScreen(Tile tile)
Local tile to offset screen position.java.awt.Point
tileToScreen(int tileX, int tileY, double offsetX, double offsetY, int tileHeight)
Tile to offset screen position.java.awt.Point
tileToScreen(int x, int y, int tileHeight)
Converts offset set of local coordinates into their screen positionsjava.awt.Point
tileToScreen(Tile tile)
World tile to offset regional tile and converts that regional tile into offset position on the game screen.
-
-
-
Field Detail
-
CURVE_SIN
public static final int[] CURVE_SIN
-
CURVE_COS
public static final int[] CURVE_COS
-
LOCAL_XY_SHIFT
public static final int LOCAL_XY_SHIFT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAbsoluteYCoordinate
public static int getAbsoluteYCoordinate()
-
getAbsoluteXCoordinate
public static int getAbsoluteXCoordinate()
-
getRandomXCoordOnCanvas
public static int getRandomXCoordOnCanvas()
-
getFullCanvasRectangle
public static java.awt.Rectangle getFullCanvasRectangle()
-
getRandomYCoordOnCanvas
public static int getRandomYCoordOnCanvas()
-
getRandomPointOnCanvas
public static java.awt.Point getRandomPointOnCanvas()
-
getClickableArea
public static java.awt.Shape getClickableArea()
-
getCanvasRectangle
public static java.awt.Rectangle getCanvasRectangle()
-
tileToScreen
public java.awt.Point tileToScreen(Tile tile)
World tile to offset regional tile and converts that regional tile into offset position on the game screen.- Specified by:
tileToScreen
in interfaceViewport
- Parameters:
tile
- tile- Returns:
- A point representing the screen coordinate, if not on game screen returns (-1,-1).
-
tileToScreen
public java.awt.Point tileToScreen(int x, int y, int tileHeight)
Converts offset set of local coordinates into their screen positions- Specified by:
tileToScreen
in interfaceViewport
- Parameters:
x
- local X coordinatey
- local Y coordinatetileHeight
- Height of the content on the tile.- Returns:
- A point representing the screen coordinate, of which the x/y may be -1.
-
tileToScreen
public java.awt.Point tileToScreen(int tileX, int tileY, double offsetX, double offsetY, int tileHeight)
Tile to offset screen position.- Specified by:
tileToScreen
in interfaceViewport
- Parameters:
tileX
- the tile xtileY
- the tile yoffsetX
- the x offsetoffsetY
- the y offsettileHeight
- the tile height- Returns:
- an on screen point
-
localTileToScreen
public java.awt.Point localTileToScreen(Tile tile)
Local tile to offset screen position.- Specified by:
localTileToScreen
in interfaceViewport
- Parameters:
tile
- tile- Returns:
- A point representing the screen coordinate, of which the x/y may be -1.
-
getTileHeight
public int getTileHeight(int tileX, int tileY, int tilePlane)
Calculates the tile height for offset specified tile- Parameters:
tileX
- raw local X of the tiletileY
- raw local Y of the tiletilePlane
- current client plane- Returns:
- tile height
-
isOnGameScreen
public boolean isOnGameScreen(java.awt.Point point)
Determines if point is on the game screen.- Specified by:
isOnGameScreen
in interfaceViewport
- Parameters:
point
- The point to check- Returns:
- true if the point is on game screen or else it's false.
-
isOnGameScreen
public boolean isOnGameScreen(double x, double y)
-
getTriangluatedFaces
public int[][] getTriangluatedFaces(int gridX, int gridY, int plane, Model model, int triangle)
-
getScreenCoordinates
public int[][] getScreenCoordinates(int gridX, int gridY, int plane, Model model)
-
getVertices
public java.util.List<java.awt.Point> getVertices(Model structure)
-
getScreenCoordinates
public int[] getScreenCoordinates(int gridX, int gridY, int plane, int height)
-
getMiniMapCoordinate
public java.awt.Point getMiniMapCoordinate(int destinationX, int destinationY)
-
getBoundingBox
public java.awt.Rectangle getBoundingBox(int[][] vertex)
-
getModelBoundingBox
public java.awt.Rectangle getModelBoundingBox(int gridX, int gridY, int z, Model model)
-
getScreenCoordinatesPoint
public java.awt.Point getScreenCoordinatesPoint(int gridX, int gridY, int plane, int height)
-
getSuitablePointForModel
public java.awt.Point getSuitablePointForModel(int gridX, int gridY, int z, Model model, boolean predictMovement)
-
getSuitablePointFor
public java.awt.Point getSuitablePointFor(java.awt.geom.Area area)
-
getSuitablePointFor
public java.awt.Point getSuitablePointFor(java.awt.Rectangle box)
-
getModelArea
public java.awt.geom.Area getModelArea(Entity target)
-
getModelArea
public java.awt.geom.Area getModelArea(Entity target, boolean predictMovement)
-
getModelArea
public java.awt.geom.Area getModelArea(int gridX, int gridY, int z, Model model)
-
getModelArea
public java.awt.geom.Area getModelArea(int gridX, int gridY, int z, Model model, boolean predictMovement)
-
drawModel
public void drawModel(java.awt.Graphics2D g, int gridX, int gridY, int z, Model model)
-
isVisibleOnCanvas
public boolean isVisibleOnCanvas(java.awt.Rectangle rectangle)
-
isVisibleOnCanvas
public boolean isVisibleOnCanvas(java.awt.geom.Area area)
-
isVisibleOnMainScreen
public boolean isVisibleOnMainScreen(java.awt.Shape shape)
-
isVisibleOnMainScreen
public boolean isVisibleOnMainScreen(int x, int y)
-
isVisibleOnMainScreen
public boolean isVisibleOnMainScreen(java.awt.Point p)
-
getPoints
public java.util.List<java.awt.Point> getPoints(java.awt.geom.Area area)
-
-