Ejemplo n.º 1
0
        public RemoveCharacterResponseParameters?Handle(MessageData <RemoveCharacterRequestParametersEx> messageData, ref MessageSendOptions sendOptions)
        {
            var userId         = messageData.Parameters.UserId;
            var characterIndex = messageData.Parameters.CharacterIndex;

            databaseCharacterRemover.Remove(userId, characterIndex);

            var removed = !databaseCharacterExistence.Exists(userId, (CharacterIndex)characterIndex);

            return(new RemoveCharacterResponseParameters(removed ? RemoveCharacterStatus.Succeed : RemoveCharacterStatus.Failed));
        }
Ejemplo n.º 2
0
        public CreateCharacterResponseParameters?Handle(MessageData <CreateCharacterRequestParametersEx> messageData, ref MessageSendOptions sendOptions)
        {
            var userId         = messageData.Parameters.UserId;
            var characterClass = messageData.Parameters.CharacterClass;
            var name           = messageData.Parameters.Name;
            var characterIndex = messageData.Parameters.Index;

            if (databaseCharacterExistence.Exists(userId, characterIndex))
            {
                return(new CreateCharacterResponseParameters(CharacterCreationStatus.Failed));
            }

            if (databaseCharacterNameVerifier.Verify(name))
            {
                return(new CreateCharacterResponseParameters(CharacterCreationStatus.NameUsed));
            }

            databaseCharacterCreator.Create(userId, name, characterClass, characterIndex);
            return(new CreateCharacterResponseParameters(CharacterCreationStatus.Succeed));
        }