Search in sources :

Example 1 with Tile

use of org.powerbot.script.Tile in project powerbot by powerbot.

the class DrawObjects method repaint.

@Override
public void repaint(final Graphics render) {
    if (ctx.game.clientState() != Constants.GAME_LOADED) {
        return;
    }
    final Player player = ctx.players.local();
    if (player == null) {
        return;
    }
    final FontMetrics metrics = render.getFontMetrics();
    final int textHeight = metrics.getHeight();
    final Map<Tile, AtomicInteger> counts = new HashMap<Tile, AtomicInteger>();
    for (final GameObject object : ctx.objects.select(8)) {
        final Tile t = object.tile();
        if (t == null) {
            continue;
        }
        if (!counts.containsKey(t)) {
            counts.put(t, new AtomicInteger(0));
        }
        final Point p = object.centerPoint();
        if (p.x == -1) {
            continue;
        }
        render.setColor(Color.black);
        render.fillRect(p.x - 1, p.y - 1, 2, 2);
        final String s = Integer.toString(object.id());
        final int ty = p.y - textHeight / 2;
        final int tx = p.x - metrics.stringWidth(s) / 2;
        render.setColor(C[object.type().ordinal()]);
        final StringBuilder b = new StringBuilder(s);
        final String n = object.name();
        if (!n.isEmpty() && !n.equals("null")) {
            int[] arr = object.meshIds();
            if (arr.length < 1) {
                arr = new int[] { -1 };
            }
            b.append(" (").append(n).append('/').append(arr[0]).append(')');
        }
        render.drawString(b.toString(), tx, ty - textHeight * counts.get(t).getAndIncrement());
    }
}
Also used : Player(org.powerbot.script.rt4.Player) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) HashMap(java.util.HashMap) FontMetrics(java.awt.FontMetrics) GameObject(org.powerbot.script.rt4.GameObject) Tile(org.powerbot.script.Tile) Point(java.awt.Point) Point(java.awt.Point)

Example 2 with Tile

use of org.powerbot.script.Tile in project powerbot by powerbot.

the class TDestination method draw.

public int draw(int idx, final Graphics render) {
    final Tile dest = ctx.movement.destination();
    drawLine(render, idx++, "Destination: " + (dest != null ? dest.toString() : "null"));
    return idx;
}
Also used : Tile(org.powerbot.script.Tile)

Example 3 with Tile

use of org.powerbot.script.Tile in project powerbot by powerbot.

the class TLocation method draw.

public int draw(int idx, final Graphics render) {
    final Player player = ctx.players.local();
    if (player != null) {
        final Tile tile = player.tile();
        drawLine(render, idx++, "Position: " + (tile != null ? tile.toString() : ""));
    }
    return idx;
}
Also used : Player(org.powerbot.script.rt6.Player) Tile(org.powerbot.script.Tile)

Example 4 with Tile

use of org.powerbot.script.Tile in project powerbot by powerbot.

the class TMapBase method draw.

public int draw(int idx, final Graphics render) {
    final Tile t = ctx.game.mapOffset();
    drawLine(render, idx++, "Map base: " + (t != null ? t.toString() : ""));
    return idx;
}
Also used : Tile(org.powerbot.script.Tile)

Example 5 with Tile

use of org.powerbot.script.Tile in project powerbot by powerbot.

the class TLocation method draw.

public int draw(int idx, final Graphics render) {
    final Player player = ctx.players.local();
    if (player != null) {
        final Tile tile = player.tile();
        drawLine(render, idx++, "Position: " + (tile != null ? tile.toString() : ""));
    }
    return idx;
}
Also used : Player(org.powerbot.script.rt4.Player) Tile(org.powerbot.script.Tile)

Aggregations

Tile (org.powerbot.script.Tile)40 Point (java.awt.Point)16 ArrayList (java.util.ArrayList)5 Client (org.powerbot.bot.rt4.client.Client)5 FontMetrics (java.awt.FontMetrics)4 Condition (org.powerbot.script.Condition)4 Rectangle (java.awt.Rectangle)3 Client (org.powerbot.bot.rt6.client.Client)3 Player (org.powerbot.script.rt4.Player)3 Player (org.powerbot.script.rt6.Player)3 HashMap (java.util.HashMap)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 NodeDeque (org.powerbot.bot.rt4.client.NodeDeque)2 Filter (org.powerbot.script.Filter)2 Locatable (org.powerbot.script.Locatable)2 Targetable (org.powerbot.script.Targetable)2 TileMatrix (org.powerbot.script.rt6.TileMatrix)2 LinkedList (java.util.LinkedList)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 ItemNode (org.powerbot.bot.rt4.client.ItemNode)1