Rework clanmanmode attack option hiding (#746)
* A whole bunch of refactoring * Api/mixins/injector additions for hiding attack options * Rework clanmanmode attack hiding * Update Client.java
This commit is contained in:
@@ -199,6 +199,16 @@ public abstract class RSClientMixin implements RSClient
|
||||
printMenuActions = yes;
|
||||
}
|
||||
|
||||
@Inject
|
||||
private static boolean hideFriendAttackOptions;
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setHideFriendAttackOptions(boolean yes)
|
||||
{
|
||||
hideFriendAttackOptions = yes;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public RSClientMixin()
|
||||
{
|
||||
@@ -1570,4 +1580,10 @@ public abstract class RSClientMixin implements RSClient
|
||||
getHealthBarCache().reset();
|
||||
getHealthBarSpriteCache().reset();
|
||||
}
|
||||
|
||||
@Inject
|
||||
static boolean shouldHideAttackOptionFor(RSPlayer p)
|
||||
{
|
||||
return hideFriendAttackOptions && p.isFriended() || p.isClanMember();
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,7 @@ import static net.runelite.api.SkullIcon.DEAD_MAN_TWO;
|
||||
import static net.runelite.api.SkullIcon.SKULL;
|
||||
import static net.runelite.api.SkullIcon.SKULL_FIGHT_PIT;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.mixins.MethodHook;
|
||||
import net.runelite.api.model.Triangle;
|
||||
import net.runelite.api.model.Vertex;
|
||||
import java.awt.Polygon;
|
||||
@@ -64,6 +65,9 @@ public abstract class RSPlayerMixin implements RSPlayer
|
||||
@Shadow("client")
|
||||
private static RSClient client;
|
||||
|
||||
@Inject
|
||||
private boolean friended;
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public String getName()
|
||||
@@ -255,4 +259,17 @@ public abstract class RSPlayerMixin implements RSPlayer
|
||||
setSpotAnimationFrame(spotAnimFrame);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
public boolean isFriended()
|
||||
{
|
||||
return isFriend() || friended;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@MethodHook(value = "checkIsFriend", end = true)
|
||||
void updateFriended()
|
||||
{
|
||||
friended = client.getFriendManager().isFriended(getRsName(), false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user