public static Career getCareerFromBattleTag(BattleTag battleTag) { Career career; using (Stream stream = dataProvider.fetchData(getCareerUrl(battleTag) + apiLocaleSuffix)) { career = Career.getCareerFromJSonStream(stream); } return career; }
public static Hero getHeroFromHeroID(BattleTag battleTag, String heroId) { Hero hero; using (Stream stream = dataProvider.fetchData(D3Api.getHeroUrlFromHeroId(battleTag, heroId) + apiLocaleSuffix)) { hero = Hero.getHeroFromJSonStream(stream); } return hero; }
static void WriteCareer(BattleTag battleTag) { Career career = Career.getCareerFromBattleTag(battleTag); Console.WriteLine("Battletag: " + career.battleTag.id); foreach (HeroSummary lastHeroPlayedName in career.heroes) { if (career.lastHeroPlayed == lastHeroPlayedName.id) { Console.WriteLine("Last played hero: " + lastHeroPlayedName.name + " (ID: " + career.lastHeroPlayed + ")"); } } Console.WriteLine("Heroes count: " + career.heroes.Length); Console.WriteLine("Total kills: Monsters ({0}) Elites ({1})", career.kills.monsters, career.kills.elites); Console.WriteLine("Cleared Normal ({0}), Nightmare ({1}), Hell ({2}), Inferno ({3})" + "\n----", career.progression.normal.act4.completed, career.progression.nightmare.act4.completed, career.progression.hell.act4.completed, career.progression.inferno.act4.completed); foreach (HeroSummary heroDigest in career.heroes) { Console.WriteLine("Hero '{0}' (ID: {1}) - {2} | Level {3} + {4} | Last updated {5}", heroDigest.name, heroDigest.id, heroDigest.heroClass, heroDigest.level, heroDigest.paragonLevel, heroDigest.lastUpdated); Hero heroFull = heroDigest.getHeroFromBattleTag(battleTag); Item mainHand = Item.getItemFromTooltipParams(heroFull.items.mainHand.tooltipParams); Console.WriteLine("\nMain Hand: '{0}' (Type: {1}) (Rarity: {2}) (iLv: {3}) (Lv: {4}) | DPS {5} - {6}" + "\n----", mainHand.name, mainHand.typeName, mainHand.displayColor, mainHand.itemLevel, mainHand.requiredLevel, mainHand.dps.min, mainHand.dps.max); } Console.WriteLine(); Console.WriteLine("Fallen Heroes count: " + career.fallenHeroes.Length); foreach (HeroSummary heroDigest in career.fallenHeroes) { Console.WriteLine("Hero {0}: {1} is {2} level {3} + {4} ", heroDigest.id, heroDigest.name, heroDigest.heroClass, heroDigest.level, heroDigest.paragonLevel); } }
public Hero getHeroFromBattleTag(BattleTag battleTag) { return Hero.getHeroFromHeroId(battleTag, id); }
public static String getHeroUrlFromHeroId(BattleTag battleTag, String heroId) { return getCareerUrl(battleTag) + "hero/" + heroId; }
public static String getCareerUrl(BattleTag battleTag) { return apiUrl + "profile/" + battleTag.name + "-" + battleTag.code + "/"; }
public static Hero getHeroFromHeroId(BattleTag battleTag, String heroId) { return D3Api.getHeroFromHeroID(battleTag, heroId); }
public static void Main(string[] args) { BattleTag battleTag = new BattleTag("mystogan#2963"); //your battletag WriteCareer(battleTag); }
public static Career getCareerFromBattleTag(BattleTag battleTag) { return D3Api.getCareerFromBattleTag(battleTag); }