updated oppInfo to have Opponent HP percent
This commit is contained in:
@@ -25,6 +25,12 @@
|
||||
|
||||
package net.runelite.api;
|
||||
|
||||
import net.runelite.rs.api.CombatInfo1;
|
||||
import net.runelite.rs.api.CombatInfo2;
|
||||
import net.runelite.rs.api.CombatInfoList;
|
||||
import net.runelite.rs.api.CombatInfoListHolder;
|
||||
import net.runelite.rs.api.Node;
|
||||
|
||||
public abstract class Actor extends Renderable
|
||||
{
|
||||
private Client client;
|
||||
@@ -38,6 +44,8 @@ public abstract class Actor extends Renderable
|
||||
this.actor = actor;
|
||||
}
|
||||
|
||||
public abstract int getCombatLevel();
|
||||
|
||||
public abstract String getName();
|
||||
|
||||
public Actor getInteracting()
|
||||
@@ -58,4 +66,45 @@ public abstract class Actor extends Renderable
|
||||
i = i - 32767 - 1;
|
||||
return client.getPlayers()[i];
|
||||
}
|
||||
|
||||
public int getHealthRatio()
|
||||
{
|
||||
CombatInfoList combatInfoList = actor.getCombatInfoList();
|
||||
if (combatInfoList != null)
|
||||
{
|
||||
Node node = combatInfoList.getNode();
|
||||
Node next = node.getNext();
|
||||
if (next instanceof CombatInfoListHolder)
|
||||
{
|
||||
CombatInfoListHolder combatInfoListWrapper = (CombatInfoListHolder) next;
|
||||
CombatInfoList combatInfoList1 = combatInfoListWrapper.getCombatInfo1();
|
||||
|
||||
Node node2 = combatInfoList1.getNode();
|
||||
Node next2 = node2.getNext();
|
||||
if (next2 instanceof CombatInfo1)
|
||||
{
|
||||
CombatInfo1 combatInfo = (CombatInfo1) next2;
|
||||
return combatInfo.getHealthRatio();
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getHealth()
|
||||
{
|
||||
CombatInfoList combatInfoList = actor.getCombatInfoList();
|
||||
if (combatInfoList != null)
|
||||
{
|
||||
Node node = combatInfoList.getNode();
|
||||
Node next = node.getNext();
|
||||
if (next instanceof CombatInfoListHolder)
|
||||
{
|
||||
CombatInfoListHolder combatInfoListWrapper = (CombatInfoListHolder) next;
|
||||
CombatInfo2 cf = combatInfoListWrapper.getCombatInfo2();
|
||||
return cf.getHealthScale();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +42,11 @@ public class NPC extends Actor
|
||||
{
|
||||
return npc.getComposition().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCombatLevel()
|
||||
{
|
||||
return npc.getComposition().getCombatLevel();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,4 +43,11 @@ public class Player extends Actor
|
||||
{
|
||||
return player.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCombatLevel()
|
||||
{
|
||||
return player.getCombatLevel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user