示例#1
0
        public static void lolskilllookup(string name)
        {
            Console.WriteLine("[EloSharp] LOLSkill FOR: " + name);
            Ranksloading = new List <Infoloading>();
            Playerz      = new List <heros>();
            //Get raw information
            string regiontag = Misc.RegionTag;

            try
            {
                string htmlcode =
                    new WebClient().DownloadString("http://www.lolskill.net/game/" + regiontag + "/" + name);

                //System.IO.File.WriteAllText(@"C:\Users\Laptop\Desktop\lolnexus.txt", htmlcode); // Testing purposes
                //Extract information
                foreach (
                    Match playerregex in
                    new Regex("<div class=\"summonername\"><a href=\"summoner/" + regiontag + "/(.*?)\">(.*?)</a></div>")
                    .Matches(htmlcode))
                {
                    heros p              = new heros();
                    Match playername     = new Regex(playerregex.Groups[2].ToString()).Matches(htmlcode)[0];
                    Match playernamehtml = new Regex(playerregex.Groups[1].ToString()).Matches(htmlcode)[0];
                    p.Name     = playername.ToString();
                    p.Htmlname = playernamehtml.ToString();
                    Playerz.Add(p);
                }

                foreach (heros p in Playerz)
                {
                    Match htmlmatchinfo = new Regex("<div class=\"summonername\"><a href=\"summoner/" + regiontag + "/" + p.Htmlname + "\">" + p.Name + "</a></div>").Matches(htmlcode)[0];

                    string foundheroinfo = htmlmatchinfo.ToString();
                    string endofheroinfo = "</table>";
                    string inbetween     = Misc.ExtractString(htmlcode, foundheroinfo, endofheroinfo);
                    string rankedwins    = Misc.ExtractString(inbetween, "<b>Ranked Wins:", "</b><br>");
                    string soloqrank     = Misc.StripHTML(Misc.ExtractString(inbetween, "is currently ranked <b>", "</b> in SoloQueue"));
                    string soloqlp       = Misc.StripHTML(Misc.ExtractString(inbetween, "and has <b>", "</b> League Points"));
                    //   string checkseries = EloSharp.StripHTML(Misc.ExtractString(inbetween, " <span class=\\\"series\\\">Series", "<td class=\\\"normal-wins\\\">"));
                    // string fixedcheckseries = checkseries.Replace("\\r\\n", string.Empty).Replace(" ", string.Empty);
                    // string fixedseries = fixseries(fixedcheckseries.ToLower());

                    string   runesfixed = Misc.ExtractString(inbetween, "<b>Runes:</b><br>", "<br><br><br><b>");
                    char[]   delimiters = { '+', '(', '-' };
                    string[] runes      = runesfixed.Split(delimiters);

                    Match  namechamp        = new Regex("title=\"&raquo;" + p.Name + "&laquo; has a LolSkillScore of <b>(.*?)</b> with (.*?)<br>").Matches(htmlcode)[0];
                    string champname        = namechamp.ToString();
                    string champnamefix     = champname.Replace("&#x27;", string.Empty);
                    string currentmasteries = Misc.StripHTML(Misc.ExtractString(inbetween, "<b>Masteries:</b><br>", "<br><br><i>"));
                    string kda                = Misc.StripHTML(Misc.ExtractString(inbetween, "<td class=\\\"champion-kda\\\">\\r\\n    \\r\\n", "</span></td>\\r\\n"));
                    string champtotal         = Misc.StripHTML(Misc.ExtractString(inbetween, "</b> out of <b>", "</b> games with"));
                    string performance        = Misc.StripHTML(Misc.ExtractString(inbetween, "has performed <b>", "</b>than the average"));
                    string champwins          = Misc.ExtractString(inbetween, "title=\"&raquo;" + p.Name + "&laquo; has won <b>", "</b> out of");
                    string champwinrate       = Misc.ExtractString(inbetween, "That's a winrate of <b>", "</b>");
                    string winloss            = Misc.ExtractString(inbetween, "<td class=\"stat green\">", "<span class=\"small\">");
                    string kills              = Misc.ExtractString(inbetween, "has killed <b>", "</b> enemy champions per game");
                    string deaths             = Misc.ExtractString(inbetween, "has died <b>", "</b> times per game");
                    string assists            = Misc.ExtractString(inbetween, "has had <b>", "</b> assists per game");
                    string champnameforbitmap = champnamefix.ToLower().Replace(" ", "");
                    //Console.WriteLine(champnameforbitmap);
                    Bitmap spritechamp = Misc.champbitmap(champnameforbitmap);

                    Infoloading infoloading = new Infoloading();
                    infoloading.Name             = p.Name;
                    infoloading.rankedwins       = rankedwins;
                    infoloading.soloqrank        = soloqrank;
                    infoloading.soloqlp          = soloqlp; // LolSkill exclusive
                    infoloading.currentrunes     = runes;
                    infoloading.currentmasteries = currentmasteries;
                    infoloading.champtotal       = champtotal;
                    infoloading.kda         = kda;
                    infoloading.champsprite = spritechamp;
                    infoloading.champname   = champnamefix;
                    // infoloading.seriescheck = fixedseries;
                    infoloading.performance  = performance;  // LolSkill exclusive
                    infoloading.champwins    = champwins;    // LolSkill exclusive
                    infoloading.champwinrate = champwinrate; // LolSkill exclusive
                    infoloading.winloss      = winloss;      // LolSkill exclusive
                    infoloading.kills        = kills;        // LolSkill exclusive
                    infoloading.deaths       = deaths;       // LolSkill exclusive
                    infoloading.assists      = assists;      // LolSkill exclusive
                    Ranksloading.Add(infoloading);
                }
            }
            catch (Exception e)
            {
                Console.Write("Exception" + e);
            }
        }
