private void HandleLoginResult(LoginResultPacket loginResultPacket) { if (loginResultPacket.Result == LoginResultPacket.LoginResult.Succesful) { ScreenManager.RemoveScreen(this); ScreenManager.AddScreen(new GameplayScreen(), null); } }
private void LoginHandler(EditorLoginRequestPacket editorLoginRequestPacket) { var username = editorLoginRequestPacket.Username; var password = editorLoginRequestPacket.Password; var result = LoginResultPacket.LoginResult.Succesful; if (AreCredentialsValid(username, password)) _authorizationTable.AuthenticateUser(editorLoginRequestPacket.Sender); else result = LoginResultPacket.LoginResult.Failed; var packet = new LoginResultPacket(result); ClientNetworkManager.Instance.SendPacket(packet, editorLoginRequestPacket.Sender); }
private void HandleLogin(LoginResultPacket loginResultPacket) { if (loginResultPacket.Result == LoginResultPacket.LoginResult.Succesful) { AppConfiguration.Instance.Username = textUsername.Text; AppConfiguration.Instance.Password = textPassword.Text; _leaveOk = true; Close(); } else MessageBox.Show( "Your login credentials were rejected. Ensure credentials are correct and your account is authorized to login."); buttonLogin.Enabled = true; }
private void ProcessLoginRequest(LoginRequestPacket obj) { var username = obj.Username; var password = obj.Password; if (AreCredentialsValid(username, password)) { Logger.Instance.Log(Level.Info, username + " has succesfully authenticated"); var packet = new LoginResultPacket(LoginResultPacket.LoginResult.Succesful); ClientNetworkManager.Instance.SendPacket(packet, obj.Sender); // Grab that account using (var context = new ServerContext()) { var account = context.Accounts.FirstOrDefault(x => x.Username.ToLower() == obj.Username); var character = context.Characters.FirstOrDefault(x => x.AccountId == account.AccountId); if(character == null) throw new Exception("A character could not be found under this slot. This should never happen."); // Introduce the entity into the simulation var entity = EntityFactory.CreateCharacter(character, obj.Sender); var mapSimulator = ((ServerServiceContainer) ServiceContainer).MapSimulators[character.MapId]; mapSimulator.AddEntity(entity); } } else { // Reject the user if they aren't able to authenticate var packet = new LoginResultPacket(LoginResultPacket.LoginResult.Failed); ClientNetworkManager.Instance.SendPacket(packet, obj.Sender); } }
public static new Packet FromNetBuffer(NetIncomingMessage incomingMessage) { var result = (LoginResult)incomingMessage.ReadByte(); var packet = new LoginResultPacket(result); return packet; }