use of client.Client in project powerbot by powerbot.
the class Skills method realLevels.
public int[] realLevels() {
final Client c = ctx.client();
final int[] arr = c != null ? c.getSkillLevels2() : new int[0];
return arr != null ? arr : new int[0];
}
use of client.Client in project powerbot by powerbot.
the class Skills method levels.
public int[] levels() {
final Client c = ctx.client();
final int[] arr = c != null ? c.getSkillLevels1() : new int[0];
return arr != null ? arr : new int[0];
}
use of 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 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 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;
}
Aggregations