use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class Actor method interacting.
/**
* The current entity of which this entity is interacting with. If
* the client is not loaded or there is no entity being interacted with,
* this will return {@link Npcs#nil()}.
*
* @return The entity of which is being interacted with.
*/
public Actor interacting() {
final Actor nil = ctx.npcs.nil();
final org.powerbot.bot.rt4.client.Actor actor = getActor();
final int index = actor != null ? actor.getInteractingIndex() : -1;
if (index == -1) {
return nil;
}
final Client client = ctx.client();
if (client == null) {
return nil;
}
if (index < 32768) {
final org.powerbot.bot.rt4.client.Npc[] npcs = client.getNpcs();
return index >= 0 && index < npcs.length ? new Npc(ctx, npcs[index]) : nil;
} else {
final int pos = index - 32768;
if (pos == client.getPlayerIndex()) {
return new Player(ctx, client.getPlayer());
}
final org.powerbot.bot.rt4.client.Player[] players = client.getPlayers();
return pos >= 0 && pos < players.length ? new Player(ctx, players[pos]) : nil;
}
}
use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class Actor method getBarData.
private CombatStatusData[] getBarData() {
final Node[] nodes = getBarNodes();
final Client client = ctx.client();
if (nodes == null || client == null) {
return null;
}
final CombatStatusData[] data = new CombatStatusData[nodes.length];
for (int i = 0; i < nodes.length; i++) {
if (nodes[i] == null || nodes[i].isNull() || !nodes[i].isTypeOf(CombatStatus.class)) {
data[i] = null;
continue;
}
final CombatStatus status = new CombatStatus(nodes[i].reflector, nodes[i]);
final org.powerbot.bot.rt4.client.LinkedList statuses;
try {
statuses = status.getList();
} catch (final IllegalArgumentException ignored) {
continue;
}
if (statuses == null) {
data[i] = null;
continue;
}
final Node node = statuses.getSentinel().getNext();
if (node.isNull() || !node.isTypeOf(CombatStatusData.class)) {
data[i] = null;
continue;
}
data[i] = new CombatStatusData(node.reflector, node);
}
return data;
}
use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class Game method crosshair.
/**
* Determines the current {@link Crosshair} displayed.
*
* @return the displayed {@link Crosshair}
*/
public Crosshair crosshair() {
final Client client = ctx.client();
final int type = client != null ? client.getCrosshairIndex() : -1;
if (type < 0 || type > 2) {
return Crosshair.NONE;
}
return Crosshair.values()[type];
}
use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class Game method hintArrow.
/**
* The {@link HintArrow}.
*
* @return {@link HintArrow}.
*/
public HintArrow hintArrow() {
// TODO: hint arrow
final HintArrow r = new HintArrow();
final Client client = ctx.client();
if (client == null) {
return r;
}
return r;
}
use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.
the class Widget method getInternalComponents.
Object[] getInternalComponents() {
final Client client = ctx.client();
if (client == null) {
return null;
}
final Object[] containers = client.getWidgets();
final ComponentContainer container;
if (containers != null && index >= 0 && index < containers.length && !(container = new ComponentContainer(client.reflector, containers[index])).isNull()) {
return container.getComponents();
}
return null;
}
Aggregations