Esempio n. 1
0
        //

        void Chat(Fougerite.Player p, ref ChatString text)
        {
        }
Esempio n. 2
0
        public static void ChatReceived(ref ConsoleSystem.Arg arg)
        {
            if (!chat.enabled)
            {
                return;
            }

            if (arg == null)
            {
                return;
            }

            var quotedName    = Facepunch.Utility.String.QuoteSafe(arg.argUser.displayName);
            var quotedMessage = Facepunch.Utility.String.QuoteSafe(arg.GetString(0, "text"));

            if (OnChatRaw != null)
            {
                OnChatRaw(ref arg);
            }

            if (arg == null)
            {
                return;
            }

            if (quotedMessage.Trim('"').StartsWith("/"))
            {
                Logger.LogDebug("[CHAT-CMD] " + quotedName + " executed " + quotedMessage);

                if (OnCommandRaw != null)
                {
                    OnCommandRaw(ref arg);
                }

                string[] args    = Facepunch.Utility.String.SplitQuotesStrings(quotedMessage.Trim('"'));
                var      command = args[0].TrimStart('/');
                var      cargs   = new string[args.Length - 1];
                Array.Copy(args, 1, cargs, 0, cargs.Length);

                if (OnCommand != null)
                {
                    OnCommand(new Player(arg.argUser.playerClient), command, cargs);
                }
            }
            else
            {
                Logger.ChatLog(quotedName, quotedMessage);
                var chatstr = new ChatString(quotedMessage);

                if (OnChat != null)
                {
                    OnChat(new Player(arg.argUser.playerClient), ref chatstr);
                }

                string newchat = Facepunch.Utility.String.QuoteSafe(chatstr.NewText.Substring(1, chatstr.NewText.Length - 2)).Replace("\\\"", "" + '\u0022');

                if (string.IsNullOrEmpty(newchat))
                {
                    return;
                }

                Fougerite.Data.GetData().chat_history.Add(newchat);
                Fougerite.Data.GetData().chat_history_username.Add(quotedName);
                ConsoleNetworker.Broadcast("chat.add " + quotedName + " " + newchat);
            }
        }
Esempio n. 3
0
        public static void ChatReceived(ref ConsoleSystem.Arg arg)
        {
            if (!chat.enabled)
                return;

            if (arg == null)
                return;

            var quotedName = Facepunch.Utility.String.QuoteSafe(arg.argUser.displayName);
            var quotedMessage = Facepunch.Utility.String.QuoteSafe(arg.GetString(0, "text"));

            if (OnChatRaw != null)
                OnChatRaw(ref arg);

            if (arg == null)
                return;

            if (quotedMessage.Trim('"').StartsWith("/")) {
                Logger.LogDebug("[CHAT-CMD] " + quotedName + " executed " + quotedMessage);

                if (OnCommandRaw != null)
                    OnCommandRaw(ref arg);

                string[] args = Facepunch.Utility.String.SplitQuotesStrings(quotedMessage.Trim('"'));
                var command = args[0].TrimStart('/');
                var cargs = new string[args.Length - 1];
                Array.Copy(args, 1, cargs, 0, cargs.Length);

                if (OnCommand != null)
                    OnCommand(new Player(arg.argUser.playerClient), command, cargs);

            } else {
                Logger.ChatLog(quotedName, quotedMessage);               
                var chatstr = new ChatString(quotedMessage);

                if(OnChat != null)
                    OnChat(new Player(arg.argUser.playerClient), ref chatstr);

                string newchat = Facepunch.Utility.String.QuoteSafe(chatstr.NewText.Substring(1, chatstr.NewText.Length - 2)).Replace("\\\"", "" + '\u0022');

                if (string.IsNullOrEmpty(newchat))
                    return;

                Fougerite.Data.GetData().chat_history.Add(newchat);
                Fougerite.Data.GetData().chat_history_username.Add(quotedName);                                                   
                ConsoleNetworker.Broadcast("chat.add " + quotedName + " " + newchat);
            }
        }
Esempio n. 4
0
 public void OnChat(Player player, ref ChatString text)
 {
     Invoke("On_Chat", player, text);
 }
Esempio n. 5
0
 void OnChat(Fougerite.Player p, ref ChatString text)
 {
     foreach (KeyValuePair<string, V8Plugin> plugin in plugins)
     {
         plugin.Value.Invoke("OnChat", p, text);
         plugin.Value.Invoke("On_Chat", p, text); // Deprecated
     }
 }