project: add missing features (#2951)
* client: add stuff client: add stuff * mixins * Update XpDropEvent.java * Update EntityHiderBridgeMixin.java * would help if I uploaded the right files would help if I uploaded the right files
This commit is contained in:
@@ -1637,6 +1637,63 @@ public interface Client extends GameEngine
|
|||||||
*/
|
*/
|
||||||
void setHideSpecificPlayers(List<String> names);
|
void setHideSpecificPlayers(List<String> names);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of NPC indices that are currently hidden
|
||||||
|
*
|
||||||
|
* @return all of the current hidden NPC Indices
|
||||||
|
*/
|
||||||
|
List<Integer> getHiddenNpcIndices();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If an NPC index is in this List then do not render it
|
||||||
|
*
|
||||||
|
* @param npcIndices the npc indices to hide
|
||||||
|
*/
|
||||||
|
void setHiddenNpcIndices(List<Integer> npcIndices);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increments the counter for how many times this npc has been selected to be hidden on death
|
||||||
|
*
|
||||||
|
* @param name npc name
|
||||||
|
*/
|
||||||
|
void addHiddenNpcDeath(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrements the counter for how many times this npc has been selected to be hidden on death
|
||||||
|
*
|
||||||
|
* @param name npc name
|
||||||
|
*/
|
||||||
|
void removeHiddenNpcDeath(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increments the counter for how many times this npc has been selected to be hidden
|
||||||
|
*
|
||||||
|
* @param name npc name
|
||||||
|
*/
|
||||||
|
void addHiddenNpcName(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrements the counter for how many times this npc has been selected to be hidden
|
||||||
|
*
|
||||||
|
* @param name npc name
|
||||||
|
*/
|
||||||
|
void removeHiddenNpcName(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether or not other players are hidden.
|
||||||
|
*
|
||||||
|
* @param state the new player hidden state
|
||||||
|
*/
|
||||||
|
void setPlayersHidden(boolean state);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether 2D sprites (ie. overhead prayers, PK skull) related to
|
||||||
|
* the other players are hidden.
|
||||||
|
*
|
||||||
|
* @param state the new player 2D hidden state
|
||||||
|
*/
|
||||||
|
void setPlayersHidden2D(boolean state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether projectiles are hidden.
|
* Sets whether projectiles are hidden.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.openosrs.client.game;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import net.runelite.api.Skill;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XpDropEvent
|
||||||
|
{
|
||||||
|
private Skill skill;
|
||||||
|
private int exp;
|
||||||
|
}
|
||||||
@@ -39,6 +39,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.ChatLineBuffer;
|
import net.runelite.api.ChatLineBuffer;
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
@@ -131,6 +132,14 @@ public class FriendsChatPlugin extends Plugin
|
|||||||
|
|
||||||
private boolean kickConfirmed = false;
|
private boolean kickConfirmed = false;
|
||||||
|
|
||||||
|
private static final CopyOnWriteArrayList<Player> clanMembers = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static CopyOnWriteArrayList<Player> getClanMembers()
|
||||||
|
{
|
||||||
|
return (CopyOnWriteArrayList<Player>) clanMembers.clone();
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
FriendsChatConfig getConfig(ConfigManager configManager)
|
FriendsChatConfig getConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,6 +25,9 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.mixins;
|
package net.runelite.mixins;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
@@ -38,6 +41,12 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
|||||||
@Inject
|
@Inject
|
||||||
public static boolean isHidingEntities;
|
public static boolean isHidingEntities;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public static boolean hidePlayers;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public static boolean hidePlayers2D;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public static boolean hideOthers;
|
public static boolean hideOthers;
|
||||||
|
|
||||||
@@ -77,9 +86,21 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
|||||||
@Inject
|
@Inject
|
||||||
public static boolean hideDeadNPCs;
|
public static boolean hideDeadNPCs;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public static Set<Integer> blacklistDeadNpcs = new HashSet<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public static List<String> hideSpecificPlayers = new ArrayList<>();
|
public static List<String> hideSpecificPlayers = new ArrayList<>();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public static HashMap<String, Integer> hiddenNpcsDeath = new HashMap<>();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public static HashMap<String, Integer> hiddenNpcsName = new HashMap<>();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public static List<Integer> hiddenNpcIndices = new ArrayList<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
public void setIsHidingEntities(boolean state)
|
public void setIsHidingEntities(boolean state)
|
||||||
@@ -184,4 +205,95 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
|||||||
{
|
{
|
||||||
hideDeadNPCs = state;
|
hideDeadNPCs = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void addHiddenNpcDeath(String npc)
|
||||||
|
{
|
||||||
|
npc = npc.toLowerCase();
|
||||||
|
int i = hiddenNpcsDeath.getOrDefault(npc, 0);
|
||||||
|
if (i == Integer.MAX_VALUE)
|
||||||
|
{
|
||||||
|
throw new RuntimeException("NPC death " + npc + " has been hidden Integer.MAX_VALUE times, is something wrong?");
|
||||||
|
}
|
||||||
|
|
||||||
|
hiddenNpcsDeath.put(npc, ++i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void removeHiddenNpcDeath(String npc)
|
||||||
|
{
|
||||||
|
npc = npc.toLowerCase();
|
||||||
|
int i = hiddenNpcsDeath.getOrDefault(npc, 0);
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hiddenNpcsDeath.put(npc, --i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void setBlacklistDeadNpcs(Set<Integer> blacklist)
|
||||||
|
{
|
||||||
|
blacklistDeadNpcs = blacklist;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void addHiddenNpcName(String npc)
|
||||||
|
{
|
||||||
|
npc = npc.toLowerCase();
|
||||||
|
int i = hiddenNpcsName.getOrDefault(npc, 0);
|
||||||
|
if (i == Integer.MAX_VALUE)
|
||||||
|
{
|
||||||
|
throw new RuntimeException("NPC name " + npc + " has been hidden Integer.MAX_VALUE times, is something wrong?");
|
||||||
|
}
|
||||||
|
|
||||||
|
hiddenNpcsName.put(npc, ++i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void removeHiddenNpcName(String npc)
|
||||||
|
{
|
||||||
|
npc = npc.toLowerCase();
|
||||||
|
int i = hiddenNpcsName.getOrDefault(npc, 0);
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hiddenNpcsName.put(npc, --i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void setPlayersHidden(boolean state)
|
||||||
|
{
|
||||||
|
hidePlayers = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void setPlayersHidden2D(boolean state)
|
||||||
|
{
|
||||||
|
hidePlayers2D = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void setHiddenNpcIndices(List<Integer> npcIndices)
|
||||||
|
{
|
||||||
|
hiddenNpcIndices = npcIndices;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public List<Integer> getHiddenNpcIndices()
|
||||||
|
{
|
||||||
|
return hiddenNpcIndices;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,10 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.mixins;
|
package net.runelite.mixins;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Set;
|
||||||
import net.runelite.api.mixins.*;
|
import net.runelite.api.mixins.*;
|
||||||
|
import net.runelite.api.util.Text;
|
||||||
import net.runelite.rs.api.*;
|
import net.runelite.rs.api.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -39,6 +42,12 @@ public abstract class EntityHiderMixin implements RSScene
|
|||||||
@Shadow("isHidingEntities")
|
@Shadow("isHidingEntities")
|
||||||
private static boolean isHidingEntities;
|
private static boolean isHidingEntities;
|
||||||
|
|
||||||
|
@Shadow("hidePlayers")
|
||||||
|
private static boolean hidePlayers;
|
||||||
|
|
||||||
|
@Shadow("hidePlayers2D")
|
||||||
|
private static boolean hidePlayers2D;
|
||||||
|
|
||||||
@Shadow("hideOthers")
|
@Shadow("hideOthers")
|
||||||
private static boolean hideOthers;
|
private static boolean hideOthers;
|
||||||
|
|
||||||
@@ -63,9 +72,18 @@ public abstract class EntityHiderMixin implements RSScene
|
|||||||
@Shadow("hideNPCs")
|
@Shadow("hideNPCs")
|
||||||
private static boolean hideNPCs;
|
private static boolean hideNPCs;
|
||||||
|
|
||||||
|
@Shadow("hiddenNpcsName")
|
||||||
|
private static HashMap<String, Integer> hiddenNpcsName;
|
||||||
|
|
||||||
|
@Shadow("hiddenNpcsDeath")
|
||||||
|
private static HashMap<String, Integer> hiddenNpcsDeath;
|
||||||
|
|
||||||
@Shadow("hideSpecificPlayers")
|
@Shadow("hideSpecificPlayers")
|
||||||
private static List<String> hideSpecificPlayers;
|
private static List<String> hideSpecificPlayers;
|
||||||
|
|
||||||
|
@Shadow("blacklistDeadNpcs")
|
||||||
|
private static Set<Integer> blacklistDeadNpcs;
|
||||||
|
|
||||||
@Shadow("hideNPCs2D")
|
@Shadow("hideNPCs2D")
|
||||||
private static boolean hideNPCs2D;
|
private static boolean hideNPCs2D;
|
||||||
|
|
||||||
@@ -81,6 +99,9 @@ public abstract class EntityHiderMixin implements RSScene
|
|||||||
@Shadow("hideDeadNPCs")
|
@Shadow("hideDeadNPCs")
|
||||||
private static boolean hideDeadNPCs;
|
private static boolean hideDeadNPCs;
|
||||||
|
|
||||||
|
@Shadow("hiddenNpcIndices")
|
||||||
|
private static List<Integer> hiddenNpcIndices;
|
||||||
|
|
||||||
@Copy("newGameObject")
|
@Copy("newGameObject")
|
||||||
@Replace("newGameObject")
|
@Replace("newGameObject")
|
||||||
boolean copy$addEntityMarker(int var1, int var2, int var3, int var4, int var5, int x, int y, int var8, RSRenderable entity, int var10, boolean var11, long var12, int var13)
|
boolean copy$addEntityMarker(int var1, int var2, int var3, int var4, int var5, int x, int y, int var8, RSRenderable entity, int var10, boolean var11, long var12, int var13)
|
||||||
@@ -122,17 +143,10 @@ public abstract class EntityHiderMixin implements RSScene
|
|||||||
|
|
||||||
if (entity instanceof RSPlayer)
|
if (entity instanceof RSPlayer)
|
||||||
{
|
{
|
||||||
|
boolean local = drawingUI ? hideLocalPlayer2D : hideLocalPlayer;
|
||||||
|
boolean other = drawingUI ? hidePlayers2D : hidePlayers;
|
||||||
|
boolean isLocalPlayer = entity == client.getLocalPlayer();
|
||||||
RSPlayer player = (RSPlayer) entity;
|
RSPlayer player = (RSPlayer) entity;
|
||||||
RSPlayer local = client.getLocalPlayer();
|
|
||||||
if (player.getName() == null)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player == local)
|
|
||||||
{
|
|
||||||
return drawingUI ? !hideLocalPlayer2D : !hideLocalPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String name : hideSpecificPlayers)
|
for (String name : hideSpecificPlayers)
|
||||||
{
|
{
|
||||||
@@ -145,19 +159,24 @@ public abstract class EntityHiderMixin implements RSScene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hideAttackers && player.getInteracting() == local)
|
if (isLocalPlayer ? local : other)
|
||||||
{
|
{
|
||||||
return false;
|
if (!hideAttackers)
|
||||||
}
|
{
|
||||||
|
if (player.getInteracting() == client.getLocalPlayer())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (player.isFriend())
|
if (player.getName() == null)
|
||||||
{
|
{
|
||||||
return !hideFriends;
|
// player.isFriend() and player.isClanMember() npe when the player has a null name
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (player.isFriendsChatMember())
|
return (!hideFriends && player.isFriend()) ||
|
||||||
{
|
(!isLocalPlayer && !hideClanMates && player.isFriendsChatMember());
|
||||||
return !hideClanMates;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client.getFriendManager().isIgnored(player.getRsName()))
|
if (client.getFriendManager().isIgnored(player.getRsName()))
|
||||||
@@ -165,13 +184,12 @@ public abstract class EntityHiderMixin implements RSScene
|
|||||||
return !hideIgnores;
|
return !hideIgnores;
|
||||||
}
|
}
|
||||||
|
|
||||||
return drawingUI ? !hideOthers2D : !hideOthers;
|
|
||||||
}
|
}
|
||||||
else if (entity instanceof RSNPC)
|
else if (entity instanceof RSNPC)
|
||||||
{
|
{
|
||||||
RSNPC npc = (RSNPC) entity;
|
RSNPC npc = (RSNPC) entity;
|
||||||
|
|
||||||
if (npc.isDead() && hideDeadNPCs)
|
if (npc.getInteracting() == client.getLocalPlayer() && hideAttackers)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -181,11 +199,31 @@ public abstract class EntityHiderMixin implements RSScene
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (npc.getInteracting() == client.getLocalPlayer() && hideAttackers)
|
if (hideDeadNPCs && npc.getHealthRatio() == 0 && !blacklistDeadNpcs.contains(npc.getId()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (npc.getName() != null &&
|
||||||
|
hiddenNpcsName.getOrDefault(Text.standardize(npc.getName().toLowerCase()), 0) > 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npc.getName() != null && npc.getHealthRatio() == 0 &&
|
||||||
|
hiddenNpcsDeath.getOrDefault(Text.standardize(npc.getName().toLowerCase()), 0) > 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Integer index : hiddenNpcIndices)
|
||||||
|
{
|
||||||
|
if (index != null && npc.getIndex() == index)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return drawingUI ? !hideNPCs2D : !hideNPCs;
|
return drawingUI ? !hideNPCs2D : !hideNPCs;
|
||||||
}
|
}
|
||||||
else if (entity instanceof RSProjectile)
|
else if (entity instanceof RSProjectile)
|
||||||
|
|||||||
Reference in New Issue
Block a user