Search in sources :

Example 6 with WorldPoint

use of net.runelite.api.coords.WorldPoint in project runelite by runelite.

the class ClueScrollPlugin method coordinatesToWorldPoint.

/**
 * This conversion is explained on
 * http://oldschoolrunescape.wikia.com/wiki/Treasure_Trails/Guide/Coordinates
 */
private WorldPoint coordinatesToWorldPoint(int degX, int minX, int degY, int minY) {
    // Center of the Observatory
    int x2 = 2440;
    int y2 = 3161;
    x2 += degX * 32 + Math.round(minX / 1.875);
    y2 += degY * 32 + Math.round(minY / 1.875);
    return new WorldPoint(x2, y2, 0);
}
Also used : WorldPoint(net.runelite.api.coords.WorldPoint) WorldPoint(net.runelite.api.coords.WorldPoint)

Example 7 with WorldPoint

use of net.runelite.api.coords.WorldPoint in project runelite by runelite.

the class LocationOverlay method render.

@Override
public Dimension render(Graphics2D graphics) {
    if (!plugin.isToggleLocation()) {
        return null;
    }
    panelComponent = new PanelComponent();
    WorldPoint localWorld = client.getLocalPlayer().getWorldLocation();
    panelComponent.getLines().add(new PanelComponent.Line("Tile", localWorld.getX() + ", " + localWorld.getY() + ", " + client.getPlane()));
    for (int i = 0; i < client.getMapRegions().length; i++) {
        int region = client.getMapRegions()[i];
        panelComponent.getLines().add(new PanelComponent.Line((i == 0) ? "Map region" : " ", String.valueOf(region)));
    }
    return panelComponent.render(graphics);
}
Also used : WorldPoint(net.runelite.api.coords.WorldPoint) PanelComponent(net.runelite.client.ui.overlay.components.PanelComponent) WorldPoint(net.runelite.api.coords.WorldPoint)

Example 8 with WorldPoint

use of net.runelite.api.coords.WorldPoint in project runelite by runelite.

the class HerbiboarOverlay method render.

@Override
public Dimension render(Graphics2D graphics) {
    if (!plugin.isInHerbiboarArea()) {
        return null;
    }
    HerbiboarTrail currentTrail = plugin.getCurrentTrail();
    int finishId = plugin.getFinishId();
    // Draw start objects
    if (config.isStartShown() && (currentTrail == null && finishId == 0)) {
        plugin.getStarts().keySet().forEach((obj) -> {
            OverlayUtil.renderTileOverlay(graphics, obj, "", config.getStartColor());
        });
    }
    // Draw trails
    if (config.isTrailShown()) {
        Set<Integer> shownTrailIds = plugin.getShownTrails();
        plugin.getTrails().keySet().forEach((x) -> {
            int id = x.getId();
            if (shownTrailIds.contains(id) && (finishId > 0 || (currentTrail != null && currentTrail.getTrailId() != id && currentTrail.getTrailId() + 1 != id))) {
                OverlayUtil.renderTileOverlay(graphics, x, "", config.getTrailColor());
            }
        });
    }
    // Draw trail objects (mushrooms, mud, etc)
    if (config.isObjectShown() && currentTrail != null) {
        int currentPath = plugin.getCurrentPath();
        plugin.getTrailObjects().keySet().forEach((obj) -> {
            WorldPoint loc = obj.getWorldLocation();
            WorldPoint[] trailLocs = currentTrail.getObjectLocs(currentPath);
            for (WorldPoint trailLoc : trailLocs) {
                if (trailLoc == null) {
                    continue;
                }
                if (trailLoc.equals(loc)) {
                    if (config.showClickBoxes()) {
                        Area clickbox = obj.getClickbox();
                        graphics.setColor(config.getObjectColor());
                        graphics.draw(clickbox);
                        graphics.setColor(new Color(255, 0, 255, 20));
                        graphics.fill(clickbox);
                    } else {
                        OverlayUtil.renderTileOverlay(graphics, obj, "", config.getObjectColor());
                    }
                }
            }
        });
    }
    // Draw finish tunnels
    if (config.isTunnelShown() && finishId > 0) {
        WorldPoint finishLoc = plugin.getEndLocations().get(finishId - 1);
        Map<TileObject, Tile> tunnels = plugin.getTunnels();
        tunnels.keySet().forEach((obj) -> {
            WorldPoint loc = obj.getWorldLocation();
            if (finishLoc.equals(loc)) {
                if (config.showClickBoxes()) {
                    Area clickbox = obj.getClickbox();
                    Color col = config.getObjectColor();
                    graphics.setColor(col);
                    graphics.draw(clickbox);
                    graphics.setColor(new Color(col.getRed(), col.getGreen(), col.getBlue(), 20));
                    graphics.fill(clickbox);
                } else {
                    OverlayUtil.renderTileOverlay(graphics, obj, "", config.getTunnelColor());
                }
            }
        });
    }
    return null;
}
Also used : Area(java.awt.geom.Area) WorldPoint(net.runelite.api.coords.WorldPoint) Color(java.awt.Color) TileObject(net.runelite.api.TileObject) Tile(net.runelite.api.Tile) WorldPoint(net.runelite.api.coords.WorldPoint)

Aggregations

WorldPoint (net.runelite.api.coords.WorldPoint)8 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 LocalPoint (net.runelite.api.coords.LocalPoint)3 Color (java.awt.Color)2 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2 IntStream (java.util.stream.IntStream)2 Singleton (javax.inject.Singleton)2 Getter (lombok.Getter)2 Slf4j (lombok.extern.slf4j.Slf4j)2 Tile (net.runelite.api.Tile)2 Book (net.runelite.client.plugins.kourendlibrary.Book)2 Subscribe (com.google.common.eventbus.Subscribe)1 Inject (com.google.inject.Inject)1 Dimension (java.awt.Dimension)1 FontMetrics (java.awt.FontMetrics)1