use of org.powerbot.bot.rt6.client.Client in project hpcourse by cscenter.
the class SimpleTests method SimpleTest.
@Test
public void SimpleTest() throws InterruptedException {
Thread serverThread = new Thread(new Server("localhost", 1500));
serverThread.start();
Thread.sleep(1000);
Client client = new Client("localhost", 1500);
for (int i = 0; i < 4; i++) submitHardTask();
Thread.sleep(100);
client.getList();
new Thread(new Runnable() {
@Override
public void run() {
Client client = new Client("localhost", 1500);
client.submitTask(getDependTask(1, 2, 3, 4));
}
}).start();
Thread.sleep(100);
client.getList();
new Thread(new Runnable() {
@Override
public void run() {
Client client = new Client("localhost", 1500);
client.submitTask(getDependTask(1, 2, 3, 5));
}
}).start();
for (int i = 0; i < 4; i++) subscribeTask();
long actual = client.subscribe(6);
client.getList();
assertEquals(0, actual);
}
use of org.powerbot.bot.rt6.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 org.powerbot.bot.rt6.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 org.powerbot.bot.rt6.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 org.powerbot.bot.rt6.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;
}
Aggregations