Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Message"></param>
        protected virtual void HandleSaidMessage(SaidMessage Message)
        {
            // check if this is a whisper to us
            // by loooking for a substring in the plain rsc text
            if (Message.Message.ResourceName.Contains("tells you"))
            {
                // log it
                Log("CHAT", Message.Message.FullString);

                // get the part that is within the " ", the real text
                if (Message.Message.Variables.Count > 1 &&
                    Message.Message.Variables[1].Type == InlineVariableType.String)
                {
                    // the whispered text within ""
                    string text = (string)Message.Message.Variables[1].Data;

                    // handle null
                    if (text == null)
                    {
                        return;
                    }

                    // split up into words
                    string[] words = text.ToLower().Split(' ');

                    // need at least the commandword
                    if (words.Length > 0)
                    {
                        // handle it
                        ProcessCommand(Message.Message.SourceObjectID, words);
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Writes <see cref="SaidMessage"/>.
 /// </summary>
 private static async Task WriteSaid(StreamWriter writer, Message message)
 {
     SaidMessage saidMessage = (SaidMessage)message;
     await writer.WriteLineAsync(String.Format(
                                     "[{0}] {1}: {2}",
                                     message.Timestamp.ToLocalTime(),
                                     saidMessage.FromDisplayName,
                                     saidMessage.BodyXml));
 }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Message"></param>
        protected override void HandleSaidMessage(SaidMessage Message)
        {
            base.HandleSaidMessage(Message);

            // log chat from players to IRC
            if (DisplayMessages)
            {
                SendSplitIRCChannelServerString(Message.Message);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Message"></param>
        protected override void HandleSaidMessage(SaidMessage Message)
        {
            base.HandleSaidMessage(Message);

            // log chat from players to IRC
            if (IrcClient.IsRegistered && IrcChannel != null)
            {
                // build a str to log
                // this has a prefix (e.g. "103: ") and a m59 message
                string chatstr =
                    IRCChatStyle.GetPrefixString(Config.ChatPrefix) +
                    IRCChatStyle.CreateIRCMessageFromChatMessage(Message.Message);

                // try to log the chatmessage to IRC
                IrcClient.LocalUser.SendMessage(IrcChannel, chatstr);
            }
        }