Search in sources :

Example 26 with Client

use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.

the class Actor method tile.

@Override
public Tile tile() {
    final Client client = ctx.client();
    final org.powerbot.bot.rt4.client.Actor actor = getActor();
    if (client != null && actor != null) {
        return new Tile(client.getOffsetX() + (actor.getX() >> 7), client.getOffsetY() + (actor.getZ() >> 7), client.getFloor());
    }
    return Tile.NIL;
}
Also used : Tile(org.powerbot.script.Tile) Client(org.powerbot.bot.rt4.client.Client)

Example 27 with Client

use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.

the class Actor method inCombat.

/**
 * Whether or not the entity has a health bar displayed over their head. This is
 * used to determine whether or not the entity is currently in combat.
 *
 * @return {@code true} if the health bar is visible, {@code false} otherwise.
 */
public boolean inCombat() {
    final Client client = ctx.client();
    if (client == null) {
        return false;
    }
    final CombatStatusData[] data = getBarData();
    return data != null && data[1] != null && data[1].getCycleEnd() < client.getCycle();
}
Also used : CombatStatusData(org.powerbot.bot.rt4.client.CombatStatusData) Client(org.powerbot.bot.rt4.client.Client)

Example 28 with Client

use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.

the class Npc method id.

@Override
public int id() {
    final Client client = ctx.client();
    if (client == null) {
        return -1;
    }
    final NpcConfig c = npc == null ? new NpcConfig(client.reflector, null) : npc.getConfig();
    if (c.isNull()) {
        return -1;
    }
    final int varbit = c.getVarbit(), si = c.getVarpbitIndex();
    int index = -1;
    if (varbit != -1) {
        final Cache cache = client.getVarbitCache();
        final Varbit varBit = HashTable.lookup(cache.getTable(), varbit, Varbit.class);
        if (!varBit.isNull()) {
            final int mask = lookup[varBit.getEndBit() - varBit.getStartBit()];
            index = ctx.varpbits.varpbit(varBit.getIndex()) >> varBit.getStartBit() & mask;
        }
    } else if (si != -1) {
        index = ctx.varpbits.varpbit(si);
    }
    if (index >= 0) {
        final int[] configs = c.getConfigs();
        if (index < configs.length && configs[index] != -1) {
            return configs[index];
        }
    }
    return c.getId();
}
Also used : NpcConfig(org.powerbot.bot.rt4.client.NpcConfig) Varbit(org.powerbot.bot.rt4.client.Varbit) Client(org.powerbot.bot.rt4.client.Client) Cache(org.powerbot.bot.rt4.client.Cache)

Example 29 with Client

use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.

the class Npcs method get.

@Override
public List<Npc> get() {
    final List<Npc> r = new ArrayList<Npc>();
    final Client client = ctx.client();
    if (client == null) {
        return r;
    }
    final int[] indices = client.getNpcIndices();
    final org.powerbot.bot.rt4.client.Npc[] npcs = client.getNpcs();
    if (indices == null || npcs == null) {
        return r;
    }
    for (int index = 0; index < Math.min(client.getNpcCount(), indices.length); ++index) {
        final org.powerbot.bot.rt4.client.Npc n = npcs[indices[index]];
        if (!n.isNull()) {
            r.add(new Npc(ctx, n));
        }
    }
    return r;
}
Also used : ArrayList(java.util.ArrayList) Client(org.powerbot.bot.rt4.client.Client)

Example 30 with Client

use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.

the class Player method valid.

@Override
public boolean valid() {
    final Client client = ctx.client();
    if (client == null || player == null) {
        return false;
    }
    final org.powerbot.bot.rt4.client.Player[] arr = client.getPlayers();
    for (final org.powerbot.bot.rt4.client.Player a : arr) {
        if (player.equals(a)) {
            return true;
        }
    }
    return false;
}
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)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