Provides data for Chat.Sent event. Immutable.
Inheritance: System.EventArgs, IPlayerEvent
示例#1
0
        /// <summary>
        /// This event happens when a chat message has been sent and shown on screen
        /// This should be used to relay the AI messages to the server / player
        /// NOTE IRC is not controlable, which means we can't do !Players
        /// </summary>
        public static void ChatSentMessage( object sender, ChatSentEventArgs e )
        {
            if ( Settings.ReleaseFlag == Flags.Debug ) {
                Logger.Log( LogType.SystemActivity, "HelperBot: ChatSentMessage P=" + e.Player.Name + "; ML=" + e.Message.Length + "; MT=" + e.MessageType );
            }
            if ( e.Message == null )
                return;
            MessageChannel Channel = Methods.ParseChatType( e.MessageType );
            if ( Methods.DetectMessageImpersonation( e.Message ) || Methods.IsPlayersDisplayedNameBots( e.Player ) ) {
                if ( e.Player != Player.Console ) {
                    if ( Settings.AnnounceImpersonation ) {
                        e.Player.Kick( Player.Console, "Impersonation Detected", LeaveReason.Kick, true, true, false ); //tad harsh? //it will stop it from happening!
                    } else {
                        Methods.SendMessage( "That wasn't me, that was " + e.Player.Info.Rank.Color + e.Player.Name, Channel ); //DetectMessageImpersonation shouldnt work for PMs
                    }
                }
            }
            if ( e.MessageType == ChatMessageType.IRC || e.MessageType == ChatMessageType.Say || e.MessageType == ChatMessageType.Rank )
                return;

            Triggers.CheckTriggers( e.Player, e.Message, Channel );
        }
示例#2
0
文件: IRC.cs 项目: fragmer/fCraft
        static void ChatSentHandler( object sender, ChatSentEventArgs args ) {
            bool enabled = ConfigKey.IRCBotForwardFromServer.Enabled();
            switch( args.MessageType ) {
                case ChatMessageType.Global:
                    if( enabled ) {
                        string formattedMessage = String.Format( "{0}{1}: {2}",
                                                        args.Player.ClassyName, 
                                                        ResetCode,
                                                        args.Message );
                        SendChannelMessage( formattedMessage );
                    } else if( args.Message.StartsWith( "#" ) ) {
                        string formattedMessage = String.Format( "{0}{1}: {2}",
                                                        args.Player.ClassyName,
                                                        ResetCode,
                                                        args.Message.Substring( 1 ) );
                        SendChannelMessage( formattedMessage );
                    }
                    break;

                case ChatMessageType.Me:
                case ChatMessageType.Say:
                    if( enabled ) {
                        SendAction( args.FormattedMessage );
                    }
                    break;
            }
        }
示例#3
0
        internal static void ChatSentHandler(object sender, ChatSentEventArgs args)
        {
            bool enabled = ConfigKey.IRCBotForwardFromServer.Enabled();
            switch (args.MessageType)
            {
                case ChatMessageType.Global:
                    if (enabled)
                    {
                        SendChannelMessage(args.Player.ClassyName + Color.IRCReset + ": " + args.Message);
                    }
                    else if (args.Message.StartsWith("#"))
                    {
                        SendChannelMessage(args.Player.ClassyName + Color.IRCReset + ": " + args.Message.Substring(1));
                    }
                    break;

                case ChatMessageType.Me:
                case ChatMessageType.Say:
                    if (enabled) SendAction(args.FormattedMessage);
                    break;
            }
        }
示例#4
0
文件: Events.cs 项目: Jonty800/Guilds
 private static void Chat_Sent( object sender, ChatSentEventArgs e )
 {
     if ( e.Message == "$$FixGuilds" ) {
         foreach ( Guild g1 in Cache.Guilds ) {
             if ( g1.Tag == "" )
                 g1.Tag = null;
             if ( !string.IsNullOrEmpty( g1.Tag ) ) {
                 if ( g1.PvP ) {
                     foreach ( String s in g1.Members ) {
                         PlayerInfo i = PlayerDB.FindPlayerInfoExact( s );
                         if ( i != null ) {
                             i.TitleName = GuildManager.GetGuildPvPTagColor(g1) + "[" + Color.StripColors( g1.Tag ) + "]";
                         }
                     }
                 }
             }
         }
         return;
     }
     if ( GuildManager.PlayerHasGuild( e.Player.Info ) ) {
         if ( e.Player.Info.MessagesWritten % 100 == 0 ) {
             Guild g = GuildManager.PlayersGuild( e.Player.Info );
             g.AddXP( ( int )Exp.OneHundredChat );
         }
     }
 }