public string getQueueData(CurrentGame game, long summonerid) { GameQueueType type = game.GameQueueType; FileWriter.WriteToFile(type.ToString()); return(type.ToString()); }
private static bool isSoloQueue(GameQueueType type) { return (type == GameQueueType.RankedSolo5x5 || type == GameQueueType.RankedPremade5x5 || type == GameQueueType.RankedFlexSR || type == GameQueueType.RankedFlexTT || type == GameQueueType.TeamBuilderDraftRanked5x5 || type == GameQueueType.TeamBuilderRankedSolo); }
public static int getData() { eventtrigger.onStartedUpdate(); Properties.Settings.Default.Save(); RiotSharp.CurrentGameEndpoint.CurrentGame gameinfo; string retval = "error"; try { gameinfo = api.GetCurrentGame(Platform.EUW1, CURRENT_SUMMONER); GameQueueType qType = gameinfo.GameQueueType; if (isTeamRanked(qType)) { Console.WriteLine("Teamranked"); GameFetcher fetcher = new TeamRankedFetcher(); retval = fetcher.getQueueData(gameinfo, CURRENT_SUMMONER); } else if (isSoloQueue(qType)) { Console.WriteLine("SoloQueue"); GameFetcher fetcher = new SoloQueueFetcher(); retval = fetcher.getQueueData(gameinfo, CURRENT_SUMMONER); } else { Console.WriteLine("Normal or Custom"); GameFetcher fetcher = new NormalCustomFetcher(); retval = fetcher.getQueueData(gameinfo, CURRENT_SUMMONER); } eventtrigger.onFinishedUpdate(retval); return(0); } catch (RiotSharpException e) { Console.WriteLine(e); FileWriter.WriteToFile("Not Ingame"); eventtrigger.onFinishedUpdate("Not Ingame"); return(-1); } catch (JsonSerializationException e) { Console.WriteLine(e); eventtrigger.onFinishedUpdate("Unknown Gamemode"); FileWriter.WriteToFile("Unknown Gamemode"); return(-2); } }
public string getQueueData(CurrentGame game, long summonerid) { List <Participant> participants = game.Participants; long teamId = participants.Find(x => x.SummonerId.Equals(summonerid)).TeamId; TeamInfo info; if (teamId == 100) { info = game.teamInfoOne; } else { info = game.teamInfoTwo; } if (info != null) { List <long> ids = new List <long>(); ids.Add((long)summonerid); Dictionary <long, List <Team> > teams = ApiFetcher.api.GetTeams(Region.euw, ids); string rankedteamid = null; info.teamId.TryGetValue("fullId", out rankedteamid); GameQueueType type = game.GameQueueType; List <Team> teamlist = teams.Values.First <List <Team> >(); Team currentTeam = teamlist.Find(team => team.FullId.Equals(rankedteamid)); TeamStatDetail details = null; if (type == GameQueueType.RankedTeam5x5) { details = currentTeam.TeamStatDetails.Find(queue => queue.TeamStatType.Equals("RANKED_TEAM_5x5")); } else { details = currentTeam.TeamStatDetails.Find(queue => queue.TeamStatType.Equals("RANKED_TEAM_3x3")); } string name = currentTeam.Name; try { List <string> teamids = new List <string>(); teamids.Add(currentTeam.FullId); Dictionary <string, List <League> > leaguedict = ApiFetcher.api.GetLeagues(Region.euw, teamids); List <League> leagues = leaguedict.Values.First <List <League> >(); League league = leagues.Find(l => l.Queue.ToString().Equals(type.ToString())); LeagueEntry entry = league.Entries[0]; string tier = league.Tier.ToString(); string division = entry.Division; int points = entry.LeaguePoints; int wins = entry.Wins; int losses = entry.Losses; return(FileWriter.WriteToFile(String.Format("{0}{1}{2} {3} ({4}LP) {5}/{6}", name, Environment.NewLine, tier, division, points, wins, losses))); } catch (RiotSharpException e) { return(FileWriter.WriteToFile(String.Format("{0}{1}{2} ({3}/{4})", name, Environment.NewLine, "Placements", details.Wins, details.Losses))); } } else { return("meem"); } }
private static bool isTeamRanked(GameQueueType type) { return(type == GameQueueType.RankedTeam5x5 || type == GameQueueType.RankedTeam3x3); }