Example #1
0
        public void HandleRegisterGame(RegisterGameClientRequest request)
        {
            try
            {
                LobbyPlayerInfo playerInfo = SessionManager.OnPlayerConnect(this, request);

                if (playerInfo != null)
                {
                    Log.Print(LogType.Lobby, string.Format(Config.Messages.LoginSuccess, this.UserName));
                    RegisterGameClientResponse response = new RegisterGameClientResponse
                    {
                        AuthInfo    = request.AuthInfo,
                        SessionInfo = request.SessionInfo,
                        ResponseId  = request.RequestId
                    };

                    Send(response);

                    SendLobbyServerReadyNotification();
                }
                else
                {
                    SendErrorResponse(new RegisterGameClientResponse(), request.RequestId, Config.Messages.LoginFailed);
                }
            }
            catch (Exception e)
            {
                SendErrorResponse(new RegisterGameClientResponse(), request.RequestId, e);
            }
        }
        private static RegisterGameClientResponse RegisterGameClient(RegisterGameClientRequest request)
        {
            RegisterGameClientResponse response = new RegisterGameClientResponse();

            response.SessionInfo = request.SessionInfo;
            response.SessionInfo.ConnectionAddress = "127.0.0.1";
            response.SessionInfo.LanguageCode      = "EN";
            response.AuthInfo               = request.AuthInfo;
            response.AuthInfo.AccountId     = request.SessionInfo.AccountId; // Override AuthInfo.AccountId with SessionInfo.AccountID, The account id from SessionInfo is set in the DirectoryServer and has the accountid value from database for the client username
            response.DevServerConnectionUrl = "127.0.0.1";                   // What is this?
            response.AuthInfo.AccountStatus = null;
            response.Status = new LobbyStatusNotification
            {
                AllowRelogin             = false,
                ClientAccessLevel        = ClientAccessLevel.Full,
                ConnectionQueueInfo      = null,
                ErrorReportRate          = TimeSpan.FromMinutes(3),
                GameplayOverrides        = null,
                HasPurchasedGame         = true,
                HighestPurchasedGamePack = 0,
                LocalizedFailure         = null,
                PacificNow             = DateTime.UtcNow, // TODO: Originally had "0001-01-01T00:00:00"
                ServerLockState        = ServerLockState.Unlocked,
                ServerMessageOverrides = new ServerMessageOverrides().FillDummyData(),
                TimeOffset             = TimeSpan.Zero,
                UtcNow     = DateTime.UtcNow, // TODO: Originally had "0001-01-01T00:00:00"
                RequestId  = 0,
                ResponseId = 0,
            };
            response.LocalizedFailure = null;
            response.RequestId        = 0;
            response.ResponseId       = request.RequestId;
            return(response);
        }