Search in sources :

Example 1 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSActorMixin method getHealth.

@Inject
@Override
public int getHealth() {
    RSCombatInfoList combatInfoList = getCombatInfoList();
    if (combatInfoList != null) {
        RSNode node = combatInfoList.getNode();
        RSNode next = node.getNext();
        if (next instanceof RSCombatInfoListHolder) {
            RSCombatInfoListHolder combatInfoListWrapper = (RSCombatInfoListHolder) next;
            RSCombatInfo2 cf = combatInfoListWrapper.getCombatInfo2();
            return cf.getHealthScale();
        }
    }
    return -1;
}
Also used : RSCombatInfoList(net.runelite.rs.api.RSCombatInfoList) RSCombatInfoListHolder(net.runelite.rs.api.RSCombatInfoListHolder) RSNode(net.runelite.rs.api.RSNode) RSCombatInfo2(net.runelite.rs.api.RSCombatInfo2) Inject(net.runelite.api.mixins.Inject)

Example 2 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSActorMixin method getHealthRatio.

@Inject
@Override
public int getHealthRatio() {
    RSCombatInfoList combatInfoList = getCombatInfoList();
    if (combatInfoList != null) {
        RSNode node = combatInfoList.getNode();
        RSNode next = node.getNext();
        if (next instanceof RSCombatInfoListHolder) {
            RSCombatInfoListHolder combatInfoListWrapper = (RSCombatInfoListHolder) next;
            RSCombatInfoList combatInfoList1 = combatInfoListWrapper.getCombatInfo1();
            RSNode node2 = combatInfoList1.getNode();
            RSNode next2 = node2.getNext();
            if (next2 instanceof RSCombatInfo1) {
                RSCombatInfo1 combatInfo = (RSCombatInfo1) next2;
                return combatInfo.getHealthRatio();
            }
        }
    }
    return -1;
}
Also used : RSCombatInfoList(net.runelite.rs.api.RSCombatInfoList) RSCombatInfoListHolder(net.runelite.rs.api.RSCombatInfoListHolder) RSNode(net.runelite.rs.api.RSNode) RSCombatInfo1(net.runelite.rs.api.RSCombatInfo1) Inject(net.runelite.api.mixins.Inject)

Example 3 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSActorMixin method animationChanged.

@FieldHook("animation")
@Inject
public void animationChanged(int idx) {
    AnimationChanged animationChange = new AnimationChanged();
    animationChange.setActor(this);
    eventBus.post(animationChange);
}
Also used : AnimationChanged(net.runelite.api.events.AnimationChanged) Inject(net.runelite.api.mixins.Inject) FieldHook(net.runelite.api.mixins.FieldHook)

Example 4 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSPlayerMixin method getPolygons.

@Inject
@Override
public Polygon[] getPolygons() {
    Model model = getModel();
    if (model == null) {
        return null;
    }
    int localX = getX();
    int localY = getY();
    int orientation = getOrientation();
    List<Triangle> triangles = model.getTriangles();
    triangles = rotate(triangles, orientation);
    List<Polygon> polys = new ArrayList<Polygon>();
    for (Triangle triangle : triangles) {
        Vertex vx = triangle.getA();
        Vertex vy = triangle.getB();
        Vertex vz = triangle.getC();
        Point x = Perspective.worldToCanvas(client, localX - vx.getX(), localY - vx.getZ(), -vx.getY());
        Point y = Perspective.worldToCanvas(client, localX - vy.getX(), localY - vy.getZ(), -vy.getY());
        Point z = Perspective.worldToCanvas(client, localX - vz.getX(), localY - vz.getZ(), -vz.getY());
        int[] xx = { x.getX(), y.getX(), z.getX() };
        int[] yy = { x.getY(), y.getY(), z.getY() };
        polys.add(new Polygon(xx, yy, 3));
    }
    return polys.toArray(new Polygon[polys.size()]);
}
Also used : Vertex(net.runelite.api.model.Vertex) Model(net.runelite.api.Model) Triangle(net.runelite.api.model.Triangle) ArrayList(java.util.ArrayList) Point(net.runelite.api.Point) Polygon(java.awt.Polygon) Point(net.runelite.api.Point) Inject(net.runelite.api.mixins.Inject)

Example 5 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSClientMixin method getGroup.

@Inject
@Override
public Widget[] getGroup(int groupId) {
    RSWidget[][] widgets = getWidgets();
    if (widgets == null || groupId < 0 || groupId >= widgets.length || widgets[groupId] == null) {
        return null;
    }
    List<Widget> w = new ArrayList<Widget>();
    for (Widget widget : widgets[groupId]) {
        if (widget != null) {
            w.add(widget);
        }
    }
    return w.toArray(new Widget[w.size()]);
}
Also used : Widget(net.runelite.api.widgets.Widget) RSWidget(net.runelite.rs.api.RSWidget) ArrayList(java.util.ArrayList) Inject(net.runelite.api.mixins.Inject)

Aggregations

Inject (net.runelite.api.mixins.Inject)57 Point (net.runelite.api.Point)20 FieldHook (net.runelite.api.mixins.FieldHook)20 ArrayList (java.util.ArrayList)14 LocalPoint (net.runelite.api.coords.LocalPoint)10 RSWidget (net.runelite.rs.api.RSWidget)6 Vertex (net.runelite.api.model.Vertex)5 Widget (net.runelite.api.widgets.Widget)5 Node (net.runelite.api.Node)4 RSNode (net.runelite.rs.api.RSNode)4 WidgetNode (net.runelite.api.WidgetNode)3 Triangle (net.runelite.api.model.Triangle)3 Polygon (java.awt.Polygon)2 MenuEntry (net.runelite.api.MenuEntry)2 Model (net.runelite.api.Model)2 NPC (net.runelite.api.NPC)2 Player (net.runelite.api.Player)2 Skill (net.runelite.api.Skill)2 WidgetItem (net.runelite.api.widgets.WidgetItem)2 RSCombatInfoList (net.runelite.rs.api.RSCombatInfoList)2