コード例 #1
0
        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);
        }
コード例 #2
0
        private async void Download_Click(object sender, RoutedEventArgs e)
        {
            if (User)
            {
                PublicSummoner summoner = await RiotCalls.GetSummonerByName(Command.Text);

                if (string.IsNullOrWhiteSpace(summoner.Name))
                {
                    var overlay = new MessageOverlay
                    {
                        MessageTitle   = { Content = "No Summoner Found" },
                        MessageTextBox = { Text = "The summoner \"" + Command.Text + "\" does not exist." }
                    };
                    Client.OverlayContainer.Content    = overlay.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;

                    return;
                }
                HintLabel.Content    = "retrieving replay";
                HintLabel.Visibility = Visibility.Visible;
                var fadeLabelInAnimationx = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1));
                HintLabel.BeginAnimation(OpacityProperty, fadeLabelInAnimationx);
                PlatformGameLifecycleDTO n = await RiotCalls.RetrieveInProgressSpectatorGameInfo(Command.Text);

                if (n == null)
                {
                    var overlay = new MessageOverlay
                    {
                        MessageTitle   = { Content = "No Game Found" },
                        MessageTextBox = { Text = "The summoner \"" + Command.Text + "\" is not currently in game." }
                    };
                    Client.OverlayContainer.Content    = overlay.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;

                    return;
                }
                if (n.GameName != null)
                {
                    string ip     = n.PlayerCredentials.ObserverServerIp + ":" + n.PlayerCredentials.ObserverServerPort;
                    string key    = n.PlayerCredentials.ObserverEncryptionKey;
                    var    gameId = (int)n.PlayerCredentials.GameId;
                    recorder = new ReplayRecorder(ip, gameId, Client.Region.InternalName, key);
                    recorder.OnReplayRecorded += recorder_OnReplayRecorded;
                    recorder.OnGotChunk       += recorder_OnGotChunk;

                    var fadeGridOutAnimation = new DoubleAnimation(0, TimeSpan.FromSeconds(0.1));
                    Command.Visibility   = Visibility.Hidden;
                    Download.Visibility  = Visibility.Hidden;
                    HintLabel.Visibility = Visibility.Visible;
                    HintLabel.Content    = "Starting replay download";
                }
                HintLabel.Content    = "That player is not in a game";
                HintLabel.Visibility = Visibility.Visible;
            }
        }
コード例 #3
0
        public void Text_Changed(object sender, RoutedEventArgs e)
        {
            MessageOverlay overlay = new MessageOverlay();

            //overlay.AcceptButton.Click += update;
            if (overlay.MessageTextBox.Text == "NO")
            {
                overlay.AcceptButton.Click -= update;
                overlay.Visibility          = Visibility.Hidden;
            }
        }
コード例 #4
0
        private async void Download_Click(object sender, RoutedEventArgs e)
        {
            if (User == true)
            {
                PublicSummoner Summoner = await Client.PVPNet.GetSummonerByName(Command.Text);

                if (String.IsNullOrWhiteSpace(Summoner.Name))
                {
                    MessageOverlay overlay = new MessageOverlay();
                    overlay.MessageTitle.Content       = "No Summoner Found";
                    overlay.MessageTextBox.Text        = "The summoner \"" + Command.Text + "\" does not exist.";
                    Client.OverlayContainer.Content    = overlay.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                    return;
                }
                HintLabel.Content    = "retrieving replay";
                HintLabel.Visibility = Visibility.Visible;
                var fadeLabelInAnimationx = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1));
                HintLabel.BeginAnimation(Label.OpacityProperty, fadeLabelInAnimationx);
                PlatformGameLifecycleDTO n = await Client.PVPNet.RetrieveInProgressSpectatorGameInfo(Command.Text);

                if (n.GameName != null)
                {
                    int    port = n.PlayerCredentials.ServerPort;
                    string IP;
                    if (port == 0)
                    {
                        IP = n.PlayerCredentials.ObserverServerIp + ":8088";
                    }
                    else
                    {
                        IP = n.PlayerCredentials.ObserverServerIp + ":" + port;
                    }
                    string Key    = n.PlayerCredentials.ObserverEncryptionKey;
                    int    GameID = (Int32)n.PlayerCredentials.GameId;
                    recorder = new ReplayRecorder(IP, GameID, Client.Region.InternalName, Key);
                    recorder.OnReplayRecorded += recorder_OnReplayRecorded;
                    recorder.OnGotChunk       += recorder_OnGotChunk;

                    var fadeGridOutAnimation = new DoubleAnimation(0, TimeSpan.FromSeconds(0.1));
                    Command.Visibility   = Visibility.Hidden;
                    Download.Visibility  = Visibility.Hidden;
                    HintLabel.Visibility = Visibility.Visible;
                    HintLabel.Content    = "Starting replay download";
                    return;
                }
                else
                {
                    HintLabel.Content    = "That player is not in a game";
                    HintLabel.Visibility = Visibility.Visible;
                    return;
                }
            }
        }
コード例 #5
0
        private void EnteredQueue(SearchingForMatchNotification result)
        {
            if (result.PlayerJoinFailures != null)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    Button item = LastSender;
                    var config  = (GameQueueConfig)item.Tag;
                    Queues.Remove(config.Id);
                    var message = new MessageOverlay();
                    message.MessageTitle.Content = "Failed to join queue";
                    message.MessageTextBox.Text  = result.PlayerJoinFailures[0].ReasonFailed;
                    if (result.PlayerJoinFailures[0].ReasonFailed == "QUEUE_DODGER")
                    {
                        message.MessageTextBox.Text = "Unable to join the queue due to you recently dodging a game." +
                                                      Environment.NewLine;
                        TimeSpan time = TimeSpan.FromMilliseconds(result.PlayerJoinFailures[0].PenaltyRemainingTime);
                        message.MessageTextBox.Text = "You have " +
                                                      string.Format("{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) +
                                                      " remaining until you may queue again";
                    }
                    else if (result.PlayerJoinFailures[0].ReasonFailed == "RANKED_MIN_LEVEL")
                    {
                        message.MessageTextBox.Text = "You do not meet the requirements for this queue." +
                                                      Environment.NewLine;
                    }
                    else if (result.PlayerJoinFailures[0].ReasonFailed == "QUEUE_PARTICIPANTS")
                    {
                        message.MessageTextBox.Text =
                            "This queue is in dev. Please use this queue on the real league of legends client." +
                            Environment.NewLine;
                    }
                    Client.OverlayContainer.Content    = message.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                }));
                return;
            }

            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                Button item    = LastSender;
                var fakeButton = new Button(); //We require a unique button to add to the dictionary
                fakeButton.Tag = item;
                item.Content   = "00:00";
                ButtonTimers.Add(fakeButton, 0);
            }));
            InQueue               = true;
            Client.GameStatus     = "inQueue";
            Client.timeStampSince =
                (DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalMilliseconds;
            Client.SetChatHover();
            Client.PVPNet.OnMessageReceived += GotQueuePop;
        }
コード例 #6
0
        private void EnteredQueue(SearchingForMatchNotification result)
        {
            if (result.PlayerJoinFailures != null)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    Client.HasPopped = false;
                    var messageOver  = new MessageOverlay();
                    messageOver.MessageTitle.Content = "Could not join the queue";
                    foreach (QueueDodger x in result.PlayerJoinFailures)
                    {
                        TimeSpan time = TimeSpan.FromMilliseconds(x.PenaltyRemainingTime);
                        switch (x.ReasonFailed)
                        {
                        case "LEAVER_BUSTER_TAINTED_WARNING":
                            messageOver.MessageTextBox.Text += " - You have left a game in progress. Please use the official client to remove the warning for now.";
                            //Need to implement their new warning for leaving.
                            break;

                        case "QUEUE_DODGER":
                            messageOver.MessageTextBox.Text += " - " + x.Summoner.Name + " is unable to join the queue as they recently dodged a game." + Environment.NewLine;
                            messageOver.MessageTextBox.Text += " - You have " + string.Format("{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) + " remaining until you may queue again";
                            break;

                        case "QUEUE_RESTRICTED":
                            messageOver.MessageTextBox.Text += " - You are too far apart in ranked to queue together.";
                            messageOver.MessageTextBox.Text += " - For instance, Silvers can only queue with Bronze, Silver, or Gold players.";
                            break;

                        case "RANKED_RESTRICTED":
                            messageOver.MessageTextBox.Text += " - You are not currently able to queue for ranked for: " + x.PenaltyRemainingTime + " games. If this is inaccurate please report it as an issue on the github page. Thanks!";
                            break;

                        default:
                            messageOver.MessageTextBox.Text += "Please submit: - " + x.ReasonFailed + " - as an Issue on github explaining what it meant. Thanks!";
                            break;
                        }
                    }
                    Client.OverlayContainer.Content    = messageOver.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                }));
                return;
            }
            Client.PVPNet.OnMessageReceived += GotQueuePop;
            setStartButtonText("Joining Queue");
            startTime             = 1;
            inQueue               = true;
            Client.GameStatus     = "inQueue";
            Client.timeStampSince = (DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalMilliseconds;
            Client.SetChatHover();
        }
コード例 #7
0
 private bool isInGame()
 {
     if (Client.IsInGame)
     {
         Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
         {
             MessageOverlay message             = new MessageOverlay();
             message.MessageTitle.Content       = "Failed to join queue";
             message.MessageTextBox.Text        = "You are currently in a game, if you need to reconnect please return to the reconnect page above!";
             Client.OverlayContainer.Content    = message.Content;
             Client.OverlayContainer.Visibility = Visibility.Visible;
         }));
         return(true);
     }
     return(false);
 }
コード例 #8
0
 private void EnteredQueue(SearchingForMatchNotification result)
 {
     if (result.PlayerJoinFailures != null)
     {
         Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
         {
             MessageOverlay messageOver       = new MessageOverlay();
             messageOver.MessageTitle.Content = "Could not join the queue";
             foreach (QueueDodger x in result.PlayerJoinFailures)
             {
                 messageOver.MessageTextBox.Text += x.Summoner.Name + " is unable to join the queue as they recently dodged a game." + Environment.NewLine;
                 TimeSpan time = TimeSpan.FromMilliseconds(x.PenaltyRemainingTime);
                 messageOver.MessageTextBox.Text += "You have " + string.Format("{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) + " remaining until you may queue again";
             }
             messageOver.Content    = messageOver.Content;
             messageOver.Visibility = Visibility.Visible;
         }));
         return;
     }
 }
コード例 #9
0
        private bool IsInGame()
        {
            if (!Client.IsInGame)
            {
                return(false);
            }

            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                var message = new MessageOverlay
                {
                    MessageTitle   = { Content = "Không thể tham gia hàng chờ" },
                    MessageTextBox =
                    {
                        Text =
                            "Bạn hiện đang ở trong một trò chơi, nếu bạn cần phải kết nối lại xin vui lòng trở lại trang chủ"
                    }
                };
                Client.OverlayContainer.Content    = message.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
            }));
            return(true);
        }
コード例 #10
0
        private void StartPatcher()
        {
            Thread bgThead = new Thread(() =>
            {
                LogTextBox("Starting Patcher");

                WebClient client = new WebClient();
                client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
                client.DownloadFileCompleted   += new AsyncCompletedEventHandler(client_DownloadDDragon);
                client.DownloadProgressChanged += (o, e) =>
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        double bytesIn               = double.Parse(e.BytesReceived.ToString());
                        double totalBytes            = double.Parse(e.TotalBytesToReceive.ToString());
                        double percentage            = bytesIn / totalBytes * 100;
                        CurrentProgressLabel.Content = "Downloaded " + e.BytesReceived + " of " + e.TotalBytesToReceive;
                        CurrentProgressBar.Value     = int.Parse(Math.Truncate(percentage).ToString());
                    }));
                };

                #region LegendaryClient

                string CurrentMD5 = GetMd5();
                LogTextBox("MD5: " + CurrentMD5);


                UpdateData legendaryupdatedata = new UpdateData();
                var version = LegendaryClientPatcher.GetLatestLCVersion();
                LogTextBox("Most Up to date LegendaryClient Version: " + version);
                string versionAsString = version;

                if (version != Client.LegendaryClientVersion)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        MessageOverlay overlay              = new MessageOverlay();
                        overlay.MessageTextBox.Text         = "An update is available LegendaryClient";
                        overlay.MessageTitle.Content        = "Update Notification";
                        overlay.AcceptButton.Content        = "Update LegendaryClient";
                        overlay.AcceptButton.Click         += update;
                        overlay.MessageTextBox.TextChanged += Text_Changed;
                        Client.OverlayContainer.Content     = overlay.Content;
                        //Client.OverlayContainer.Visibility = Visibility.Visible;

                        CurrentProgressLabel.Content = "LegendaryClient Is Out of Date!";
                    }));
                    LogTextBox("LegendaryClient Is Out of Date!");

                    //return;
                }
                else if (Client.LegendaryClientVersion == version)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "LegendaryClient Is Up To Date!";
                    }));
                    LogTextBox("LegendaryClient Is Up To Date!");
                }
                else if (version == null)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Could not check LegendaryClient Version!";
                    }));
                    LogTextBox("Could not check LegendaryClient Version!");
                    return;
                }

                #endregion LegendaryClient

                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    TotalProgressLabel.Content = "20%";
                    TotalProgessBar.Value      = 20;
                }));

                #region DDragon

                System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
                if (!Directory.Exists("Assets"))
                {
                    Directory.CreateDirectory("Assets");
                }
                if (!File.Exists(Path.Combine("Assets", "VERSION_DDRagon")))
                {
                    var VersionLOL = File.Create(Path.Combine("Assets", "VERSION_DDRagon"));
                    VersionLOL.Write(encoding.GetBytes("0.0.0"), 0, encoding.GetBytes("0.0.0").Length);

                    VersionLOL.Close();
                }


                RiotPatcher patcher       = new RiotPatcher();
                string DDragonDownloadURL = patcher.GetDragon();
                LogTextBox("DataDragon Version: " + patcher.DDragonVersion);
                string DDragonVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_DDragon"));
                LogTextBox("Current DataDragon Version: " + DDragonVersion);

                Client.Version = DDragonVersion;
                Client.Log("DDragon Version (LOL Version) = " + DDragonVersion);

                LogTextBox("Client Version: " + Client.Version);

                if (patcher.DDragonVersion != DDragonVersion)
                {
                    if (!Directory.Exists(Path.Combine("Assets", "temp")))
                    {
                        Directory.CreateDirectory(Path.Combine("Assets", "temp"));
                    }

                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Downloading DataDragon";
                    }));

                    client.DownloadFile(DDragonDownloadURL, Path.Combine("Assets", "dragontail-" + patcher.DDragonVersion + ".tgz"));

                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Extracting DataDragon";
                    }));

                    Stream inStream = File.OpenRead(Path.Combine("Assets", "dragontail-" + patcher.DDragonVersion + ".tgz"));

                    using (GZipInputStream gzipStream = new GZipInputStream(inStream))
                    {
                        TarArchive tarArchive = TarArchive.CreateInputTarArchive(gzipStream);
                        tarArchive.ExtractContents(Path.Combine("Assets", "temp"));
                        tarArchive.CloseArchive();
                    }
                    inStream.Close();

                    Copy(Path.Combine("Assets", "temp", patcher.DDragonVersion, "data"), Path.Combine("Assets", "data"));
                    Copy(Path.Combine("Assets", "temp", patcher.DDragonVersion, "img"), Path.Combine("Assets"));
                    DeleteDirectoryRecursive(Path.Combine("Assets", "temp"));

                    var VersionDDragon = File.Create(Path.Combine("Assets", "VERSION_DDRagon"));
                    VersionDDragon.Write(encoding.GetBytes(patcher.DDragonVersion), 0, encoding.GetBytes(patcher.DDragonVersion).Length);

                    Client.Version = DDragonVersion;
                    VersionDDragon.Close();
                }

                #endregion DDragon

                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    TotalProgressLabel.Content = "40%";
                    TotalProgessBar.Value      = 40;
                }));

                // Try get LoL path from registry

                //A string that looks like C:\Riot Games\League of Legends\
                string lolRootPath = GetLolRootPath();

                #region lol_air_client

                if (!File.Exists(Path.Combine("Assets", "VERSION_AIR")))
                {
                    var VersionAIR = File.Create(Path.Combine("Assets", "VERSION_AIR"));
                    VersionAIR.Write(encoding.GetBytes("0.0.0.0"), 0, encoding.GetBytes("0.0.0.0").Length);
                    VersionAIR.Close();
                }

                string LatestAIR = patcher.GetLatestAir();
                LogTextBox("Air Assets Version: " + LatestAIR);
                string AirVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_AIR"));
                LogTextBox("Current Air Assets Version: " + AirVersion);
                bool RetrieveCurrentInstallation = false;
                WebClient UpdateClient           = new WebClient();
                string Release       = UpdateClient.DownloadString("http://l3cdn.riotgames.com/releases/live/projects/lol_air_client/releases/releaselisting");
                string LatestVersion = Release.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0];

                if (AirVersion != LatestVersion)
                {
                    //Download Air Assists from riot
                    string Package = UpdateClient.DownloadString("http://l3cdn.riotgames.com/releases/live/projects/lol_air_client/releases/" + LatestVersion + "/packages/files/packagemanifest");
                    GetAllPngs(Package);
                    if (File.Exists(Path.Combine(Client.ExecutingDirectory, "gameStats_en_US.sqlite")))
                    {
                        File.Delete(Path.Combine(Client.ExecutingDirectory, "gameStats_en_US.sqlite"));
                    }
                    UpdateClient.DownloadFile(new Uri("http://l3cdn.riotgames.com/releases/live/projects/lol_air_client/releases/" + LatestVersion + "/files/assets/data/gameStats/gameStats_en_US.sqlite"), Path.Combine(Client.ExecutingDirectory, "gameStats_en_US.sqlite"));

                    if (File.Exists(System.IO.Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_AIR")))
                    {
                        File.Delete(System.IO.Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_AIR"));
                    }
                    var file = File.Create(System.IO.Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_AIR"));
                    file.Write(encoding.GetBytes(LatestVersion), 0, encoding.GetBytes(LatestVersion).Length);
                    file.Close();
                }

                if (AirVersion != LatestAIR)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        SkipPatchButton.IsEnabled    = true;
                        CurrentProgressLabel.Content = "Retrieving Air Assets";
                    }));
                }

                #endregion lol_air_client


                //string GameVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "RADS", "VERSION_LOL"));
                #region lol_game_client
                LogTextBox("Trying to detect League of Legends GameClient");
                LogTextBox("League of Legends is located at: " + lolRootPath);
                //RADS\solutions\lol_game_client_sln\releases
                var GameLocation = Path.Combine(lolRootPath, "RADS", "solutions", "lol_game_client_sln", "releases");

                string LolVersion2   = new WebClient().DownloadString("http://l3cdn.riotgames.com/releases/live/projects/lol_game_client/releases/releaselisting_NA");
                string LolVersion    = new WebClient().DownloadString("http://l3cdn.riotgames.com/releases/live/solutions/lol_game_client_sln/releases/releaselisting_NA");
                string GameClientSln = LolVersion.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0];
                string GameClient    = LolVersion2.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0];
                LogTextBox("Latest League of Legends GameClient: " + GameClientSln);
                LogTextBox("Checking if League of Legends is Up-To-Date");

                string LolLauncherVersion = new WebClient().DownloadString("http://l3cdn.riotgames.com/releases/live/projects/lol_air_client/releases/releaselisting_NA");
                string LauncherVersion    = LolLauncherVersion.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0];
                if (Directory.Exists(Path.Combine(GameLocation, GameClientSln)))
                {
                    LogTextBox("League of Legends is Up-To-Date");
                    //Client.LaunchGameLocation = Path.Combine(Client.GameLocation, GameClientSln);
                    //C:\Riot Games\League of Legends\RADS\projects\lol_game_client\releases\0.0.0.243\deploy
                    Client.LOLCLIENTVERSION = LolVersion2;
                    //C:\Riot Games\League of Legends\RADS\solutions\lol_game_client_sln\releases\0.0.1.50\deploy
                    Client.Location = Path.Combine(lolRootPath, "RADS", "solutions", "lol_game_client_sln", "releases", GameClientSln, "deploy");
                    //C:\Riot Games\League of Legends\RADS\projects\lol_air_client\releases\0.0.1.104
                    Client.LoLLauncherLocation = Path.Combine(lolRootPath, "RADS", "projects", "lol_air_client", "releases", LauncherVersion, "deploy");
                    Client.RootLocation        = lolRootPath;
                }
                else
                {
                    LogTextBox("League of Legends is not Up-To-Date. Please Update League Of Legends");
                    return;
                }


                if (!Directory.Exists("RADS"))
                {
                    Directory.CreateDirectory("RADS");
                }

                if (!File.Exists(Path.Combine("RADS", "VERSION_LOL")))
                {
                    var VersionGAME = File.Create(Path.Combine("RADS", "VERSION_LOL"));
                    VersionGAME.Write(encoding.GetBytes("0.0.0.0"), 0, encoding.GetBytes("0.0.0.0").Length);
                    VersionGAME.Close();
                }

                string LatestGame = patcher.GetLatestGame();
                LogTextBox("League Of Legends Version: " + LatestGame);
                string GameVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "RADS", "VERSION_LOL"));
                LogTextBox("Current League of Legends Version: " + GameVersion);
                RetrieveCurrentInstallation = false;
                string NGameLocation        = "";

                if (GameVersion != GameClient)
                {
                    LogTextBox("Checking for existing League of Legends Installation");
                    NGameLocation = Path.Combine("League of Legends", "RADS");
                    if (Directory.Exists(NGameLocation))
                    {
                        RetrieveCurrentInstallation = true;
                    }
                    else if (Directory.Exists(Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", NGameLocation)))
                    {
                        RetrieveCurrentInstallation = true;
                        NGameLocation = Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", NGameLocation);
                    }
                    else
                    {
                        LogTextBox("Unable to find existing League of Legends. Copy your League of Legends folder into + "
                                   + Client.ExecutingDirectory
                                   + " to make the patching process quicker");
                    }

                    if (RetrieveCurrentInstallation)
                    {
                        LogTextBox("Getting League Of Legends from " + NGameLocation);
                        Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                        {
                            CurrentProgressLabel.Content = "Copying League of Legends";
                        }));
                        LogTextBox("Retrieved currently installed League of Legends");
                        LogTextBox("Current League of Legends Version: " + NGameLocation);
                    }
                }

                if (GameVersion != LatestGame)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Retrieving League of Legends";
                    }));
                }
                #endregion lol_game_client



                FinishPatching(LatestVersion);
            });

            bgThead.Start();
        }
