use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class Movement method destination.
/**
* Determines the current destination of the player.
*
* @return the {@link Tile} destination; or {@link Tile#NIL} if there is no destination
*/
public Tile destination() {
final Client client = ctx.client();
if (client == null) {
return Tile.NIL;
}
final int dX = client.getDestinationX(), dY = client.getDestinationY();
if (dX == -1 || dY == -1) {
return Tile.NIL;
}
return ctx.game.mapOffset().derive(dX, dY);
}
use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class Npcs method get.
/**
* {@inheritDoc}
*/
@Override
protected List<org.powerbot.script.rt6.Npc> get() {
final List<org.powerbot.script.rt6.Npc> npcs = new ArrayList<org.powerbot.script.rt6.Npc>();
final Client client = ctx.client();
if (client == null) {
return npcs;
}
final int[] keys = client.getNpcIndices();
final org.powerbot.bot.rt6.client.HashTable table = client.getNpcTable();
if (keys == null || table.isNull()) {
return npcs;
}
final Reflector r = client.reflector;
for (int index = 0; index < client.getNpcCount() && index < keys.length; ++index) {
final Node o = HashTable.lookup(table, keys[index], Node.class);
if (o.isTypeOf(NpcNode.class)) {
npcs.add(new org.powerbot.script.rt6.Npc(ctx, new NpcNode(r, o).getNpc()));
} else if (o.isTypeOf(Npc.class)) {
npcs.add(new org.powerbot.script.rt6.Npc(ctx, new Npc(r, o)));
}
}
return npcs;
}
use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class Varpbits method array.
/**
* Returns the array of settings for the game.
*
* @return an array of the game's settings
*/
public int[] array() {
final Client client = ctx.client();
if (client == null) {
return null;
}
final int[] arr = client.getPlayerFacade().getVarpbits().get();
return arr != null ? arr.clone() : new int[0];
}
use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class Widget method valid.
/**
* {@inheritDoc}
*/
@Override
public boolean valid() {
final Client client = ctx.client();
if (client == null || index < 0) {
return false;
}
final Object[] containers = client.getWidgets();
return containers.length > 0 && index < containers.length && containers[index] != null && new ComponentContainer(client.reflector, containers[index]).getComponents().length > 0;
}
use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class Widgets method get.
/**
* {@inheritDoc}
*/
@Override
protected List<Widget> get() {
final Client client = ctx.client();
if (client == null) {
return new ArrayList<Widget>(0);
}
final Object[] cache = client.getWidgets();
if (cache == null || cache.length == 0) {
return new ArrayList<Widget>(0);
}
final List<Widget> w = new ArrayList<Widget>(cache.length);
for (int i = 0; i < cache.length; i++) {
w.add(new Widget(ctx, i));
}
return w;
}
Aggregations