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()
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()
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 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 else: if 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()
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)
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 self.cr.whiteListChatEnabled = 0 self.notify.info('End of DISL token parse') self.notify.info('accountDetailRecord: %s' % accountDetailRecord) self.cr.accountDetailRecord = accountDetailRecord self.__handleLoginSuccess() def handleLoginResponseMsg2(self, di): self.notify.debug('handleLoginResponseMsg2')