public EndOfGamePage(EndOfGameStats Statistics)
        {
            InitializeComponent();
            RenderStats(Statistics);
            Client.SwitchPage(new MainPage());
            Client.runonce = false;

            string ObfuscatedName = Client.GetObfuscatedChatroomName(Statistics.RoomName, ChatPrefixes.Post_Game); //Why do you need to replace INVID with invid Riot?
            string JID = Client.GetChatroomJID(ObfuscatedName, Statistics.RoomPassword, false);
            newRoom = Client.ConfManager.GetRoom(new jabber.JID(JID));
            newRoom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name;
            newRoom.OnRoomMessage += newRoom_OnRoomMessage;
            newRoom.OnParticipantJoin += newRoom_OnParticipantJoin;
            newRoom.Join(Statistics.RoomPassword);
        }
Esempio n. 2
0
        //internal static Inviter CurrentInviter;

#pragma warning disable 4014

        internal static void OnMessageReceived(object sender, object message)
        {
            MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() =>
            {
                if (message is StoreAccountBalanceNotification)
                {
                    StoreAccountBalanceNotification newBalance = (StoreAccountBalanceNotification)message;
                    InfoLabel.Content            = "IP: " + newBalance.Ip + " ∙ RP: " + newBalance.Rp;
                    Client.LoginPacket.IpBalance = newBalance.Ip;
                    Client.LoginPacket.RpBalance = newBalance.Rp;
                }
                else if (message is GameNotification)
                {
                    GameNotification notification    = (GameNotification)message;
                    MessageOverlay messageOver       = new MessageOverlay();
                    messageOver.MessageTitle.Content = notification.Type;
                    switch (notification.Type)
                    {
                    case "PLAYER_BANNED_FROM_GAME":
                        messageOver.MessageTitle.Content = "Banned from custom game";
                        messageOver.MessageTextBox.Text  = "You have been banned from this custom game!";
                        break;

                    default:
                        messageOver.MessageTextBox.Text = notification.MessageCode + Environment.NewLine;
                        messageOver.MessageTextBox.Text = Convert.ToString(notification.MessageArgument);
                        break;
                    }
                    Client.OverlayContainer.Content    = messageOver.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                    Client.ClearPage(typeof(CustomGameLobbyPage));
                    if (messageOver.MessageTitle.Content.ToString() != "PLAYER_QUIT")
                    {
                        Client.SwitchPage(new MainPage());
                    }
                }
                else if (message is PVPNetConnect.RiotObjects.Platform.Statistics.EndOfGameStats)
                {
                    PVPNetConnect.RiotObjects.Platform.Statistics.EndOfGameStats stats = message as PVPNetConnect.RiotObjects.Platform.Statistics.EndOfGameStats;
                    EndOfGamePage EndOfGame = new EndOfGamePage(stats);
                    Client.ClearPage(typeof(TeamQueuePage));
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                    Client.OverlayContainer.Content    = EndOfGame.Content;
                }
                else if (message is StoreFulfillmentNotification)
                {
                    PlayerChampions = await PVPNet.GetAvailableChampions();
                }
                else if (message is Inviter)
                {
                    Inviter stats = message as Inviter;
                    //CurrentInviter = stats;
                }
                else if (message is InvitationRequest)
                {
                    InvitationRequest stats = message as InvitationRequest;
                    //TypedObject body = (TypedObject)to["body"];
                    if (stats.Inviter != null)
                    {
                        try
                        {
                            //Already existant popup. Do not create a new one
                            var x = Client.InviteData[stats.InvitationId];
                            if (x.Inviter != null)
                            {
                                return;
                            }
                        }
                        catch
                        {
                        }
                        MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                        {
                            GameInvitePopup pop     = new GameInvitePopup(stats);
                            pop.HorizontalAlignment = HorizontalAlignment.Right;
                            pop.VerticalAlignment   = VerticalAlignment.Bottom;
                            pop.Height = 230;
                            Client.NotificationGrid.Children.Add(pop);
                        }));
                    }
                }
            }));
        }
Esempio n. 3
0
 public EndOfGameStats GetTeamEndOfGameStats(TeamId arg0, double arg1)
 {
     int Id = Invoke("playerStatsService", "getTeamEndOfGameStats",
         new object[] { arg0.GetBaseTypedObject(), arg1 });
     while (!results.ContainsKey(Id))
         System.Threading.Thread.Sleep(10);
     TypedObject messageBody = results[Id].GetTO("data").GetTO("body");
     EndOfGameStats result = new EndOfGameStats(messageBody);
     results.Remove(Id);
     return result;
 }
