Search in sources :

Example 51 with Client

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);
}
Also used : Server(server.Server) Client(client.Client) Test(org.junit.Test)

Example 52 with Client

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;
    }
}
Also used : Point(java.awt.Point) Client(org.powerbot.bot.rt4.client.Client)

Example 53 with Client

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;
}
Also used : CombatStatus(org.powerbot.bot.rt4.client.CombatStatus) Node(org.powerbot.bot.rt4.client.Node) CombatStatusData(org.powerbot.bot.rt4.client.CombatStatusData) Client(org.powerbot.bot.rt4.client.Client) Point(java.awt.Point)

Example 54 with Client

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];
}
Also used : Client(org.powerbot.bot.rt4.client.Client)

Example 55 with Client

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;
}
Also used : Client(org.powerbot.bot.rt4.client.Client)

Aggregations

Client (org.powerbot.bot.rt4.client.Client)36 Client (org.powerbot.bot.rt6.client.Client)33 Point (java.awt.Point)26 ArrayList (java.util.ArrayList)13 Client (org.orcid.jaxb.model.v3.dev1.client.Client)11 Test (org.junit.Test)8 Tile (org.powerbot.script.Tile)8 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)6 HashSet (java.util.HashSet)5 Rectangle (java.awt.Rectangle)4 Reflector (org.powerbot.bot.Reflector)4 Condition (org.powerbot.script.Condition)4 Client (client.Client)3 LinkedList (java.util.LinkedList)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)3 ClientRedirectUri (org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri)3 Graphics (java.awt.Graphics)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ScopePathType (org.orcid.jaxb.model.message.ScopePathType)2