Fix hiding player attacks in client, add option to hide cast as well (#896)

Tiny bit of refactoring as well
This commit is contained in:
Lucwousin
2019-07-05 23:10:02 +02:00
committed by Kyleeld
parent a8cf657e4c
commit 2367f7ee18
19 changed files with 187 additions and 69 deletions

View File

@@ -24,6 +24,7 @@
*/
package net.runelite.mixins;
import java.util.HashSet;
import net.runelite.api.ChatMessageType;
import net.runelite.api.ClanMember;
import net.runelite.api.EnumDefinition;
@@ -200,7 +201,13 @@ public abstract class RSClientMixin implements RSClient
}
@Inject
private static boolean hideFriendAttackOptions;
private static boolean hideFriendAttackOptions = false;
@Inject
private static boolean hideFriendCastOptions = false;
@Inject
private static HashSet<String> unhiddenCasts = new HashSet<String>();
@Inject
@Override
@@ -209,6 +216,20 @@ public abstract class RSClientMixin implements RSClient
hideFriendAttackOptions = yes;
}
@Inject
@Override
public void setHideFriendCastOptions(boolean yes)
{
hideFriendCastOptions = yes;
}
@Inject
@Override
public void setUnhiddenCasts(HashSet<String> casts)
{
unhiddenCasts = casts;
}
@Inject
public RSClientMixin()
{
@@ -1577,6 +1598,13 @@ public abstract class RSClientMixin implements RSClient
@Inject
static boolean shouldHideAttackOptionFor(RSPlayer p)
{
if (client.isSpellSelected())
{
return hideFriendCastOptions
&& (p.isFriended() || p.isClanMember())
&& !unhiddenCasts.contains(client.getSelectedSpellName());
}
return hideFriendAttackOptions && p.isFriended() || p.isClanMember();
}
}