コード例 #11
0
        private void EnteredQueue(SearchingForMatchNotification result)
        {
            if (result.PlayerJoinFailures != null)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async () =>
                {
                    Client.HasPopped = false;
                    var messageOver = new MessageOverlay();
                    messageOver.MessageTitle.Content = "Could not join the queue";
                    foreach (var item in result.PlayerJoinFailures)
                    {
                        var x = (QueueDodger)item;
                        TimeSpan time = TimeSpan.FromMilliseconds(x.PenaltyRemainingTime);
                        switch (x.ReasonFailed)
                        {
                            case "LEAVER_BUSTER_TAINTED_WARNING":
                                messageOver.MessageTextBox.Text += " - You have left a game in progress. Please use the official client to remove the warning for now.";
                                //Need to implement their new warning for leaving.
                                break;
                            case "QUEUE_DODGER":
                                messageOver.MessageTextBox.Text += " - " + x.Summoner.Name + " is unable to join the queue as they recently dodged a game." + Environment.NewLine;
                                messageOver.MessageTextBox.Text += " - You have " + string.Format("{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) + " remaining until you may queue again";
                                break;
                            case "QUEUE_RESTRICTED":
                                messageOver.MessageTextBox.Text += " - You are too far apart in ranked to queue together.";
                                messageOver.MessageTextBox.Text += " - For instance, Silvers can only queue with Bronze, Silver, or Gold players.";
                                break;
                            case "RANKED_RESTRICTED":
                                messageOver.MessageTextBox.Text += " - You are not currently able to queue for ranked for: " + x.PenaltyRemainingTime + " games. If this is inaccurate please report it as an issue on the github page. Thanks!";
                                break;
                            case "RANKED_MIN_LEVEL":
                                messageOver.MessageTextBox.Text += " - Level 30 is required to played ranked games.";
                                break;
                            case "QUEUE_PARTICIPANTS":
                                messageOver.MessageTextBox.Text += " - Not enough players for this queue type.";
                                break;
                            case "LEAVER_BUSTED":
                                var xm = (BustedLeaver)x;
                                    Client.Log("LeaverBuster, Access token is: " + xm.AccessToken);
                                    var message = new MessageOverlay
                                    {
                                        MessageTitle = { Content = "LeaverBuster" },
                                        MessageTextBox = { Text = "" }
                                    };
                                    Timer t = new Timer { Interval = 1000 };
                                    var timeleft = xm.LeaverPenaltyMilisRemaining;
                                    t.Elapsed += (messafge, mx) =>
                                    {
                                        timeleft = timeleft - 1000;
                                        var timex = TimeSpan.FromMilliseconds(timeleft);
                                        Dispatcher.BeginInvoke(
                                            DispatcherPriority.Input, new ThreadStart(() =>
                                            {
                                                //Can not bypass this sadly, it just relaunches
                                                message.MessageTextBox.Text =
                                                    @"Abandoning a match or being AFK results in a negative experience for your teammates, and is a punishable offense in League of Legends.
You've been placed in a lower priority queue" + Environment.NewLine;
                                                message.MessageTextBox.Text += "You have " +
                                                                               string.Format(
                                                                                   "{0:D2}m:{1:D2}s", timex.Minutes, timex.Seconds) +
                                                                               " remaining until you may queue again" + Environment.NewLine;

                                                message.MessageTextBox.Text += "You can close this window and you will still be in queue";

                                                Client.OverlayContainer.Content = message.Content;
                                                if (timeleft < 0)
                                                {
                                                    t.Stop();
                                                    Client.OverlayContainer.Visibility = Visibility.Hidden;
                                                }
                                            }));

                                    };
                                    t.Start();
                                    Client.OverlayContainer.Content = message.Content;
                                    Client.OverlayContainer.Visibility = Visibility.Visible;
                                if (CurrentLobby.Owner.SummonerId.MathRound() !=
                                    Client.LoginPacket.AllSummonerData.Summoner.SumId.MathRound())
                                {
                                    return;
                                }
                                EnteredQueue(await RiotCalls.AttachTeamToQueue(parameters, new AsObject { { "LEAVER_BUSTER_ACCESS_TOKEN", xm.AccessToken } }));
                                break;
                            case "RANKED_NUM_CHAMPS":
                                messageOver.MessageTextBox.Text += " - You require at least 16 owned champions to play a Normal Draft / Ranked game.";
                                break;
                            default:
                                messageOver.MessageTextBox.Text += "Please submit: - " + x.ReasonFailed + " - as an Issue on github explaining what it meant. Thanks!";
                                break;
                        }
                    }
                    Client.OverlayContainer.Content = messageOver.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                }));
                return;
            }
            Client.RiotConnection.MessageReceived += GotQueuePop;
            setStartButtonText("Joining Queue");
            startTime = 1;
            inQueue = true;
            Client.GameStatus = "inQueue";
            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                if (Client.inQueueTimer.Visibility == Visibility.Hidden)
                    Client.inQueueTimer.Visibility = Visibility.Visible;
                TeamListView.Opacity = 0.3D;
            }));
            Client.timeStampSince = (DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalMilliseconds;
            Client.SetChatHover();
        }
コード例 #12
0
        private void EnteredQueue(SearchingForMatchNotification result)
        {
            if (result.PlayerJoinFailures != null)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    var leaver = result.PlayerJoinFailures[0];
                    if (leaver.ReasonFailed == "LEAVER_BUSTED")
                    {
                        var x = (BustedLeaver)leaver;
                        Client.Log("LeaverBuster, Access token is: " + x.AccessToken);
                        var message = new MessageOverlay
                        {
                            MessageTitle   = { Content = "LeaverBuster" },
                            MessageTextBox = { Text = "" }
                        };
                        Timer t = new Timer {
                            Interval = 1000
                        };
                        var timeleft = x.LeaverPenaltyMilisRemaining;
                        t.Elapsed   += (messafge, mx) =>
                        {
                            timeleft      = timeleft - 1000;
                            TimeSpan time = TimeSpan.FromMilliseconds(timeleft);
                            Dispatcher.BeginInvoke(
                                DispatcherPriority.Input, new ThreadStart(async() =>
                            {
                                //Can not bypass this sadly, it just relaunches
                                message.MessageTextBox.Text =
                                    @"Abandoning a match or being AFK results in a negative experience for your teammates, and is a punishable offense in League of Legends.
You've been placed in a lower priority queue" + Environment.NewLine;
                                message.MessageTextBox.Text += "You have " +
                                                               string.Format(
                                    "{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) +
                                                               " remaining until you may queue again" + Environment.NewLine;

                                message.MessageTextBox.Text += "You can close this window and you will still be in queue";

                                Client.OverlayContainer.Content = message.Content;
                                if (timeleft < 0)
                                {
                                    t.Stop();
                                    Client.OverlayContainer.Visibility = Visibility.Hidden;
                                    var obj = new AsObject {
                                        { "LEAVER_BUSTER_ACCESS_TOKEN", x.AccessToken }
                                    };
                                    EnteredQueue(await RiotCalls.AttachToQueue(param, obj));
                                }
                            }));
                        };
                        t.Start();
                        Client.OverlayContainer.Content    = message.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        Button item  = LastSender;
                        var settings = (QueueButtonConfig)LastSender.Tag;
                        var config   = settings.GameQueueConfig;
                        Queues.Remove(config.Id);
                        var failure = result.PlayerJoinFailures[0];
                        var message = new MessageOverlay
                        {
                            MessageTitle   = { Content = "Failed to join queue" },
                            MessageTextBox = { Text = failure.ReasonFailed }
                        };
                        switch (failure.ReasonFailed)
                        {
                        case "QUEUE_DODGER":
                            {
                                message.MessageTextBox.Text =
                                    "Unable to join the queue due to you recently dodging a game." +
                                    Environment.NewLine;
                                TimeSpan time = TimeSpan.FromMilliseconds(failure.PenaltyRemainingTime);
                                message.MessageTextBox.Text = "You have " +
                                                              string.Format(
                                    "{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) +
                                                              " remaining until you may queue again";
                            }
                            break;

                        case "RANKED_MIN_LEVEL":
                            message.MessageTextBox.Text =
                                "You do not meet the requirements for this queue." + Environment.NewLine;
                            break;

                        case "QUEUE_PARTICIPANTS":
                            message.MessageTextBox.Text =
                                "This queue is in dev. Please use this queue on the real league of legends client." +
                                Environment.NewLine;
                            break;
                        }
                        Client.OverlayContainer.Content    = message.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                }));
            }
            else if (result.JoinedQueues != null)
            {
                Button item = new Button();
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    item           = LastSender;
                    var fakeButton = new Button
                    {
                        Tag = item
                    };
                    item.Content = "00:00";
                }));
                if (t.Enabled)
                {
                    t.Stop();
                }
                t = new Timer {
                    Interval = 1000
                };
                t.Start();
                time       = 0;
                t.Elapsed += (gg, easy) =>
                {
                    time = time + 1000;
                    TimeSpan timespan = TimeSpan.FromMilliseconds(time);
                    Dispatcher.BeginInvoke(
                        DispatcherPriority.Input,
                        new ThreadStart(() => item.Content = string.Format("{0:D2}m:{1:D2}s", timespan.Minutes, timespan.Seconds)));
                };
                InQueue               = true;
                Client.GameStatus     = "inQueue";
                Client.timeStampSince =
                    (DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalMilliseconds;
                Client.SetChatHover();
                Client.RiotConnection.MessageReceived += GotQueuePop;
                Client.Log("Now in Queue");
            }
        }
コード例 #13
0
#pragma warning disable 4014

        internal static void OnMessageReceived(object sender, MessageReceivedEventArgs message)
        {
            Log("Message received! The type is: " + message.Body.GetType());
            MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async () =>
            {
                var balance = message.Body as StoreAccountBalanceNotification;
                if (balance != null)
                {
                    StoreAccountBalanceNotification newBalance = balance;
                    InfoLabel.Content = "IP: " + newBalance.Ip + " ∙ RP: " + newBalance.Rp;
                    LoginPacket.IpBalance = newBalance.Ip;
                    LoginPacket.RpBalance = newBalance.Rp;
                }
                else
                {
                    var gameNotification = message.Body as GameNotification;
                    if (gameNotification != null)
                    {
                        GameNotification notification = gameNotification;
                        var messageOver = new MessageOverlay { 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;
                            case "PLAYER_QUIT":
                                messageOver.MessageTitle.Content = "Player quit";
                                var name = await RiotCalls.GetSummonerNames(new[] { Convert.ToDouble(notification.MessageArgument) });
                                messageOver.MessageTextBox.Text = name[0] + " quit from queue!";
                                break;
                            default:
                                messageOver.MessageTextBox.Text = notification.MessageCode + Environment.NewLine;
                                messageOver.MessageTextBox.Text = System.Convert.ToString(notification.MessageArgument);
                                break;
                        }
                        OverlayContainer.Content = messageOver.Content;
                        OverlayContainer.Visibility = Visibility.Visible;
                        ClearPage(typeof(CustomGameLobbyPage));
                        if (notification.Type != "PLAYER_QUIT")
                            SwitchPage(Client.MainPage);
                    }
                    else if (message.Body is EndOfGameStats)
                    {
                        var stats = (EndOfGameStats)message.Body;
                        var EndOfGame = new EndOfGamePage(stats);
                        ClearPage(typeof(TeamQueuePage));
                        OverlayContainer.Visibility = Visibility.Visible;
                        OverlayContainer.Content = EndOfGame.Content;
                    }
                    else if (message.Body is StoreFulfillmentNotification)
                    {
                        PlayerChampions = await RiotCalls.GetAvailableChampions();
                    }
                    else if (message.Body is Inviter)
                    {
                        var stats = (Inviter)message.Body;
                        //CurrentInviter = stats;
                    }
                    else if (message.Body is InvitationRequest)
                    {
                        var stats = (InvitationRequest)message.Body;
                        if (stats.Inviter == null)
                            return;


                        if (InviteData.ContainsKey(stats.InvitationId))
                        {
                            InviteInfo x = InviteData[stats.InvitationId];
                            if (x.Inviter != null)
                                return;
                        }
                        
                        MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                        {
                            var pop = new GameInvitePopup(stats)
                            {
                                HorizontalAlignment = HorizontalAlignment.Right,
                                VerticalAlignment = VerticalAlignment.Bottom,
                                Height = 230
                            };

                            NotificationGrid.Children.Add(pop);
                        }));
                        MainWin.FlashWindow();
                    }
                    else if (message.Body is ClientLoginKickNotification)
                    {
                        var kick = (ClientLoginKickNotification)message.Body;
                        if (kick.sessionToken == null)
                            return;

                        Warning Warn = new Warning
                        {
                            Header = { Content = "Kicked from server" },
                            MessageText = { Text = "This account has been logged in from another location" }
                        };
                        Warn.backtochampselect.Click += (MainWin as MainWindow).LogoutButton_Click;
                        Warn.AcceptButton.Click += QuitClient;
                        Warn.hide.Visibility = Visibility.Hidden;
                        Warn.backtochampselect.Content = "Logout(Work in progress)";
                        Warn.AcceptButton.Content = "Quit";
                        FullNotificationOverlayContainer.Content = Warn.Content;
                        FullNotificationOverlayContainer.Visibility = Visibility.Visible;
                    }
                    else if (message.Body is SimpleDialogMessage)
                    {
                        var leagueInfo = message.Body as SimpleDialogMessage;
                        if (leagueInfo.Type == "leagues")
                        {
                            var promote = LeaguePromote.LeaguesPromote(leagueInfo.Params.ToString());
                            var messageOver = new MessageOverlay();
                            messageOver.MessageTitle.Content = "Leagues updated";
                            messageOver.MessageTextBox.Text = promote.leagueItem.PlayerOrTeamName + " have been promoted to " + promote.leagueItem.Rank;
                            var response = new SimpleDialogMessageResponse
                            {
                                Command = "ack",
                                AccountId = leagueInfo.AccountId,
                                MessageId = leagueInfo.MessageId
                            };
                            messageOver.AcceptButton.Click += (o, e) => { RiotCalls.CallPersistenceMessaging(response); };
                        }
                    }
                }
            }));
        }
