Merge remote-tracking branch 'upstream/master' into master
This commit is contained in:
@@ -25,9 +25,9 @@
|
|||||||
|
|
||||||
object ProjectVersions {
|
object ProjectVersions {
|
||||||
const val launcherVersion = "2.2.0"
|
const val launcherVersion = "2.2.0"
|
||||||
const val rlVersion = "1.7.8.1"
|
const val rlVersion = "1.7.9"
|
||||||
|
|
||||||
const val openosrsVersion = "4.7.0"
|
const val openosrsVersion = "4.7.1"
|
||||||
|
|
||||||
const val rsversion = 196
|
const val rsversion = 196
|
||||||
const val cacheversion = 165
|
const val cacheversion = 165
|
||||||
|
|||||||
@@ -108,6 +108,22 @@ public enum ChatMessageType
|
|||||||
* Adding player to ignore list.
|
* Adding player to ignore list.
|
||||||
*/
|
*/
|
||||||
IGNORENOTIFICATION(31),
|
IGNORENOTIFICATION(31),
|
||||||
|
/**
|
||||||
|
* A chat message in a clan chat.
|
||||||
|
*/
|
||||||
|
CLAN_CHAT(41),
|
||||||
|
/**
|
||||||
|
* A system message in a clan chat.
|
||||||
|
*/
|
||||||
|
CLAN_MESSAGE(43),
|
||||||
|
/**
|
||||||
|
* A chat message in the guest clan chat.
|
||||||
|
*/
|
||||||
|
CLAN_GUEST_CHAT(44),
|
||||||
|
/**
|
||||||
|
* A system message in the guest clan chat.
|
||||||
|
*/
|
||||||
|
CLAN_GUEST_MESSAGE(46),
|
||||||
/**
|
/**
|
||||||
* An autotyper message from a player.
|
* An autotyper message from a player.
|
||||||
*/
|
*/
|
||||||
@@ -152,6 +168,14 @@ public enum ChatMessageType
|
|||||||
* The "Welcome to RuneScape" message
|
* The "Welcome to RuneScape" message
|
||||||
*/
|
*/
|
||||||
WELCOME(108),
|
WELCOME(108),
|
||||||
|
/**
|
||||||
|
* Clan creation invitation.
|
||||||
|
*/
|
||||||
|
CLAN_CREATION_INVITATION(109),
|
||||||
|
/**
|
||||||
|
* Clan wars challenge for clans rather than FCs
|
||||||
|
*/
|
||||||
|
CLAN_CLAN_WARS_CHALLENGE(110),
|
||||||
/**
|
/**
|
||||||
* An unknown message type.
|
* An unknown message type.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ package net.runelite.api;
|
|||||||
|
|
||||||
public interface EnumComposition
|
public interface EnumComposition
|
||||||
{
|
{
|
||||||
|
int size();
|
||||||
|
|
||||||
int[] getKeys();
|
int[] getKeys();
|
||||||
|
|
||||||
int[] getIntVals();
|
int[] getIntVals();
|
||||||
|
|||||||
@@ -47,4 +47,6 @@ public final class EnumID
|
|||||||
public static final int ANCIENT_SPELLBOOK = 1983;
|
public static final int ANCIENT_SPELLBOOK = 1983;
|
||||||
public static final int LUNAR_SPELLBOOK = 1984;
|
public static final int LUNAR_SPELLBOOK = 1984;
|
||||||
public static final int ARCEUUS_SPELLBOOK = 1985;
|
public static final int ARCEUUS_SPELLBOOK = 1985;
|
||||||
|
|
||||||
|
public static final int FRIENDS_CHAT_RANK_ICONS = 1543;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9094,5 +9094,6 @@ public final class NpcID
|
|||||||
public static final int GARDENER_JAY_JR_10757 = 10757;
|
public static final int GARDENER_JAY_JR_10757 = 10757;
|
||||||
public static final int GARDENER_JAY_JR_10758 = 10758;
|
public static final int GARDENER_JAY_JR_10758 = 10758;
|
||||||
public static final int CLERK_10759 = 10759;
|
public static final int CLERK_10759 = 10759;
|
||||||
|
public static final int STRAY_DOG_10760 = 10760;
|
||||||
/* This file is automatically generated. Do not edit. */
|
/* This file is automatically generated. Do not edit. */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20303,8 +20303,6 @@ public final class NullObjectID
|
|||||||
public static final int NULL_41599 = 41599;
|
public static final int NULL_41599 = 41599;
|
||||||
public static final int NULL_41608 = 41608;
|
public static final int NULL_41608 = 41608;
|
||||||
public static final int NULL_41609 = 41609;
|
public static final int NULL_41609 = 41609;
|
||||||
public static final int NULL_41610 = 41610;
|
|
||||||
public static final int NULL_41611 = 41611;
|
|
||||||
public static final int NULL_41612 = 41612;
|
public static final int NULL_41612 = 41612;
|
||||||
public static final int NULL_41614 = 41614;
|
public static final int NULL_41614 = 41614;
|
||||||
public static final int NULL_41616 = 41616;
|
public static final int NULL_41616 = 41616;
|
||||||
|
|||||||
@@ -21293,6 +21293,8 @@ public final class ObjectID
|
|||||||
public static final int BOXES_41605 = 41605;
|
public static final int BOXES_41605 = 41605;
|
||||||
public static final int SIGNPOST_41606 = 41606;
|
public static final int SIGNPOST_41606 = 41606;
|
||||||
public static final int TABLE_41607 = 41607;
|
public static final int TABLE_41607 = 41607;
|
||||||
|
public static final int BUSH_41610 = 41610;
|
||||||
|
public static final int BUSH_41611 = 41611;
|
||||||
public static final int RED_BARRIER_41613 = 41613;
|
public static final int RED_BARRIER_41613 = 41613;
|
||||||
public static final int POSTER_41615 = 41615;
|
public static final int POSTER_41615 = 41615;
|
||||||
public static final int PORTAL_41617 = 41617;
|
public static final int PORTAL_41617 = 41617;
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ public final class ScriptID
|
|||||||
@ScriptArguments(integer = 1, string = 1)
|
@ScriptArguments(integer = 1, string = 1)
|
||||||
public static final int CHATBOX_INPUT = 96;
|
public static final int CHATBOX_INPUT = 96;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rebuilds the chatbox and the pmbox
|
||||||
|
*/
|
||||||
|
@ScriptArguments()
|
||||||
|
public static final int SPLITPM_CHANGED = 83;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rebuilds the chatbox
|
* Rebuilds the chatbox
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1000,6 +1000,13 @@ public interface Widget
|
|||||||
*/
|
*/
|
||||||
void setDragParent(Widget dragParent);
|
void setDragParent(Widget dragParent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the script and arguments to be ran when one of the listened for vars changes.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Object[] getOnVarTransmitListener();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a script to be ran when a varplayer changes
|
* Sets a script to be ran when a varplayer changes
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -271,6 +271,8 @@ public class WidgetID
|
|||||||
|
|
||||||
static class FriendsChat
|
static class FriendsChat
|
||||||
{
|
{
|
||||||
|
static final int ROOT = 0;
|
||||||
|
static final int TITLE = 1;
|
||||||
static final int OWNER = 2;
|
static final int OWNER = 2;
|
||||||
static final int LIST = 12;
|
static final int LIST = 12;
|
||||||
}
|
}
|
||||||
@@ -558,7 +560,8 @@ public class WidgetID
|
|||||||
static final int TAB_ALL = 4;
|
static final int TAB_ALL = 4;
|
||||||
static final int TAB_GAME = 7;
|
static final int TAB_GAME = 7;
|
||||||
static final int TAB_PUBLIC = 11;
|
static final int TAB_PUBLIC = 11;
|
||||||
static final int TAB_PRIVATE = 19;
|
static final int TAB_PRIVATE = 15;
|
||||||
|
static final int TAB_CHANNEL = 19;
|
||||||
static final int TAB_CLAN = 23;
|
static final int TAB_CLAN = 23;
|
||||||
static final int TAB_TRADE = 27;
|
static final int TAB_TRADE = 27;
|
||||||
static final int REPORT_TEXT = 33;
|
static final int REPORT_TEXT = 33;
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ public enum WidgetInfo
|
|||||||
|
|
||||||
EXPLORERS_RING_ALCH_INVENTORY(WidgetID.EXPLORERS_RING_ALCH_GROUP_ID, WidgetID.ExplorersRing.INVENTORY),
|
EXPLORERS_RING_ALCH_INVENTORY(WidgetID.EXPLORERS_RING_ALCH_GROUP_ID, WidgetID.ExplorersRing.INVENTORY),
|
||||||
|
|
||||||
|
FRIENDS_CHAT_ROOT(WidgetID.FRIENDS_CHAT_GROUP_ID, WidgetID.FriendsChat.ROOT),
|
||||||
|
FRIENDS_CHAT_TITLE(WidgetID.FRIENDS_CHAT_GROUP_ID, WidgetID.FriendsChat.TITLE),
|
||||||
FRIENDS_CHAT_OWNER(WidgetID.FRIENDS_CHAT_GROUP_ID, WidgetID.FriendsChat.OWNER),
|
FRIENDS_CHAT_OWNER(WidgetID.FRIENDS_CHAT_GROUP_ID, WidgetID.FriendsChat.OWNER),
|
||||||
FRIENDS_CHAT_LIST(WidgetID.FRIENDS_CHAT_GROUP_ID, WidgetID.FriendsChat.LIST),
|
FRIENDS_CHAT_LIST(WidgetID.FRIENDS_CHAT_GROUP_ID, WidgetID.FriendsChat.LIST),
|
||||||
|
|
||||||
@@ -366,6 +368,7 @@ public enum WidgetInfo
|
|||||||
CHATBOX_TAB_GAME(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TAB_GAME),
|
CHATBOX_TAB_GAME(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TAB_GAME),
|
||||||
CHATBOX_TAB_PUBLIC(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TAB_PUBLIC),
|
CHATBOX_TAB_PUBLIC(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TAB_PUBLIC),
|
||||||
CHATBOX_TAB_PRIVATE(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TAB_PRIVATE),
|
CHATBOX_TAB_PRIVATE(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TAB_PRIVATE),
|
||||||
|
CHATBOX_TAB_CHANNEL(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TAB_CHANNEL),
|
||||||
CHATBOX_TAB_CLAN(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TAB_CLAN),
|
CHATBOX_TAB_CLAN(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TAB_CLAN),
|
||||||
CHATBOX_TAB_TRADE(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TAB_TRADE),
|
CHATBOX_TAB_TRADE(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.TAB_TRADE),
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import net.runelite.api.events.PlayerDespawned;
|
|||||||
import net.runelite.api.kit.KitType;
|
import net.runelite.api.kit.KitType;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.game.FriendChatManager;
|
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.game.ItemMapping;
|
import net.runelite.client.game.ItemMapping;
|
||||||
import net.runelite.client.util.PvPUtil;
|
import net.runelite.client.util.PvPUtil;
|
||||||
@@ -50,7 +49,6 @@ public class PlayerManager
|
|||||||
private final Client client;
|
private final Client client;
|
||||||
private final ItemManager itemManager;
|
private final ItemManager itemManager;
|
||||||
private final EventBus eventBus;
|
private final EventBus eventBus;
|
||||||
private final FriendChatManager friendChatManager;
|
|
||||||
private final Map<String, PlayerContainer> playerMap = new ConcurrentHashMap<>();
|
private final Map<String, PlayerContainer> playerMap = new ConcurrentHashMap<>();
|
||||||
private final Map<String, HiscoreResult> resultCache = new ConcurrentHashMap<>();
|
private final Map<String, HiscoreResult> resultCache = new ConcurrentHashMap<>();
|
||||||
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
|
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
|
||||||
@@ -60,14 +58,12 @@ public class PlayerManager
|
|||||||
final Client client,
|
final Client client,
|
||||||
final EventBus eventBus,
|
final EventBus eventBus,
|
||||||
final ItemManager itemManager,
|
final ItemManager itemManager,
|
||||||
final FriendChatManager friendChatManager,
|
|
||||||
final OkHttpClient okHttpClient
|
final OkHttpClient okHttpClient
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.itemManager = itemManager;
|
this.itemManager = itemManager;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.friendChatManager = friendChatManager;
|
|
||||||
this.hiscoreClient = new HiscoreClient(okHttpClient);
|
this.hiscoreClient = new HiscoreClient(okHttpClient);
|
||||||
|
|
||||||
eventBus.register(this);
|
eventBus.register(this);
|
||||||
@@ -219,7 +215,7 @@ public class PlayerManager
|
|||||||
PlayerContainer player = playerMap.computeIfAbsent(event.getPlayer().getName(), s -> new PlayerContainer(event.getPlayer()));
|
PlayerContainer player = playerMap.computeIfAbsent(event.getPlayer().getName(), s -> new PlayerContainer(event.getPlayer()));
|
||||||
update(player);
|
update(player);
|
||||||
player.setFriend(client.isFriended(player.getName(), false));
|
player.setFriend(client.isFriended(player.getName(), false));
|
||||||
player.setClan(friendChatManager.isMember(player.getName()));
|
player.setClan(event.getPlayer().isFriendsChatMember());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|||||||
+24
-80
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
* Copyright (c) 2021, Adam <Adam@sigterm.info>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -24,94 +24,45 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.game;
|
package net.runelite.client.game;
|
||||||
|
|
||||||
import com.google.common.cache.CacheBuilder;
|
|
||||||
import com.google.common.cache.CacheLoader;
|
|
||||||
import com.google.common.cache.LoadingCache;
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import net.runelite.api.FriendsChatMember;
|
|
||||||
import net.runelite.api.FriendsChatManager;
|
|
||||||
import net.runelite.api.FriendsChatRank;
|
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.EnumComposition;
|
||||||
|
import net.runelite.api.EnumID;
|
||||||
|
import net.runelite.api.FriendsChatRank;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.IndexedSprite;
|
import net.runelite.api.IndexedSprite;
|
||||||
import net.runelite.api.SpriteID;
|
|
||||||
import net.runelite.api.events.FriendsChatChanged;
|
|
||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.util.ImageUtil;
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.Text;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class FriendChatManager
|
public class ChatIconManager
|
||||||
{
|
{
|
||||||
private static final int[] RANK_IMAGES =
|
|
||||||
{
|
|
||||||
SpriteID.FRIENDS_CHAT_RANK_SMILEY_FRIEND,
|
|
||||||
SpriteID.FRIENDS_CHAT_RANK_SINGLE_CHEVRON_RECRUIT,
|
|
||||||
SpriteID.FRIENDS_CHAT_RANK_DOUBLE_CHEVRON_CORPORAL,
|
|
||||||
SpriteID.FRIENDS_CHAT_RANK_TRIPLE_CHEVRON_SERGEANT,
|
|
||||||
SpriteID.FRIENDS_CHAT_RANK_BRONZE_STAR_LIEUTENANT,
|
|
||||||
SpriteID.FRIENDS_CHAT_RANK_SILVER_STAR_CAPTAIN,
|
|
||||||
SpriteID.FRIENDS_CHAT_RANK_GOLD_STAR_GENERAL,
|
|
||||||
SpriteID.FRIENDS_CHAT_RANK_KEY_CHANNEL_OWNER,
|
|
||||||
SpriteID.FRIENDS_CHAT_RANK_CROWN_JAGEX_MODERATOR,
|
|
||||||
};
|
|
||||||
private static final Dimension IMAGE_DIMENSION = new Dimension(11, 11);
|
private static final Dimension IMAGE_DIMENSION = new Dimension(11, 11);
|
||||||
private static final Color IMAGE_OUTLINE_COLOR = new Color(33, 33, 33);
|
private static final Color IMAGE_OUTLINE_COLOR = new Color(33, 33, 33);
|
||||||
|
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final SpriteManager spriteManager;
|
private final SpriteManager spriteManager;
|
||||||
private final BufferedImage[] rankImages = new BufferedImage[RANK_IMAGES.length];
|
|
||||||
|
|
||||||
private final LoadingCache<String, FriendsChatRank> ranksCache = CacheBuilder.newBuilder()
|
private BufferedImage[] friendsChatRankImages;
|
||||||
.maximumSize(100)
|
|
||||||
.expireAfterWrite(1, TimeUnit.MINUTES)
|
|
||||||
.build(new CacheLoader<String, FriendsChatRank>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public FriendsChatRank load(@Nonnull String key)
|
|
||||||
{
|
|
||||||
final FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
|
||||||
if (friendsChatManager == null)
|
|
||||||
{
|
|
||||||
return FriendsChatRank.UNRANKED;
|
|
||||||
}
|
|
||||||
|
|
||||||
FriendsChatMember friendsChatMember = friendsChatManager.findByName(sanitize(key));
|
private int friendsChatOffset;
|
||||||
return friendsChatMember != null ? friendsChatMember.getRank() : FriendsChatRank.UNRANKED;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
private int offset;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private FriendChatManager(Client client, SpriteManager spriteManager, EventBus eventBus)
|
private ChatIconManager(Client client, SpriteManager spriteManager, EventBus eventBus)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.spriteManager = spriteManager;
|
this.spriteManager = spriteManager;
|
||||||
eventBus.register(this);
|
eventBus.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMember(String name)
|
|
||||||
{
|
|
||||||
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
|
||||||
return friendsChatManager != null && friendsChatManager.findByName(name) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FriendsChatRank getRank(String playerName)
|
|
||||||
{
|
|
||||||
return ranksCache.getUnchecked(playerName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public BufferedImage getRankImage(final FriendsChatRank friendsChatRank)
|
public BufferedImage getRankImage(final FriendsChatRank friendsChatRank)
|
||||||
{
|
{
|
||||||
@@ -120,64 +71,57 @@ public class FriendChatManager
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rankImages[friendsChatRank.ordinal() - 1];
|
return friendsChatRankImages[friendsChatRank.ordinal() - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIconNumber(final FriendsChatRank friendsChatRank)
|
public int getIconNumber(final FriendsChatRank friendsChatRank)
|
||||||
{
|
{
|
||||||
return offset + friendsChatRank.ordinal() - 1;
|
return friendsChatOffset + friendsChatRank.ordinal() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameStateChanged(GameStateChanged gameStateChanged)
|
public void onGameStateChanged(GameStateChanged gameStateChanged)
|
||||||
{
|
{
|
||||||
if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN && offset == 0)
|
if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN && friendsChatOffset == 0)
|
||||||
{
|
{
|
||||||
loadRankIcons();
|
loadRankIcons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onFriendsChatChanged(FriendsChatChanged friendsChatChanged)
|
|
||||||
{
|
|
||||||
ranksCache.invalidateAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadRankIcons()
|
private void loadRankIcons()
|
||||||
{
|
{
|
||||||
|
final EnumComposition friendsChatIcons = client.getEnum(EnumID.FRIENDS_CHAT_RANK_ICONS);
|
||||||
|
|
||||||
{
|
{
|
||||||
IndexedSprite[] modIcons = client.getModIcons();
|
IndexedSprite[] modIcons = client.getModIcons();
|
||||||
offset = modIcons.length;
|
friendsChatOffset = modIcons.length;
|
||||||
|
|
||||||
IndexedSprite blank = ImageUtil.getImageIndexedSprite(
|
IndexedSprite blank = ImageUtil.getImageIndexedSprite(
|
||||||
new BufferedImage(modIcons[0].getWidth(), modIcons[0].getHeight(), BufferedImage.TYPE_INT_ARGB),
|
new BufferedImage(modIcons[0].getWidth(), modIcons[0].getHeight(), BufferedImage.TYPE_INT_ARGB),
|
||||||
client);
|
client);
|
||||||
|
|
||||||
modIcons = Arrays.copyOf(modIcons, offset + RANK_IMAGES.length);
|
modIcons = Arrays.copyOf(modIcons, friendsChatOffset + friendsChatIcons.size());
|
||||||
Arrays.fill(modIcons, offset, modIcons.length, blank);
|
Arrays.fill(modIcons, friendsChatOffset, modIcons.length, blank);
|
||||||
|
|
||||||
client.setModIcons(modIcons);
|
client.setModIcons(modIcons);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < RANK_IMAGES.length; i++)
|
friendsChatRankImages = new BufferedImage[friendsChatIcons.size()];
|
||||||
|
|
||||||
|
final IndexedSprite[] modIcons = client.getModIcons();
|
||||||
|
|
||||||
|
for (int i = 0; i < friendsChatIcons.size(); i++)
|
||||||
{
|
{
|
||||||
final int fi = i;
|
final int fi = i;
|
||||||
|
|
||||||
spriteManager.getSpriteAsync(RANK_IMAGES[i], 0, sprite ->
|
spriteManager.getSpriteAsync(friendsChatIcons.getIntValue(friendsChatIcons.getKeys()[i]), 0, sprite ->
|
||||||
{
|
{
|
||||||
IndexedSprite[] modIcons = client.getModIcons();
|
friendsChatRankImages[fi] = friendsChatImageFromSprite(sprite);
|
||||||
rankImages[fi] = friendsChatImageFromSprite(sprite);
|
modIcons[friendsChatOffset + fi] = ImageUtil.getImageIndexedSprite(friendsChatRankImages[fi], client);
|
||||||
modIcons[offset + fi] = ImageUtil.getImageIndexedSprite(rankImages[fi], client);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String sanitize(String lookup)
|
|
||||||
{
|
|
||||||
final String cleaned = Text.removeTags(lookup);
|
|
||||||
return cleaned.replace('\u00A0', ' ');
|
|
||||||
}
|
|
||||||
|
|
||||||
private static BufferedImage friendsChatImageFromSprite(final BufferedImage sprite)
|
private static BufferedImage friendsChatImageFromSprite(final BufferedImage sprite)
|
||||||
{
|
{
|
||||||
final BufferedImage canvas = ImageUtil.resizeCanvas(sprite, IMAGE_DIMENSION.width, IMAGE_DIMENSION.height);
|
final BufferedImage canvas = ImageUtil.resizeCanvas(sprite, IMAGE_DIMENSION.width, IMAGE_DIMENSION.height);
|
||||||
@@ -37,6 +37,11 @@ public @interface PluginDescriptor
|
|||||||
{
|
{
|
||||||
String name();
|
String name();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal name used in the config.
|
||||||
|
*/
|
||||||
|
String configName() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A short, one-line summary of the plugin.
|
* A short, one-line summary of the plugin.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
package net.runelite.client.plugins;
|
package net.runelite.client.plugins;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.graph.Graph;
|
import com.google.common.graph.Graph;
|
||||||
import com.google.common.graph.GraphBuilder;
|
import com.google.common.graph.GraphBuilder;
|
||||||
@@ -337,7 +338,8 @@ public class PluginManager
|
|||||||
{
|
{
|
||||||
log.debug("Disabling {} due to safe mode", clazz);
|
log.debug("Disabling {} due to safe mode", clazz);
|
||||||
// also disable the plugin from autostarting later
|
// also disable the plugin from autostarting later
|
||||||
configManager.unsetConfiguration(RuneLiteConfig.GROUP_NAME, clazz.getSimpleName().toLowerCase());
|
configManager.unsetConfiguration(RuneLiteConfig.GROUP_NAME,
|
||||||
|
(Strings.isNullOrEmpty(pluginDescriptor.configName()) ? clazz.getSimpleName() : pluginDescriptor.configName()).toLowerCase());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,22 +467,17 @@ public class PluginManager
|
|||||||
|
|
||||||
public void setPluginEnabled(Plugin plugin, boolean enabled)
|
public void setPluginEnabled(Plugin plugin, boolean enabled)
|
||||||
{
|
{
|
||||||
final String keyName = plugin.getClass().getSimpleName().toLowerCase();
|
final PluginDescriptor pluginDescriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||||
configManager.setConfiguration(RuneLiteConfig.GROUP_NAME, keyName, String.valueOf(enabled));
|
final String keyName = Strings.isNullOrEmpty(pluginDescriptor.configName()) ? plugin.getClass().getSimpleName() : pluginDescriptor.configName();
|
||||||
|
configManager.setConfiguration(RuneLiteConfig.GROUP_NAME, keyName.toLowerCase(), String.valueOf(enabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPluginEnabled(Plugin plugin)
|
public boolean isPluginEnabled(Plugin plugin)
|
||||||
{
|
{
|
||||||
final String keyName = plugin.getClass().getSimpleName().toLowerCase();
|
|
||||||
final String value = configManager.getConfiguration(RuneLiteConfig.GROUP_NAME, keyName);
|
|
||||||
|
|
||||||
if (value != null)
|
|
||||||
{
|
|
||||||
return Boolean.valueOf(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
final PluginDescriptor pluginDescriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
final PluginDescriptor pluginDescriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||||
return pluginDescriptor == null || pluginDescriptor.enabledByDefault();
|
final String keyName = Strings.isNullOrEmpty(pluginDescriptor.configName()) ? plugin.getClass().getSimpleName() : pluginDescriptor.configName();
|
||||||
|
final String value = configManager.getConfiguration(RuneLiteConfig.GROUP_NAME, keyName.toLowerCase());
|
||||||
|
return value != null ? Boolean.parseBoolean(value) : pluginDescriptor.enabledByDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Plugin instantiate(List<Plugin> scannedPlugins, Class<Plugin> clazz) throws PluginInstantiationException
|
private Plugin instantiate(List<Plugin> scannedPlugins, Class<Plugin> clazz) throws PluginInstantiationException
|
||||||
|
|||||||
+8
-5
@@ -50,6 +50,7 @@ import static net.runelite.api.ChatMessageType.OBJECT_EXAMINE;
|
|||||||
import static net.runelite.api.ChatMessageType.PUBLICCHAT;
|
import static net.runelite.api.ChatMessageType.PUBLICCHAT;
|
||||||
import static net.runelite.api.ChatMessageType.SPAM;
|
import static net.runelite.api.ChatMessageType.SPAM;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.FriendsChatManager;
|
||||||
import net.runelite.api.MessageNode;
|
import net.runelite.api.MessageNode;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
@@ -58,7 +59,6 @@ import net.runelite.api.events.ScriptCallbackEvent;
|
|||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.events.ConfigChanged;
|
import net.runelite.client.events.ConfigChanged;
|
||||||
import net.runelite.client.game.FriendChatManager;
|
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
@@ -117,9 +117,6 @@ public class ChatFilterPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private ChatFilterConfig config;
|
private ChatFilterConfig config;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private FriendChatManager friendChatManager;
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
ChatFilterConfig provideConfig(ConfigManager configManager)
|
ChatFilterConfig provideConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
@@ -274,7 +271,13 @@ public class ChatFilterPlugin extends Plugin
|
|||||||
boolean isMessageFromSelf = playerName.equals(client.getLocalPlayer().getName());
|
boolean isMessageFromSelf = playerName.equals(client.getLocalPlayer().getName());
|
||||||
return !isMessageFromSelf &&
|
return !isMessageFromSelf &&
|
||||||
(config.filterFriends() || !client.isFriended(playerName, false)) &&
|
(config.filterFriends() || !client.isFriended(playerName, false)) &&
|
||||||
(config.filterFriendsChat() || !friendChatManager.isMember(playerName));
|
(config.filterFriendsChat() || !isFriendsChatMember(playerName));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isFriendsChatMember(String name)
|
||||||
|
{
|
||||||
|
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||||
|
return friendsChatManager != null && friendsChatManager.findByName(name) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String censorMessage(final String username, final String message)
|
String censorMessage(final String username, final String message)
|
||||||
|
|||||||
+17
-4
@@ -37,6 +37,7 @@ import java.util.Deque;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.ChatLineBuffer;
|
import net.runelite.api.ChatLineBuffer;
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
@@ -72,6 +73,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
description = "Retain your chat history when logging in/out or world hopping",
|
description = "Retain your chat history when logging in/out or world hopping",
|
||||||
tags = {"chat", "history", "retain", "cycle", "pm"}
|
tags = {"chat", "history", "retain", "cycle", "pm"}
|
||||||
)
|
)
|
||||||
|
@Slf4j
|
||||||
public class ChatHistoryPlugin extends Plugin implements KeyListener
|
public class ChatHistoryPlugin extends Plugin implements KeyListener
|
||||||
{
|
{
|
||||||
private static final String WELCOME_MESSAGE = "Welcome to Old School RuneScape";
|
private static final String WELCOME_MESSAGE = "Welcome to Old School RuneScape";
|
||||||
@@ -173,6 +175,8 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
|
|||||||
case PUBLICCHAT:
|
case PUBLICCHAT:
|
||||||
case MODCHAT:
|
case MODCHAT:
|
||||||
case FRIENDSCHAT:
|
case FRIENDSCHAT:
|
||||||
|
case CLAN_GUEST_CHAT:
|
||||||
|
case CLAN_CHAT:
|
||||||
case CONSOLE:
|
case CONSOLE:
|
||||||
messageQueue.offer(chatMessage.getMessageNode());
|
messageQueue.offer(chatMessage.getMessageNode());
|
||||||
}
|
}
|
||||||
@@ -262,7 +266,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
|
|||||||
{
|
{
|
||||||
final ChatboxTab tab = ChatboxTab.of(entry.getActionParam1());
|
final ChatboxTab tab = ChatboxTab.of(entry.getActionParam1());
|
||||||
|
|
||||||
if (tab == null || !config.clearHistory() || !Text.removeTags(entry.getOption()).equals(tab.getAfter()))
|
if (tab == null || tab.getAfter() == null || !config.clearHistory() || !Text.removeTags(entry.getOption()).equals(tab.getAfter()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -311,6 +315,16 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.debug("Clearing chatbox history for tab {}", tab);
|
||||||
|
|
||||||
|
clearMessageQueue(tab);
|
||||||
|
|
||||||
|
if (tab.getAfter() == null)
|
||||||
|
{
|
||||||
|
// if the tab has a vanilla Clear option, it isn't necessary to delete the messages ourselves.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean removed = false;
|
boolean removed = false;
|
||||||
for (ChatMessageType msgType : tab.getMessageTypes())
|
for (ChatMessageType msgType : tab.getMessageTypes())
|
||||||
{
|
{
|
||||||
@@ -333,10 +347,9 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
|
|||||||
|
|
||||||
if (removed)
|
if (removed)
|
||||||
{
|
{
|
||||||
clientThread.invoke(() -> client.runScript(ScriptID.BUILD_CHATBOX));
|
// this rebuilds both the chatbox and the pmbox
|
||||||
|
clientThread.invoke(() -> client.runScript(ScriptID.SPLITPM_CHANGED));
|
||||||
}
|
}
|
||||||
|
|
||||||
clearMessageQueue(tab);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+5
-2
@@ -54,10 +54,13 @@ enum ChatboxTab
|
|||||||
ChatMessageType.CONSOLE, ChatMessageType.SPAM, ChatMessageType.PLAYERRELATED, ChatMessageType.TENSECTIMEOUT,
|
ChatMessageType.CONSOLE, ChatMessageType.SPAM, ChatMessageType.PLAYERRELATED, ChatMessageType.TENSECTIMEOUT,
|
||||||
ChatMessageType.WELCOME, ChatMessageType.UNKNOWN),
|
ChatMessageType.WELCOME, ChatMessageType.UNKNOWN),
|
||||||
|
|
||||||
CLAN("Clan", "Clan: Off", WidgetInfo.CHATBOX_TAB_CLAN,
|
CHANNEL("Channel", null, WidgetInfo.CHATBOX_TAB_CHANNEL,
|
||||||
ChatMessageType.FRIENDSCHATNOTIFICATION, ChatMessageType.FRIENDSCHAT, ChatMessageType.CHALREQ_FRIENDSCHAT),
|
ChatMessageType.FRIENDSCHATNOTIFICATION, ChatMessageType.FRIENDSCHAT, ChatMessageType.CHALREQ_FRIENDSCHAT),
|
||||||
|
|
||||||
TRADE("Trade", "Trade: Off", WidgetInfo.CHATBOX_TAB_TRADE,
|
CLAN("Clan", null, WidgetInfo.CHATBOX_TAB_CLAN,
|
||||||
|
ChatMessageType.CLAN_CHAT, ChatMessageType.CLAN_MESSAGE, ChatMessageType.CLAN_GUEST_CHAT, ChatMessageType.CLAN_GUEST_MESSAGE),
|
||||||
|
|
||||||
|
TRADE("Trade", "Trade: Show none", WidgetInfo.CHATBOX_TAB_TRADE,
|
||||||
ChatMessageType.TRADE_SENT, ChatMessageType.TRADEREQ, ChatMessageType.TRADE, ChatMessageType.CHALREQ_TRADE),
|
ChatMessageType.TRADE_SENT, ChatMessageType.TRADEREQ, ChatMessageType.TRADE, ChatMessageType.CHALREQ_TRADE),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
+20
@@ -38,6 +38,7 @@ import lombok.Getter;
|
|||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.Experience;
|
import net.runelite.api.Experience;
|
||||||
|
import net.runelite.api.IndexedSprite;
|
||||||
import net.runelite.api.MenuAction;
|
import net.runelite.api.MenuAction;
|
||||||
import net.runelite.api.MenuEntry;
|
import net.runelite.api.MenuEntry;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.NPC;
|
||||||
@@ -430,6 +431,25 @@ public class DevToolsPlugin extends Plugin
|
|||||||
.build());
|
.build());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "modicons":
|
||||||
|
{
|
||||||
|
final ChatMessageBuilder builder = new ChatMessageBuilder();
|
||||||
|
final IndexedSprite[] modIcons = client.getModIcons();
|
||||||
|
for (int i = 0; i < modIcons.length; i++)
|
||||||
|
{
|
||||||
|
builder.append(i + "=").img(i);
|
||||||
|
|
||||||
|
if (i != modIcons.length - 1)
|
||||||
|
{
|
||||||
|
builder.append(", ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
chatMessageManager.queue(QueuedMessage.builder()
|
||||||
|
.type(ChatMessageType.GAMEMESSAGE)
|
||||||
|
.runeLiteFormattedMessage(builder.build())
|
||||||
|
.build());
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+40
-18
@@ -76,7 +76,7 @@ import net.runelite.client.config.ChatColorConfig;
|
|||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.events.ConfigChanged;
|
import net.runelite.client.events.ConfigChanged;
|
||||||
import net.runelite.client.game.FriendChatManager;
|
import net.runelite.client.game.ChatIconManager;
|
||||||
import net.runelite.client.game.SpriteManager;
|
import net.runelite.client.game.SpriteManager;
|
||||||
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
@@ -96,13 +96,14 @@ import net.runelite.client.util.Text;
|
|||||||
public class FriendsChatPlugin extends Plugin
|
public class FriendsChatPlugin extends Plugin
|
||||||
{
|
{
|
||||||
private static final int MAX_CHATS = 10;
|
private static final int MAX_CHATS = 10;
|
||||||
|
private static final String RECENT_TITLE = "Recent FCs";
|
||||||
private static final int MESSAGE_DELAY = 10;
|
private static final int MESSAGE_DELAY = 10;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private FriendChatManager friendChatManager;
|
private ChatIconManager chatIconManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private FriendsChatConfig config;
|
private FriendsChatConfig config;
|
||||||
@@ -157,7 +158,7 @@ public class FriendsChatPlugin extends Plugin
|
|||||||
clientThread.invoke(() -> colorIgnoredPlayers(Color.WHITE));
|
clientThread.invoke(() -> colorIgnoredPlayers(Color.WHITE));
|
||||||
members.clear();
|
members.clear();
|
||||||
resetCounter();
|
resetCounter();
|
||||||
resetChats();
|
rebuildFriendsChat();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -167,7 +168,7 @@ public class FriendsChatPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
if (!config.recentChats())
|
if (!config.recentChats())
|
||||||
{
|
{
|
||||||
resetChats();
|
rebuildFriendsChat();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.showCounter())
|
if (config.showCounter())
|
||||||
@@ -397,7 +398,7 @@ public class FriendsChatPlugin extends Plugin
|
|||||||
|
|
||||||
if (config.chatIcons() && rank != null && rank != FriendsChatRank.UNRANKED)
|
if (config.chatIcons() && rank != null && rank != FriendsChatRank.UNRANKED)
|
||||||
{
|
{
|
||||||
rankIcon = friendChatManager.getIconNumber(rank);
|
rankIcon = chatIconManager.getIconNumber(rank);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatMessageBuilder message = new ChatMessageBuilder()
|
ChatMessageBuilder message = new ChatMessageBuilder()
|
||||||
@@ -556,9 +557,19 @@ public class FriendsChatPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onScriptPostFired(ScriptPostFired event)
|
public void onScriptPostFired(ScriptPostFired event)
|
||||||
{
|
{
|
||||||
if (event.getScriptId() == ScriptID.FRIENDS_CHAT_CHANNEL_REBUILD && config.showIgnores())
|
if (event.getScriptId() == ScriptID.FRIENDS_CHAT_CHANNEL_REBUILD)
|
||||||
{
|
{
|
||||||
colorIgnoredPlayers(config.showIgnoresColor());
|
if (config.showIgnores())
|
||||||
|
{
|
||||||
|
colorIgnoredPlayers(config.showIgnoresColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||||
|
Widget chatTitle = client.getWidget(WidgetInfo.FRIENDS_CHAT_TITLE);
|
||||||
|
if (friendsChatManager != null && friendsChatManager.getCount() > 0 && chatTitle != null)
|
||||||
|
{
|
||||||
|
chatTitle.setText(chatTitle.getText() + " (" + friendsChatManager.getCount() + "/100)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,11 +580,11 @@ public class FriendsChatPlugin extends Plugin
|
|||||||
|
|
||||||
private void insertRankIcon(final ChatMessage message)
|
private void insertRankIcon(final ChatMessage message)
|
||||||
{
|
{
|
||||||
final FriendsChatRank rank = friendChatManager.getRank(message.getName());
|
final FriendsChatRank rank = getRank(message.getName());
|
||||||
|
|
||||||
if (rank != null && rank != FriendsChatRank.UNRANKED)
|
if (rank != null && rank != FriendsChatRank.UNRANKED)
|
||||||
{
|
{
|
||||||
int iconNumber = friendChatManager.getIconNumber(rank);
|
int iconNumber = chatIconManager.getIconNumber(rank);
|
||||||
final String img = "<img=" + iconNumber + ">";
|
final String img = "<img=" + iconNumber + ">";
|
||||||
if (message.getType() == ChatMessageType.FRIENDSCHAT)
|
if (message.getType() == ChatMessageType.FRIENDSCHAT)
|
||||||
{
|
{
|
||||||
@@ -589,30 +600,41 @@ public class FriendsChatPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetChats()
|
private FriendsChatRank getRank(String playerName)
|
||||||
{
|
{
|
||||||
Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST);
|
final FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||||
|
if (friendsChatManager == null)
|
||||||
|
{
|
||||||
|
return FriendsChatRank.UNRANKED;
|
||||||
|
}
|
||||||
|
|
||||||
if (chatList == null)
|
FriendsChatMember friendsChatMember = friendsChatManager.findByName(playerName);
|
||||||
|
return friendsChatMember != null ? friendsChatMember.getRank() : FriendsChatRank.UNRANKED;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void rebuildFriendsChat()
|
||||||
|
{
|
||||||
|
Widget chat = client.getWidget(WidgetInfo.FRIENDS_CHAT_ROOT);
|
||||||
|
if (chat == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
Object[] args = chat.getOnVarTransmitListener();
|
||||||
if (friendsChatManager == null || friendsChatManager.getCount() == 0)
|
clientThread.invokeLater(() -> client.runScript(args));
|
||||||
{
|
|
||||||
chatList.setChildren(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadFriendsChats()
|
private void loadFriendsChats()
|
||||||
{
|
{
|
||||||
|
Widget chatOwner = client.getWidget(WidgetInfo.FRIENDS_CHAT_OWNER);
|
||||||
Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST);
|
Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST);
|
||||||
if (chatList == null)
|
if (chatList == null || chatOwner == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chatOwner.setText(RECENT_TITLE);
|
||||||
|
|
||||||
int y = 2;
|
int y = 2;
|
||||||
chatList.setChildren(null);
|
chatList.setChildren(null);
|
||||||
for (String chat : Lists.reverse(chats))
|
for (String chat : Lists.reverse(chats))
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ import net.runelite.http.api.ws.messages.party.UserSync;
|
|||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Party",
|
name = "Party",
|
||||||
|
configName = "PartyPlugin2",
|
||||||
description = "Party management and basic info",
|
description = "Party management and basic info",
|
||||||
enabledByDefault = false
|
enabledByDefault = false
|
||||||
)
|
)
|
||||||
|
|||||||
+8
-8
@@ -34,7 +34,7 @@ import javax.inject.Singleton;
|
|||||||
import net.runelite.api.FriendsChatRank;
|
import net.runelite.api.FriendsChatRank;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.client.game.FriendChatManager;
|
import net.runelite.client.game.ChatIconManager;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
@@ -49,15 +49,15 @@ public class PlayerIndicatorsOverlay extends Overlay
|
|||||||
|
|
||||||
private final PlayerIndicatorsService playerIndicatorsService;
|
private final PlayerIndicatorsService playerIndicatorsService;
|
||||||
private final PlayerIndicatorsConfig config;
|
private final PlayerIndicatorsConfig config;
|
||||||
private final FriendChatManager friendChatManager;
|
private final ChatIconManager chatIconManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private PlayerIndicatorsOverlay(PlayerIndicatorsConfig config, PlayerIndicatorsService playerIndicatorsService,
|
private PlayerIndicatorsOverlay(PlayerIndicatorsConfig config, PlayerIndicatorsService playerIndicatorsService,
|
||||||
FriendChatManager friendChatManager)
|
ChatIconManager chatIconManager)
|
||||||
{
|
{
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.playerIndicatorsService = playerIndicatorsService;
|
this.playerIndicatorsService = playerIndicatorsService;
|
||||||
this.friendChatManager = friendChatManager;
|
this.chatIconManager = chatIconManager;
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
setPriority(OverlayPriority.MED);
|
setPriority(OverlayPriority.MED);
|
||||||
}
|
}
|
||||||
@@ -108,13 +108,13 @@ public class PlayerIndicatorsOverlay extends Overlay
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.showFriendsChatRanks() && actor.isFriendsChatMember())
|
if (actor.isFriendsChatMember() && config.showFriendsChatRanks())
|
||||||
{
|
{
|
||||||
final FriendsChatRank rank = friendChatManager.getRank(name);
|
final FriendsChatRank rank = playerIndicatorsService.getFriendsChatRank(actor);
|
||||||
|
|
||||||
if (rank != FriendsChatRank.UNRANKED)
|
if (rank != FriendsChatRank.UNRANKED)
|
||||||
{
|
{
|
||||||
final BufferedImage rankImage = friendChatManager.getRankImage(rank);
|
final BufferedImage rankImage = chatIconManager.getRankImage(rank);
|
||||||
|
|
||||||
if (rankImage != null)
|
if (rankImage != null)
|
||||||
{
|
{
|
||||||
@@ -145,4 +145,4 @@ public class PlayerIndicatorsOverlay extends Overlay
|
|||||||
|
|
||||||
OverlayUtil.renderTextLocation(graphics, textLocation, name, color);
|
OverlayUtil.renderTextLocation(graphics, textLocation, name, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+26
-8
@@ -28,16 +28,28 @@ import com.google.inject.Provides;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.FriendsChatRank;
|
import net.runelite.api.FriendsChatRank;
|
||||||
import static net.runelite.api.FriendsChatRank.UNRANKED;
|
import static net.runelite.api.FriendsChatRank.UNRANKED;
|
||||||
import net.runelite.api.Client;
|
import static net.runelite.api.MenuAction.ITEM_USE_ON_PLAYER;
|
||||||
import static net.runelite.api.MenuAction.*;
|
import static net.runelite.api.MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET;
|
||||||
|
import static net.runelite.api.MenuAction.PLAYER_EIGTH_OPTION;
|
||||||
|
import static net.runelite.api.MenuAction.PLAYER_FIFTH_OPTION;
|
||||||
|
import static net.runelite.api.MenuAction.PLAYER_FIRST_OPTION;
|
||||||
|
import static net.runelite.api.MenuAction.PLAYER_FOURTH_OPTION;
|
||||||
|
import static net.runelite.api.MenuAction.PLAYER_SECOND_OPTION;
|
||||||
|
import static net.runelite.api.MenuAction.PLAYER_SEVENTH_OPTION;
|
||||||
|
import static net.runelite.api.MenuAction.PLAYER_SIXTH_OPTION;
|
||||||
|
import static net.runelite.api.MenuAction.PLAYER_THIRD_OPTION;
|
||||||
|
import static net.runelite.api.MenuAction.RUNELITE_PLAYER;
|
||||||
|
import static net.runelite.api.MenuAction.SPELL_CAST_ON_PLAYER;
|
||||||
|
import static net.runelite.api.MenuAction.WALK;
|
||||||
import net.runelite.api.MenuEntry;
|
import net.runelite.api.MenuEntry;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.events.ClientTick;
|
import net.runelite.api.events.ClientTick;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.game.FriendChatManager;
|
import net.runelite.client.game.ChatIconManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
@@ -65,11 +77,14 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private PlayerIndicatorsMinimapOverlay playerIndicatorsMinimapOverlay;
|
private PlayerIndicatorsMinimapOverlay playerIndicatorsMinimapOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private PlayerIndicatorsService playerIndicatorsService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private FriendChatManager friendChatManager;
|
private ChatIconManager chatIconManager;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
PlayerIndicatorsConfig provideConfig(ConfigManager configManager)
|
PlayerIndicatorsConfig provideConfig(ConfigManager configManager)
|
||||||
@@ -182,10 +197,13 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
color = config.getFriendsChatMemberColor();
|
color = config.getFriendsChatMemberColor();
|
||||||
|
|
||||||
FriendsChatRank rank = friendChatManager.getRank(player.getName());
|
if (config.showFriendsChatRanks())
|
||||||
if (rank != UNRANKED)
|
|
||||||
{
|
{
|
||||||
image = friendChatManager.getIconNumber(rank);
|
FriendsChatRank rank = playerIndicatorsService.getFriendsChatRank(player);
|
||||||
|
if (rank != UNRANKED)
|
||||||
|
{
|
||||||
|
image = chatIconManager.getIconNumber(rank);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (config.highlightTeamMembers()
|
else if (config.highlightTeamMembers()
|
||||||
@@ -222,7 +240,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
|||||||
newTarget = ColorUtil.prependColorTag(newTarget, decorations.getColor());
|
newTarget = ColorUtil.prependColorTag(newTarget, decorations.getColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decorations.getImage() != -1 && config.showFriendsChatRanks())
|
if (decorations.getImage() != -1)
|
||||||
{
|
{
|
||||||
newTarget = "<img=" + decorations.getImage() + ">" + newTarget;
|
newTarget = "<img=" + decorations.getImage() + ">" + newTarget;
|
||||||
}
|
}
|
||||||
|
|||||||
+15
@@ -29,6 +29,9 @@ import java.util.function.BiConsumer;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.FriendsChatManager;
|
||||||
|
import net.runelite.api.FriendsChatMember;
|
||||||
|
import net.runelite.api.FriendsChatRank;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -88,4 +91,16 @@ public class PlayerIndicatorsService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FriendsChatRank getFriendsChatRank(Player player)
|
||||||
|
{
|
||||||
|
final FriendsChatManager friendsChatManager = client.getFriendsChatManager();
|
||||||
|
if (friendsChatManager == null)
|
||||||
|
{
|
||||||
|
return FriendsChatRank.UNRANKED;
|
||||||
|
}
|
||||||
|
|
||||||
|
FriendsChatMember friendsChatMember = friendsChatManager.findByName(player.getName());
|
||||||
|
return friendsChatMember != null ? friendsChatMember.getRank() : FriendsChatRank.UNRANKED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,9 +211,9 @@ public class TwitchPlugin extends Plugin implements TwitchListener, ChatboxInput
|
|||||||
public boolean onChatboxInput(ChatboxInput chatboxInput)
|
public boolean onChatboxInput(ChatboxInput chatboxInput)
|
||||||
{
|
{
|
||||||
String message = chatboxInput.getValue();
|
String message = chatboxInput.getValue();
|
||||||
if (message.startsWith("//"))
|
if (message.startsWith("/t "))
|
||||||
{
|
{
|
||||||
message = message.substring(2);
|
message = message.substring(3);
|
||||||
if (message.isEmpty() || twitchIRCClient == null)
|
if (message.isEmpty() || twitchIRCClient == null)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
559DA005256EF939AA48F2B0B2B8C5D05168D50D378253DF81B0B68C20331A95
|
D6803CE58C6976B2799C6410F4F3E806D1EFD5A8263DCAE9C5BF54A4426BFFD1
|
||||||
@@ -25,7 +25,7 @@ LABEL10:
|
|||||||
iload 1
|
iload 1
|
||||||
iconst 0
|
iconst 0
|
||||||
if_icmpgt LABEL21
|
if_icmpgt LABEL21
|
||||||
jump LABEL255
|
jump LABEL265
|
||||||
LABEL21:
|
LABEL21:
|
||||||
get_varc_int 5
|
get_varc_int 5
|
||||||
switch
|
switch
|
||||||
@@ -38,20 +38,20 @@ LABEL21:
|
|||||||
7: LABEL110
|
7: LABEL110
|
||||||
8: LABEL116
|
8: LABEL116
|
||||||
9: LABEL124
|
9: LABEL124
|
||||||
10: LABEL191
|
10: LABEL201
|
||||||
11: LABEL247
|
11: LABEL257
|
||||||
12: LABEL207
|
12: LABEL217
|
||||||
13: LABEL225
|
13: LABEL235
|
||||||
15: LABEL124
|
15: LABEL124
|
||||||
16: LABEL252
|
16: LABEL262
|
||||||
18: LABEL247
|
18: LABEL257
|
||||||
19: LABEL110
|
19: LABEL110
|
||||||
20: LABEL124
|
20: LABEL124
|
||||||
21: LABEL124
|
21: LABEL124
|
||||||
jump LABEL254
|
jump LABEL264
|
||||||
LABEL24:
|
LABEL24:
|
||||||
return
|
return
|
||||||
jump LABEL254
|
jump LABEL264
|
||||||
LABEL26:
|
LABEL26:
|
||||||
ignore_count
|
ignore_count
|
||||||
iconst 0
|
iconst 0
|
||||||
@@ -79,7 +79,7 @@ LABEL44:
|
|||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
ignore_del
|
ignore_del
|
||||||
LABEL46:
|
LABEL46:
|
||||||
jump LABEL254
|
jump LABEL264
|
||||||
LABEL47:
|
LABEL47:
|
||||||
friend_count
|
friend_count
|
||||||
iconst 0
|
iconst 0
|
||||||
@@ -163,14 +163,14 @@ LABEL107:
|
|||||||
clientclock
|
clientclock
|
||||||
set_varc_int 61
|
set_varc_int 61
|
||||||
LABEL109:
|
LABEL109:
|
||||||
jump LABEL254
|
jump LABEL264
|
||||||
LABEL110:
|
LABEL110:
|
||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
invoke 212
|
invoke 212
|
||||||
resume_countdialog
|
resume_countdialog
|
||||||
iconst 0
|
iconst 0
|
||||||
set_varc_int 5
|
set_varc_int 5
|
||||||
jump LABEL254
|
jump LABEL264
|
||||||
LABEL116:
|
LABEL116:
|
||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
removetags
|
removetags
|
||||||
@@ -179,7 +179,7 @@ LABEL116:
|
|||||||
resume_namedialog
|
resume_namedialog
|
||||||
iconst 0
|
iconst 0
|
||||||
set_varc_int 5
|
set_varc_int 5
|
||||||
jump LABEL254
|
jump LABEL264
|
||||||
LABEL124:
|
LABEL124:
|
||||||
get_varc_int 5
|
get_varc_int 5
|
||||||
iconst 20
|
iconst 20
|
||||||
@@ -189,12 +189,12 @@ LABEL128:
|
|||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
removetags
|
removetags
|
||||||
invoke 4394
|
invoke 4394
|
||||||
jump LABEL186
|
jump LABEL196
|
||||||
LABEL132:
|
LABEL132:
|
||||||
get_varc_int 5
|
get_varc_int 5
|
||||||
iconst 21
|
iconst 21
|
||||||
if_icmpeq LABEL136
|
if_icmpeq LABEL136
|
||||||
jump LABEL186
|
jump LABEL196
|
||||||
LABEL136:
|
LABEL136:
|
||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
sconst "jagex"
|
sconst "jagex"
|
||||||
@@ -232,6 +232,16 @@ LABEL136:
|
|||||||
invoke 4191
|
invoke 4191
|
||||||
set_varc_string 359
|
set_varc_string 359
|
||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
|
sconst "mod "
|
||||||
|
sconst " "
|
||||||
|
invoke 4191
|
||||||
|
set_varc_string 359
|
||||||
|
get_varc_string 359
|
||||||
|
sconst "m0d "
|
||||||
|
sconst " "
|
||||||
|
invoke 4191
|
||||||
|
set_varc_string 359
|
||||||
|
get_varc_string 359
|
||||||
sconst "-"
|
sconst "-"
|
||||||
sconst " "
|
sconst " "
|
||||||
invoke 4191
|
invoke 4191
|
||||||
@@ -246,66 +256,66 @@ LABEL136:
|
|||||||
sconst " "
|
sconst " "
|
||||||
invoke 4191
|
invoke 4191
|
||||||
set_varc_string 359
|
set_varc_string 359
|
||||||
LABEL186:
|
LABEL196:
|
||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
resume_stringdialog
|
resume_stringdialog
|
||||||
iconst 0
|
iconst 0
|
||||||
set_varc_int 5
|
set_varc_int 5
|
||||||
jump LABEL254
|
jump LABEL264
|
||||||
LABEL191:
|
LABEL201:
|
||||||
get_varbit 8119
|
get_varbit 8119
|
||||||
iconst 0
|
iconst 0
|
||||||
if_icmpeq LABEL195
|
if_icmpeq LABEL205
|
||||||
jump LABEL201
|
jump LABEL211
|
||||||
LABEL195:
|
LABEL205:
|
||||||
iconst 1
|
iconst 1
|
||||||
iconst 1
|
iconst 1
|
||||||
invoke 299
|
invoke 299
|
||||||
sconst "You must set a name before you can chat."
|
sconst "You must set a name before you can chat."
|
||||||
mes
|
mes
|
||||||
return
|
return
|
||||||
LABEL201:
|
LABEL211:
|
||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
removetags
|
removetags
|
||||||
set_varc_string 362
|
set_varc_string 362
|
||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
clan_joinchat
|
clan_joinchat
|
||||||
jump LABEL254
|
jump LABEL264
|
||||||
LABEL207:
|
LABEL217:
|
||||||
iload 1
|
iload 1
|
||||||
iconst 10
|
iconst 10
|
||||||
if_icmpgt LABEL211
|
if_icmpgt LABEL221
|
||||||
jump LABEL217
|
jump LABEL227
|
||||||
LABEL211:
|
LABEL221:
|
||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
iconst 0
|
iconst 0
|
||||||
iconst 9
|
iconst 9
|
||||||
substring
|
substring
|
||||||
sstore 0
|
sstore 0
|
||||||
jump LABEL219
|
jump LABEL229
|
||||||
LABEL217:
|
LABEL227:
|
||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
sstore 0
|
sstore 0
|
||||||
LABEL219:
|
LABEL229:
|
||||||
sload 0
|
sload 0
|
||||||
lowercase
|
lowercase
|
||||||
chat_setmessagefilter
|
chat_setmessagefilter
|
||||||
invoke 553
|
invoke 553
|
||||||
invoke 84
|
invoke 84
|
||||||
jump LABEL254
|
jump LABEL264
|
||||||
LABEL225:
|
LABEL235:
|
||||||
get_varbit 8119
|
get_varbit 8119
|
||||||
iconst 0
|
iconst 0
|
||||||
if_icmpeq LABEL229
|
if_icmpeq LABEL239
|
||||||
jump LABEL235
|
jump LABEL245
|
||||||
LABEL229:
|
LABEL239:
|
||||||
iconst 1
|
iconst 1
|
||||||
iconst 1
|
iconst 1
|
||||||
invoke 299
|
invoke 299
|
||||||
sconst "You must set a name before you can chat."
|
sconst "You must set a name before you can chat."
|
||||||
mes
|
mes
|
||||||
return
|
return
|
||||||
LABEL235:
|
LABEL245:
|
||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
iconst 0
|
iconst 0
|
||||||
set_varc_int 62
|
set_varc_int 62
|
||||||
@@ -317,35 +327,35 @@ LABEL235:
|
|||||||
sconst "I1"
|
sconst "I1"
|
||||||
iconst 10616843
|
iconst 10616843
|
||||||
if_setontimer
|
if_setontimer
|
||||||
jump LABEL254
|
jump LABEL264
|
||||||
LABEL247:
|
LABEL257:
|
||||||
iconst 0
|
iconst 0
|
||||||
iconst 1
|
iconst 1
|
||||||
invoke 299
|
invoke 299
|
||||||
return
|
return
|
||||||
jump LABEL254
|
jump LABEL264
|
||||||
LABEL252:
|
LABEL262:
|
||||||
get_varc_string 359
|
get_varc_string 359
|
||||||
invoke 2061
|
invoke 2061
|
||||||
LABEL254:
|
LABEL264:
|
||||||
jump LABEL261
|
jump LABEL271
|
||||||
LABEL255:
|
LABEL265:
|
||||||
get_varc_int 5
|
get_varc_int 5
|
||||||
switch
|
switch
|
||||||
16: LABEL260
|
16: LABEL270
|
||||||
20: LABEL258
|
20: LABEL268
|
||||||
21: LABEL258
|
21: LABEL268
|
||||||
7: LABEL258
|
7: LABEL268
|
||||||
8: LABEL258
|
8: LABEL268
|
||||||
9: LABEL258
|
9: LABEL268
|
||||||
15: LABEL258
|
15: LABEL268
|
||||||
jump LABEL261
|
jump LABEL271
|
||||||
LABEL258:
|
LABEL268:
|
||||||
return
|
return
|
||||||
jump LABEL261
|
jump LABEL271
|
||||||
LABEL260:
|
LABEL270:
|
||||||
return
|
return
|
||||||
LABEL261:
|
LABEL271:
|
||||||
iconst 1
|
iconst 1
|
||||||
iconst 1
|
iconst 1
|
||||||
invoke 299
|
invoke 299
|
||||||
|
|||||||
+8
-8
@@ -31,12 +31,13 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.FriendsChatManager;
|
||||||
|
import net.runelite.api.FriendsChatMember;
|
||||||
import net.runelite.api.IterableHashTable;
|
import net.runelite.api.IterableHashTable;
|
||||||
import net.runelite.api.MessageNode;
|
import net.runelite.api.MessageNode;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
import net.runelite.api.events.ScriptCallbackEvent;
|
import net.runelite.api.events.ScriptCallbackEvent;
|
||||||
import net.runelite.client.game.FriendChatManager;
|
|
||||||
import static net.runelite.client.plugins.chatfilter.ChatFilterPlugin.CENSOR_MESSAGE;
|
import static net.runelite.client.plugins.chatfilter.ChatFilterPlugin.CENSOR_MESSAGE;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
@@ -59,12 +60,11 @@ public class ChatFilterPluginTest
|
|||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@Bind
|
private FriendsChatManager friendsChatManager;
|
||||||
private ChatFilterConfig chatFilterConfig;
|
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@Bind
|
@Bind
|
||||||
private FriendChatManager friendChatManager;
|
private ChatFilterConfig chatFilterConfig;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private Player localPlayer;
|
private Player localPlayer;
|
||||||
@@ -81,7 +81,9 @@ public class ChatFilterPluginTest
|
|||||||
when(chatFilterConfig.filteredWords()).thenReturn("");
|
when(chatFilterConfig.filteredWords()).thenReturn("");
|
||||||
when(chatFilterConfig.filteredRegex()).thenReturn("");
|
when(chatFilterConfig.filteredRegex()).thenReturn("");
|
||||||
when(chatFilterConfig.filteredNames()).thenReturn("");
|
when(chatFilterConfig.filteredNames()).thenReturn("");
|
||||||
|
|
||||||
when(client.getLocalPlayer()).thenReturn(localPlayer);
|
when(client.getLocalPlayer()).thenReturn(localPlayer);
|
||||||
|
when(client.getFriendsChatManager()).thenReturn(friendsChatManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScriptCallbackEvent createCallbackEvent(final String sender, final String chatMessage, final ChatMessageType messageType)
|
private ScriptCallbackEvent createCallbackEvent(final String sender, final String chatMessage, final ChatMessageType messageType)
|
||||||
@@ -187,7 +189,6 @@ public class ChatFilterPluginTest
|
|||||||
@Test
|
@Test
|
||||||
public void testMessageFromFriendIsFiltered()
|
public void testMessageFromFriendIsFiltered()
|
||||||
{
|
{
|
||||||
when(friendChatManager.isMember("Iron Mammal")).thenReturn(false);
|
|
||||||
when(chatFilterConfig.filterFriends()).thenReturn(true);
|
when(chatFilterConfig.filterFriends()).thenReturn(true);
|
||||||
assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("Iron Mammal"));
|
assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("Iron Mammal"));
|
||||||
}
|
}
|
||||||
@@ -211,7 +212,7 @@ public class ChatFilterPluginTest
|
|||||||
@Test
|
@Test
|
||||||
public void testMessageFromFriendsChatIsNotFiltered()
|
public void testMessageFromFriendsChatIsNotFiltered()
|
||||||
{
|
{
|
||||||
when(friendChatManager.isMember("B0aty")).thenReturn(true);
|
when(friendsChatManager.findByName("B0aty")).thenReturn(mock(FriendsChatMember.class));
|
||||||
when(chatFilterConfig.filterFriendsChat()).thenReturn(false);
|
when(chatFilterConfig.filterFriendsChat()).thenReturn(false);
|
||||||
assertFalse(chatFilterPlugin.shouldFilterPlayerMessage("B0aty"));
|
assertFalse(chatFilterPlugin.shouldFilterPlayerMessage("B0aty"));
|
||||||
}
|
}
|
||||||
@@ -227,7 +228,6 @@ public class ChatFilterPluginTest
|
|||||||
public void testMessageFromNonFriendNonFCIsFiltered()
|
public void testMessageFromNonFriendNonFCIsFiltered()
|
||||||
{
|
{
|
||||||
when(client.isFriended("Woox", false)).thenReturn(false);
|
when(client.isFriended("Woox", false)).thenReturn(false);
|
||||||
when(friendChatManager.isMember("Woox")).thenReturn(false);
|
|
||||||
assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("Woox"));
|
assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("Woox"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public class ChatFilterPluginTest
|
|||||||
when(chatFilterConfig.filteredWords()).thenReturn("test");
|
when(chatFilterConfig.filteredWords()).thenReturn("test");
|
||||||
// if this test is broken, this stubbing is required to trip the assert
|
// if this test is broken, this stubbing is required to trip the assert
|
||||||
lenient().when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.REMOVE_MESSAGE);
|
lenient().when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.REMOVE_MESSAGE);
|
||||||
when(friendChatManager.isMember("Lazark")).thenReturn(true);
|
when(friendsChatManager.findByName("Lazark")).thenReturn(mock(FriendsChatMember.class));
|
||||||
|
|
||||||
chatFilterPlugin.updateFilteredPatterns();
|
chatFilterPlugin.updateFilteredPatterns();
|
||||||
ScriptCallbackEvent event = createCallbackEvent("<img=22>Lazark", "test", ChatMessageType.PUBLICCHAT);
|
ScriptCallbackEvent event = createCallbackEvent("<img=22>Lazark", "test", ChatMessageType.PUBLICCHAT);
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import net.runelite.mapping.Import;
|
|||||||
|
|
||||||
public interface RSEnumComposition extends EnumComposition, RSDualNode
|
public interface RSEnumComposition extends EnumComposition, RSDualNode
|
||||||
{
|
{
|
||||||
|
@Import("size")
|
||||||
|
@Override
|
||||||
|
int size();
|
||||||
|
|
||||||
@Import("keys")
|
@Import("keys")
|
||||||
@Override
|
@Override
|
||||||
int[] getKeys();
|
int[] getKeys();
|
||||||
|
|||||||
Reference in New Issue
Block a user