public override void run() { if (getClient().login1 != login1 && getClient().login2 != login2) { getClient().sendPacket(new LoginFail(getClient(), LoginFail.LoginFailReason.REASON_ACCESS_FAILED)); return; } L2Server server = ServerThreadPool.getInstance().get(serverId); if (server == null) { getClient().sendPacket(new LoginFail(getClient(), LoginFail.LoginFailReason.REASON_ACCESS_FAILED)); return; } if (server.connected == 0) { getClient().sendPacket(new LoginFail(getClient(), LoginFail.LoginFailReason.REASON_SERVER_MAINTENANCE)); } else { ServerThreadPool.getInstance().SendPlayer(serverId, getClient(), DateTime.Now.ToLocalTime().ToString()); //login updates here getClient().sendPacket(new PlayOk(getClient())); } }
public override async Task RunImpl() { await Task.Run(() => { L2Server server = LoginServer.ServiceProvider.GetService <ServerThreadPool>().Servers.FirstOrDefault(srv => srv.Code == _code); if (server == null) { Log.Error($"Code '{_code}' for server was not found. Closing"); _thread.Close(ServerLoginFail.ToPacket("Code Error")); return; } server.Thread = _thread; _thread.Id = server.Id; _thread.Info = _info; _thread.Wan = _host; _thread.Port = _port; _thread.Maxp = _maxp; _thread.GmOnly = _gmonly == 1; _thread.TestMode = _test == 1; _thread.Connected = true; _thread.Send(ServerLoginOk.ToPacket()); Log.Info($"Server #{server.Id} connected"); }); }
public override void run() { L2Server server = null; foreach (L2Server srv in ServerThreadPool.getInstance().servers) { if (srv.code == code) { srv.thread = thread; server = srv; break; } } if (server == null) { CLogger.error("code '" + code + "' for server was not found. closing"); thread.close(new ServerLoginFail("wrong code")); return; } thread.id = server.id; thread.info = info; thread.wan = host; thread.port = port; thread.maxp = maxp; thread.gmonly = gmonly == 1; thread.testMode = test == 1; thread.connected = true; thread.sendPacket(new ServerLoginOk()); CLogger.extra_info("AuthThread: Server #" + server.id + " connected"); }
public override async Task RunImpl() { L2Server server = LoginServer.ServiceProvider.GetService <ServerThreadPool>() .Servers.FirstOrDefault(x => x.ServerKey == _serverKey); if (server == null) { Log.Error($"Server with id '{_serverKey}' was not found. Closing"); _thread.Close(ServerLoginFail.ToPacket("ServerId Error")); return; } server.Thread = _thread; _thread.ServerId = server.ServerId; _thread.Info = _info; _thread.Wan = _host; _thread.Port = _port; _thread.MaxPlayers = _maxPlayers; _thread.GmOnly = _gmonly == 1; _thread.TestMode = _test == 1; _thread.Connected = true; _thread.Send(ServerLoginOk.ToPacket()); Log.Info($"Server #{server.ServerId} connected"); }
public override void RunImpl() { if (_client.State != LoginClientState.AuthedLogin) { _client.Send(LoginFail.ToPacket(LoginFailReason.ReasonAccessFailed)); _client.Close(); return; } if (_client.Key.LoginOkId1 != _loginOkID1 && _client.Key.LoginOkId2 != _loginOkID2) { _client.Send(LoginFail.ToPacket(LoginFailReason.ReasonAccessFailed)); _client.Close(); return; } L2Server server = ServerThreadPool.Instance.Get(_serverId); if (server == null) { _client.Send(LoginFail.ToPacket(LoginFailReason.ReasonAccessFailed)); _client.Close(); return; } if (server.Connected == 0) { _client.Send(LoginFail.ToPacket(LoginFailReason.ReasonServerMaintenance)); _client.Close(); return; } _client.Send(PlayOk.ToPacket(_client)); }
public override void RunImpl() { if ((_client.Login1 != _login1) && (_client.Login2 != _login2)) { _client.Send(LoginFail.ToPacket(LoginFailReason.ReasonAccessFailed)); return; } L2Server server = ServerThreadPool.Instance.Get(_serverId); if (server == null) { _client.Send(LoginFail.ToPacket(LoginFailReason.ReasonAccessFailed)); return; } if (server.Connected == 0) { _client.Send(LoginFail.ToPacket(LoginFailReason.ReasonServerMaintenance)); } else { _client.Send(PlayOk.ToPacket(_client)); } }
public override void run() { L2Server server = null; foreach (L2Server srv in ServerThreadPool.Instance.servers) { if (srv.Code == code) { srv.Thread = thread; server = srv; break; } } if (server == null) { CLogger.error("code '" + code + "' for server was not found. closing"); thread.close(new ServerLoginFail("wrong code")); return; } thread.Id = server.Id; thread.Info = info; thread.Wan = host; thread.Port = port; thread.Maxp = maxp; thread.GmOnly = gmonly == 1; thread.TestMode = test == 1; thread.Connected = true; thread.SendPacket(new ServerLoginOk()); CLogger.extra_info($"AuthThread: Server #{server.Id} connected"); }
public void Shutdown(byte id) { L2Server server = Servers.FirstOrDefault(s => s.Id == id); if (server == null) { return; } server.Thread?.Stop(); server.Thread = null; Log.Warn($"ServerThread: #{id} shutted down"); }
public override async Task RunImpl() { if (_client.State != LoginClientState.AuthedLogin) { await _client.SendAsync(LoginFail.ToPacket(LoginFailReason.ReasonAccessFailed)); _client.Close(); return; } if (_client.Key.LoginOkId1 != _loginOkID1 || _client.Key.LoginOkId2 != _loginOkID2) { await _client.SendAsync(LoginFail.ToPacket(LoginFailReason.ReasonAccessFailed)); _client.Close(); return; } L2Server server = LoginServer.ServiceProvider.GetService <ServerThreadPool>().Get(_serverId); if (server == null) { await _client.SendAsync(LoginFail.ToPacket(LoginFailReason.ReasonAccessFailed)); _client.Close(); return; } if (!server.Connected) { await _client.SendAsync(LoginFail.ToPacket(LoginFailReason.ReasonServerMaintenance)); _client.Close(); return; } await server.Thread.SendPlayer(_client); _client.SendAsync(PlayOk.ToPacket(_client)); }
public override void RunImpl() { L2Server server = ServerThreadPool.Instance.Servers.FirstOrDefault(srv => srv.Code == _code); if (server == null) { Log.Error($"Code '{_code}' for server was not found. Closing"); _thread.Close(ServerLoginFail.ToPacket("Code Error")); return; } server.Thread = _thread; _thread.Id = server.Id; _thread.Info = _info; _thread.Wan = _host; _thread.Port = _port; _thread.Maxp = _maxp; _thread.GmOnly = _gmonly == 1; _thread.TestMode = _test == 1; _thread.Connected = true; _thread.Send(ServerLoginOk.ToPacket()); Log.Info($"AuthThread: Server #{server.Id} connected"); }
public void SendPlayer(byte serverId, LoginClient client, string time) { L2Server server = Servers.FirstOrDefault(srv => (srv.Id == serverId) && (srv.Thread != null)); server?.Thread.SendPlayer(client, time); }
public void makeme(L2Server server) { this.mstream = new MemoryStream(); this.server = server; }
public void SendPlayer(byte serverId, LoginClient client) { L2Server server = Servers.FirstOrDefault(srv => srv.ServerId == serverId && srv.Thread != null); server?.Thread.SendPlayer(client); }