コード例 #14
0
ファイル: Client.cs プロジェクト: Battler624/LegendaryClient
        internal static void ChatClient_OnMessage(object sender, jabber.protocol.client.Message msg)
        {
            MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                if (OnMessage != null)
                {
                    OnMessage(sender, msg);
                }

                if (msg.Subject != null)
                {
                    ChatSubjects subject = (ChatSubjects)Enum.Parse(typeof(ChatSubjects), msg.Subject, true);

                    if (subject == ChatSubjects.PRACTICE_GAME_INVITE ||
                        subject == ChatSubjects.GAME_INVITE)
                    {
                        MainWin.FlashWindow();
                        NotificationPopup pop = new NotificationPopup(subject, msg);
                        pop.Height = 230;
                        pop.HorizontalAlignment = HorizontalAlignment.Right;
                        pop.VerticalAlignment = VerticalAlignment.Bottom;
                        NotificationGrid.Children.Add(pop);
                    }
                    else if (subject == ChatSubjects.GAME_MSG_OUT_OF_SYNC)
                    {
                        MessageOverlay messageOver = new MessageOverlay();
                        messageOver.MessageTitle.Content = "Game no longer exists";
                        messageOver.MessageTextBox.Text = "The game you are looking for no longer exists.";
                        Client.OverlayContainer.Content = messageOver.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                }
            }));

            //On core thread
            if (msg.Subject != null)
                return;

            if (AllPlayers.ContainsKey(msg.From.User) && !String.IsNullOrWhiteSpace(msg.Body))
            {
                ChatPlayerItem chatItem = AllPlayers[msg.From.User];
                chatItem.Messages.Add(chatItem.Username + "|" + msg.Body);
                MainWin.FlashWindow();
            }
        }
コード例 #15
0
        private bool IsInGame()
        {
            if (!Client.IsInGame)
                return false;

            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                var message = new MessageOverlay
                {
                    MessageTitle = {Content = "Failed to join queue"},
                    MessageTextBox =
                    {
                        Text =
                            "You are currently in a game, if you need to reconnect please return to the reconnect page above!"
                    }
                };
                Client.OverlayContainer.Content = message.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
            }));
            return true;
        }
コード例 #16
0
        public async void GetSummonerProfile(string s)
        {
            PublicSummoner Summoner = await Client.PVPNet.GetSummonerByName(String.IsNullOrWhiteSpace(s)?Client.LoginPacket.AllSummonerData.Summoner.Name : s);

            if (String.IsNullOrWhiteSpace(Summoner.Name))
            {
                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
            {
                Client.PVPNet.GetAllLeaguesForPlayer(Summoner.SummonerId, new SummonerLeaguesDTO.Callback(GotLeaguesForPlayer));
            }

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

            ProfileImage.Source = Client.GetImage(uriSource);

            PlatformGameLifecycleDTO n = await Client.PVPNet.RetrieveInProgressSpectatorGameInfo(s);

            if (n.GameName != null)
            {
                InGameHeader.Visibility = Visibility.Visible;
                InGameHeader.IsSelected = true;
                Ingame ingame = InGameContainer.Content as Ingame;
                ingame.Update(n);
            }
            else
            {
                InGameHeader.Visibility   = Visibility.Collapsed;
                OverviewHeader.IsSelected = true;
            }

            if (Summoner.InternalName == Client.LoginPacket.AllSummonerData.Summoner.InternalName)
            {
                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);
        }
コード例 #17
0
        public async void GetSummonerProfile(string s)
        {
            PublicSummoner summoner =
                await
                Client.PVPNet.GetSummonerByName(String.IsNullOrWhiteSpace(s)
                                                ?Client.LoginPacket.AllSummonerData.Summoner.Name
                                                : s);

            if (String.IsNullOrWhiteSpace(summoner.Name))
            {
                var overlay = new MessageOverlay
                {
                    MessageTitle   = { Content = "No Summoner Found" },
                    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 = Visibility.Collapsed;
                TeamsHeader.Visibility  = Visibility.Collapsed;
            }
            else
            {
                Client.PVPNet.GetAllLeaguesForPlayer(summoner.SummonerId, GotLeaguesForPlayer);
                PlayerDTO playerTeams = await Client.PVPNet.FindPlayer(summoner.SummonerId);

                GotPlayerTeams(playerTeams);
            }


            int    profileIconId = summoner.ProfileIconId;
            string uriSource     = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", profileIconId + ".png");

            ProfileImage.Source = Client.GetImage(uriSource);

            PlatformGameLifecycleDTO n = await Client.PVPNet.RetrieveInProgressSpectatorGameInfo(s);

            if (n.GameName != null)
            {
                InGameHeader.Visibility = Visibility.Visible;
                InGameHeader.IsSelected = true;

                var ingame = InGameContainer.Content as Ingame;
                if (ingame != null)
                {
                    ingame.Update(n, summoner.Name);
                }
            }
            else
            {
                InGameHeader.Visibility   = Visibility.Collapsed;
                OverviewHeader.IsSelected = true;
            }

            if (summoner.InternalName == Client.LoginPacket.AllSummonerData.Summoner.InternalName)
            {
                ChampionsTab.Visibility = Visibility.Visible;
                SkinsTab.Visibility     = Visibility.Visible;

                MatchHistoryBetaTab.Margin = new Thickness(0, 0, 0, 0);
            }
            else
            {
                ChampionsTab.Visibility    = Visibility.Hidden;
                SkinsTab.Visibility        = Visibility.Hidden;
                MatchHistoryBetaTab.Margin = new Thickness(-211, 0, 211, 0);
            }

            var historyBeta = LeagueMatchHistoryBetaContainer.Content as MatchHistoryOnline;

            if (historyBeta != null)
            {
                historyBeta.Update(summoner.AcctId);
            }

            var history = MatchHistoryContainer.Content as MatchHistory;

            if (history != null)
            {
                history.Update(summoner.AcctId);
            }

            var overview = OverviewContainer.Content as Overview;

            if (overview != null)
            {
                overview.Update(summoner.SummonerId, summoner.AcctId);
            }
        }
コード例 #18
0
#pragma warning disable 4014 //Code does not need to be awaited
        async void Login()
        {
            BaseRegion selectedRegion = BaseRegion.GetRegion((string)RegionComboBox.SelectedValue);
            var        authToken      = await RiotCalls.GetRestToken(LoginUsernameBox.Text, LoginPasswordBox.Password, selectedRegion.LoginQueue);

            if (authToken == "invalid_credentials")
            {
                ErrorTextBox.Text                = "Wrong login data";
                HideGrid.Visibility              = Visibility.Visible;
                ErrorTextBox.Visibility          = Visibility.Visible;
                LoggingInLabel.Visibility        = Visibility.Hidden;
                LoggingInProgressRing.Visibility = Visibility.Collapsed;
                return;
            }
            Client.RiotConnection = new RtmpClient(new System.Uri("rtmps://" + selectedRegion.Server + ":2099"), RiotCalls.RegisterObjects(), ObjectEncoding.Amf3);
            Client.RiotConnection.CallbackException += client_CallbackException;
            Client.RiotConnection.MessageReceived   += client_MessageReceived;
            try
            {
                await Client.RiotConnection.ConnectAsync();
            }
            catch
            {
                ErrorTextBox.Text                = "Failed to login. SSL error.";
                HideGrid.Visibility              = Visibility.Visible;
                ErrorTextBox.Visibility          = Visibility.Visible;
                LoggingInLabel.Visibility        = Visibility.Hidden;
                LoggingInProgressRing.Visibility = Visibility.Collapsed;
                return;
            }

            Client.RiotConnection.SetChunkSize(2147483647);
            AuthenticationCredentials newCredentials = new AuthenticationCredentials
            {
                Username        = LoginUsernameBox.Text,
                Password        = LoginPasswordBox.Password,
                ClientVersion   = Client.Version,
                IpAddress       = RiotCalls.GetIpAddress(),
                Locale          = selectedRegion.Locale,
                OperatingSystem = "Windows 7",
                Domain          = "lolclient.lol.riotgames.com",
                AuthToken       = authToken
            };
            Session login = await RiotCalls.Login(newCredentials);

            if (login == null)
            {
                Client.Log("Login session is null.");
                var overlay = new MessageOverlay
                {
                    MessageTextBox = { Text = "Login session is null. Login failed. Please check whether the version number is correct or not.", IsReadOnly = true },
                    MessageTitle   = { Content = "Login session is null." }
                };
                Client.OverlayContainer.Content    = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
                ErrorTextBox.Text                = "Failed to login. Login session is null.";
                HideGrid.Visibility              = Visibility.Visible;
                ErrorTextBox.Visibility          = Visibility.Visible;
                LoggingInLabel.Visibility        = Visibility.Hidden;
                LoggingInProgressRing.Visibility = Visibility.Collapsed;
                return;
            }
            Client.PlayerSession = login;
            var str1 = string.Format("gn-{0}", login.AccountSummary.AccountId);
            var str2 = string.Format("cn-{0}", login.AccountSummary.AccountId);
            var str3 = string.Format("bc-{0}", login.AccountSummary.AccountId);

            Task <bool>[] taskArray = { Client.RiotConnection.SubscribeAsync("my-rtmps", "messagingDestination", str1, str1),
                                        Client.RiotConnection.SubscribeAsync("my-rtmps", "messagingDestination", str2, str2),
                                        Client.RiotConnection.SubscribeAsync("my-rtmps", "messagingDestination", "bc", str3) };

            await Task.WhenAll(taskArray);

            //Riot added this for no reason but make it look like the riot client we have to do this
            var plainTextbytes = Encoding.UTF8.GetBytes(login.AccountSummary.Username + ":" + login.Token);

            Client.reconnectToken = Convert.ToBase64String(plainTextbytes);
            //await RiotCalls.Login(result);
            var LoggedIn = await Client.RiotConnection.LoginAsync(LoginUsernameBox.Text.ToLower(), login.Token);

            DoGetOnLoginPacket();
        }
コード例 #19
0
        private void EnteredQueue(SearchingForMatchNotification result)
        {
            if (result.PlayerJoinFailures != null)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() =>
                {
                    Client.HasPopped = false;
                    var messageOver  = new MessageOverlay();
                    messageOver.MessageTitle.Content = "Could not join the queue";
                    foreach (var item in result.PlayerJoinFailures)
                    {
                        var x         = (QueueDodger)item;
                        TimeSpan time = TimeSpan.FromMilliseconds(x.PenaltyRemainingTime);
                        switch (x.ReasonFailed)
                        {
                        case "LEAVER_BUSTER_TAINTED_WARNING":
                            messageOver.MessageTextBox.Text += " - You have left a game in progress. Please use the official client to remove the warning for now.";
                            //Need to implement their new warning for leaving.
                            break;

                        case "QUEUE_DODGER":
                            messageOver.MessageTextBox.Text += " - " + x.Summoner.Name + " is unable to join the queue as they recently dodged a game." + Environment.NewLine;
                            messageOver.MessageTextBox.Text += " - You have " + string.Format("{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) + " remaining until you may queue again";
                            break;

                        case "QUEUE_RESTRICTED":
                            messageOver.MessageTextBox.Text += " - You are too far apart in ranked to queue together.";
                            messageOver.MessageTextBox.Text += " - For instance, Silvers can only queue with Bronze, Silver, or Gold players.";
                            break;

                        case "RANKED_RESTRICTED":
                            messageOver.MessageTextBox.Text += " - You are not currently able to queue for ranked for: " + x.PenaltyRemainingTime + " games. If this is inaccurate please report it as an issue on the github page. Thanks!";
                            break;

                        case "RANKED_MIN_LEVEL":
                            messageOver.MessageTextBox.Text += " - Level 30 is required to played ranked games.";
                            break;

                        case "QUEUE_PARTICIPANTS":
                            messageOver.MessageTextBox.Text += " - Not enough players for this queue type.";
                            break;

                        case "LEAVER_BUSTED":
                            var xm = (BustedLeaver)x;
                            Client.Log("LeaverBuster, Access token is: " + xm.AccessToken);
                            var message = new MessageOverlay
                            {
                                MessageTitle   = { Content = "LeaverBuster" },
                                MessageTextBox = { Text = "" }
                            };
                            Timer t = new Timer {
                                Interval = 1000
                            };
                            var timeleft = xm.LeaverPenaltyMilisRemaining;
                            t.Elapsed   += (messafge, mx) =>
                            {
                                timeleft  = timeleft - 1000;
                                var timex = TimeSpan.FromMilliseconds(timeleft);
                                Dispatcher.BeginInvoke(
                                    DispatcherPriority.Input, new ThreadStart(() =>
                                {
                                    //Can not bypass this sadly, it just relaunches
                                    message.MessageTextBox.Text =
                                        @"Abandoning a match or being AFK results in a negative experience for your teammates, and is a punishable offense in League of Legends.
You've been placed in a lower priority queue" + Environment.NewLine;
                                    message.MessageTextBox.Text += "You have " +
                                                                   string.Format(
                                        "{0:D2}m:{1:D2}s", timex.Minutes, timex.Seconds) +
                                                                   " remaining until you may queue again" + Environment.NewLine;

                                    message.MessageTextBox.Text += "You can close this window and you will still be in queue";

                                    Client.OverlayContainer.Content = message.Content;
                                    if (timeleft < 0)
                                    {
                                        t.Stop();
                                        Client.OverlayContainer.Visibility = Visibility.Hidden;
                                    }
                                }));
                            };
                            t.Start();
                            Client.OverlayContainer.Content    = message.Content;
                            Client.OverlayContainer.Visibility = Visibility.Visible;
                            if (CurrentLobby.Owner.SummonerId.MathRound() !=
                                Client.LoginPacket.AllSummonerData.Summoner.SumId.MathRound())
                            {
                                return;
                            }
                            EnteredQueue(await RiotCalls.AttachTeamToQueue(parameters, new AsObject {
                                { "LEAVER_BUSTER_ACCESS_TOKEN", xm.AccessToken }
                            }));
                            break;

                        case "RANKED_NUM_CHAMPS":
                            messageOver.MessageTextBox.Text += " - You require at least 16 owned champions to play a Normal Draft / Ranked game.";
                            break;

                        default:
                            messageOver.MessageTextBox.Text += "Please submit: - " + x.ReasonFailed + " - as an Issue on github explaining what it meant. Thanks!";
                            break;
                        }
                    }
                    Client.OverlayContainer.Content    = messageOver.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                }));
                return;
            }
            Client.RiotConnection.MessageReceived += GotQueuePop;
            setStartButtonText("Joining Queue");
            startTime         = 1;
            inQueue           = true;
            Client.GameStatus = "inQueue";
            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                if (Client.inQueueTimer.Visibility == Visibility.Hidden)
                {
                    Client.inQueueTimer.Visibility = Visibility.Visible;
                }
                TeamListView.Opacity = 0.3D;
            }));
            Client.timeStampSince = (DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalMilliseconds;
            Client.SetChatHover();
        }
コード例 #20
0
 private void EnteredQueue(SearchingForMatchNotification result)
 {
     if (result.PlayerJoinFailures != null)
     {
         Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
         {
             MessageOverlay messageOver = new MessageOverlay();
             messageOver.MessageTitle.Content = "Could not join the queue";
             foreach (QueueDodger x in result.PlayerJoinFailures)
             {
                 messageOver.MessageTextBox.Text += x.Summoner.Name + " is unable to join the queue as they recently dodged a game." + Environment.NewLine;
                 TimeSpan time = TimeSpan.FromMilliseconds(x.PenaltyRemainingTime);
                 messageOver.MessageTextBox.Text += "You have " + string.Format("{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) + " remaining until you may queue again";
             }
             messageOver.Content = messageOver.Content;
             messageOver.Visibility = Visibility.Visible;
         }));
         return;
     }
 }
コード例 #21
0
        private async void Client_OnMessage(object sender, Message msg)
        {
            if (msg.Subject != null)
            {
                ChatSubjects subject = (ChatSubjects)Enum.Parse(typeof(ChatSubjects), msg.Subject, true);
                double[] Double = new double[1] { Convert.ToDouble(msg.From.User.Replace("sum", "")) };
                string[] Name = await Client.PVPNet.GetSummonerNames(Double);
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    InvitePlayer invitePlayer = null;
                    foreach (var x in Client.InviteListView.Items)
                    {
                        InvitePlayer tempInvPlayer = (InvitePlayer)x;
                        if ((string)tempInvPlayer.PlayerLabel.Content == Name[0])
                        {
                            invitePlayer = x as InvitePlayer;
                            break;
                        }
                    }

                    if (subject == ChatSubjects.GAME_INVITE_ACCEPT)
                    {
                        if (invitePlayer != null)
                            invitePlayer.StatusLabel.Content = "Accepted";
                        if (IsOwner)
                            Client.Message("sum222908", "<body><inviteId>8649134</inviteId><userName>Snowl</userName><profileIconId>576</profileIconId><gameType>NORMAL_GAME</gameType><groupId></groupId><seasonRewards>-1</seasonRewards><mapId>1</mapId><queueId>2</queueId><gameMode>classic_pvp</gameMode><gameDifficulty></gameDifficulty></body>", ChatSubjects.GAME_INVITE_ACCEPT_ACK);
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_REJECT)
                    {
                        if (invitePlayer != null)
                            invitePlayer.StatusLabel.Content = "Rejected";
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_LIST_STATUS)
                    {
                        ParseCurrentInvitees(msg.Body);
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_ALLOW_SUGGESTIONS)
                    {
                        InviteButton.IsEnabled = true;
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_DISALLOW_SUGGESTIONS)
                    {
                        InviteButton.IsEnabled = false;
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_OWNER_CANCEL)
                    {
                        MessageOverlay messageOver = new MessageOverlay();
                        messageOver.MessageTitle.Content = "Party Cancelled";
                        messageOver.MessageTextBox.Text = "This party has been cancelled.";
                        newRoom.Leave("Party Cancelled");
                        Client.OverlayContainer.Content = messageOver.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_CANCEL)
                    {
                        MessageOverlay messageOver = new MessageOverlay();
                        messageOver.MessageTitle.Content = "Kicked";
                        messageOver.MessageTextBox.Text = "You have been kicked from the party.";
                        newRoom.Leave("Kicked");
                        Client.OverlayContainer.Content = messageOver.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                    else if (subject == ChatSubjects.VERIFY_INVITEE)
                    {
                        Client.Message(MessageData.From.User, MessageData.Body, ChatSubjects.VERIFY_INVITEE_ACK);
                    }
                }));
            }
        }
