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;
}
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;
}
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);
}
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()]);
}
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()]);
}
Aggregations