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;
}
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();
}
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();
}
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;
}
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;
}
Aggregations