コード例 #22
0
        private async void Client_OnMessage(object sender, Message msg)
        {
            if (msg.Subject != null)
            {
                ChatSubjects subject = (ChatSubjects)Enum.Parse(typeof(ChatSubjects), msg.Subject, true);
                double[]     Double  = new double[1] {
                    Convert.ToDouble(msg.From.User.Replace("sum", ""))
                };
                string[] Name = await RiotCalls.GetSummonerNames(Double);

                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    InvitePlayer invitePlayer = null;
                    foreach (var x in Client.InviteListView.Items)
                    {
                        InvitePlayer tempInvPlayer = (InvitePlayer)x;
                        if ((string)tempInvPlayer.PlayerLabel.Content == Name[0])
                        {
                            invitePlayer = x as InvitePlayer;
                            break;
                        }
                    }

                    if (subject == ChatSubjects.GAME_INVITE_ACCEPT)
                    {
                        if (invitePlayer != null)
                        {
                            invitePlayer.StatusLabel.Content = "Accepted";
                        }
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_REJECT)
                    {
                        if (invitePlayer != null)
                        {
                            invitePlayer.StatusLabel.Content = "Rejected";
                        }
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_LIST_STATUS)
                    {
                        ParseCurrentInvitees(msg.Body);
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_ALLOW_SUGGESTIONS)
                    {
                        InviteButton.IsEnabled = true;
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_DISALLOW_SUGGESTIONS)
                    {
                        InviteButton.IsEnabled = false;
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_OWNER_CANCEL)
                    {
                        MessageOverlay messageOver       = new MessageOverlay();
                        messageOver.MessageTitle.Content = "Party Cancelled";
                        messageOver.MessageTextBox.Text  = "This party has been cancelled.";
                        newRoom.Leave("Party Cancelled");
                        Client.OverlayContainer.Content    = messageOver.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_CANCEL)
                    {
                        MessageOverlay messageOver       = new MessageOverlay();
                        messageOver.MessageTitle.Content = "Kicked";
                        messageOver.MessageTextBox.Text  = "You have been kicked from the party.";
                        newRoom.Leave("Kicked");
                        Client.OverlayContainer.Content    = messageOver.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                    else if (subject == ChatSubjects.VERIFY_INVITEE)
                    {
                        Client.Message(MessageData.From.User, MessageData.Body, ChatSubjects.VERIFY_INVITEE_ACK);
                    }
                }));
            }
        }
コード例 #23
0
 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;
             LoginPacket.IpBalance = newBalance.Ip;
             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;
                 case "PLAYER_QUIT":
                     string[] Name = await PVPNet.GetSummonerNames(new double[1] { Convert.ToDouble((string)notification.MessageArgument) });
                     messageOver.MessageTitle.Content = "Player has left the queue";
                     messageOver.MessageTextBox.Text = Name[0] + " has left the queue";
                     break;
                 default:
                     messageOver.MessageTextBox.Text = notification.MessageCode + Environment.NewLine;
                     messageOver.MessageTextBox.Text += Convert.ToString(notification.MessageArgument);
                     break;
             }
             OverlayContainer.Content = messageOver.Content;
             OverlayContainer.Visibility = Visibility.Visible;
             QuitCurrentGame();
         }
         else if (message is EndOfGameStats)
         {
             EndOfGameStats stats = message as EndOfGameStats;
             EndOfGamePage EndOfGame = new EndOfGamePage(stats);
             OverlayContainer.Visibility = Visibility.Visible;
             OverlayContainer.Content = EndOfGame.Content;
         }
         else if (message is StoreFulfillmentNotification)
         {
             PlayerChampions = await PVPNet.GetAvailableChampions();
         }
         else if (message is GameDTO)
         {
             GameDTO Queue = message as GameDTO;
             if (!IsInGame && Queue.GameState != "TERMINATED")
             {
                 MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                 {
                     Client.OverlayContainer.Content = new QueuePopOverlay(Queue).Content;
                     Client.OverlayContainer.Visibility = Visibility.Visible;
                 }));
             }
         }
     }));
 }
コード例 #24
0
        private void EnteredQueue(SearchingForMatchNotification result)
        {
            if (result.PlayerJoinFailures != null)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    Button item = LastSender;
                    GameQueueConfig config = (GameQueueConfig)item.Tag;
                    Queues.Remove(config.Id);
                    MessageOverlay message = new MessageOverlay();
                    message.MessageTitle.Content = "Failed to join queue";
                    message.MessageTextBox.Text = result.PlayerJoinFailures[0].ReasonFailed;
                    if (result.PlayerJoinFailures[0].ReasonFailed == "QUEUE_DODGER")
                    {
                        message.MessageTextBox.Text = "Unable to join the queue due to you recently dodging a game." + Environment.NewLine;
                        TimeSpan time = TimeSpan.FromMilliseconds(result.PlayerJoinFailures[0].PenaltyRemainingTime);
                        message.MessageTextBox.Text = "You have " + string.Format("{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) + " remaining until you may queue again";
                    }
                    else if (result.PlayerJoinFailures[0].ReasonFailed == "RANKED_MIN_LEVEL")
                    {
                        message.MessageTextBox.Text = "You do not meet the level requirements for this queue! Please wait until you are a higher level.";
                    }
                    Client.OverlayContainer.Content = message.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                }));
                return;
            }

            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                Button item = LastSender;
                Button fakeButton = new Button(); //We require a unique button to add to the dictionary
                fakeButton.Tag = item;
                item.Content = "00:00";
                ButtonTimers.Add(fakeButton, 0);
            }));
            Client.PVPNet.OnMessageReceived += GotQueuePop;
        }
コード例 #25
0
        public LoginPage()
        {
            InitializeComponent();
            Client.donepatch     = true;
            Client.patching      = false;
            Version.TextChanged += WaterTextbox_TextChanged;
            bool x = Settings.Default.DarkTheme;

            if (!x)
            {
                var bc = new BrushConverter();
                HideGrid.Background = (Brush)bc.ConvertFrom("#B24F4F4F");
                LoggingInProgressRing.Foreground = (Brush)bc.ConvertFrom("#FFFFFFFF");
            }
            //#B2C8C8C8
            UpdateRegionComboBox.SelectedValue = Client.UpdateRegion;
            switch (Client.UpdateRegion)
            {
            case "PBE":
                RegionComboBox.ItemsSource          = new[] { "PBE" };
                LoginUsernameBox.Visibility         = Visibility.Visible;
                RememberUsernameCheckbox.Visibility = Visibility.Visible;
                break;

            case "Live":
                RegionComboBox.ItemsSource          = new[] { "BR", "EUNE", "EUW", "NA", "OCE", "RU", "LAS", "LAN", "TR", "CS" };
                LoginUsernameBox.Visibility         = Visibility.Visible;
                RememberUsernameCheckbox.Visibility = Visibility.Visible;
                break;

            case "Korea":
                RegionComboBox.ItemsSource          = new[] { "KR" };
                LoginUsernameBox.Visibility         = Visibility.Visible;
                RememberUsernameCheckbox.Visibility = Visibility.Visible;
                LoginPasswordBox.Visibility         = Visibility.Visible;
                break;

            case "Garena":
                RegionComboBox.ItemsSource          = new[] { "PH", "SG", "SGMY", "TH", "TW", "VN", "ID" };
                LoginUsernameBox.Visibility         = Visibility.Hidden;
                RememberUsernameCheckbox.Visibility = Visibility.Hidden;
                LoginPasswordBox.Visibility         = Visibility.Hidden;
                if (!string.IsNullOrEmpty(Settings.Default.DefaultGarenaRegion))
                {
                    RegionComboBox.SelectedValue = Settings.Default.DefaultGarenaRegion;      // Default Garena Region
                }
                break;
            }

            string themeLocation = Path.Combine(Client.ExecutingDirectory, "assets", "themes", Client.Theme);

            if (!Settings.Default.DisableLoginMusic)
            {
                string[] music;
                string   soundpath = Path.Combine(Client.ExecutingDirectory, "Assets", "sounds", "sound_o_heaven.ogg");
                if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1)
                {
                    if (!File.Exists(soundpath))
                    {
                        using (WebClient wc = new WebClient())
                        {
                            wc.DownloadFile("http://images.wikia.com/leagueoflegends/images/1/10/Teemo.laugh3.ogg", soundpath);
                        }
                    }
                    music = new[] { soundpath };
                }
                else
                {
                    music = Directory.GetFiles(themeLocation, "*.mp3");
                }
                SoundPlayer.Source = new System.Uri(Path.Combine(themeLocation, music[0]));
                SoundPlayer.Play();
                Sound.IsChecked = false;
            }
            else
            {
                Sound.IsChecked = true;
            }

            if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1)
            {
                string SkinPath = Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
                                               "Teemo_Splash_" + new Random().Next(0, 8) + ".jpg");
                if (File.Exists(SkinPath))
                {
                    LoginImage.Source = new BitmapImage(new System.Uri(SkinPath, UriKind.Absolute));
                }
            }
            else if (Settings.Default.LoginPageImage == "")
            {
                string[] videos = Directory.GetFiles(themeLocation, "*.mp4");
                if (videos.Length > 0 && File.Exists(videos[0]))
                {
                    LoginPic.Source = new System.Uri(videos[0]);
                }
                LoginPic.LoadedBehavior = MediaState.Manual;
                LoginPic.MediaEnded    += LoginPic_MediaEnded;
                SoundPlayer.MediaEnded += SoundPlayer_MediaEnded;
                LoginPic.Play();
            }
            else
            {
                if (
                    File.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
                                             Settings.Default.LoginPageImage.Replace("\r\n", ""))))
                {
                    LoginImage.Source =
                        new BitmapImage(
                            new System.Uri(
                                Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
                                             Settings.Default.LoginPageImage), UriKind.Absolute));
                }
            }

            Video.IsChecked = false;

            //Get client data after patcher completed

            Client.SQLiteDatabase = new SQLiteConnection(Path.Combine(Client.ExecutingDirectory, Client.sqlite));

            // Check database error
            try
            {
                Client.Champions = (from s in Client.SQLiteDatabase.Table <champions>()
                                    orderby s.name
                                    select s).ToList();

                //* to remove just remove one slash from the comment
                //Pls bard the tard for april fools
                Client.Champions.Find(bard => bard.name == "Bard").displayName = "Tard";
                //*/
            }
            catch (Exception e) // Database broken?
            {
                Client.Log("Database is broken : \r\n" + e.Message + "\r\n" + e.Source);
                var overlay = new MessageOverlay
                {
                    MessageTextBox = { Text = "Database is broken. Click OK to exit LegendaryClient." },
                    MessageTitle   = { Content = "Database Error" }
                };
                Client.SQLiteDatabase.Close();
                File.Delete(Path.Combine(Client.ExecutingDirectory, Client.sqlite));
                overlay.AcceptButton.Click        += (o, i) => { Environment.Exit(0); };
                Client.OverlayContainer.Content    = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
                return;
            }

            var FreeToPlay = FreeToPlayChampions.GetInstance();

            foreach (champions c in Client.Champions)
            {
                var source = new System.Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", c.iconPath),
                                            UriKind.Absolute);
                c.icon = new BitmapImage(source);

                if (FreeToPlay != null)
                {
                    c.IsFreeToPlay = FreeToPlay.IsFreeToPlay(c);
                }
                Champions.InsertExtraChampData(c);
            }

            Client.ChampionSkins = (from s in Client.SQLiteDatabase.Table <championSkins>()
                                    orderby s.name
                                    select s).ToList();
            Client.ChampionAbilities = (from s in Client.SQLiteDatabase.Table <championAbilities>()
                                        orderby s.name
                                        select s).ToList();

            Client.SQLiteDatabase.Close();
            Client.Items     = Items.PopulateItems();
            Client.Masteries = Masteries.PopulateMasteries();
            Client.Runes     = Runes.PopulateRunes();
            BaseUpdateRegion updateRegion = BaseUpdateRegion.GetUpdateRegion(Client.UpdateRegion);
            var patcher = new RiotPatcher();

            if (Client.UpdateRegion != "Garena")
            {
                string tempString = patcher.GetListing(updateRegion.AirListing);

                string[] packages = patcher.GetManifest(
                    updateRegion.AirManifest + "releases/" + tempString + "/packages/files/packagemanifest");
                foreach (
                    string usestring in
                    packages.Select(package => package.Split(',')[0])
                    .Where(usestring => usestring.Contains("ClientLibCommon.dat")))
                {
                    new WebClient().DownloadFile(new System.Uri(updateRegion.BaseLink + usestring),
                                                 Path.Combine(Client.ExecutingDirectory, "ClientLibCommon.dat"));
                }
            }
            var reader = new SWFReader(Path.Combine(Client.ExecutingDirectory, "ClientLibCommon.dat"));

            foreach (var secondSplit in from abcTag in reader.Tags.OfType <DoABC>()
                     where abcTag.Name.Contains("riotgames/platform/gameclient/application/Version")
                     select Encoding.Default.GetString(abcTag.ABCData)
                     into str
                     select str.Split((char)6)
                     into firstSplit

                     select firstSplit[0].Split((char)18))
            {
                if (secondSplit.Count() > 1)
                {
                    Client.Version = secondSplit[1];
                }
                else
                {
                    var thirdSplit = secondSplit[0].Split((char)19);
                    Client.Version = thirdSplit[1];
                }
            }


            Version.Text = Client.Version;

            if (!string.IsNullOrWhiteSpace(Settings.Default.SavedUsername))
            {
                RememberUsernameCheckbox.IsChecked = true;
                LoginUsernameBox.Text = Settings.Default.SavedUsername;
            }
            if (!string.IsNullOrWhiteSpace(Settings.Default.SavedPassword))
            {
                SHA1 sha = new SHA1CryptoServiceProvider();
                RememberPasswordCheckbox.IsChecked = true;
                LoginPasswordBox.Password          =
                    Settings.Default.SavedPassword.DecryptStringAES(
                        sha.ComputeHash(Encoding.UTF8.GetBytes(Settings.Default.Guid)).ToString());
            }
            if (!string.IsNullOrWhiteSpace(Settings.Default.Region))
            {
                RegionComboBox.SelectedValue = Settings.Default.Region;
            }

            invisibleLoginCheckBox.IsChecked = Settings.Default.incognitoLogin;
        }
コード例 #26
0
        private void EnteredQueue(SearchingForMatchNotification result)
        {
            if (result.PlayerJoinFailures != null)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    var leaver = result.PlayerJoinFailures[0];
                    if (leaver.ReasonFailed == "LEAVER_BUSTED")
                    {
                        var x = (BustedLeaver)leaver;
                        Client.Log("LeaverBuster, Access token is: " + x.AccessToken);
                        var message = new MessageOverlay
                        {
                            MessageTitle = { Content = "LeaverBuster" },
                            MessageTextBox = { Text = "" }
                        };
                        Timer t = new Timer { Interval = 1000 };
                        var timeleft = x.LeaverPenaltyMilisRemaining;
                        t.Elapsed += (messafge, mx) =>
                        {
                            timeleft = timeleft - 1000;
                            TimeSpan time = TimeSpan.FromMilliseconds(timeleft);
                            Dispatcher.BeginInvoke(
                                DispatcherPriority.Input, new ThreadStart(async() =>
                                    {
                                        //Can not bypass this sadly, it just relaunches
                                        message.MessageTextBox.Text =
                                            @"Abandoning a match or being AFK results in a negative experience for your teammates, and is a punishable offense in League of Legends.
You've been placed in a lower priority queue" + Environment.NewLine;
                                        message.MessageTextBox.Text += "You have " +
                                                                       string.Format(
                                                                           "{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) +
                                                                       " remaining until you may queue again" + Environment.NewLine;

                                        message.MessageTextBox.Text += "You can close this window and you will still be in queue";

                                        Client.OverlayContainer.Content = message.Content;
                                        if (timeleft < 0)
                                        {
                                            t.Stop();
                                            Client.OverlayContainer.Visibility = Visibility.Hidden;
                                            var obj = new AsObject { { "LEAVER_BUSTER_ACCESS_TOKEN", x.AccessToken } };
                                            EnteredQueue(await RiotCalls.AttachToQueue(param, obj));
                                        }
                                    }));

                        };
                        t.Start();
                        Client.OverlayContainer.Content = message.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        Button item = LastSender;
                        var settings = (QueueButtonConfig) LastSender.Tag;
                        var config = settings.GameQueueConfig;
                        Queues.Remove(config.Id);
                        var failure = result.PlayerJoinFailures[0];
                        var message = new MessageOverlay
                        {
                            MessageTitle = { Content = "Failed to join queue" },
                            MessageTextBox = { Text = failure.ReasonFailed }
                        };
                        switch (failure.ReasonFailed)
                        {
                            case "QUEUE_DODGER":
                                {
                                    message.MessageTextBox.Text =
                                    "Unable to join the queue due to you recently dodging a game." +
                                        Environment.NewLine;
                                        TimeSpan time = TimeSpan.FromMilliseconds(failure.PenaltyRemainingTime);
                                        message.MessageTextBox.Text = "You have " +
                                                                      string.Format(
                                                                          "{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) +
                                                                      " remaining until you may queue again";
                                }
                                    break;
                            case "RANKED_MIN_LEVEL":
                                    message.MessageTextBox.Text =
                                        "You do not meet the requirements for this queue." + Environment.NewLine;
                                    break;
                            case "QUEUE_PARTICIPANTS":
                                    message.MessageTextBox.Text =
                                        "This queue is in dev. Please use this queue on the real league of legends client." +
                                        Environment.NewLine;
                                    break;
                                }
                        Client.OverlayContainer.Content = message.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                }));
            }
            else if (result.JoinedQueues != null)
            {
                Button item = new Button();
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    item = LastSender;
                    var fakeButton = new Button
                    {
                        Tag = item
                    }; 
                    item.Content = "00:00";
                }));
                if (t.Enabled)
                    t.Stop();
                t = new Timer { Interval = 1000 };
                t.Start();
                time = 0;
                t.Elapsed += (gg, easy) =>
                {
                    time = time + 1000;
                    TimeSpan timespan = TimeSpan.FromMilliseconds(time);
                    Dispatcher.BeginInvoke(
                        DispatcherPriority.Input,
                        new ThreadStart(() => item.Content = string.Format("{0:D2}m:{1:D2}s", timespan.Minutes, timespan.Seconds)));
                };
                InQueue = true;
                Client.GameStatus = "inQueue";
                Client.timeStampSince =
                    (DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalMilliseconds;
                Client.SetChatHover();
                Client.RiotConnection.MessageReceived += GotQueuePop;
                Client.Log("Now in Queue");
            }
        }
