private async Task GetStoreData() { Data.Transfers = new List <TransferData>(); // Regex var regexTransfers = new Regex("\\\'account_transfer(.*)\\\'\\)", RegexOptions.Multiline); var regexTransferData = new Regex("rp_cost\\\":(.*?),(?:.*)name\\\":\\\"(.*?)\\\""); var regexRefunds = new Regex("credit_counter\\\">(\\d[1-3]?)<"); var regexRegion = new Regex("\\.(.*?)\\."); var storeUrl = await Connection.GetStoreUrl(); var region = regexRegion.Match(storeUrl).Groups[1]; var storeUrlMisc = string.Format("https://store.{0}.lol.riotgames.com/store/tabs/view/misc", region); var storeUrlHist = string.Format( "https://store.{0}.lol.riotgames.com/store/accounts/rental_history", region); var cookies = new CookieContainer(); Utils.GetHtmlResponse(storeUrl, cookies); var miscHtml = Utils.GetHtmlResponse(storeUrlMisc, cookies); var histHtml = Utils.GetHtmlResponse(storeUrlHist, cookies); // Transfers foreach (Match match in regexTransfers.Matches(miscHtml)) { var data = regexTransferData.Matches(match.Value); var transfer = new TransferData { Price = Int32.Parse(data[0].Groups[1].Value.Replace("\"", "")), Name = data[0].Groups[2].Value }; Data.Transfers.Add(transfer); } // Refunds credits if (regexRefunds.IsMatch(histHtml)) { Data.Refunds = Int32.Parse(regexRefunds.Match(histHtml).Groups[1].Value); } }
private async void BuyBoost() { var Boosts = Connections.GetSummonerActiveBoosts(); if (Boosts.Result.XpBoostEndDate > 0) // xpb active { return; } if (Packets.RpBalance > 260) { var url = await Connections.GetStoreUrl(); var regEx = new Regex(@"(https://).*?(?=com)\w+"); var Second = regEx.Matches(url); string uri = null; foreach (Match URRL in Second) { uri = URRL.Value; } var storeUrl = uri + "/store/tabs/view/boosts/1"; var purchaseUrl = uri + "/store/purchase/item"; HttpClient httpClient = new HttpClient(); await httpClient.GetStringAsync(url); await httpClient.GetStringAsync(storeUrl); List <KeyValuePair <string, string> > storeItemList = new List <KeyValuePair <string, string> >(); storeItemList.Add(new KeyValuePair <string, string>("item_id", "boosts_2")); storeItemList.Add(new KeyValuePair <string, string>("currency_type", "rp")); storeItemList.Add(new KeyValuePair <string, string>("quantity", "1")); storeItemList.Add(new KeyValuePair <string, string>("rp", "260")); storeItemList.Add(new KeyValuePair <string, string>("ip", "null")); storeItemList.Add(new KeyValuePair <string, string>("duration_type", "PURCHASED")); storeItemList.Add(new KeyValuePair <string, string>("duration", "3")); HttpContent httpContent = new FormUrlEncodedContent(storeItemList); await httpClient.PostAsync(purchaseUrl, httpContent); Client.Status("Bought XP boost!", AccountName); httpClient.Dispose(); } }