Bring player targeted by hint arrow to front (while not in combat)

This commit is contained in:
Lucwousin
2020-06-27 15:09:15 +02:00
parent d80f6a211c
commit 81542d02a6
2 changed files with 16 additions and 0 deletions

View File

@@ -1196,6 +1196,18 @@ public abstract class RSClientMixin implements RSClient
client.getCallbacks().post(CanvasSizeChanged.class, CanvasSizeChanged.INSTANCE);
}
@FieldHook("hintArrowPlayerIndex")
@Inject
public static void hintPlayerChanged(int ignored)
{
// Setting the localInteractingIndex (aka player target index, it only applies to players)
// causes that player to get priority over others when rendering/menus are added
if (client.getVar(VarPlayer.ATTACKING_PLAYER) == -1)
{
client.setLocalInteractingIndex(client.getHintArrowPlayerTargetIdx() & 2047);
}
}
@Inject
@Override
public boolean hasHintArrow()
@@ -1247,6 +1259,7 @@ public abstract class RSClientMixin implements RSClient
{
client.setHintArrowTargetType(HintArrowType.PLAYER.getValue());
client.setHintArrowPlayerTargetIdx(((RSPlayer) player).getPlayerId());
hintPlayerChanged(-1);
}
@Inject

View File

@@ -234,6 +234,9 @@ public interface RSClient extends RSGameShell, Client
@Import("combatTargetPlayerIndex")
int getLocalInteractingIndex();
@Import("combatTargetPlayerIndex")
void setLocalInteractingIndex(int idx);
@Import("groundItems")
RSNodeDeque[][][] getGroundItemDeque();