use of org.powerbot.bot.rt6.client.ComponentNode 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