Esempio n. 1
0
        public async Task UploadItemSet(Position pos, int championId)
        {
            LogTo.Debug("Trying to upload item set");

            var provider = RuneProviders.FirstOrDefault(o => o.Name == Config.ItemSetProvider) ?? RuneProviders[0];
            var set      = await provider.GetItemSet(championId, pos);

            if (set == null)
            {
                LogTo.Error("Failed to get item set from {0}", provider.Name);
                return;
            }

            LogTo.Info("Gotten item set from {0}", provider.Name);

            if (Config.ShowSkillOrder)
            {
                if (!provider.Supports(Provider.Options.SkillOrder))
                {
                    LogTo.Error("Tried to upload skill order but selected provider doesn't support it");
                }
                else
                {
                    LogTo.Debug("Appending skill order block to item set");

                    var order = await provider.GetSkillOrder(championId, pos);

                    var blocks = new List <ItemSet.SetBlock>(set.Blocks);

                    blocks.Insert(0, new ItemSet.SetBlock
                    {
                        Name  = "Skill order: " + order,
                        Items = SkillOrderBlockContent
                    });

                    set.Blocks = blocks.ToArray();

                    if (order.Contains(' '))
                    {
                        set.Name += " " + order.Split(' ')[0];
                    }
                }
            }

            LogTo.Debug("Uploading item set");
            await set.UploadToClient(LoL.Login, LoL.ItemSets);

            LogTo.Debug("Uploaded item set");

            Main.ShowNotification("Upload item set",
                                  string.Format("From {0}", provider.Name), NotificationType.Success);
        }
Esempio n. 2
0
        public async Task UploadSkillOrder(Position pos, int championId)
        {
            LogTo.Debug("Trying to upload skill order");

            var provider = RuneProviders.FirstOrDefault(o => o.Name == Config.Current.SkillOrderProvider)
                           ?? RuneProviders.First(o => o.Supports(Provider.Options.SkillOrder));

            if (!provider.Supports(Provider.Options.SkillOrder))
            {
                LogTo.Error("Provider {0} doesn't support skill order", provider.Name);
                return;
            }

            LogTo.Debug("Getting skill order from provider {0}", provider.Name);

            var order = await provider.GetSkillOrder(championId, pos);

            LogTo.Info("Gotten skill order from {0}: {1}", provider.Name, order);

            var set = new ItemSet
            {
                Name     = "Skill order" + (order.Contains(' ') ? " " + order.Split(' ')[0] : ""),
                Champion = championId,
                Blocks   = new[]
                {
                    new ItemSet.SetBlock
                    {
                        Name  = "Skill order: " + order,
                        Items = SkillOrderBlockContent
                    }
                }
            };

            LogTo.Debug("Uploading skill order item set");
            await set.UploadToClient(LoL.Login, LoL.ItemSets);

            LogTo.Debug("Uploaded skill order");
        }