Search in sources :

Example 16 with Client

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

Example 17 with Client

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;
}
Also used : Npc(org.powerbot.bot.rt6.client.Npc) Reflector(org.powerbot.bot.Reflector) NpcNode(org.powerbot.bot.rt6.client.NpcNode) Node(org.powerbot.bot.rt6.client.Node) ArrayList(java.util.ArrayList) Client(org.powerbot.bot.rt6.client.Client) NpcNode(org.powerbot.bot.rt6.client.NpcNode)

Example 18 with Client

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

Example 19 with Client

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

Example 20 with Client

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

Aggregations

Client (org.powerbot.bot.rt4.client.Client)36 Client (org.powerbot.bot.rt6.client.Client)33 Point (java.awt.Point)25 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 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)3 ClientRedirectUri (org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri)3 Graphics (java.awt.Graphics)2 LinkedList (java.util.LinkedList)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ScopePathType (org.orcid.jaxb.model.message.ScopePathType)2