use of net.runelite.api.coords.LocalPoint in project runelite by runelite.
the class CannonOverlay method drawDoubleHitSpots.
/**
* Draw the double hit spots on a 6 by 6 grid around the cannon
* @param startTile The position of the cannon
*/
private void drawDoubleHitSpots(Graphics2D graphics, LocalPoint startTile, Color color) {
for (int x = -3; x <= 3; x++) {
for (int y = -3; y <= 3; y++) {
if (y != 1 && x != 1 && y != -1 && x != -1) {
continue;
}
// Ignore center square
if (y >= -1 && y <= 1 && x >= -1 && x <= 1) {
continue;
}
int xPos = startTile.getX() - (x * LOCAL_TILE_SIZE);
int yPos = startTile.getY() - (y * LOCAL_TILE_SIZE);
LocalPoint marker = new LocalPoint(xPos, yPos);
Polygon poly = Perspective.getCanvasTilePoly(client, marker);
if (poly == null) {
continue;
}
OverlayUtil.renderPolygon(graphics, poly, color);
}
}
}
use of net.runelite.api.coords.LocalPoint in project runelite by runelite.
the class CannonOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
if (!plugin.isCannonPlaced() || plugin.getCannonPosition() == null) {
return null;
}
LocalPoint cannonPoint = LocalPoint.fromWorld(client, plugin.getCannonPosition());
if (cannonPoint == null) {
return null;
}
LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
if (localLocation.distanceTo(cannonPoint) <= MAX_DISTANCE) {
Point cannonLoc = Perspective.getCanvasTextLocation(client, graphics, cannonPoint, String.valueOf(plugin.getCballsLeft()), 200);
if (cannonLoc != null) {
textComponent.setText(String.valueOf(plugin.getCballsLeft()));
textComponent.setPosition(new java.awt.Point(cannonLoc.getX(), cannonLoc.getY()));
textComponent.setColor(plugin.getStateColor());
textComponent.render(graphics);
}
if (config.showDoubleHitSpot()) {
Color color = config.highlightDoubleHitColor();
drawDoubleHitSpots(graphics, cannonPoint, color);
}
}
return null;
}
use of net.runelite.api.coords.LocalPoint in project runelite by runelite.
the class CannonSpotOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
if (!config.showCannonSpots() || plugin.isCannonPlaced()) {
return null;
}
for (WorldPoint spot : plugin.getSpotPoints()) {
if (spot.getPlane() != client.getPlane()) {
continue;
}
LocalPoint spotPoint = LocalPoint.fromWorld(client, spot);
LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
if (spotPoint != null && localLocation.distanceTo(spotPoint) <= MAX_DISTANCE) {
renderCannonSpot(graphics, client, spotPoint, itemManager.getImage(CANNONBALL), Color.RED);
}
}
return null;
}
use of net.runelite.api.coords.LocalPoint in project runelite by runelite.
the class EmoteClue method makeWorldOverlayHint.
@Override
public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) {
LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation());
if (localLocation == null) {
return;
}
OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, EMOTE_IMAGE, Color.ORANGE);
}
use of net.runelite.api.coords.LocalPoint in project runelite by runelite.
the class ConveyorBeltOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
if (!config.showConveyorBelt() || plugin.getConveyorBelt() == null) {
return null;
}
LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
Point mousePosition = client.getMouseCanvasPosition();
GameObject object = plugin.getConveyorBelt();
LocalPoint location = object.getLocalLocation();
if (localLocation.distanceTo(location) <= MAX_DISTANCE) {
Area objectClickbox = object.getClickbox();
if (objectClickbox != null) {
if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY())) {
graphics.setColor(Color.RED.darker());
} else {
graphics.setColor(Color.RED);
}
graphics.draw(objectClickbox);
graphics.setColor(new Color(0xFF, 0, 0, 20));
graphics.fill(objectClickbox);
}
}
return null;
}
Aggregations