public int GetPlayerTeam(MatchInfos matchInfos, Player player) { int participantId = GetParticipantId(matchInfos, player); int teamId = matchInfos.participants.Where(x => x.participantId == participantId).Select(x => x.teamId).FirstOrDefault(); return(teamId); }
public int GetPrimaryRune(MatchInfos matchInfos, int participantId) { var participant = GetParticipantById(matchInfos, participantId); var primaryKey = participant.stats.perk0; return(primaryKey); }
public int GetPrimaryStyleRune(MatchInfos matchInfos, int participantId) { var participant = GetParticipantById(matchInfos, participantId); var primaryKeyStyle = participant.stats.perkPrimaryStyle; return(primaryKeyStyle); }
public int GetOpponentChampionId(MatchInfos matchInfos, Player player) { int teamId = GetPlayerTeam(matchInfos, player); int opponentTeamId = teamId == 100 ? 200 : 100; string playerRole = GlobalVar.getRoleById(player.Role); int opponentChampionId = 0; if (playerRole == "MID") { playerRole = "MIDDLE"; opponentChampionId = matchInfos.participants.Where(x => x.timeline.lane == playerRole && x.teamId == opponentTeamId).Select(x => x.championId).FirstOrDefault(); } else if (playerRole == "SUPPORT") { playerRole = "BOTTOM"; string playerLane = "DUO_SUPPORT"; opponentChampionId = matchInfos.participants.Where(x => x.timeline.lane == playerRole && x.timeline.role == playerLane && x.teamId == opponentTeamId).Select(x => x.championId).FirstOrDefault(); } else if (playerRole == "BOTTOM") { string playerLane = "DUO_CARRY"; opponentChampionId = matchInfos.participants.Where(x => x.timeline.lane == playerRole && x.timeline.role == playerLane && x.teamId == opponentTeamId).Select(x => x.championId).FirstOrDefault(); if (opponentChampionId == 0)// if thoses lines code below , change it also in method "GetOpponentNameByOpponentId" { playerLane = "SOLO"; playerRole = "BOTTOM"; opponentChampionId = matchInfos.participants.Where(x => x.timeline.lane == playerRole && x.timeline.role == playerLane && x.teamId == opponentTeamId).Select(x => x.championId).FirstOrDefault(); } } else { opponentChampionId = matchInfos.participants.Where(x => x.timeline.lane == playerRole && x.teamId == opponentTeamId).Select(x => x.championId).FirstOrDefault(); } return(opponentChampionId); }
public bool DidPlayerWin(MatchInfos matchInfos, Player player) { int teamId = GetPlayerTeam(matchInfos, player); string hasWin = matchInfos.teams.Where(x => x.teamId == teamId).Select(x => x.win).FirstOrDefault(); if (hasWin.ToLower() == "win") { return(true); } return(false); }
public List <MatchInfos> GetListMatchInfos(List <Match> listMatch) { List <MatchInfos> listMatchInfos = new List <MatchInfos>(); int nbGames = 0; foreach (var game in listMatch) { MatchInfos matchInfos = GetMatchInfo(game.gameId.ToString()); if (nbGames % 20 == 0) { Thread.Sleep(1000); } nbGames++; listMatchInfos.Add(matchInfos); } return(listMatchInfos); }
public void GetDraftPositionPick(MatchInfos matchInfos, Player player) { }
public Tuple <int, int> GetSummonerSpellsByParticipantId(MatchInfos matchInfos, int participantId) { var participant = GetParticipantById(matchInfos, participantId); return(new Tuple <int, int>(participant.spell1Id, participant.spell2Id)); }
public Participant GetParticipantById(MatchInfos matchInfos, int participantId) { var participant = matchInfos.participants.Where(x => x.participantId == participantId).FirstOrDefault(); return(participant); }
public int GetParticipantId(MatchInfos matchInfos, Player player) { int participantId = matchInfos.participantIdentities.Where(x => x.player.accountId == player.AccountId).Select(x => x.participantId).FirstOrDefault(); return(participantId); }