Esempio n. 1
0
#pragma warning disable 4014 //Code does not need to be awaited


        private async void GotLoginPacket(LoginDataPacket packet)
        {
            if (packet.AllSummonerData == null)
            {
                //Just Created Account, need to put logic here.
                Client.done = false;
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    var createSummoner = new CreateSummonerNameOverlay();
                    Client.OverlayContainer.Content    = createSummoner.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                }));
                while (!Client.done)
                {
                }
                Client.PVPNet.Connect(LoginUsernameBox.Text, LoginPasswordBox.Password, Client.Region.PVPRegion,
                                      Client.Version);
                return;
            }
            Client.LoginPacket = packet;
            if (packet.AllSummonerData.Summoner.ProfileIconId == -1)
            {
                Client.done = false;
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    Client.OverlayContainer.Content    = new ChooseProfilePicturePage().Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                }));
                while (!Client.done)
                {
                }
                Client.PVPNet.Connect(LoginUsernameBox.Text, LoginPasswordBox.Password, Client.Region.PVPRegion,
                                      Client.Version);

                return;
            }
            Client.PlayerChampions = await Client.PVPNet.GetAvailableChampions();

            Client.PVPNet.OnError -= PVPNet_OnError;
            Client.GameConfigs     = packet.GameTypeConfigs;
            Client.PVPNet.Subscribe("bc", packet.AllSummonerData.Summoner.AcctId);
            Client.PVPNet.Subscribe("cn", packet.AllSummonerData.Summoner.AcctId);
            Client.PVPNet.Subscribe("gn", packet.AllSummonerData.Summoner.AcctId);
            Client.IsLoggedIn = true;


            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() =>
            {
                Client.StatusContainer.Visibility = Visibility.Visible;
                Client.Container.Margin           = new Thickness(0, 0, 0, 40);

                var newCredentials = new AuthenticationCredentials
                {
                    Username      = LoginUsernameBox.Text,
                    Password      = LoginPasswordBox.Password,
                    ClientVersion = Client.Version,
                    IpAddress     = GetNewIpAddress(),
                    Locale        = Client.Region.Locale,
                    Domain        = "lolclient.lol.riotgames.com"
                };
                //Almost like the lol client now
                string os        = Environment.OSVersion.ToString();
                string[] ossplit = os.Split('.');
                if (ossplit[0] == "Windows 8")
                {
                    if (ossplit[1] == "1")
                    {
                        os = "Windows 8.1";
                    }
                }
                else
                {
                    os = ossplit[0];
                }

                newCredentials.OperatingSystem = os;

                Session login        = await Client.PVPNet.Login(newCredentials);
                Client.PlayerSession = login;

                //Setup chat
                if (!Client.Garena)
                {
                    Client.ChatClient.AutoReconnect = 30;
                    Client.ChatClient.KeepAlive     = 10;
                    Client.ChatClient.NetworkHost   = "chat." + Client.Region.ChatName + ".lol.riotgames.com";
                    Client.ChatClient.Port          = 5223;
                    Client.ChatClient.Server        = "pvp.net";
                    Client.ChatClient.SSL           = true;
                    Client.ChatClient.User          = LoginUsernameBox.Text;
                    Client.ChatClient.Password      = "******" + LoginPasswordBox.Password;
                    Client.userpass = new KeyValuePair <String, String>(LoginUsernameBox.Text,
                                                                        "AIR_" + LoginPasswordBox.Password);
                    Client.ChatClient.OnInvalidCertificate += Client.ChatClient_OnInvalidCertificate;
                    Client.ChatClient.OnMessage            += Client.ChatClient_OnMessage;
                    Client.ChatClient.OnPresence           += Client.ChatClient_OnPresence;
                    Client.ChatClient.OnDisconnect         += Client.ChatClient_OnDisconnect;
                    Client.ChatClient.Connect();
                }
                else
                {
                    Client.ChatClient.AutoReconnect = 30;
                    Client.ChatClient.KeepAlive     = 10;
                    Client.ChatClient.NetworkHost   = Client.Region.ChatName;
                    Client.ChatClient.Port          = 5223;
                    Client.ChatClient.Server        = "pvp.net";
                    Client.ChatClient.SSL           = true;
                    Client.ChatClient.User          = packet.AllSummonerData.Summoner.AcctId.ToString();
                    Client.ChatClient.Password      = "******" + GetLast(packet.AllSummonerData.Summoner.AcctId.ToString(), 5);
                    Client.userpass = new KeyValuePair <String, String>(packet.AllSummonerData.Summoner.AcctId.ToString(),
                                                                        "AIR_pass" + GetLast(packet.AllSummonerData.Summoner.AcctId.ToString(), 5));
                    Client.ChatClient.OnInvalidCertificate += Client.ChatClient_OnInvalidCertificate;
                    Client.ChatClient.OnMessage            += Client.ChatClient_OnMessage;
                    Client.ChatClient.OnPresence           += Client.ChatClient_OnPresence;
                    Client.ChatClient.OnDisconnect         += Client.ChatClient_OnDisconnect;
                    Client.ChatClient.Connect();
                }

                Client.RostManager = new RosterManager
                {
                    Stream    = Client.ChatClient,
                    AutoAllow = AutoSubscriptionHanding.AllowAll
                };
                Client.RostManager.OnRosterItem += Client.RostManager_OnRosterItem;
                Client.RostManager.OnRosterEnd  += Client.ChatClientConnect;

                Client.PresManager = new PresenceManager
                {
                    Stream = Client.ChatClient
                };
                Client.PresManager.OnPrimarySessionChange += Client.PresManager_OnPrimarySessionChange;

                Client.ConfManager = new ConferenceManager
                {
                    Stream = Client.ChatClient
                };
                //switch
                Client.Log("Connected to " + Client.Region.RegionName + " and logged in as " +
                           Client.LoginPacket.AllSummonerData.Summoner.Name);

                //Gather data and convert it that way that it does not cause errors
                PlatformGameLifecycleDTO data = Client.LoginPacket.ReconnectInfo;

                if (data != null && data.Game != null)
                {
                    Client.Log(data.PlayerCredentials.ChampionId.ToString(CultureInfo.InvariantCulture));
                    Client.CurrentGame = data.PlayerCredentials;
                    Client.GameType    = data.Game.GameType;
                    Client.SwitchPage(new InGame());
                }
                else
                {
                    uiLogic.UpdateMainPage();
                }

                Client.ClearPage(typeof(LoginPage));
            }));
        }
