runelite-api: expand hint arrow api

This commit is contained in:
Adam
2018-05-21 08:20:48 -04:00
parent 2c5284d597
commit 0fe49ec2df
2 changed files with 85 additions and 0 deletions

View File

@@ -884,6 +884,29 @@ public abstract class RSClientMixin implements RSClient
return client.getHintArrowTargetType() != HintArrowType.NONE.getValue();
}
@Inject
@Override
public HintArrowType getHintArrowType()
{
int type = client.getHintArrowTargetType();
if (type == HintArrowType.NPC.getValue())
{
return HintArrowType.NPC;
}
else if (type == HintArrowType.PLAYER.getValue())
{
return HintArrowType.PLAYER;
}
else if (type == HintArrowType.WORLD_POSITION.getValue())
{
return HintArrowType.WORLD_POSITION;
}
else
{
return HintArrowType.NONE;
}
}
@Inject
@Override
public void clearHintArrow()
@@ -919,6 +942,60 @@ public abstract class RSClientMixin implements RSClient
client.setHintArrowOffsetY(LOCAL_TILE_SIZE / 2);
}
@Inject
@Override
public WorldPoint getHintArrowPoint()
{
if (getHintArrowType() == HintArrowType.WORLD_POSITION)
{
int x = client.getHintArrowX();
int y = client.getHintArrowY();
return new WorldPoint(x, y, client.getPlane());
}
return null;
}
@Inject
@Override
public Player getHintArrowPlayer()
{
if (getHintArrowType() == HintArrowType.PLAYER)
{
int idx = client.getHintArrowPlayerTargetIdx();
RSPlayer[] players = client.getCachedPlayers();
if (idx < 0 || idx >= players.length)
{
return null;
}
return players[idx];
}
return null;
}
@Inject
@Override
public NPC getHintArrowNpc()
{
if (getHintArrowType() == HintArrowType.NPC)
{
int idx = client.getHintArrowNpcTargetIdx();
RSNPC[] npcs = client.getCachedNPCs();
if (idx < 0 || idx >= npcs.length)
{
return null;
}
return npcs[idx];
}
return null;
}
@Copy("menuAction")
static void rs$menuAction(int var0, int var1, int var2, int var3, String var4, String var5, int var6, int var7)
{