Example #1
0
        //Blank out chats containing specific match
        public static void HideChats(string Match)
        {
            SleekChat[]         x = (SleekChat[])chatHist.GetValue(null);
            SleekChat[]         y = (SleekChat[])chatPreviews.GetValue(null);
            ReceivedChatMessage p = new ReceivedChatMessage(null, null, EChatMode.GLOBAL, Color.white, false, "");

            for (int uhwhy = 0; uhwhy < ChatManager.receivedChatHistory.Count; uhwhy++)
            {
                if (ChatManager.receivedChatHistory[uhwhy].contents.Contains(Match))
                {
                    ChatManager.receivedChatHistory[uhwhy] = p;
                }
            }
            for (int uhwhy = 0; uhwhy < y.Length; uhwhy++)
            {
                if (y[uhwhy].representingChatMessage.contents.Contains(Match))
                {
                    y[uhwhy].representingChatMessage = p;
                }
            }
            for (int uhwhy = 0; uhwhy < x.Length; uhwhy++)
            {
                if (x[uhwhy].representingChatMessage.contents.Contains(Match))
                {
                    x[uhwhy].representingChatMessage = p;
                }
            }
        }
        public static void OV_receiveChatMessage(CSteamID speakerSteamID, string iconURL, EChatMode mode, Color color, bool isRich, string text)
        {
            G.Settings.Mute.TryGetValue(speakerSteamID.m_SteamID, out Mute MuteState);
            if (MuteState == Mute.All)
            {
                return;
            }
            if (MuteState == Mute.Global && mode == EChatMode.GLOBAL)
            {
                return;
            }
            if (MuteState == Mute.Area && mode == EChatMode.LOCAL)
            {
                return;
            }
            if (MuteState == Mute.Group && mode == EChatMode.GROUP)
            {
                return;
            }
            text = text.Trim();
            ControlsSettings.formatPluginHotkeysIntoText(ref text);
            if (OptionsSettings.streamer)
            {
                color = Color.white;
            }
            SteamPlayer speaker;

            if (speakerSteamID == CSteamID.Nil)
            {
                speaker = null;
            }
            else
            {
                if (!OptionsSettings.chatText && speakerSteamID != Provider.client)
                {
                    return;
                }
                speaker = PlayerTool.getSteamPlayer(speakerSteamID);
            }
            ReceivedChatMessage item = new ReceivedChatMessage(speaker, iconURL, mode, color, isRich, text);

            ChatManager.receivedChatHistory.Insert(0, item);
            if (ChatManager.receivedChatHistory.Count > Provider.preferenceData.Chat.History_Length)
            {
                ChatManager.receivedChatHistory.RemoveAt(ChatManager.receivedChatHistory.Count - 1);
            }
            if (ChatManager.onChatMessageReceived != null)
            {
                ChatManager.onChatMessageReceived();
            }
        }
Example #3
0
    private void onChatMessageReceived(GameServerEvent evt, object data)
    {
        ReceivedChatMessage receivedChatMessage = (ReceivedChatMessage)data;

        Service.Get <EventDispatcher>().DispatchEvent(new ChatServiceEvents.ChatMessageReceived(receivedChatMessage.senderSessionId, receivedChatMessage.message, receivedChatMessage.emotion));
    }