Esempio n. 2
0
        private void GotLoginPacket(LoginDataPacket packet)
        {
            if (packet.AllSummonerData == null)
            {
                Client.RiotConnection.CallbackException -= client_CallbackException;
                Client.RiotConnection.MessageReceived   -= client_MessageReceived;
                //Just Created Account, need to put logic here.
                Client.done = false;
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    var createSummoner = new CreateSummonerNameOverlay();
                    Client.OverlayContainer.Content    = createSummoner.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                }));
                while (!Client.done)
                {
                }
                Login();
                return;
            }
            Client.LoginPacket = packet;
            if (packet.AllSummonerData.Summoner.ProfileIconId == -1)
            {
                Client.RiotConnection.CallbackException -= client_CallbackException;
                Client.RiotConnection.MessageReceived   -= client_MessageReceived;
                Client.done = false;
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    Client.OverlayContainer.Content    = new ChooseProfilePicturePage().Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                }));
                while (!Client.done)
                {
                }
                Login();

                return;
            }

            Client.RiotConnection.MessageReceived += Client.OnMessageReceived;
            Client.RiotConnection.Disconnected    += Client.RiotConnection_Disconnected;
            Client.GameConfigs = packet.GameTypeConfigs;
            Client.IsLoggedIn  = true;


            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                MessageBox.Show("Do not play ANY games. I am not sure if they will work ~eddy", "XMPP", MessageBoxButton.OK, MessageBoxImage.Warning);
                Client.StatusContainer.Visibility = Visibility.Visible;
                Client.Container.Margin           = new Thickness(0, 0, 0, 40);
                //You have to hand implement this
                //Client.XmppConnection.AutoReconnect = 30;
                Client.XmppConnection = new agsXMPP.XmppClientConnection("pvp.net", 5223)
                {
                    AutoResolveConnectServer = false,
                    ConnectServer            = "chat." + Client.Region.ChatName + ".lol.riotgames.com",
                    Resource          = "xiff",
                    UseSSL            = true,
                    KeepAliveInterval = 10,
                    KeepAlive         = true
                };
                Client.XmppConnection.UseCompression = true;
                Client.XmppConnection.OnMessage     += Client.XmppConnection_OnMessage;
                Client.XmppConnection.OnError       += Client.XmppConnection_OnError;
                Client.XmppConnection.OnLogin       += (o) =>
                {
                    Client.Log("Connected to XMPP Server");
                    //Set up chat
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        if (invisibleLoginCheckBox.IsChecked != true)
                        {
                            Client.XmppConnection.Send(new Presence(ShowType.chat, Client.GetPresence(), 0)
                            {
                                Type = PresenceType.available
                            });
                        }
                        else
                        {
                            Client.XmppConnection.Send(new Presence(ShowType.NONE, Client.GetPresence(), 0)
                            {
                                Type = PresenceType.invisible
                            });
                        }
                    }));
                };
                Client.RostManager = new RosterManager(Client.XmppConnection);
                Client.XmppConnection.OnRosterItem += Client.RostManager_OnRosterItem;
                Client.XmppConnection.OnRosterEnd  += Client.ChatClientConnect;
                Client.PresManager = new PresenceManager(Client.XmppConnection);
                Client.XmppConnection.OnPresence += Client.XmppConnection_OnPresence;
                if (!Client.Garena)
                {
                    Client.userpass = new KeyValuePair <string, string>(LoginUsernameBox.Text,
                                                                        "AIR_" + LoginPasswordBox.Password);

                    Client.XmppConnection.Open(LoginUsernameBox.Text, "AIR_" + LoginPasswordBox.Password);

                    //Client.XmppConnection.OnInvalidCertificate += Client.XmppConnection_OnInvalidCertificate;
                }
                else
                {
                    Client.XmppConnection.ConnectServer = "chat" + Client.Region.ChatName + ".lol.garenanow.com";
                    var gas = getGas();
                    Client.XmppConnection.Open(Client.UID, "AIR_" + gas);
                    Client.userpass = new KeyValuePair <string, string>(Client.UID, "AIR_" + gas);
                }

                //Client.PresManager.OnPrimarySessionChange += Client.PresManager_OnPrimarySessionChange;

                /*
                 * Client.ConfManager = new ConferenceManager
                 * {
                 *  Stream = Client.XmppConnection
                 * };
                 * //*/
                //switch
                Client.Log("Connected to " + Client.Region.RegionName + " and logged in as " +
                           Client.LoginPacket.AllSummonerData.Summoner.Name);

                //Gather data and convert it that way that it does not cause errors
                PlatformGameLifecycleDTO data = (PlatformGameLifecycleDTO)Client.LoginPacket.ReconnectInfo;

                Client.MainPage = new MainPage();
                if (data != null && data.Game != null)
                {
                    Client.Log(data.PlayerCredentials.ChampionId.ToString(CultureInfo.InvariantCulture));
                    Client.CurrentGame = data.PlayerCredentials;
                    Client.GameType    = data.Game.GameType;
                    Client.SwitchPage(new InGame());
                }
                else
                {
                    Client.SwitchPage(Client.MainPage);
                }

                Client.ClearPage(typeof(LoginPage));
            }));
        }
        private void GotLoginPacket(LoginDataPacket packet)
        {
            if (packet.AllSummonerData == null)
            {
                Client.RiotConnection.CallbackException -= client_CallbackException;
                Client.RiotConnection.MessageReceived -= client_MessageReceived;
                //Just Created Account, need to put logic here.
                Client.done = false;
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    var createSummoner = new CreateSummonerNameOverlay();
                    Client.OverlayContainer.Content = createSummoner.Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                }));
                while (!Client.done)
                {
                }
                Login();
                return;
            }
            Client.LoginPacket = packet;
            if (packet.AllSummonerData.Summoner.ProfileIconId == -1)
            {
                Client.RiotConnection.CallbackException -= client_CallbackException;
                Client.RiotConnection.MessageReceived -= client_MessageReceived;
                Client.done = false;
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    Client.OverlayContainer.Content = new ChooseProfilePicturePage().Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                }));
                while (!Client.done)
                {
                }
                Login();

                return;
            }

            Client.RiotConnection.MessageReceived += Client.OnMessageReceived;
            Client.RiotConnection.Disconnected += Client.RiotConnection_Disconnected;
            Client.GameConfigs = packet.GameTypeConfigs;
            Client.IsLoggedIn = true;


            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                MessageBox.Show("Do not play ANY games. I am not sure if they will work ~eddy", "XMPP", MessageBoxButton.OK, MessageBoxImage.Warning);
                Client.StatusContainer.Visibility = Visibility.Visible;
                Client.Container.Margin = new Thickness(0, 0, 0, 40);
                //You have to hand implement this
                //Client.XmppConnection.AutoReconnect = 30;
                Client.XmppConnection = new agsXMPP.XmppClientConnection("pvp.net", 5223)
                {
                    AutoResolveConnectServer = false,
                    ConnectServer = "chat." + Client.Region.ChatName + ".lol.riotgames.com",
                    Resource = "xiff",
                    UseSSL = true,
                    KeepAliveInterval = 10,
                    KeepAlive = true
                };
                Client.XmppConnection.UseCompression = true;
                Client.XmppConnection.OnMessage += Client.XmppConnection_OnMessage;
                Client.XmppConnection.OnError += Client.XmppConnection_OnError;
                Client.XmppConnection.OnLogin += (o) => 
                {
                    Client.Log("Connected to XMPP Server");
                    //Set up chat
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        if (invisibleLoginCheckBox.IsChecked != true)
                            Client.XmppConnection.Send(new Presence(ShowType.chat, Client.GetPresence(), 0) { Type = PresenceType.available });
                        else
                            Client.XmppConnection.Send(new Presence(ShowType.NONE, Client.GetPresence(), 0) { Type = PresenceType.invisible });
                    }));
                };
                Client.RostManager = new RosterManager(Client.XmppConnection);
                Client.XmppConnection.OnRosterItem += Client.RostManager_OnRosterItem;
                Client.XmppConnection.OnRosterEnd += Client.ChatClientConnect;
                Client.PresManager = new PresenceManager(Client.XmppConnection);
                Client.XmppConnection.OnPresence += Client.XmppConnection_OnPresence;
                if (!Client.Garena)
                {
                    Client.userpass = new KeyValuePair<string, string>(LoginUsernameBox.Text,
                        "AIR_" + LoginPasswordBox.Password);
                    
                    Client.XmppConnection.Open(LoginUsernameBox.Text, "AIR_" + LoginPasswordBox.Password);

                    //Client.XmppConnection.OnInvalidCertificate += Client.XmppConnection_OnInvalidCertificate;
                }
                else
                {
                    Client.XmppConnection.ConnectServer = "chat" + Client.Region.ChatName + ".lol.garenanow.com";
                    var gas = getGas();
                    Client.XmppConnection.Open(Client.UID, "AIR_" + gas);
                    Client.userpass = new KeyValuePair<string, string>(Client.UID, "AIR_" + gas);
                }

                //Client.PresManager.OnPrimarySessionChange += Client.PresManager_OnPrimarySessionChange;
                /*
                Client.ConfManager = new ConferenceManager
                {
                    Stream = Client.XmppConnection
                };
                //*/
                //switch
                Client.Log("Connected to " + Client.Region.RegionName + " and logged in as " +
                           Client.LoginPacket.AllSummonerData.Summoner.Name);

                //Gather data and convert it that way that it does not cause errors
                PlatformGameLifecycleDTO data = (PlatformGameLifecycleDTO)Client.LoginPacket.ReconnectInfo;

                Client.MainPage = new MainPage();
                if (data != null && data.Game != null)
                {
                    Client.Log(data.PlayerCredentials.ChampionId.ToString(CultureInfo.InvariantCulture));
                    Client.CurrentGame = data.PlayerCredentials;
                    Client.GameType = data.Game.GameType;
                    Client.SwitchPage(new InGame());
                }
                else
                    Client.SwitchPage(Client.MainPage);

                Client.ClearPage(typeof(LoginPage));
            }));
        }
