Exemplo n.º 1
0
        private async void load(agsXMPP.protocol.client.Presence message)
        {
            try
            {
                Client.Log("FriendRequest stuff coming");
                Client.Log(message.From.User.Replace("sum", string.Empty));
                var x = await RiotCalls.GetAllPublicSummonerDataByAccount(message.From.User.Replace("sum", string.Empty).ToInt());

                Client.Log(x.Summoner.InternalName);

                SummonerLeaguesDTO playerLeagues =
                    await RiotCalls.GetAllLeaguesForPlayer(x.Summoner.AcctId);

                string rank = string.Empty;
                foreach (LeagueListDTO l in playerLeagues.SummonerLeagues.Where(l => l.Queue == "RANKED_SOLO_5x5"))
                {
                    rank = l.Tier + " " + l.RequestorsRank;
                }
                if (string.IsNullOrEmpty(rank))
                {
                    rank = "Unranked";
                }
                NotificationTextBox.Text = string.Format(@"{0} would like to have you as a friend
Level: {1}
Rank: {2}", x.Summoner.InternalName, x.SummonerLevel.Level, rank);
            }
            catch
            {
                NotificationTextBox.Text = string.Format(@"{0} would like to have you as a friend", message.From.User);
            }
        }
Exemplo n.º 2
0
        private void GotLeaguesForPlayer(SummonerLeaguesDTO result)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                string CurrentLP   = "";
                string CurrentTier = "";
                bool InPromo       = false;
                if (result.SummonerLeagues != null && result.SummonerLeagues.Count > 0)
                {
                    foreach (LeagueListDTO leagues in result.SummonerLeagues)
                    {
                        if (leagues.Queue == "RANKED_SOLO_5x5")
                        {
                            Client.Tier                  = leagues.RequestorsRank;
                            Client.TierName              = leagues.Tier;
                            Client.LeagueName            = leagues.Name;
                            CurrentTier                  = leagues.Tier + " " + leagues.RequestorsRank;
                            List <LeagueItemDTO> players = leagues.Entries.OrderBy(o => o.LeaguePoints).Where(item => item.Rank == leagues.RequestorsRank).ToList();
                            foreach (LeagueItemDTO player in players)
                            {
                                if (player.PlayerOrTeamName == Client.LoginPacket.AllSummonerData.Summoner.Name)
                                {
                                    TypedObject miniSeries = player.MiniSeries as TypedObject;
                                    string Series          = "";
                                    if (miniSeries != null)
                                    {
                                        Series  = ((string)miniSeries["progress"]).Replace('N', '-');
                                        InPromo = true;
                                    }
                                    CurrentLP = (player.LeaguePoints == 100 ? Series : Convert.ToString(player.LeaguePoints));
                                }
                            }
                        }
                    }
                }
                else
                {
                    PlayerProgressBar.Value            = 100;
                    PlayerProgressLabel.Content        = "Level 30";
                    PlayerCurrentProgressLabel.Content = "";
                    PlayerAimProgressLabel.Content     = "";
                }

                PlayerProgressLabel.Content = CurrentTier;
                if (InPromo)
                {
                    PlayerCurrentProgressLabel.Content = CurrentLP.Replace('N', '-');
                    PlayerProgressBar.Value            = 100;
                }
                else
                {
                    if (string.IsNullOrEmpty(CurrentLP))
                    {
                        CurrentLP = "0";
                    }
                    PlayerCurrentProgressLabel.Content = CurrentLP + "LP";
                    PlayerProgressBar.Value            = Convert.ToInt32(CurrentLP);
                }
            }));
        }
