use of net.runelite.api.WidgetNode in project runelite by runelite.
the class RSWidgetMixin method getNestedChildren.
@Inject
@Override
public Widget[] getNestedChildren() {
RSHashTable componentTable = client.getComponentTable();
int group = -1;
// iteration here...
for (Node node : componentTable.getNodes()) {
WidgetNode wn = (WidgetNode) node;
if (wn.getHash() == getId()) {
group = wn.getId();
break;
}
}
if (group == -1) {
return new Widget[0];
}
List<Widget> widgets = new ArrayList<Widget>();
for (Widget widget : client.getGroup(group)) {
if (widget != null && widget.getParentId() == getId()) {
widgets.add(widget);
}
}
return widgets.toArray(new Widget[widgets.size()]);
}
use of net.runelite.api.WidgetNode in project runelite by runelite.
the class RSWidgetMixin method getParentId.
@Inject
@Override
public int getParentId() {
int parentId = getRSParentId();
if (parentId != -1) {
return parentId;
}
int groupId = TO_GROUP(getId());
RSHashTable componentTable = client.getComponentTable();
RSNode[] buckets = componentTable.getBuckets();
for (int i = 0; i < buckets.length; ++i) {
Node node = buckets[i];
// It looks like the first node in the bucket is always
// a sentinel
Node cur = node.getNext();
while (cur != node) {
WidgetNode wn = (WidgetNode) cur;
if (groupId == wn.getId()) {
return (int) wn.getHash();
}
cur = cur.getNext();
}
}
return -1;
}
Aggregations