def handleSetNameTypedAnswerMsg(self, di): self.notify.debug('handleSetNameTypedAnswerMsg') self.cleanupWaitForServer() newavId = di.getUint32() if newavId and newavId != self.avId: self.notify.debug("doid's don't match up!") self.rejectName(TTLocalizer.NameError) returnCode = di.getUint16() if newavId == 0: if returnCode == 0: pendingname = di.getString() approvedname = di.getString() rejectedname = di.getString() if pendingname != '': self.notify.debug('name check pending') self.fsm.request('Approval') elif approvedname != '': self.notify.debug('name check accepted') self.nameAction = 2 self.serverCreateAvatar() elif rejectedname != '': self.notify.debug('name check rejected') self.fsm.request('TypeAName') self.rejectName(TTLocalizer.NameError) else: self.notify.debug('typed name response did not contain any return fields') self.rejectName(TTLocalizer.NameError) elif returnCode == 0: wishname = di.getString() approvedname = di.getString() rejectedname = di.getString() if approvedname != '': style = self.toon.getStyle() avDNA = style.makeNetString() self.names[0] = self.nameEntry.get() self.notify.debug('typed name accepted') newPotAv = PotentialAvatar.PotentialAvatar(newavId, self.names, avDNA, self.index, 0) self.avList.append(newPotAv) self.fsm.request('Accepted') elif wishname != '': style = self.toon.getStyle() avDNA = style.makeNetString() self.names[1] = self.nameEntry.get() self.notify.debug('typed name needs approval') newPotAv = PotentialAvatar.PotentialAvatar(newavId, self.names, avDNA, self.index, 1) if not self.newwarp: self.avList.append(newPotAv) self.fsm.request('ApprovalAccepted') elif rejectedname != '': self.fsm.request('Rejected') else: self.notify.debug("name typed accepted but didn't fill any return fields") self.rejectName(TTLocalizer.NameError) else: self.notify.debug('name typed rejected') self.rejectName(TTLocalizer.NameError) return None
def handleCreateAvatarResponseMsg(self, di): self.notify.debug('handleCreateAvatarResponseMsg') echoContext = di.getUint16() returnCode = di.getUint8() if returnCode == 0: self.notify.debug('avatar with default name accepted') self.avId = di.getUint32() self.avExists = 1 self.logAvatarCreation() if self.nameAction == 0: self.toon.setName(self.names[0]) newPotAv = PotentialAvatar.PotentialAvatar(self.avId, self.names, self.newDNA, self.index, 1) self.avList.append(newPotAv) self.doneStatus = 'done' self.storeSkipTutorialRequest() messenger.send(self.doneEvent) elif self.nameAction == 1: self.checkNamePattern() elif self.nameAction == 2: self.checkNameTyped() else: self.notify.debug('avatar invalid nameAction') self.rejectName(TTLocalizer.NameError) else: self.notify.debug('avatar rejected') self.rejectName(TTLocalizer.NameError) return None
def handleNameTypedResponse(self, avId, status): self.notify.debug('handleNameTypedResponse') self.cleanupWaitForServer() if avId and avId != self.avId: self.notify.debug("doid's don't match up!") self.rejectName(TTLocalizer.NameError) if avId == 0: if status == 1: self.notify.debug('name check pending') self.fsm.request('Approval') elif status == 0: self.notify.debug('name check rejected') self.fsm.request('TypeAName') self.rejectName(TTLocalizer.NameError) else: self.notify.debug('typed name response did not contain any return fields') self.rejectName(TTLocalizer.NameError) else: if status == 1: style = self.toon.getStyle() avDNA = style.makeNetString() self.names[1] = self.nameEntry.get() self.notify.debug('typed name needs approval') newPotAv = PotentialAvatar.PotentialAvatar(avId, self.names, avDNA, self.index, 1) if not self.newwarp: self.avList.append(newPotAv) self.fsm.request('ApprovalAccepted') elif status == 0: self.fsm.request('Rejected') else: self.notify.debug("name typed accepted but didn't fill any return fields") self.rejectName(TTLocalizer.NameError)
def enterCreateAvatar(self, avList, index, newDNA = None): if self.music: self.music.stop() self.music = None if newDNA != None: self.newPotAv = PotentialAvatar.PotentialAvatar('deleteMe', ['', '', '', ''], newDNA.makeNetString(), index, 1) avList.append(self.newPotAv) base.transitions.noFade() self.avCreate = MakeAToon.MakeAToon(self.loginFSM, avList, 'makeAToonComplete', index, self.isPaid()) self.avCreate.load() self.avCreate.enter() self.accept('makeAToonComplete', self.__handleMakeAToon, [avList, index]) self.accept('nameShopPost', self.relayMessage) return
def handleSetNamePatternResponse(self, avId, status): self.notify.debug('handleSetNamePatternResponse') self.cleanupWaitForServer() if avId != self.avId: self.notify.debug("doid's don't match up!") self.rejectName(TTLocalizer.NameError) if status == 1: style = self.toon.getStyle() avDNA = style.makeNetString() self.notify.debug('pattern name accepted') newPotAv = PotentialAvatar.PotentialAvatar(avId, self.names, avDNA, self.index, 0) self.avList.append(newPotAv) self.doneStatus = 'done' self.storeSkipTutorialRequest() messenger.send(self.doneEvent) else: self.notify.debug('name pattern rejected') self.rejectName(TTLocalizer.NameError) return None