コード例 #1
0
ファイル: ChatActionHandlers.cs プロジェクト: Godkong/RunUO
		public static void EmoteMessage( ChatUser from, Channel channel, string param )
		{
			if ( channel.CanTalk( from ) )
				channel.SendIgnorableMessage( 58, from, from.GetColorCharacter() + from.Username, param ); // %1 %2
			else
				from.SendMessage( 36 ); // The moderator of this conference has not given you speaking priviledges.
		}
コード例 #2
0
        public static void AddVoice( ChatUser from, Channel channel, string param )
        {
            ChatUser target = ChatSystem.SearchForUser( from, param );

            if ( target != null )
                channel.AddVoiced( target, from );
        }
コード例 #3
0
        public static void AddIgnore( ChatUser from, Channel channel, string param )
        {
            ChatUser target = ChatSystem.SearchForUser( from, param );

            if ( target == null )
                return;

            from.AddIgnored( target );
        }
コード例 #4
0
		public static ChatUser AddChatUser( Mobile from )
		{
			ChatUser user = GetChatUser( from );

			if ( user == null )
			{
				user = new ChatUser( from );

				m_Users.Add( user );
				m_Table[from] = user;

				Channel.SendChannelsTo( user );
			}

			return user;
		}
コード例 #5
0
		public static void RemoveChatUser( ChatUser user )
		{
			if ( user == null )
				return;

			if ( m_Users.Contains( user ) )
			{
				ChatSystem.SendCommandTo( user.Mobile, ChatCommand.CloseChatWindow );

				if ( user.m_Channel != null )
					user.m_Channel.RemoveUser( user );

				m_Users.Remove( user );
				m_Table.Remove( user.m_Mobile );
			}
		}
コード例 #6
0
		public void RemoveUser( ChatUser user )
		{
			if ( Contains( user ) )
			{
				m_Users.Remove( user );
				user.CurrentChannel = null;

				SendCommand( ChatCommand.RemoveUserFromChannel, user, user.Username );
				ChatSystem.SendCommandTo( user.Mobile, ChatCommand.LeaveChannel, String.Format( "{{{0}}}", m_Name ) );
				ChatSystem.SendCommandTo( user.Mobile, ChatCommand.LeftChannel, m_Name );

				ChatLogging.LogLeave( this.Name, user.Username );

				if ( m_Users.Count == 0 && !m_AlwaysAvailable )
					RemoveChannel( this );
			}
		}
コード例 #7
0
ファイル: ChatActionHandlers.cs プロジェクト: Godkong/RunUO
		public static void PrivateMessage( ChatUser from, Channel channel, string param )
		{
			int indexOf = param.IndexOf( ' ' );

			string name = param.Substring( 0, indexOf );
			string text = param.Substring( indexOf + 1 );

			ChatUser target = ChatSystem.SearchForUser( from, name );

			if ( target == null )
				return;

			if ( target.IsIgnored( from ) )
				from.SendMessage( 35, target.Username ); // %1 has chosen to ignore you. None of your messages to them will get through.
			else if ( target.IgnorePrivateMessage )
				from.SendMessage( 42, target.Username ); // %1 has chosen to not receive private messages at the moment.
			else
				target.SendMessage( 59, from.Mobile, from.GetColorCharacter() + from.Username, text ); // [%1]: %2
		}
コード例 #8
0
		public static void JoinChannel( ChatUser from, Channel channel, string param )
		{
			string name;
			string password = null;

			int start = param.IndexOf( '\"' );

			if ( start >= 0 )
			{
				int end = param.IndexOf( '\"', ++start );

				if ( end >= 0 )
				{
					name = param.Substring( start, end - start );
					password = param.Substring( ++end );
				}
				else
				{
					name = param.Substring( start );
				}
			}
			else
			{
				int indexOf = param.IndexOf( ' ' );

				if ( indexOf >= 0 )
				{
					name = param.Substring( 0, indexOf++ );
					password = param.Substring( indexOf );
				}
				else
				{
					name = param;
				}
			}

			CreateAndJoin( from, name );
		}
