コード例 #1
0
        public ProfileRunes(Runes p, Runes s, List <Runes> runes)
        {
            p.type = Runes.RuneType.PrimarySection;
            s.type = Runes.RuneType.SecondarySection;

            this.primary   = p;
            this.secondary = s;

            primaryRunes   = new List <Runes>();
            secondaryRunes = new List <Runes>();
            shards         = new List <Runes>();

            foreach (var i in runes)
            {
                if (i.type == Runes.RuneType.Primary)
                {
                    primaryRunes.Add(i);
                }
                else if (i.type == Runes.RuneType.Secondary)
                {
                    secondaryRunes.Add(i);
                }
                else if (i.type == Runes.RuneType.Shard)
                {
                    shards.Add(i);
                }
            }
        }
コード例 #2
0
        private void autorunes(string url, bool inChampSelect, bool clickEditRune, bool clickSave, int sleepTime)
        {
            if (!windowManager.AssignWindow(LeagueOfLegendsWindowName))
            {
                return;
            }
            windowManager.SetFocus();

            ProfileRunes runes;

            runes = parser.Parse(url);

            if (clickEditRune)
            {
                clickRune(Runes.GetRune(Runes.RuneType.Button, "edit_rune"), inChampSelect, sleepTime);
            }

            clickRune(Runes.GetRune(Runes.RuneType.Button, "square"), inChampSelect, sleepTime);

            clickRune(runes.primary, inChampSelect, sleepTime);
            foreach (Runes i in runes.primaryRunes)
            {
                clickRune(i, inChampSelect, sleepTime);
            }

            bool indentLeft = false;

            if (
                Runes.GetRuneIndex(Runes.RuneType.PrimarySection, runes.primary.names[0])
                <
                Runes.GetRuneIndex(Runes.RuneType.PrimarySection, runes.secondary.names[0])
                )
            {
                indentLeft = true;
            }

            clickRune(runes.secondary, inChampSelect, sleepTime, indentLeft);
            foreach (Runes i in runes.secondaryRunes)
            {
                clickRune(i, inChampSelect, sleepTime);
            }
            foreach (Runes i in runes.shards)
            {
                clickRune(i, inChampSelect, sleepTime);
            }

            if (clickSave == true)
            {
                clickRune(Runes.GetRune(Runes.RuneType.Button, "save"), inChampSelect, sleepTime * 2);
                if (inChampSelect)
                {
                    clickRune(Runes.GetRune(Runes.RuneType.Button, "close"), inChampSelect, sleepTime);
                }
            }
        }
コード例 #3
0
        private void clickRune(Runes rune, bool isInChampSelect, int sleepTime, bool indentLeft = false)
        {
            WindowManager.Rect rect = windowManager.GetWindowPos();

            if (indentLeft)
            {
                rune.position.x -= 50;
            }

            Position convertedPos = Runes.TransferPositionResolution(rune.position, 1600, 900, rect.Right - rect.Left, rect.Bottom - rect.Top);

            if (isInChampSelect == true && !rune.position.alreadyTranslated)
            {
                convertedPos.x += (int)(0.085 * (rect.Right - rect.Left));
            }

            mouseManager.SetCursorPosition(rect.Left + convertedPos.x, rect.Top + convertedPos.y);
            mouseManager.Click();
            Thread.Sleep(sleepTime);
        }
コード例 #4
0
        public ProfileRunes Parse(string url)
        {
            WebClient client = new WebClient();

            string html = client.DownloadString(url);

            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(html);

            HtmlNodeCollection primariesNode = doc.DocumentNode.SelectNodes("//div[@class='new-runes__title']");
            string             primaryTier   = primariesNode[0].Attributes["path"].Value;
            string             secondaryTier = primariesNode[1].Attributes["path"].Value;

            HtmlNodeCollection primaryRunes   = doc.DocumentNode.SelectNodes("(//div[@class='new-runes__primary']//div[@class='new-runes__item']/span[string-length(text()) > 0])[position() < 5]");
            HtmlNodeCollection secondaryRunes = doc.DocumentNode.SelectNodes("(//div[@class='new-runes__secondary']//div[@class='new-runes__item']/span[string-length(text()) > 0])[position() < 3]");
            HtmlNodeCollection shards         = doc.DocumentNode.SelectNodes("(//div[@class='new-runes__shards']//span[@shard-type])[position() < 4]");

            List <string> primaryRuneNames   = new List <string>();
            List <string> secondaryRuneNames = new List <string>();
            List <string> shardNames         = new List <string>();

            if (primaryRunes != null)
            {
                foreach (var rune in primaryRunes)
                {
                    primaryRuneNames.Add(rune.InnerText);
                }
            }

            if (secondaryRunes != null)
            {
                foreach (var rune in secondaryRunes)
                {
                    secondaryRuneNames.Add(rune.InnerText);
                }
            }

            if (shards != null)
            {
                foreach (var shard in shards)
                {
                    shardNames.Add(shard.Attributes["shard-type"].Value);
                }
            }

            List <Runes> finalRunes = new List <Runes>();

            foreach (var i in primaryRuneNames)
            {
                Runes rune = Runes.GetRune(Runes.RuneType.Primary, i).copy();
                finalRunes.Add(rune);
            }
            foreach (var i in secondaryRuneNames)
            {
                Runes rune = Runes.GetRune(Runes.RuneType.Secondary, i).copy();
                finalRunes.Add(rune);
            }
            for (int i = 0; i < shardNames.Count; i++)
            {
                string shardName = shardNames[i].ToLower() + (i + 1);
                Runes  shard     = Runes.GetRune(Runes.RuneType.Shard, shardName).copy();
                finalRunes.Add(shard);
            }

            Runes primarySection   = Runes.GetRune(Runes.RuneType.PrimarySection, primaryTier).copy();
            Runes secondarySection = Runes.GetRune(Runes.RuneType.SecondarySection, secondaryTier).copy();

            return(new ProfileRunes(
                       primarySection,
                       secondarySection,
                       finalRunes
                       ));
        }