示例#2
0
        private static void Drawing_OnEndScene(EventArgs args)
        {
            if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed || Game.Mode != GameMode.Running)
            {
                return;
            }
            try
            {
                if (Sprite.IsDisposed)
                {
                    return;
                }
                if (Misc.getsetwebsite() == "lolnexus")
                {
                    foreach (Lolnexus.Infoloading infoloading in Lolnexus.Ranksloading.ToList())
                    {
                        var indicator = new Misc.HpBarIndicator {
                            Unit = infoloading.herohandle
                        };
                        X = (int)indicator.Position.X;
                        Y = (int)indicator.Position.Y;
                        var startX = X + 50;
                        var startY = Y - 60;
                        if (Misc.Config.Item("enablerank").GetValue <bool>())
                        {
                            Text.DrawText(null, infoloading.soloqrank, startX + (15 - infoloading.soloqrank.Length * 4) / 2, startY, Misc.ColorRank(infoloading.soloqrank));
                        }

                        if (Misc.Config.Item("enablekdaratio").GetValue <bool>())
                        {
                            Text.DrawText(
                                null, "KDA: " + infoloading.kda,
                                startX + (15 - infoloading.soloqrank.Length * 4) / 2, startY + 15, Misc.ColorRank(infoloading.soloqrank));
                        }
                    }
                }

                if (Misc.getsetwebsite() == "lolskill")
                {
                    foreach (LolSkill.Infoloading infoloading in LolSkill.Ranksloading.ToList())
                    {
                        var indicator = new Misc.HpBarIndicator {
                            Unit = infoloading.herohandle
                        };
                        X = (int)indicator.Position.X;
                        Y = (int)indicator.Position.Y;
                        var startX = X + 50;
                        var startY = Y - 60;
                        Text.DrawText(
                            null, infoloading.soloqrank, startX + (15 - infoloading.soloqrank.Length * 4) / 2,
                            startY + 6, Misc.ColorRank(infoloading.soloqrank));
                    }
                }

                if (Misc.getsetwebsite() == "opgg")
                {
                    foreach (OPGGLIVE.Info info in OPGGLIVE.Ranks)
                    {
                        var indicator = new Misc.HpBarIndicator {
                            Unit = info.herohandle
                        };
                        X = (int)indicator.Position.X;
                        Y = (int)indicator.Position.Y;
                        var startX = X + 50;
                        var startY = Y - 70;
                        if (Misc.Config.Item("enablerank").GetValue <bool>())
                        {
                            Text.DrawText(
                                null, info.Ranking, startX + (15 - info.Ranking.Length * 4) / 2, startY + 5,
                                Misc.ColorRank(info.Ranking));
                        }
                        if (Misc.Config.Item("enablewinratio").GetValue <bool>())
                        {
                            Text.DrawText(
                                null, "Ranked: " + info.rankedwinrate + " (" + info.rankedwins + " wins)",
                                startX + (15 - info.Ranking.Length * 4) / 2, startY + 20, Misc.ColorRank(info.Ranking));
                        }
                        if (Misc.Config.Item("enablekdaratio").GetValue <bool>())
                        {
                            Text.DrawText(
                                null, "Champ: " + info.champwinrate + " (" + info.kda + " KDA)",
                                startX + (15 - info.Ranking.Length * 4) / 2, startY + 35, Misc.ColorRank(info.Ranking));
                        }
                    }
                }
            }

            catch (Exception e)
            {
                Console.WriteLine(@"Error drawing text overheads " + e);
            }
        }
