Esempio n. 1
0
        /// <summary>
        /// Called for every chat message, including messages about Joins, Leaves, Died, Killed, etc.
        /// </summary>
        /// <returns>true if chat message can be processed further, false if it should be suppressed</returns>
        public override bool ChatMessage(ClientInfo clientInfo, EnumGameMessages messageType, string message, string mainName, bool localizeMain, string secondaryName, bool localizeSecondary)
        {
            try
            {
                Log.Debug("Api.ChatMessage called.");
                var args = new ChatMessageEventArgs()
                {
                    messageType = messageType.ToString(),
                    from        = mainName,
                    message     = message,
                    clientInfo  = clientInfo,
                };

                CommandTools.InvokeScriptEvents(ScriptEvent.chatMessage, () => args);

                return(!args.isPropagationStopped);
            }
            catch (Exception ex)
            {
                CommandTools.HandleEventException(ex);
                return(false);
            }
        }
Esempio n. 2
0
 public void HookPlayer(
     ClientInfo clientInfo,
     EnumGameMessages enumGameMessages,
     string message,
     string mainName,
     bool localizeMain,
     string secondaryName,
     bool localizeSecondary
     )
 {
     _httpTool.Post(new NameValueCollection()
     {
         ClientInfoAsNameValueCollection(clientInfo),
         HookTypeNameValueCollection(EnumHookType.Player),
         { "MessageType", enumGameMessages.ToString() },
         { "Message", message ?? string.Empty },
         { "MainName", mainName ?? string.Empty },
         { "LocalizeMain", localizeMain.ToString() },
         { "SecondaryName", secondaryName ?? string.Empty },
         { "LocalizeSecondary", localizeSecondary.ToString() },
     }
                    );
 }