Esempio n. 4
0
 /// 26.)
 public void GetTeamEndOfGameStats(TeamId arg0, double arg1, EndOfGameStats.Callback callback)
 {
     EndOfGameStats cb = new EndOfGameStats(callback);
     InvokeWithCallback("playerStatsService", "getTeamEndOfGameStats",
         new object[] { arg0.GetBaseTypedObject(), arg1 }, cb);
 }
        private void RenderStats(EndOfGameStats Statistics)
        {
            TimeSpan t = TimeSpan.FromSeconds(Statistics.GameLength);
            TimeLabel.Content = string.Format("{0:D2}:{1:D2}", t.Minutes, t.Seconds);
            ModeLabel.Content = Statistics.GameMode;
            TypeLabel.Content = Statistics.GameType;

            List<PlayerParticipantStatsSummary> AllParticipants = new List<PlayerParticipantStatsSummary>(Statistics.TeamPlayerParticipantStats.ToArray());
            AllParticipants.AddRange(Statistics.OtherTeamPlayerParticipantStats);

            foreach (PlayerParticipantStatsSummary summary in AllParticipants)
            {
                EndOfGamePlayer playerStats = new EndOfGamePlayer();
                champions Champ = champions.GetChampion(summary.SkinName); //Misleading variable name
                playerStats.ChampImage.Source = Champ.icon;
                playerStats.ChampLabel.Content = Champ.name;
                playerStats.PlayerLabel.Content = summary.SummonerName;
                var uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "spell", SummonerSpell.GetSpellImageName((int)summary.Spell1Id));
                playerStats.Spell1Image.Source = Client.GetImage(uriSource);
                uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "spell", SummonerSpell.GetSpellImageName((int)summary.Spell2Id));
                playerStats.Spell2Image.Source = Client.GetImage(uriSource);

                double ChampionsKilled = 0;
                double Assists = 0;
                double Deaths = 0;

                foreach (RawStatDTO stat in summary.Statistics)
                {
                    if (stat.StatTypeName.StartsWith("ITEM") && stat.Value != 0)
                    {
                        Image item = new Image();
                        uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "item", stat.Value + ".png");
                        item.Source = Client.GetImage(uriSource);
                        playerStats.ItemsListView.Items.Add(item);
                    }

                    switch (stat.StatTypeName)
                    {
                        case "GOLD_EARNED":
                            if (stat.Value > 0)
                            {
                                playerStats.GoldLabel.Content = string.Format("{0:N1}k", stat.Value / 1000);
                            }
                            break;

                        case "MINIONS_KILLED":
                            playerStats.CSLabel.Content = stat.Value;
                            break;

                        case "LEVEL":
                            playerStats.LevelLabel.Content = stat.Value;
                            break;

                        case "CHAMPIONS_KILLED":
                            ChampionsKilled = stat.Value;
                            break;

                        case "ASSISTS":
                            Assists = stat.Value;
                            break;

                        case "NUM_DEATHS":
                            Deaths = stat.Value;
                            break;

                        default:
                            break;
                    }
                }

                playerStats.ScoreLabel.Content = ChampionsKilled + "/" + Deaths + "/" + Assists;

                PlayersListView.Items.Add(playerStats);
            }

            PlayersListView.Items.Insert(AllParticipants.Count / 2, new Separator());

            /*championSkins Skin = championSkins.GetSkin(Statistics.SkinIndex);
            var skinSource = Path.Combine(Client.ExecutingDirectory, "Assets", "champions", Skin.splashPath);
            SkinImage.Source = Client.GetImage(skinSource);*/
        }
 public EndOfGamePage(EndOfGameStats Statistics)
 {
     InitializeComponent();
     RenderStats(Statistics);
 }
