Esempio n. 1
0
        public async Task InitGuild(string realmSlug, string guildSlug)
        {
            List <Task> DropTasks = new List <Task>
            {
                _dbManager.Drop <Guild>(),
                _dbManager.Drop <Character>()
            };
            await Task.WhenAll(DropTasks).ConfigureAwait(false);

            Guild guild = new Guild
            {
                Slug      = guildSlug,
                RealmSlug = realmSlug
            };
            GuildJson guildJson = await _blizzardApiReader.GetAsync <GuildJson>($"data/wow/guild/{realmSlug}/{guildSlug}", Namespace.Profile).ConfigureAwait(false);

            guild.Load(guildJson);
            GuildAchievementsJson guildAchievementsJson = await _blizzardApiReader.GetAsync <GuildAchievementsJson>($"data/wow/guild/{realmSlug}/{guildSlug}/achievements", Namespace.Profile).ConfigureAwait(false);

            guild.Load(guildAchievementsJson);
            GuildRosterJson guildRosterJson = await _blizzardApiReader.GetAsync <GuildRosterJson>($"data/wow/guild/{realmSlug}/{guildSlug}/roster", Namespace.Profile).ConfigureAwait(false);

            if (guildRosterJson != null)
            {
                await FillRoster(guildRosterJson).ConfigureAwait(false);
            }
            guild.Load(guildRosterJson);
            await _dbManager.Insert(guild).ConfigureAwait(false);
        }
Esempio n. 2
0
 public void Load(GuildAchievementsJson guildAchievementsJson)
 {
     if (CheckJson(guildAchievementsJson))
     {
         AchievementCount  = guildAchievementsJson.TotalQuantity;
         AchievementPoints = guildAchievementsJson.TotalPoints;
         if (Achievements.Any())
         {
             Achievements.Clear();
         }
         foreach (AchievementCompletionJson achievmentCompletionJson in guildAchievementsJson.Achievements)
         {
             Achievements.Add(new AchievementCompletion(achievmentCompletionJson));
         }
         if (AchievementCategoryCompletion.Any())
         {
             AchievementCategoryCompletion.Clear();
         }
         foreach (AchievementCategoryCompletionJson achievementCategoryCompletionJson in guildAchievementsJson.CategoriesProgress)
         {
             AchievementCategoryCompletion.Add(new AchievementCategoryCompletion(achievementCategoryCompletionJson));
         }
     }
 }
Esempio n. 3
0
 public Guild(GuildJson guildJson, GuildAchievementsJson guildAchievementsJson, GuildRosterJson guildRosterJson) : this()
 {
     Load(guildJson);
     Load(guildAchievementsJson);
     Load(guildRosterJson);
 }