Search in sources :

Example 71 with Client

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];
}
Also used : Client(org.powerbot.bot.rt4.client.Client)

Example 72 with Client

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;
}
Also used : Client(org.powerbot.bot.rt4.client.Client)

Example 73 with Client

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;
}
Also used : ComponentContainer(org.powerbot.bot.rt6.client.ComponentContainer) Client(org.powerbot.bot.rt6.client.Client)

Example 74 with Client

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);
}
Also used : Condition(org.powerbot.script.Condition) Client(org.powerbot.bot.rt6.client.Client) Point(java.awt.Point)

Example 75 with Client

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));
}
Also used : Condition(org.powerbot.script.Condition) Point(java.awt.Point) Client(org.powerbot.bot.rt6.client.Client) Point(java.awt.Point)

Aggregations

Client (org.powerbot.bot.rt4.client.Client)36 Client (org.powerbot.bot.rt6.client.Client)33 Point (java.awt.Point)25 ArrayList (java.util.ArrayList)18 Test (org.junit.Test)17 Client (org.orcid.jaxb.model.v3.dev1.client.Client)11 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)9 Tile (org.powerbot.script.Tile)8 HashSet (java.util.HashSet)6 ClientRedirectUri (org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri)5 Rectangle (java.awt.Rectangle)4 ClientSummary (org.orcid.jaxb.model.v3.dev1.client.ClientSummary)4 DBUnitTest (org.orcid.test.DBUnitTest)4 Reflector (org.powerbot.bot.Reflector)4 Condition (org.powerbot.script.Condition)4 Client (client.Client)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)3 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)3