public void AddChampion(ulong discordid, string championname) { ChampionAPI championApi = new ChampionAPI(); int champid = championApi.GetChampionId(championname); new CoachRepo(new CoachContext()).AddChampionToCoach(champid, discordid); }
public void AddCoach(ulong discordid, string championname, string role) { ChampionAPI championApi = new ChampionAPI(); int champid = championApi.GetChampionId(championname); bool found = false; foreach (string line in DataLibary.Models.Roles.NormalRoles()) { if (line.ToLower() == role.ToLower()) { found = true; } } if (found == true) { new CoachRepo(new CoachContext()).AddCoach(new DataLibary.Models.Coach(discordid, role, champid)); } else { throw new Exception("Role or Champion not found."); } }
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); }