Search in sources :

Example 76 with Client

use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.

the class Skills method realLevels.

public int[] realLevels() {
    final Client c = ctx.client();
    final int[] arr = c != null ? c.getSkillLevels2() : new int[0];
    return arr != null ? arr : new int[0];
}
Also used : Client(org.powerbot.bot.rt4.client.Client)

Example 77 with Client

use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.

the class Skills method levels.

public int[] levels() {
    final Client c = ctx.client();
    final int[] arr = c != null ? c.getSkillLevels1() : new int[0];
    return arr != null ? arr : new int[0];
}
Also used : Client(org.powerbot.bot.rt4.client.Client)

Example 78 with Client

use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.

the class Varpbits method array.

/**
 * Returns the array of settings for the game.
 *
 * @return an array of the game's settings
 */
public int[] array() {
    final int[] c = new int[0];
    final Client client = ctx.client();
    if (client == null) {
        return c;
    }
    final int[] varpbits = client.getVarpbits();
    return varpbits != null ? varpbits.clone() : c;
}
Also used : Client(org.powerbot.bot.rt4.client.Client)

Example 79 with Client

use of ru.compscicenter.hpc2016.ha1.client.Client in project powerbot by powerbot.

the class Component method _screenPoint.

private Point _screenPoint(final int depth) {
    if (depth > RECURSION_DEPTH) {
        return new Point(-1, -1);
    }
    final Client client = ctx.client();
    final Widget component = getInternalComponent();
    if (client == null || component == null) {
        return new Point(-1, -1);
    }
    final int pId = parentId();
    int x = 0, y = 0;
    if (pId != -1) {
        final Point point = ctx.widgets.component(pId >> 16, pId & 0xffff)._screenPoint(depth + 1);
        x = point.x;
        y = point.y;
    } else {
        final Rectangle[] bounds = client.getWidgetBoundsArray();
        final int index = component.getBoundsArrayIndex();
        if (bounds != null && index > 0 && index < bounds.length && bounds[index] != null) {
            return new Point(bounds[index].x, bounds[index].y);
        }
    }
    if (pId != -1) {
        final Component child = ctx.widgets.component(pId >> 16, pId & 0xffff);
        final int horizontalScrollSize = child.scrollWidthMax(), verticalScrollSize = child.scrollHeightMax();
        if (horizontalScrollSize > 0 || verticalScrollSize > 0) {
            x -= child.scrollX();
            y -= child.scrollY();
        }
    }
    x += component.getX();
    y += component.getY();
    return new Point(x, y);
}
Also used : Widget(org.powerbot.bot.rt6.client.Widget) Rectangle(java.awt.Rectangle) Point(java.awt.Point) Client(org.powerbot.bot.rt6.client.Client) Point(java.awt.Point)

Example 80 with Client

use of ru.compscicenter.hpc2016.ha1.client.Client 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;
}
Also used : HashTable(org.powerbot.bot.rt6.HashTable) Widget(org.powerbot.bot.rt6.client.Widget) Client(org.powerbot.bot.rt6.client.Client) ComponentNode(org.powerbot.bot.rt6.client.ComponentNode) 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)13 Client (org.orcid.jaxb.model.v3.dev1.client.Client)11 Test (org.junit.Test)8 Tile (org.powerbot.script.Tile)8 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)6 HashSet (java.util.HashSet)5 Rectangle (java.awt.Rectangle)4 Reflector (org.powerbot.bot.Reflector)4 Condition (org.powerbot.script.Condition)4 Client (client.Client)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)3 ClientRedirectUri (org.orcid.jaxb.model.v3.dev1.client.ClientRedirectUri)3 Graphics (java.awt.Graphics)2 LinkedList (java.util.LinkedList)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ScopePathType (org.orcid.jaxb.model.message.ScopePathType)2