Search in sources :

Example 31 with Client

use of client.Client in project powerbot by powerbot.

the class Players method get.

@Override
public List<Player> get() {
    final List<Player> r = new CopyOnWriteArrayList<Player>();
    final Client client = ctx.client();
    if (client == null) {
        return r;
    }
    final int[] indices = client.getPlayerIndices();
    final org.powerbot.bot.rt4.client.Player[] players = client.getPlayers();
    if (indices == null || players == null) {
        return r;
    }
    for (int index = 0; index < Math.min(client.getPlayerCount(), indices.length); index++) {
        final int k = indices[index];
        final org.powerbot.bot.rt4.client.Player p = players[k];
        if (p.obj.get() != null) {
            r.add(new Player(ctx, p));
        }
    }
    return r;
}
Also used : Client(org.powerbot.bot.rt4.client.Client) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Example 32 with Client

use of client.Client in project powerbot by powerbot.

the class Skills method experiences.

public int[] experiences() {
    final Client c = ctx.client();
    final int[] arr = c != null ? c.getSkillExps() : new int[0];
    return arr != null ? arr : new int[0];
}
Also used : Client(org.powerbot.bot.rt4.client.Client)

Example 33 with Client

use of client.Client in project powerbot by powerbot.

the class Widget method valid.

/**
 * {@inheritDoc}
 */
@Override
public boolean valid() {
    if (index < 1) {
        return false;
    }
    final Client client = ctx.client();
    final org.powerbot.bot.rt4.client.Widget[][] arr = client != null ? client.getWidgets() : null;
    return arr != null && index > -1 && index < arr.length && arr[index] != null && arr[index].length > 0;
}
Also used : Client(org.powerbot.bot.rt4.client.Client)

Example 34 with Client

use of client.Client in project powerbot by powerbot.

the class Widget method componentCount.

public int componentCount() {
    final Client client = ctx.client();
    final org.powerbot.bot.rt4.client.Widget[][] arr = client != null ? client.getWidgets() : null;
    if (arr != null && index < arr.length) {
        final org.powerbot.bot.rt4.client.Widget[] comps = arr[index];
        return comps != null ? comps.length : 0;
    }
    return 0;
}
Also used : Client(org.powerbot.bot.rt4.client.Client)

Example 35 with Client

use of client.Client in project powerbot by powerbot.

the class Widgets method get.

/**
 * {@inheritDoc}
 */
@Override
protected List<Widget> get() {
    final Client client = ctx.client();
    final org.powerbot.bot.rt4.client.Widget[][] a = client != null ? client.getWidgets() : null;
    final int len = a != null ? a.length : 0;
    if (len <= 0) {
        return new ArrayList<Widget>(0);
    }
    widget(len - 1);
    return new ArrayList<Widget>(Arrays.asList(Arrays.copyOf(sparseCache, len)));
}
Also used : ArrayList(java.util.ArrayList) 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)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