Пример #1
0
 public void SetOptimalItems(List <int> items)
 {
     if (EqualityComparer <TempRunesRESTResponse> .Default.Equals(this.optimalRunes, default(TempRunesRESTResponse)))
     {
         this.optimalRunes = new TempRunesRESTResponse();
     }
     this.optimalRunes.Items = items;
 }
Пример #2
0
        /// <summary>
        /// set the optimal runes based on the champ selected and lane
        /// </summary>
        /// <param name="lane">The lane the player is playing in</param>
        /// <param name="currentChamp">The champ the player selected</param>
        private async Task SetOptimalRunes(string lane, string currentChamp)
        {
            try {
                var Runes = await RunesGetRequest($"?currentChamp={currentChamp}&enemyChamp=NA&lane={lane}");

                var runeIds = GetRunesIDs(Runes);
                var page    = MakeRunePage(Runes.PrimaryPath, Runes.SecondaryPath, runeIds);
                await this.riotConnecter.SendRequestToRiot(LCUSharp.HttpMethod.Put, "/lol-perks/v1/pages/1701818929", page);

                this.optimalRunes = Runes;
            } catch (Exception error) {
                Console.WriteLine(error.Message);
                throw error;
            }
        }
Пример #3
0
        /// <summary>
        /// Convert runes objects (TemperRunesRESTResponse) to an int[] resembling runes ids
        /// </summary>
        /// <param name="runes">the runes object from firebase</param>
        /// <returns>an array of runes ids</returns>
        private int[] GetRunesIDs(TempRunesRESTResponse runes)
        {
            var runeIds = new int[] {
                runes.PrimaryPathKeystoneRune,
                runes.PrimaryPathRune1,
                runes.PrimaryPathRune2,
                runes.PrimaryPathRune3,
                runes.SecondaryPathRune1,
                runes.SecondaryPathRune2,
                runes.StatRune1,
                runes.StatRune2,
                runes.StatRune3
            };

            return(runeIds);
        }
Пример #4
0
        /// <summary>
        /// set the optimal runes based on the champ selected, the champ you are laning against, and the lane the player is playing in.
        /// </summary>
        /// <param name="lane">The lane the player is playing in</param>
        /// <param name="currentChamp">The champ the player selected</param>
        /// <param name="enamyChamp">The champ the player is laning  against</param>
        private async Task SetOptimalRunes(string lane, string currentChamp, string enamyChamp)
        {
            try {
                var Runes = await RunesGetRequest($"?currentChamp={currentChamp}&enemyChamp={enamyChamp}&lane={lane}");

                var runeIds = GetRunesIDs(Runes);
                var page    = MakeRunePage(Runes.PrimaryPath, Runes.SecondaryPath, runeIds);
                await this.riotConnecter.SendRequestToRiot(LCUSharp.HttpMethod.Delete, "/lol-perks/v1/pages");

                await this.riotConnecter.SendRequestToRiot(LCUSharp.HttpMethod.Post, "/lol-perks/v1/pages", page);

                this.optimalRunes = Runes;
            } catch (Exception error) {
                throw error;
            }
        }