Exemplo n.º 3
0
        private void GotLeaguesForPlayer(SummonerLeaguesDTO result)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                string CurrentLP   = "";
                string CurrentTier = "";
                bool InPromo       = false;
                if (result.SummonerLeagues.Exists(x => x.Queue == "RANKED_SOLO_5x5") &&
                    result.SummonerLeagues.Count > 0)
                {
                    var leagues = result.SummonerLeagues.Single(x => x.Queue == "RANKED_SOLO_5x5");

                    Client.Tier                  = leagues.RequestorsRank;
                    Client.TierName              = leagues.Tier;
                    Client.LeagueName            = leagues.Name;
                    CurrentTier                  = leagues.Tier + " " + leagues.RequestorsRank;
                    List <LeagueItemDTO> players =
                        leagues.Entries.OrderBy(o => o.LeaguePoints)
                        .Where(item => item.Rank == leagues.RequestorsRank)
                        .ToList();
                    foreach (LeagueItemDTO player in players)
                    {
                        if (player.PlayerOrTeamName != Client.LoginPacket.AllSummonerData.Summoner.Name)
                        {
                            continue;
                        }

                        string Series = "";
                        if (player.MiniSeries != null)
                        {
                            Series  = player.MiniSeries.Progress.Replace('N', '-');
                            InPromo = true;
                        }
                        CurrentLP = (player.LeaguePoints == 100 ? Series : Convert.ToString(player.LeaguePoints));
                    }
                }

                else
                {
                    PlayerProgressBar.Value            = 100;
                    PlayerProgressLabel.Content        = "Level 30";
                    PlayerCurrentProgressLabel.Content = "";
                    PlayerAimProgressLabel.Content     = "";
                    return;
                }

                PlayerProgressLabel.Content = CurrentTier;
                if (InPromo)
                {
                    PlayerCurrentProgressLabel.Content = CurrentLP;
                    PlayerProgressBar.Value            = 100;
                }
                else
                {
                    PlayerCurrentProgressLabel.Content = CurrentLP + "LP";
                    PlayerProgressBar.Value            = Convert.ToInt32(CurrentLP);
                }
            }));
        }
Exemplo n.º 4
0
        private async void GotPlayerData(LoginDataPacket packet)
        {
            Client.RtmpConnection.MessageReceived += OnMessageReceived;
            AllSummonerData PlayerData = packet.AllSummonerData;

            SummonerNameLabel.Content = PlayerData.Summoner.Name;
            if (Client.LoginPacket.AllSummonerData.SummonerLevel.Level < 30)
            {
                PlayerProgressBar.Value            = (PlayerData.SummonerLevelAndPoints.ExpPoints / PlayerData.SummonerLevel.ExpToNextLevel) * 100;
                PlayerProgressLabel.Content        = String.Format("Level {0}", PlayerData.SummonerLevel.Level);
                PlayerCurrentProgressLabel.Content = String.Format("{0}XP", PlayerData.SummonerLevelAndPoints.ExpPoints);
                PlayerAimProgressLabel.Content     = String.Format("{0}XP", PlayerData.SummonerLevel.ExpToNextLevel);
            }
            else
            {
                SummonerLeaguesDTO MyLeagues = await RiotCalls.GetAllLeaguesForPlayer(PlayerData.Summoner.SumId);

                GotLeaguesForPlayer(MyLeagues);
            }

            if (packet.BroadcastNotification.broadcastMessages != null)
            {
                Dictionary <string, object> Message = packet.BroadcastNotification.broadcastMessages[0] as Dictionary <string, object>;
                BroadcastMessage.Text = Convert.ToString(Message["content"]);
            }

            foreach (PlayerStatSummary x in packet.PlayerStatSummaries.PlayerStatSummarySet)
            {
                if (x.PlayerStatSummaryTypeString == "Unranked")
                {
                    Client.IsRanked     = false;
                    Client.AmountOfWins = x.Wins;
                }
                if (x.PlayerStatSummaryTypeString == "RankedSolo5x5")
                {
                    Client.IsRanked     = true;
                    Client.AmountOfWins = x.Wins;
                    break;
                }
            }

            if (packet.ReconnectInfo != null)
            {
                ;
            }

            Client.InfoLabel.Content = "IP: " + Client.LoginPacket.IpBalance + " ∙ RP: " + Client.LoginPacket.RpBalance;
            int    ProfileIconID = Client.LoginPacket.AllSummonerData.Summoner.ProfileIconId;
            string uriSource     = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", ProfileIconID + ".png");

            ProfileImage.Source         = Client.GetImage(uriSource);
            Client.MainPageProfileImage = ProfileImage;

            RefreshTimer          = new System.Windows.Forms.Timer();
            RefreshTimer.Tick    += new EventHandler(RefreshTimer_Tick);
            RefreshTimer.Interval = 300000; // 5 minutes
            RefreshTimer.Start();
        }