コード例 #27
0
        private void StartPatcher()
        {
            Thread bgThead = new Thread(() =>
            {
                LogTextBox("Starting Patcher");

                WebClient client = new WebClient();
                client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
                client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadDDragon);
                client.DownloadProgressChanged += (o, e) =>
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        double bytesIn = double.Parse(e.BytesReceived.ToString());
                        double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
                        double percentage = bytesIn / totalBytes * 100;
                        CurrentProgressLabel.Content = "Downloaded " + e.BytesReceived + " of " + e.TotalBytesToReceive;
                        CurrentProgressBar.Value = int.Parse(Math.Truncate(percentage).ToString());
                    }));
                };

                #region LegendaryClient

                string CurrentMD5 = GetMd5();
                LogTextBox("MD5: " + CurrentMD5);
                string VersionString = "";
                try
                {
                    VersionString = client.DownloadString(new Uri("http://eddy5641.github.io/LegendaryClient/update.html"));

                    string[] VersionSplit = VersionString.Split('|');

                    LogTextBox("Update data: " + VersionSplit[0] + "|" + VersionSplit[1]);
                }
                catch
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Could not retrieve update files!";
                    }));

                    //return;
                }

                
                //Client.updateData = LegendaryUpdate.PopulateItems();

                //#if !DEBUG //Dont patch client while in DEBUG
                UpdateData legendaryupdatedata = new UpdateData();
                var version = new WebClient().DownloadString("http://eddy5641.github.io/LegendaryClient/Version");
                LogTextBox("Most Up to date LegendaryClient Version: " + version);
                string versionAsString = version;
                var versiontoint = new WebClient().DownloadString("http://eddy5641.github.io/LegendaryClient/VersionAsInt");
                int VersionAsInt = Convert.ToInt32(versiontoint);

                if (VersionAsInt != Client.LegendaryClientReleaseNumber)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        MessageOverlay overlay = new MessageOverlay();
                        overlay.MessageTextBox.Text = "An update is available LegendaryClient";
                        overlay.MessageTitle.Content = "Update Notification";
                        overlay.AcceptButton.Content = "Update LegendaryClient";
                        overlay.AcceptButton.Click += update;
                        overlay.MessageTextBox.TextChanged += Text_Changed;
                        Client.OverlayContainer.Content = overlay.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;

                        CurrentProgressLabel.Content = "LegendaryClient Is Out of Date!";
                        
                    }));
                    LogTextBox("LegendaryClient Is Out of Date!");

                    return;
                }
                else if (Client.LegendaryClientVersion == version)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "LegendaryClient Is Up To Date!";
                        
                    }));
                    LogTextBox("LegendaryClient Is Up To Date!");
                }
                else if (version == null)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Could not check LegendaryClient Version!";
                        
                    }));
                    LogTextBox("Could not check LegendaryClient Version!");
                    return;
                }
                //LogTextBox("LC Update Json Data: " + json);
                //#endif

                //LogTextBox("LegendaryClient is up to date");
                //LogTextBox("LegendaryClient does not have a patcher downloader. Do not be worried by this.");
                
                //Client.Log("[Debug]: LegendaryClient Is Up To Date");

                #endregion LegendaryClient

                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    TotalProgressLabel.Content = "20%";
                    TotalProgessBar.Value = 20;
                }));

                #region DDragon

                System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
                if (!Directory.Exists("Assets"))
                {
                    Directory.CreateDirectory("Assets");
                }
                if (!File.Exists(Path.Combine("Assets", "VERSION_DDRagon")))
                {
                    var VersionLOL = File.Create(Path.Combine("Assets", "VERSION_DDRagon"));
                    VersionLOL.Write(encoding.GetBytes("0.0.0"), 0, encoding.GetBytes("0.0.0").Length);
                    
                    VersionLOL.Close();
                }
                

                RiotPatcher patcher = new RiotPatcher();
                string DDragonDownloadURL = patcher.GetDragon();
                LogTextBox("DataDragon Version: " + patcher.DDragonVersion);
                string DDragonVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_DDragon"));
                LogTextBox("Current DataDragon Version: " + DDragonVersion);

                Client.Version = DDragonVersion;
                Client.Log("DDragon Version (LOL Version) = " + DDragonVersion);

                 LogTextBox("Client Version: " + Client.Version);

                if (patcher.DDragonVersion != DDragonVersion)
                {
                    if (!Directory.Exists(Path.Combine("Assets", "temp")))
                    {
                        Directory.CreateDirectory(Path.Combine("Assets", "temp"));
                    }

                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Downloading DataDragon";
                    }));

                    client.DownloadFile(DDragonDownloadURL, Path.Combine("Assets", "dragontail-" + patcher.DDragonVersion + ".tgz"));

                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Extracting DataDragon";
                    }));

                    Stream inStream = File.OpenRead(Path.Combine("Assets", "dragontail-" + patcher.DDragonVersion + ".tgz"));
                    
                    using (GZipInputStream gzipStream = new GZipInputStream(inStream))
                    {
                        TarArchive tarArchive = TarArchive.CreateInputTarArchive(gzipStream);
                        tarArchive.ExtractContents(Path.Combine("Assets", "temp"));
                        tarArchive.CloseArchive();
                    }
                    inStream.Close();

                    Copy(Path.Combine("Assets", "temp", patcher.DDragonVersion, "data"), Path.Combine("Assets", "data"));
                    Copy(Path.Combine("Assets", "temp", patcher.DDragonVersion, "img"), Path.Combine("Assets"));
                    DeleteDirectoryRecursive(Path.Combine("Assets", "temp"));

                    var VersionDDragon = File.Create(Path.Combine("Assets", "VERSION_DDRagon"));
                    VersionDDragon.Write(encoding.GetBytes(patcher.DDragonVersion), 0, encoding.GetBytes(patcher.DDragonVersion).Length);

                    Client.Version = DDragonVersion;
                    VersionDDragon.Close();
                }

                #endregion DDragon

                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    TotalProgressLabel.Content = "40%";
                    TotalProgessBar.Value = 40;
                }));

                // Try get LoL path from registry

                //A string that looks like C:\Riot Games\League of Legends\
                string lolRootPath = GetLolRootPath();

                #region lol_air_client

                if (!File.Exists(Path.Combine("Assets", "VERSION_AIR")))
                {
                    var VersionAIR = File.Create(Path.Combine("Assets", "VERSION_AIR"));
                    VersionAIR.Write(encoding.GetBytes("0.0.0.0"), 0, encoding.GetBytes("0.0.0.0").Length);
                    VersionAIR.Close();
                }

                string LatestAIR = patcher.GetLatestAir();
                LogTextBox("Air Assets Version: " + LatestAIR);
                string AirVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_AIR"));
                LogTextBox("Current Air Assets Version: " + AirVersion);
                bool RetrieveCurrentInstallation = false;
                string AirLocation = "";

                if (AirVersion == "0.0.0.0")
                {
                    LogTextBox("Checking for existing League of Legends Installation");
                    AirLocation = Path.Combine("League of Legends", "RADS", "projects", "lol_air_client", "releases");
                    var localAirLocation = Path.Combine("RADS", "projects", "lol_air_client", "releases");
                    if (Directory.Exists(AirLocation))
                    {
                        RetrieveCurrentInstallation = true;
                    }
                    else if (string.IsNullOrEmpty(lolRootPath) == false && Directory.Exists(Path.Combine(lolRootPath, localAirLocation)))
                    {
                        RetrieveCurrentInstallation = true;
                        AirLocation = Path.Combine(lolRootPath, localAirLocation);
                    }
                    else
                    {
                        LogTextBox("Unable to find existing League of Legends. Copy your League of Legends folder into + "
                            + Client.ExecutingDirectory
                            + " to make the patching process quicker");
                    }

                    if (RetrieveCurrentInstallation)
                    {
                        LogTextBox("Getting Air Assets from " + AirLocation);
                        Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                        {
                            CurrentProgressLabel.Content = "Copying Air Assets";
                        }));
                        AirVersion = patcher.GetCurrentAirInstall(AirLocation);
                        LogTextBox("Retrieved currently installed Air Assets");
                        LogTextBox("Current Air Assets Version: " + AirVersion);
                        Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                        {
                            TotalProgressLabel.Content = "60%";
                            TotalProgessBar.Value = 60;
                        }));
                    }
                }

                if (AirVersion != LatestAIR)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        SkipPatchButton.IsEnabled = true;
                        CurrentProgressLabel.Content = "Retrieving Air Assets";
                    }));
                }

                #endregion lol_air_client


                //string GameVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "RADS", "VERSION_LOL"));
                #region lol_game_client
                LogTextBox("Trying to detect League of Legends GameClient");
                LogTextBox("League of Legends is located at: " + lolRootPath);
                //RADS\solutions\lol_game_client_sln\releases
                var GameLocation = Path.Combine(lolRootPath, "RADS", "solutions", "lol_game_client_sln", "releases");

                string LolVersion2 = new WebClient().DownloadString("http://l3cdn.riotgames.com/releases/live/projects/lol_game_client/releases/releaselisting_NA");
                string LolVersion = new WebClient().DownloadString("http://l3cdn.riotgames.com/releases/live/solutions/lol_game_client_sln/releases/releaselisting_NA");
                string GameClientSln = LolVersion.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0];
                string GameClient = LolVersion2.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0];
                LogTextBox("Latest League of Legends GameClient: " + GameClientSln);
                LogTextBox("Checking if League of Legends is Up-To-Date");
                if (Directory.Exists(Path.Combine(GameLocation, GameClientSln)))
                {
                    LogTextBox("League of Legends is Up-To-Date");
                    //Client.LaunchGameLocation = Path.Combine(Client.GameLocation, GameClientSln);
                    //C:\Riot Games\League of Legends\RADS\projects\lol_game_client\releases\0.0.0.243\deploy
                    Client.LOLCLIENTVERSION = LolVersion2;
                    Client.Location = Path.Combine(lolRootPath, "RADS", "projects", "lol_game_client", "releases", GameClient, "deploy");
                }
                else 
                {
                    LogTextBox("League of Legends is not Up-To-Date. Please Update League Of Legends");
                    return;
                }


                if (!Directory.Exists("RADS"))
                {
                    Directory.CreateDirectory("RADS");
                }

                if (!File.Exists(Path.Combine("RADS", "VERSION_LOL")))
                {
                    var VersionGAME = File.Create(Path.Combine("RADS", "VERSION_LOL"));
                    VersionGAME.Write(encoding.GetBytes("0.0.0.0"), 0, encoding.GetBytes("0.0.0.0").Length);
                    VersionGAME.Close();
                }

                string LatestGame = patcher.GetLatestGame();
                LogTextBox("League Of Legends Version: " + LatestGame);
                string GameVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "RADS", "VERSION_LOL"));
                LogTextBox("Current League of Legends Version: " + GameVersion);
                RetrieveCurrentInstallation = false;
                string NGameLocation = "";

                if (GameVersion != GameClient)
                {
                    LogTextBox("Checking for existing League of Legends Installation");
                    NGameLocation = Path.Combine("League of Legends", "RADS");
                    if (Directory.Exists(NGameLocation))
                    {
                        RetrieveCurrentInstallation = true;
                    }
                    else if (Directory.Exists(Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", NGameLocation)))
                    {
                        RetrieveCurrentInstallation = true;
                        NGameLocation = Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", NGameLocation);
                    }
                    else
                    {
                        LogTextBox("Unable to find existing League of Legends. Copy your League of Legends folder into + "
                            + Client.ExecutingDirectory
                            + " to make the patching process quicker");
                    }

                    if (RetrieveCurrentInstallation)
                    {
                        LogTextBox("Getting League Of Legends from " + NGameLocation);
                        Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                        {
                            CurrentProgressLabel.Content = "Copying League of Legends";
                        }));
                        GameVersion = patcher.GetCurrentGameInstall(NGameLocation);
                        LogTextBox("Retrieved currently installed League of Legends");
                        LogTextBox("Current League of Legends Version: " + NGameLocation);
                    }
                }

                if (GameVersion != LatestGame)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Retrieving League of Legends";
                    }));
                }
                //No Need to download this anymore, I will auto detect League of Legends
                /*
                if (!Directory.Exists(Path.Combine(Client.ExecutingDirectory, "RADS", "lol_game_client")))
                {
                    Directory.CreateDirectory(Path.Combine(Client.ExecutingDirectory, "RADS", "lol_game_client"));
                }
                if (!File.Exists(Path.Combine(Client.ExecutingDirectory, "RADS", "VERSION_LOL")))
                {
                    var VersionLOL = File.Create(Path.Combine(Client.ExecutingDirectory, "RADS", "VERSION_LOL"));
                    VersionLOL.Write(encoding.GetBytes("0.0.0.0"),0,encoding.GetBytes("0.0.0.0").Length);
                    VersionLOL.Close();
                }
                LogTextBox("Checking version...");
                CheckIfPatched();
                if (!LoLDataIsUpToDate)
                {
                    LogTextBox("Not up-to-date!");
                    if (LolDataVersion == "0.0.0.0")
                    {
                        LogTextBox("Checking for existing LoL installation");
                        string FileArchivesDirectory = Path.Combine("League of Legends", "RADS", "projects", "lol_game_client", "filearchives");
                        string MainVersionLocation = Path.Combine("League of Legends", "RADS", "projects", "lol_game_client", "releases");
                        if (Directory.Exists(FileArchivesDirectory))
                        {
                            ExpandRAF(FileArchivesDirectory);
                            WriteLatestVersion(MainVersionLocation);
                        }
                        else if (Directory.Exists(Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", FileArchivesDirectory)))
                        {
                            ExpandRAF(Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", FileArchivesDirectory));
                            WriteLatestVersion(Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", MainVersionLocation));
                        }
                    }
                    string PackageManifest = "";
                    int CurrentVersionNumber = Convert.ToInt32(LolDataVersion.Split('.')[3]);
                    int LatestVersionNumber = Convert.ToInt32(LatestLolDataVersion.Split('.')[3]);
                    LogTextBox("Retrieving Package Manifest");
                    //How will this happen, idk but we will never know if it will happen
                    InvalidVersion:
                    if (CurrentVersionNumber >= LatestVersionNumber)
                    {
                        //Already updated, just fake numbers in the release listing and you can ignore them
                    }
                    try
                    {
                        PackageManifest = new WebClient().DownloadString("http://l3cdn.riotgames.com/releases/live/projects/lol_game_client/releases/0.0.0." + LatestVersionNumber + "/packages/files/packagemanifest");
                    }
                    catch { LogTextBox(LatestVersionNumber + " is not valid"); LatestVersionNumber -= 1; goto InvalidVersion; }
                    //Do online patch of LoLData from current version onwards
                    if (LolDataVersion != LatestLolDataVersion)
                    {
                        LogTextBox("Updating from " + LolDataVersion + " -> " + LatestLolDataVersion);
                        UpdateFrom(LolDataVersion, PackageManifest);
                        WriteLatestVersion(LatestLolDataVersion);
                    }
                    LogTextBox("Patching League of Legends.exe...");
                    //Everytime we update download all .exe and dll files
                    GetAllExe(PackageManifest);
                }
                LogTextBox("Done!");
                //*/
                #endregion lol_game_client

                

                FinishPatching();
            });

            bgThead.Start();
        }
コード例 #28
0
        private async void StartChampSelect()
        {
            Client.FocusClient();
            Champions = Client.PlayerChampions;
            MyMasteries = Client.LoginPacket.AllSummonerData.MasteryBook;
            MyRunes = Client.LoginPacket.AllSummonerData.SpellBook;

            
            int i = 0;
            foreach (MasteryBookPageDTO MasteryPage in MyMasteries.BookPages)
            {
                string MasteryPageName = MasteryPage.Name;
                if (MasteryPageName.StartsWith("@@"))
                {
                    MasteryPageName = "Mastery Page " + ++i;
                }
                MasteryComboBox.Items.Add(MasteryPageName);
                if (MasteryPage.Current)
                    MasteryComboBox.SelectedValue = MasteryPageName;
            }
            i = 0;
            foreach (SpellBookPageDTO RunePage in MyRunes.BookPages)
            {
                string RunePageName = RunePage.Name;
                if (RunePageName.StartsWith("@@"))
                {
                    RunePageName = "Rune Page " + ++i;
                }
                RuneComboBox.Items.Add(RunePageName);
                if (RunePage.Current)
                    RuneComboBox.SelectedValue = RunePageName;
            }
             

            QuickLoad = true;

            await Client.PVPNet.SetClientReceivedGameMessage(Client.GameID, "CHAMP_SELECT_CLIENT");
            GameDTO latestDTO = await Client.PVPNet.GetLatestGameTimerState(Client.GameID, Client.ChampSelectDTO.GameState, Client.ChampSelectDTO.PickTurn);
            configType = Client.LoginPacket.GameTypeConfigs.Find(x => x.Id == latestDTO.GameTypeConfigId);
            if (configType == null) //Invalid config... abort!
            {
                Client.PVPNet.OnMessageReceived -= ChampSelect_OnMessageReceived;
                await Client.PVPNet.QuitGame();
                Client.ClearPage(this);

                Client.SwitchPage(new MainPage());
                MessageOverlay overlay = new MessageOverlay();
                overlay.MessageTextBox.Text = "Invalid Config ID (" + latestDTO.GameTypeConfigId.ToString() + "). Report to Snowl [https://github.com/Snowl/LegendaryClient/issues/new]";
                overlay.MessageTitle.Content = "Invalid Config";
                Client.OverlayContainer.Content = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
                return;
            }
            counter = configType.MainPickTimerDuration - 5; //Seems to be a 5 second inconsistancy with riot and what they actually provide
            CountdownTimer = new System.Windows.Forms.Timer();
            CountdownTimer.Tick += new EventHandler(CountdownTimer_Tick);
            CountdownTimer.Interval = 1000; // 1 second
            CountdownTimer.Start();

            LatestDto = latestDTO;

            string JID = Client.GetChatroomJID(latestDTO.RoomName.Replace("@sec", ""), latestDTO.RoomPassword, false);
            Chatroom = Client.ConfManager.GetRoom(new jabber.JID(JID));
            Chatroom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name;
            Chatroom.OnRoomMessage += Chatroom_OnRoomMessage;
            Chatroom.OnParticipantJoin += Chatroom_OnParticipantJoin;
            Chatroom.Join(latestDTO.RoomPassword);

            List<ChampionDTO> champList = new List<ChampionDTO>(Champions);

            champList.Sort((x, y) => champions.GetChampion(x.ChampionId).displayName.CompareTo(champions.GetChampion(y.ChampionId).displayName));

            foreach (ChampionDTO champ in champList)
            {
                if (champ.Owned || champ.FreeToPlay)
                {
                    MyChamps.Add(champ);

                    //Add to ListView
                    ListViewItem item = new ListViewItem();
                    ChampionImage championImage = new ChampionImage();
                    championImage.ChampImage.Source = champions.GetChampion(champ.ChampionId).icon;
                    if (champ.FreeToPlay)
                        championImage.FreeToPlayLabel.Visibility = Visibility.Visible;
                    championImage.Width = 64;
                    championImage.Height = 64;
                    item.Tag = champ.ChampionId;
                    item.Content = championImage.Content;
                    ChampionSelectListView.Items.Add(item);
                }
            }

            ChampSelect_OnMessageReceived(this, latestDTO);
            Client.PVPNet.OnMessageReceived += ChampSelect_OnMessageReceived;
        }
