public static ChampionPickResult PickChampion(Summoner currentSummoner, ChampionEnum champion)
        {
            var session = ClientLCU.GetChampSelectSession();

            foreach (var summoner in session.actions[0])
            {
                if (summoner.championId == (int)champion)
                {
                    return(ChampionPickResult.ChampionPicked);
                }
            }


            int[] pickableChampions = GetPickableChampions();

            if (!pickableChampions.Contains((int)champion))
            {
                return(ChampionPickResult.ChampionNotOwned);
            }

            int championId = (int)champion;

            for (int id = 0; id < 10; id++) // <-- clean this. What is 'id' ?
            {
                using (var request = CreateRequest())
                {
                    var result = request.Patch(PickURL + id, "{\"actorCellId\": 0, \"championId\": " + championId + ", \"completed\": true, \"id\": " + id + ", \"isAllyAction\": true, \"type\": \"string\"}", "application/json").ToString();
                }
            }

            return(ChampionPickResult.Ok);
        }
예제 #2
0
        public static ChampionPickResult PickChampion(Summoner currentSummoner, ChampionEnum champion)
        {
            var session = ClientLCU.GetChampSelectSession();
            var cellId  = -1;
            var id      = -1;

            foreach (var summoner in session.myTeam)
            {
                if (summoner.summonerId == currentSummoner.summonerId)
                {
                    cellId = summoner.cellId;
                }
            }

            foreach (var summoner in session.actions[0])
            {
                if (summoner.championId == (int)champion)
                {
                    return(ChampionPickResult.ChampionPicked);
                }

                if (summoner.actorCellId == cellId)
                {
                    id = summoner.id;
                }
            }


            int[] pickableChampions = GetPickableChampions();

            if (!pickableChampions.Contains((int)champion))
            {
                return(ChampionPickResult.ChampionNotOwned);
            }

            int championId = (int)champion;

            using (var request = CreateRequest())
            {
                var result = request.Patch(PickURL + id, "{\"actorCellId\": 0, \"championId\": " + championId + ", \"completed\": true, \"id\": " + id + ", \"isAllyAction\": true, \"type\": \"string\"}", "application/json").ToString();
                return(ChampionPickResult.Ok);
            }
        }