use of net.runelite.api.coords.LocalPoint in project runelite by runelite.
the class RoguesDenOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
if (!plugin.isHasGem()) {
return null;
}
LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation();
plugin.getObstaclesHull().forEach((obstacle, tile) -> {
if (tile.getPlane() == client.getPlane() && obstacle.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE) {
Polygon p = tile.getGameObjects()[0].getConvexHull();
if (p != null) {
graphics.setColor(Color.CYAN);
graphics.drawPolygon(p);
}
}
});
plugin.getObstaclesTile().forEach((obstacle, tile) -> {
if (tile.getPlane() == client.getPlane() && obstacle.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE) {
Polygon p = obstacle.getCanvasTilePoly();
if (p != null) {
graphics.setColor(Color.CYAN);
graphics.drawPolygon(p);
}
}
});
return null;
}
use of net.runelite.api.coords.LocalPoint in project runelite by runelite.
the class TileIndicatorsOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
LocalPoint dest = client.getLocalDestinationLocation();
if (dest == null) {
return null;
}
Polygon poly = Perspective.getCanvasTilePoly(client, dest);
if (poly == null) {
return null;
}
OverlayUtil.renderPolygon(graphics, poly, config.highlightDestinationColor());
return null;
}
use of net.runelite.api.coords.LocalPoint in project runelite by runelite.
the class Hooks method projectileMoved.
/**
* Called when a projectile is set to move towards a point. For
* projectiles that target the ground, like AoE projectiles from
* Lizardman Shamans, this is only called once
*
* @param projectile The projectile being moved
* @param targetX X position of where the projectile is being moved to
* @param targetY Y position of where the projectile is being moved to
* @param targetZ Z position of where the projectile is being moved to
* @param cycle
*/
public static void projectileMoved(Projectile projectile, int targetX, int targetY, int targetZ, int cycle) {
LocalPoint position = new LocalPoint(targetX, targetY);
ProjectileMoved projectileMoved = new ProjectileMoved();
projectileMoved.setProjectile(projectile);
projectileMoved.setPosition(position);
projectileMoved.setZ(targetZ);
eventBus.post(projectileMoved);
}
use of net.runelite.api.coords.LocalPoint in project runelite by runelite.
the class AgilityOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation();
Point mousePosition = client.getMouseCanvasPosition();
plugin.getObstacles().forEach((object, tile) -> {
if (tile.getPlane() == client.getPlane() && object.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE) {
Area objectClickbox = object.getClickbox();
if (objectClickbox != null) {
Color configColor = config.getOverlayColor();
if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY())) {
graphics.setColor(configColor.darker());
} else {
graphics.setColor(configColor);
}
graphics.draw(objectClickbox);
graphics.setColor(new Color(configColor.getRed(), configColor.getGreen(), configColor.getBlue(), 50));
graphics.fill(objectClickbox);
}
}
});
return null;
}
use of net.runelite.api.coords.LocalPoint in project runelite by runelite.
the class TrapOverlay method drawTimerOnTrap.
/**
* Draws a timer on a given trap.
*
* @param graphics
* @param trap The trap on which the timer needs to be drawn
* @param fill The fill color of the timer
* @param border The border color of the timer
* @param fillTimeLow The fill color of the timer when it is low
* @param borderTimeLow The border color of the timer when it is low
*/
private void drawTimerOnTrap(Graphics2D graphics, HunterTrap trap, Color fill, Color border, Color fillTimeLow, Color borderTimeLow) {
if (trap.getWorldLocation().getPlane() != client.getPlane()) {
return;
}
LocalPoint localLoc = LocalPoint.fromWorld(client, trap.getWorldLocation());
if (localLoc == null) {
return;
}
net.runelite.api.Point loc = Perspective.worldToCanvas(client, localLoc.getX(), localLoc.getY(), trap.getWorldLocation().getPlane());
double timeLeft = 1 - trap.getTrapTimeRelative();
ProgressPie pie = new ProgressPie();
pie.setFill(timeLeft > TIMER_LOW ? fill : fillTimeLow);
pie.setBorderColor(timeLeft > TIMER_LOW ? border : borderTimeLow);
pie.render(graphics, loc, timeLeft);
}
Aggregations