Esempio n. 4
0
#pragma warning disable 4014 //Code does not need to be awaited


        private async void GotLoginPacket(LoginDataPacket packet)
        {
            if (packet.AllSummonerData == null)
            {
                //Just Created Account, need to put logic here.
                Client.done = false;
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    CreateSummonerNameOverlay createSummoner = new CreateSummonerNameOverlay();
                    Client.OverlayContainer.Content          = createSummoner.Content;
                    Client.OverlayContainer.Visibility       = Visibility.Visible;
                }));
                while (!Client.done)
                {
                    ;
                }
                Client.PVPNet.Connect(LoginUsernameBox.Text, LoginPasswordBox.Password, Client.Region.PVPRegion, Client.Version);
                return;
            }
            Client.LoginPacket = packet;
            if (packet.AllSummonerData.Summoner.ProfileIconId == -1)
            {
                Client.done = false;
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    Client.OverlayContainer.Content    = new ChooseProfilePicturePage().Content;
                    Client.OverlayContainer.Visibility = Visibility.Visible;
                }));
                while (!Client.done)
                {
                    ;
                }
                Client.PVPNet.Connect(LoginUsernameBox.Text, LoginPasswordBox.Password, Client.Region.PVPRegion, Client.Version);
                return;
            }
            Client.PlayerChampions = await Client.PVPNet.GetAvailableChampions();

            Client.PVPNet.OnError -= PVPNet_OnError;
            Client.GameConfigs     = packet.GameTypeConfigs;
            Client.PVPNet.Subscribe("bc", packet.AllSummonerData.Summoner.AcctId);
            Client.PVPNet.Subscribe("cn", packet.AllSummonerData.Summoner.AcctId);
            Client.PVPNet.Subscribe("gn", packet.AllSummonerData.Summoner.AcctId);
            Client.IsLoggedIn = true;



            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() =>
            {
                Client.StatusContainer.Visibility = System.Windows.Visibility.Visible;
                Client.Container.Margin           = new Thickness(0, 0, 0, 40);

                AuthenticationCredentials newCredentials = new AuthenticationCredentials();
                newCredentials.Username      = LoginUsernameBox.Text;
                newCredentials.Password      = LoginPasswordBox.Password;
                newCredentials.ClientVersion = Client.Version;
                newCredentials.IpAddress     = GetNewIpAddress();
                newCredentials.Locale        = Client.Region.Locale;
                newCredentials.Domain        = "lolclient.lol.riotgames.com";

                Session login        = await Client.PVPNet.Login(newCredentials);
                Client.PlayerSession = login;

                //Setup chat
                Client.ChatClient.AutoReconnect         = 30;
                Client.ChatClient.KeepAlive             = 10;
                Client.ChatClient.NetworkHost           = "chat." + Client.Region.ChatName + ".lol.riotgames.com";
                Client.ChatClient.Port                  = 5223;
                Client.ChatClient.Server                = "pvp.net";
                Client.ChatClient.SSL                   = true;
                Client.ChatClient.User                  = LoginUsernameBox.Text;
                Client.ChatClient.Password              = "******" + LoginPasswordBox.Password;
                Client.ChatClient.OnInvalidCertificate += Client.ChatClient_OnInvalidCertificate;
                Client.ChatClient.OnMessage            += Client.ChatClient_OnMessage;
                Client.ChatClient.OnPresence           += Client.ChatClient_OnPresence;
                Client.ChatClient.Connect();

                Client.RostManager               = new RosterManager();
                Client.RostManager.Stream        = Client.ChatClient;
                Client.RostManager.AutoSubscribe = true;
                Client.RostManager.AutoAllow     = jabber.client.AutoSubscriptionHanding.AllowAll;
                Client.RostManager.OnRosterItem += Client.RostManager_OnRosterItem;
                Client.RostManager.OnRosterEnd  += new bedrock.ObjectHandler(Client.ChatClientConnect);

                Client.PresManager        = new PresenceManager();
                Client.PresManager.Stream = Client.ChatClient;
                Client.PresManager.OnPrimarySessionChange += Client.PresManager_OnPrimarySessionChange;

                Client.ConfManager        = new ConferenceManager();
                Client.ConfManager.Stream = Client.ChatClient;
                //switch
                Client.Log("Connected and logged in as " + Client.LoginPacket.AllSummonerData.Summoner.Name);

                //Gather data and convert it that way that it does not cause errors
                PlatformGameLifecycleDTO data = Client.LoginPacket.ReconnectInfo;

                if (data != null && data.Game != null)
                {
                    Client.Log(data.PlayerCredentials.ChampionId.ToString());
                    Client.CurrentGame = data.PlayerCredentials;
                    Client.SwitchPage(new InGame());
                }
                else
                {
                    Client.SwitchPage(new MainPage());
                }
                Client.ClearPage(typeof(LoginPage));
            }));
        }