Search in sources :

Example 1 with Projectile

use of net.runelite.api.Projectile in project runelite by runelite.

the class RSClientMixin method getProjectiles.

@Inject
@Override
public List<Projectile> getProjectiles() {
    List<Projectile> projectiles = new ArrayList<Projectile>();
    RSDeque projectileDeque = this.getProjectilesDeque();
    Node head = projectileDeque.getHead();
    for (Node node = head.getNext(); node != head; node = node.getNext()) {
        projectiles.add((Projectile) node);
    }
    return projectiles;
}
Also used : RSDeque(net.runelite.rs.api.RSDeque) Node(net.runelite.api.Node) WidgetNode(net.runelite.api.WidgetNode) ArrayList(java.util.ArrayList) Projectile(net.runelite.api.Projectile) Inject(net.runelite.api.mixins.Inject)

Example 2 with Projectile

use of net.runelite.api.Projectile in project runelite by runelite.

the class DevToolsOverlay method renderProjectiles.

private void renderProjectiles(Graphics2D graphics) {
    List<Projectile> projectiles = client.getProjectiles();
    for (Projectile projectile : projectiles) {
        int originX = projectile.getX1();
        int originY = projectile.getY1();
        LocalPoint tilePoint = new LocalPoint(originX, originY);
        Polygon poly = Perspective.getCanvasTilePoly(client, tilePoint);
        if (poly != null) {
            OverlayUtil.renderPolygon(graphics, poly, Color.RED);
        }
        int projectileId = projectile.getId();
        Actor projectileInteracting = projectile.getInteracting();
        String infoString = "";
        if (projectileInteracting == null) {
            infoString += "AoE";
        } else {
            infoString += "Targeted (T: " + projectileInteracting.getName() + ")";
        }
        infoString += " (ID: " + projectileId + ")";
        if (projectileInteracting != null) {
            OverlayUtil.renderActorOverlay(graphics, projectile.getInteracting(), infoString, Color.RED);
        }
    }
}
Also used : LocalPoint(net.runelite.api.coords.LocalPoint) Actor(net.runelite.api.Actor) Polygon(java.awt.Polygon) LocalPoint(net.runelite.api.coords.LocalPoint) Projectile(net.runelite.api.Projectile)

Aggregations

Projectile (net.runelite.api.Projectile)2 Polygon (java.awt.Polygon)1 ArrayList (java.util.ArrayList)1 Actor (net.runelite.api.Actor)1 Node (net.runelite.api.Node)1 WidgetNode (net.runelite.api.WidgetNode)1 LocalPoint (net.runelite.api.coords.LocalPoint)1 Inject (net.runelite.api.mixins.Inject)1 RSDeque (net.runelite.rs.api.RSDeque)1