Ejemplo n.º 1
0
        private async Task <Tuple <bool, bool> > CheckForDodge()
        {
            await Task.Delay(4000);

            while (true)
            {
                var isInLobby = await lc.MakeApiRequest(HttpMethod.Get, "/lol-champ-select/v1/session");

                if (isInLobby.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var info = JsonConvert.DeserializeObject <InGameModel>(await isInLobby.Content.ReadAsStringAsync());
                    if (info.Timer.Phase == "GAME_STARTING")
                    {
                        return(new Tuple <bool, bool>(false, false));
                    }
                }
                else
                {
                    var lobbyInfo = await lc.MakeApiRequest(HttpMethod.Get, "/lol-lobby/v2/lobby");

                    if (lobbyInfo.StatusCode == HttpStatusCode.OK)
                    {
                        return(new Tuple <bool, bool>(true, true));
                    }
                    else
                    {
                        return(new Tuple <bool, bool>(true, false));
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public async void JoinGame(long enemy, string match)
        {
            ILeagueClient league = await LeagueClient.Connect();

            while (true)
            {
                var response = await league.MakeApiRequest(HttpMethod.Get, "/lol-lobby/v2/received-invitations");

                var invites = JsonConvert.DeserializeObject <List <InviteModel> >(await response.Content.ReadAsStringAsync());

                foreach (var item in invites)
                {
                    if (item.FromSummonerId == enemy)
                    {
                        await league.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v2/received-invitations/" + item.InvitationId + "/accept");

                        System.Net.Http.HttpClient http = new System.Net.Http.HttpClient();
                        var data = await http.GetAsync("http://matchmakingapi.azurewebsites.net/oneVone/KillMatch?match=" + match);

                        break;
                    }
                }
                Thread.Sleep(100);
            }
        }
Ejemplo n.º 3
0
        public async void CreateOneOnOneGame(string LobbyName, long Enemyid)
        {
            Random        r      = new Random();
            ILeagueClient league = await LeagueClient.Connect();

            ApiObject api      = new ApiObject();
            var       obj      = api.createCustomGameOneOnOne(LobbyName);
            var       response = league.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v2/lobby", obj).Result;

            while (true)
            {
                if (response.StatusCode != System.Net.HttpStatusCode.OK)
                {
                    obj      = api.createCustomGameOneOnOne(LobbyName + r.Next());
                    response = league.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v2/lobby", obj).Result;
                }
                else
                {
                    break;
                }
            }

            var invites = new List <LobbyInvitation>();

            invites.Add(new LobbyInvitation
            {
                ToSummonerId = Enemyid
            });
            await league.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v2/lobby/invitations", invites);

            bool AllIn = false;

            while (!AllIn)
            {
                LobbyPlayerInfo[] players = await league.MakeApiRequestAs <LobbyPlayerInfo[]>(HttpMethod.Get, "/lol-lobby/v2/lobby/members");

                foreach (var item in players)
                {
                    if (item.SummonerId == Enemyid)
                    {
                        AllIn = true;
                    }
                }
            }
            await league.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v1/lobby/custom/start-champ-select", new StartGame());
        }
Ejemplo n.º 4
0
        public async Task <Summoner> GetSummoner()
        {
            if (League == null)
            {
                League = await LeagueClient.Connect();
            }
            try
            {
                var region = await League.MakeApiRequest(HttpMethod.Get, "/riotclient/get_region_locale");

                var locals = JsonConvert.DeserializeObject <Region>(region.Content.ReadAsStringAsync().Result);

                Summoners sum    = new Summoners(League);
                var       player = await sum.GetCurrentSummoner();

                if (player == null || player.SummonerId == null)
                {
                    return(null);
                }

                Summoner user = new Summoner();
                user.SummonerID   = player.SummonerId.ToString();
                user.SummonerName = player.DisplayName;
                user.Region       = (Regions)Enum.Parse(typeof(Regions), locals.RegionRegion);
                return(user);
            }

            catch
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
        public async void CreateNewFiveOnFiveGame(string Name, long Id)
        {
            ILeagueClient league = await LeagueClient.Connect();

            ApiObject api = new ApiObject();
            var       obj = api.createCustomGameFiveOnFive(Name);

            var response = league.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v2/lobby", obj).Result;

            var invites = new List <LobbyInvitation>();

            invites.Add(new LobbyInvitation
            {
                ToSummonerId = 20289202
            });

            invites.Add(new LobbyInvitation
            {
                ToSummonerId = 92420917
            });

            await league.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v2/lobby/invitations", invites);
        }
Ejemplo n.º 6
0
        public async void JoinGame(string enemy, Match match)
        {
            bool          matchAccepted = false;
            ILeagueClient league        = await LeagueClient.Connect();

            while (!matchAccepted)
            {
                var response = await league.MakeApiRequest(HttpMethod.Get, "/lol-lobby/v2/received-invitations");

                var invites = JsonConvert.DeserializeObject <List <InviteModel> >(await response.Content.ReadAsStringAsync());

                foreach (var item in invites)
                {
                    if (item.FromSummonerId == enemy)
                    {
                        await league.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v2/received-invitations/" + item.InvitationId + "/accept");

                        System.Net.Http.HttpClient http = new System.Net.Http.HttpClient();
                        matchAccepted = true;
                    }
                }
                await Task.Delay(100);
            }
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Index()
        {
            League = await LeagueClient.Connect();

            var region = await League.MakeApiRequest(LCUSharp.HttpMethod.Get, "/riotclient/region-locale");

            var locals = JsonConvert.DeserializeObject <Region>(region.Content.ReadAsStringAsync().Result);

            Summoners sum    = new Summoners(League);
            var       player = sum.GetCurrentSummoner();

            Summoner user = new Summoner();

            user.SummonerID   = player.SummonerId.ToString();
            user.SummonerName = player.DisplayName;
            user.Region       = locals.RegionRegion;
            user.Role         = "Test";
            return(View(user));
        }
Ejemplo n.º 8
0
        public async Task GetUserInfoAsync()
        {
            var region = await League.MakeApiRequest(LCUSharp.HttpMethod.Get, "/riotclient/region-locale");

            var locals = JsonConvert.DeserializeObject <Region>(region.Content.ReadAsStringAsync().Result);

            Summoners sum    = new Summoners(League);
            var       player = sum.GetCurrentSummoner();

            Summoner user = new Summoner();

            user.SummonerID   = player.SummonerId.ToString();
            user.SummonerName = player.DisplayName;
            user.Region       = locals.RegionRegion;
            user.Role         = "Test";

            http = new HttpClient();
            var content = new StringContent(JsonConvert.SerializeObject(user), Encoding.UTF8, "application/json");
            await http.PostAsync("https://lossummonerinfoapi.azurewebsites.net/api/AddSummoner", content);
        }
Ejemplo n.º 9
0
        public bool IsNameAvailable(string name)
        {
            var result = League.MakeApiRequest(HttpMethod.Get, endpointRoot + "check-name-availability/" + name).Result;

            return(bool.Parse(result.Content.ReadAsStringAsync().Result));
        }
Ejemplo n.º 10
0
        public int GetOwnedPageCount()
        {
            var result = League.MakeApiRequest(HttpMethod.Get, endpointRoot + "inventory").Result;

            return(int.Parse(result.Content.ReadAsStringAsync().Result));
        }