Search in sources :

Example 31 with Client

use of org.orcid.jaxb.model.v3.dev1.client.Client in project powerbot by powerbot.

the class Skills method experiences.

public int[] experiences() {
    final Client client = ctx.client();
    if (client == null) {
        return new int[0];
    }
    final PlayerFacade info = client.getPlayerFacade();
    final Skill[] skills;
    if (info == null || (skills = info.getSkills()) == null) {
        return new int[0];
    }
    final int[] levels = new int[skills.length];
    for (int i = 0; i < skills.length; i++) {
        final Skill s = skills[i];
        if (!s.isNull()) {
            levels[i] = s.getExperience();
        }
    }
    return levels;
}
Also used : Skill(org.powerbot.bot.rt6.client.Skill) PlayerFacade(org.powerbot.bot.rt6.client.PlayerFacade) Client(org.powerbot.bot.rt6.client.Client)

Example 32 with Client

use of org.orcid.jaxb.model.v3.dev1.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 33 with Client

use of org.orcid.jaxb.model.v3.dev1.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 34 with Client

use of org.orcid.jaxb.model.v3.dev1.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 35 with Client

use of org.orcid.jaxb.model.v3.dev1.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)

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)18 Test (org.junit.Test)17 Client (org.orcid.jaxb.model.v3.dev1.client.Client)11 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)9 Tile (org.powerbot.script.Tile)8 HashSet (java.util.HashSet)6 ClientRedirectUri (org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri)5 Rectangle (java.awt.Rectangle)4 ClientSummary (org.orcid.jaxb.model.v3.dev1.client.ClientSummary)4 DBUnitTest (org.orcid.test.DBUnitTest)4 Reflector (org.powerbot.bot.Reflector)4 Condition (org.powerbot.script.Condition)4 Client (client.Client)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)3 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)3