Exemplo n.º 5
0
        public void Update(SummonerLeaguesDTO result)
        {
            MyLeagues = result;
            foreach (
                LeagueListDTO leagues in MyLeagues.SummonerLeagues.Where(leagues => leagues.Queue == "RANKED_SOLO_5x5"))
            {
                SelectedRank = leagues.RequestorsRank;
            }

            Queue = "RANKED_SOLO_5x5";
            RenderLeague();
        }
Exemplo n.º 6
0
        public void Update(SummonerLeaguesDTO result)
        {
            _myLeagues = result;
            foreach (
                var leagues in _myLeagues.SummonerLeagues.Where(leagues => leagues.Queue == "RANKED_SOLO_5x5"))
            {
                _selectedRank = leagues.RequestorsRank;
            }

            _queue = "RANKED_SOLO_5x5";
            RenderLeague();
        }
Exemplo n.º 7
0
        public async Task <SummonerLeaguesDTO> GetLeaguesForTeam(String teamName)
        {
            int Id = Invoke("leaguesServiceProxy", "getLeaguesForTeam", new object[] { teamName });

            while (!results.ContainsKey(Id))
            {
                await Task.Delay(10);
            }
            TypedObject        messageBody = results[Id].GetTO("data").GetTO("body");
            SummonerLeaguesDTO result      = new SummonerLeaguesDTO(messageBody);

            results.Remove(Id);
            return(result);
        }
Exemplo n.º 8
0
        public async Task <SummonerLeaguesDTO> GetAllLeaguesForPlayer(Double summonerId)
        {
            int Id = Invoke("leaguesServiceProxy", "getAllLeaguesForPlayer", new object[] { summonerId });

            while (!results.ContainsKey(Id))
            {
                await Task.Delay(10);
            }
            TypedObject        messageBody = results[Id].GetTO("data").GetTO("body");
            SummonerLeaguesDTO result      = new SummonerLeaguesDTO(messageBody);

            results.Remove(Id);
            return(result);
        }
Exemplo n.º 9
0
        public void SetStats(PublicSummoner summoner, SummonerLeaguesDTO leagueInfo, PlayerLifetimeStats stats)
        {
            if (summoner == null || stats == null)
            {
                return;
            }

            if (InvokeRequired)
            {
                Invoke(new Action <PublicSummoner, SummonerLeaguesDTO, PlayerLifetimeStats>(SetStats), summoner, leagueInfo, stats);
                return;
            }

            RemoveAll(p => (p.Tag as string) == "Stats");

            var nameMap = new Dictionary <string, string>()
            {
                { "RankedSolo5x5", "RANKED_SOLO_5x5" },
                { "RankedTeam5x5", "RANKED_TEAM_5x5" },
                { "RankedTeam3x3", "RANKED_TEAM_3x3" }
            };

            foreach (var stat in stats.PlayerStatSummaries.PlayerStatSummarySet)
            {
                var sc = new StatsControl {
                    Dock = DockStyle.Fill, Tag = "Stats"
                };

                Dictionary <string, object> queueInfo = null;
                if (leagueInfo != null)
                {
                    string queueType;
                    if (nameMap.TryGetValue(stat.PlayerStatSummaryTypeString, out queueType))
                    {
                        queueInfo = leagueInfo.GetQueueByName(queueType);
                    }
                }

                sc.SetStatSummary(stat, SummonerLeaguesDTO.GetRanking(queueInfo));

                var tab = new TabPage(MinifyStatType(stat.PlayerStatSummaryType))
                {
                    BackColor = this.BackColor,
                    Tag       = "Stats"
                };
                tab.Controls.Add(sc);
                AddTab(tab);
            }
        }
