public List <MainChampion> Get5MainChampions(Summoner summoner) { List <MainChampion> result = new List <MainChampion>(); List <MainChampion> champs = new List <MainChampion>(); (api.GetMatchList(summoner.Region, summoner.Id, null, null, null, new DateTime(2016, 12, 7))).Matches.ForEach( match => { bool found = false; if (champs.Count != 0) { foreach (var champ in champs) { if (champ.Id == match.ChampionID) { champ.IncreaseCount(); found = true; } } } if (found == false) { champs.Add(new MainChampion(match.ChampionID)); } }); int ChampCount = 5; if (champs.Count < 5) { ChampCount = champs.Count; } champs.Sort(); for (int i = 0; i < ChampCount; i++) { champs[i].Name = sApi.GetChampion(Region.eune, Convert.ToInt32(champs[i].Id)).Name; result.Add(champs[i]); } return(result); }
public void GetChampion_Test() { var champ = api.GetChampion(Region.euw, 1, ChampionData.all); Assert.AreEqual(champ.Name, "Annie"); }
public void GetStatic_ShouldThrowRiotSharpException_Test() { faultyStaticApi.GetChampion(Region.euw, 1, ChampionData.all); }
/// <summary> /// Fetches the given Summoner's current game from the RiotAPI for the given region. /// </summary> /// <param name="e">The command event which was executed.</param> /// <returns>A message in the channel with information about the current game of the Summoner in the region.</returns> public async Task GetCurrentGameStats(CommandEventArgs e) { var input = Utils.ReturnInputParameterStringArray(e); string regionString = input[0]; string summonerName = ""; if (input.Length == 2) { summonerName = input[1]; } else { summonerName = input[1]; for (int i = 2; i < input.Length; i++) { summonerName = String.Format("{0} {1}", summonerName, input[i]); } } try { var summoner = GetSummoner(regionString, summonerName); var currentGame = api.GetCurrentGame(GetPlatform(regionString), summoner.Id); string[] summoners = new string[10]; Region region = GetRegion(regionString); List <Participant> blueTeam = new List <Participant>(); List <Participant> redTeam = new List <Participant>(); for (int i = 0; i < currentGame.Participants.Count; i++) { if (currentGame.Participants[i].TeamId == 100) { blueTeam.Add(currentGame.Participants[i]); } else if (currentGame.Participants[i].TeamId == 200) { redTeam.Add(currentGame.Participants[i]); } string champion = ""; if (currentGame.Participants[i].ChampionId != 0) { champion = " (" + staticApi.GetChampion(region, (Int32)currentGame.Participants[i].ChampionId).Name + ")"; } summoners[i] = currentGame.Participants[i].SummonerName.PadRight(20) + champion; } //Fill up empty slots. if (currentGame.Participants.Count < 10) { int emptySlots = 10; emptySlots -= redTeam.Count; emptySlots -= blueTeam.Count; Participant emptyParticipant = new Participant(); for (int i = 0; i < emptySlots / 2; i++) { redTeam.Add(emptyParticipant); blueTeam.Add(emptyParticipant); } } int minutes = (Int32)currentGame.GameLength / 60; int seconds = (Int32)currentGame.GameLength % 60; //Information to display. string output = String.Format("*{0}* is currently in a **{1}** game on {2}. ({3})", summoner.Name, currentGame.GameMode, currentGame.MapType, currentGame.GameQueueType) + "\n" + String.Format("This match started at *{0}* and has been going on for **{1}:{2}** (+ ~ 5 minutes).", currentGame.GameStartTime.ToShortTimeString(), minutes.ToString().PadLeft(2, '0'), seconds.ToString().PadLeft(2, '0'), currentGame.GameLength) + "\n" + "```" + "".PadLeft(13) + "Blue Team".PadRight(22) + " - " + "".PadLeft(13) + "Red Team".PadRight(22) + "\n" + "".PadRight(75, '~') + "\n"; for (int i = 0; i < currentGame.Participants.Count / 2; i++) { output += summoners[i].PadRight(35); output += " - "; output += summoners[i + 5].PadRight(35); output += " \n"; } output += "```"; await e.Channel.SendMessage(output); } catch (RiotSharpException ex) { Console.WriteLine(String.Format("Get current game - {0}", ex.Message)); await e.Channel.SendMessage("This Summoner is currently not in a game."); } catch (IndexOutOfRangeException) { await Utils.InproperCommandUsageMessage(e, "currentgame", "currentgame <REGION> <SUMMONERNAME>"); } catch (Exception ex) when(ex is SummonerNotFoundException || ex is RegionNotFoundException) { Console.WriteLine(String.Format("Get current game - {0}", ex.Message)); await e.Channel.SendMessage(ex.Message); } }
public SearchedSummonerPage(Summoner summoner, Region region) { InitializeComponent(); nameText.BackgroundColor = Color.FromRgba(0, 0, 0, 0.6); Title = summoner.Name; Region = region; Summoner = summoner; filterControl = new FilterControl(); filterControl.SelectedIndex = 0; contentViewFilter.Content = filterControl; nameText.Text = "\n\t\t " + summoner.Name; summonerIcon.Source = string.Format(icon, region, summoner.Id); var frequentlyPlayed = Task.Run(async() => { var matchList = await api.GetRecentGamesAsync(region, summoner.Id); var freqPlayed = matchList.GroupBy(q => q.ChampionId) .OrderByDescending(gp => gp.Count()) .Select(g => g.Key) .First(); var championPlayedMost = staticApi.GetChampion(region, freqPlayed, new List <ChampionData> { ChampionData.skins }); freqPlayedChamp.Source = string.Format(skinString, championPlayedMost.Key, championPlayedMost.Skins[0].Num); }); frequentlyPlayed.Wait(); var MatchListTask = Task.Run(async() => { var MatchList = await loadMatchHistory(summoner, region, this); contentVue.Content = MatchList; }); MatchListTask.Wait(); switch (App.device.HardwareVersion) { case "iPhone SE": case "iPhone 5S": case "iPhone 5S GSM": case "iPhone 5S CDMA": case "iPhone 5": case "iPhone 5 GSM": case "iPhone 5 CDMA": contentVue.HeightRequest = 230; break; case "iPhone 6S": case "iPhone 6": case "iPhone 7": contentVue.HeightRequest = 330; break; case "iPhone 6+": case "iPhone 6s+": case "iPhone 6 Plus": case "iPhone 6S Plus": case "iPhone 7 Plus": case "iPhone 7+": contentVue.HeightRequest = 410; break; } try { allLeagues = api.GetLeagues(region, new List <int> { (int)summoner.Id }); ranked5v5League = allLeagues[summoner.Id].Single(x => x.Queue == Queue.RankedSolo5x5); filterControl.Items = new List <string> { "Match History", "Ranked", "Current Game" }; } catch { filterControl.Items = new List <string> { "Match History", "Current Game" }; } filterControl.SelectedIndexChanged += async(object sender, EventArgs e) => { UserDialogs.Instance.ShowLoading("Loading", MaskType.Black); try { allLeagues = await api.GetLeaguesAsync(region, new List <int> { (int)summoner.Id }); ranked5v5League = allLeagues[summoner.Id].Single(x => x.Queue == Queue.RankedSolo5x5); switch (filterControl.SelectedIndex) { case 0: var MatchList = await loadMatchHistory(summoner, region, this); contentVue.Content = MatchList; UserDialogs.Instance.HideLoading(); break; case 1: var statsPage = await loadRanked(summoner, summoner.Region, this); contentVue.Content = statsPage; UserDialogs.Instance.HideLoading(); break; case 2: currentGameView = await loadCurrentGameView(summoner, summoner.Region, this); contentVue.Content = currentGameView; UserDialogs.Instance.HideLoading(); break; } } catch { switch (filterControl.SelectedIndex) { case 0: var MatchList = await loadMatchHistory(summoner, region, this); contentVue.Content = MatchList; UserDialogs.Instance.HideLoading(); break; case 1: currentGameView = await loadCurrentGameView(summoner, summoner.Region, this); contentVue.Content = currentGameView; UserDialogs.Instance.HideLoading(); break; } } }; var soloRankString = ""; var soloIcon = ""; var flexRankString = ""; var flexIcon = ""; try { allLeagues = api.GetLeagues(region, new List <int> { (int)summoner.Id }); ranked5v5League = allLeagues[summoner.Id].Single(x => x.Queue == Queue.RankedSolo5x5); div = ranked5v5League.Entries.Where(x => x.PlayerOrTeamId == summoner.Id.ToString()).Select(x => x.Division).Single(); var soloLP = ranked5v5League.Entries.FirstOrDefault(x => x.PlayerOrTeamName == summoner.Name).LeaguePoints; soloRankString = ranked5v5League.Tier + " " + div + " " + soloLP + "LP\nSolo Queue"; switch (ranked5v5League.Tier) { case RiotSharp.LeagueEndpoint.Enums.Tier.Bronze: soloIcon = "Bronze.png"; break; case RiotSharp.LeagueEndpoint.Enums.Tier.Silver: soloIcon = "Silver.png"; break; case RiotSharp.LeagueEndpoint.Enums.Tier.Gold: soloIcon = "Gold.png"; break; case RiotSharp.LeagueEndpoint.Enums.Tier.Platinum: soloIcon = "Platinum.png"; break; case RiotSharp.LeagueEndpoint.Enums.Tier.Diamond: soloIcon = "Diamond.png"; break; case RiotSharp.LeagueEndpoint.Enums.Tier.Master: soloIcon = "Master.png"; break; case RiotSharp.LeagueEndpoint.Enums.Tier.Challenger: soloIcon = "Challenger.png"; break; } } catch { soloRankString = "Unranked\nSolo Queue"; soloIcon = "Unranked.png"; } try { rankedFlexLeague = allLeagues[summoner.Id].Single(x => x.Queue == Queue.RankedFlexSR); flexDiv = rankedFlexLeague.Entries.Where(x => x.PlayerOrTeamId == summoner.Id.ToString()).Select(x => x.Division).Single(); var flexLP = rankedFlexLeague.Entries.FirstOrDefault(x => x.PlayerOrTeamName == summoner.Name).LeaguePoints; flexRankString = rankedFlexLeague.Tier + " " + flexDiv + " " + flexLP + "LP\nFlex 5v5"; switch (rankedFlexLeague.Tier) { case RiotSharp.LeagueEndpoint.Enums.Tier.Bronze: flexIcon = "Bronze.png"; break; case RiotSharp.LeagueEndpoint.Enums.Tier.Silver: flexIcon = "Silver.png"; break; case RiotSharp.LeagueEndpoint.Enums.Tier.Gold: flexIcon = "Gold.png"; break; case RiotSharp.LeagueEndpoint.Enums.Tier.Platinum: flexIcon = "Platinum.png"; break; case RiotSharp.LeagueEndpoint.Enums.Tier.Diamond: flexIcon = "Diamond.png"; break; case RiotSharp.LeagueEndpoint.Enums.Tier.Master: flexIcon = "Master.png"; break; case RiotSharp.LeagueEndpoint.Enums.Tier.Challenger: flexIcon = "Challenger.png"; break; } } catch { flexRankString = "Unranked\nFlex 5v5"; flexIcon = "Unranked.png"; } var grid = new Grid { RowDefinitions = { new RowDefinition { Height = new GridLength(50, GridUnitType.Absolute) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(50, GridUnitType.Absolute) }, new ColumnDefinition { Width = GridLength.Auto }, new ColumnDefinition { Width = new GridLength(50, GridUnitType.Absolute) }, new ColumnDefinition { Width = GridLength.Auto }, } }; grid.Children.Add(new Image { Source = soloIcon }, 0, 0); grid.Children.Add(new Label { TextColor = Color.White, Text = soloRankString }, 1, 0); grid.Children.Add(new Image { Source = flexIcon }, 2, 0); grid.Children.Add(new Label { TextColor = Color.White, Text = flexRankString }, 3, 0); grid.BackgroundColor = Color.FromRgba(0, 0, 0, 0.6); rankedImagesStuff.Content = grid; }
public string GetInfoShort(Summoner summoner) { StaticRiotApi staticApi = StaticRiotApi.GetInstance(Keys.Keys.riotKey); string returnstring = ""; returnstring += "**" + summoner.Name + ": **"; returnstring += "\n**Region:** " + summoner.Region.ToString().ToUpper(); returnstring += "\n**Level:** " + summoner.Level.ToString(); if (summoner.Level == 30) { RankAPI rankApi = new RankAPI(); try { returnstring += "\n**Rankings: **"; if (rankApi.GetRankingHarder(summoner, Queue.RankedSolo5x5) != null) { returnstring += "\nSolo: " + rankApi.GetRankingHarder(summoner, Queue.RankedSolo5x5); } if (rankApi.GetRankingHarder(summoner, Queue.RankedFlexSR) != null) { returnstring += "\nFlex: " + rankApi.GetRankingHarder(summoner, Queue.RankedFlexSR); } if (rankApi.GetRankingHarder(summoner, Queue.RankedFlexTT) != null) { returnstring += "\n3v3: " + rankApi.GetRankingHarder(summoner, Queue.RankedFlexTT); } } catch { } } try { int gamesplayed = new RoleAPI().GetGamesPlayed(summoner); if (gamesplayed != 0) { returnstring += "**\nTotal Solo Games Played:** " + gamesplayed + " games"; } var champList = new ChampionAPI().Get5MainChampions(summoner); returnstring += "**\nMain ranked champions:**"; foreach (var champ in champList) { returnstring += "\n" + champ.Name + ": " + champ.Count + " games."; } } catch { } try { var masteryList = new MasteryAPI().GetChampionMasterys(summoner); masteryList = masteryList.OrderBy(c => c.ChampionLevel).ThenBy(c => c.ChampionPoints).ToList(); masteryList.Reverse(); int champions = 3; if (masteryList.Count < 3) { champions = masteryList.Count; } returnstring += "\n**Highest mastery:** "; for (int i = 0; i < champions; i++) { returnstring += "\n" + staticApi.GetChampion(RiotSharp.Region.br, (Convert.ToInt32((masteryList[i].ChampionId)))).Name + ": Level " + masteryList[i].ChampionLevel.ToString() + ", " + masteryList[i].ChampionPoints.ToString() + " Points"; } } catch { } return(returnstring); }
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++; } } }
public void PrintMatchesDatas() { foreach (MatchDetail match in matchesDetails) { foreach (Participant player in match.Participants) { for (int z = 0; z < match.ParticipantIdentities.Count; z++) { if ((match.ParticipantIdentities[z].Player.SummonerId == summonerId || match.ParticipantIdentities[z].Player.SummonerId == long.Parse(ConfigurationManager.AppSettings["Summoner2Id"]) || match.ParticipantIdentities[z].Player.SummonerId == long.Parse(ConfigurationManager.AppSettings["Summoner3Id"]) || match.ParticipantIdentities[z].Player.SummonerId == long.Parse(ConfigurationManager.AppSettings["Summoner4Id"]) || match.ParticipantIdentities[z].Player.SummonerId == long.Parse(ConfigurationManager.AppSettings["Summoner5Id"]) || match.ParticipantIdentities[z].Player.SummonerId == long.Parse(ConfigurationManager.AppSettings["Summoner6Id"])) && match.ParticipantIdentities[z].ParticipantId == player.ParticipantId) { singleMatch = new AllMatches(); int team = 0; int wardsMin; //Match Date singleMatch.GameDate = match.MatchCreation.ToString(); //Result if (player.TeamId == match.Teams[0].TeamId) { if (match.Teams[0].Winner) { singleMatch.Result = "Victory"; } else { singleMatch.Result = "Defeat"; } } else { team = 1; if (match.Teams[1].Winner) { singleMatch.Result = "Victory"; } else { singleMatch.Result = "Defeat"; } } //Player foreach (ParticipantIdentity singleParticipantIdentity in match.ParticipantIdentities) { if (singleParticipantIdentity.ParticipantId == player.ParticipantId) { singleMatch.Player = singleParticipantIdentity.Player.SummonerName == "Betheljihb" ? "Venquetecuro" : singleParticipantIdentity.Player.SummonerName; break; } } //Champion singleMatch.Champion = staticApi.GetChampion(region, player.ChampionId).Name; Thread.Sleep(1000); //Kills singleMatch.Kills = player.Stats.Kills; //Deaths singleMatch.Deaths = player.Stats.Deaths; //Assists singleMatch.Assists = player.Stats.Assists; //Gold singleMatch.Gold = player.Stats.GoldEarned; //CS singleMatch.CS = player.Stats.MinionsKilled; //CS@10 singleMatch.CS10 = player.Timeline.CreepsPerMinDeltas.ZeroToTen * 10; //CS@20 singleMatch.CS20 = player.Timeline.CreepsPerMinDeltas.TenToTwenty * 10; //CS@30 singleMatch.CS30 = player.Timeline.CreepsPerMinDeltas.TwentyToThirty * 10; //CSDiff@10 try { singleMatch.CSDiff10 = player.Timeline.CsDiffPerMinDeltas.ZeroToTen; //singleMatch.CSDiff10 = Math.Round(player.Timeline.CsDiffPerMinDeltas.ZeroToTen, 2); } catch { } //CSDiff@20 try { singleMatch.CSDiff20 = player.Timeline.CsDiffPerMinDeltas.TenToTwenty; //singleMatch.CSDiff20 = Math.Round(player.Timeline.CsDiffPerMinDeltas.TenToTwenty, 2); } catch { } //CSDiff@30 try { singleMatch.CSDiff30 = player.Timeline.CsDiffPerMinDeltas.TwentyToThirty; //singleMatch.CSDiff30 = Math.Round(player.Timeline.CsDiffPerMinDeltas.TwentyToThirty, 2); } catch { } //CSDiff@END try { singleMatch.CSDiffEnd = player.Timeline.CsDiffPerMinDeltas.ThirtyToEnd; //singleMatch.CSDiffEnd = Math.Round(player.Timeline.CsDiffPerMinDeltas.ThirtyToEnd, 2); } catch { } //Wards singleMatch.Wards = player.Stats.WardsPlaced; //Wards@10 wardsMin = 0; for (int i = 0; i < match.Timeline.Frames.Count; i++) { if (match.Timeline.Frames[i].Timestamp.Minutes <= 10) { if (match.Timeline.Frames[i].Events != null) { for (int k = 0; k < match.Timeline.Frames[i].Events.Count; k++) { if (match.Timeline.Frames[i].Events[k].EventType == EventType.WardPlaced) { if (match.Timeline.Frames[i].Events[k].CreatorId == player.ParticipantId && match.Timeline.Frames[i].Events[k].WardType != WardType.Undefined && match.Timeline.Frames[i].Events[k].WardType != WardType.TeemoMushroom) { wardsMin += 1; } } } } } } singleMatch.Wards10 = wardsMin; //Wards@20 wardsMin = 0; for (int i = 0; i < match.Timeline.Frames.Count; i++) { if (match.Timeline.Frames[i].Timestamp.Minutes <= 20 && match.Timeline.Frames[i].Timestamp.Minutes > 10) { if (match.Timeline.Frames[i].Events != null) { for (int k = 0; k < match.Timeline.Frames[i].Events.Count; k++) { if (match.Timeline.Frames[i].Events[k].EventType == EventType.WardPlaced) { if (match.Timeline.Frames[i].Events[k].CreatorId == player.ParticipantId && match.Timeline.Frames[i].Events[k].WardType != WardType.Undefined && match.Timeline.Frames[i].Events[k].WardType != WardType.TeemoMushroom) { wardsMin += 1; } } } } } } singleMatch.Wards20 = wardsMin; //Wards@30 wardsMin = 0; for (int i = 0; i < match.Timeline.Frames.Count; i++) { if (match.Timeline.Frames[i].Timestamp.Minutes <= 30 && match.Timeline.Frames[i].Timestamp.Minutes > 20) { if (match.Timeline.Frames[i].Events != null) { for (int k = 0; k < match.Timeline.Frames[i].Events.Count; k++) { if (match.Timeline.Frames[i].Events[k].EventType == EventType.WardPlaced) { if (match.Timeline.Frames[i].Events[k].CreatorId == player.ParticipantId && match.Timeline.Frames[i].Events[k].WardType != WardType.Undefined && match.Timeline.Frames[i].Events[k].WardType != WardType.TeemoMushroom) { wardsMin += 1; } } } } } } singleMatch.Wards30 = wardsMin; //Pinks singleMatch.Pinks = player.Stats.VisionWardsBoughtInGame; //Damage Output singleMatch.DamageOutput = player.Stats.TotalDamageDealtToChampions; //First Blood singleMatch.FirstBlood = Convert.ToInt32(player.Stats.FirstBloodKill); //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ TEAM STATS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //First Dragon singleMatch.FirstDrake = Convert.ToInt32(match.Teams[team].FirstDragon); //First Baron singleMatch.FirstBaron = Convert.ToInt32(match.Teams[team].FirstBaron); //First Turret singleMatch.FirstTurret = Convert.ToInt32(match.Teams[team].FirstTower); //Drakes killed singleMatch.Drakes = match.Teams[team].DragonKills; //Drakes Given singleMatch.DrakesGiven = team == 1 ? match.Teams[team - 1].DragonKills : match.Teams[team + 1].DragonKills; //Barons killed singleMatch.Barons = match.Teams[team].BaronKills; //Barons Given singleMatch.BaronsGiven = team == 1 ? match.Teams[team - 1].BaronKills : match.Teams[team + 1].BaronKills; //Team GoldDiff@10 double teamGold = 0; foreach (var goldPlayer in match.Participants) { if (goldPlayer.TeamId == match.Teams[team].TeamId) { teamGold += (goldPlayer.Timeline.GoldPerMinDeltas.ZeroToTen * 10); } else { teamGold -= (goldPlayer.Timeline.GoldPerMinDeltas.ZeroToTen * 10); } } singleMatch.TeamGoldDiff10 = teamGold; //Team GoldDiff@20 teamGold = 0; foreach (var goldPlayer in match.Participants) { if (goldPlayer.TeamId == match.Teams[team].TeamId) { teamGold += (goldPlayer.Timeline.GoldPerMinDeltas.TenToTwenty * 10); } else { teamGold -= (goldPlayer.Timeline.GoldPerMinDeltas.TenToTwenty * 10); } } singleMatch.TeamGoldDiff20 = teamGold; //Team GoldDiff@30 teamGold = 0; foreach (var goldPlayer in match.Participants) { if (goldPlayer.TeamId == match.Teams[team].TeamId) { teamGold += (goldPlayer.Timeline.GoldPerMinDeltas.TwentyToThirty * 10); } else { teamGold -= (goldPlayer.Timeline.GoldPerMinDeltas.TwentyToThirty * 10); } } singleMatch.TeamGoldDiff30 = teamGold; //Team GoldDiff@End teamGold = 0; foreach (var goldPlayer in match.Participants) { if (goldPlayer.TeamId == match.Teams[team].TeamId) { teamGold += (goldPlayer.Timeline.GoldPerMinDeltas.ThirtyToEnd * 10); } else { teamGold -= (goldPlayer.Timeline.GoldPerMinDeltas.ThirtyToEnd * 10); } } singleMatch.TeamGoldDiffEnd = teamGold; Matches.Add(singleMatch); break; } } } } }