コード例 #29
0
        private void ServerThread(object data)
        {
            var pipeServer = new NamedPipeServerStream("LegendaryClientPipe@191537514598135486vneaoifJidafd", PipeDirection.InOut, NumThreads);
            pipeServer.WaitForConnection();
            Client.SendPIPE = new StreamString(pipeServer);
            Client.SendPIPE.WriteString("Logger started. All errors will be logged from now on");
            var assembly = Assembly.GetExecutingAssembly();
            var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
            var version = fvi.FileVersion;
            Client.SendPIPE.WriteString("LegendaryClient Version: " + version);

            Client.SendPIPE.WriteString("AwaitStart");


            var output = new NamedPipeClientStream(".",
                "LegendaryClientPipe@191537514598135486vneaoifJidafdOUTPUT",
                PipeDirection.InOut,
                PipeOptions.None,
                TokenImpersonationLevel.Impersonation);
            output.Connect();
            var ss = new StreamString(output);
            Client.InPIPE = ss;
            Started = true;
            while (Started)
            {
                var x = ss.ReadString();
                if (x.Contains("SendOVERLAY"))
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input,
                        new ThreadStart(() =>
                        {
                            var mmm = x.Split('|');
                            var messageOver = new MessageOverlay {MessageTitle = {Content = mmm[1]}, MessageTextBox = {Text = mmm[2]}};
                            if (!x.ToLower().Contains("fullover"))
                            {
                                Client.OverlayContainer.Content = messageOver.Content;
                                Client.OverlayContainer.Visibility = Visibility.Visible;
                            }
                            else
                            {
                                Client.FullNotificationOverlayContainer.Content = messageOver.Content;
                                Client.FullNotificationOverlayContainer.Visibility = Visibility.Visible;
                            }
                            Client.SendPIPE.WriteString("Overlay received!");
                        }));
                }
                else if (x == "Server_STOPPED")
                {
                    Started = false;
                }
            }
        }
コード例 #30
0
        private async void StartChampSelect()
        {
            //Force client to popup once in champion select
            Client.FocusClient();
            //Get champions and sort alphabetically

            CanLockIn = false;
            ChampList = new List<ChampionDTO>(Client.PlayerChampions);
            ChampList.Sort(
                (x, y) =>
                    string.Compare(champions.GetChampion(x.ChampionId)
                        .displayName, champions.GetChampion(y.ChampionId).displayName, StringComparison.Ordinal));
            if (Client.LoginPacket.ClientSystemStates.freeToPlayChampionsForNewPlayersMaxLevel >=
                Client.LoginPacket.AllSummonerData.SummonerLevel.Level)
                foreach (var item in ChampList)
                {
                    if (Client.LoginPacket.ClientSystemStates.freeToPlayChampionIdList.Contains(item.ChampionId))
                        item.FreeToPlay = true;
                    else
                        item.FreeToPlay = false;
                }

            //Retrieve masteries and runes
            MyMasteries = Client.LoginPacket.AllSummonerData.MasteryBook;
            MyRunes = Client.LoginPacket.AllSummonerData.SpellBook;

            //Put masteries & runes into combo boxes
            int i = 0;
            foreach (MasteryBookPageDTO masteryPage in MyMasteries.BookPages)
            {
                string masteryPageName = masteryPage.Name;
                //Stop garbage mastery names
                if (masteryPageName.StartsWith("@@"))
                    masteryPageName = "Mastery Page " + ++i;

                MasteryComboBox.Items.Add(masteryPageName);
                if (masteryPage.Current)
                    MasteryComboBox.SelectedValue = masteryPageName;
            }
            i = 0;
            foreach (SpellBookPageDTO runePage in MyRunes.BookPages)
            {
                string runePageName = runePage.Name;
                //Stop garbage rune names
                if (runePageName.StartsWith("@@"))
                    runePageName = "Rune Page " + ++i;

                RuneComboBox.Items.Add(runePageName);
                if (runePage.Current)
                    RuneComboBox.SelectedValue = runePageName;
            }
            //Allow runes & masteries to be changed
            QuickLoad = true;

            //Signal to the server we are in champion select
            await RiotCalls.SetClientReceivedGameMessage(Client.GameID, "CHAMP_SELECT_CLIENT");
            GameDTO latestDto =
                await
                    RiotCalls.GetLatestGameTimerState(Client.GameID, Client.ChampSelectDTO.GameState,
                        Client.ChampSelectDTO.PickTurn);
            //Find the game config for timers
            configType = Client.LoginPacket.GameTypeConfigs.Find(x => x.Id == latestDto.GameTypeConfigId);
            if (configType == null) //Invalid config... abort!
            {
                QuitCurrentGame();

                var overlay = new MessageOverlay
                {
                    MessageTextBox =
                    {
                        Text = "Invalid Config ID (" + latestDto.GameTypeConfigId +
                               "). Report to Eddy5641 [https://github.com/Eddy5641/LegendaryClient/issues/new]"
                    },
                    MessageTitle = { Content = "Invalid Config" }
                };
                Client.OverlayContainer.Content = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
            }
            else
            {
                counter = configType.MainPickTimerDuration - 5;
                //Seems to be a 5 second inconsistancy with riot and what they actually provide
                CountdownTimer = new Timer();
                CountdownTimer.Tick += CountdownTimer_Tick;
                CountdownTimer.Interval = 1000; // 1 second
                CountdownTimer.Start();

                LatestDto = latestDto;
                //Get the champions for the other team to ban & sort alpabetically
                if (latestDto.GameState.ToUpper() == "PRE_CHAMP_SELECT")
                {
                    ChampionBanInfoDTO[] champsForBan = await RiotCalls.GetChampionsForBan();
                    ChampionsForBan = new List<ChampionBanInfoDTO>(champsForBan);
                    ChampionsForBan.Sort(
                        (x, y) =>
                            string.Compare(champions.GetChampion(x.ChampionId)
                                .displayName, champions.GetChampion(y.ChampionId).displayName, StringComparison.Ordinal));
                }


                //Render our champions
                RenderChamps(false);

                //Start recieving champ select
                Select_OnMessageReceived(this, latestDto);
                //Client.OnFixChampSelect += ChampSelect_OnMessageReceived;
                Client.RiotConnection.MessageReceived += ChampSelect_OnMessageReceived;
            }
        }
コード例 #31
0
        private async void Download_Click(object sender, RoutedEventArgs e)
        {
            if (User)
            {
                PublicSummoner summoner = await RiotCalls.GetSummonerByName(Command.Text);
                if (string.IsNullOrWhiteSpace(summoner.Name))
                {
                    var overlay = new MessageOverlay
                    {
                        MessageTitle = { Content = "No Summoner Found" },
                        MessageTextBox = { Text = "The summoner \"" + Command.Text + "\" does not exist." }
                    };
                    Client.OverlayContainer.Content = overlay.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;

                    return;
                }
                HintLabel.Content = "retrieving replay";
                HintLabel.Visibility = Visibility.Visible;
                var fadeLabelInAnimationx = new DoubleAnimation(1, TimeSpan.FromSeconds(0.1));
                HintLabel.BeginAnimation(OpacityProperty, fadeLabelInAnimationx);
                PlatformGameLifecycleDTO n = await RiotCalls.RetrieveInProgressSpectatorGameInfo(Command.Text);
                if (n == null)
                {
                    var overlay = new MessageOverlay
                    {
                        MessageTitle = { Content = "No Game Found" },
                        MessageTextBox = { Text = "The summoner \"" + Command.Text + "\" is not currently in game." }
                    };
                    Client.OverlayContainer.Content = overlay.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;

                    return;
                }
                if (n.GameName != null)
                {
                    string ip = n.PlayerCredentials.ObserverServerIp + ":" + n.PlayerCredentials.ObserverServerPort;
                    string key = n.PlayerCredentials.ObserverEncryptionKey;
                    var gameId = (int)n.PlayerCredentials.GameId;
                    recorder = new ReplayRecorder(ip, gameId, Client.Region.InternalName, key);
                    recorder.OnReplayRecorded += recorder_OnReplayRecorded;
                    recorder.OnGotChunk += recorder_OnGotChunk;

                    var fadeGridOutAnimation = new DoubleAnimation(0, TimeSpan.FromSeconds(0.1));
                    Command.Visibility = Visibility.Hidden;
                    Download.Visibility = Visibility.Hidden;
                    HintLabel.Visibility = Visibility.Visible;
                    HintLabel.Content = "Starting replay download";
                }
                HintLabel.Content = "That player is not in a game";
                HintLabel.Visibility = Visibility.Visible;
            }
        }
コード例 #32
0
ファイル: Client.cs プロジェクト: ResQue1980/LegendaryClient
        //internal static Inviter CurrentInviter;

        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(new CustomGameLobbyPage());
                    Client.SwitchPage(new MainPage());
                }
                else if (message is EndOfGameStats)
                {
                    EndOfGameStats stats = message as EndOfGameStats;
                    EndOfGamePage EndOfGame = new EndOfGamePage(stats);
                    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;
                    Inviter Inviterstats = message as Inviter;
                    //TypedObject body = (TypedObject)to["body"];
                    MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        //Gameinvite stuff
                        GameInvitePopup pop = new GameInvitePopup(stats);
                        //await Invite.Callback;
                        //Invite.InvitationRequest(body);
                        pop.HorizontalAlignment = HorizontalAlignment.Right;
                        pop.VerticalAlignment = VerticalAlignment.Bottom;
                        pop.Height = 230;
                        Client.NotificationGrid.Children.Add(pop);
                        //Client.InviteJsonRequest = LegendaryClient.Logic.JSON.InvitationRequest.PopulateGameInviteJson();
                        //message.GetType() == typeof(GameInvitePopup)
                    }));
                }
            }));
        }
コード例 #33
0
        private void WatchReplayButton_Click(object sender, RoutedEventArgs e)
        {
            string directory = Client.Location;

            if (string.IsNullOrEmpty(directory))
            {
                MessageBoxResult result =
                    MessageBox.Show("You need to set your League of Legends installation location in settings.", "Error",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (File.Exists(Path.Combine(Client.ExecutingDirectory, "ReplayHandler.exe")))
            {
                var overlay = new MessageOverlay
                {
                    MessageTitle   = { Content = "No Replay Handler" },
                    MessageTextBox = { Text = "Replay service is experimental and can not be found" }
                };
                Client.OverlayContainer.Content    = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;

                return;
            }
            var replay = new ProcessStartInfo
            {
                FileName  = Path.Combine(Client.ExecutingDirectory, "ReplayHandler.exe"),
                Verb      = "runas",
                Arguments = selectedStats.Difficulty.Replace('-', ' ')
            };

            Process.Start(replay);

            //string Directory = Path.Combine(@"RADS/projects/lol_game_client/releases");

            var dInfo = new DirectoryInfo(directory);

            try
            {
                dInfo.GetDirectories();
            }
            catch
            {
                MessageBoxResult result = MessageBox.Show("Could not find League of Legends", "Error",
                                                          MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            directory = Path.Combine(Client.Location);

            if (!File.Exists(Path.Combine(directory, "League of Legends.exe")))
            {
                MessageBox.Show("Could not find League of Legends", "Error",
                                MessageBoxButton.OK, MessageBoxImage.Error);

                return;
            }

            var details = selectedStats.Difficulty.Split('-');

            Client.LaunchSpectatorGame("127.0.0.1:5651",
                                       File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "cabinet", selectedStats.Difficulty, "key")),
                                       Convert.ToInt32(details[0]), details[1]);
        }
コード例 #34
0
ファイル: Client.cs プロジェクト: Battler624/LegendaryClient
 internal static void OnMessageReceived(object sender, MessageReceivedEventArgs message)
 {
     MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async () =>
     {
         if (message.Body is StoreAccountBalanceNotification)
         {
             StoreAccountBalanceNotification newBalance = (StoreAccountBalanceNotification)message.Body;
             InfoLabel.Content = "IP: " + newBalance.Ip + " ∙ RP: " + newBalance.Rp;
             LoginPacket.IpBalance = newBalance.Ip;
             LoginPacket.RpBalance = newBalance.Rp;
         }
         else if (message.Body is GameNotification)
         {
             GameNotification notification = (GameNotification)message.Body;
             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;
                 case "PLAYER_QUIT":
                     string[] Name = await RiotCalls.GetSummonerNames(new double[1] { Convert.ToDouble((string)notification.MessageArgument) });
                     messageOver.MessageTitle.Content = "Player has left the queue";
                     messageOver.MessageTextBox.Text = Name[0] + " has left the queue";
                     break;
                 default:
                     messageOver.MessageTextBox.Text = notification.MessageCode + Environment.NewLine;
                     messageOver.MessageTextBox.Text += Convert.ToString(notification.MessageArgument);
                     break;
             }
             OverlayContainer.Content = messageOver.Content;
             OverlayContainer.Visibility = Visibility.Visible;
             QuitCurrentGame();
         }
         else if (message.Body is EndOfGameStats)
         {
             EndOfGameStats stats = message.Body as EndOfGameStats;
             EndOfGamePage EndOfGame = new EndOfGamePage(stats);
             OverlayContainer.Visibility = Visibility.Visible;
             OverlayContainer.Content = EndOfGame.Content;
         }
         else if (message.Body is StoreFulfillmentNotification)
         {
             PlayerChampions = await RiotCalls.GetAvailableChampions();
         }
         else if (message.Body is GameDTO)
         {
             GameDTO Queue = message.Body as GameDTO;
             if (!IsInGame && Queue.GameState != "TERMINATED" && Queue.GameState != "TERMINATED_IN_ERROR")
             {
                 MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                 {
                     Client.OverlayContainer.Content = new QueuePopOverlay(Queue).Content;
                     Client.OverlayContainer.Visibility = Visibility.Visible;
                 }));
             }
         }
         else if (message.Body is SearchingForMatchNotification)
         {
             SearchingForMatchNotification Notification = message.Body as SearchingForMatchNotification;
             if (Notification.PlayerJoinFailures != null && Notification.PlayerJoinFailures.Count > 0)
             {
                 MessageOverlay messageOver = new MessageOverlay();
                 messageOver.MessageTitle.Content = "Could not join the queue";
                 foreach (QueueDodger x in Notification.PlayerJoinFailures)
                 {
                     messageOver.MessageTextBox.Text += x.Summoner.Name + " is unable to join the queue as they recently dodged a game." + Environment.NewLine;
                     TimeSpan time = TimeSpan.FromMilliseconds(x.PenaltyRemainingTime);
                     messageOver.MessageTextBox.Text += "You have " + string.Format("{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) + " remaining until you may queue again";
                 }
                 OverlayContainer.Content = messageOver.Content;
                 OverlayContainer.Visibility = Visibility.Visible;
             }
         }
     }));
 }
