Exemple #1
0
        public async Task <RuntimeResult> ApplyEffectAsync(string npcName, [Remainder] string name)
        {
            var character = _npcService.FindNpc(npcName);

            if (character == null)
            {
                return(CharacterResult.NpcNotFound());
            }

            var effect = await _effectsService.GetEffectAsync(name);

            if (effect == null)
            {
                return(GenericResult.FromError(Messages.ERR_EFFECT_NOT_FOUND));
            }

            if (character.EffectCharacters == null)
            {
                character.EffectCharacters = new List <EffectCharacter>();
            }

            if (character.EffectCharacters.Any(x => x.Effect.Equals(effect)))
            {
                return(GenericResult.FromError(Messages.ERR_EFFECT_ALREADY_APPLIED));
            }

            character.EffectCharacters.Add(new EffectCharacter {
                Character = character, Effect = effect
            });

            return(GenericResult.FromSuccess(String.Format(Messages.EFFECT_APPLY_SUCCESS, effect.Name, character.Name)));
        }
Exemple #2
0
        public async Task <RuntimeResult> ViewEffectAsync([Remainder] string name)
        {
            var effect = await _effectsService.GetEffectAsync(name);

            if (effect == null)
            {
                return(GenericResult.FromError(Messages.ERR_EFFECT_NOT_FOUND));
            }

            await ReplyAsync(message : Context.User.Mention, embed : EmbedHelper.BuildBasicEmbed(null, _effectsService.GetEffectInfo(effect)));

            return(GenericResult.FromSilentSuccess());
        }