public static bool InvokeValidatePlayerName(ValidatePlayerNameEventArgs e)
        {
            if (ValidatePlayerName != null)
            {
                return(ValidatePlayerName(e));
            }

            return(false);
        }
        public static bool EventSink_ValidatePlayerName( ValidatePlayerNameEventArgs e )
        {
            NetState state = e.State;
            string name = e.Name;
            string lowername = name.ToLower();

            NameResultMessage result = NameVerification.ValidatePlayerName( lowername, 2, 16, true, false, true, 1, NameVerification.SpaceDashPeriodQuote );

            switch ( result )
            {
                default:
                case NameResultMessage.NotAllowed: SendErrorOnCharacterCreation( state, String.Format( "The name {0} is not allowed.", name ) ); return false;
                case NameResultMessage.InvalidCharacter: SendErrorOnCharacterCreation( state, String.Format( "The name {0} contains invalid characters.", name ) ); return false;
                case NameResultMessage.TooFewCharacters: case NameResultMessage.TooManyCharacters: SendErrorOnCharacterCreation( state, "The name must be between 2-16 characters." ); return false;
                case NameResultMessage.AlreadyExists: SendErrorOnCharacterCreation( state, String.Format( "A player with the name {0} already exists.", name ) ); return false;
                case NameResultMessage.Allowed: return true;
            }
        }
Example #3
0
		public static bool InvokeValidatePlayerName(ValidatePlayerNameEventArgs e)
		{
			if (ValidatePlayerName != null)
			{
				return ValidatePlayerName(e);
			}

			return false;
		}