public override void Handle(LoginSession session, PacketReader packet) { LoginMode mode = (LoginMode)packet.ReadByte(); string username = packet.ReadUnicodeString(); string password = packet.ReadUnicodeString(); if (string.IsNullOrEmpty(username)) { session.Send(LoginResultPacket.SendLoginMode(Packets.LoginMode.IncorrectId)); return; } Account account; if (DatabaseManager.Accounts.AccountExists(username.ToLower())) { if (!DatabaseManager.Accounts.Authenticate(username, password, out account)) { session.Send(LoginResultPacket.SendLoginMode(Packets.LoginMode.IncorrectPassword)); return; } Session loggedInAccount = MapleServer.GetSessions(MapleServer.GetLoginServer(), MapleServer.GetGameServer()).FirstOrDefault(p => p switch { LoginSession s => s.AccountId == account.Id, GameSession s => s.Player?.AccountId == account.Id, _ => false });