public SeasonalProfile(JObject rawData)
 {
     if (rawData["seasonId"] != null)
     {
         SeasonID = int.Parse(rawData["seasonId"].ToString());
     }
     if (rawData["paragonLevel"] != null)
     {
         ParagonLevel = int.Parse(rawData["paragonLevel"].ToString());
     }
     if (rawData["paragonLevelHardcore"] != null)
     {
         HardcoreParagonLevel = int.Parse(rawData["paragonLevelHardcore"].ToString());
     }
     if (rawData["kills"] != null)
     {
         Kills = new Kill(JObject.Parse(rawData["kills"].ToString()));
     }
     if (rawData["timePlayed"] != null)
     {
         TimePlayed = new TimePlayed(JObject.Parse(rawData["timePlayed"].ToString()));
     }
     if (rawData["highestHardcoreLevel"] != null)
     {
         HighestHardcoreLevel = int.Parse(rawData["highestHardcoreLevel"].ToString());
     }
 }
Example #2
0
        public Profile(JObject rawData)
        {
            if (rawData["battleTag"] != null)
            {
                BattleTag = rawData["battleTag"].ToString();
            }
            if (rawData["paragonLevel"] != null)
            {
                ParagonLevel = int.Parse(rawData["paragonLevel"].ToString());
            }
            if (rawData["paragonLevelHardcore"] != null)
            {
                HardcoreParagonLevel = int.Parse(rawData["paragonLevelHardcore"].ToString());
            }
            if (rawData["paragonLevelSeason"] != null)
            {
                SeasonParagonLevel = int.Parse(rawData["paragonLevelSeason"].ToString());
            }
            if (rawData["paragonLevelSeasonHardcore"] != null)
            {
                HardcoreSeasonParagonLevel = int.Parse(rawData["paragonLevelSeasonHardcore"].ToString());
            }
            if (rawData["guildName"] != null)
            {
                GuildName = rawData["guildName"].ToString();
            }
            if (rawData["heroes"] != null && rawData["heroes"].HasValues)
            {
                Heroes = new List <Hero>();

                foreach (JObject heroObject in rawData["heroes"])
                {
                    Hero hero = new Hero(heroObject);
                    Heroes.Add(hero);
                }
            }
            if (rawData["lastHeroPlayed"] != null)
            {
                LastHeroPlayedID = long.Parse(rawData["lastHeroPlayed"].ToString());
            }
            if (rawData["lastUpdated"] != null)
            {
                LastUpdated = long.Parse(rawData["lastUpdated"].ToString());
            }
            if (rawData["kills"] != null)
            {
                Kills = new Kill(JObject.Parse(rawData["kills"].ToString()));
            }
            if (rawData["highestHardcoreLevel"] != null)
            {
                HighestHardcoreLevel = int.Parse(rawData["highestHardcoreLevel"].ToString());
            }
            if (rawData["timePlayed"] != null)
            {
                TimePlayed = new TimePlayed(JObject.Parse(rawData["timePlayed"].ToString()));
            }
            if (rawData["progression"] != null)
            {
                Progression = new Progression(JObject.Parse(rawData["progression"].ToString()));
            }
            if (rawData["seasonalProfiles"] != null && rawData["seasonalProfiles"].HasValues)
            {
                SeasonalProfiles = new List <SeasonalProfile>();
                foreach (JObject season in rawData["seasonalProfiles"])
                {
                    SeasonalProfile sp = new SeasonalProfile(season);
                    SeasonalProfiles.Add(sp);
                }
            }
            if (rawData["blacksmith"] != null)
            {
                Blacksmith = new CharacterArtisan(JObject.Parse(rawData["blacksmith"].ToString()));
            }
            if (rawData["mystic"] != null)
            {
                Mystic = new CharacterArtisan(JObject.Parse(rawData["mystic"].ToString()));
            }
            if (rawData["jeweler"] != null)
            {
                Jeweler = new CharacterArtisan(JObject.Parse(rawData["jeweler"].ToString()));
            }
            if (rawData["blacksmithSeason"] != null)
            {
                SeasonBlacksmith = new CharacterArtisan(JObject.Parse(rawData["blacksmithSeason"].ToString()));
            }
            if (rawData["mysticSeason"] != null)
            {
                SeasonMystic = new CharacterArtisan(JObject.Parse(rawData["mysticSeason"].ToString()));
            }
            if (rawData["jewelerSeason"] != null)
            {
                SeasonJeweler = new CharacterArtisan(JObject.Parse(rawData["jewelerSeason"].ToString()));
            }
            if (rawData["blacksmithHardcore"] != null)
            {
                HardcoreBlacksmith = new CharacterArtisan(JObject.Parse(rawData["blacksmithHardcore"].ToString()));
            }
            if (rawData["mysticHardcore"] != null)
            {
                HardcoreMystic = new CharacterArtisan(JObject.Parse(rawData["mysticHardcore"].ToString()));
            }
            if (rawData["jewelerHardcore"] != null)
            {
                HardcoreJeweler = new CharacterArtisan(JObject.Parse(rawData["jewelerHardcore"].ToString()));
            }
            if (rawData["blacksmithSeasonHardcore"] != null)
            {
                HardcoreSeasonBlacksmith = new CharacterArtisan(JObject.Parse(rawData["blacksmithSeasonHardcore"].ToString()));
            }
            if (rawData["mysticSeasonHardcore"] != null)
            {
                HardcoreSeasonMystic = new CharacterArtisan(JObject.Parse(rawData["mysticSeasonHardcore"].ToString()));
            }
            if (rawData["jewelerSeasonHardcore"] != null)
            {
                HardcoreSeasonJeweler = new CharacterArtisan(JObject.Parse(rawData["jewelerSeasonHardcore"].ToString()));
            }
        }
