Search in sources :

Example 11 with Client

use of org.orcid.jaxb.model.v3.dev1.client.Client in project ORCID-Source by ORCID.

the class JpaJaxbClientAdapterTest method toEntity_withExistingEntityTest.

@Test
public void toEntity_withExistingEntityTest() {
    Client client = getClient();
    ClientDetailsEntity existingEntity = getClientDetailsEntity();
    existingEntity = adapter.toEntity(client, existingEntity);
    assertEquals(getClientDetailsEntity(), existingEntity);
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Client(org.orcid.jaxb.model.v3.dev1.client.Client) Test(org.junit.Test)

Example 12 with Client

use of org.orcid.jaxb.model.v3.dev1.client.Client in project ORCID-Source by ORCID.

the class JpaJaxbClientAdapterTest method getClientSummary.

private ClientSummary getClientSummary() {
    ClientSummary summary = new ClientSummary();
    summary.setDescription("description");
    summary.setName("client-name");
    return summary;
}
Also used : ClientSummary(org.orcid.jaxb.model.v3.dev1.client.ClientSummary)

Example 13 with Client

use of org.orcid.jaxb.model.v3.dev1.client.Client in project ORCID-Source by ORCID.

the class JpaJaxbClientAdapterTest method toClientListTest.

@Test
public void toClientListTest() {
    ClientDetailsEntity entity1 = getClientDetailsEntity();
    List<ClientDetailsEntity> entities = new ArrayList<ClientDetailsEntity>();
    entities.add(entity1);
    Set<Client> clients = adapter.toClientList(entities);
    assertEquals(1, clients.size());
    for (Client client : clients) {
        assertEquals(getClient(), client);
    }
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) ArrayList(java.util.ArrayList) Client(org.orcid.jaxb.model.v3.dev1.client.Client) Test(org.junit.Test)

Example 14 with Client

use of org.orcid.jaxb.model.v3.dev1.client.Client in project powerbot by powerbot.

the class DrawBoundaries method repaint.

@Override
public void repaint(final Graphics render) {
    if (!ctx.game.loggedIn()) {
        return;
    }
    final Client client = ctx.client();
    final RelativeLocation r = ctx.players.local().relative();
    final float rx = r.x();
    final float ry = r.z();
    final Component component = ctx.game.mapComponent();
    final int w = component.scrollWidth();
    final int h = component.scrollHeight();
    final int radius = Math.max(w / 2, h / 2) + 10;
    final boolean f = client.getMinimapSettings() == client.reflector.getConstant("V_MINIMAP_SCALE_ON_VALUE");
    final double a = ctx.camera.rotation() * 16384d / (Math.PI * 2d);
    int i = 0x3fff & (int) a;
    if (!f) {
        i = 0x3fff & client.getMinimapOffset() + (int) a;
    }
    int sin = Game.SIN_TABLE[i], cos = Game.COS_TABLE[i];
    if (!f) {
        final int scale = 256 + client.getMinimapScale();
        sin = 256 * sin / scale;
        cos = 256 * cos / scale;
    }
    final CollisionMap map = ctx.movement.collisionMap();
    final int mapWidth = map.width() - 6;
    final int mapHeight = map.height() - 6;
    final Point[][] points = new Point[mapWidth][mapHeight];
    final Point sp = component.screenPoint();
    for (int x = 0; x < mapWidth; ++x) {
        for (int y = 0; y < mapHeight; ++y) {
            Point p = map(x, y, rx, ry, w, h, radius, sin, cos, sp);
            if (p.x == -1 || p.y == -1) {
                p = null;
            }
            points[x][y] = p;
        }
    }
    final CollisionFlag collisionFlag = CollisionFlag.DEAD_BLOCK.mark(CollisionFlag.OBJECT_BLOCK);
    for (int x = 1; x < mapWidth - 1; ++x) {
        for (int y = 1; y < mapHeight - 1; ++y) {
            final Point tl = points[x][y];
            final Point tr = points[x + 1][y];
            final Point br = points[x + 1][y + 1];
            final Point bl = points[x][y + 1];
            if (tl != null && tr != null && br != null && bl != null) {
                render.setColor(map.flagAt(x, y).contains(collisionFlag) ? new Color(255, 0, 0, 50) : new Color(0, 255, 0, 50));
                render.fillPolygon(new int[] { tl.x, tr.x, br.x, bl.x }, new int[] { tl.y, tr.y, br.y, bl.y }, 4);
            }
        }
    }
}
Also used : RelativeLocation(org.powerbot.script.rt6.RelativeLocation) CollisionFlag(org.powerbot.script.rt6.CollisionFlag) Color(java.awt.Color) Point(java.awt.Point) Client(org.powerbot.bot.rt6.client.Client) Component(org.powerbot.script.rt6.Component) CollisionMap(org.powerbot.script.rt6.CollisionMap) Point(java.awt.Point)

Example 15 with Client

use of org.orcid.jaxb.model.v3.dev1.client.Client in project powerbot by powerbot.

the class Component method getInternalComponent.

private Widget getInternalComponent() {
    if (index < 0 || widget.id() < 1) {
        return null;
    }
    final Object[] components;
    if (parent != null) {
        final Widget parentComponent = parent.getInternalComponent();
        components = parentComponent != null ? parentComponent.getComponents() : null;
    } else {
        components = widget.getInternalComponents();
    }
    final Client c = ctx.client();
    return c != null && components != null && index < components.length ? new Widget(c.reflector, components[index]) : null;
}
Also used : Widget(org.powerbot.bot.rt6.client.Widget) Client(org.powerbot.bot.rt6.client.Client)

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