private void OnCommunicatorConnect(SocketAsyncEventArgs args) { if (args.SocketError != SocketError.Success) { Timer.Add("CommReconnect", 10000, false, () => { if (AuthCommunicator?.Connected ?? true) { ConnectCommunicator(); } }); Logger.WriteLog(LogType.Error, "Could not connect to the Auth server! Trying again in a few seconds..."); return; } Logger.WriteLog(LogType.Network, "*** Connected to the Auth Server!"); AuthCommunicator.OnReceive += OnCommunicatorReceive; AuthCommunicator.Send(new LoginRequestPacket { ServerId = Config.ServerInfoConfig.Id, Password = Config.ServerInfoConfig.Password, PublicAddress = PublicAddress }); AuthCommunicator.ReceiveAsync(); }
private void MsgGameInfoRequest(ServerInfoRequestPacket packet) { AuthCommunicator.Send(new ServerInfoResponsePacket { AgeLimit = Config.ServerInfoConfig.AgeLimit, PKFlag = Config.ServerInfoConfig.PKFlag, CurrentPlayers = CurrentPlayers, GamePort = Config.GameConfig.Port, QueuePort = Config.QueueConfig.Port, MaxPlayers = (ushort)Config.SocketAsyncConfig.MaxClients }); }
private void MsgRedirectRequest(RedirectRequestPacket packet) { lock (IncomingClients) { if (IncomingClients.ContainsKey(packet.Id)) { IncomingClients.Remove(packet.Id); } IncomingClients.Add(packet.Id, new LoginAccountEntry(packet)); } AuthCommunicator.Send(new RedirectResponsePacket { AccountId = packet.Id, Response = RedirectResult.Success }); }
private void OnCommunicatorConnect(SocketAsyncEventArgs args) { if (args.SocketError != SocketError.Success) { OnCommunicatorError(args); return; } Logger.WriteLog(LogType.Network, "*** Connected to the Auth Server!"); AuthCommunicator.OnReceive += OnCommunicatorReceive; AuthCommunicator.Send(new LoginRequestPacket { ServerId = Config.ServerInfoConfig.Id, Password = Config.ServerInfoConfig.Password, PublicAddress = PublicAddress }); AuthCommunicator.ReceiveAsync(); }