public async void InitializePop(GameDTO InitialDTO) { List<Participant> AllParticipants = InitialDTO.TeamOne; AllParticipants.AddRange(InitialDTO.TeamTwo); if (InitialDTO.TeamOne[0] is ObfuscatedParticipant) { ReverseString = true; } foreach (Participant p in AllParticipants) { QueuePopPlayer player = new QueuePopPlayer(); player.Width = 300; player.Height = 100; if (p is PlayerParticipant) { PlayerParticipant playerPart = (PlayerParticipant)p; player.PlayerLabel.Content = playerPart.SummonerName; player.RankLabel.Content = ""; Team1ListBox.Items.Add(player); } else { player.PlayerLabel.Content = "Enemy"; player.RankLabel.Content = ""; Team2ListBox.Items.Add(player); } } int i = 0; foreach (Participant p in AllParticipants) { if (p is PlayerParticipant) { QueuePopPlayer player = (QueuePopPlayer)Team1ListBox.Items[i]; PlayerParticipant playerPart = (PlayerParticipant)p; SummonerLeaguesDTO playerLeagues = await Client.PVPNet.GetAllLeaguesForPlayer(playerPart.SummonerId); foreach (LeagueListDTO x in playerLeagues.SummonerLeagues) { if (x.Queue == "RANKED_SOLO_5x5") { player.RankLabel.Content = x.Tier + " " + x.RequestorsRank; } } //People can be ranked without having solo queue so don't put if statement checking List.Length if (String.IsNullOrEmpty((string)player.RankLabel.Content)) { player.RankLabel.Content = "Unranked"; } i++; } } if (Client.AutoAcceptQueue) { await Client.PVPNet.AcceptPoppedGame(true); } }
public async void InitializePop(GameDTO InitialDTO) { List<Participant> allParticipants = InitialDTO.TeamOne; allParticipants.AddRange(InitialDTO.TeamTwo); if (InitialDTO.TeamOne[0] is ObfuscatedParticipant) ReverseString = true; allParticipants = allParticipants.Distinct().ToList(); //Seems to have fixed the queuepopoverlay page crashing. //whichever team you're on sometimes duplicates and could not find a reason as it doesn't happen a lot. int i = 1; foreach (Participant p in allParticipants) { var player = new QueuePopPlayer { Width = 264, Height = 70 }; var part = p as PlayerParticipant; if (part != null) { PlayerParticipant playerPart = part; if (!string.IsNullOrEmpty(playerPart.SummonerName)) { player.PlayerLabel.Content = playerPart.SummonerName; player.RankLabel.Content = ""; player.Tag = part; Team1ListBox.Items.Add(player); } else { Client.Log(playerPart.SummonerId.ToString(CultureInfo.InvariantCulture)); player.PlayerLabel.Content = "Summoner " + i; i++; player.RankLabel.Content = ""; Team2ListBox.Items.Add(player); } } else { var oPlayer = p as ObfuscatedParticipant; if (oPlayer != null) player.PlayerLabel.Content = "Summoner " + (oPlayer.GameUniqueId - (oPlayer.GameUniqueId > 5 ? 5 : 0)); player.RankLabel.Content = ""; Team2ListBox.Items.Add(player); } } GetPlayerLeagues(); if (!Client.AutoAcceptQueue) return; await RiotCalls.AcceptPoppedGame(true); accepted = true; }