Example #3
0
        public Hero(JObject rawData)
        {
            if (rawData["id"] != null)
            {
                ID = long.Parse(rawData["id"].ToString());
            }
            if (rawData["name"] != null)
            {
                Name = rawData["name"].ToString();
            }
            if (rawData["class"] != null)
            {
                Class = rawData["class"].ToString();
            }
            if (rawData["classSlug"] != null)
            {
                ClassSlug = rawData["classSlug"].ToString();
            }
            if (rawData["gender"] != null)
            {
                Gender = int.Parse(rawData["gender"].ToString());
            }
            if (rawData["level"] != null)
            {
                Level = int.Parse(rawData["level"].ToString());
            }
            if (rawData["kills"] != null && rawData["kills"].HasValues)
            {
                Kills = new Kill(JObject.Parse(rawData["kills"].ToString()));
            }
            if (rawData["paragonLevel"] != null)
            {
                ParagonLevel = int.Parse(rawData["paragonLevel"].ToString());
            }
            if (rawData["hardcore"] != null)
            {
                Hardcore = bool.Parse(rawData["hardcore"].ToString());
            }
            if (rawData["seasonal"] != null)
            {
                Seasonal = bool.Parse(rawData["seasonal"].ToString());
            }
            if (rawData["dead"] != null)
            {
                Dead = bool.Parse(rawData["dead"].ToString());
            }
            if (rawData["lastUpdated"] != null)
            {
                LastUpdated = long.Parse(rawData["lastUpdated"].ToString());
            }
            if (rawData["seasonCreated"] != null)
            {
                SeasonCreated = int.Parse(rawData["seasonCreated"].ToString());
            }
            if (rawData["skills"]["active"] != null && rawData["skills"]["active"].HasValues)
            {
                ActiveSkills = new List <HeroSkill>();

                foreach (JObject hs in rawData["skills"]["active"])
                {
                    HeroSkill hero = new HeroSkill(hs);
                    ActiveSkills.Add(hero);
                }
            }
            if (rawData["skills"]["passive"] != null && rawData["skills"]["passive"].HasValues)
            {
                PassiveSkills = new List <Skill>();

                foreach (JObject hs in rawData["skills"]["passive"])
                {
                    Skill skill = new Skill(hs);
                    PassiveSkills.Add(skill);
                }
            }
            if (rawData["items"] != null && rawData["items"].HasValues)
            {
                EquippedItems = new List <EquippedItem>();

                foreach (JObject eitem in rawData["items"])
                {
                    EquippedItem item = new EquippedItem(eitem);
                    EquippedItems.Add(item);
                }
            }
            if (rawData["followers"] != null && rawData["followers"].HasValues)
            {
                Followers = new List <Follower>();

                foreach (JObject foll in rawData["followers"])
                {
                    Follower follower = new Follower(foll);
                    Followers.Add(follower);
                }
            }
            if (rawData["legendaryPowers"] != null && rawData["legendaryPowers"].HasValues)
            {
                LegendaryPowers = new List <LegendaryPower>();

                foreach (JObject lp in rawData["legendaryPowers"])
                {
                    LegendaryPower power = new LegendaryPower(lp);
                    LegendaryPowers.Add(power);
                }
            }
            if (rawData["progression"] != null && rawData["progression"].HasValues)
            {
                Progression = new List <HeroProgression>();

                foreach (JObject prog in rawData["progression"])
                {
                    HeroProgression hp = new HeroProgression(prog);
                    Progression.Add(hp);
                }
            }
            if (rawData["alive"] != null)
            {
                Alive = bool.Parse(rawData["alive"].ToString());
            }
            if (rawData["highestSoloRiftCompleted"] != null)
            {
                HighestSoloRiftCompleted = int.Parse(rawData["highestSoloRiftCompleted"].ToString());
            }
            if (rawData["stats"] != null)
            {
                Stats = new Stats(JObject.Parse(rawData["stats"].ToString()));
            }
        }