use of org.orcid.jaxb.model.v3.dev1.client.Client in project powerbot by powerbot.
the class Game method crosshair.
/**
* Determines the current {@link Crosshair} displayed.
*
* @return the displayed {@link Crosshair}
*/
public Crosshair crosshair() {
final Client client = ctx.client();
final int type = client != null ? client.getCrosshairIndex() : -1;
if (type < 0 || type > 2) {
return Crosshair.NONE;
}
return Crosshair.values()[type];
}
use of org.orcid.jaxb.model.v3.dev1.client.Client in project powerbot by powerbot.
the class Game method hintArrow.
/**
* The {@link HintArrow}.
*
* @return {@link HintArrow}.
*/
public HintArrow hintArrow() {
// TODO: hint arrow
final HintArrow r = new HintArrow();
final Client client = ctx.client();
if (client == null) {
return r;
}
return r;
}
use of org.orcid.jaxb.model.v3.dev1.client.Client in project powerbot by powerbot.
the class Widget method getInternalComponents.
Object[] getInternalComponents() {
final Client client = ctx.client();
if (client == null) {
return null;
}
final Object[] containers = client.getWidgets();
final ComponentContainer container;
if (containers != null && index >= 0 && index < containers.length && !(container = new ComponentContainer(client.reflector, containers[index])).isNull()) {
return container.getComponents();
}
return null;
}
use of org.orcid.jaxb.model.v3.dev1.client.Client in project powerbot by powerbot.
the class Menu method close.
/**
* Closes the menu.
*
* @return {@code true} if the menu was closed, otherwise {@code false}
*/
public boolean close() {
final Client client = ctx.client();
if (client == null) {
return false;
}
if (!client.isMenuOpen()) {
return true;
}
final Game.Viewport v = ctx.game.getViewport();
final int mx = client.getMenuX(), my = client.getMenuY();
int x1, x2;
final int y1, y2;
x1 = x2 = mx;
y1 = y2 = Math.min((int) v.my - 5, Math.max(4, my + Random.nextInt(-10, 10)));
x1 = Math.max(4, x1 + Random.nextInt(-30, -10));
x2 = x2 + client.getMenuWidth() + (client.isMenuCollapsed() ? client.getSubMenuWidth() : 0) + Random.nextInt(10, 30);
if (x2 <= (int) v.mx - 5 && (x1 - mx >= 5 || Random.nextBoolean())) {
ctx.input.move(x2, y2);
} else {
ctx.input.move(x1, y1);
}
return Condition.wait(new Condition.Check() {
@Override
public boolean poll() {
return client.isMenuOpen();
}
}, 10, 50);
}
use of org.orcid.jaxb.model.v3.dev1.client.Client in project powerbot by powerbot.
the class Menu method select.
private boolean select(final Filter<? super MenuCommand> filter, final boolean click) {
final Client client = ctx.client();
if (client == null) {
return false;
}
int index = indexOf(filter);
if (index == -1) {
return false;
}
if (click && !client.isMenuOpen() && !Condition.wait(new Condition.Check() {
@Override
public boolean poll() {
return indexOf(filter) != 0 && !filter.accept(tooltip());
}
}, 10, 10)) {
return ctx.input.click(true);
}
if (!client.isMenuOpen()) {
if (ctx.input.click(false)) {
Condition.wait(new Condition.Check() {
@Override
public boolean poll() {
return client.isMenuOpen();
}
}, 5, 20);
Condition.sleep(Random.hicks(index));
if (!client.isMenuOpen()) {
return false;
}
if ((index = indexOf(filter)) == -1) {
close();
return false;
}
}
}
final Point p = hoverIndex(client, index);
return p.getX() != -1 && p.getY() != -1 && (!click || ctx.input.click(p, true));
}
Aggregations