예제 #1
0
        public ActionResult GetCharacterProgress(string expansion, string realm, string character)
        {
            int blizzardId = _characterAchievementRepository.GetBlizzardIdForCharacter("", realm, character);

            string            category     = "flying";
            string            goal         = _achievementRepository.GetGoalKey(category, expansion);
            IEnumerable <int> achievements = _achievementRepository.GetAchievementsByGoal(goal);

            var allAchievements = new List <int>();

            allAchievements.AddRange(achievements);
            var descendents = achievements.SelectMany(ach => _achievementRepository.GetDescendentAchievementsForAchievement(ach));

            allAchievements.AddRange(descendents);

            var characterSteps = new List <CharacterStage>();

            foreach (int achievement in allAchievements)
            {
                characterSteps.AddRange(_characterAchievementRepository.GetCharacterStagesForAchievement(achievement, blizzardId));
            }

            var characterProgress = new CharacterStatus
            {
                CharacterName  = character,
                CharacterSteps = characterSteps
            };

            return(Ok(characterProgress));
        }
        public IEnumerable <AchievementStatus> GetStages(string category, string expansion, int faction = 0)
        {
            var achievementStages = new List <AchievementStatus>();

            string            goal         = _achievementRepository.GetGoalKey(category, expansion);
            IEnumerable <int> achievements = _achievementRepository.GetAchievementsByGoal(goal);

            foreach (int achievement in achievements)
            {
                achievementStages.AddRange(AddCriteriaToAchievementStages(achievement, faction));
            }

            return(achievementStages);
        }