Exemplo n.º 10
0
 private void GotLeaguesForPlayer(SummonerLeaguesDTO result)
 {
     Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
     {
         if (result.SummonerLeagues != null && result.SummonerLeagues.Count > 0)
         {
             LeagueHeader.Visibility = System.Windows.Visibility.Visible;
             Leagues overview        = LeaguesContainer.Content as Leagues;
             overview.Update(result);
         }
         else
         {
             LeagueHeader.Visibility = System.Windows.Visibility.Collapsed;
         }
     }));
 }
Exemplo n.º 11
0
        public void SetLeagueInfo(SummonerLeaguesDTO leagueInfo)
        {
            if (InvokeRequired)
            {
                Invoke(new Action <SummonerLeaguesDTO>(SetLeagueInfo), leagueInfo);
                return;
            }

            if (leagueInfo == null)
            {
                SetRanking("???");
            }
            else
            {
                Dictionary <string, object> queueInfo = leagueInfo.GetQueueByName("RANKED_SOLO_5x5");
                SetRanking(SummonerLeaguesDTO.GetRanking(queueInfo));
            }
        }
Exemplo n.º 12
0
        public void SetLeagueInfo(PublicSummoner summoner, SummonerLeaguesDTO leagueInfo)
        {
            if (summoner == null || leagueInfo == null)
            {
                return;
            }

            if (InvokeRequired)
            {
                Invoke(new Action <PublicSummoner, SummonerLeaguesDTO>(SetLeagueInfo), summoner, leagueInfo);
                return;
            }
            foreach (var entry in leagueInfo.summonerLeagues)
            {
                foreach (var entry2 in entry.entries)
                {
                    if (entry2.PlayerOrTeamName.Equals(summoner.Name))
                    {
                        division.Text = entry2.Tier + "." + ToInt(entry2.Rank) + "." + entry2.LeaguePoints;
                        return;
                    }
                }
            }
        }
Exemplo n.º 13
0
        private async void GetPlayerLeagues()
        {
            foreach (QueuePopPlayer item in Team1ListBox.Items)
            {
                var playerInfo = item.Tag as PlayerParticipant;
                await Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() =>
                {
                    SummonerLeaguesDTO playerLeagues =
                        await RiotCalls.GetAllLeaguesForPlayer(playerInfo.SummonerId);

                    foreach (
                        LeagueListDTO x in
                        playerLeagues.SummonerLeagues.Where(x => x.Queue == "RANKED_SOLO_5x5"))
                    {
                        item.RankLabel.Content = x.Tier + " " + x.RequestorsRank;
                    }

                    if (string.IsNullOrEmpty(item.RankLabel.Content.ToString()))
                    {
                        item.RankLabel.Content = "Unranked";
                    }
                }));
            }
        }
        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 RiotCalls.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 RiotCalls.AcceptPoppedGame(true);
            }
        }
