You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a more efficient way to obtain the top 6 most played champions of a summoner using their Summoner Name and Region from their last 100 games?
Here is what I am currently using but it's very slow:
List<int> playedChampionIds = new List<int>();
summoner = api.Summoner.GetSummonerByNameAsync(selectedSpecificRegion, name).Result;
var matchListOfSummoner = api.Match.GetMatchListAsync(selectedBroadRegion, summoner.Puuid, null, 100).Result;
foreach (var m in matchListOfSummoner)
{
var matchData = api.Match.GetMatchAsync(selectedBroadRegion, m).Result;
var summonerMatchData = matchData.Info.Participants.FirstOrDefault(p => p.SummonerId == summoner.Id);
if (summonerMatchData != null)
{
playedChampionIds.Add(summonerMatchData.ChampionId);
}
}
var mostPlayed = (from c in playedChampionIds
group c by c into grp
orderby grp.Count() descending
select grp.Key).Take(6);
The text was updated successfully, but these errors were encountered:
Based on available endpoints there is no more efficient way.
You might want to go for an asynchronous approach. This could increase performance for the stake of much more complicated handling.
If you want to get the last 100 ranked games you should add those filters in the matchlist request.
Is there a more efficient way to obtain the top 6 most played champions of a summoner using their Summoner Name and Region from their last 100 games?
Here is what I am currently using but it's very slow:
The text was updated successfully, but these errors were encountered: