Esempio n. 1
0
        public void AuthenticationRequest(GameServer pServer, byte[] pBuffer)
        {
            var pMsg = new MsgLoginSvAuthentication(pBuffer);

            if (pMsg.Username != ServerKernel.Username || pMsg.Password != ServerKernel.Password)
            {
                pServer.Send(new LoginSvResponsePacket(LoginServerResponse.LOGIN_DENIED_LOGIN));
                pServer.Disconnect();
                return;
            }

            pServer.ConnectionState = InterServerState.CONNECTED;
            pServer.Send(new LoginSvResponsePacket(LoginServerResponse.LOGIN_SUCCESSFUL));
        }
Esempio n. 2
0
        public void AuthRequest(GameServer pServer, byte[] pBuffer)
        {
            var pMsg = new MsgLoginSvAuthRequest(pBuffer);

            if (pMsg.Message != ServerKernel.HelloExpectedMsg)
            {
                pServer.Disconnect();
                return;
            }

            pServer.ConnectionState = InterServerState.MEETING_OK;
            pServer.Send(new MsgLoginSvAuthRequest(ServerKernel.HelloSendString));
            ServerKernel.Log.SaveLog(string.Format("Waiting for server [{0}] to accept connection.", pServer.IpAddress), true, LogType.WARNING);
        }
Esempio n. 3
0
        public void ServerInformation(GameServer pServer, byte[] pBuffer)
        {
            if (pServer.ConnectionState < InterServerState.CONNECTED)
            {
                pServer.Disconnect();
                ServerKernel.Log.SaveLog(string.Format("Disconnected[{0}]: Unauthorized.", pServer.IpAddress), true, LogType.WARNING);
                return;
            }

            var pMsg = new MsgServerInformation(pBuffer);

            pServer.ServerName         = pMsg.ServerName;
            pServer.MaxPermitedPlayers = pMsg.MaxOnlinePlayers;
            pServer.OnlinePlayers      = pMsg.OnlinePlayers;
            pServer.GamePort           = pMsg.GamePort;

            if (!ServerKernel.OnlineServers.TryAdd(pServer.ServerName, pServer))
            {
                pServer.Disconnect();
                return;
            }

            ServerKernel.Log.SaveLog(string.Format("Server [{0}] has connected with the following information>\r\n\tPort: {1}, Online: {2}, MaxOnline: {3}", pServer.ServerName, pServer.GamePort, pServer.OnlinePlayers, pServer.MaxPermitedPlayers), true, LogType.MESSAGE);
        }