Пример #1
0
 private void UpdateItemPicture(ItemSummary item)
 {
     D3Api.GetItemIcon(item.Icon, "large",
                       picture =>
     {
         if (picture != null)
         {
             guiItemPicture.Image = new Bitmap(new MemoryStream(picture.Bytes));
         }
     },
                       () => { }
                       );
 }
Пример #2
0
        private void getSkillIcon64ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var skill = (Skill)guiD3ProfileTreeView.SelectedNode.Tag;

            if (skill.Icon != null)
            {
                var picture = D3Api.GetSkillIcon(skill.Icon, "64");
                using (var imageStream = new MemoryStream(picture.Bytes))
                {
                    guiD3Icon.Image = Image.FromStream(imageStream);
                }
            }
        }
Пример #3
0
        private void getItemSmallIconToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var itemSummary = (ItemSummary)guiD3ProfileTreeView.SelectedNode.Tag;

            if (itemSummary.Icon != null)
            {
                var picture = D3Api.GetItemIcon(itemSummary.Icon);
                using (var imageStream = new MemoryStream(picture.Bytes))
                {
                    guiD3Icon.Image = Image.FromStream(imageStream);
                }
            }
        }
Пример #4
0
 public static Item CreateFromTooltipParams(String tooltipParams)
 {
     return(D3Api.GetItemFromTooltipParams(tooltipParams));
 }
Пример #5
0
 public static async Task <Item> CreateFromTooltipParamsAsync(string tooltipParams) =>
 await D3Api.GetItemFromTooltipParamsAsync(tooltipParams);
Пример #6
0
 public static void CreateFromTooltipParams(string tooltipParams, Action <Item> onSuccess, Action onFailure) =>
 D3Api.GetItemFromTooltipParams(tooltipParams, onSuccess, onFailure);
Пример #7
0
 public static Hero CreateFromHeroId(BattleTag battleTag, String heroId)
 {
     return(D3Api.GetHeroFromHeroId(battleTag, heroId));
 }
Пример #8
0
 public static Artisan CreateFromSlug(String slug)
 {
     return(D3Api.GetArtisanFromSlug(slug));
 }
Пример #9
0
        private static async Task WriteCalculation(BattleTag battleTag)
        {
            Console.WriteLine("= = = = Calculator of {0} = = = =", battleTag);

            Console.WriteLine("Downloading {0}", "career");
            var career = await D3Api.GetCareerFromBattleTagAsync(battleTag);

            if (career == null || career.Heroes.Length == 0)
            {
                return;
            }

            Console.WriteLine("Downloading Hero {0}/{1}", battleTag, career.Heroes[0].Name);
            var hero = await D3Api.GetHeroFromHeroIdAsync(battleTag, career.Heroes[0].Id);

            if (hero?.Items == null)
            {
                return;
            }

            var bracersTask     = GetFullItem(hero.Items.Bracers, "bracers");
            var feetTask        = GetFullItem(hero.Items.Feet, "feet");
            var handsTask       = GetFullItem(hero.Items.Hands, "hands");
            var headTask        = GetFullItem(hero.Items.Hands, "head");
            var leftFingerTask  = GetFullItem(hero.Items.LeftFinger, "leftFinger");
            var legsTask        = GetFullItem(hero.Items.Legs, "legs");
            var mainHandTask    = GetFullItem(hero.Items.MainHand, "mainHand");
            var neckTask        = GetFullItem(hero.Items.Neck, "neck");
            var offHandTask     = GetFullItem(hero.Items.OffHand, "offHand");
            var rightFingerTask = GetFullItem(hero.Items.RightFinger, "rightFinger");
            var shouldersTask   = GetFullItem(hero.Items.Shoulders, "shoulders");
            var torsoTask       = GetFullItem(hero.Items.Torso, "torso");
            var waistTask       = GetFullItem(hero.Items.Waist, "waist");

            Task.WaitAll(bracersTask, feetTask, handsTask, headTask, leftFingerTask, legsTask, mainHandTask, neckTask, offHandTask, rightFingerTask, shouldersTask, torsoTask, waistTask);

            var bracers     = bracersTask.Result;
            var feet        = feetTask.Result;
            var hands       = handsTask.Result;
            var head        = headTask.Result;
            var leftFinger  = leftFingerTask.Result;
            var legs        = legsTask.Result;
            var mainHand    = mainHandTask.Result;
            var neck        = neckTask.Result;
            var offHand     = offHandTask.Result;
            var rightFinger = rightFingerTask.Result;
            var shoulders   = shouldersTask.Result;
            var torso       = torsoTask.Result;
            var waist       = waistTask.Result;

            var items = new List <Item> {
                bracers, feet, hands, head, leftFinger, legs, neck, rightFinger, shoulders, torso, waist
            }.Where(i => i != null).ToList();

            var allItems = new List <Item>(items)
            {
                mainHand, offHand
            }.Where(i => i != null).ToList();

            Console.WriteLine("Calculating activated set");
            foreach (var set in allItems.GetActivatedSets())
            {
                Console.WriteLine("Activated set: {0}", set.name);
            }
            var setBonus = new Item(allItems.GetActivatedSetBonus());

            items.Add(setBonus);

            var d3Calculator = new D3Calculator(hero, mainHand, offHand, items.ToArray());

            Console.WriteLine("Calculation results");
            var dps = d3Calculator.GetHeroDps(new List <ID3SkillModifier>(), new List <ID3SkillModifier>());

            Console.WriteLine("Dexterity : {0}", d3Calculator.GetHeroDexterity().Min);
            Console.WriteLine("DPS : {0}", dps.Min);
            Console.WriteLine("Attack speed: {0}", d3Calculator.GetActualAttackSpeed().Min);
        }
Пример #10
0
 public static async Task <Hero> CreateFromHeroIdAsync(BattleTag battleTag, string heroId)
 {
     return(await D3Api.GetHeroFromHeroIdAsync(battleTag, heroId));
 }
Пример #11
0
 public static Career CreateFromBattleTag(BattleTag battleTag)
 {
     return(D3Api.GetCareerFromBattleTag(battleTag));
 }
Пример #12
0
 private void OnNodeClick(CareerArtisan d3Object)
 {
     D3ObjectLiveUrl.Text = D3Api.GetArtisanUrlFromSlug(d3Object.Slug);
 }
Пример #13
0
 private void OnNodeClick(ItemSummary d3Object)
 {
     D3ObjectLiveUrl.Text = D3Api.GetItemUrlFromTooltipParams(d3Object.TooltipParams);
 }
Пример #14
0
 private void OnNodeClick(BNetContext <HeroSummary> d3Object)
 {
     guiBattleNetHostList.SelectedItem = hosts.FirstOrDefault(h => h.Url == d3Object.Host);
     guiBattleTag.Text    = d3Object.BattleTag.ToString();
     D3ObjectLiveUrl.Text = D3Api.GetHeroUrlFromHeroId(d3Object.BattleTag, d3Object.Data.Id);
 }
Пример #15
0
 private void OnNodeClick(BNetContext <Career> d3Object)
 {
     guiBattleNetHostList.SelectedItem = hosts.FirstOrDefault(h => h.Url == d3Object.Host);
     guiBattleTag.Text    = d3Object.BattleTag.ToString();
     D3ObjectLiveUrl.Text = D3Api.GetCareerUrl(d3Object.BattleTag);
 }