Exemplo n.º 15
0
        private async void ChampPlayer_MouseOver(object sender, MouseEventArgs e)
        {
            if (!KnownPar)
            {
                return;
            }


            if (_stats == null)
            {
                _stats = new PlayerStatisticsChampSelect();
                var summoner = await Client.PVPNet.GetSummonerByName(_sumName);

                if (summoner.SummonerLevel < 30)
                {
                    _stats.Rank.Content = "Level " + summoner.SummonerLevel;
                }
                else
                {
                    SummonerLeaguesDTO playerLeagues = await Client.PVPNet.GetAllLeaguesForPlayer(summoner.SummonerId);

                    _stats.Rank.Content = playerLeagues.SummonerLeagues;

                    foreach (LeagueListDTO x in playerLeagues.SummonerLeagues.Where(x => x.Queue == "RANKED_SOLO_5x5"))
                    {
                        _stats.Rank.Content = x.Tier + " " + x.RequestorsRank;
                    }

                    if (String.IsNullOrEmpty(_stats.Rank.Content.ToString()))
                    {
                        _stats.Rank.Content = "Unranked";
                    }
                }
                if (summoner == null || _stats == null || summoner.InternalName.Contains("bot"))
                {
                    _stats = null;
                    return;
                }
                var topChampions = await Client.PVPNet.RetrieveTopPlayedChampions(summoner.AcctId, "CLASSIC");

                foreach (var x in topChampions)
                {
                    Debugger.Log(0, "CHAMPS", x.ChampionId + Environment.NewLine);
                }
                //_stats.PlayerName.Content = PlayerName.Content;
                GetKDA kda;
                if (topChampions.Length > 0 && KnownPar)
                {
                    if (topChampions[0].ChampionId != 0)
                    {
                        _stats.MostPlayed.Source = champions.GetChampion((int)topChampions[0].ChampionId).icon;
                        _stats.Champion1.Content = champions.GetChampion((int)topChampions[0].ChampionId).displayName +
                                                   " - Games: " + topChampions[0].TotalGamesPlayed;
                        var wins  = 0.0;
                        var total = 0.0;
                        kda = new GetKDA((int)summoner.AcctId, (int)topChampions[0].ChampionId);
                        kda.stats.ChampID = (int)topChampions[0].ChampionId;

                        string[] xz = await kda.stats.Load((int)summoner.AcctId);

                        _stats.MPChamp.Content = xz[0];
                        foreach (var stat in topChampions[0].Stats)
                        {
                            switch (stat.StatType)
                            {
                            case "TOTAL_SESSIONS_WON":
                                wins = stat.Value;
                                break;

                            case "TOTAL_SESSIONS_PLAYED":
                                total = stat.Value;
                                break;
                            }
                        }

                        if ((Math.Abs(wins / total * 100.0) > 0) && Math.Abs(total) > 0)
                        {
                            _stats.Champ1ProgressBar.Value = wins / total * 100.0;
                        }
                    }
                    else if (topChampions[1].ChampionId != 0 && topChampions.Length > 1)
                    {
                        if (topChampions[1].ChampionId != 0)
                        {
                            try
                            {
                                _stats.MostPlayed.Source = champions.GetChampion((int)topChampions[1].ChampionId).icon;
                                _stats.Champion1.Content = champions.GetChampion((int)topChampions[1].ChampionId).displayName +
                                                           " - Games: " + topChampions[1].TotalGamesPlayed;
                                var wins  = 0.0;
                                var total = 0.0;
                                kda = new GetKDA((int)summoner.AcctId, (int)topChampions[1].ChampionId);
                                kda.stats.ChampID = (int)topChampions[1].ChampionId;
                                string[] x = await kda.stats.Load((int)summoner.AcctId);

                                _stats.MPChamp.Content = x[0];
                                foreach (var stat in topChampions[1].Stats)
                                {
                                    switch (stat.StatType)
                                    {
                                    case "TOTAL_SESSIONS_WON":
                                        wins = stat.Value;
                                        break;

                                    case "TOTAL_SESSIONS_PLAYED":
                                        total = stat.Value;
                                        break;
                                    }
                                }

                                if ((Math.Abs(wins / total * 100.0) > 0) && Math.Abs(total) > 0)
                                {
                                    _stats.Champ1ProgressBar.Value = wins / total * 100.0;
                                }
                                else
                                {
                                    _stats.Champ1ProgressBar.Visibility = Visibility.Hidden;
                                }
                            }
                            catch { }
                        }
                    }
                    else
                    {
                        _stats.Champ1ProgressBar.Visibility = Visibility.Hidden;
                        _stats.Champion1.Visibility         = Visibility.Hidden;
                    }

                    kda = new GetKDA((int)summoner.AcctId, 103);
                    kda.stats.ChampID = 103;
                    string[] xm = await kda.stats.Load((int)summoner.AcctId);

                    try
                    {
                        _stats.Overall.Content         = xm[1];
                        _stats.Champ3ProgressBar.Value = kda.stats.WinLossRatio;
                    }
                    catch { }

                    //
                    if (_champID != 0)
                    {
                        kda = new GetKDA((int)summoner.AcctId, _champID);
                        kda.stats.ChampID = _champID;
                        string[] xmt = await kda.stats.Load((int)summoner.AcctId);

                        if (!String.IsNullOrEmpty(xmt[0]))
                        {
                            try
                            {
                                _stats.Champ2ProgressBar.Value = kda.stats.WinLossChampRatio;
                                _stats.CurrentChamp.Content    = xmt[0];
                            }
                            catch
                            {
                                try
                                {
                                    _stats.Champ2ProgressBar.Visibility = Visibility.Hidden;
                                    _stats.CurrentChamp.Content         = "NO GAMES!";
                                }
                                catch { }
                            }
                        }
                        else
                        {
                            try
                            {
                                _stats.Champ2ProgressBar.Value = 0;
                                _stats.CurrentChamp.Content    = "NO GAMES!";
                            }
                            catch { }
                        }
                    }


                    Client.MainGrid.Children.Add(_stats);
                }
                try
                {
                    var mouseLocation = e.GetPosition(Client.MainGrid);
                    var yMargin       = mouseLocation.Y - 25;
                    if (Mouse.GetPosition(Client.MainGrid).X < 200)
                    {
                        _stats.HorizontalAlignment = HorizontalAlignment.Left;
                        _stats.VerticalAlignment   = VerticalAlignment.Top;
                        _stats.Margin = new Thickness(142, yMargin, 0, 0);
                    }
                    else
                    {
                        _stats.HorizontalAlignment = HorizontalAlignment.Right;
                        _stats.VerticalAlignment   = VerticalAlignment.Top;
                        _stats.Margin = new Thickness(0, yMargin, 155, 0);
                    }
                }
                catch { }
            }
        }
