Search in sources :

Example 6 with Node

use of org.powerbot.bot.rt4.client.Node in project powerbot by powerbot.

the class GroundItem method valid.

@Override
public boolean valid() {
    final Client c = ctx.client();
    if (c == null || node.isNull()) {
        return false;
    }
    final NodeDeque[][][] nd = c.getGroundItems();
    if (nd != null) {
        final int f = c.getFloor();
        if (f < 0 || f >= nd.length || nd[f] == null) {
            return false;
        }
        final Tile t = tile.tile().derive(-c.getOffsetX(), -c.getOffsetY());
        if (t.x() < 0 || t.y() < 0 || t.x() >= nd[f].length) {
            return false;
        }
        final NodeDeque[] nd2 = nd[f][t.x()];
        if (nd2 == null || t.y() >= nd2.length) {
            return false;
        }
        final NodeDeque d = nd2[t.y()];
        return d != null && NodeQueue.get(d, ItemNode.class).contains(node);
    }
    return false;
}
Also used : Tile(org.powerbot.script.Tile) Client(org.powerbot.bot.rt4.client.Client) NodeDeque(org.powerbot.bot.rt4.client.NodeDeque) Point(java.awt.Point)

Example 7 with Node

use of org.powerbot.bot.rt4.client.Node in project powerbot by powerbot.

the class HintArrow method tile.

@Override
public Tile tile() {
    final Client client = ctx.client();
    if (client == null || arrow.obj.get() == null) {
        return Tile.NIL;
    }
    final int type = type();
    final int target = targetId();
    if (type == -1 || type == 0) {
        return Tile.NIL;
    }
    if (type == 1) {
        org.powerbot.script.rt6.Npc npc = null;
        final Node node = HashTable.lookup(client.getNpcTable(), target, Node.class);
        if (!node.isNull()) {
            final Reflector r = client.reflector;
            if (node.isTypeOf(NpcNode.class)) {
                npc = new org.powerbot.script.rt6.Npc(ctx, new NpcNode(r, node).getNpc());
            } else if (node.isTypeOf(Npc.class)) {
                npc = new org.powerbot.script.rt6.Npc(ctx, new Npc(r, node));
            }
        }
        return npc != null ? npc.tile() : Tile.NIL;
    } else if (type == 2) {
        return ctx.game.mapOffset().derive(arrow.getX() >> 9, arrow.getY() >> 9, floor());
    }
    final Player[] players = client.getPlayers();
    if (type != 10 || target < 0 || target >= players.length) {
        return Tile.NIL;
    }
    final Player localPlayer = players[target];
    if (localPlayer != null) {
        return new org.powerbot.script.rt6.Player(ctx, localPlayer).tile();
    }
    return Tile.NIL;
}
Also used : Npc(org.powerbot.bot.rt6.client.Npc) Player(org.powerbot.bot.rt6.client.Player) NpcNode(org.powerbot.bot.rt6.client.NpcNode) Node(org.powerbot.bot.rt6.client.Node) Reflector(org.powerbot.bot.Reflector) Client(org.powerbot.bot.rt6.client.Client) NpcNode(org.powerbot.bot.rt6.client.NpcNode)

Aggregations

Point (java.awt.Point)4 Reflector (org.powerbot.bot.Reflector)3 Client (org.powerbot.bot.rt4.client.Client)3 Client (org.powerbot.bot.rt6.client.Client)3 Node (org.powerbot.bot.rt6.client.Node)3 Npc (org.powerbot.bot.rt6.client.Npc)3 NpcNode (org.powerbot.bot.rt6.client.NpcNode)3 Node (org.powerbot.bot.rt4.client.Node)2 Player (org.powerbot.bot.rt6.client.Player)2 ArrayList (java.util.ArrayList)1 HashTable (org.powerbot.bot.rt4.HashTable)1 CombatStatus (org.powerbot.bot.rt4.client.CombatStatus)1 CombatStatusData (org.powerbot.bot.rt4.client.CombatStatusData)1 NodeDeque (org.powerbot.bot.rt4.client.NodeDeque)1 WidgetNode (org.powerbot.bot.rt4.client.WidgetNode)1 LinkedListNode (org.powerbot.bot.rt6.client.LinkedListNode)1 Tile (org.powerbot.script.Tile)1