Esempio n. 7
0
        //TODO: Clean this up
        public void SimulateEndOfGame()
        {
            EndOfGameStats fakeStats = new EndOfGameStats();
            fakeStats.TalentPointsGained = 0;
            fakeStats.Ranked = false;
            fakeStats.LeveledUp = false;
            fakeStats.SkinIndex = 6001;
            fakeStats.QueueBonusEarned = 14;
            fakeStats.GameType = "MATCHED_GAME";
            fakeStats.ExperienceEarned = 0;
            fakeStats.ImbalancedTeamsNoPoints = false;
            fakeStats.BasePoints = 32;
            fakeStats.ReportGameId = 22036662;
            fakeStats.Difficulty = null;
            fakeStats.GameLength = 1411;
            fakeStats.BoostXpEarned = 0;
            fakeStats.Invalid = false;
            fakeStats.OtherTeamInfo = null;
            fakeStats.RoomName = "endGame22036662";
            fakeStats.CustomMinutesLeftToday = 120;
            fakeStats.UserId = 200006292;
            fakeStats.CoOpVsAiMinutesLeftToday = 180;
            fakeStats.LoyaltyBoostIpEarned = 0;
            fakeStats.RpEarned = 0;
            fakeStats.CompletionBonusPoints = 0;
            fakeStats.CoOpVsAiMsecsUntilReset = 0;
            fakeStats.BoostIpEarned = 0;
            fakeStats.ExperienceTotal = 23;
            fakeStats.GameId = 125432223;
            fakeStats.TimeUntilNextFirstWinBonus = 0;
            fakeStats.LoyaltyBoostXpEarned = 0;
            fakeStats.RoomPassword = "******";
            fakeStats.Elo = 0;
            fakeStats.IpEarned = 0;
            fakeStats.FirstWinBonus = 0;
            fakeStats.SendStatsToTournamentProvider = false;
            fakeStats.EloChange = 0;
            fakeStats.GameMode = "ARAM";
            fakeStats.QueueType = "ARAM_UNRANKED_5x5";
            fakeStats.OdinBonusIp = 0;
            fakeStats.IpTotal = 295513;
            fakeStats.CustomMsecsUntilReset = -1;
            fakeStats.TeamPlayerParticipantStats = new List<PlayerParticipantStatsSummary>();
            fakeStats.OtherTeamPlayerParticipantStats = new List<PlayerParticipantStatsSummary>();

            for (int i = 0; i < 10; i++)
            {
                PlayerParticipantStatsSummary fakePlayer = new PlayerParticipantStatsSummary();
                fakePlayer.SkinName = "Urgot";
                fakePlayer.GameId = 22035552;
                fakePlayer.ProfileIconId = 550;
                fakePlayer.Elo = 0;
                fakePlayer.Leaver = false;
                fakePlayer.Leaves = 3;
                fakePlayer.TeamId = 200;
                fakePlayer.EloChange = 0;
                fakePlayer.Level = 30;
                fakePlayer.BotPlayer = false;
                fakePlayer.UserId = 331458;
                fakePlayer.Spell2Id = 4;
                fakePlayer.Spell1Id = 21;
                fakePlayer.Losses = 59;
                fakePlayer.SummonerName = "Snowl";
                fakePlayer.Wins = 64;
                fakePlayer.Statistics = new List<RawStatDTO>();
                RawStatDTO Item0 = new RawStatDTO();
                Item0.StatTypeName = "ITEM0";
                Item0.Value = 3181;
                fakePlayer.Statistics.Add(Item0);
                RawStatDTO Item1 = new RawStatDTO();
                Item1.StatTypeName = "ITEM1";
                Item1.Value = 3046;
                fakePlayer.Statistics.Add(Item1);
                RawStatDTO Item2 = new RawStatDTO();
                Item2.StatTypeName = "ITEM2";
                Item2.Value = 3006;
                fakePlayer.Statistics.Add(Item2);
                RawStatDTO Item3 = new RawStatDTO();
                Item3.StatTypeName = "ITEM3";
                Item3.Value = 3031;
                fakePlayer.Statistics.Add(Item3);
                RawStatDTO Item4 = new RawStatDTO();
                Item4.StatTypeName = "ITEM4";
                Item4.Value = 1055;
                fakePlayer.Statistics.Add(Item4);
                RawStatDTO Item5 = new RawStatDTO();
                Item5.StatTypeName = "ITEM5";
                Item5.Value = 1036;
                fakePlayer.Statistics.Add(Item5);
                RawStatDTO Item6 = new RawStatDTO();
                Item6.StatTypeName = "ITEM6";
                Item6.Value = 0;
                fakePlayer.Statistics.Add(Item6);
                RawStatDTO GOLDEARNED = new RawStatDTO();
                GOLDEARNED.StatTypeName = "GOLD_EARNED";
                GOLDEARNED.Value = 11736;
                fakePlayer.Statistics.Add(GOLDEARNED);
                RawStatDTO Assists = new RawStatDTO();
                Assists.StatTypeName = "ASSISTS";
                Assists.Value = 23;
                RawStatDTO NUMDEATHS = new RawStatDTO();
                NUMDEATHS.StatTypeName = "NUM_DEATHS";
                NUMDEATHS.Value = 0;
                fakePlayer.Statistics.Add(NUMDEATHS);
                RawStatDTO LEVEL = new RawStatDTO();
                LEVEL.StatTypeName = "LEVEL";
                LEVEL.Value = 17;
                fakePlayer.Statistics.Add(LEVEL);
                RawStatDTO CHAMPIONSKILLED = new RawStatDTO();
                CHAMPIONSKILLED.StatTypeName = "CHAMPIONS_KILLED";
                CHAMPIONSKILLED.Value = 99;
                fakePlayer.Statistics.Add(CHAMPIONSKILLED);
                RawStatDTO MinionsKILLED = new RawStatDTO();
                MinionsKILLED.StatTypeName = "MINIONS_KILLED";
                MinionsKILLED.Value = 60;
                fakePlayer.Statistics.Add(MinionsKILLED);
                RawStatDTO WIN = new RawStatDTO();
                WIN.StatTypeName = "WIN";
                WIN.Value = 1;
                fakePlayer.Statistics.Add(WIN);
                if (i < 5)
                {
                    fakeStats.OtherTeamPlayerParticipantStats.Add(fakePlayer);
                }
                else
                {
                    fakeStats.TeamPlayerParticipantStats.Add(fakePlayer);
                }
            }

            MessageReceived(fakeStats);
        }
 public EndOfGamePage(EndOfGameStats Statistics)
 {
     InitializeComponent();
     RenderStats(Statistics);
     Client.SwitchPage(new MainPage());
 }
 public async Task<EndOfGameStats> GetTeamEndOfGameStats(TeamId arg0, Double arg1)
 {
     int Id = Invoke("playerStatsService", "getTeamEndOfGameStats",
         new object[] { arg0.GetBaseTypedObject(), arg1 });
     while (!results.ContainsKey(Id))
         await Task.Delay(10);
     TypedObject messageBody = results[Id].GetTO("data").GetTO("body");
     EndOfGameStats result = new EndOfGameStats(messageBody);
     results.Remove(Id);
     return result;
 }
        void item_MouseDown(object sender, MouseButtonEventArgs e)
        {
            ReplayItem item = (ReplayItem)sender;
            EndOfGameStats stats = (EndOfGameStats)item.Tag;
            selectedStats = stats;

            ReplayOverviewGrid.Visibility = Visibility.Visible;
            var fadeGridInAnimation = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1));
            ReplayOverviewGrid.BeginAnimation(Grid.OpacityProperty, fadeGridInAnimation);

            GameId.Content = stats.Difficulty;
            GameType.Content = stats.GameMode.ToLower();
            double seconds = stats.GameLength % 60;
            double minutes = stats.GameLength / 60;
            GameTime.Content = string.Format("{0:0}:{1:00}", minutes, seconds);

            TeamOnePanel.Children.Clear();
            TeamTwoPanel.Children.Clear();

            foreach (PlayerParticipantStatsSummary summary in stats.TeamPlayerParticipantStats)
            {
                PlayerItemReplay player = new PlayerItemReplay();
                player.PlayerNameLabel.Content = summary.SummonerName;

                Uri UriSource = new Uri("/LegendaryReplays;component/champion/" + summary.SkinName + ".png", UriKind.RelativeOrAbsolute);
                player.ChampionIcon.ChampionImage.Source = new BitmapImage(UriSource);

                TeamOnePanel.Children.Add(player);
            }

            foreach (PlayerParticipantStatsSummary summary in stats.OtherTeamPlayerParticipantStats)
            {
                PlayerItemReplay player = new PlayerItemReplay();
                player.PlayerNameLabel.Content = summary.SummonerName;

                Uri UriSource = new Uri("/LegendaryReplays;component/champion/" + summary.SkinName + ".png", UriKind.RelativeOrAbsolute);
                player.ChampionIcon.ChampionImage.Source = new BitmapImage(UriSource);

                TeamTwoPanel.Children.Add(player);
            }
        }