コード例 #35
0
        public LoginPage()
        {
            InitializeComponent();
            Client.donepatch = true;
            Client.patching = false;
            Version.TextChanged += WaterTextbox_TextChanged;
            bool x = Settings.Default.DarkTheme;
            if (!x)
            {
                var bc = new BrushConverter();
                HideGrid.Background = (Brush)bc.ConvertFrom("#B24F4F4F");
                LoggingInProgressRing.Foreground = (Brush)bc.ConvertFrom("#FFFFFFFF");
            }
            //#B2C8C8C8
            UpdateRegionComboBox.SelectedValue = Client.UpdateRegion;
            switch (Client.UpdateRegion)
            {
                case "PBE":
                    RegionComboBox.ItemsSource = new[] { "PBE" };
                    LoginUsernameBox.Visibility = Visibility.Visible;
                    RememberUsernameCheckbox.Visibility = Visibility.Visible;
                    break;

                case "Live":
                    RegionComboBox.ItemsSource = new[] { "BR", "EUNE", "EUW", "NA", "OCE", "RU", "LAS", "LAN", "TR", "CS" };
                    LoginUsernameBox.Visibility = Visibility.Visible;
                    RememberUsernameCheckbox.Visibility = Visibility.Visible;
                    break;

                case "Korea":
                    RegionComboBox.ItemsSource = new[] { "KR" };
                    LoginUsernameBox.Visibility = Visibility.Visible;
                    RememberUsernameCheckbox.Visibility = Visibility.Visible;
                    LoginPasswordBox.Visibility = Visibility.Visible;
                    break;

                case "Garena":
                    RegionComboBox.ItemsSource = new[] { "PH", "SG", "SGMY", "TH", "TW", "VN", "ID" };
                    LoginUsernameBox.Visibility = Visibility.Hidden;
                    RememberUsernameCheckbox.Visibility = Visibility.Hidden;
                    LoginPasswordBox.Visibility = Visibility.Hidden;
                    if (!string.IsNullOrEmpty(Settings.Default.DefaultGarenaRegion))
                        RegionComboBox.SelectedValue = Settings.Default.DefaultGarenaRegion;  // Default Garena Region
                    break;
            }

            string themeLocation = Path.Combine(Client.ExecutingDirectory, "assets", "themes", Client.Theme);
            if (!Settings.Default.DisableLoginMusic)
            {
                string[] music;
                string soundpath = Path.Combine(Client.ExecutingDirectory, "Assets", "sounds", "sound_o_heaven.ogg");
                if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1)
                {
                    if (!File.Exists(soundpath))
                    {
                        using (WebClient wc = new WebClient())
                        {
                            wc.DownloadFile("http://images.wikia.com/leagueoflegends/images/1/10/Teemo.laugh3.ogg", soundpath);
                        }
                    }
                    music = new[] { soundpath };
                }
                else
                {
                    music = Directory.GetFiles(themeLocation, "*.mp3");
                }
                SoundPlayer.Source = new System.Uri(Path.Combine(themeLocation, music[0]));
                SoundPlayer.Play();
                Sound.IsChecked = false;
            }
            else Sound.IsChecked = true;

            if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1)
            {
                string SkinPath = Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
                    "Teemo_Splash_" + new Random().Next(0, 8) + ".jpg");
                if (File.Exists(SkinPath))
                {
                    LoginImage.Source = new BitmapImage(new System.Uri(SkinPath, UriKind.Absolute));
                }
            }
            else if (Settings.Default.LoginPageImage == "")
            {
                string[] videos = Directory.GetFiles(themeLocation, "*.mp4");
                if (videos.Length > 0 && File.Exists(videos[0]))
                    LoginPic.Source = new System.Uri(videos[0]);
                LoginPic.LoadedBehavior = MediaState.Manual;
                LoginPic.MediaEnded += LoginPic_MediaEnded;
                SoundPlayer.MediaEnded += SoundPlayer_MediaEnded;
                LoginPic.Play();
            }
            else
            {
                if (
                    File.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
                        Settings.Default.LoginPageImage.Replace("\r\n", ""))))
                    LoginImage.Source =
                        new BitmapImage(
                            new System.Uri(
                                Path.Combine(Client.ExecutingDirectory, "Assets", "champions",
                                    Settings.Default.LoginPageImage), UriKind.Absolute));
            }

            Video.IsChecked = false;

            //Get client data after patcher completed

            Client.SQLiteDatabase = new SQLiteConnection(Path.Combine(Client.ExecutingDirectory, Client.sqlite));

            // Check database error
            try
            {
                Client.Champions = (from s in Client.SQLiteDatabase.Table<champions>()
                                    orderby s.name
                                    select s).ToList();

                //* to remove just remove one slash from the comment
                //Pls bard the tard for april fools
                Client.Champions.Find(bard => bard.name == "Bard").displayName = "Tard";
                //*/
            }
            catch (Exception e) // Database broken?
            {
                Client.Log("Database is broken : \r\n" + e.Message + "\r\n" + e.Source);
                var overlay = new MessageOverlay
                {
                    MessageTextBox = { Text = "Database is broken. Click OK to exit LegendaryClient." },
                    MessageTitle = { Content = "Database Error" }
                };
                Client.SQLiteDatabase.Close();
                File.Delete(Path.Combine(Client.ExecutingDirectory, Client.sqlite));
                overlay.AcceptButton.Click += (o, i) => { Environment.Exit(0); };
                Client.OverlayContainer.Content = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
                return;
            }

            var FreeToPlay = FreeToPlayChampions.GetInstance();

            foreach (champions c in Client.Champions)
            {
                var source = new System.Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "champions", c.iconPath),
                    UriKind.Absolute);
                c.icon = new BitmapImage(source);

                if (FreeToPlay != null)
                {
                    c.IsFreeToPlay = FreeToPlay.IsFreeToPlay(c);
                }
                Champions.InsertExtraChampData(c);
            }

            Client.ChampionSkins = (from s in Client.SQLiteDatabase.Table<championSkins>()
                                    orderby s.name
                                    select s).ToList();
            Client.ChampionAbilities = (from s in Client.SQLiteDatabase.Table<championAbilities>()
                                        orderby s.name
                                        select s).ToList();

            Client.SQLiteDatabase.Close();
            Client.Items = Items.PopulateItems();
            Client.Masteries = Masteries.PopulateMasteries();
            Client.Runes = Runes.PopulateRunes();
            if (Client.UpdateRegion != "Garena")
            {
                var reader = new SWFReader(Path.Combine(Client.ExecutingDirectory, "ClientLibCommon.dat"));
                foreach (var tag in reader.Tags)
                {
                    if (!(tag is DoABC))
                        continue;

                    var abcTag = (DoABC) tag;

                    if (!abcTag.Name.Contains("riotgames/platform/gameclient/application/Version"))
                        continue;

                    var str = Encoding.Default.GetString(abcTag.ABCData);
                    var firstSplit = str.Split((char) 6);
                    var secondSplit = firstSplit[0].Split((char) 18);

                    if (secondSplit.Count() > 1)
                    {
                        Client.Version = secondSplit[1];
                    }
                    else
                    {
                        var thirdSplit = secondSplit[0].Split((char)19);
                        Client.Version = thirdSplit[1];
                    }
                }
            }

            Version.Text = Client.Version;

            if (!string.IsNullOrWhiteSpace(Settings.Default.SavedUsername))
            {
                RememberUsernameCheckbox.IsChecked = true;
                LoginUsernameBox.Text = Settings.Default.SavedUsername;
            }
            if (!string.IsNullOrWhiteSpace(Settings.Default.SavedPassword))
            {
                SHA1 sha = new SHA1CryptoServiceProvider();
                RememberPasswordCheckbox.IsChecked = true;
                LoginPasswordBox.Password =
                    Settings.Default.SavedPassword.DecryptStringAES(
                        sha.ComputeHash(Encoding.UTF8.GetBytes(Settings.Default.Guid)).ToString());
            }
            if (!string.IsNullOrWhiteSpace(Settings.Default.Region))
                RegionComboBox.SelectedValue = Settings.Default.Region;

            invisibleLoginCheckBox.IsChecked = Settings.Default.incognitoLogin;
        }
コード例 #36
0
        public async void GetSummonerProfile(string s)
        {
            PublicSummoner summoner =
                await
                    RiotCalls.GetSummonerByName(string.IsNullOrWhiteSpace(s)
                        ? Client.LoginPacket.AllSummonerData.Summoner.Name
                        : s);
            if (string.IsNullOrWhiteSpace(summoner.Name))
            {
                var overlay = new MessageOverlay
                {
                    MessageTitle = { Content = "No Summoner Found" },
                    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 = Visibility.Collapsed;
                TeamsHeader.Visibility = Visibility.Collapsed;
            }
            else
            {
                GotLeaguesForPlayer(await RiotCalls.GetAllLeaguesForPlayer(summoner.SummonerId));
                PlayerDTO playerTeams = await RiotCalls.FindPlayer(summoner.SummonerId);
                GotPlayerTeams(playerTeams);
            }


            int profileIconId = summoner.ProfileIconId;
            string UriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", profileIconId + ".png");
            ProfileImage.Source = Client.GetImage(UriSource);

            PlatformGameLifecycleDTO n = await RiotCalls.RetrieveInProgressSpectatorGameInfo(s);
            if (n != null && n.GameName != null)
            {
                InGameHeader.Visibility = Visibility.Visible;
                InGameHeader.IsSelected = true;

                var ingame = InGameContainer.Content as Ingame;
                if (ingame != null)
                    ingame.Update(n, summoner.Name);
            }
            else
            {
                InGameHeader.Visibility = Visibility.Collapsed;
                OverviewHeader.IsSelected = true;
            }

            if (summoner.Name == Client.LoginPacket.AllSummonerData.Summoner.Name)
            {
                ChampionsTab.Visibility = Visibility.Visible;
                SkinsTab.Visibility = Visibility.Visible;

                MatchHistoryBetaTab.Margin = new Thickness(0, 0, 0, 0);
            }
            else
            {
                ChampionsTab.Visibility = Visibility.Hidden;
                SkinsTab.Visibility = Visibility.Hidden;
                MatchHistoryBetaTab.Margin = new Thickness(-211, 0, 211, 0);
            }

            var historyBeta = LeagueMatchHistoryBetaContainer.Content as MatchHistoryOnline;
            if (historyBeta != null)
                historyBeta.Update(summoner.AcctId);

            var history = MatchHistoryContainer.Content as MatchHistory;
            if (history != null)
                await history.Update(summoner.AcctId);

            var overview = OverviewContainer.Content as Overview;
            if (overview != null)
                overview.Update(summoner.SummonerId, summoner.AcctId);

            //RiotCalls.Call(Guid.NewGuid().ToString(), "championMastery", "getAllChampionMasteries", "[" + summoner.SummonerId + "]");
        }
コード例 #37
0
        private async void StartChampSelect()
        {
            //Force client to popup once in champion select
            Client.FocusClient();
            Client.IsInGame = true;
            //Get champions and sort alphabetically



            ChampList = new List <ChampionDTO>(Client.PlayerChampions);
            ChampList.Sort((x, y) => champions.GetChampion(x.ChampionId).displayName.CompareTo(champions.GetChampion(y.ChampionId).displayName));



            //Retrieve masteries and runes
            MyMasteries = Client.LoginPacket.AllSummonerData.MasteryBook;
            MyRunes     = Client.LoginPacket.AllSummonerData.SpellBook;

            //Put masteries & runes into combo boxes
            int i = 0;

            foreach (MasteryBookPageDTO MasteryPage in MyMasteries.BookPages)
            {
                string MasteryPageName = MasteryPage.Name;
                //Stop garbage mastery names
                if (MasteryPageName.StartsWith("@@"))
                {
                    MasteryPageName = "Mastery Page " + ++i;
                }
                MasteryComboBox.Items.Add(MasteryPageName);
                if (MasteryPage.Current)
                {
                    MasteryComboBox.SelectedValue = MasteryPageName;
                }
            }
            i = 0;
            foreach (SpellBookPageDTO RunePage in MyRunes.BookPages)
            {
                string RunePageName = RunePage.Name;
                //Stop garbage rune names
                if (RunePageName.StartsWith("@@"))
                {
                    RunePageName = "Rune Page " + ++i;
                }
                RuneComboBox.Items.Add(RunePageName);
                if (RunePage.Current)
                {
                    RuneComboBox.SelectedValue = RunePageName;
                }
            }
            //Allow runes & masteries to be changed
            QuickLoad = true;

            //Signal to the server we are in champion select
            await Client.PVPNet.SetClientReceivedGameMessage(Client.GameID, "CHAMP_SELECT_CLIENT");

            //Retrieve the latest GameDTO
            GameDTO latestDTO = await Client.PVPNet.GetLatestGameTimerState(Client.GameID, Client.ChampSelectDTO.GameState, Client.ChampSelectDTO.PickTurn);

            //Find the game config for timers
            configType = Client.LoginPacket.GameTypeConfigs.Find(x => x.Id == latestDTO.GameTypeConfigId);
            if (configType == null) //Invalid config... abort!
            {
                QuitCurrentGame();

                MessageOverlay overlay = new MessageOverlay();
                overlay.MessageTextBox.Text        = "Invalid Config ID (" + latestDTO.GameTypeConfigId.ToString() + "). Report to Eddy5641 [https://github.com/Eddy5641/LegendaryClient/issues/new]";
                overlay.MessageTitle.Content       = "Invalid Config";
                Client.OverlayContainer.Content    = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
            }
            counter                 = configType.MainPickTimerDuration - 5; //Seems to be a 5 second inconsistancy with riot and what they actually provide
            CountdownTimer          = new System.Windows.Forms.Timer();
            CountdownTimer.Tick    += new EventHandler(CountdownTimer_Tick);
            CountdownTimer.Interval = 1000; // 1 second
            CountdownTimer.Start();

            LatestDto = latestDTO;
            //Get the champions for the other team to ban & sort alpabetically
            ChampionBanInfoDTO[] ChampsForBan = await Client.PVPNet.GetChampionsForBan();

            ChampionsForBan = new List <ChampionBanInfoDTO>(ChampsForBan);
            ChampionsForBan.Sort((x, y) => champions.GetChampion(x.ChampionId).displayName.CompareTo(champions.GetChampion(y.ChampionId).displayName));

            //Join champion select chatroom
            string JID = Client.GetChatroomJID(latestDTO.RoomName.Replace("@sec", ""), latestDTO.RoomPassword, false);

            Chatroom                    = Client.ConfManager.GetRoom(new jabber.JID(JID));
            Chatroom.Nickname           = Client.LoginPacket.AllSummonerData.Summoner.Name;
            Chatroom.OnRoomMessage     += Chatroom_OnRoomMessage;
            Chatroom.OnParticipantJoin += Chatroom_OnParticipantJoin;
            Chatroom.Join(latestDTO.RoomPassword);

            //Render our champions
            RenderChamps(false);

            //Start recieving champ select
            ChampSelect_OnMessageReceived(this, latestDTO);
            Client.OnFixChampSelect         += ChampSelect_OnMessageReceived;
            Client.PVPNet.OnMessageReceived += ChampSelect_OnMessageReceived;
        }
コード例 #38
0
        private void StartPatcher()
        {
            bgThread = new Thread(() =>
            {
                LogTextBox("Starting Patcher");
<<<<<<< HEAD
                Client.Log("Patcher Starting");
=======
>>>>>>> master

                WebClient client = new WebClient();
                client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
                client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadDDragon);
                client.DownloadProgressChanged += (o, e) =>
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        double bytesIn = double.Parse(e.BytesReceived.ToString());
                        double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
                        double percentage = bytesIn / totalBytes * 100;
                        CurrentProgressLabel.Content = "Downloaded " + e.BytesReceived + " of " + e.TotalBytesToReceive;
                        CurrentProgressBar.Value = int.Parse(Math.Truncate(percentage).ToString());
                    }));
                };

                #region LegendaryClient

                string CurrentMD5 = GetMd5();
                LogTextBox("MD5: " + CurrentMD5);
                Client.Log("[DEBUG]: MD5:" + CurrentMD5);
                string VersionString = "";
                try
                {
                    VersionString = client.DownloadString(new Uri("http://legendaryclient.com/update.html"));
                }
                catch
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Could not retrieve update files!";
<<<<<<< HEAD
                        Client.Log("[Warn]: Failed to retrieve update files");
=======
                        Client.Log("Couldn't get update files for LegendaryClient");
>>>>>>> master
                    }));

                    //return;
                }

                string[] VersionSplit = VersionString.Split('|');

                LogTextBox("Update data: " + VersionSplit[0] + "|" + VersionSplit[1]);
<<<<<<< HEAD
                Client.updateData = LegendaryUpdate.PopulateItems();
=======
                Client.Log("Update data: " + VersionSplit[0] + "|" + VersionSplit[1]);
>>>>>>> master

                #if !DEBUG //Dont patch client while in DEBUG
                UpdateData legendaryupdatedata = new UpdateData();
                var version = new WebClient().DownloadString("http://eddy5641.github.io/LegendaryClient/Version");
                LogTextBox("Most Up to date LegendaryClient Version: " + version);
                string versionAsString = version;
                var versiontoint = new WebClient().DownloadString("http://eddy5641.github.io/LegendaryClient/VersionAsInt");
                int VersionAsInt = Convert.ToInt32(versiontoint);

                if (VersionAsInt != Client.LegendaryClientReleaseNumber)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        MessageOverlay overlay = new MessageOverlay();
                        overlay.MessageTextBox.Text = "An update is available LegendaryClient";
                        overlay.MessageTitle.Content = "Update Notification";
                        overlay.AcceptButton.Content = "Update LegendaryClient";
                        overlay.MessageTextBox.TextChanged += Text_Changed;
                        Client.OverlayContainer.Content = overlay.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;

                        CurrentProgressLabel.Content = "LegendaryClient Is Out of Date!";
                        
                    }));
                    LogTextBox("LegendaryClient Is Out of Date!");

                    return;
                }
<<<<<<< HEAD
                else if (Client.LegendaryClientVersion == version)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "LegendaryClient Is Up To Date!";
                        
                    }));
                    LogTextBox("LegendaryClient Is Up To Date!");
                }
                else if (version == null)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Could not check LegendaryClient Version!";
                        
                    }));
                    LogTextBox("Could not check LegendaryClient Version!");
                    return;
                }
                //LogTextBox("LC Update Json Data: " + json);
                #endif

                //LogTextBox("LegendaryClient is up to date");
                //LogTextBox("LegendaryClient does not have a patcher downloader. Do not be worried by this.");
                
                //Client.Log("[Debug]: LegendaryClient Is Up To Date");
=======
#endif
                LogTextBox("LegendaryClient is up to date");
                Client.Log("LC Patched");
>>>>>>> master

                #endregion LegendaryClient

                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    TotalProgressLabel.Content = "20%";
                    TotalProgessBar.Value = 20;
                }));

                #region DDragon

                System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
                if (!Directory.Exists("Assets"))
                {
                    Directory.CreateDirectory("Assets");
                }
                if (!File.Exists(Path.Combine("Assets", "VERSION_DDRagon")))
                {
                    var VersionLOL = File.Create(Path.Combine("Assets", "VERSION_DDRagon"));
                    VersionLOL.Write(encoding.GetBytes("0.0.0"), 0, encoding.GetBytes("0.0.0").Length);
                    VersionLOL.Close();
                }

                RiotPatcher patcher = new RiotPatcher();
                string DDragonDownloadURL = patcher.GetDragon();
                if (!DDragonDownloadURL.StartsWith("http:"))
                    DDragonDownloadURL = "http:" + DDragonDownloadURL;
                LogTextBox("DataDragon Version: " + patcher.DDragonVersion);
                Client.Version = patcher.DDragonVersion;
                string DDragonVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_DDragon"));
                LogTextBox("Current DataDragon Version: " + DDragonVersion);
                Client.Log("DD: " + patcher.DDragonVersion + "|" + DDragonVersion);

                Client.Version = DDragonVersion;
                Client.Log("[Debug]: DDragon Version (LOL Version) = " + DDragonVersion);

                 LogTextBox("Client Version: " + Client.Version);

                if (patcher.DDragonVersion != DDragonVersion)
                {
                    if (!Directory.Exists(Path.Combine("Assets", "temp")))
                    {
                        Directory.CreateDirectory(Path.Combine("Assets", "temp"));
                    }

                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Downloading DataDragon";
                    }));

                    client.DownloadFile(DDragonDownloadURL, Path.Combine("Assets", "dragontail-" + patcher.DDragonVersion + ".tgz"));

                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Extracting DataDragon";
                    }));

                    Stream inStream = File.OpenRead(Path.Combine("Assets", "dragontail-" + patcher.DDragonVersion + ".tgz"));
                    
                    using (GZipInputStream gzipStream = new GZipInputStream(inStream))
                    {
                        TarArchive tarArchive = TarArchive.CreateInputTarArchive(gzipStream);
                        tarArchive.ExtractContents(Path.Combine("Assets", "temp"));
                        tarArchive.CloseArchive();
                    }
                    inStream.Close();

                    Copy(Path.Combine("Assets", "temp", patcher.DDragonVersion, "data"), Path.Combine("Assets", "data"));
                    Copy(Path.Combine("Assets", "temp", patcher.DDragonVersion, "img"), Path.Combine("Assets"));
                    Directory.Delete(Path.Combine("Assets", "temp"), true);

                    var VersionDDragon = File.Create(Path.Combine("Assets", "VERSION_DDRagon"));
                    VersionDDragon.Write(encoding.GetBytes(patcher.DDragonVersion), 0, encoding.GetBytes(patcher.DDragonVersion).Length);
