Search in sources :

Example 1 with LinkedListNode

use of org.powerbot.bot.rt6.client.LinkedListNode in project powerbot by powerbot.

the class Actor method getBarData.

private CombatStatusData[] getBarData() {
    final LinkedListNode[] nodes = getBarNodes();
    final Client client = ctx.client();
    if (nodes == null || client == null) {
        return null;
    }
    final CombatStatusData[] data = new CombatStatusData[nodes.length];
    for (int i = 0; i < nodes.length; i++) {
        if (nodes[i] == null || nodes[i].isNull() || !nodes[i].isTypeOf(CombatStatus.class)) {
            data[i] = null;
            continue;
        }
        final CombatStatus status = new CombatStatus(nodes[i].reflector, nodes[i]);
        final org.powerbot.bot.rt6.client.LinkedList statuses;
        try {
            statuses = status.getList();
        } catch (final IllegalArgumentException ignored) {
            continue;
        }
        if (statuses == null) {
            data[i] = null;
            continue;
        }
        final LinkedListNode node = statuses.getSentinel().getNext();
        if (node.isNull() || !node.isTypeOf(CombatStatusData.class)) {
            data[i] = null;
            continue;
        }
        data[i] = new CombatStatusData(node.reflector, node);
    }
    return data;
}
Also used : CombatStatus(org.powerbot.bot.rt6.client.CombatStatus) LinkedListNode(org.powerbot.bot.rt6.client.LinkedListNode) CombatStatusData(org.powerbot.bot.rt6.client.CombatStatusData) Client(org.powerbot.bot.rt6.client.Client) Point(java.awt.Point)

Example 2 with LinkedListNode

use of org.powerbot.bot.rt6.client.LinkedListNode in project powerbot by powerbot.

the class Actor method getBarNodes.

private LinkedListNode[] getBarNodes() {
    final org.powerbot.bot.rt6.client.Actor accessor = getAccessor();
    if (accessor == null) {
        return null;
    }
    final org.powerbot.bot.rt6.client.LinkedList barList = accessor.getCombatStatusList();
    if (barList == null) {
        return null;
    }
    final LinkedListNode tail = barList.getSentinel();
    final LinkedListNode health;
    final LinkedListNode adrenaline;
    final LinkedListNode current;
    current = tail.getNext();
    if (!current.getNext().equals(tail)) {
        adrenaline = current;
        health = current.getNext();
    } else {
        adrenaline = null;
        health = current;
    }
    return new LinkedListNode[] { adrenaline, health };
}
Also used : LinkedListNode(org.powerbot.bot.rt6.client.LinkedListNode)

Aggregations

LinkedListNode (org.powerbot.bot.rt6.client.LinkedListNode)2 Point (java.awt.Point)1 Client (org.powerbot.bot.rt6.client.Client)1 CombatStatus (org.powerbot.bot.rt6.client.CombatStatus)1 CombatStatusData (org.powerbot.bot.rt6.client.CombatStatusData)1