Skip to content

Instantly share code, notes, and snippets.

@efranford
Created February 3, 2014 05:05
Show Gist options
  • Save efranford/8779097 to your computer and use it in GitHub Desktop.
Save efranford/8779097 to your computer and use it in GitHub Desktop.
Gets the highest tier a summoner has achieved in any game mode
public int GetHighestTier(int summonerId)
{
var leagues = EF.RiotApi.Client.API.LeagueApi.Instance.GetLeagueBySummonerAsync(summonerId).Result;
int summoner1Tier = -1;
foreach (var league in leagues)
{
var summoner1LeagueVar = league.Value;
if (summoner1LeagueVar.Tier.Contains("BRONZE"))
{
summoner1Tier = 1;
}
else if (summoner1LeagueVar.Tier.Contains("SILVER"))
{
summoner1Tier = 2;
}
else if (summoner1LeagueVar.Tier.Contains("GOLD"))
{
summoner1Tier = 3;
}
else if (summoner1LeagueVar.Tier.Contains("PLATINUM"))
{
summoner1Tier = 4;
}
else if (summoner1LeagueVar.Tier.Contains("DIAMOND"))
{
summoner1Tier = 5;
}
else if (summoner1LeagueVar.Tier.Contains("CHALLENGER"))
{
summoner1Tier = 6;
}
}
return summoner1Tier;
}
@meyea
Copy link

meyea commented Feb 5, 2014

This runs perfectly thank you so much! The threading error was killing me .-.
I gave you credit in the code comments if anyone ever feels the need to decompile it :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment