Пример #1
0
 def handleLoginResponseMsg(self, di):
     self.notify.debug('handleLoginResponseMsg1')
     if self.notify.getDebug():
         dgram = di.getDatagram()
         dgram.dumpHex(ostream)
     now = time.time()
     accountDetailRecord = AccountDetailRecord()
     self.cr.accountDetailRecord = accountDetailRecord
     returnCode = di.getUint8()
     accountCode = di.getUint32()
     errorString = self.getExtendedErrorMsg(di.getString())
     sec = di.getUint32()
     usec = di.getUint32()
     serverTime = sec + usec / 1000000.0
     serverDelta = serverTime - now
     self.cr.serverTimeUponLogin = serverTime
     self.cr.clientTimeUponLogin = now
     self.cr.globalClockRealTimeUponLogin = globalClock.getRealTime()
     if hasattr(self.cr, 'toontownTimeManager'):
         self.cr.toontownTimeManager.updateLoginTimes(serverTime, now, self.cr.globalClockRealTimeUponLogin)
     self.cr.setServerDelta(serverDelta)
     self.notify.setServerDelta(serverDelta, 28800)
     if di.getRemainingSize() > 0:
         self.cr.accountDays = self.parseAccountDays(di.getInt32())
     else:
         self.cr.accountDays = 100000
     if di.getRemainingSize() > 0:
         WhiteListResponse = di.getString()
     else:
         WhiteListResponse = 'NO'
     if WhiteListResponse == 'YES':
         self.cr.whiteListChatEnabled = 1
     else:
         self.cr.whiteListChatEnabled = 0
     self.lastLoggedInStr = base.config.GetString('last-logged-in', '')
     self.cr.lastLoggedIn = datetime.now()
     if hasattr(self.cr, 'toontownTimeManager'):
         self.cr.lastLoggedIn = self.cr.toontownTimeManager.convertStrToToontownTime(self.lastLoggedInStr)
     self.cr.withParentAccount = base.config.GetBool('dev-with-parent-account', 0)
     self.notify.info('Login response return code %s' % returnCode)
     if returnCode == 0:
         self.__handleLoginSuccess()
     elif returnCode == 12:
         self.notify.info('Bad password')
         self.fsm.request('showLoginFailDialog', [
          OTPLocalizer.LoginScreenBadPassword])
     elif returnCode == 14:
         self.notify.info('Bad word in user name')
         self.fsm.request('showLoginFailDialog', [
          OTPLocalizer.LoginScreenInvalidUserName])
     elif returnCode == 129:
         self.notify.info('Username not found')
         self.fsm.request('showLoginFailDialog', [
          OTPLocalizer.LoginScreenUserNameNotFound])
     else:
         self.notify.info('Login failed: %s' % errorString)
         messenger.send(self.doneEvent, [{'mode': 'reject'}])
Пример #2
0
 def handleLoginResponseMsg3(self, di):
     now = time.time()
     returnCode = di.getInt8()
     errorString = self.getExtendedErrorMsg(di.getString())
     self.notify.info('Login response return code %s' % returnCode)
     if returnCode != 0:
         self.notify.info('Login failed: %s' % errorString)
         messenger.send(self.doneEvent, [{'mode': 'reject'}])
         return
     accountDetailRecord = AccountDetailRecord()
     accountDetailRecord.openChatEnabled = di.getString() == 'YES'
     accountDetailRecord.createFriendsWithChat = di.getString() == 'YES'
     chatCodeCreation = di.getString()
     accountDetailRecord.chatCodeCreation = chatCodeCreation == 'YES'
     parentControlledChat = chatCodeCreation == 'PARENT'
     access = di.getString()
     if access == 'VELVET':
         access = OTPGlobals.AccessVelvetRope
     else:                                                                                                                       if access == 'FULL':
             access = OTPGlobals.AccessFull
    def handleLoginResponseMsg3(self, di):
        now = time.time()
        returnCode = di.getInt8()
        errorString = self.getExtendedErrorMsg(di.getString())
        self.notify.info('Login response return code %s' % returnCode)
        if returnCode != 0:
            self.notify.info('Login failed: %s' % errorString)
            messenger.send(self.doneEvent, [{'mode': 'reject'}])
            return
        accountDetailRecord = AccountDetailRecord()
        accountDetailRecord.openChatEnabled = di.getString() == 'YES'
        accountDetailRecord.createFriendsWithChat = di.getString() == 'YES'
        chatCodeCreation = di.getString()
        accountDetailRecord.chatCodeCreation = chatCodeCreation == 'YES'
        parentControlledChat = chatCodeCreation == 'PARENT'
        access = di.getString()
        if access == 'VELVET':
            access = OTPGlobals.AccessVelvetRope
        elif access == 'FULL':
            access = OTPGlobals.AccessFull
        else:
            self.notify.warning('Unknown access: %s' % access)
            access = OTPGlobals.AccessUnknown
        accountDetailRecord.piratesAccess = access
        accountDetailRecord.familyAccountId = di.getInt32()
        accountDetailRecord.playerAccountId = di.getInt32()
        accountDetailRecord.playerName = di.getString()
        accountDetailRecord.playerNameApproved = di.getInt8()
        accountDetailRecord.maxAvatars = di.getInt32()
        self.cr.openChatAllowed = accountDetailRecord.openChatEnabled
        self.cr.secretChatAllowed = accountDetailRecord.chatCodeCreation or parentControlledChat
        self.cr.setIsPaid(accountDetailRecord.piratesAccess)
        self.userName = accountDetailRecord.playerName
        self.cr.userName = accountDetailRecord.playerName
        accountDetailRecord.numSubs = di.getUint16()
        for i in range(accountDetailRecord.numSubs):
            subDetailRecord = SubDetailRecord()
            subDetailRecord.subId = di.getUint32()
            subDetailRecord.subOwnerId = di.getUint32()
            subDetailRecord.subName = di.getString()
            subDetailRecord.subActive = di.getString()
            access = di.getString()
            if access == 'VELVET':
                access = OTPGlobals.AccessVelvetRope
            elif access == 'FULL':
                access = OTPGlobals.AccessFull
            else:
                access = OTPGlobals.AccessUnknown
            subDetailRecord.subAccess = access
            subDetailRecord.subLevel = di.getUint8()
            subDetailRecord.subNumAvatars = di.getUint8()
            subDetailRecord.subNumConcur = di.getUint8()
            subDetailRecord.subFounder = di.getString() == 'YES'
            accountDetailRecord.subDetails[subDetailRecord.subId] = subDetailRecord

        accountDetailRecord.WLChatEnabled = di.getString() == 'YES'
        if accountDetailRecord.WLChatEnabled:
            self.cr.whiteListChatEnabled = 1
        else:
            self.cr.whiteListChatEnabled = 0
        self.notify.info('End of DISL token parse')
        if base.logPrivateInfo:
            self.notify.info('accountDetailRecord: %s' % accountDetailRecord)
        self.cr.accountDetailRecord = accountDetailRecord
        self.__handleLoginSuccess()
Пример #4
0
    def handleLoginToontownResponse(self, di):
        """Handle the new toontown specific login response.
        
        We having gotten a toontown specific login response from the
        server for our normal Toontown login, via the account server.
        We can also get here with use-tt-specific-dev-login set to 1
        """
        # First, get the local time of day that we receive the message
        # from the server, so we can compare our clock to the server's
        # clock.
        self.notify.debug('handleLoginToontownResponse')
        if 1: #self.notify.getDebug():
            dgram = di.getDatagram()
            dgram.dumpHex(ostream)
            
        now = time.time()

        # Get the return code
        returnCode = di.getUint8()
        respString = di.getString()
        errorString = self.getExtendedErrorMsg(respString)

        # account number is actually DISL ID
        self.accountNumber = di.getUint32()
        self.cr.DISLIdFromLogin = self.accountNumber
        
        # The account name and chat flag are redundant if we logged in
        # via a user-supplied username and password, since we already
        # knew these; but if we logged in via LoginGoAccount, we don't
        # know this stuff until the server cracks open the token and
        # sends them back to us.  So we need to save these at least in
        # this case, but it does no harm to save them in all cases
        # anyway.
        self.accountName = di.getString()
        # unfortunately the above is ACCOUNT_NAME which is actually DNAME
        # we need the game username, lets add it to the login response
        
        # account name approved is new
        self.accountNameApproved = di.getUint8()
        
        accountDetailRecord = AccountDetailRecord()
        self.cr.accountDetailRecord = accountDetailRecord

        # open chat enabled is new, probably not used in toontown        
        self.openChatEnabled = (di.getString() == "YES")

        # this is CREATE_FRIENDS_WITH_CHAT
        createFriendsWithChat = di.getString()
        canChat = (createFriendsWithChat == 'YES') or (createFriendsWithChat=='CODE')
        self.cr.secretChatAllowed = canChat
        self.notify.info("CREATE_FRIENDS_WITH_CHAT from game server login: %s %s" % (createFriendsWithChat, canChat))

        # this controls if he can make a true friend code,
        # valid values are NO, PARENT and YES
        self.chatCodeCreationRule = di.getString()
        self.cr.chatChatCodeCreationRule = self.chatCodeCreationRule
        self.notify.info("Chat code creation rule = %s" % (self.chatCodeCreationRule))
        # correct the default value from quick launcher
        self.cr.secretChatNeedsParentPassword = (self.chatCodeCreationRule == 'PARENT')

        # The current time of day at the server
        sec = di.getUint32()
        usec = di.getUint32()
        serverTime = sec + usec / 1000000.0
        self.cr.serverTimeUponLogin = serverTime
        self.cr.clientTimeUponLogin = now
        self.cr.globalClockRealTimeUponLogin = globalClock.getRealTime()
        if hasattr(self.cr, 'toontownTimeManager'):
            self.cr.toontownTimeManager.updateLoginTimes(
                serverTime, now, self.cr.globalClockRealTimeUponLogin)         
        serverDelta = serverTime - now
        self.cr.setServerDelta(serverDelta)
        self.notify.setServerDelta(serverDelta, 28800)
        

        # Whether the user is paid
        access = di.getString()
        self.isPaid = (access == 'FULL')
        # correct the default value from quicklauncher
        self.cr.parentPasswordSet = self.isPaid
        self.cr.setIsPaid(self.isPaid)
        if self.isPaid:
            launcher.setPaidUserLoggedIn()
        self.notify.info("Paid from game server login: %s" % (self.isPaid))
     

        WhiteListResponse = di.getString()
        
        if WhiteListResponse == "YES":
            self.cr.whiteListChatEnabled = 1
        else:
            self.cr.whiteListChatEnabled = 0

        self.lastLoggedInStr = di.getString()
        self.cr.lastLoggedIn = datetime.now()
        if hasattr(self.cr, 'toontownTimeManager'):
            self.cr.lastLoggedIn = self.cr.toontownTimeManager.convertStrToToontownTime(self.lastLoggedInStr)
        
        if di.getRemainingSize() > 0:
            self.cr.accountDays = self.parseAccountDays(di.getInt32())
        else:
            self.cr.accountDays = 100000

        self.toonAccountType = di.getString()
        if self.toonAccountType == "WITH_PARENT_ACCOUNT":
            self.cr.withParentAccount = True
        elif self.toonAccountType == "NO_PARENT_ACCOUNT":
            self.cr.withParentAccount = False
        else:
            # we really need one or the other,
            self.notify.error('unknown toon account type %s' % self.toonAccountType)

        self.notify.info("toonAccountType=%s" % self.toonAccountType)
        self.userName = di.getString()
        self.cr.userName = self.userName
                
        self.notify.info("Login response return code %s" % (returnCode))

        if returnCode == 0:
            self.__handleLoginSuccess()

        elif returnCode == -13:
            # This error code means the user has entered a valid
            # password, but he has already used up his allowable time
            # for the period.

            # In practice, we never see this error message, since the
            # server sends us the "go get lost" message instead.  So
            # this code is untested.  But it remains, in case the
            # server semantics should change one day.
            self.notify.info("Period Time Expired")
            self.fsm.request("showLoginFailDialog",
                             [OTPLocalizer.LoginScreenPeriodTimeExpired])
        else:
            # If the return code is anything else, something went
            # wrong.  Better just go to reject mode and bail out.
            self.notify.info("Login failed: %s" % (errorString))
            messenger.send(self.doneEvent, [{'mode': 'reject'}])
Пример #5
0
    def handleLoginResponseMsg(self, di):
        #print("LoginScreen - handleLoginResponseMsg2")
        # We having gotten a login response from the server for our
        # old-style Toontown login, via the "account-old-auth 1"
        # Configrc option.  This is normally used only in the
        # developmernt environment.
        self.notify.debug('handleLoginResponseMsg1')
        if self.notify.getDebug():
            dgram = di.getDatagram()
            dgram.dumpHex(ostream)


        # First, get the local time of day that we receive the message
        # from the server, so we can compare our clock to the server's
        # clock.
        now = time.time()
        
        accountDetailRecord = AccountDetailRecord()
        self.cr.accountDetailRecord = accountDetailRecord

        # Get the return code
        returnCode = di.getUint8()
        accountCode = di.getUint32()
        errorString = self.getExtendedErrorMsg(di.getString())

        # The current time of day at the server.
        sec = di.getUint32()
        usec = di.getUint32()
        serverTime = sec + usec / 1000000.0
        serverDelta = serverTime - now
        self.cr.serverTimeUponLogin = serverTime
        self.cr.clientTimeUponLogin = now
        self.cr.globalClockRealTimeUponLogin = globalClock.getRealTime()
        if hasattr(self.cr, 'toontownTimeManager'):
            self.cr.toontownTimeManager.updateLoginTimes(
                serverTime, now, self.cr.globalClockRealTimeUponLogin) 
        
        self.cr.setServerDelta(serverDelta)
        self.notify.setServerDelta(serverDelta, 28800)

        if di.getRemainingSize() > 0:
            self.cr.accountDays = self.parseAccountDays(di.getInt32())
        else:
            self.cr.accountDays = 100000 
            
        if di.getRemainingSize() > 0:
            WhiteListResponse = di.getString()
        else:
            WhiteListResponse = "NO"

        if WhiteListResponse == "YES":
            self.cr.whiteListChatEnabled = 1
        else:
            self.cr.whiteListChatEnabled = 0

        # an example last logged in is "2009-11-09 17:51:51"
        self.lastLoggedInStr = base.config.GetString('last-logged-in',"")
        self.cr.lastLoggedIn = datetime.now()
        if hasattr(self.cr, 'toontownTimeManager'):
            self.cr.lastLoggedIn = self.cr.toontownTimeManager.convertStrToToontownTime(self.lastLoggedInStr)
        # developer login with a config override
        self.cr.withParentAccount = base.config.GetBool('dev-with-parent-account',0)
        
        self.notify.info("Login response return code %s" % (returnCode))
    

        if returnCode == 0:
            # if the return code is good, record the account code
            # and request the avatar list.
            self.__handleLoginSuccess()
        elif returnCode == 12:
            self.notify.info("Bad password")
            self.fsm.request(
                "showLoginFailDialog",
                [OTPLocalizer.LoginScreenBadPassword])
        elif returnCode == 14:
            self.notify.info("Bad word in user name")
            self.fsm.request(
                "showLoginFailDialog",
                [OTPLocalizer.LoginScreenInvalidUserName])
        elif returnCode == 129:
            self.notify.info("Username not found")
            self.fsm.request(
                "showLoginFailDialog",
                [OTPLocalizer.LoginScreenUserNameNotFound])
        else:
            # if the return code is bad, go to reject mode
            self.notify.info("Login failed: %s" % (errorString))
            messenger.send(self.doneEvent, [{'mode': 'reject'}])
Пример #6
0
    def handleLoginResponseMsg2(self, di):
        #print("LoginScreen - handleLoginResponseMsg2")
        # We having gotten a login response from the server for our
        # normal Toontown login, via the account server.
        
        # First, get the local time of day that we receive the message
        # from the server, so we can compare our clock to the server's
        # clock.
        self.notify.debug('handleLoginResponseMsg2')
        if self.notify.getDebug():
            dgram = di.getDatagram()
            dgram.dumpHex(ostream)
            
        now = time.time()

        # Get the return code
        returnCode = di.getUint8()
        errorString = self.getExtendedErrorMsg(di.getString())

        # The account name and chat flag are redundant if we logged in
        # via a user-supplied username and password, since we already
        # knew these; but if we logged in via LoginGoAccount, we don't
        # know this stuff until the server cracks open the token and
        # sends them back to us.  So we need to save these at least in
        # this case, but it does no harm to save them in all cases
        # anyway.
        self.userName = di.getString()
        self.cr.userName = self.userName
        
        accountDetailRecord = AccountDetailRecord()
        self.cr.accountDetailRecord = accountDetailRecord

        # Chat:
        canChat = di.getUint8()
        self.cr.secretChatAllowed = canChat
        self.notify.info("Chat from game server login: %s" % (canChat))

        # The current time of day at the server
        sec = di.getUint32()
        usec = di.getUint32()
        serverTime = sec + usec / 1000000.0
        self.cr.serverTimeUponLogin = serverTime
        self.cr.clientTimeUponLogin = now
        self.cr.globalClockRealTimeUponLogin = globalClock.getRealTime()
        if hasattr(self.cr, 'toontownTimeManager'):
            self.cr.toontownTimeManager.updateLoginTimes(
                serverTime, now, self.cr.globalClockRealTimeUponLogin)         
        serverDelta = serverTime - now
        self.cr.setServerDelta(serverDelta)
        self.notify.setServerDelta(serverDelta, 28800)

        # Whether the user is paid
        self.isPaid = di.getUint8()
        self.cr.setIsPaid(self.isPaid)
        if self.isPaid:
            launcher.setPaidUserLoggedIn()
        self.notify.info("Paid from game server login: %s" % (self.isPaid))
            
        # default
        self.cr.resetPeriodTimer(None)
        if di.getRemainingSize() >= 4:
            # The amount of time remaining on the user's account for
            # this period, in minutes.
            minutesRemaining = di.getInt32()
            self.notify.info("Minutes remaining from server %s" % (minutesRemaining))

            if (minutesRemaining >= 0):
                self.notify.info("Spawning period timer")
                self.cr.resetPeriodTimer(minutesRemaining * 60)
            elif (self.isPaid):
                self.notify.warning("Negative minutes remaining for paid user (?)")
            else:
                self.notify.warning("Not paid, but also negative minutes remaining (?)")
        else:
            self.notify.info("Minutes remaining not returned from server; not spawning period timer")

        familyStr = di.getString()
        WhiteListResponse = di.getString()
        
        if WhiteListResponse == "YES":
            self.cr.whiteListChatEnabled = 1
        else:
            self.cr.whiteListChatEnabled = 0
        
        if di.getRemainingSize() > 0:
            self.cr.accountDays = self.parseAccountDays(di.getInt32())
        else:
            self.cr.accountDays = 100000

        if di.getRemainingSize() > 0:
            self.lastLoggedInStr = di.getString()
            self.notify.info("last logged in = %s" % self.lastLoggedInStr)
        else:
            self.lastLoggedInStr = ""
        self.cr.lastLoggedIn = datetime.now()
        if hasattr(self.cr, 'toontownTimeManager'):
            self.cr.lastLoggedIn = self.cr.toontownTimeManager.convertStrToToontownTime(self.lastLoggedInStr)
        # old style login_2 does Not have an associated parent account
        self.cr.withParentAccount = False
                
        self.notify.info("Login response return code %s" % (returnCode))

        if returnCode == 0:
            self.__handleLoginSuccess()

        elif returnCode == -13:
            # This error code means the user has entered a valid
            # password, but he has already used up his allowable time
            # for the period.

            # In practice, we never see this error message, since the
            # server sends us the "go get lost" message instead.  So
            # this code is untested.  But it remains, in case the
            # server semantics should change one day.
            self.notify.info("Period Time Expired")
            self.fsm.request("showLoginFailDialog",
                             [OTPLocalizer.LoginScreenPeriodTimeExpired])
        else:
            # If the return code is anything else, something went
            # wrong.  Better just go to reject mode and bail out.
            self.notify.info("Login failed: %s" % (errorString))
            messenger.send(self.doneEvent, [{'mode': 'reject'}])
Пример #7
0
    def handleLoginResponseMsg3(self, di):
        #print("LoginScreen - handleLoginResponseMsg3")
        # We having gotten a login response from the server for our
        # normal Pirates login, via the DISL account system
        
        # First, get the local time of day that we receive the message
        # from the server, so we can compare our clock to the server's
        # clock.
        now = time.time()

        # Get the return code
        returnCode = di.getInt8()
        errorString = self.getExtendedErrorMsg(di.getString())

        self.notify.info("Login response return code %s" % (returnCode))

        if returnCode != 0:
            # If the return code is non-zero, something went
            # wrong.  Better just go to reject mode and bail out.
            self.notify.info("Login failed: %s" % (errorString))
            messenger.send(self.doneEvent, [{'mode': 'reject'}])
            return

        accountDetailRecord = AccountDetailRecord()

        # chat permission fields
        accountDetailRecord.openChatEnabled = (di.getString() == "YES")
        accountDetailRecord.createFriendsWithChat = (di.getString() == "YES")
        chatCodeCreation = di.getString()
        accountDetailRecord.chatCodeCreation = (chatCodeCreation == "YES")
        parentControlledChat = (chatCodeCreation == "PARENT")
        access = di.getString()
        if access == "VELVET":
            access = OTPGlobals.AccessVelvetRope
        elif access == "FULL":
            access = OTPGlobals.AccessFull
        else:
            self.notify.warning("Unknown access: %s" % access)
            access = OTPGlobals.AccessUnknown        
        accountDetailRecord.piratesAccess = access
        accountDetailRecord.familyAccountId = di.getInt32()
        accountDetailRecord.playerAccountId = di.getInt32()
        accountDetailRecord.playerName = di.getString()
        accountDetailRecord.playerNameApproved = di.getInt8()
        accountDetailRecord.maxAvatars = di.getInt32()

        # Remember these fields on the client repository
        self.cr.openChatAllowed = accountDetailRecord.openChatEnabled
        self.cr.secretChatAllowed = accountDetailRecord.chatCodeCreation or parentControlledChat
        self.cr.setIsPaid(accountDetailRecord.piratesAccess)
        self.userName = accountDetailRecord.playerName
        self.cr.userName = accountDetailRecord.playerName

        # Now retrieve the subscription information
        accountDetailRecord.numSubs = di.getUint16()

        for i in range(accountDetailRecord.numSubs):
            subDetailRecord = SubDetailRecord()
            subDetailRecord.subId = di.getUint32()
            subDetailRecord.subOwnerId = di.getUint32()
            subDetailRecord.subName = di.getString()
            subDetailRecord.subActive = di.getString()
            access = di.getString()
            if access == "VELVET":
                access = OTPGlobals.AccessVelvetRope
            elif access == "FULL": 
                access = OTPGlobals.AccessFull
            else:
                access = OTPGlobals.AccessUnknown
            subDetailRecord.subAccess = access
            subDetailRecord.subLevel = di.getUint8()
            subDetailRecord.subNumAvatars = di.getUint8()
            subDetailRecord.subNumConcur = di.getUint8()
            subDetailRecord.subFounder = (di.getString() == "YES")
            accountDetailRecord.subDetails[subDetailRecord.subId] = subDetailRecord

        accountDetailRecord.WLChatEnabled = (di.getString() == "YES")
        if accountDetailRecord.WLChatEnabled:
            self.cr.whiteListChatEnabled = 1
        else:
            self.cr.whiteListChatEnabled = 0

        self.notify.info("End of DISL token parse")
        self.notify.info("accountDetailRecord: %s" % accountDetailRecord)

        self.cr.accountDetailRecord = accountDetailRecord
        self.__handleLoginSuccess()
Пример #8
0
    def __init__(self, serverVersion, launcher=None):
        self.loadingScreen = base.loadingScreen
        self.loadingScreen.parent = self
        self.accept('connectionIssue', self.loadingScreen.hide)
        self.accept('connectionRetrying', self.loadingScreen.show)
        OTPClientRepository.__init__(self,
                                     serverVersion,
                                     launcher,
                                     playGame=PlayGame.PlayGame)
        self.createAvatarClass = DistributedPlayerPirate.DistributedPlayerPirate
        self.tradeManager = None
        self.pvpManager = None
        self.csm = self.generateGlobalObject(
            OtpDoGlobals.OTP_DO_ID_CLIENT_SERVICES_MANAGER,
            'ClientServicesManager')
        #self.avatarManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PIRATES_AVATAR_MANAGER, 'DistributedAvatarManager')
        #self.chatManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_CHAT_MANAGER, 'DistributedChatManager')
        #self.crewMatchManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PIRATES_CREW_MATCH_MANAGER, 'DistributedCrewMatchManager')
        #self.avatarFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_AVATAR_FRIENDS_MANAGER, 'PCAvatarFriendsManager')
        #self.playerFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PLAYER_FRIENDS_MANAGER, 'PCPlayerFriendsManager')
        #self.guildManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PIRATES_GUILD_MANAGER, 'PCGuildManager')
        #self.speedchatRelay = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PIRATES_SPEEDCHAT_RELAY, 'PiratesSpeedchatRelay')
        #self.shipLoader = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PIRATES_SHIP_MANAGER, 'DistributedShipLoader')
        #self.matchMaker = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PIRATES_MATCH_MAKER, 'DistributedMatchMaker')
        base.loadingScreen.tick()
        #self.codeRedemption = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PIRATES_CODE_REDEMPTION, 'CodeRedemption')
        base.loadingScreen.tick()
        #self.settingsMgr = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PIRATES_SETTINGS_MANAGER, 'PiratesSettingsMgr')
        #self.statusDatabase = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_STATUS_DATABASE, 'StatusDatabase')
        self.wantSeapatch = base.config.GetBool('want-seapatch', 1)
        self.wantSpecialEffects = base.config.GetBool('want-special-effects',
                                                      1)
        self.wantMakeAPirate = base.config.GetBool('wantMakeAPirate', 0)
        self.forceTutorial = base.config.GetBool('force-tutorial', 0)
        self.skipTutorial = base.config.GetBool('skip-tutorial', 0)
        self.tutorialObject = None
        self.avChoiceDoneEvent = None
        self.avChoice = None
        self.avCreate = None
        self.currentCutscene = None
        self.activeWorld = None
        self.oldWorld = None
        self.teleportMgr = None
        self.treasureMap = None
        self.newsManager = None
        self.distributedDistrict = None
        self.district = None
        self.profileMgr = None
        self.battleMgr = BattleManager.BattleManager(self)
        self.combatAnims = CombatAnimations.CombatAnimations()
        self.interactionMgr = InteractionManager.InteractionManager()
        self.currCamParent = None
        self.uidMgr = UniqueIdManager.UniqueIdManager(self)
        self.fakeMSP = None
        self.questDynMap = QuestLadderDynMap.QuestLadderDynMap()
        self.questDependency = QuestLadderDependency()
        self.questChoiceSibsMap = QuestChoiceDynMap()
        base.loadingScreen.beginStep('MasterHumans', 52, 45)
        self.humanHigh = [MasterHuman.MasterHuman(), MasterHuman.MasterHuman()]
        self.humanHigh[0].billboardNode.removeNode()
        self.humanHigh[1].billboardNode.removeNode()
        self.humanHigh[0].style = HumanDNA.HumanDNA('m')
        self.humanHigh[1].style = HumanDNA.HumanDNA('f')
        self.humanHigh[0].generateHuman('m')
        base.loadingScreen.tick()
        self.humanHigh[1].generateHuman('f')
        base.loadingScreen.tick()
        self.humanHigh[0].ignoreAll()
        self.humanHigh[1].ignoreAll()
        self.humanHigh[0].stopBlink()
        self.humanHigh[1].stopBlink()
        self.humanLow = [MasterHuman.MasterHuman(), MasterHuman.MasterHuman()]
        self.humanLow[0].billboardNode.removeNode()
        self.humanLow[1].billboardNode.removeNode()
        self.humanLow[0].style = HumanDNA.HumanDNA('m')
        self.humanLow[1].style = HumanDNA.HumanDNA('f')
        self.humanLow[0].generateHuman('m')
        base.loadingScreen.tick()
        self.humanLow[1].generateHuman('f')
        base.loadingScreen.tick()
        base.loadingScreen.endStep('MasterHumans')
        self.humanLow[0].ignoreAll()
        self.humanLow[1].ignoreAll()
        self.humanLow[0].stopBlink()
        self.humanLow[1].stopBlink()
        for i in range(2):
            self.humanLow[i]._Actor__sortedLODNames = ['500']
            del self.humanLow[i]._Actor__partBundleDict['2000']
            del self.humanLow[i]._Actor__partBundleDict['1000']
            self.humanLow[i].getLOD('2000').detachNode()
            self.humanLow[i].getLOD('1000').detachNode()
            self.humanLow[i].getLODNode().clearSwitches()
            self.humanLow[i].getLODNode().addSwitch(10000, 0)

        if base.options.getCharacterDetailSetting() == 0:
            self.human = self.humanLow
        else:
            self.human = self.humanHigh
        A = AvatarTypes
        del A
        self.preloadedCutscenes = {}
        self.defaultShard = 0
        if __dev__:
            __builtin__.go = self.getDo
            self.effectTypes = {
                'damageSmoke': ['BlackSmoke'],
                'damageFire': ['Fire'],
                'cannonDeckFire': ['CannonSmokeSimple', 'CannonBlastSmoke'],
                'cannonBSFire': [
                    'MuzzleFlameBS', 'CannonSmokeSimpleBS',
                    'CannonBlastSmokeBS', 'GrapeshotEffectBS'
                ],
                'cannonHit': ['SimpleSmokeCloud', 'ExplosionFlip'],
                'cannonSplash': ['CannonSplash']
            }
            self.effectToggles = {}

        self.cannonballCollisionDebug = 1
        self.npcManager = NPCManager.NPCManager()
        self.accountDetailRecord = AccountDetailRecord()
Пример #9
0
 def handleLoginToontownResponse(self, di):
     self.notify.debug("handleLoginToontownResponse")
     if 1:
         if base.logPrivateInfo:
             dgram = di.getDatagram()
             dgram.dumpHex(ostream)
     now = time.time()
     returnCode = di.getUint8()
     respString = di.getString()
     errorString = self.getExtendedErrorMsg(respString)
     self.accountNumber = di.getUint32()
     self.cr.DISLIdFromLogin = self.accountNumber
     self.accountName = di.getString()
     self.accountNameApproved = di.getUint8()
     accountDetailRecord = AccountDetailRecord()
     self.cr.accountDetailRecord = accountDetailRecord
     self.openChatEnabled = di.getString() == "YES"
     createFriendsWithChat = di.getString()
     canChat = createFriendsWithChat == "YES" or createFriendsWithChat == "CODE"
     self.cr.secretChatAllowed = canChat
     if base.logPrivateInfo:
         self.notify.info(
             "CREATE_FRIENDS_WITH_CHAT from game server login: %s %s" %
             (createFriendsWithChat, canChat))
     self.chatCodeCreationRule = di.getString()
     self.cr.chatChatCodeCreationRule = self.chatCodeCreationRule
     if base.logPrivateInfo:
         self.notify.info("Chat code creation rule = %s" %
                          self.chatCodeCreationRule)
     self.cr.secretChatNeedsParentPassword = self.chatCodeCreationRule == "PARENT"
     sec = di.getUint32()
     usec = di.getUint32()
     serverTime = sec + (usec / 1000000.0)
     self.cr.serverTimeUponLogin = serverTime
     self.cr.clientTimeUponLogin = now
     self.cr.globalClockRealTimeUponLogin = globalClock.getRealTime()
     if hasattr(self.cr, "toontownTimeManager"):
         self.cr.toontownTimeManager.updateLoginTimes(
             serverTime, now, self.cr.globalClockRealTimeUponLogin)
     serverDelta = serverTime - now
     self.cr.setServerDelta(serverDelta)
     self.notify.setServerDelta(serverDelta, 28800)
     access = di.getString()
     self.cr.parentPasswordSet = True
     launcher.setUserLoggedIn()
     WhiteListResponse = di.getString()
     if WhiteListResponse == "YES":
         self.cr.whiteListChatEnabled = 1
     else:
         self.cr.whiteListChatEnabled = 0
     self.lastLoggedInStr = di.getString()
     self.cr.lastLoggedIn = datetime.now()
     if hasattr(self.cr, "toontownTimeManager"):
         self.cr.lastLoggedIn = self.cr.toontownTimeManager.convertStrToToontownTime(
             self.lastLoggedInStr)
     if di.getRemainingSize() > 0:
         self.cr.accountDays = self.parseAccountDays(di.getInt32())
     else:
         self.cr.accountDays = 100000
     self.toonAccountType = di.getString()
     if self.toonAccountType == "WITH_PARENT_ACCOUNT":
         self.cr.withParentAccount = True
     elif self.toonAccountType == "NO_PARENT_ACCOUNT":
         self.cr.withParentAccount = False
     else:
         self.notify.error("unknown toon account type %s" %
                           self.toonAccountType)
     if base.logPrivateInfo:
         self.notify.info("toonAccountType=%s" % self.toonAccountType)
     self.userName = di.getString()
     self.cr.userName = self.userName
     self.notify.info("Login response return code %s" % returnCode)
     if returnCode == 0:
         self.__handleLoginSuccess()
     elif returnCode == -13:
         self.notify.info("Period Time Expired")
         self.fsm.request("showLoginFailDialog",
                          [OTPLocalizer.LoginScreenPeriodTimeExpired])
     else:
         self.notify.info("Login failed: %s" % errorString)
         messenger.send(self.doneEvent, [{'mode': 'reject'}])
Пример #10
0
 def handleLoginResponseMsg2(self, di):
     self.notify.debug('handleLoginResponseMsg2')
     if base.logPrivateInfo:
         if self.notify.getDebug():
             dgram = di.getDatagram()
             dgram.dumpHex(ostream)
     now = time.time()
     returnCode = di.getUint8()
     errorString = self.getExtendedErrorMsg(di.getString())
     self.userName = di.getString()
     self.cr.userName = self.userName
     accountDetailRecord = AccountDetailRecord()
     self.cr.accountDetailRecord = accountDetailRecord
     canChat = di.getUint8()
     self.cr.secretChatAllowed = canChat
     if base.logPrivateInfo:
         self.notify.info('Chat from game server login: %s' % canChat)
     sec = di.getUint32()
     usec = di.getUint32()
     serverTime = sec + usec / 1000000.0
     self.cr.serverTimeUponLogin = serverTime
     self.cr.clientTimeUponLogin = now
     self.cr.globalClockRealTimeUponLogin = globalClock.getRealTime()
     if hasattr(self.cr, 'toontownTimeManager'):
         self.cr.toontownTimeManager.updateLoginTimes(
             serverTime, now, self.cr.globalClockRealTimeUponLogin)
     serverDelta = serverTime - now
     self.cr.setServerDelta(serverDelta)
     self.notify.setServerDelta(serverDelta, 28800)
     launcher.setUserLoggedIn()
     familyStr = di.getString()
     WhiteListResponse = di.getString()
     if WhiteListResponse == 'YES':
         self.cr.whiteListChatEnabled = 1
     else:
         self.cr.whiteListChatEnabled = 0
     if di.getRemainingSize() > 0:
         self.cr.accountDays = self.parseAccountDays(di.getInt32())
     else:
         self.cr.accountDays = 100000
     if di.getRemainingSize() > 0:
         self.lastLoggedInStr = di.getString()
         self.notify.info('last logged in = %s' % self.lastLoggedInStr)
     else:
         self.lastLoggedInStr = ''
     self.cr.lastLoggedIn = datetime.now()
     if hasattr(self.cr, 'toontownTimeManager'):
         self.cr.lastLoggedIn = self.cr.toontownTimeManager.convertStrToToontownTime(
             self.lastLoggedInStr)
     self.cr.withParentAccount = False
     self.notify.info('Login response return code %s' % returnCode)
     if returnCode == 0:
         self.__handleLoginSuccess()
     elif returnCode == -13:
         self.notify.info('Period Time Expired')
         self.fsm.request('showLoginFailDialog',
                          [OTPLocalizer.LoginScreenPeriodTimeExpired])
     else:
         self.notify.info('Login failed: %s' % errorString)
         messenger.send(self.doneEvent, [{'mode': 'reject'}])
     return
Пример #11
0
    def handleLoginResponseMsg3(self, di):
        now = time.time()
        returnCode = di.getInt8()
        errorString = self.getExtendedErrorMsg(di.getString())
        self.notify.info('Login response return code %s' % returnCode)
        if returnCode != 0:
            self.notify.info('Login failed: %s' % errorString)
            messenger.send(self.doneEvent, [{'mode': 'reject'}])
            return
        accountDetailRecord = AccountDetailRecord()
        accountDetailRecord.openChatEnabled = di.getString() == 'YES'
        accountDetailRecord.createFriendsWithChat = di.getString() == 'YES'
        chatCodeCreation = di.getString()
        accountDetailRecord.chatCodeCreation = chatCodeCreation == 'YES'
        parentControlledChat = chatCodeCreation == 'PARENT'
        accountDetailRecord.familyAccountId = di.getInt32()
        accountDetailRecord.playerAccountId = di.getInt32()
        accountDetailRecord.playerName = di.getString()
        accountDetailRecord.playerNameApproved = di.getInt8()
        accountDetailRecord.maxAvatars = di.getInt32()
        self.cr.openChatAllowed = accountDetailRecord.openChatEnabled
        self.cr.secretChatAllowed = accountDetailRecord.chatCodeCreation or parentControlledChat
        self.userName = accountDetailRecord.playerName
        self.cr.userName = accountDetailRecord.playerName
        accountDetailRecord.numSubs = di.getUint16()
        for i in xrange(accountDetailRecord.numSubs):
            subDetailRecord = SubDetailRecord()
            subDetailRecord.subId = di.getUint32()
            subDetailRecord.subOwnerId = di.getUint32()
            subDetailRecord.subName = di.getString()
            subDetailRecord.subActive = di.getString()
            subDetailRecord.subLevel = di.getUint8()
            subDetailRecord.subNumAvatars = di.getUint8()
            subDetailRecord.subNumConcur = di.getUint8()
            subDetailRecord.subFounder = di.getString() == 'YES'
            accountDetailRecord.subDetails[
                subDetailRecord.subId] = subDetailRecord

        accountDetailRecord.WLChatEnabled = di.getString() == 'YES'
        if accountDetailRecord.WLChatEnabled:
            self.cr.whiteListChatEnabled = 1
        else:
            self.cr.whiteListChatEnabled = 0
        self.notify.info('End of DISL token parse')
        if base.logPrivateInfo:
            self.notify.info('accountDetailRecord: %s' % accountDetailRecord)
        self.cr.accountDetailRecord = accountDetailRecord
        self.__handleLoginSuccess()
Пример #12
0
    def handleAccountUsage(self, di):
        priorAccount = di.getUint32() # Historic - used only in __dev__ atm
        newAccount = di.getUint32()

        if priorAccount == 0 and newAccount == 0:
            assert self.notify.debug("priorAccount==0 and newAccount==0, ignoring accountUsage message")
            return

        accountDetailRecord = AccountDetailRecord()
        accountDetailRecord.openChatEnabled = (di.getString() == "YES")
        accountDetailRecord.createFriendsWithChat = (di.getString() == "YES")
        accountDetailRecord.chatCodeCreation = (di.getString() == "YES")
        access = di.getString()
        if access == "VELVET":
            access = OTPGlobals.AccessVelvetRope
        elif access == "FULL":
            access = OTPGlobals.AccessFull
        else:
            access = OTPGlobals.AccessUnknown
        accountDetailRecord.piratesAccess = access
        accountDetailRecord.familyAccountId = di.getInt32()
        accountDetailRecord.playerAccountId = di.getInt32()
        accountDetailRecord.playerName = di.getString()
        accountDetailRecord.playerNameApproved = di.getInt8()
        accountDetailRecord.maxAvatars = di.getInt32()
        accountDetailRecord.numFamilyMembers = di.getInt16()
        accountDetailRecord.familyMembers = []
        for i in range(accountDetailRecord.numFamilyMembers):
            accountDetailRecord.familyMembers.append(di.getInt32())

        logoutReason = di.getInt32()

        # Now retrieve the subscription information
        accountDetailRecord.numSubs = di.getUint16()

        for i in range(accountDetailRecord.numSubs):
            subDetailRecord = SubDetailRecord()
            subDetailRecord.subId = di.getUint32()
            subDetailRecord.subOwnerId = di.getUint32()
            subDetailRecord.subName = di.getString()
            subDetailRecord.subActive = di.getString()
            access = di.getString()
            if access == "VELVET":
                access = OTPGlobals.AccessVelvetRope
            elif access == "FULL":
                access = OTPGlobals.AccessFull
            else:
                access = OTPGlobals.AccessUnknown
            subDetailRecord.subAccess = access
            subDetailRecord.subLevel = di.getUint8()
            subDetailRecord.subNumAvatars = di.getUint8()
            subDetailRecord.subNumConcur = di.getUint8()
            subDetailRecord.subFounder = (di.getString() == "YES")
            # Add this subscription to the dict on the account record
            accountDetailRecord.subDetails[subDetailRecord.subId] = subDetailRecord

        # How many avatar slots total do you get in this game?
        accountDetailRecord.maxAvatarSlots = di.getInt8()

        assert self.notify.debug("accountDetailRecord: %s" % accountDetailRecord)

        if priorAccount:
            # Send any previous account offline
            self.accountOffline(priorAccount)
            pass

        if newAccount:
            # Set up the new guy
            self.accountOnline(newAccount, accountDetailRecord)
Пример #13
0
 def handleLoginToontownResponse(self, responseBlob):
     self.notify.debug("handleLoginToontownResponse")
     responseData = json.loads(responseBlob)
     now = time.time()
     returnCode = responseData.get('returnCode')
     respString = responseData.get('respString')
     errorString = self.getExtendedErrorMsg(respString)
     self.accountNumber = responseData.get('accountNumber')
     self.cr.DISLIdFromLogin = self.accountNumber
     accountDetailRecord = AccountDetailRecord()
     self.cr.accountDetailRecord = accountDetailRecord
     createFriendsWithChat = responseData.get('createFriendsWithChat')
     canChat = createFriendsWithChat == "YES" or createFriendsWithChat == "CODE"
     self.cr.secretChatAllowed = canChat
     if base.logPrivateInfo:
         self.notify.info(
             "CREATE_FRIENDS_WITH_CHAT from game server login: %s %s" %
             (createFriendsWithChat, canChat))
     self.chatCodeCreationRule = responseData.get(
         'chatCodeCreationRule')
     self.cr.chatChatCodeCreationRule = self.chatCodeCreationRule
     if base.logPrivateInfo:
         self.notify.info("Chat code creation rule = %s" %
                          self.chatCodeCreationRule)
     self.cr.secretChatNeedsParentPassword = self.chatCodeCreationRule == "PARENT"
     serverTime = responseData.get('serverTime')
     self.cr.serverTimeUponLogin = serverTime
     self.cr.clientTimeUponLogin = now
     self.cr.globalClockRealTimeUponLogin = globalClock.getRealTime()
     if hasattr(self.cr, "toontownTimeManager"):
         self.cr.toontownTimeManager.updateLoginTimes(
             serverTime, now, self.cr.globalClockRealTimeUponLogin)
     serverDelta = serverTime - now
     self.cr.setServerDelta(serverDelta)
     self.notify.setServerDelta(serverDelta, 28800)
     access = responseData.get('access')
     self.isPaid = access == "FULL"
     self.cr.parentPasswordSet = self.isPaid
     self.cr.setIsPaid(self.isPaid)
     if self.isPaid:
         launcher.setPaidUserLoggedIn()
     if base.logPrivateInfo:
         self.notify.info("Paid from game server login: %s" %
                          self.isPaid)
     WhiteListResponse = responseData.get('WhiteListResponse')
     if WhiteListResponse == "YES":
         self.cr.whiteListChatEnabled = 1
     else:
         self.cr.whiteListChatEnabled = 0
     self.lastLoggedInStr = responseData.get('lastLoggedInStr')
     self.cr.lastLoggedIn = datetime.now()
     if hasattr(self.cr, "toontownTimeManager"):
         self.cr.lastLoggedIn = self.cr.toontownTimeManager.convertStrToToontownTime(
             self.lastLoggedInStr)
     accountDaysFromServer = responseData.get('accountDays')
     if accountDaysFromServer is not None:
         self.cr.accountDays = self.parseAccountDays(
             accountDaysFromServer)
     else:
         self.cr.accountDays = 100000
     self.toonAccountType = responseData.get('toonAccountType')
     if self.toonAccountType == "WITH_PARENT_ACCOUNT":
         self.cr.withParentAccount = True
     elif self.toonAccountType == "NO_PARENT_ACCOUNT":
         self.cr.withParentAccount = False
     else:
         self.notify.error("unknown toon account type %s" %
                           self.toonAccountType)
     if base.logPrivateInfo:
         self.notify.info("toonAccountType=%s" % self.toonAccountType)
     self.userName = responseData.get('userName')
     self.cr.userName = self.userName
     self.notify.info("Login response return code %s" % returnCode)
     if returnCode == 0:
         self.__handleLoginSuccess()
     elif returnCode == -13:
         self.notify.info("Period Time Expired")
         self.fsm.request("showLoginFailDialog",
                          [OTPLocalizer.LoginScreenPeriodTimeExpired])
     else:
         self.notify.info("Login failed: %s" % errorString)
         messenger.send(self.doneEvent, [{'mode': 'reject'}])
Пример #14
0
    def handleLoginResponseMsg3(self, di):
        now = time.time()
        returnCode = di.getInt8()
        errorString = self.getExtendedErrorMsg(di.getString())
        self.notify.info('Login response return code %s' % returnCode)
        if returnCode != 0:
            self.notify.info('Login failed: %s' % errorString)
            messenger.send(self.doneEvent, [{'mode': 'reject'}])
            return None

        accountDetailRecord = AccountDetailRecord()
        accountDetailRecord.openChatEnabled = di.getString() == 'YES'
        accountDetailRecord.createFriendsWithChat = di.getString() == 'YES'
        chatCodeCreation = di.getString()
        accountDetailRecord.chatCodeCreation = chatCodeCreation == 'YES'
        parentControlledChat = chatCodeCreation == 'PARENT'
        access = di.getString()
        if access == 'VELVET':
            access = OTPGlobals.AccessVelvetRope
        elif access == 'FULL':
            access = OTPGlobals.AccessFull
        else:
            self.notify.warning('Unknown access: %s' % access)
            access = OTPGlobals.AccessUnknown
        accountDetailRecord.piratesAccess = access
        accountDetailRecord.familyAccountId = di.getInt32()
        accountDetailRecord.playerAccountId = di.getInt32()
        accountDetailRecord.playerName = di.getString()
        accountDetailRecord.playerNameApproved = di.getInt8()
        accountDetailRecord.maxAvatars = di.getInt32()
        self.cr.openChatAllowed = accountDetailRecord.openChatEnabled
        if not accountDetailRecord.chatCodeCreation:
            pass
        self.cr.secretChatAllowed = parentControlledChat
        self.cr.setIsPaid(accountDetailRecord.piratesAccess)
        self.userName = accountDetailRecord.playerName
        self.cr.userName = accountDetailRecord.playerName
        accountDetailRecord.numSubs = di.getUint16()
        for i in range(accountDetailRecord.numSubs):
            subDetailRecord = SubDetailRecord()
            subDetailRecord.subId = di.getUint32()
            subDetailRecord.subOwnerId = di.getUint32()
            subDetailRecord.subName = di.getString()
            subDetailRecord.subActive = di.getString()
            access = di.getString()
            if access == 'VELVET':
                access = OTPGlobals.AccessVelvetRope
            elif access == 'FULL':
                access = OTPGlobals.AccessFull
            else:
                access = OTPGlobals.AccessUnknown
            subDetailRecord.subAccess = access
            subDetailRecord.subLevel = di.getUint8()
            subDetailRecord.subNumAvatars = di.getUint8()
            subDetailRecord.subNumConcur = di.getUint8()
            subDetailRecord.subFounder = di.getString() == 'YES'
            accountDetailRecord.subDetails[
                subDetailRecord.subId] = subDetailRecord

        accountDetailRecord.WLChatEnabled = di.getString() == 'YES'
        if accountDetailRecord.WLChatEnabled:
            self.cr.whiteListChatEnabled = 1
        else:
            self.cr.whiteListChatEnabled = 0
        self.notify.info('End of DISL token parse')
        self.notify.info('accountDetailRecord: %s' % accountDetailRecord)
        self.cr.accountDetailRecord = accountDetailRecord
        self._LoginScreen__handleLoginSuccess()
Пример #15
0
 def handleLoginToontownResponse(self):
     self.notify.debug('handleLoginToontownResponse')
     if base.logPrivateInfo:
         dgram = di.getDatagram()
         dgram.dumpHex(ostream)
     now = time.time()
     returnCode = di.getUint8()
     respString = di.getString()
     errorString = self.getExtendedErrorMsg().respString
     self.accountNumber = di.getUint32()
     self.cr.DISLIdFromLogin = self.accountNumber
     self.accountName = di.getString()
     self.accountNameApproved = di.getUint8()
     accountDetailRecord = AccountDetailRecord()
     self.cr.accountDetailRecord = accountDetailRecord
     self.openChatEnabled = di.getString() == 'YES'
     createFriendsWithChat = di.getString()
     canChat = createFriendsWithChat == 'YES' or createFriendsWithChat == 'CODE'
     self.cr.secretChatAllowed = canChat
     if base.logPrivateInfo:
         self.notify.info(
             'CREATE_FRIENDS_WITH_CHAT from game server login: %s %s' %
             (createFriendsWithChat, canChat))
     self.chatCodeCreationRule = di.getString()
     self.cr.chatCodeCreationRule = self.chatCodeCreationRule
     if base.logPrivateInfo:
         self.notify.info('Chat code creation rule = %s' %
                          self.chatCodeCreationRule)
     self.cr.secretChatNeedsParentPassword = self.chatCodeCreationRule == 'PARENT'
     sec = di.getUint32()
     usec = di.getUint32()
     serverTime = sec + usec / 1000000.0
     self.cr.serverTimeUponLogin = serverTime
     self.cr.clientTimeUponLogin = now
     self.cr.globalClockRealTimeUponLogin = globalClock.getRealTime()
     if hasattr(self.cr, 'toontownTimeManager'):
         self.cr.toontownTimeManager.updateLoginTimes(
             serverTime, now, self.cr.globalClockRealTimeUponLogin)
     serverDelta = serverTime - now
     self.cr.setServerDelta(serverDelta)
     self.notify.setServerDelta(serverDelta, 28800)
     access = di.getString()
     self.isPaid = access == 'FULL'
     self.cr.parentPasswordSet = self.isPaid
     self.cr.setIsPaid(self.isPaid)
     if self.isPaid:
         launcher.setPaidUserLoggedIn()
     if base.logPrivateInfo:
         self.notify.info('Paid from game server login: %s' % self.isPaid)
     WhiteListResponse = di.getString()
     if WhiteListResponse == 'YES':
         self.cr.whiteListChatEnabled = 1
     else:
         self.cr.whiteListChatEnabled = 0
     self.lastLoggedInStr = di.getString()
     self.cr.lastLoggedIn = datetime.now()
     if hasattr(self.cr, 'toontownTimeManager'):
         self.cr.lastLoggedIn = self.cr.toontownTimeManager.convertStrToToontownTime(
             self.lastLoggedInStr)
     if di.getRemainingSize > 0:
         self.cr.accountDays = self.parseAccountDays(di.getInt32())
     else:
         self.cr.accountDays = 100000