Exemplo n.º 16
0
        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   = "";

                        await Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() =>
                        {
                            SummonerLeaguesDTO playerLeagues =
                                await Client.PVPNet.GetAllLeaguesForPlayer(playerPart.SummonerId);

                            foreach (
                                LeagueListDTO x in
                                playerLeagues.SummonerLeagues.Where(x => x.Queue == "RANKED_SOLO_5x5"))
                            {
                                player.RankLabel.Content = x.Tier + " " + x.RequestorsRank;
                            }

                            if (String.IsNullOrEmpty(player.RankLabel.Content.ToString()))
                            {
                                player.RankLabel.Content = "Unranked";
                            }
                        }));

                        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);
                }
            }
            if (!Client.AutoAcceptQueue)
            {
                return;
            }

            await Client.PVPNet.AcceptPoppedGame(true);

            accepted = true;
        }
Exemplo n.º 17
0
        /// 33.)
        public void GetAllLeaguesForPlayer(Double summonerId, SummonerLeaguesDTO.Callback callback)
        {
            SummonerLeaguesDTO cb = new SummonerLeaguesDTO(callback);

            InvokeWithCallback("leaguesServiceProxy", "getAllLeaguesForPlayer", new object[] { summonerId }, cb);
        }
        public async void GetSummonerProfile(string s)
        {
            PublicSummoner Summoner = await RiotCalls.GetSummonerByName(String.IsNullOrWhiteSpace(s)?Client.LoginPacket.AllSummonerData.Summoner.Name : s);

            if (Summoner == null)
            {
                MessageOverlay overlay = new MessageOverlay();
                overlay.MessageTitle.Content       = "No Summoner Found";
                overlay.MessageTextBox.Text        = "The summoner \"" + s + "\" does not exist.";
                Client.OverlayContainer.Content    = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
                return;
            }
            SummonerNameLabel.Content  = Summoner.Name;
            SummonerLevelLabel.Content = "Level " + Summoner.SummonerLevel;

            if (Summoner.SummonerLevel < 30)
            {
                LeagueHeader.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                SummonerLeaguesDTO dto = await RiotCalls.GetAllLeaguesForPlayer(Summoner.SummonerId);

                GotLeaguesForPlayer(dto);
            }

            int ProfileIconID = Summoner.ProfileIconId;
            var uriSource     = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", ProfileIconID + ".png");

            ProfileImage.Source = Client.GetImage(uriSource);

            try
            {
                PlatformGameLifecycleDTO n = await RiotCalls.RetrieveInProgressSpectatorGameInfo(s);

                InGameHeader.Visibility = Visibility.Visible;
                InGameHeader.IsSelected = true;
                Ingame ingame = InGameContainer.Content as Ingame;
                ingame.Update(n);
            }
            catch
            {
                InGameHeader.Visibility   = Visibility.Collapsed;
                OverviewHeader.IsSelected = true;
            }

            if (Summoner.Name == Client.LoginPacket.AllSummonerData.Summoner.Name)
            {
                ChampionsTab.Visibility = System.Windows.Visibility.Visible;
                SkinsTab.Visibility     = System.Windows.Visibility.Visible;
            }
            else
            {
                ChampionsTab.Visibility = System.Windows.Visibility.Hidden;
                SkinsTab.Visibility     = System.Windows.Visibility.Hidden;
            }

            MatchHistory history = MatchHistoryContainer.Content as MatchHistory;

            history.Update(Summoner.AcctId);

            Overview overview = OverviewContainer.Content as Overview;

            overview.Update(Summoner.SummonerId, Summoner.AcctId);
        }