示例#3
0
文件: OPGG.cs 项目: wade1990/PortAIO
        public OPGG()
        {
            Ranks = new List <Info>();

            foreach (var hero in ObjectManager.Get <AIHeroClient>())
            {
                Info   info          = new Info();
                string playerNameEnc = HttpUtility.UrlEncode(hero.Name);
                if (Misc.getregionurl() != "Not Supported" && Misc.getregionurl().Contains("op.gg"))
                {
                    string htmlcode = "";
                    var    request  =
                        (HttpWebRequest)WebRequest.Create(Misc.getregionurl() + "summoner/userName="******"Response OK FOR: " + playerNameEnc);
                        //  System.IO.File.WriteAllText(@"C:\Users\Laptop\Desktop\" + hero.Name + ".txt", htmlcode);
                    }
                    else if (response.StatusCode != HttpStatusCode.OK)
                    {
                        Chat.Print("ERROR"); //Console.WriteLine("ERROR: " + playerNameEnc);
                        htmlcode = "ErrorHTTPSTATUS: " + playerNameEnc;
                    }
                    if (htmlcode.Contains("ErrorHTTPSTATUS"))
                    {
                        Console.WriteLine("Http Error: " + htmlcode);
                        info.Name       = hero.Name;
                        info.herohandle = hero;
                        info.Ranking    = "HTTPERROR";
                        info.lpamount   = "";
                        Ranks.Add(info);
                    }
                    if (htmlcode.Contains("tierRank") && htmlcode.Contains("leaguePoints"))
                    {
                        try
                        {
                            Match htmlmatchrank =
                                new Regex(@"\<span class=\""tierRank\"">(.*?)</span>").Matches(htmlcode)[0];
                            Match htmlmatchlp =
                                new Regex(@"\<span class=\""leaguePoints\"">(.*?)</span>").Matches(htmlcode)[0];
                            Match playerrank = new Regex(htmlmatchrank.Groups[1].ToString()).Matches(htmlcode)[0];
                            Match playerlp   = new Regex(htmlmatchlp.Groups[1].ToString()).Matches(htmlcode)[0];
                            rank = playerrank.ToString();
                            if (Misc.Config.Item("printranks").GetValue <bool>() && hero.IsAlly)
                            {
                                Chat.Print("<font color=\"#FF000\"><b>" + hero.ChampionName +
                                           "</font> <font color=\"#FFFFFF\">(" + hero.Name + ")" + " : " + rank);
                            }
                            if (Misc.Config.Item("printranks").GetValue <bool>() && hero.IsEnemy)
                            {
                                Chat.Print("<font color=\"#FF0000\"><b>" + hero.ChampionName +
                                           "</font> <font color=\"#FFFFFF\">(" + hero.Name + ")" + " : " + rank);
                            }
                            info.Name       = hero.Name;
                            info.herohandle = hero;
                            info.Ranking    = rank;
                            info.lpamount   = playerlp.ToString();
                            Ranks.Add(info);
                            Console.WriteLine("Added info" + hero.Name + info.Ranking);
                        }
                        catch (Exception)
                        {
                            info.Name       = hero.Name;
                            info.herohandle = hero;
                            info.Ranking    = "Exception";
                            info.lpamount   = "";
                            Ranks.Add(info);
                            Console.WriteLine("Exception in 1st");
                        }
                    }
                    if (!htmlcode.Contains("ChampionBox Unranked") &&
                        (htmlcode.Contains("tierRank")) && !htmlcode.Contains("leaguePoints"))
                    {
                        try
                        {
                            rank = "Unranked";
                            if (Misc.Config.Item("printranks").GetValue <bool>() && hero.IsAlly)
                            {
                                Chat.Print("<font color=\"#FF000\"><b>" + hero.ChampionName +
                                           "</font> <font color=\"#FFFFFF\">(" + hero.Name + ")" + " : " + rank);
                            }
                            if (Misc.Config.Item("printranks").GetValue <bool>() && hero.IsEnemy)
                            {
                                Chat.Print("<font color=\"#FF0000\"><b>" + hero.ChampionName +
                                           "</font> <font color=\"#FFFFFF\">(" + hero.Name + ")" + " : " + rank);
                            }

                            info.Name       = hero.Name;
                            info.herohandle = hero;
                            info.Ranking    = rank;
                            info.lpamount   = "";
                            Ranks.Add(info);
                            Console.WriteLine("Added info" + hero.Name + info.Ranking);
                        }
                        catch (Exception)
                        {
                            info.Name       = hero.Name;
                            info.herohandle = hero;
                            info.Ranking    = "Exception";
                            info.lpamount   = "";
                            Ranks.Add(info);
                            Console.WriteLine("Exception in 4th");
                        }
                    }
                    if (htmlcode.Contains("tierRank") && !htmlcode.Contains("leaguePoints") &&
                        (htmlcode.Contains("ChampionBox Unranked")))
                    {
                        try
                        {
                            Match htmlmatchrank =
                                new Regex(@"\<span class=\""tierRank\"">(.*?)</span>").Matches(htmlcode)[0];
                            Match playerrank = new Regex(htmlmatchrank.Groups[1].ToString()).Matches(htmlcode)[0];

                            rank = "Unranked (L-30)";
                            if (Misc.Config.Item("printranks").GetValue <bool>() && hero.IsAlly)
                            {
                                Chat.Print("<font color=\"#FF000\"><b>" + hero.ChampionName +
                                           "</font> <font color=\"#FFFFFF\">(" + hero.Name + ")" + " : " + rank);
                            }
                            if (Misc.Config.Item("printranks").GetValue <bool>() && hero.IsEnemy)
                            {
                                Chat.Print("<font color=\"#FF0000\"><b>" + hero.ChampionName +
                                           "</font> <font color=\"#FFFFFF\">(" + hero.Name + ")" + " : " + rank);
                            }
                            info.Name       = hero.Name;
                            info.herohandle = hero;
                            info.Ranking    = rank;
                            info.lpamount   = "";
                            Ranks.Add(info);
                            Console.WriteLine("Added info" + hero.Name + info.Ranking);
                        }
                        catch (Exception)
                        {
                            info.Name       = hero.Name;
                            info.herohandle = hero;
                            info.Ranking    = "Exception";
                            info.lpamount   = "";
                            Ranks.Add(info);
                            Console.WriteLine("Exception in 2nd");
                        }
                    }
                    if ((htmlcode.Contains("ChampionBox Unranked") &&
                         !htmlcode.Contains("leaguePoints") && (!htmlcode.Contains("tierRank"))))
                    {
                        try
                        {
                            rank = "Unranked";
                            if (Misc.Config.Item("printranks").GetValue <bool>() && hero.IsAlly)
                            {
                                Chat.Print("<font color=\"#FF000\"><b>" + hero.ChampionName +
                                           "</font> <font color=\"#FFFFFF\">(" + hero.Name + ")" + " : " + rank);
                            }
                            if (Misc.Config.Item("printranks").GetValue <bool>() && hero.IsEnemy)
                            {
                                Chat.Print("<font color=\"#FF0000\"><b>" + hero.ChampionName +
                                           "</font> <font color=\"#FFFFFF\">(" + hero.Name + ")" + " : " + rank);
                            }


                            info.Name       = hero.Name;
                            info.herohandle = hero;
                            info.Ranking    = "Unranked";
                            info.lpamount   = "";
                            Ranks.Add(info);
                            Console.WriteLine("Added info" + hero.Name + info.Ranking);
                        }
                        catch (Exception)
                        {
                            info.Name       = hero.Name;
                            info.herohandle = hero;
                            info.Ranking    = "Exception";
                            info.lpamount   = "";
                            Ranks.Add(info);
                            Console.WriteLine("Exception in 3rd");
                        }
                    }



                    if (!htmlcode.Contains("ChampionBox Unranked") &&
                        (!htmlcode.Contains("tierRank")))
                    {
                        try
                        {
                            rank = "Error";
                            if (Misc.Config.Item("printranks").GetValue <bool>() && hero.IsAlly)
                            {
                                Chat.Print("<font color=\"#FF000\"><b>" + hero.ChampionName +
                                           "</font> <font color=\"#FFFFFF\">(" + hero.Name + ")" + " : " + rank);
                            }
                            if (Misc.Config.Item("printranks").GetValue <bool>() && hero.IsEnemy)
                            {
                                Chat.Print("<font color=\"#FF0000\"><b>" + hero.ChampionName +
                                           "</font> <font color=\"#FFFFFF\">(" + hero.Name + ")" + " : " + rank);
                            }

                            info.Name       = hero.Name;
                            info.herohandle = hero;
                            info.Ranking    = rank;
                            info.lpamount   = "";
                            Ranks.Add(info);
                            Console.WriteLine("Added info" + hero.Name + info.Ranking);
                        }
                        catch (Exception)
                        {
                            info.Name       = hero.Name;
                            info.herohandle = hero;
                            info.Ranking    = "Exception";
                            info.lpamount   = "";
                            Ranks.Add(info);
                            Console.WriteLine("Exception in 4th");
                        }
                    }


                    if ((Misc.Config.Item("enablekdaratio").GetValue <bool>()) ||
                        (Misc.Config.Item("enablewinratio").GetValue <bool>()))
                    {
                        //Console.WriteLine("Starting Debug");
                        string data = "";
                        request =
                            (HttpWebRequest)
                            WebRequest.Create(Misc.getregionurl() + "summoner/champions/userName="******"summoner/champions/userName=Chief Raydere");
                        response = (HttpWebResponse)request.GetResponse();

                        if (response.StatusCode == HttpStatusCode.OK)
                        {
                            Stream       receiveStream = response.GetResponseStream();
                            StreamReader readStream    = null;

                            if (response.CharacterSet == null)
                            {
                                readStream = new StreamReader(receiveStream);
                            }
                            else
                            {
                                readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
                            }

                            data = readStream.ReadToEnd();

                            response.Close();
                            readStream.Close();
                        }


                        if (data.Contains("__spc24 __spc24-" + championid(hero) + "\""))
                        {
                            int    index     = data.IndexOf("__spc24 __spc24-" + championid(hero) + "\"");
                            String htmlstats = data.Remove(0, index);
                            index     = htmlstats.IndexOf("gold");
                            htmlstats = htmlstats.Substring(0, index);

                            Match htmlmatchwinRatio =
                                new Regex(@"\<span class=\""winRatio\"">(.*?)</span>").Matches(htmlstats)[0];
                            Match htmlmatchkill =
                                new Regex(@"\<span class=\""kill\"">(.*?)</span>").Matches(htmlstats)[0];
                            Match htmlmatchdeath =
                                new Regex(@"\<span class=\""death\"">(.*?)</span>").Matches(htmlstats)[0];
                            Match htmlmatchassist =
                                new Regex(@"\<span class=\""assist\"">(.*?)</span>").Matches(htmlstats)[0];
                            Match htmlmatchkdaratio =
                                new Regex(@"\<span class=\""kdaratio\"">(.*?)</span>").Matches(htmlstats)[0];

                            Match winRatio = new Regex(htmlmatchwinRatio.Groups[1].ToString()).Matches(htmlstats)[0];
                            Match kill     = new Regex(htmlmatchkill.Groups[1].ToString()).Matches(htmlstats)[0];
                            Match death    = new Regex(htmlmatchdeath.Groups[1].ToString()).Matches(htmlstats)[0];
                            Match assist   = new Regex(htmlmatchassist.Groups[1].ToString()).Matches(htmlstats)[0];
                            Match kdaratio = new Regex(htmlmatchkdaratio.Groups[1].ToString()).Matches(htmlstats)[0];

                            index     = htmlstats.IndexOf("wins");
                            htmlstats = htmlstats.Remove(0, (index + 6));
                            index     = htmlstats.IndexOf("</span>");
                            String wins = htmlstats.Substring(0, index);
                            wins = wins.Trim();
                            int Length = wins.Length;
                            wins = wins.Substring(0, Length - 1);

                            index     = htmlstats.IndexOf("losses");
                            htmlstats = htmlstats.Remove(0, (index + 8));
                            index     = htmlstats.IndexOf("</span>");
                            String losses = htmlstats.Substring(0, index);
                            losses = losses.Trim();
                            Length = losses.Length;
                            losses = losses.Substring(0, Length - 1);

                            String winratioString = ("Win Ratio (champ) = " + winRatio + " (" + wins + "/" + losses +
                                                     ")");

                            String kdaString = ("KDA = " + kdaratio + " (" + kill + "K + " + assist + "A / " + death +
                                                "D)");


                            if (kdaratio.ToString().Contains("."))
                            {
                                index = kdaratio.ToString().IndexOf(".");
                            }

                            else
                            {
                                index = kdaratio.ToString().IndexOf(":");
                            }
                            String kdaratio2     = kdaratio.ToString().Substring(0, index);
                            int    kdaratiocolor = 0;

                            if (Int32.TryParse(kdaratio2, out kdaratiocolor))
                            {
                                //Console.WriteLine(kdaratiocolor);
                                if (kdaratiocolor > 8)
                                {
                                    info.kdaratiocolor = Color.Orange; //Challenger
                                }
                                if (kdaratiocolor >= 6 && kdaratiocolor < 8)
                                {
                                    info.kdaratiocolor = Color.LimeGreen; //Master
                                }
                                if (kdaratiocolor >= 4 && kdaratiocolor < 6)
                                {
                                    info.kdaratiocolor = Color.Cyan; //Diamond
                                }
                                if (kdaratiocolor >= 3 && kdaratiocolor < 4)
                                {
                                    info.kdaratiocolor = Color.DeepSkyBlue; //Platinum
                                }
                                if (kdaratiocolor >= 2 && kdaratiocolor < 3)
                                {
                                    info.kdaratiocolor = Color.Gold; //Gold
                                }
                                if (kdaratiocolor >= 1 && kdaratiocolor < 2)
                                {
                                    info.kdaratiocolor = Color.Silver; //Silver
                                }
                                if (kdaratiocolor < 1)
                                {
                                    info.kdaratiocolor = Color.SandyBrown; //Bronze
                                }
                            }

                            string stringwinratio       = winRatio.ToString();
                            string winrateremovepercent = stringwinratio.Replace("%", "");
                            double winratio             = Convert.ToInt32(winrateremovepercent);
                            info.winratiocolor = colorwinratio(winratio);
                            info.winratio      = winratioString;
                            info.kdaratio      = kdaString;
                            Ranks.Add(info);
                        }
                        else
                        {
                            info.winratio      = "error";
                            info.kdaratio      = "error";
                            info.winratiocolor = Color.White;
                            Ranks.Add(info);
                        }
                    }
                }
            }
        }
示例#4
0
        public static void DrawLoading()
        {
            try
            {
                var screenheight = Drawing.Height;
                var screenwidth  = Drawing.Width;

                if (Lolnexus.Ranksloading != null && Misc.getsetwebsite() == "lolnexus")
                {
                    foreach (Lolnexus.Infoloading infoloading in Lolnexus.Ranksloading)
                    {
                        int indexof = 0;
                        indexof = Lolnexus.Ranksloading.IndexOf(infoloading);
                        bool isTop = indexof < 5;

                        /*
                         * if (Misc.Config.Item("drawicons").GetValue<bool>())
                         * {
                         *  Drawsprite(
                         *      infoloading.champsprite, Newspriteposition(xformula, ystart),
                         *      Newspriteposition(xformula - 20, ystart + 5));
                         * }
                         * */

                        RenderText(
                            Misc.FormatString(infoloading.Name) + " " + infoloading.seriescheck, isTop, indexof, 15,
                            Color2.White);

                        RenderText(infoloading.soloqrank, isTop, indexof, 35, Misc.rankincolorls(infoloading.soloqrank));

                        RenderText(
                            infoloading.champname + " Games: " + infoloading.champtotal, isTop, indexof, 55, Color2.Red);

                        RenderText("Ranked wins: " + infoloading.rankedwins, isTop, indexof, 75, Color2.White);

                        RenderText("KDA: " + infoloading.kda, isTop, indexof, 95, Color2.Red);

                        RenderText("Masteries: " + infoloading.currentmasteries, isTop, indexof, 115, Color2.White);

                        int runescount = infoloading.currentrunes.Length;

                        RenderText("Runes: " + Misc.StripHTML(infoloading.currentrunes[0]), isTop, indexof, 135, Color2.Red);

                        for (int i = 1; i < runescount; i++)
                        {
                            RenderText(
                                "" + Misc.StripHTML(infoloading.currentrunes[i]), isTop, indexof, 135 + (i * 20),
                                Color2.White);
                        }
                    }
                }

                if (LolSkill.Ranksloading != null && Misc.getsetwebsite() == "lolskill")
                {
                    foreach (LolSkill.Infoloading infoloading in LolSkill.Ranksloading)
                    {
                        int indexof = 0;
                        indexof = LolSkill.Ranksloading.IndexOf(infoloading);
                        bool isTop    = indexof < 5;
                        int  ystart   = isTop ? 15 : 411;
                        int  xformula = isTop ? 210 + (indexof * 200) : 210 + ((indexof - 5) * 200);

                        /*
                         * Drawsprite(
                         *  infoloading.champsprite, Newspriteposition(xformula, ystart),
                         *  Newspriteposition(xformula - 20, ystart + 5));
                         * */

                        RenderText(
                            Misc.FormatString(infoloading.Name) + " " + infoloading.seriescheck, isTop, indexof, 15,
                            Color2.White);

                        RenderText(infoloading.soloqrank, isTop, indexof, 35, Misc.rankincolorls(infoloading.soloqrank));

                        RenderText(
                            infoloading.champname + " Games: " + infoloading.champtotal, isTop, indexof, 55, Color2.Red);

                        RenderText("Ranked wins: " + infoloading.rankedwins, isTop, indexof, 75, Color2.White);

                        RenderText("KDA: " + infoloading.kda, isTop, indexof, 95, Color2.Red);

                        RenderText("Masteries: " + infoloading.currentmasteries, isTop, indexof, 115, Color2.White);

                        int runescount = infoloading.currentrunes.Length;

                        RenderText("Runes: " + Misc.StripHTML(infoloading.currentrunes[0]), isTop, indexof, 135, Color2.Red);

                        for (int i = 1; i < runescount; i++)
                        {
                            RenderText(
                                "" + Misc.StripHTML(infoloading.currentrunes[i]), isTop, indexof, 135 + (i * 20),
                                Color2.White);
                        }
                        return;
                    }
                }

                if (OPGGLIVE.Ranks != null && OPGGLIVE.Ranks.Any() && Misc.getsetwebsite() == "opgg")
                {
                    foreach (var hero in OPGGLIVE.Ranks)
                    {
                        int indexof = 0;
                        indexof = OPGGLIVE.Ranks.IndexOf(hero);
                        bool isTop    = indexof < 5;
                        int  ystart   = isTop ? 15 : 411;
                        int  xformula = isTop ? 210 + (indexof * 200) : 210 + ((indexof - 5) * 200);

                        //  Drawsprite(
                        //   hero.champsprite, Newspriteposition(xformula, ystart),
                        // Newspriteposition(xformula - 20, ystart + 5));


                        RenderText(
                            Misc.FormatString(hero.Name) + " ", isTop, indexof, 15,
                            Color2.White);

                        RenderText(hero.Ranking, isTop, indexof, 35, Misc.rankincolorls(hero.Ranking));

                        RenderText("Ranked Wins: " + hero.rankedwins, isTop, indexof, 55, Color2.White);

                        RenderText("Ranked Win Ratio: " + hero.rankedwinrate, isTop, indexof, 75, Color2.White);

                        RenderText(hero.champname + " Games: " + hero.champtotal, isTop, indexof, 95, Color2.Red);

                        RenderText("Champ Win Ratio: " + hero.champwinrate, isTop, indexof, 115, Color2.White);

                        RenderText("KDA: " + hero.kda, isTop, indexof, 135, Color2.Red);
                    }
                    return;
                }
            }
            catch (Exception e)
            {
                Console.Write("Exception in DrawLoading" + e);
            }
        }
示例#5
0
        public static void lolnexuslookup(string name, string region)
        {
            Ranksloading = new List <Infoloading>();
            Playerz      = new List <heros>();
            string lxregion = Misc.sortedregion();

            try
            {
                //Get raw information
                string htmlcode =
                    new WebClient().DownloadString("http://www.lolnexus.com/ajax/get-game-info/" + region + ".json?name=" + name);
                System.IO.File.WriteAllText(@"C:\Users\Laptop\Desktop\lolnexus.txt", htmlcode); // Testing purposes
                //Extract information
                foreach (
                    Match playerregex in
                    new Regex("href=\\\\\"http://" + lxregion + ".op.gg/summoner/userName=(.*?)\\\\\" target=\\\\\"outbound\\\\\"")
                    .Matches(htmlcode))
                {
                    heros p          = new heros();
                    Match playername = new Regex(playerregex.Groups[1].ToString()).Matches(htmlcode)[0];
                    p.Name = playername.ToString();


                    Playerz.Add(p);
                }

                foreach (heros p in Playerz)
                {
                    Match htmlmatchinfo =
                        new Regex("href=\\\\\"http://" + Misc.sortedregion() + ".op.gg/summoner/userName="******"\\\\\" target=\\\\\"outbound\\\\\"").Matches(htmlcode)[0];
                    string foundheroinfo    = htmlmatchinfo.ToString();
                    string endofheroinfo    = "\\n             </a>\\r\\n         </td>\\r\\n  \\r\\n</tr>";
                    string inbetween        = Misc.ExtractString(htmlcode, foundheroinfo, endofheroinfo);
                    string rankedwins       = Misc.ExtractString(inbetween, "<span class=\\\"ranked-wins\\\">", "</span>\\r\\n");
                    string soloqrank        = Misc.StripHTML(Misc.ExtractString(inbetween, "<div class=\\\"ranking\\\">\\r\\n", "</span>\\r\\n"));
                    string checkseries      = Misc.StripHTML(Misc.ExtractString(inbetween, " <span class=\\\"series\\\">Series", "<td class=\\\"normal-wins\\\">"));
                    string fixedcheckseries = checkseries.Replace("\\r\\n", string.Empty).Replace(" ", string.Empty);
                    string fixedseries      = fixseries(fixedcheckseries.ToLower());
                    string runesfixed       = Misc.ExtractString(inbetween, "class=\\\"tooltip-html\\\"><div><h2>", "</span>\\r\\n");

                    char[]   delimiters   = { '+', '(', '-' };
                    string[] runes        = runesfixed.Split(delimiters);
                    string   champname    = Misc.StripHTML(Misc.ExtractString(inbetween, "</div>\\r\\n\\r\\n        <span>", "\\r\\n        \\r\\n"));
                    string   champnamefix = champname.Replace("&#x27;", string.Empty);

                    string currentmasteries = Misc.StripHTML(Misc.ExtractString(inbetween, "<span class=\\\"offense\\\">", "</span>\\r"));
                    string kda        = Misc.StripHTML(Misc.ExtractString(inbetween, "<td class=\\\"champion-kda\\\">\\r\\n    \\r\\n", "</span></td>\\r\\n"));
                    string champtotal = Misc.StripHTML(Misc.ExtractString(inbetween, "<h2>Champion Games</h2>The number of games played with this champion.\\\">", "</b>)</span>"));

                    string champnameforbitmap = champnamefix.ToLower().Replace(" ", "");
                    Game.PrintChat(champnameforbitmap);
                    //Console.WriteLine(champnameforbitmap);
                    Bitmap spritechamp = Misc.champbitmap(champnameforbitmap);

                    Infoloading infoloading = new Infoloading();
                    infoloading.Name             = p.Name;
                    infoloading.rankedwins       = rankedwins;
                    infoloading.soloqrank        = soloqrank;
                    infoloading.currentrunes     = runes;
                    infoloading.currentmasteries = currentmasteries;
                    infoloading.champtotal       = champtotal;
                    infoloading.kda         = kda;
                    infoloading.champsprite = spritechamp;
                    infoloading.champname   = champnamefix;
                    infoloading.seriescheck = fixedseries;
                    Ranksloading.Add(infoloading);
                    Console.WriteLine("End of lookup function");
                }
            }
            catch (Exception e)
            {
                Console.Write("Exception" + e);
            }
        }