示例#1
0
            public async Task <RuntimeResult> TagSkillsAsync(Skill tag1, Skill tag2, Skill tag3)
            {
                if (!_progOptions.UseOldProgression ||
                    !_progOptions.OldProgression.UseNewVegasRules)
                {
                    return(StatisticResult.NotUsingNewVegasRules());
                }

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

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

                if (_skillsService.AreSkillsSet(character))
                {
                    return(StatisticResult.SkillsAlreadyTagged());
                }

                try
                {
                    await _skillsService.TagSkills(character, tag1, tag2, tag3);

                    return(GenericResult.FromSuccess(Messages.SKILLS_SET_SUCCESS));
                }
                catch (Exception e)
                {
                    return(GenericResult.FromError($"{Messages.FAILURE_EMOJI} {e.Message}"));
                }
            }
示例#2
0
            public async Task <RuntimeResult> SetSkillsAsync(Skill tag, int points)
            {
                if (ExperienceService.UseOldProgression)
                {
                    return(StatisticResult.UsingOldProgression());
                }

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

                if (character == null)
                {
                    return(CharacterResult.CharacterNotFound());
                }
                if (_skillsService.AreSkillsSet(character))
                {
                    return(StatisticResult.SkillsAlreadyTagged());
                }

                try
                {
                    await _skillsService.TagSkill(character, tag, points);

                    return(GenericResult.FromSuccess(Messages.SKILLS_SET_SUCCESS));
                }
                catch (Exception e)
                {
                    return(GenericResult.FromError($"{Messages.FAILURE_EMOJI} {e.Message}"));
                }
            }
示例#3
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."));
            }