Merge remote-tracking branch 'upstream/master' into master

Nice insider info btw, be nice if you shared it, so-called "open source" client.
This commit is contained in:
ThatGamerBlue
2021-05-28 21:39:25 +01:00
481 changed files with 53410 additions and 51723 deletions

View File

@@ -98,6 +98,8 @@ public class ChatCommandManager implements ChatboxInputListener
case PRIVATECHAT:
case MODPRIVATECHAT:
case PRIVATECHATOUT:
case CLAN_CHAT:
case CLAN_GUEST_CHAT:
break;
default:
return;

View File

@@ -119,7 +119,7 @@ public class ChatMessageManager
boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1;
Color usernameColor = null;
Color senderColor;
Color senderColor = null;
switch (chatMessageType)
{
@@ -147,12 +147,22 @@ public class ChatMessageManager
break;
}
case FRIENDSCHAT:
case FRIENDSCHATNOTIFICATION:
usernameColor = isChatboxTransparent ? chatColorConfig.transparentFriendsChatUsernames() : chatColorConfig.opaqueFriendsChatUsernames();
senderColor = isChatboxTransparent ? chatColorConfig.transparentFriendsChatChannelName() : chatColorConfig.opaqueFriendsChatChannelName();
break;
case CLAN_CHAT:
case CLAN_MESSAGE:
usernameColor = isChatboxTransparent ? chatColorConfig.transparentClanChatUsernames() : chatColorConfig.opaqueClanChatUsernames();
senderColor = isChatboxTransparent ? chatColorConfig.transparentClanChannelName() : chatColorConfig.opaqueClanChannelName();
break;
case CLAN_GUEST_CHAT:
case CLAN_GUEST_MESSAGE:
usernameColor = isChatboxTransparent ? chatColorConfig.transparentClanChatGuestUsernames() : chatColorConfig.opaqueClanChatGuestUsernames();
senderColor = isChatboxTransparent ? chatColorConfig.transparentClanChannelGuestName() : chatColorConfig.opaqueClanGuestChatChannelName();
break;
}
senderColor = isChatboxTransparent ? chatColorConfig.transparentFriendsChatChannelName() : chatColorConfig.opaqueFriendsChatChannelName();
if (usernameColor != null)
{
messageNode.setName(ColorUtil.wrapWithColorTag(messageNode.getName(), usernameColor));
@@ -186,12 +196,14 @@ public class ChatMessageManager
{
final String eventName = scriptCallbackEvent.getEventName();
boolean wrap;
switch (eventName)
{
case "privateChatFrom":
case "privateChatTo":
case "privateChatSplitFrom":
case "privateChatSplitTo":
case "splitPrivChatUsernameColor":
wrap = false;
break;
case "privChatUsername":
wrap = true;
break;
default:
return;
@@ -206,10 +218,17 @@ public class ChatMessageManager
final String[] stringStack = client.getStringStack();
final int stringStackSize = client.getStringStackSize();
// Stack is: To/From playername :
String toFrom = stringStack[stringStackSize - 3];
stringStack[stringStackSize - 3] = ColorUtil.prependColorTag(toFrom, usernameColor);
String fromToUsername = stringStack[stringStackSize - 1];
if (wrap)
{
fromToUsername = ColorUtil.wrapWithColorTag(fromToUsername, usernameColor);
}
else
{
fromToUsername = ColorUtil.colorTag(usernameColor);
}
stringStack[stringStackSize - 1] = fromToUsername;
}
private static Color getDefaultColor(ChatMessageType type, boolean transparent)
@@ -226,12 +245,16 @@ public class ChatMessageManager
case PRIVATECHAT:
return JagexColors.CHAT_PRIVATE_MESSAGE_TEXT_OPAQUE_BACKGROUND;
case FRIENDSCHAT:
case CLAN_CHAT:
case CLAN_GUEST_CHAT:
return JagexColors.CHAT_FC_TEXT_OPAQUE_BACKGROUND;
case ITEM_EXAMINE:
case OBJECT_EXAMINE:
case NPC_EXAMINE:
case CONSOLE:
case FRIENDSCHATNOTIFICATION:
case CLAN_MESSAGE:
case CLAN_GUEST_MESSAGE:
return JagexColors.CHAT_GAME_EXAMINE_TEXT_OPAQUE_BACKGROUND;
}
}
@@ -247,12 +270,16 @@ public class ChatMessageManager
case PRIVATECHAT:
return JagexColors.CHAT_PRIVATE_MESSAGE_TEXT_TRANSPARENT_BACKGROUND;
case FRIENDSCHAT:
case CLAN_CHAT:
case CLAN_GUEST_CHAT:
return JagexColors.CHAT_FC_TEXT_TRANSPARENT_BACKGROUND;
case ITEM_EXAMINE:
case OBJECT_EXAMINE:
case NPC_EXAMINE:
case CONSOLE:
case FRIENDSCHATNOTIFICATION:
case CLAN_MESSAGE:
case CLAN_GUEST_MESSAGE:
return JagexColors.CHAT_GAME_EXAMINE_TEXT_TRANSPARENT_BACKGROUND;
}
}
@@ -341,6 +368,49 @@ public class ChatMessageManager
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueFriendsChatMessageHighlight(), false),
ChatMessageType.FRIENDSCHAT);
}
//region opaque clanchat
if (chatColorConfig.opaqueClanChatInfo() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueClanChatInfo(), false),
ChatMessageType.CLAN_MESSAGE);
}
if (chatColorConfig.opaqueClanChatInfoHighlight() != null)
{
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueClanChatInfoHighlight(), false),
ChatMessageType.CLAN_MESSAGE);
}
if (chatColorConfig.opaqueClanChatMessage() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueClanChatMessage(), false),
ChatMessageType.CLAN_CHAT);
}
if (chatColorConfig.opaqueClanChatMessageHighlight() != null)
{
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueClanChatMessageHighlight(), false),
ChatMessageType.CLAN_CHAT);
}
if (chatColorConfig.opaqueClanChatGuestInfo() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueClanChatGuestInfo(), false),
ChatMessageType.CLAN_GUEST_MESSAGE);
}
if (chatColorConfig.opaqueClanChatGuestInfoHighlight() != null)
{
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueClanChatGuestInfoHighlight(), false),
ChatMessageType.CLAN_GUEST_MESSAGE);
}
if (chatColorConfig.opaqueClanChatGuestMessage() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueClanChatGuestMessage(), false),
ChatMessageType.CLAN_GUEST_CHAT);
}
if (chatColorConfig.opaqueClanChatGuestMessageHighlight() != null)
{
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueClanChatGuestMessageHighlight(), false),
ChatMessageType.CLAN_GUEST_CHAT);
}
//endregion
if (chatColorConfig.opaqueAutochatMessage() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueAutochatMessage(), false),
@@ -454,6 +524,7 @@ public class ChatMessageManager
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentPrivateMessageReceivedHighlight(), true),
ChatMessageType.MODPRIVATECHAT);
}
//region transpaprent friends chat
if (chatColorConfig.transparentFriendsChatInfo() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentFriendsChatInfo(), true),
@@ -474,6 +545,50 @@ public class ChatMessageManager
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentFriendsChatMessageHighlight(), true),
ChatMessageType.FRIENDSCHAT);
}
//endregion
//region transparent clanchat
if (chatColorConfig.transparentClanChatInfo() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentClanChatInfo(), true),
ChatMessageType.CLAN_MESSAGE);
}
if (chatColorConfig.transparentClanChatInfoHighlight() != null)
{
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentClanChatInfoHighlight(), true),
ChatMessageType.CLAN_MESSAGE);
}
if (chatColorConfig.transparentClanChatMessage() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentClanChatMessage(), true),
ChatMessageType.CLAN_CHAT);
}
if (chatColorConfig.transparentClanChatMessageHighlight() != null)
{
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentClanChatMessageHighlight(), true),
ChatMessageType.CLAN_CHAT);
}
if (chatColorConfig.transparentClanChatGuestInfo() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentClanChatGuestInfo(), true),
ChatMessageType.CLAN_GUEST_MESSAGE);
}
if (chatColorConfig.transparentClanChatGuestInfoHighlight() != null)
{
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentClanChatGuestInfoHighlight(), true),
ChatMessageType.CLAN_GUEST_MESSAGE);
}
if (chatColorConfig.transparentClanChatGuestMessage() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentClanChatGuestMessage(), true),
ChatMessageType.CLAN_GUEST_CHAT);
}
if (chatColorConfig.transparentClanChatGuestMessageHighlight() != null)
{
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentClanChatGuestMessageHighlight(), true),
ChatMessageType.CLAN_GUEST_CHAT);
}
//endregion
if (chatColorConfig.transparentAutochatMessage() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentAutochatMessage(), true),