Exemplo n.º 19
0
        /// 24.)
        public void GetLeaguesForTeam(String teamName, SummonerLeaguesDTO.Callback callback)
        {
            SummonerLeaguesDTO cb = new SummonerLeaguesDTO(callback);

            InvokeWithCallback("leaguesServiceProxy", "getLeaguesForTeam", new object[] { teamName }, cb);
        }
Exemplo n.º 20
0
        /// 13.)
        public void GetAllMyLeagues(SummonerLeaguesDTO.Callback callback)
        {
            SummonerLeaguesDTO cb = new SummonerLeaguesDTO(callback);

            InvokeWithCallback("leaguesServiceProxy", "getAllMyLeagues", new object[] { }, cb);
        }
Exemplo n.º 21
0
        void AnalyseSummonerProfile(List <string> arguments)
        {
            string         summonerName   = GetSummonerName(arguments[0]);
            PublicSummoner publicSummoner = RPC.GetSummonerByName(summonerName);

            if (publicSummoner == null)
            {
                NoSuchSummoner();
                return;
            }

            SummonerLeaguesDTO summonerLeagues = RPC.GetAllLeaguesForPlayer(publicSummoner.summonerId);

            Output.WriteLine("Name: {0}", publicSummoner.name);
            Output.WriteLine("Account ID: {0}", publicSummoner.acctId);
            Output.WriteLine("Summoner ID: {0}", publicSummoner.summonerId);
            Output.WriteLine("Summoner level: {0}", publicSummoner.summonerLevel);

            foreach (var league in summonerLeagues.summonerLeagues)
            {
                int?leaguePoints = null;
                foreach (var entry in league.entries)
                {
                    try
                    {
                        int id = Convert.ToInt32(entry.playerOrTeamId);
                        if (publicSummoner.summonerId == id)
                        {
                            leaguePoints = entry.leaguePoints;
                            break;
                        }
                    }
                    catch (Exception)
                    {
                        // playerOrTeamId may be a strange string like "TEAM-xxx" for team queue
                        break;
                    }
                }
                Output.WriteLine("League ({0}): {1} {2}, {3} LP ({4})", league.queue, league.tier, league.requestorsRank, leaguePoints == null ? "?" : leaguePoints.Value.ToString(), league.name);
            }

            string[] seasonStrings =
            {
                "CURRENT",
                "TWO",
                "ONE",
            };

            foreach (string seasonString in seasonStrings)
            {
                Output.WriteLine("Season: \"{0}\"", seasonString);

                PlayerLifeTimeStats lifeTimeStatistics = RPC.RetrievePlayerStatsByAccountID(publicSummoner.acctId, seasonString);
                if (lifeTimeStatistics == null)
                {
                    Output.WriteLine("Unable to retrieve lifetime statistics");
                    return;
                }

                List <PlayerStatSummary> summaries = lifeTimeStatistics.playerStatSummaries.playerStatSummarySet;

                //The hidden "Team" variants of the "Premade" ratings are currently unused, it seems
                AnalayseStatistics("Unranked Summoner's Rift/Twisted Treeline", "Unranked", summaries);
                AnalayseStatistics("Ranked Twisted Treeline (team)", "RankedPremade3x3", summaries);
                AnalayseStatistics("Ranked Summoner's Rift (solo)", "RankedSolo5x5", summaries);
                AnalayseStatistics("Ranked Summoner's Rift (team)", "RankedPremade5x5", summaries);
                AnalayseStatistics("Unranked Dominion", "OdinUnranked", summaries);
            }
        }
