Example #1
0
        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();
            }
        }