Пример #1
0
            public async Task ShowSpecialAsync(IUser targetUser = null)
            {
                var userInfo  = Context.User;
                var character = targetUser == null
                    ? await _charService.GetCharacterAsync(userInfo.Id)
                    : await _charService.GetCharacterAsync(targetUser.Id);

                if (character == null)
                {
                    await ReplyAsync(
                        string.Format(Messages.ERR_CHAR_NOT_FOUND, userInfo.Mention));

                    return;
                }

                if (!_specService.IsSpecialSet(character))
                {
                    await ReplyAsync(
                        string.Format(Messages.ERR_SPECIAL_NOT_FOUND, userInfo.Mention));

                    return;
                }

                var embed = EmbedHelper.BuildBasicEmbed("Command: $character special",
                                                        $"**Name:** {character.Name}\n" +
                                                        $"**STR:** {character.Special.Strength}\n" +
                                                        $"**PER:** {character.Special.Perception}\n" +
                                                        $"**END:** {character.Special.Endurance}\n" +
                                                        $"**CHA:** {character.Special.Charisma}\n" +
                                                        $"**INT:** {character.Special.Intelligence}\n" +
                                                        $"**AGI:** {character.Special.Agility}\n" +
                                                        $"**LUC:** {character.Special.Luck}");

                await ReplyAsync(userInfo.Mention, embed : embed);
            }
Пример #2
0
            public async Task <RuntimeResult> InitializeStatisticsAsync()
            {
                if (!_progOptions.UseOldProgression ||
                    !_progOptions.OldProgression.UseNewVegasRules)
                {
                    return(StatisticResult.NotUsingNewVegasRules());
                }

                var character = await _charService.GetCharacterAsync(Context.User.Id);

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

                if (!_specService.IsSpecialSet(character))
                {
                    return(StatisticResult.SpecialNotSet());
                }

                // Makes sure at least one skill has a value, otherwise the character might not have tagged their skills yet
                // We can't use !AreSkillsSet because it assumes that EVERY skill (including the brand new one) is greater than 0 at this point
                // If a new skill just got added, it's going to be 0 for everybody!
                if (character.Skills.Count(x => x.Value > 0) < 1)
                {
                    return(StatisticResult.SkillsNotSet());
                }

                // Now we check if all the skills count is the same, because if this is true, there aren't any new skills to initialize,
                // running this command is pointless and adds unnecessary risk
                if (character.Skills.Count == StatisticsService.Statistics.OfType <Skill>().Count())
                {
                    return(StatisticResult.SkillsAlreadyTagged());
                }

                _statsService.InitializeStatistics(character.Statistics);
                _skillsService.InitializeSkills(character, true);
                await _charService.SaveCharacterAsync(character);

                return(GenericResult.FromSuccess("Character skills initialized successfully."));
            }
Пример #3
0
            private async Task <RuntimeResult> ShowSpecialAsync(IUser targetUser = null, bool useEffects = false)
            {
                var userInfo  = Context.User;
                var character = targetUser == null
                    ? await _charService.GetCharacterAsync(userInfo.Id)
                    : await _charService.GetCharacterAsync(targetUser.Id);

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

                var stats = character.Statistics;

                if (useEffects)
                {
                    stats = _effectsService.GetEffectiveStatistics(character);
                }

                StringBuilder message = new StringBuilder($"**Name:** {character.Name}\n");

                foreach (var special in stats.Where(x => x.Statistic is Special).OrderBy(x => x.Statistic.Id))
                {
                    message.Append($"**{special.Statistic.Name}:** {special.Value}\n");
                }

                if (!_specService.IsSpecialSet(character))
                {
                    message.Append($"*You have {character.SpecialPoints} S.P.E.C.I.A.L. points left to spend!*");
                }

                var embed = EmbedHelper.BuildBasicEmbed("Command: $special", message.ToString());

                await ReplyAsync(userInfo.Mention, embed : embed);

                return(GenericResult.FromSilentSuccess());
            }
Пример #4
0
        public async Task CheckSpecial(IUser user, Globals.SpecialType special, int minimum)
        {
            var character = await _charService.GetCharacterAsync(user.Id);

            if (character == null)
            {
                await ReplyAsync(String.Format(Messages.ERR_CHAR_NOT_FOUND, user.Username));

                return;
            }
            if (!_specialService.IsSpecialSet(character))
            {
                await ReplyAsync(String.Format(Messages.ERR_SPECIAL_NOT_FOUND, user.Username));

                return;
            }

            int specialValue = _specialService.GetSpecial(character, special);

            await ReplyAsync(GetCheckMessage(character.Name, special.ToString(), specialValue, minimum));
        }