View File

@@ -108,6 +108,7 @@ public interface ChatColorConfig extends Config
return Color.decode("#002783");
}
//region opaque friends chat
@ConfigItem(
position = 7,
keyName = "opaqueFriendsChatInfo",
@@ -149,9 +150,96 @@ public interface ChatColorConfig extends Config
{
return Color.decode("#000000");
}
//endregion
//region opaque clan chat
@ConfigItem(
position = 11,
keyName = "opaqueClanInfo",
name = "Clan chat info",
description = "Clan Chat Information (eg. when joining a channel)",
section = opaqueSection
)
Color opaqueClanChatInfo();
@ConfigItem(
position = 12,
keyName = "opaqueClanInfoHighlight",
name = "Clan chat info highlight",
description = "Clan Chat Information highlight",
section = opaqueSection
)
default Color opaqueClanChatInfoHighlight()
{
return Color.RED;
}
@ConfigItem(
position = 13,
keyName = "opaqueClanMessage",
name = "Clan chat message",
description = "Color of Clan chat messages",
section = opaqueSection
)
Color opaqueClanChatMessage();
@ConfigItem(
position = 14,
keyName = "opaqueClanChatMessageHighlight",
name = "Clan chat message highlight",
description = "Color of highlights in Clan Chat messages",
section = opaqueSection
)
default Color opaqueClanChatMessageHighlight()
{
return Color.decode("#000000");
}
@ConfigItem(
position = 15,
keyName = "opaqueClanGuestInfo",
name = "Guest Clan chat info",
description = "Guest Clan Chat Information (eg. when joining a channel)",
section = opaqueSection
)
Color opaqueClanChatGuestInfo();
@ConfigItem(
position = 16,
keyName = "opaqueClanGuestInfoHighlight",
name = "Guest Clan chat info highlight",
description = "Guest Clan Chat Information highlight",
section = opaqueSection
)
default Color opaqueClanChatGuestInfoHighlight()
{
return Color.RED;
}
@ConfigItem(
position = 17,
keyName = "opaqueClanGuestMessage",
name = "Guest Clan chat message",
description = "Color of Guest Clan chat messages",
section = opaqueSection
)
Color opaqueClanChatGuestMessage();
@ConfigItem(
position = 18,
keyName = "opaqueClanChatGuestMessageHighlight",
name = "Guest Clan chat message highlight",
description = "Color of highlights in Guest Clan Chat messages",
section = opaqueSection
)
default Color opaqueClanChatGuestMessageHighlight()
{
return Color.decode("#000000");
}
//endregion
@ConfigItem(
position = 19,
keyName = "opaqueAutochatMessage",
name = "Autochat",
description = "Color of Autochat messages",
@@ -160,7 +248,7 @@ public interface ChatColorConfig extends Config
Color opaqueAutochatMessage();
@ConfigItem(
position = 12,
position = 20,
keyName = "opaqueAutochatMessageHighlight",
name = "Autochat highlight",
description = "Color of highlights in Autochat messages",
@@ -169,7 +257,7 @@ public interface ChatColorConfig extends Config
Color opaqueAutochatMessageHighlight();
@ConfigItem(
position = 13,
position = 21,
keyName = "opaqueTradeChatMessage",
name = "Trade chat",
description = "Color of Trade Chat Messages",
@@ -178,7 +266,7 @@ public interface ChatColorConfig extends Config
Color opaqueTradeChatMessage();
@ConfigItem(
position = 14,
position = 22,
keyName = "opaqueTradeChatMessageHighlight",
name = "Trade chat highlight",
description = "Color of highlights in Trade Chat Messages",
@@ -187,7 +275,7 @@ public interface ChatColorConfig extends Config
Color opaqueTradeChatMessageHighlight();
@ConfigItem(
position = 15,
position = 23,
keyName = "opaqueServerMessage",
name = "Server message",
description = "Color of Server Messages (eg. 'Welcome to RuneScape')",
@@ -196,7 +284,7 @@ public interface ChatColorConfig extends Config
Color opaqueServerMessage();
@ConfigItem(
position = 16,
position = 24,
keyName = "opaqueServerMessageHighlight",
name = "Server message highlight",
description = "Color of highlights in Server Messages",
@@ -205,7 +293,7 @@ public interface ChatColorConfig extends Config
Color opaqueServerMessageHighlight();
@ConfigItem(
position = 17,
position = 25,
keyName = "opaqueGameMessage",
name = "Game message",
description = "Color of Game Messages",
@@ -214,7 +302,7 @@ public interface ChatColorConfig extends Config
Color opaqueGameMessage();
@ConfigItem(
position = 18,
position = 26,
keyName = "opaqueGameMessageHighlight",
name = "Game message highlight",
description = "Color of highlights in Game Messages",
@@ -226,7 +314,7 @@ public interface ChatColorConfig extends Config
}
@ConfigItem(
position = 19,
position = 27,
keyName = "opaqueExamine",
name = "Examine",
description = "Color of Examine Text",
@@ -235,7 +323,7 @@ public interface ChatColorConfig extends Config
Color opaqueExamine();
@ConfigItem(
position = 20,
position = 28,
keyName = "opaqueExamineHighlight",
name = "Examine highlight",
description = "Color of highlights in Examine Text",
@@ -247,7 +335,7 @@ public interface ChatColorConfig extends Config
}
@ConfigItem(
position = 21,
position = 29,
keyName = "opaqueFiltered",
name = "Filtered",
description = "Color of Filtered Text (messages that aren't shown when Game messages are filtered)",
@@ -256,7 +344,7 @@ public interface ChatColorConfig extends Config
Color opaqueFiltered();
@ConfigItem(
position = 22,
position = 30,
keyName = "opaqueFilteredHighlight",
name = "Filtered highlight",
description = "Color of highlights in Filtered Text",
@@ -265,7 +353,7 @@ public interface ChatColorConfig extends Config
Color opaqueFilteredHighlight();
@ConfigItem(
position = 23,
position = 31,
keyName = "opaqueUsername",
name = "Usernames",
description = "Color of Usernames",
@@ -274,7 +362,7 @@ public interface ChatColorConfig extends Config
Color opaqueUsername();
@ConfigItem(
position = 24,
position = 32,
keyName = "opaquePrivateUsernames",
name = "Private chat usernames",
description = "Color of Usernames in Private Chat",
@@ -283,16 +371,34 @@ public interface ChatColorConfig extends Config
Color opaquePrivateUsernames();
@ConfigItem(
position = 25,
position = 33,
keyName = "opaqueClanChannelName",
name = "Friends chat channel name",
name = "Friends Chat channel name",
description = "Color of Friends chat channel name",
section = opaqueSection
)
Color opaqueFriendsChatChannelName();
@ConfigItem(
position = 26,
position = 34,
keyName = "opaqueClanChatChannelName",
name = "Clan Chat channel name",
description = "Color of Clan chat channel name",
section = opaqueSection
)
Color opaqueClanChannelName();
@ConfigItem(
position = 35,
keyName = "opaqueClanChatGuestChannelName",
name = "Guest Clan Chat channel name",
description = "Color of Guest clan chat channel name",
section = opaqueSection
)
Color opaqueClanGuestChatChannelName();
@ConfigItem(
position = 36,
keyName = "opaqueClanUsernames",
name = "Friends chat usernames",
description = "Color of usernames in Friends chat",
@@ -301,7 +407,25 @@ public interface ChatColorConfig extends Config
Color opaqueFriendsChatUsernames();
@ConfigItem(
position = 27,
position = 37,
keyName = "opaqueClanChatUsernames",
name = "Clan chat usernames",
description = "Color of usernames in Clan chat",
section = opaqueSection
)
Color opaqueClanChatUsernames();
@ConfigItem(
position = 38,
keyName = "opaqueClanChatGuestUsernames",
name = "Guest Clan chat usernames",
description = "Color of usernames in Guest Clan chat",
section = opaqueSection
)
Color opaqueClanChatGuestUsernames();
@ConfigItem(
position = 39,
keyName = "opaquePublicFriendUsernames",
name = "Public friend usernames",
description = "Color of Friend Usernames in Public Chat",
@@ -310,7 +434,7 @@ public interface ChatColorConfig extends Config
Color opaquePublicFriendUsernames();
@ConfigItem(
position = 28,
position = 40,
keyName = "opaquePlayerUsername",
name = "Your username",
description = "Color of your username",
@@ -381,6 +505,7 @@ public interface ChatColorConfig extends Config
return Color.decode("#FFFFFF");
}
//region transparent friends chat
@ConfigItem(
position = 57,
keyName = "transparentFriendsChatInfo",
@@ -422,9 +547,96 @@ public interface ChatColorConfig extends Config
{
return Color.decode("#FFFFFF");
}
//endregion
//region transparent clan chat
@ConfigItem(
position = 61,
keyName = "transparentClanInfo",
name = "Clan chat info (transparent)",
description = "Clan Chat Information (eg. when joining a channel) (transparent)",
section = transparentSection
)
Color transparentClanChatInfo();
@ConfigItem(
position = 62,
keyName = "transparentClanInfoHighlight",
name = "Clan chat info highlight (transparent)",
description = "Clan Chat Information highlight (transparent)",
section = transparentSection
)
default Color transparentClanChatInfoHighlight()
{
return Color.RED;
}
@ConfigItem(
position = 63,
keyName = "transparentClanMessage",
name = "Clan chat message (transparent)",
description = "Color of Clan chat messages (transparent)",
section = transparentSection
)
Color transparentClanChatMessage();
@ConfigItem(
position = 64,
keyName = "transparentClanChatMessageHighlight",
name = "Clan chat message highlight (transparent)",
description = "Color of highlights in Clan Chat messages (transparent)",
section = transparentSection
)
default Color transparentClanChatMessageHighlight()
{
return Color.decode("#FFFFFF");
}
@ConfigItem(
position = 65,
keyName = "transparentClanGuestInfo",
name = "Guest Clan chat info (transparent)",
description = "Guest Clan Chat Information (eg. when joining a channel) (transparent)",
section = transparentSection
)
Color transparentClanChatGuestInfo();
@ConfigItem(
position = 66,
keyName = "transparentClanGuestInfoHighlight",
name = "Guest Clan chat info highlight (transparent)",
description = "Guest Clan Chat Information highlight (transparent)",
section = transparentSection
)
default Color transparentClanChatGuestInfoHighlight()
{
return Color.RED;
}
@ConfigItem(
position = 67,
keyName = "transparentClanGuestMessage",
name = "Guest Clan chat message (transparent)",
description = "Color of Guest Clan chat messages (transparent)",
section = transparentSection
)
Color transparentClanChatGuestMessage();
@ConfigItem(
position = 68,
keyName = "transparentClanChatGuestMessageHighlight",
name = "Guest Clan chat message highlight (transparent)",
description = "Color of highlights in Guest Clan Chat messages (transparent)",
section = transparentSection
)
default Color transparentClanChatGuestMessageHighlight()
{
return Color.decode("#FFFFFF");
}
//endregion
@ConfigItem(
position = 69,
keyName = "transparentAutochatMessage",
name = "Autochat (transparent)",
description = "Color of Autochat messages (transparent)",
@@ -433,7 +645,7 @@ public interface ChatColorConfig extends Config
Color transparentAutochatMessage();
@ConfigItem(
position = 62,
position = 70,
keyName = "transparentAutochatMessageHighlight",
name = "Autochat highlight (transparent)",
description = "Color of highlights in Autochat messages (transparent)",
@@ -442,7 +654,7 @@ public interface ChatColorConfig extends Config
Color transparentAutochatMessageHighlight();
@ConfigItem(
position = 63,
position = 71,
keyName = "transparentTradeChatMessage",
name = "Trade chat (transparent)",
description = "Color of Trade Chat Messages (transparent)",
@@ -451,7 +663,7 @@ public interface ChatColorConfig extends Config
Color transparentTradeChatMessage();
@ConfigItem(
position = 64,
position = 72,
keyName = "transparentTradeChatMessageHighlight",
name = "Trade chat highlight (transparent)",
description = "Color of highlights in Trade Chat Messages (transparent)",
@@ -460,7 +672,7 @@ public interface ChatColorConfig extends Config
Color transparentTradeChatMessageHighlight();
@ConfigItem(
position = 65,
position = 73,
keyName = "transparentServerMessage",
name = "Server message (transparent)",
description = "Color of Server Messages (eg. 'Welcome to RuneScape') (transparent)",
@@ -469,7 +681,7 @@ public interface ChatColorConfig extends Config
Color transparentServerMessage();
@ConfigItem(
position = 66,
position = 74,
keyName = "transparentServerMessageHighlight",
name = "Server message highlight (transparent)",
description = "Color of highlights in Server Messages (transparent)",
@@ -478,7 +690,7 @@ public interface ChatColorConfig extends Config
Color transparentServerMessageHighlight();
@ConfigItem(
position = 67,
position = 75,
keyName = "transparentGameMessage",
name = "Game message (transparent)",
description = "Color of Game Messages (transparent)",
@@ -487,7 +699,7 @@ public interface ChatColorConfig extends Config
Color transparentGameMessage();
@ConfigItem(
position = 68,
position = 76,
keyName = "transparentGameMessageHighlight",
name = "Game message highlight (transparent)",
description = "Color of highlights in Game Messages (transparent)",
@@ -499,7 +711,7 @@ public interface ChatColorConfig extends Config
}
@ConfigItem(
position = 69,
position = 77,
keyName = "transparentExamine",
name = "Examine (transparent)",
description = "Color of Examine Text (transparent)",
@@ -508,7 +720,7 @@ public interface ChatColorConfig extends Config
Color transparentExamine();
@ConfigItem(
position = 70,
position = 78,
keyName = "transparentExamineHighlight",
name = "Examine highlight (transparent)",
description = "Color of highlights in Examine Text (transparent)",
@@ -520,7 +732,7 @@ public interface ChatColorConfig extends Config
}
@ConfigItem(
position = 71,
position = 79,
keyName = "transparentFiltered",
name = "Filtered (transparent)",
description = "Color of Filtered Text (messages that aren't shown when Game messages are filtered) (transparent)",
@@ -529,7 +741,7 @@ public interface ChatColorConfig extends Config
Color transparentFiltered();
@ConfigItem(
position = 72,
position = 80,
keyName = "transparentFilteredHighlight",
name = "Filtered highlight (transparent)",
description = "Color of highlights in Filtered Text (transparent)",
@@ -538,7 +750,7 @@ public interface ChatColorConfig extends Config
Color transparentFilteredHighlight();
@ConfigItem(
position = 73,
position = 81,
keyName = "transparentUsername",
name = "Usernames (transparent)",
description = "Color of Usernames (transparent)",
@@ -547,7 +759,7 @@ public interface ChatColorConfig extends Config
Color transparentUsername();
@ConfigItem(
position = 74,
position = 82,
keyName = "transparentPrivateUsernames",
name = "Private chat usernames (transparent)",
description = "Color of Usernames in Private Chat (transparent)",
@@ -556,16 +768,34 @@ public interface ChatColorConfig extends Config
Color transparentPrivateUsernames();
@ConfigItem(
position = 75,
position = 83,
keyName = "transparentClanChannelName",
name = "Friends chat channel name (transparent)",
name = "Friends Chat channel name (transparent)",
description = "Color of Friends chat channel name (transparent)",
section = transparentSection
)
Color transparentFriendsChatChannelName();
@ConfigItem(
position = 76,
position = 84,
keyName = "transparentClanChatChannelName",
name = "Clan Chat channel name (transparent)",
description = "Color of Clan chat channel name (transparent)",
section = transparentSection
)
Color transparentClanChannelName();
@ConfigItem(
position = 85,
keyName = "transparentClanChatGuestChannelName",
name = "Guest Clan Chat channel name (transparent)",
description = "Color of Guest clan chat channel name (transparent)",
section = transparentSection
)
Color transparentClanChannelGuestName();
@ConfigItem(
position = 86,
keyName = "transparentClanUsernames",
name = "Friends chat usernames (transparent)",
description = "Color of usernames in Friends chat (transparent)",
@@ -574,7 +804,25 @@ public interface ChatColorConfig extends Config
Color transparentFriendsChatUsernames();
@ConfigItem(
position = 77,
position = 87,
keyName = "transparentClanClanUsernames",
name = "Clan chat usernames (transparent)",
description = "Color of usernames in Clan chat (transparent)",
section = transparentSection
)
Color transparentClanChatUsernames();
@ConfigItem(
position = 88,
keyName = "transparentClanClanGuestUsernames",
name = "Guest Clan chat usernames (transparent)",
description = "Color of usernames in Guest Clan chat (transparent)",
section = transparentSection
)
Color transparentClanChatGuestUsernames();
@ConfigItem(
position = 89,
keyName = "transparentPublicFriendUsernames",
name = "Public friend usernames (transparent)",
description = "Color of Friend Usernames in Public Chat (transparent)",
@@ -583,7 +831,7 @@ public interface ChatColorConfig extends Config
Color transparentPublicFriendUsernames();
@ConfigItem(
position = 78,
position = 90,
keyName = "transparentPlayerUsername",
name = "Your username (transparent)",
description = "Color of your username (transparent)",

View File

@@ -37,6 +37,7 @@ import net.runelite.api.EnumID;
import net.runelite.api.FriendsChatRank;
import net.runelite.api.GameState;
import net.runelite.api.IndexedSprite;
import net.runelite.api.clan.ClanTitle;
import net.runelite.api.events.GameStateChanged;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
@@ -52,8 +53,10 @@ public class ChatIconManager
private final SpriteManager spriteManager;
private BufferedImage[] friendsChatRankImages;
private BufferedImage[] clanRankImages;
private int friendsChatOffset;
private int clanOffset;
@Inject
private ChatIconManager(Client client, SpriteManager spriteManager, EventBus eventBus)
@@ -74,11 +77,25 @@ public class ChatIconManager
return friendsChatRankImages[friendsChatRank.ordinal() - 1];
}
@Nullable
public BufferedImage getRankImage(final ClanTitle clanTitle)
{
int rank = clanTitle.getId();
int idx = clanRankToIdx(rank);
return clanRankImages[idx];
}
public int getIconNumber(final FriendsChatRank friendsChatRank)
{
return friendsChatOffset + friendsChatRank.ordinal() - 1;
}
public int getIconNumber(final ClanTitle clanTitle)
{
int rank = clanTitle.getId();
return clanOffset + clanRankToIdx(rank);
}
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged)
{
@@ -91,22 +108,25 @@ public class ChatIconManager
private void loadRankIcons()
{
final EnumComposition friendsChatIcons = client.getEnum(EnumID.FRIENDS_CHAT_RANK_ICONS);
final EnumComposition clanIcons = client.getEnum(EnumID.CLAN_RANK_GRAPHIC);
{
IndexedSprite[] modIcons = client.getModIcons();
friendsChatOffset = modIcons.length;
clanOffset = friendsChatOffset + friendsChatIcons.size();
IndexedSprite blank = ImageUtil.getImageIndexedSprite(
new BufferedImage(modIcons[0].getWidth(), modIcons[0].getHeight(), BufferedImage.TYPE_INT_ARGB),
client);
modIcons = Arrays.copyOf(modIcons, friendsChatOffset + friendsChatIcons.size());
modIcons = Arrays.copyOf(modIcons, friendsChatOffset + friendsChatIcons.size() + clanIcons.size());
Arrays.fill(modIcons, friendsChatOffset, modIcons.length, blank);
client.setModIcons(modIcons);
}
friendsChatRankImages = new BufferedImage[friendsChatIcons.size()];
clanRankImages = new BufferedImage[clanIcons.size()];
final IndexedSprite[] modIcons = client.getModIcons();
@@ -120,6 +140,21 @@ public class ChatIconManager
modIcons[friendsChatOffset + fi] = ImageUtil.getImageIndexedSprite(friendsChatRankImages[fi], client);
});
}
for (int i = 0; i < clanIcons.size(); i++)
{
final int key = clanIcons.getKeys()[i];
final int idx = clanRankToIdx(key);
assert idx >= 0 && idx < clanIcons.size();
spriteManager.getSpriteAsync(clanIcons.getIntValue(key), 0, sprite ->
{
final BufferedImage img = ImageUtil.resizeCanvas(sprite, IMAGE_DIMENSION.width, IMAGE_DIMENSION.height);
clanRankImages[idx] = img;
modIcons[clanOffset + idx] = ImageUtil.getImageIndexedSprite(img, client);
});
}
}
private static BufferedImage friendsChatImageFromSprite(final BufferedImage sprite)
@@ -127,4 +162,10 @@ public class ChatIconManager
final BufferedImage canvas = ImageUtil.resizeCanvas(sprite, IMAGE_DIMENSION.width, IMAGE_DIMENSION.height);
return ImageUtil.outlineImage(canvas, IMAGE_OUTLINE_COLOR);
}
private static int clanRankToIdx(int key)
{
// keys are -5 to 264, with no 0
return key < 0 ? ~key : (key + 4);
}
}

View File

@@ -34,7 +34,7 @@ import net.runelite.api.GameState;
import net.runelite.api.ScriptID;
import net.runelite.api.VarClientInt;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.events.ScriptPreFired;
import net.runelite.api.vars.InputType;
import net.runelite.api.widgets.JavaScriptCallback;
import net.runelite.api.widgets.Widget;
@@ -153,9 +153,9 @@ public class ChatboxPanelManager
}
@Subscribe
public void onScriptCallbackEvent(ScriptCallbackEvent ev)
public void onScriptPreFired(ScriptPreFired ev)
{
if (currentInput != null && "resetChatboxInput".equals(ev.getEventName()))
if (currentInput != null && ev.getScriptId() == ScriptID.MESSAGE_LAYER_CLOSE)
{
killCurrentPanel();
}

View File

@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.friendschat;
package net.runelite.client.plugins.chatchannel;
enum ActivityType
{

View File

@@ -22,22 +22,58 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.friendschat;
package net.runelite.client.plugins.chatchannel;
import java.awt.Color;
import net.runelite.api.FriendsChatRank;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigSection;
@ConfigGroup("clanchat") // group name from the old plugin
public interface FriendsChatConfig extends Config
@ConfigGroup(ChatChannelConfig.GROUP)
public interface ChatChannelConfig extends Config
{
String GROUP = "clanchat"; // group name from the old plugin
@ConfigSection(
name = "Friends Chat",
description = "Configuration for friends chat",
position = 10
)
String friendsChatSection = "friendsChat";
@ConfigSection(
name = "Clan Chat",
description = "Configuration for clan chat",
position = 20
)
String clanChatSection = "clanChat";
@ConfigSection(
name = "Guest Clan Chat",
description = "Configuration for guest clan chat",
position = 30
)
String guestClanChatSection = "guestClanChat";
@ConfigItem(
keyName = "joinLeaveTimeout",
name = "Join/Leave timeout",
description = "Set the timeout duration of join/leave messages. A value of 0 will make the messages permanent.",
position = 0
)
default int joinLeaveTimeout()
{
return 20;
}
@ConfigItem(
keyName = "clanChatIcons",
name = "Chat Icons",
description = "Show rank icons next to friends chat members.",
position = 1
position = 1,
section = friendsChatSection
)
default boolean chatIcons()
{
@@ -48,7 +84,8 @@ public interface FriendsChatConfig extends Config
keyName = "recentChats",
name = "Recent Chats",
description = "Show recent friends chats.",
position = 2
position = 2,
section = friendsChatSection
)
default boolean recentChats()
{
@@ -59,7 +96,8 @@ public interface FriendsChatConfig extends Config
keyName = "clanCounter",
name = "Members Counter",
description = "Show the amount of friends chat members near you.",
position = 3
position = 3,
section = friendsChatSection
)
default boolean showCounter()
{
@@ -88,7 +126,8 @@ public interface FriendsChatConfig extends Config
keyName = "showJoinLeave",
name = "Show Join/Leave",
description = "Adds a temporary message notifying when a member joins or leaves.",
position = 4
position = 4,
section = friendsChatSection
)
default boolean showJoinLeave()
{
@@ -99,29 +138,20 @@ public interface FriendsChatConfig extends Config
keyName = "joinLeaveRank",
name = "Join/Leave rank",
description = "Only show join/leave messages for members at or above this rank.",
position = 5
position = 5,
section = friendsChatSection
)
default FriendsChatRank joinLeaveRank()
{
return FriendsChatRank.UNRANKED;
}
@ConfigItem(
keyName = "joinLeaveTimeout",
name = "Join/Leave timeout",
description = "Set the timeout duration of join/leave messages. A value of 0 will make the messages permanent.",
position = 6
)
default int joinLeaveTimeout()
{
return 20;
}
@ConfigItem(
keyName = "privateMessageIcons",
name = "Private Message Icons",
description = "Add rank icons to private messages received from members.",
position = 7
position = 7,
section = friendsChatSection
)
default boolean privateMessageIcons()
{
@@ -132,7 +162,8 @@ public interface FriendsChatConfig extends Config
keyName = "publicChatIcons",
name = "Public Chat Icons",
description = "Add rank icons to public chat messages from members.",
position = 8
position = 8,
section = friendsChatSection
)
default boolean publicChatIcons()
{
@@ -143,7 +174,8 @@ public interface FriendsChatConfig extends Config
keyName = "confirmKicks",
name = "Confirm Kicks",
description = "Shows a chat prompt to confirm kicks",
position = 10
position = 10,
section = friendsChatSection
)
default boolean confirmKicks()
{
@@ -154,7 +186,8 @@ public interface FriendsChatConfig extends Config
keyName = "showIgnores",
name = "Recolor ignored players",
description = "Recolor members who are on your ignore list",
position = 11
position = 11,
section = friendsChatSection
)
default boolean showIgnores()
{
@@ -165,10 +198,35 @@ public interface FriendsChatConfig extends Config
keyName = "showIgnoresColor",
name = "Ignored color",
description = "Allows you to change the color of the ignored players in your friends chat",
position = 12
position = 12,
section = friendsChatSection
)
default Color showIgnoresColor()
{
return Color.RED;
}
@ConfigItem(
keyName = "clanChatShowJoinLeave",
name = "Show Join/Leave",
description = "Adds a temporary message notifying when a member joins or leaves.",
position = 0,
section = clanChatSection
)
default boolean clanChatShowJoinLeave()
{
return false;
}
@ConfigItem(
keyName = "guestClanChatShowJoinLeave",
name = "Show Join/Leave",
description = "Adds a temporary message notifying when a member joins or leaves.",
position = 0,
section = guestClanChatSection
)
default boolean guestClanChatShowJoinLeave()
{
return false;
}
}

View File

@@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.friendschat;
package net.runelite.client.plugins.chatchannel;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
@@ -36,13 +36,15 @@ import java.awt.image.BufferedImage;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import lombok.AllArgsConstructor;
import net.runelite.api.ChatLineBuffer;
import net.runelite.api.ChatMessageType;
import net.runelite.api.ChatPlayer;
import net.runelite.api.Client;
import net.runelite.api.FriendsChatManager;
import net.runelite.api.FriendsChatMember;
@@ -56,7 +58,14 @@ import net.runelite.api.ScriptID;
import net.runelite.api.SpriteID;
import net.runelite.api.VarClientStr;
import net.runelite.api.Varbits;
import net.runelite.api.clan.ClanChannel;
import net.runelite.api.clan.ClanChannelMember;
import net.runelite.api.clan.ClanRank;
import net.runelite.api.clan.ClanSettings;
import net.runelite.api.clan.ClanTitle;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ClanMemberJoined;
import net.runelite.api.events.ClanMemberLeft;
import net.runelite.api.events.FriendsChatChanged;
import net.runelite.api.events.FriendsChatMemberJoined;
import net.runelite.api.events.FriendsChatMemberLeft;
@@ -72,6 +81,8 @@ import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetType;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@@ -89,11 +100,11 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.client.util.Text;
@PluginDescriptor(
name = "Friends Chat",
description = "Add rank icons to users talking in friends chat",
tags = {"icons", "rank", "recent", "clan"}
name = "Chat Channels",
description = "Improvements for friends chat and clan chat.",
tags = {"icons", "rank", "recent", "clan", "friend", "channel"}
)
public class FriendsChatPlugin extends Plugin
public class ChatChannelPlugin extends Plugin
{
private static final int MAX_CHATS = 10;
private static final String RECENT_TITLE = "Recent FCs";
@@ -106,7 +117,7 @@ public class FriendsChatPlugin extends Plugin
private ChatIconManager chatIconManager;
@Inject
private FriendsChatConfig config;
private ChatChannelConfig config;
@Inject
private InfoBoxManager infoBoxManager;
@@ -123,22 +134,40 @@ public class FriendsChatPlugin extends Plugin
@Inject
private ChatColorConfig chatColorConfig;
private List<String> chats = new ArrayList<>();
@Inject
private ChatMessageManager chatMessageManager;
private List<String> chats;
private final List<Player> members = new ArrayList<>();
private MembersIndicator membersIndicator;
/**
* queue of temporary messages added to the client
*/
private final Deque<MemberJoinMessage> joinMessages = new ArrayDeque<>();
private final Map<String, MemberActivity> activityBuffer = new HashMap<>();
private final Map<ChatPlayer, MemberActivity> activityBuffer = new LinkedHashMap<>();
private int joinedTick;
private boolean kickConfirmed = false;
@Provides
FriendsChatConfig getConfig(ConfigManager configManager)
private boolean inputWarning;
@AllArgsConstructor
private enum InputMode
{
return configManager.getConfig(FriendsChatConfig.class);
FRIEND("Friends Chat", ChatMessageType.FRIENDSCHAT),
CLAN("Clan Chat", ChatMessageType.CLAN_CHAT),
GUEST("Guest Clan Chat", ChatMessageType.CLAN_GUEST_CHAT);
private final String prompt;
private final ChatMessageType chatMessageType;
}
private InputMode inputMode;
@Provides
ChatChannelConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(ChatChannelConfig.class);
}
@Override
@@ -155,16 +184,18 @@ public class FriendsChatPlugin extends Plugin
@Override
public void shutDown()
{
chats = null;
clientThread.invoke(() -> colorIgnoredPlayers(Color.WHITE));
members.clear();
resetCounter();
rebuildFriendsChat();
inputMode = null;
}
@Subscribe
public void onConfigChanged(ConfigChanged configChanged)
{
if (configChanged.getGroup().equals("clanchat"))
if (configChanged.getGroup().equals(ChatChannelConfig.GROUP))
{
if (!config.recentChats())
{
@@ -219,16 +250,7 @@ public class FriendsChatPlugin extends Plugin
}
// attempt to filter out world hopping joins
if (!activityBuffer.containsKey(member.getName()))
{
MemberActivity joinActivity = new MemberActivity(ActivityType.JOINED,
member, client.getTickCount());
activityBuffer.put(member.getName(), joinActivity);
}
else
{
activityBuffer.remove(member.getName());
}
queueJoin(member, MemberActivity.ChatType.FRIENDS_CHAT);
}
@Subscribe
@@ -263,15 +285,75 @@ public class FriendsChatPlugin extends Plugin
return;
}
if (!activityBuffer.containsKey(member.getName()))
queueLeave(member, MemberActivity.ChatType.FRIENDS_CHAT);
}
@Subscribe
public void onClanMemberJoined(ClanMemberJoined clanMemberJoined)
{
MemberActivity.ChatType chatType = clanChannelToChatType(clanMemberJoined.getClanChannel());
if (chatType != null && clanChannelJoinLeaveEnabled(chatType))
{
MemberActivity leaveActivity = new MemberActivity(ActivityType.LEFT,
queueJoin(clanMemberJoined.getClanMember(), chatType);
}
}
@Subscribe
public void onClanMemberLeft(ClanMemberLeft clanMemberLeft)
{
MemberActivity.ChatType chatType = clanChannelToChatType(clanMemberLeft.getClanChannel());
if (chatType != null && clanChannelJoinLeaveEnabled(chatType))
{
queueLeave(clanMemberLeft.getClanMember(), chatType);
}
}
private MemberActivity.ChatType clanChannelToChatType(ClanChannel clanChannel)
{
return clanChannel == client.getClanChannel() ? MemberActivity.ChatType.CLAN_CHAT :
clanChannel == client.getGuestClanChannel() ? MemberActivity.ChatType.GUEST_CHAT :
null;
}
private boolean clanChannelJoinLeaveEnabled(MemberActivity.ChatType chatType)
{
switch (chatType)
{
case CLAN_CHAT:
return config.clanChatShowJoinLeave();
case GUEST_CHAT:
return config.guestClanChatShowJoinLeave();
default:
return false;
}
}
private void queueJoin(ChatPlayer member, MemberActivity.ChatType chatType)
{
// attempt to filter out world hopping joins
if (!activityBuffer.containsKey(member))
{
MemberActivity joinActivity = new MemberActivity(ActivityType.JOINED, chatType,
member, client.getTickCount());
activityBuffer.put(member.getName(), leaveActivity);
activityBuffer.put(member, joinActivity);
}
else
{
activityBuffer.remove(member.getName());
activityBuffer.remove(member);
}
}
private void queueLeave(ChatPlayer member, MemberActivity.ChatType chatType)
{
if (!activityBuffer.containsKey(member))
{
MemberActivity leaveActivity = new MemberActivity(ActivityType.LEFT, chatType,
member, client.getTickCount());
activityBuffer.put(member, leaveActivity);
}
else
{
activityBuffer.remove(member);
}
}
@@ -334,7 +416,7 @@ public class FriendsChatPlugin extends Plugin
// If this message has been reused since, it will get a different id
if (joinMessage.getGetMessageId() == messageNode.getId())
{
ChatLineBuffer ccInfoBuffer = client.getChatLineMap().get(ChatMessageType.FRIENDSCHATNOTIFICATION.getType());
ChatLineBuffer ccInfoBuffer = client.getChatLineMap().get(messageNode.getType().getType());
if (ccInfoBuffer != null)
{
ccInfoBuffer.removeMessageNode(messageNode);
@@ -357,8 +439,7 @@ public class FriendsChatPlugin extends Plugin
private void addActivityMessages()
{
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
if (friendsChatManager == null || activityBuffer.isEmpty())
if (activityBuffer.isEmpty())
{
return;
}
@@ -372,13 +453,28 @@ public class FriendsChatPlugin extends Plugin
if (activity.getTick() < client.getTickCount() - MESSAGE_DELAY)
{
activityIt.remove();
addActivityMessage(friendsChatManager, activity.getMember(), activity.getActivityType());
switch (activity.getChatType())
{
case FRIENDS_CHAT:
addActivityMessage((FriendsChatMember) activity.getMember(), activity.getActivityType());
break;
case CLAN_CHAT:
case GUEST_CHAT:
addClanActivityMessage((ClanChannelMember) activity.getMember(), activity.getActivityType(), activity.getChatType());
break;
}
}
}
}
private void addActivityMessage(FriendsChatManager friendsChatManager, FriendsChatMember member, ActivityType activityType)
private void addActivityMessage(FriendsChatMember member, ActivityType activityType)
{
final FriendsChatManager friendsChatManager = client.getFriendsChatManager();
if (friendsChatManager == null)
{
return;
}
final String activityMessage = activityType == ActivityType.JOINED ? " has joined." : " has left.";
final FriendsChatRank rank = member.getRank();
final Color textColor, channelColor;
@@ -421,6 +517,55 @@ public class FriendsChatPlugin extends Plugin
joinMessages.addLast(joinMessage);
}
private void addClanActivityMessage(ClanChannelMember member, ActivityType activityType, MemberActivity.ChatType chatType)
{
ClanSettings clanSettings = chatType == MemberActivity.ChatType.CLAN_CHAT ? client.getClanSettings() : client.getGuestClanSettings();
ClanRank rank = member.getRank();
if (rank == null || clanSettings == null)
{
return;
}
ClanTitle clanTitle = clanSettings.titleForRank(rank);
int rankIcon = -1;
if (clanTitle != null)
{
// Clan ranks are always included in chat messages, so we'll just always include it in join messages.
rankIcon = chatIconManager.getIconNumber(clanTitle);
}
final Color textColor;
// Use configured clan chat info colors if set, otherwise default to the jagex text and fc name colors
if (client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1)
{
textColor = MoreObjects.firstNonNull(
chatType == MemberActivity.ChatType.CLAN_CHAT ? chatColorConfig.transparentClanChatInfo() : chatColorConfig.transparentClanChatGuestInfo(),
CHAT_FC_TEXT_TRANSPARENT_BACKGROUND);
}
else
{
textColor = MoreObjects.firstNonNull(
chatType == MemberActivity.ChatType.CLAN_CHAT ? chatColorConfig.opaqueClanChatInfo() : chatColorConfig.opaqueClanChatGuestInfo(),
CHAT_FC_TEXT_OPAQUE_BACKGROUND);
}
ChatMessageBuilder message = new ChatMessageBuilder();
if (rankIcon > -1)
{
message.img(rankIcon);
}
message.append(textColor, member.getName() + (activityType == ActivityType.JOINED ? " has joined." : " has left."));
final String messageString = message.build();
final MessageNode line = client.addChatMessage(
chatType == MemberActivity.ChatType.CLAN_CHAT ? ChatMessageType.CLAN_MESSAGE : ChatMessageType.CLAN_GUEST_MESSAGE,
"", messageString, "");
MemberJoinMessage joinMessage = new MemberJoinMessage(line, line.getId(), client.getTickCount());
joinMessages.addLast(joinMessage);
}
@Subscribe
public void onVarClientStrChanged(VarClientStrChanged strChanged)
{
@@ -551,6 +696,67 @@ public class FriendsChatPlugin extends Plugin
clientThread.invokeLater(() -> confirmKickPlayer(kickPlayerName));
break;
}
case "preChatSendpublic":
{
final String chatboxInput = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT);
switch (chatboxInput)
{
case "/p":
switchTypingMode(null);
break;
case "/f":
switchTypingMode(InputMode.FRIEND);
break;
case "/c":
switchTypingMode(InputMode.CLAN);
break;
case "/g":
switchTypingMode(InputMode.GUEST);
break;
default:
if (inputMode != null)
{
final int[] intStack = client.getIntStack();
final int intStackSize = client.getIntStackSize();
intStack[intStackSize - 1] = inputMode.chatMessageType.getType(); // chat message type
intStack[intStackSize - 2] = 0; // prefix length
}
break;
}
break;
}
case "setChatboxInput":
{
Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT);
if (chatboxInput != null && inputMode != null)
{
String text = chatboxInput.getText();
int idx = text.indexOf(": ");
if (idx != -1)
{
String newText = inputMode.prompt + ": " + text.substring(idx + 2);
chatboxInput.setText(newText);
}
}
break;
}
}
}
private void switchTypingMode(InputMode mode)
{
inputMode = mode;
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, "");
if (mode != null && !inputWarning)
{
inputWarning = true;
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.CONSOLE)
.runeLiteFormattedMessage("You've entered " + inputMode.prompt + " typing mode. All typed messages will be sent to your " +
inputMode.prompt.toLowerCase() + ". Use /p to reset to public chat.")
.build());
}
}

View File

@@ -22,17 +22,25 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.friendschat;
package net.runelite.client.plugins.chatchannel;
import lombok.AllArgsConstructor;
import lombok.Value;
import net.runelite.api.FriendsChatMember;
import net.runelite.api.ChatPlayer;
@Value
@AllArgsConstructor
class MemberActivity
{
enum ChatType
{
FRIENDS_CHAT,
CLAN_CHAT,
GUEST_CHAT
}
private ActivityType activityType;
private FriendsChatMember member;
private ChatType chatType;
private ChatPlayer member;
private Integer tick;
}

View File

@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.friendschat;
package net.runelite.client.plugins.chatchannel;
import lombok.Value;
import net.runelite.api.MessageNode;

View File

@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.friendschat;
package net.runelite.client.plugins.chatchannel;
import java.awt.Color;
import java.awt.image.BufferedImage;
@@ -30,9 +30,9 @@ import net.runelite.client.ui.overlay.infobox.Counter;
class MembersIndicator extends Counter
{
private final FriendsChatPlugin plugin;
private final ChatChannelPlugin plugin;
MembersIndicator(BufferedImage image, FriendsChatPlugin plugin)
MembersIndicator(BufferedImage image, ChatChannelPlugin plugin)
{
super(image, plugin, plugin.getMembersSize());
this.plugin = plugin;

View File

@@ -110,11 +110,22 @@ public interface ChatFilterConfig extends Config
return false;
}
@ConfigItem(
keyName = "filterClanChat",
name = "Filter clan Chat Members",
description = "Filter your clan chat members' messages",
position = 7
)
default boolean filterClanChat()
{
return false;
}
@ConfigItem(
keyName = "filterLogin",
name = "Filter Logged In/Out Messages",
description = "Filter your private chat to remove logged in/out messages",
position = 7
position = 8
)
default boolean filterLogin()
{
@@ -125,7 +136,7 @@ public interface ChatFilterConfig extends Config
keyName = "filterGameChat",
name = "Filter Game Chat",
description = "Filter your game chat messages",
position = 8
position = 9
)
default boolean filterGameChat()
{
@@ -136,7 +147,7 @@ public interface ChatFilterConfig extends Config
keyName = "collapseGameChat",
name = "Collapse Game Chat",
description = "Collapse duplicate game chat messages into a single line",
position = 9
position = 10
)
default boolean collapseGameChat()
{
@@ -147,7 +158,7 @@ public interface ChatFilterConfig extends Config
keyName = "collapsePlayerChat",
name = "Collapse Player Chat",
description = "Collapse duplicate player chat messages into a single line",
position = 10
position = 11
)
default boolean collapsePlayerChat()
{
@@ -158,7 +169,7 @@ public interface ChatFilterConfig extends Config
keyName = "maxRepeatedPublicChats",
name = "Repeat filter",
description = "Block player chat message if repeated this many times. 0 is off",
position = 11
position = 12
)
default int maxRepeatedPublicChats()
{

View File

@@ -53,6 +53,7 @@ import net.runelite.api.Client;
import net.runelite.api.FriendsChatManager;
import net.runelite.api.MessageNode;
import net.runelite.api.Player;
import net.runelite.api.clan.ClanChannel;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.OverheadTextChanged;
import net.runelite.api.events.ScriptCallbackEvent;
@@ -170,6 +171,8 @@ public class ChatFilterPlugin extends Plugin
case PRIVATECHAT:
case MODPRIVATECHAT:
case FRIENDSCHAT:
case CLAN_CHAT:
case CLAN_GUEST_CHAT:
if (shouldFilterPlayerMessage(Text.removeTags(name)))
{
message = censorMessage(name, message);
@@ -271,7 +274,8 @@ public class ChatFilterPlugin extends Plugin
boolean isMessageFromSelf = playerName.equals(client.getLocalPlayer().getName());
return !isMessageFromSelf &&
(config.filterFriends() || !client.isFriended(playerName, false)) &&
(config.filterFriendsChat() || !isFriendsChatMember(playerName));
(config.filterFriendsChat() || !isFriendsChatMember(playerName)) &&
(config.filterClanChat() || !isClanChatMember(playerName));
}
private boolean isFriendsChatMember(String name)
@@ -280,6 +284,23 @@ public class ChatFilterPlugin extends Plugin
return friendsChatManager != null && friendsChatManager.findByName(name) != null;
}
private boolean isClanChatMember(String name)
{
ClanChannel clanChannel = client.getClanChannel();
if (clanChannel != null && clanChannel.findMember(name) != null)
{
return true;
}
clanChannel = client.getGuestClanChannel();
if (clanChannel != null && clanChannel.findMember(name) != null)
{
return true;
}
return false;
}
String censorMessage(final String username, final String message)
{
String strippedMessage = jagexPrintableCharMatcher.retainFrom(message)

View File

@@ -209,6 +209,8 @@ public class ChatNotificationsPlugin extends Plugin
case MODCHAT:
case PUBLICCHAT:
case FRIENDSCHAT:
case CLAN_CHAT:
case CLAN_GUEST_CHAT:
case AUTOTYPER:
case MODAUTOTYPER:
if (client.getLocalPlayer() != null && Text.toJagexName(Text.removeTags(chatMessage.getName())).equals(client.getLocalPlayer().getName()))
@@ -250,7 +252,9 @@ public class ChatNotificationsPlugin extends Plugin
|| chatMessage.getType() == ChatMessageType.PRIVATECHAT
|| chatMessage.getType() == ChatMessageType.FRIENDSCHAT
|| chatMessage.getType() == ChatMessageType.MODCHAT
|| chatMessage.getType() == ChatMessageType.MODPRIVATECHAT))
|| chatMessage.getType() == ChatMessageType.MODPRIVATECHAT
|| chatMessage.getType() == ChatMessageType.CLAN_CHAT
|| chatMessage.getType() == ChatMessageType.CLAN_GUEST_CHAT))
{
sendNotification(chatMessage);
}

View File

@@ -124,6 +124,8 @@ public class EmojiPlugin extends Plugin
case PUBLICCHAT:
case MODCHAT:
case FRIENDSCHAT:
case CLAN_CHAT:
case CLAN_GUEST_CHAT:
case PRIVATECHAT:
case PRIVATECHATOUT:
case MODPRIVATECHAT:

View File

@@ -342,8 +342,7 @@ public class FriendNotesPlugin extends Plugin
switch (event.getEventName())
{
case "friend_cc_settext":
case "ignore_cc_settext":
case "friendsChatSetText":
String[] stringStack = client.getStringStack();
int stringStackSize = client.getStringStackSize();
final String rsn = stringStack[stringStackSize - 1];
@@ -354,8 +353,7 @@ public class FriendNotesPlugin extends Plugin
stringStack[stringStackSize - 1] = rsn + " <img=" + iconIdx + ">";
}
break;
case "friend_cc_setposition":
case "ignore_cc_setposition":
case "friendsChatSetPosition":
if (currentlyLayouting == null || getFriendNote(currentlyLayouting) == null)
{
return;

View File

@@ -95,7 +95,7 @@ public interface PlayerIndicatorsConfig extends Config
description = "Configures if friends chat members should be highlighted",
section = highlightSection
)
default boolean drawFriendsChatMemberNames()
default boolean highlightFriendsChat()
{
return true;
}
@@ -138,6 +138,30 @@ public interface PlayerIndicatorsConfig extends Config
@ConfigItem(
position = 8,
keyName = "drawClanChatMemberNames",
name = "Highlight clan members",
description = "Configures whether or not clan members should be highlighted",
section = highlightSection
)
default boolean highlightClanMembers()
{
return true;
}
@ConfigItem(
position = 9,
keyName = "clanChatMemberColor",
name = "Clan member",
description = "Color of clan members",
section = highlightSection
)
default Color getClanMemberColor()
{
return new Color(36, 15, 171);
}
@ConfigItem(
position = 10,
keyName = "drawNonClanMemberNames",
name = "Highlight others",
description = "Configures whether or not other players should be highlighted",
@@ -149,7 +173,7 @@ public interface PlayerIndicatorsConfig extends Config
}
@ConfigItem(
position = 9,
position = 11,
keyName = "nonClanMemberColor",
name = "Others",
description = "Color of other players names",
@@ -214,4 +238,15 @@ public interface PlayerIndicatorsConfig extends Config
{
return true;
}
@ConfigItem(
position = 15,
keyName = "clanchatMenuIcons",
name = "Show clan chat ranks",
description = "Add clan chat rank to right click menu and next to player names"
)
default boolean showClanChatRanks()
{
return true;
}
}

View File

@@ -34,6 +34,7 @@ import javax.inject.Singleton;
import net.runelite.api.FriendsChatRank;
import net.runelite.api.Player;
import net.runelite.api.Point;
import net.runelite.api.clan.ClanTitle;
import net.runelite.client.game.ChatIconManager;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
@@ -108,40 +109,49 @@ public class PlayerIndicatorsOverlay extends Overlay
return;
}
if (actor.isFriendsChatMember() && config.showFriendsChatRanks())
BufferedImage rankImage = null;
if (actor.isFriendsChatMember() && config.highlightFriendsChat() && config.showFriendsChatRanks())
{
final FriendsChatRank rank = playerIndicatorsService.getFriendsChatRank(actor);
if (rank != FriendsChatRank.UNRANKED)
{
final BufferedImage rankImage = chatIconManager.getRankImage(rank);
if (rankImage != null)
{
final int imageWidth = rankImage.getWidth();
final int imageTextMargin;
final int imageNegativeMargin;
if (drawPlayerNamesConfig == PlayerNameLocation.MODEL_RIGHT)
{
imageTextMargin = imageWidth;
imageNegativeMargin = 0;
}
else
{
imageTextMargin = imageWidth / 2;
imageNegativeMargin = imageWidth / 2;
}
final int textHeight = graphics.getFontMetrics().getHeight() - graphics.getFontMetrics().getMaxDescent();
final Point imageLocation = new Point(textLocation.getX() - imageNegativeMargin - 1, textLocation.getY() - textHeight / 2 - rankImage.getHeight() / 2);
OverlayUtil.renderImageLocation(graphics, imageLocation, rankImage);
// move text
textLocation = new Point(textLocation.getX() + imageTextMargin, textLocation.getY());
}
rankImage = chatIconManager.getRankImage(rank);
}
}
else if (actor.isClanMember() && config.highlightClanMembers() && config.showClanChatRanks())
{
ClanTitle clanTitle = playerIndicatorsService.getClanTitle(actor);
if (clanTitle != null)
{
rankImage = chatIconManager.getRankImage(clanTitle);
}
}
if (rankImage != null)
{
final int imageWidth = rankImage.getWidth();
final int imageTextMargin;
final int imageNegativeMargin;
if (drawPlayerNamesConfig == PlayerNameLocation.MODEL_RIGHT)
{
imageTextMargin = imageWidth;
imageNegativeMargin = 0;
}
else
{
imageTextMargin = imageWidth / 2;
imageNegativeMargin = imageWidth / 2;
}
final int textHeight = graphics.getFontMetrics().getHeight() - graphics.getFontMetrics().getMaxDescent();
final Point imageLocation = new Point(textLocation.getX() - imageNegativeMargin - 1, textLocation.getY() - textHeight / 2 - rankImage.getHeight() / 2);
OverlayUtil.renderImageLocation(graphics, imageLocation, rankImage);
// move text
textLocation = new Point(textLocation.getX() + imageTextMargin, textLocation.getY());
}
OverlayUtil.renderTextLocation(graphics, textLocation, name, color);
}

View File

@@ -46,6 +46,7 @@ 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.Player;
import net.runelite.api.clan.ClanTitle;
import net.runelite.api.events.ClientTick;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@@ -189,11 +190,11 @@ public class PlayerIndicatorsPlugin extends Plugin
int image = -1;
Color color = null;
if (config.highlightFriends() && player.isFriend())
if (player.isFriend() && config.highlightFriends())
{
color = config.getFriendColor();
}
else if (config.drawFriendsChatMemberNames() && player.isFriendsChatMember())
else if (player.isFriendsChatMember() && config.highlightFriendsChat())
{
color = config.getFriendsChatMemberColor();
@@ -206,12 +207,24 @@ public class PlayerIndicatorsPlugin extends Plugin
}
}
}
else if (config.highlightTeamMembers()
&& player.getTeam() > 0 && client.getLocalPlayer().getTeam() == player.getTeam())
else if (player.getTeam() > 0 && client.getLocalPlayer().getTeam() == player.getTeam() && config.highlightTeamMembers())
{
color = config.getTeamMemberColor();
}
else if (config.highlightOthers() && !player.isFriendsChatMember())
else if (player.isClanMember() && config.highlightClanMembers())
{
color = config.getClanMemberColor();
if (config.showClanChatRanks())
{
ClanTitle clanTitle = playerIndicatorsService.getClanTitle(player);
if (clanTitle != null)
{
image = chatIconManager.getIconNumber(clanTitle);
}
}
}
else if (!player.isFriendsChatMember() && !player.isClanMember() && config.highlightOthers())
{
color = config.getOthersColor();
}

View File

@@ -33,6 +33,11 @@ import net.runelite.api.FriendsChatManager;
import net.runelite.api.FriendsChatMember;
import net.runelite.api.FriendsChatRank;
import net.runelite.api.Player;
import net.runelite.api.clan.ClanChannel;
import net.runelite.api.clan.ClanChannelMember;
import net.runelite.api.clan.ClanRank;
import net.runelite.api.clan.ClanSettings;
import net.runelite.api.clan.ClanTitle;
@Singleton
public class PlayerIndicatorsService
@@ -49,8 +54,9 @@ public class PlayerIndicatorsService
public void forEachPlayer(final BiConsumer<Player, Color> consumer)
{
if (!config.highlightOwnPlayer() && !config.drawFriendsChatMemberNames()
&& !config.highlightFriends() && !config.highlightOthers())
if (!config.highlightOwnPlayer() && !config.highlightFriendsChat()
&& !config.highlightFriends() && !config.highlightOthers()
&& !config.highlightClanMembers())
{
return;
}
@@ -65,6 +71,7 @@ public class PlayerIndicatorsService
}
boolean isFriendsChatMember = player.isFriendsChatMember();
boolean isClanMember = player.isClanMember();
if (player == localPlayer)
{
@@ -77,7 +84,7 @@ public class PlayerIndicatorsService
{
consumer.accept(player, config.getFriendColor());
}
else if (config.drawFriendsChatMemberNames() && isFriendsChatMember)
else if (config.highlightFriendsChat() && isFriendsChatMember)
{
consumer.accept(player, config.getFriendsChatMemberColor());
}
@@ -85,13 +92,36 @@ public class PlayerIndicatorsService
{
consumer.accept(player, config.getTeamMemberColor());
}
else if (config.highlightOthers() && !isFriendsChatMember)
else if (config.highlightClanMembers() && isClanMember)
{
consumer.accept(player, config.getClanMemberColor());
}
else if (config.highlightOthers() && !isFriendsChatMember && !isClanMember)
{
consumer.accept(player, config.getOthersColor());
}
}
}
ClanTitle getClanTitle(Player player)
{
ClanChannel clanChannel = client.getClanChannel();
ClanSettings clanSettings = client.getClanSettings();
if (clanChannel == null || clanSettings == null)
{
return null;
}
ClanChannelMember member = clanChannel.findMember(player.getName());
if (member == null)
{
return null;
}
ClanRank rank = member.getRank();
return clanSettings.titleForRank(rank);
}
FriendsChatRank getFriendsChatRank(Player player)
{
final FriendsChatManager friendsChatManager = client.getFriendsChatManager();

View File

@@ -36,7 +36,9 @@ import javax.inject.Inject;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.MessageNode;
import net.runelite.api.ScriptID;
import net.runelite.api.Varbits;
import net.runelite.api.events.ScriptPreFired;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.client.config.ConfigManager;
@@ -62,6 +64,8 @@ public class TimestampPlugin extends Plugin
@Getter
private SimpleDateFormat formatter;
private MessageNode currentlyBuildingMessage = null;
@Provides
public TimestampConfig provideConfig(final ConfigManager configManager)
{
@@ -90,32 +94,59 @@ public class TimestampPlugin extends Plugin
}
@Subscribe
public void onScriptCallbackEvent(ScriptCallbackEvent event)
private void onScriptCallbackEvent(ScriptCallbackEvent event)
{
if (!event.getEventName().equals("addTimestamp"))
if (!"chatMessageBuilding".equals(event.getEventName()))
{
return;
}
int[] intStack = client.getIntStack();
int intStackSize = client.getIntStackSize();
int uid = client.getIntStack()[client.getIntStackSize() - 1];
currentlyBuildingMessage = client.getMessages().get(uid);
}
@Subscribe
private void onScriptPreFired(ScriptPreFired ev)
{
int numStringArgs;
int messagePrefixArg = 0;
switch (ev.getScriptId())
{
case ScriptID.CHATBOX_BUILD_LINE_WITHOUT_USER:
numStringArgs = 1;
break;
case ScriptID.CHATBOX_BUILD_LINE_WITH_USER:
numStringArgs = 2;
break;
case ScriptID.CHATBOX_BUILD_LINE_WITH_CLAN:
numStringArgs = 3;
break;
default:
return;
}
if (currentlyBuildingMessage == null)
{
return;
}
MessageNode messageNode = currentlyBuildingMessage;
currentlyBuildingMessage = null;
String[] stringStack = client.getStringStack();
int stringStackSize = client.getStringStackSize();
int messageId = intStack[intStackSize - 1];
MessageNode messageNode = client.getMessages().get(messageId);
int stringArgStart = client.getStringStackSize() - numStringArgs;
String timestamp = generateTimestamp(messageNode.getTimestamp(), ZoneId.systemDefault()) + " ";
Color timestampColour = getTimestampColour();
if (timestampColour != null)
{
timestamp = ColorUtil.wrapWithColorTag(timestamp, timestampColour);
}
stringStack[stringStackSize - 1] = timestamp;
String segment = stringStack[stringArgStart + messagePrefixArg];
segment = timestamp + segment;
stringStack[stringArgStart + messagePrefixArg] = segment;
}
private Color getTimestampColour()

View File

@@ -56,6 +56,8 @@ import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.NameableContainer;
import net.runelite.api.Varbits;
import net.runelite.api.clan.ClanChannel;
import net.runelite.api.clan.ClanChannelMember;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
@@ -353,10 +355,12 @@ public class WorldHopperPlugin extends Plugin
return;
}
int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
final int componentId = event.getActionParam1();
int groupId = WidgetInfo.TO_GROUP(componentId);
String option = event.getOption();
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.FRIENDS_CHAT.getGroupId())
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.FRIENDS_CHAT.getGroupId()
|| componentId == WidgetInfo.CLAN_MEMBER_LIST.getId() || componentId == WidgetInfo.CLAN_GUEST_MEMBER_LIST.getId())
{
boolean after;
@@ -744,6 +748,26 @@ public class WorldHopperPlugin extends Plugin
}
}
ClanChannel clanChannel = client.getClanChannel();
if (clanChannel != null)
{
ClanChannelMember member = clanChannel.findMember(cleanName);
if (member != null)
{
return member;
}
}
clanChannel = client.getGuestClanChannel();
if (clanChannel != null)
{
ClanChannelMember member = clanChannel.findMember(cleanName);
if (member != null)
{
return member;
}
}
NameableContainer<Friend> friendContainer = client.getFriendContainer();
if (friendContainer != null)
{