use of org.orcid.jaxb.model.v3.dev1.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 int[] c = new int[0];
final Client client = ctx.client();
if (client == null) {
return c;
}
final int[] varpbits = client.getVarpbits();
return varpbits != null ? varpbits.clone() : c;
}
use of org.orcid.jaxb.model.v3.dev1.client.Client in project powerbot by powerbot.
the class Component method _screenPoint.
private Point _screenPoint(final int depth) {
if (depth > RECURSION_DEPTH) {
return new Point(-1, -1);
}
final Client client = ctx.client();
final Widget component = getInternalComponent();
if (client == null || component == null) {
return new Point(-1, -1);
}
final int pId = parentId();
int x = 0, y = 0;
if (pId != -1) {
final Point point = ctx.widgets.component(pId >> 16, pId & 0xffff)._screenPoint(depth + 1);
x = point.x;
y = point.y;
} else {
final Rectangle[] bounds = client.getWidgetBoundsArray();
final int index = component.getBoundsArrayIndex();
if (bounds != null && index > 0 && index < bounds.length && bounds[index] != null) {
return new Point(bounds[index].x, bounds[index].y);
}
}
if (pId != -1) {
final Component child = ctx.widgets.component(pId >> 16, pId & 0xffff);
final int horizontalScrollSize = child.scrollWidthMax(), verticalScrollSize = child.scrollHeightMax();
if (horizontalScrollSize > 0 || verticalScrollSize > 0) {
x -= child.scrollX();
y -= child.scrollY();
}
}
x += component.getX();
y += component.getY();
return new Point(x, y);
}
use of org.orcid.jaxb.model.v3.dev1.client.Client in project powerbot by powerbot.
the class Component method parentId.
public int parentId() {
final Client client = ctx.client();
final Widget component = getInternalComponent();
if (client == null || component == null) {
return -1;
}
final int pId = component.getParentId();
if (pId != -1) {
return pId;
}
final int uid = id() >>> 16;
int i = 0;
for (final ComponentNode node : new HashTable<ComponentNode>(client.getWidgetTable(), ComponentNode.class)) {
if (uid == node.getUid()) {
return (int) node.getId();
}
if (i++ >= 1500) {
System.out.printf("WARNING: parentId operation killed -- beyond depth of %d.%n", 1500);
break;
}
}
return -1;
}
use of org.orcid.jaxb.model.v3.dev1.client.Client in project powerbot by powerbot.
the class Players method get.
/**
* Returns all the {@link org.powerbot.script.rt6.Player}s in the region.
*
* @return an array of all the loaded {@link org.powerbot.script.rt6.Player}s
*/
@Override
protected List<org.powerbot.script.rt6.Player> get() {
final List<org.powerbot.script.rt6.Player> players = new ArrayList<org.powerbot.script.rt6.Player>();
final Client client = ctx.client();
if (client == null) {
return players;
}
final int count = client.getPlayerCount();
final int[] keys = client.getPlayerIndices();
final Player[] arr = client.getPlayers();
if (keys == null || arr == null) {
return players;
}
for (int i = 0; i < Math.min(Math.min(keys.length, arr.length), count); i++) {
final int key = keys[i];
final Player player = arr[key];
if (!player.isNull()) {
players.add(new org.powerbot.script.rt6.Player(ctx, player));
}
}
return players;
}
use of org.orcid.jaxb.model.v3.dev1.client.Client in project powerbot by powerbot.
the class Projectiles method get.
/**
* {@inheritDoc}
*/
@Override
protected List<org.powerbot.script.rt6.Projectile> get() {
final List<org.powerbot.script.rt6.Projectile> items = new ArrayList<org.powerbot.script.rt6.Projectile>();
final Client client = ctx.client();
if (client == null) {
return items;
}
for (final ProjectileNode n : NodeQueue.get(client.getProjectileDeque(), ProjectileNode.class)) {
final Projectile p = n.getProjectile();
if (!p.isNull()) {
items.add(new org.powerbot.script.rt6.Projectile(ctx, p));
}
}
return items;
}
Aggregations