<<<<<<< HEAD

                    Client.Version = DDragonVersion;
=======
>>>>>>> master
                    VersionDDragon.Close();
                }

                #endregion DDragon

                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    TotalProgressLabel.Content = "40%";
                    TotalProgessBar.Value = 40;
                }));

                #region lol_air_client

                if (!File.Exists(Path.Combine("Assets", "VERSION_AIR")))
                {
                    var VersionAIR = File.Create(Path.Combine("Assets", "VERSION_AIR"));
                    VersionAIR.Write(encoding.GetBytes("0.0.0.0"), 0, encoding.GetBytes("0.0.0.0").Length);
                    VersionAIR.Close();
                }

                string LatestAIR = patcher.GetLatestAir();
                LogTextBox("Air Assets Version: " + LatestAIR);
                string AirVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_AIR"));
                LogTextBox("Current Air Assets Version: " + AirVersion);
                bool RetrieveCurrentInstallation = false;
                string AirLocation = "";
                Client.Log("AIR: " + LatestAIR + "|" + AirVersion);

                if (AirVersion == "0.0.0.0")
                {
                    LogTextBox("Checking for existing League of Legends Installation");
                    AirLocation = Path.Combine("League of Legends", "RADS", "projects", "lol_air_client", "releases");
                    if (Directory.Exists(AirLocation))
                    {
                        RetrieveCurrentInstallation = true;
                    }
                    else if (Directory.Exists(Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", AirLocation)))
                    {
                        RetrieveCurrentInstallation = true;
                        AirLocation = Path.Combine(System.IO.Path.GetPathRoot(Environment.SystemDirectory), "Riot Games", AirLocation);
                    }
                    else
                    {
                        LogTextBox("Unable to find existing League of Legends. Copy your League of Legends folder into + "
                            + Client.ExecutingDirectory
                            + " to make the patching process quicker");
                    }

                    if (RetrieveCurrentInstallation)
                    {
                        Client.Log("Got previous installation: " + AirLocation);
                        LogTextBox("Getting Air Assets from " + AirLocation);
                        Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                        {
                            CurrentProgressLabel.Content = "Copying Air Assets";
                        }));
                        AirVersion = patcher.GetCurrentAirInstall(AirLocation);
                        LogTextBox("Retrieved currently installed Air Assets");
                        LogTextBox("Current Air Assets Version: " + AirVersion);
                    }
                }

                if (AirVersion != LatestAIR)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Retrieving Air Assets";
                    }));
                }

                #endregion lol_air_client

                #region lol_game_client

                if (!Directory.Exists("RADS"))
                {
                    Directory.CreateDirectory("RADS");
                }

                if (!File.Exists(Path.Combine("RADS", "VERSION_LOL")))
                {
                    var VersionGAME = File.Create(Path.Combine("RADS", "VERSION_LOL"));
                    VersionGAME.Write(encoding.GetBytes("0.0.0.0"), 0, encoding.GetBytes("0.0.0.0").Length);
                    VersionGAME.Close();
                }

                string LatestGame = patcher.GetLatestGame();
                LogTextBox("League Of Legends Version: " + LatestGame);
                string GameVersion = File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "RADS", "VERSION_LOL"));
                LogTextBox("Current League of Legends Version: " + GameVersion);
                RetrieveCurrentInstallation = false;
                string GameLocation = "";

                if (GameVersion == "0.0.0.0")
                {
                    LogTextBox("Checking for existing League of Legends Installation");
                    GameLocation = Path.Combine("League of Legends", "RADS");
                    string rootPath = Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\Riot Games\League Of Legends", "Path", "").ToString();
                    if (Directory.Exists(GameLocation))
                    {
                        RetrieveCurrentInstallation = true;
                    }
                    else if (Directory.Exists(Path.Combine(rootPath, "RADS")))
                    {
                        RetrieveCurrentInstallation = true;
                        GameLocation = Path.Combine(rootPath, "RADS");
                    }
                    else
                    {
                        LogTextBox("Unable to find existing League of Legends. Copy your League of Legends folder into + "
                            + Client.ExecutingDirectory
                            + " to make the patching process quicker");
                    }

                    if (RetrieveCurrentInstallation)
                    {
                        LogTextBox("Getting League Of Legends from " + GameLocation);
                        Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                        {
                            CurrentProgressLabel.Content = "Copying League of Legends";
                        }));
                        GameVersion = patcher.GetCurrentGameInstall(GameLocation);
                        LogTextBox("Retrieved currently installed League of Legends");
                        LogTextBox("Current League of Legends Version: " + GameLocation);
                    }
                }

                if (GameVersion != LatestGame)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        CurrentProgressLabel.Content = "Retrieving League of Legends";
                    }));
                }

                #endregion lol_game_client

                FinishPatching();
            });
            bgThread.IsBackground = true;
            bgThread.Start();
        }
コード例 #39
0
        private async void Client_OnMessage(object sender, Message msg)
        {
            if (msg.Subject != null)
            {
                ChatSubjects subject = (ChatSubjects)Enum.Parse(typeof(ChatSubjects), msg.Subject, true);
                double[] Double = new double[1] { Convert.ToDouble(msg.From.User.Replace("sum", "")) };
                string[] Name = await RiotCalls.GetSummonerNames(Double);
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    InvitePlayer invitePlayer = null;
                    foreach (var x in Client.InviteListView.Items)
                    {
                        InvitePlayer tempInvPlayer = (InvitePlayer)x;
                        if ((string)tempInvPlayer.PlayerLabel.Content == Name[0])
                        {
                            invitePlayer = x as InvitePlayer;
                            break;
                        }
                    }

                    if (subject == ChatSubjects.GAME_INVITE_ACCEPT)
                    {
                        if (invitePlayer != null)
                            invitePlayer.StatusLabel.Content = "Accepted";
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_REJECT)
                    {
                        if (invitePlayer != null)
                            invitePlayer.StatusLabel.Content = "Rejected";
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_LIST_STATUS)
                    {
                        ParseCurrentInvitees(msg.Body);
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_ALLOW_SUGGESTIONS)
                    {
                        InviteButton.IsEnabled = true;
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_DISALLOW_SUGGESTIONS)
                    {
                        InviteButton.IsEnabled = false;
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_OWNER_CANCEL)
                    {
                        MessageOverlay messageOver = new MessageOverlay();
                        messageOver.MessageTitle.Content = "Party Cancelled";
                        messageOver.MessageTextBox.Text = "This party has been cancelled.";
                        newRoom.Leave("Party Cancelled");
                        Client.OverlayContainer.Content = messageOver.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                    else if (subject == ChatSubjects.GAME_INVITE_CANCEL)
                    {
                        MessageOverlay messageOver = new MessageOverlay();
                        messageOver.MessageTitle.Content = "Kicked";
                        messageOver.MessageTextBox.Text = "You have been kicked from the party.";
                        newRoom.Leave("Kicked");
                        Client.OverlayContainer.Content = messageOver.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                    else if (subject == ChatSubjects.VERIFY_INVITEE)
                    {
                        Client.Message(MessageData.From.User, MessageData.Body, ChatSubjects.VERIFY_INVITEE_ACK);
                    }
                }));
            }
        }
コード例 #40
0
 public void Text_Changed(object sender, RoutedEventArgs e)
 {
     MessageOverlay overlay = new MessageOverlay();
                 //overlay.AcceptButton.Click += update;
     if (overlay.MessageTextBox.Text == "NO")
     {
         overlay.AcceptButton.Click -= update;
         overlay.Visibility = Visibility.Hidden;
     }
 }
コード例 #41
0
 public void Text_Changed(object sender, RoutedEventArgs e)
 {
     MessageOverlay overlay = new MessageOverlay();
                 //overlay.AcceptButton.Click += update;
     if (overlay.MessageTextBox.Text != "NO")
     {
         overlay.AcceptButton.Click += update;
     }
 }
コード例 #42
0
        /// <summary>
        /// Initializes all data required for champion select. Also retrieves latest GameDTO
        /// </summary>
        private async void StartChampSelect()
        {
            //Force client to popup once in champion select
            Client.FocusClient();
            //Get champions and sort alphabetically
            ChampList = new List<ChampionDTO>(Client.PlayerChampions);
            ChampList.Sort((x, y) => champions.GetChampion(x.ChampionId).displayName.CompareTo(champions.GetChampion(y.ChampionId).displayName));
            //Retrieve masteries and runes
            MyMasteries = Client.LoginPacket.AllSummonerData.MasteryBook;
            MyRunes = Client.LoginPacket.AllSummonerData.SpellBook;

            //Put masteries & runes into combo boxes
            int i = 0;
            foreach (MasteryBookPageDTO MasteryPage in MyMasteries.BookPages)
            {
                string MasteryPageName = MasteryPage.Name;
                //Stop garbage mastery names
                if (MasteryPageName.StartsWith("@@")) 
                {
                    MasteryPageName = "Mastery Page " + ++i;
                }
                MasteryComboBox.Items.Add(MasteryPageName);
                if (MasteryPage.Current)
                    MasteryComboBox.SelectedValue = MasteryPageName;
            }
            i = 0;
            foreach (SpellBookPageDTO RunePage in MyRunes.BookPages)
            {
                string RunePageName = RunePage.Name;
                //Stop garbage rune names
                if (RunePageName.StartsWith("@@"))
                {
                    RunePageName = "Rune Page " + ++i;
                }
                RuneComboBox.Items.Add(RunePageName);
                if (RunePage.Current)
                    RuneComboBox.SelectedValue = RunePageName;
            }
            //Allow runes & masteries to be changed
            QuickLoad = true;

            //Signal to the server we are in champion select
            await Client.PVPNet.SetClientReceivedGameMessage(Client.GameID, "CHAMP_SELECT_CLIENT");
            //Retrieve the latest GameDTO
            GameDTO latestDTO = await Client.PVPNet.GetLatestGameTimerState(Client.GameID, Client.ChampSelectDTO.GameState, Client.ChampSelectDTO.PickTurn);
            //Find the game config for timers
            configType = Client.LoginPacket.GameTypeConfigs.Find(x => x.Id == latestDTO.GameTypeConfigId);
            if (configType == null) //Invalid config... abort!
            {
                Client.QuitCurrentGame();

                MessageOverlay overlay = new MessageOverlay();
                overlay.MessageTextBox.Text = "Invalid Config ID (" + latestDTO.GameTypeConfigId.ToString() + "). Report to Snowl [https://github.com/Snowl/LegendaryClient/issues/new]";
                overlay.MessageTitle.Content = "Invalid Config";
                Client.OverlayContainer.Content = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
                return;
            }
            counter = configType.MainPickTimerDuration - 5; //Seems to be a 5 second inconsistancy with riot and what they actually provide
            CountdownTimer = new System.Windows.Forms.Timer();
            CountdownTimer.Tick += new EventHandler(CountdownTimer_Tick);
            CountdownTimer.Interval = 1000; // 1 second
            CountdownTimer.Start();

            LatestDto = latestDTO;
            //Get the champions for the other team to ban & sort alpabetically
            ChampionBanInfoDTO[] ChampsForBan = await Client.PVPNet.GetChampionsForBan();
            ChampionsForBan = new List<ChampionBanInfoDTO>(ChampsForBan);
            ChampionsForBan.Sort((x, y) => champions.GetChampion(x.ChampionId).displayName.CompareTo(champions.GetChampion(y.ChampionId).displayName));

            //Join champion select chatroom
            string JID = Client.GetChatroomJID(latestDTO.RoomName.Replace("@sec", ""), latestDTO.RoomPassword, false);
            Chatroom = Client.ConfManager.GetRoom(new jabber.JID(JID));
            Chatroom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name;
            Chatroom.OnRoomMessage += Chatroom_OnRoomMessage;
            Chatroom.OnParticipantJoin += Chatroom_OnParticipantJoin;
            Chatroom.Join(latestDTO.RoomPassword);

            //Render our champions
            RenderChamps(false);

            //Start recieving champ select
            ChampSelect_OnMessageReceived(this, latestDTO);
            Client.OnFixChampSelect += ChampSelect_OnMessageReceived;
            Client.PVPNet.OnMessageReceived += ChampSelect_OnMessageReceived;
        }
コード例 #43
0
        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(new CustomGameLobbyPage());
                    Client.SwitchPage(new MainPage());
                }
                else if (message is EndOfGameStats)
                {
                    EndOfGameStats stats = message as EndOfGameStats;
                    EndOfGamePage EndOfGame = new EndOfGamePage(stats);
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                    Client.OverlayContainer.Content = EndOfGame.Content;
                }
                else if (message is StoreFulfillmentNotification)
                {
                    PlayerChampions = await PVPNet.GetAvailableChampions();
                }
            }));
        }
コード例 #44
0
        private void WatchReplayButton_Click(object sender, RoutedEventArgs e)
        {
            string directory = Client.Location;
            if (string.IsNullOrEmpty(directory))
            {
                MessageBoxResult result =
                    MessageBox.Show("You need to set your League of Legends installation location in settings.", "Error",
                        MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (File.Exists(Path.Combine(Client.ExecutingDirectory, "ReplayHandler.exe")))
            {
                var overlay = new MessageOverlay
                {
                    MessageTitle = { Content = "No Replay Handler" },
                    MessageTextBox = { Text = "Replay service is experimental and can not be found" }
                };
                Client.OverlayContainer.Content = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;

                return;
            }
            var replay = new ProcessStartInfo
            {
                FileName = Path.Combine(Client.ExecutingDirectory, "ReplayHandler.exe"),
                Verb = "runas",
                Arguments = selectedStats.Difficulty.Replace('-', ' ')
            };
            Process.Start(replay);

            //string Directory = Path.Combine(@"RADS/projects/lol_game_client/releases");

            var dInfo = new DirectoryInfo(directory);
            try
            {
                dInfo.GetDirectories();
            }
            catch
            {
                MessageBoxResult result = MessageBox.Show("Could not find League of Legends", "Error",
                    MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            directory = Path.Combine(Client.Location);

            if (!File.Exists(Path.Combine(directory, "League of Legends.exe")))
            {
                MessageBox.Show("Could not find League of Legends", "Error",
                    MessageBoxButton.OK, MessageBoxImage.Error);

                return;
            }

            var details = selectedStats.Difficulty.Split('-');
            Client.LaunchSpectatorGame("127.0.0.1:5651",
                File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "cabinet", selectedStats.Difficulty, "key")),
                Convert.ToInt32(details[0]), details[1]);
        }
コード例 #45
0
#pragma warning disable 4014 //Code does not need to be awaited
        async void Login()
        {
            BaseRegion selectedRegion = BaseRegion.GetRegion((string)RegionComboBox.SelectedValue);
            var authToken = await RiotCalls.GetRestToken(LoginUsernameBox.Text, LoginPasswordBox.Password, selectedRegion.LoginQueue);

            if (authToken == "invalid_credentials")
            {
                ErrorTextBox.Text = "Wrong login data";
                HideGrid.Visibility = Visibility.Visible;
                ErrorTextBox.Visibility = Visibility.Visible;
                LoggingInLabel.Visibility = Visibility.Hidden;
                LoggingInProgressRing.Visibility = Visibility.Collapsed;
                return;
            }
            Client.RiotConnection = new RtmpClient(new System.Uri("rtmps://" + selectedRegion.Server + ":2099"), RiotCalls.RegisterObjects(), ObjectEncoding.Amf3);
            Client.RiotConnection.CallbackException += client_CallbackException;
            Client.RiotConnection.MessageReceived += client_MessageReceived;
            try
            {

                await Client.RiotConnection.ConnectAsync();
            }
            catch
            {
                ErrorTextBox.Text = "Failed to login. SSL error.";
                HideGrid.Visibility = Visibility.Visible;
                ErrorTextBox.Visibility = Visibility.Visible;
                LoggingInLabel.Visibility = Visibility.Hidden;
                LoggingInProgressRing.Visibility = Visibility.Collapsed;
                return;
            }

            Client.RiotConnection.SetChunkSize(2147483647);
            AuthenticationCredentials newCredentials = new AuthenticationCredentials
            {
                Username = LoginUsernameBox.Text,
                Password = LoginPasswordBox.Password,
                ClientVersion = Client.Version,
                IpAddress = RiotCalls.GetIpAddress(),
                Locale = selectedRegion.Locale,
                OperatingSystem = "Windows 7",
                Domain = "lolclient.lol.riotgames.com",
                AuthToken = authToken
            };
            Session login = await RiotCalls.Login(newCredentials);
            if (login == null)
            {
                Client.Log("Login session is null.");
                var overlay = new MessageOverlay
                {
                    MessageTextBox = { Text = "Login session is null. Login failed. Please check whether the version number is correct or not.", IsReadOnly = true },
                    MessageTitle = { Content = "Login session is null." }
                };
                Client.OverlayContainer.Content = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
                ErrorTextBox.Text = "Failed to login. Login session is null.";
                HideGrid.Visibility = Visibility.Visible;
                ErrorTextBox.Visibility = Visibility.Visible;
                LoggingInLabel.Visibility = Visibility.Hidden;
                LoggingInProgressRing.Visibility = Visibility.Collapsed;
                return;
            }
            Client.PlayerSession = login;
            var str1 = string.Format("gn-{0}", login.AccountSummary.AccountId);
            var str2 = string.Format("cn-{0}", login.AccountSummary.AccountId);
            var str3 = string.Format("bc-{0}", login.AccountSummary.AccountId);
            Task<bool>[] taskArray = { Client.RiotConnection.SubscribeAsync("my-rtmps", "messagingDestination", str1, str1), 
                                                 Client.RiotConnection.SubscribeAsync("my-rtmps", "messagingDestination", str2, str2), 
                                                 Client.RiotConnection.SubscribeAsync("my-rtmps", "messagingDestination", "bc", str3) };

            await Task.WhenAll(taskArray);
            //Riot added this for no reason but make it look like the riot client we have to do this
            var plainTextbytes = Encoding.UTF8.GetBytes(login.AccountSummary.Username + ":" + login.Token);
            Client.reconnectToken = Convert.ToBase64String(plainTextbytes);
            //await RiotCalls.Login(result);
            var LoggedIn = await Client.RiotConnection.LoginAsync(LoginUsernameBox.Text.ToLower(), login.Token);
            DoGetOnLoginPacket();
        }