public async Task<LoginDataPacket> GetLoginDataPacketForUser() { int Id = Invoke("clientFacadeService", "getLoginDataPacketForUser", new object[] { }); while (!results.ContainsKey(Id)) await Task.Delay(10); TypedObject messageBody = results[Id].GetTO("data").GetTO("body"); LoginDataPacket result = new LoginDataPacket(messageBody); results.Remove(Id); return result; }
private void GotPlayerData(LoginDataPacket packet) { Client.PVPNet.OnMessageReceived += PVPNet_OnMessageReceived; AllSummonerData PlayerData = packet.AllSummonerData; SummonerNameLabel.Content = PlayerData.Summoner.Name; if (Client.LoginPacket.AllSummonerData.SummonerLevel.Level < 30) { PlayerProgressBar.Value = (PlayerData.SummonerLevelAndPoints.ExpPoints / PlayerData.SummonerLevel.ExpToNextLevel) * 100; PlayerProgressLabel.Content = String.Format("Level {0}", PlayerData.SummonerLevel.Level); PlayerCurrentProgressLabel.Content = String.Format("{0}XP", PlayerData.SummonerLevelAndPoints.ExpPoints); PlayerAimProgressLabel.Content = String.Format("{0}XP", PlayerData.SummonerLevel.ExpToNextLevel); } else { Client.PVPNet.GetAllLeaguesForPlayer(PlayerData.Summoner.SumId, new SummonerLeaguesDTO.Callback(GotLeaguesForPlayer)); } if (packet.BroadcastNotification.BroadcastMessages != null) { Dictionary<string, object> Message = packet.BroadcastNotification.BroadcastMessages[0] as Dictionary<string, object>; BroadcastMessage.Text = Convert.ToString(Message["content"]); } foreach (PlayerStatSummary x in packet.PlayerStatSummaries.PlayerStatSummarySet) { if (x.PlayerStatSummaryTypeString == "Unranked") { Client.IsRanked = false; Client.AmountOfWins = x.Wins; } if (x.PlayerStatSummaryTypeString == "RankedSolo5x5") { Client.IsRanked = true; Client.AmountOfWins = x.Wins; break; } } if (packet.ReconnectInfo != null) { ; } Client.InfoLabel.Content = "IP: " + Client.LoginPacket.IpBalance + " ∙ RP: " + Client.LoginPacket.RpBalance; int ProfileIconID = Client.LoginPacket.AllSummonerData.Summoner.ProfileIconId; string uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", ProfileIconID + ".png"); ProfileImage.Source = Client.GetImage(uriSource); Client.MainPageProfileImage = ProfileImage; RefreshTimer = new System.Windows.Forms.Timer(); RefreshTimer.Tick += new EventHandler(RefreshTimer_Tick); RefreshTimer.Interval = 300000; // 5 minutes RefreshTimer.Start(); }
public LoginDataPacket GetLoginDataPacketForUser() { int Id = Invoke("clientFacadeService", "getLoginDataPacketForUser", new object[] { }); while (!results.ContainsKey(Id)) System.Threading.Thread.Sleep(10); TypedObject messageBody = results[Id].GetTO("data").GetTO("body"); LoginDataPacket result = new LoginDataPacket(messageBody); results.Remove(Id); return result; }
/// 1.) public void GetLoginDataPacketForUser(LoginDataPacket.Callback callback) { LoginDataPacket cb = new LoginDataPacket(callback); InvokeWithCallback("clientFacadeService", "getLoginDataPacketForUser", new object[] { }, cb); }
#pragma warning disable 4014 //Code does not need to be awaited private async void GotLoginPacket(LoginDataPacket packet) { Client.LoginPacket = packet; 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(() => { Client.StatusContainer.Visibility = System.Windows.Visibility.Visible; Client.Container.Margin = new Thickness(0, 0, 0, 40); //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.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; Client.Log("Connected and loged in as" + Client.ChatClient.User); Client.SwitchPage(new MainPage()); Client.ClearPage(this); })); }
#pragma warning disable 4014 //Code does not need to be awaited private async void GotLoginPacket(LoginDataPacket packet) { Client.LoginPacket = packet; 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); //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.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; Client.Log("Connected and loged in as" + Client.ChatClient.User); Client.SwitchPage(new MainPage()); Client.ClearPage(this); 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; //We need this HeartBeat so it looks like this is the real client await Client.PVPNet.PerformLCDSHeartBeat(Convert.ToInt32(Client.LoginPacket.AllSummonerData.Summoner.AcctId), Client.PlayerSession.Token, Client.HeartbeatCount, DateTime.Now.ToString("ddd MMM d yyyy HH:mm:ss 'GMT-'%K")); Client.HeartbeatCount++; })); }