public void GetSummonerSpell_Test() { var spell = api.GetSummonerSpell(Region.euw, SummonerSpell.Barrier, SummonerSpellData.all); Assert.AreEqual(spell.Name, "Barrier"); }
private void SummonerNameTextBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == System.Windows.Input.Key.Return) { string summonerName = SummonerNameTextBox.Text; Summoner summoner; RiotSharp.CurrentGameEndpoint.CurrentGame currentGame; try { summoner = api.GetSummoner(Region.na, summonerName); } catch (RiotSharpException ex) { System.Windows.Forms.MessageBox.Show("That Summoner does not exist"); return; } try { currentGame = api.GetCurrentGame(Platform.NA1, summoner.Id); } catch (RiotSharp.RiotSharpException ex) { //Handle the exception however you want. System.Windows.Forms.MessageBox.Show("Could not find that summoner in a game"); return; } List <RiotSharp.CurrentGameEndpoint.Participant> team1 = new List <RiotSharp.CurrentGameEndpoint.Participant>(); List <RiotSharp.CurrentGameEndpoint.Participant> team2 = new List <RiotSharp.CurrentGameEndpoint.Participant>(); int teamIDofSummoner = -1; //split the participants into their teams, ally and enemy foreach (var p in currentGame.Participants) { if (summoner.Name.Equals(p.SummonerName)) { teamIDofSummoner = (int)p.TeamId; } if (p.TeamId == 100) //ids are 100 or 200 { team1.Add(p); } else { team2.Add(p); } } Console.WriteLine("Main summoner's enemies are: "); List <RiotSharp.CurrentGameEndpoint.Participant> enemyTeam; if (teamIDofSummoner == 100) { enemyTeam = team2; } else { enemyTeam = team1; } int i = 0; foreach (var p in enemyTeam) { string championName = staticApi.GetChampion(Region.na, (int)p.ChampionId).Name; Console.WriteLine("Player " + p.SummonerName + " is playing " + championName); if (staticApi.GetSummonerSpell(Region.na, (RiotSharp.StaticDataEndpoint.SummonerSpell)p.SummonuerSpell1).Name.Equals("Flash") || staticApi.GetSummonerSpell(Region.na, (RiotSharp.StaticDataEndpoint.SummonerSpell)p.SummonerSpell2).Name.Equals("Flash")) { Console.WriteLine("and they have Flash."); } /** * masteryId long The ID of the mastery * rank int The number of points put into this mastery by the user */ var m = p.Masteries; bool hasInsight = false; foreach (var mastery in m) { var masteryDetail = staticApi.GetMastery(Region.na, (int)mastery.MasteryId); if (masteryDetail.Name.Equals("Insight")) //also id == 6241 { int id = masteryDetail.Id; Console.WriteLine("And they have the insight mastery."); hasInsight = true; } } championPanelPresenters[i].LoadFromRiotAPI(p.SummonerName, championName, hasInsight); i++; } } }