use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class GroundItems method get.
private List<GroundItem> get(int radius, final int floor) {
if (radius < 1) {
radius = 110;
}
final List<GroundItem> r = new CopyOnWriteArrayList<GroundItem>();
final Client client = ctx.client();
final NodeDeque[][][] dequeArray;
if (client == null || (dequeArray = client.getGroundItems()) == null) {
return r;
}
final NodeDeque[][] rows;
if (floor > -1 && floor < dequeArray.length) {
rows = dequeArray[floor];
} else {
rows = null;
}
if (rows == null) {
return r;
}
final List<GroundItem> list = new LinkedList<GroundItem>();
final Tile tile = new Tile(client.getOffsetX(), client.getOffsetY(), floor);
final Tile ct = ctx.players.local().tile().derive(-tile.x(), -tile.y());
for (int x = Math.max(0, ct.x() - radius); x < Math.min(rows.length, ct.x() + radius + 1); x++) {
final NodeDeque[] row = rows[x];
if (row == null) {
continue;
}
for (int y = Math.max(0, ct.y() - radius); y < Math.min(row.length, ct.y() + radius + 1); y++) {
for (final ItemNode n : NodeQueue.get(row[y], ItemNode.class)) {
list.add(new GroundItem(ctx, tile.derive(x, y), n));
}
}
}
return list;
}
use of ru.compscicenter.hpc2016.ha1.client.Client 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;
}
use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class HintArrow method valid.
@Override
public boolean valid() {
final Client client = ctx.client();
if (client == null) {
return false;
}
final org.powerbot.bot.rt6.client.HintArrow[] arr = client.getHintArrows();
return arrow.obj.get() != null && arr != null && Arrays.asList(arr).contains(arrow);
}
use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class HintArrows method get.
/**
* {@inheritDoc}
*/
@Override
protected List<org.powerbot.script.rt6.HintArrow> get() {
final List<org.powerbot.script.rt6.HintArrow> items = new ArrayList<org.powerbot.script.rt6.HintArrow>();
final Client client = ctx.client();
if (client == null) {
return items;
}
final HintArrow[] arr = client.getHintArrows();
for (final HintArrow arrow : arr != null ? arr : new HintArrow[0]) {
if (arrow.isNull()) {
items.add(new org.powerbot.script.rt6.HintArrow(ctx, arrow));
}
}
return items;
}
use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class Players method local.
public Player local() {
final Player r = new Player(ctx, null);
final Client client = ctx.client();
if (client == null) {
return r;
}
return new Player(ctx, client.getPlayer());
}
Aggregations