private void go(string s1, string s2, string champ, string api) { Summoner sum1; Summoner sum2; ChampionMastery champ1; ChampionMastery champ2; string sum1_name = s1; string sum2_name = s2; long champion_id = Convert.ToInt64(champ); string sum1_id; string sum2_id; int sum1_mastery; int sum2_mastery; long sum1_lv; long sum2_lv; SummonerV4 riotapi = new SummonerV4(api); sum1 = riotapi.GetSummonerByName(sum1_name); sum2 = riotapi.GetSummonerByName(sum2_name); champ1 = riotapi.GetChampionMastery(sum1.ID, champion_id); champ2 = riotapi.GetChampionMastery(sum2.ID, champion_id); sum1_lv = sum1.SummonerLevel; sum2_lv = sum2.SummonerLevel; sum1_mastery = champ1.ChampionPoints; sum2_mastery = champ2.ChampionPoints; Summoner1AL_TextBox.Text = Convert.ToString(sum1_lv); Summoner2AL_TextBox.Text = Convert.ToString(sum2_lv); Summoner1MP_Textbox.Text = Convert.ToString(sum1_mastery); Summoner2MP_Textbox.Text = Convert.ToString(sum2_mastery); string winner; long lv_dif = sum1_lv - sum2_lv; if (Math.Abs(lv_dif) > 50) { winner = (champ1 > champ2) ? sum1_name : sum2_name; } else { winner = (sum1_lv > sum2_lv) ? sum1_name : sum2_name; } textBox5.Text = winner; }
public RiotAPI(string key) { AccountV1 = new AccountV1(key); ChampionMasteryV4 = new ChampionMasteryV4(key); ChampionV3 = new ChampionV3(key); ClashV1 = new ClashV1(key); LeagueExpV4 = new LeagueExpV4(key); LeagueV4 = new LeagueV4(key); LOLStatusV3 = new LOLStatusV3(key); LORRankedV1 = new LORRankedV1(key); MatchV4 = new MatchV4(key); SpectatorV4 = new SpectatorV4(key); SummonerV4 = new SummonerV4(key); TFTLeagueV1 = new TFTLeagueV1(key); TFTMatchV1 = new TFTMatchV1(key); TFTSummonerV1 = new TFTSummonerV1(key); DataDragonChampions = new DataDragonChampions(); }