Exemplo n.º 22
0
        void AnalyseEnvironmentalRating(List <string> arguments, bool ranked, string season, bool lastGameMode)
        {
            if (arguments.Count == 0)
            {
                return;
            }
            string summonerName  = GetSummonerName(arguments[0]);
            var    excludedNames = new List <string>();

            for (int i = 1; i < arguments.Count; i++)
            {
                excludedNames.Add(GetSummonerName(arguments[i]));
            }
            PublicSummoner         publicSummoner = new PublicSummoner();
            List <PlayerGameStats> recentGames    = new List <PlayerGameStats>();
            bool foundSummoner = GetRecentGames(summonerName, ref publicSummoner, ref recentGames);

            if (!foundSummoner)
            {
                NoSuchSummoner();
                return;
            }

            var knownSummoners = new HashSet <string>();
            var ratings        = new List <LeagueRating>();
            int gameCount      = 0;

            foreach (var stats in recentGames)
            {
                GameResult result = new GameResult(stats);
                if (
                    (stats.gameType == "PRACTICE_GAME") ||
                    (!ranked && stats.queueType != "NORMAL") ||
                    (ranked && stats.queueType != "RANKED_SOLO_5x5")
                    )
                {
                    continue;
                }
                var ids = new List <int>();
                foreach (var fellowPlayer in stats.fellowPlayers)
                {
                    ids.Add(fellowPlayer.summonerId);
                }
                var  names       = RPC.GetSummonerNames(ids);
                bool isValidGame = true;
                foreach (var name in excludedNames)
                {
                    if (names.IndexOf(name) >= 0)
                    {
                        isValidGame = false;
                        break;
                    }
                }
                if (!isValidGame)
                {
                    continue;
                }
                gameCount++;
                foreach (var name in names)
                {
                    if (knownSummoners.Contains(name))
                    {
                        continue;
                    }
                    knownSummoners.Add(name);
                    PublicSummoner summoner = RPC.GetSummonerByName(name);
                    if (summoner == null)
                    {
                        Console.WriteLine("Unable to load summoner {0}", name);
                        return;
                    }

                    SummonerLeaguesDTO leagues = RPC.GetAllLeaguesForPlayer(summoner.summonerId);
                    if (leagues == null)
                    {
                        Console.WriteLine("Unable to retrieve leagues for summoner {0}", name);
                        return;
                    }

                    bool         isRanked = false;
                    const string target   = "RANKED_SOLO_5x5";
                    foreach (var league in leagues.summonerLeagues)
                    {
                        if (league.queue != target)
                        {
                            continue;
                        }
                        LeagueRating rating = new LeagueRating(name, league.tier, league.requestorsRank);
                        Console.ForegroundColor = rating.Colour;
                        Console.WriteLine("{0}: {1} {2}", rating.SummonerName, rating.TierString, rating.RankString);
                        Console.ForegroundColor = ConsoleColor.Gray;
                        ratings.Add(rating);
                        isRanked = true;
                        break;
                    }
                    if (!isRanked)
                    {
                        Console.WriteLine("{0}: unranked", summoner.name);
                    }
                }
                if (lastGameMode)
                {
                    break;
                }
            }

            if (gameCount == 0)
            {
                Console.WriteLine("No games found");
                return;
            }

            ratings.Sort();

            LeagueRating median = ratings[ratings.Count / 2 + ratings.Count % 2];

            Console.Write("Median: ", median.TierString, median.RankString);
            Console.ForegroundColor = median.Colour;
            Console.WriteLine("{0} {1}", median.TierString, median.RankString);
            Console.ForegroundColor = ConsoleColor.Gray;

            int   playerCount   = 9 * gameCount;
            int   rankedPlayers = ratings.Count;
            float rankedRatio   = (float)rankedPlayers / playerCount;

            Console.WriteLine("Ranked players: {0}/{1} ({2:F1}%)", rankedPlayers, playerCount, rankedRatio * 100);
        }