コード例 #9
0
		public void AddUser( ChatUser user )
		{
			if ( Contains( user ) )
			{
				user.SendMessage( 46, m_Name ); // You are already in the conference '%1'.
			}
			else
			{
				if ( user.CurrentChannel != null )
					user.CurrentChannel.RemoveUser( user ); // Remove them from their current channel first

				ChatSystem.SendCommandTo( user.Mobile, ChatCommand.JoinedChannel, m_Name );

				SendCommand( ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );

				m_Users.Add( user );
				user.CurrentChannel = this;

				SendUsersTo( user );

				ChatLogging.LogJoin( this.Name, user.Username );
			}
		}
コード例 #10
0
 public static void ShowCharacterName(ChatUser from, Channel channel, string param)
 {
     from.Anonymous = false;
     from.SendMessage(39);               // You are now showing your character name to any players who inquire with the whois command.
 }
コード例 #11
0
		public bool CanTalk( ChatUser user )
		{
			return ( !m_VoiceRestricted || m_Voices.Contains( user ) || m_Moderators.Contains( user ) );
		}
コード例 #12
0
		public bool Contains( ChatUser user )
		{
			return m_Users.Contains( user );
		}
コード例 #13
0
		public void SendUsersTo( ChatUser to )
		{
			for ( int i = 0; i < m_Users.Count; ++i )
			{
				ChatUser user = (ChatUser)m_Users[i];

				ChatSystem.SendCommandTo( to.Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
			}
		}
コード例 #14
0
		public void SendCommand( ChatCommand command, ChatUser initiator )
		{
			SendCommand( command, initiator, null, null );
		}
コード例 #15
0
		public void SendMessage( int number, ChatUser initiator, string param1, string param2 )
		{
			for ( int i = 0; i < m_Users.Count; ++i )
			{
				ChatUser user = (ChatUser)m_Users[i];

				if ( user == initiator )
					continue;

				if ( user.CheckOnline() )
					user.SendMessage( number, param1, param2 );
				else if ( !Contains( user ) )
					--i;
			}
		}
コード例 #16
0
 public static void ChangeChannelPassword(ChatUser from, Channel channel, string param)
 {
     channel.Password = param;
     from.SendMessage(60);               // The password to the conference has been changed.
 }
コード例 #17
0
 public static void DisableDefaultVoice(ChatUser from, Channel channel, string param)
 {
     channel.VoiceRestricted = true;
 }
コード例 #18
0
 public static void ToggleDefaultVoice(ChatUser from, Channel channel, string param)
 {
     channel.VoiceRestricted = !channel.VoiceRestricted;
 }
コード例 #19
0
 public static void RenameChannel(ChatUser from, Channel channel, string param)
 {
     channel.Name = param;
 }
コード例 #20
0
 public static void ToggleCharacterName(ChatUser from, Channel channel, string param)
 {
     from.Anonymous = !from.Anonymous;
     from.SendMessage(from.Anonymous ? 40 : 39);               // See above for messages
 }
コード例 #21
0
 public static void HideCharacterName(ChatUser from, Channel channel, string param)
 {
     from.Anonymous = true;
     from.SendMessage(40);               // You are no longer showing your character name to any players who inquire with the whois command.
 }
コード例 #22
0
ファイル: ChatUser.cs プロジェクト: FreeReign/Rebirth-Repack
 public static void GlobalSendCommand( ChatCommand command, ChatUser initiator, string param1 )
 {
     GlobalSendCommand( command, initiator, param1, null );
 }
コード例 #23
0
 public static void AllowPrivateMessages(ChatUser from, Channel channel, string param)
 {
     from.IgnorePrivateMessage = false;
     from.SendMessage(37);               // You can now receive private messages.
 }
コード例 #24
0
ファイル: ChatUser.cs プロジェクト: FreeReign/Rebirth-Repack
        public static void RemoveChatUser( ChatUser user )
        {
            if ( user == null )
                return;

            for ( int i = 0; i < user.m_Ignoring.Count; ++i )
                ((ChatUser)user.m_Ignoring[i]).RemoveIgnored( user );

            if ( m_Users.Contains( user ) )
            {
                ChatSystem.SendCommandTo( user.Mobile, ChatCommand.CloseChatWindow );

                if ( user.m_Channel != null )
                    user.m_Channel.RemoveUser( user );

                m_Users.Remove( user );
                m_Table.Remove( user.m_Mobile );
            }
        }
コード例 #25
0
 public bool IsIgnored(ChatUser check)
 {
     return(m_Ignored.Contains(check));
 }
コード例 #26
0
		public void SendMessage( int number, ChatUser initiator, string param1 )
		{
			SendMessage( number, initiator, param1, null );
		}
コード例 #27
0
 public static void GlobalSendCommand(ChatCommand command, ChatUser initiator)
 {
     GlobalSendCommand(command, initiator, null, null);
 }
コード例 #28
0
		public void SendIgnorableMessage( int number, ChatUser from, string param1, string param2 )
		{
			for ( int i = 0; i < m_Users.Count; ++i )
			{
				ChatUser user = (ChatUser)m_Users[i];

				if ( user.IsIgnored( from ) )
					continue;

				if ( user.CheckOnline() )
					user.SendMessage( number, from.Mobile, param1, param2 );
				else if ( !Contains( user ) )
					--i;
			}
		}
コード例 #29
0
 public static void GlobalSendCommand(ChatCommand command, ChatUser initiator, string param1)
 {
     GlobalSendCommand(command, initiator, param1, null);
 }
コード例 #30
0
		public void SendCommand( ChatCommand command, ChatUser initiator, string param1 )
		{
			SendCommand( command, initiator, param1, null );
		}
コード例 #31
0
ファイル: ChatUser.cs プロジェクト: nogu3ira/xrunuo
        public static void RemoveChatUser(Mobile from)
        {
            ChatUser user = GetChatUser(from);

            RemoveChatUser(user);
        }
コード例 #32
0
		public static void SendChannelsTo( ChatUser user )
		{
			for ( int i = 0; i < m_Channels.Count; ++i )
			{
				Channel channel = (Channel)m_Channels[i];

				if ( !channel.IsBanned( user ) )
					ChatSystem.SendCommandTo( user.Mobile, ChatCommand.AddChannel, channel.Name, "0" );
			}
		}
コード例 #33
0
		public bool IsVoiced( ChatUser user )
		{
			return m_Voices.Contains( user );
		}
コード例 #34
0
		public bool IsBanned( ChatUser user )
		{
			return m_Banned.Contains( user );
		}
コード例 #35
0
ファイル: ChatUser.cs プロジェクト: FreeReign/Rebirth-Repack
        public static ChatUser AddChatUser( Mobile from )
        {
            ChatUser user = GetChatUser( from );

            if ( user == null )
            {
                user = new ChatUser( from );

                m_Users.Add( user );
                m_Table[from] = user;

                Channel.SendChannelsTo( user );

                ArrayList list = Channel.Channels;

                for ( int i = 0; i < list.Count; ++i )
                {
                    Channel c = (Channel)list[i];

                    if ( c.AddUser( user ) )
                        break;
                }

                //ChatSystem.SendCommandTo( user.m_Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
            }

            return user;
        }
コード例 #36
0
		public bool IsModerator( ChatUser user )
		{
			return m_Moderators.Contains( user );
		}
コード例 #37
0
 public static void TogglePrivateMessages(ChatUser from, Channel channel, string param)
 {
     from.IgnorePrivateMessage = !from.IgnorePrivateMessage;
     from.SendMessage(from.IgnorePrivateMessage ? 38 : 37);               // See above for messages
 }
コード例 #38
0
		public bool ValidateModerator( ChatUser user )
		{
			if ( user != null && !IsModerator( user ) )
			{
				user.SendMessage( 29 ); // You must have operator status to do this.
				return false;
			}

			return true;
		}
コード例 #39
0
ファイル: ChatUser.cs プロジェクト: FreeReign/Rebirth-Repack
 public bool IsIgnored( ChatUser check )
 {
     return m_Ignored.Contains( check );
 }
コード例 #40
0
ファイル: ChatUser.cs プロジェクト: FreeReign/Rebirth-Repack
 public static void GlobalSendCommand( ChatCommand command, ChatUser initiator )
 {
     GlobalSendCommand( command, initiator, null, null );
 }
コード例 #41
0
ファイル: Channel.cs プロジェクト: ygtkms/ServUO
 public bool Contains(ChatUser user)
 {
     return(m_Users.Contains(user));
 }
コード例 #42
0
ファイル: ChatUser.cs プロジェクト: FreeReign/Rebirth-Repack
        public static void GlobalSendCommand( ChatCommand command, ChatUser initiator, string param1, string param2 )
        {
            for ( int i = 0; i < m_Users.Count; ++i )
            {
                ChatUser user = (ChatUser)m_Users[i];

                if ( user == initiator )
                    continue;

                if ( user.CheckOnline() )
                    ChatSystem.SendCommandTo( user.m_Mobile, command, param1, param2 );
                else if ( !m_Users.Contains( i ) )
                    --i;
            }
        }
コード例 #43
0
ファイル: Chat.cs プロジェクト: phpjunkie420/RunUO
        public static void OpenChatWindowRequest(NetState state, PacketReader pvSrc)
        {
            Mobile from = state.Mobile;

            if (!m_Enabled)
            {
                from.SendMessage("The chat system has been disabled.");
                return;
            }

            pvSrc.Seek(2, System.IO.SeekOrigin.Begin);
            string chatName = pvSrc.ReadUnicodeStringSafe((0x40 - 2) >> 1).Trim();

            Account acct = state.Account as Account;

            string accountChatName = null;

            if (acct != null)
            {
                accountChatName = acct.GetTag("ChatName");
            }

            if (accountChatName != null)
            {
                accountChatName = accountChatName.Trim();
            }

            if (accountChatName != null && accountChatName.Length > 0)
            {
                if (chatName.Length > 0 && chatName != accountChatName)
                {
                    from.SendMessage("You cannot change chat nickname once it has been set.");
                }
            }
            else
            {
                if (chatName == null || chatName.Length == 0)
                {
                    SendCommandTo(from, ChatCommand.AskNewNickname);
                    return;
                }

                if (NameVerification.Validate(chatName, 2, 31, true, true, true, 0, NameVerification.SpaceDashPeriodQuote) && chatName.ToLower().IndexOf("system") == -1)
                {
                    // TODO: Optimize this search

                    foreach (Account checkAccount in Accounts.GetAccounts())
                    {
                        string existingName = checkAccount.GetTag("ChatName");

                        if (existingName != null)
                        {
                            existingName = existingName.Trim();

                            if (Insensitive.Equals(existingName, chatName))
                            {
                                from.SendMessage("Nickname already in use.");
                                SendCommandTo(from, ChatCommand.AskNewNickname);
                                return;
                            }
                        }
                    }

                    accountChatName = chatName;

                    if (acct != null)
                    {
                        acct.AddTag("ChatName", chatName);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501173);                       // That name is disallowed.
                    SendCommandTo(from, ChatCommand.AskNewNickname);
                    return;
                }
            }

            SendCommandTo(from, ChatCommand.OpenChatWindow, accountChatName);
            ChatUser.AddChatUser(from);
        }
コード例 #44
0
ファイル: ChatUser.cs プロジェクト: FreeReign/Rebirth-Repack
        public void AddIgnored( ChatUser user )
        {
            if ( IsIgnored( user ) )
            {
                SendAsciiMessage( 22, user.Username ); // You are already ignoring %1.
            }
            else
            {
                m_Ignored.Add( user );
                user.m_Ignoring.Add( this );

                SendAsciiMessage( 23, user.Username ); // You are now ignoring %1.
            }
        }
コード例 #45
0
 public static void LeaveChat(ChatUser from, Channel channel, string param)
 {
     ChatUser.RemoveChatUser(from);
 }
コード例 #46
0
ファイル: ChatUser.cs プロジェクト: FreeReign/Rebirth-Repack
        public void RemoveIgnored( ChatUser user )
        {
            if ( IsIgnored( user ) )
            {
                m_Ignored.Remove( user );
                user.m_Ignoring.Remove( this );

                SendAsciiMessage( 24, user.Username ); // You are no longer ignoring %1.

                if ( m_Ignored.Count == 0 )
                    SendAsciiMessage( 26 ); // You are no longer ignoring anyone.
            }
            else
            {
                SendAsciiMessage( 25, user.Username ); // You are not ignoring %1.
            }
        }
コード例 #47
0
ファイル: Channel.cs プロジェクト: ygtkms/ServUO
 private static void EventSink_Disconnected(DisconnectedEventArgs e)
 {
     ChatUser.RemoveChatUser(e.Mobile);
 }