use of org.powerbot.script.rt4.Component in project powerbot by powerbot.
the class WidgetCloser method poll.
@Override
public void poll() {
final List<Integer> w = new ArrayList<Integer>();
if (!ctx.bot().allowTrades()) {
for (final int e : Constants.WIDGETCLOSER_TRADE_ITEMS) {
w.add(e);
}
}
for (final int id : w) {
final AtomicInteger a = attempts.get(id);
if (a.get() >= 3) {
continue;
}
final Component c = ctx.widgets.component(id >> 16, id & 0xffff);
final Point p = c.screenPoint();
if (c.visible() && c.click()) {
if (Condition.wait(new Condition.Check() {
@Override
public boolean poll() {
return !c.visible() || !c.screenPoint().equals(p);
}
})) {
a.set(0);
} else {
a.incrementAndGet();
}
}
}
}
Aggregations