def setAvatars(self, avatars): avList = [] for avNum, avName, avDNA, avPosition, nameState, hp, maxHp, hat, glasses, backpack, shoes in avatars: nameOpen = int(nameState == 1) names = [avName, '', '', ''] if nameState == 2: # PENDING names[1] = avName elif nameState == 3: # APPROVED names[2] = avName elif nameState == 4: # REJECTED names[3] = avName avList.append( PotentialAvatar(avNum, names, avDNA, avPosition, nameOpen, hp=hp, maxHp=maxHp, hat=hat, glasses=glasses, backpack=backpack, shoes=shoes)) self.cr.handleAvatarsList(avList)
def handleCreateAvatarResponseMsg(self, di): echoContext = di.getUint16() returnCode = di.getUint8() if returnCode == 0: self.avId = di.getUint32() newPotAv = PotentialAvatar(self.avId, [self.newName, '', '', ''], self.newDNA, self.newPosition, 1) self.loginFSM.request('waitForSetAvatarResponse', [newPotAv]) else: self.notify.error('name rejected')
def setAvatars(self, avatars): avList = [] for avNum, avName, avDNA, avPosition, nameState in avatars: nameOpen = int(nameState == 1) names = [avName, '', '', ''] if nameState == 2: # PENDING names[1] = avName elif nameState == 3: # APPROVED names[2] = avName elif nameState == 4: # REJECTED names[3] = avName avList.append(PotentialAvatar(avNum, names, avDNA, avPosition, nameOpen)) self.cr.handleAvatarsList(avList)
def avatarListResponse(self, avatarList): avList = [] for avNum, avName, avDNA, avPosition, nameState in avatarList: nameOpen = int(nameState == 1) names = [avName, '', '', ''] if nameState == 2: names[1] = avName elif nameState == 3: names[2] = avName elif nameState == 4: names[3] = avName avList.append( PotentialAvatar(avNum, names, avDNA, avPosition, nameOpen)) self.cr.handleAvatarsList(avList)
def enterCreateAvatar(self, avList, index, subId): if self.skipTutorial: self.tutorial = 0 self.avCreate = MakeAPirate(avList, 'makeAPirateComplete', subId, index, self.isPaid()) self.avCreate.load() self.avCreate.enter() self.accept('makeAPirateComplete', self.__handleMakeAPirate) else: self.tutorial = 1 dna = HumanDNA.HumanDNA() dna.makeMakeAPirate() newPotAv = PotentialAvatar(0, ['dbp', '', '', ''], dna, index, 0) self.csm.sendCreateAvatar(newPotAv.dna, '', newPotAv.position) self.accept('createdNewAvatar', self.handleAvatarCreated, [newPotAv])
def setAvatars(self, avatars): avList = [] for avNum, avName, avDNA, avPosition, nameState, hp, maxHp, lastHood in avatars: nameOpen = int(nameState == 1) names = [avName, '', '', ''] if nameState == 2: # PENDING names[1] = avName elif nameState == 3: # APPROVED names[2] = avName elif nameState == 4: # REJECTED names[3] = avName av = PotentialAvatar(avNum, names, avDNA, avPosition, nameOpen) av.hp = maxHp av.maxHp = maxHp av.lastHood = lastHood avList.append(av) self.cr.handleAvatarsList(avList)
def enterCreateAvatar(self, avList, index, subId): self.handler = self.handleCreateAvatar if self.skipTutorial: self.tutorial = 0 self.avCreate = MakeAPirate(avList, 'makeAPirateComplete', subId, index, self.isPaid()) self.avCreate.load() self.avCreate.enter() self.accept('makeAPirateComplete', self._PiratesClientRepository__handleMakeAPirate) self.accept('nameShopCreateAvatar', self.sendCreateAvatarMsg) else: self.tutorial = 1 dna = HumanDNA.HumanDNA() newPotAv = PotentialAvatar(0, ['dbp', '', '', ''], dna, index, 0) self.avatarManager.sendRequestCreateAvatar(subId) self.accept('createdNewAvatar', self.handleAvatarCreated, [newPotAv])
def setAvatars(self, avatars): avList = [] for avNum, avName, avDNA, avPosition, nameState in avatars: nameOpen = int(nameState == 1) names = [avName, '', '', ''] if nameState == 2: # PENDING names[1] = avName elif nameState == 3: # APPROVED names[2] = avName elif nameState == 4: # REJECTED names[3] = avName dna = HumanDNA() dna.makeFromNetString(avDNA) avList.append( PotentialAvatar(avNum, names, dna, avPosition, nameOpen)) while len(avList) < 4: avList.append(OTPGlobals.AvatarSlotAvailable) self.cr.handleAvatarsList({0: avList})
def setAvatars(self, avatars): avList = [] for avNum, avName, avDNA, avPosition, nameState, hp, maxHp in avatars: nameOpen = int(nameState == 1) names = [avName, '', '', ''] if nameState == 2: names[1] = avName elif nameState == 3: names[2] = avName elif nameState == 4: names[3] = avName avList.append( PotentialAvatar(avNum, names, avDNA, avPosition, nameOpen, hp=hp, maxHp=maxHp)) self.cr.handleAvatarsList(avList)
def avatarList(self, avatars): self.ignore('avatarListFailed') self.ignore('avatarList') self.avList = {} for (subId, avData) in avatars.items(): data = [] self.avList[subId] = data for av in avData: if av == OTPGlobals.AvatarSlotAvailable: data.append(OTPGlobals.AvatarSlotAvailable) continue if av == OTPGlobals.AvatarSlotUnavailable: data.append(OTPGlobals.AvatarSlotUnavailable) continue if av == OTPGlobals.AvatarPendingCreate: data.append(OTPGlobals.AvatarPendingCreate) continue avNames = [av['name'], av['wishName'], '', ''] aName = 0 pa = PotentialAvatar( av['id'], avNames, av['dna'], av['slot'], aName, av['creator'] == self.accountDetailRecord.playerAccountId, av['shared'], av['online'], wishState=av['wishState'], wishName=av['wishName'], defaultShard=av['defaultShard'], lastLogout=av['lastLogout']) data.append(pa) if self.loginFSM.getCurrentState().getName() == 'chooseAvatar': self.avChoice.updateAvatarList() else: self.loginFSM.request('chooseAvatar', [self.avList])
def setAvatars(self, avatars): avatarList = {} data = [] for avNum, avName, avDNA, avPosition, nameState in avatars: nameOpen = int(nameState == 1) names = [avName, '', '', ''] if nameState == 2: # PENDING names[1] = avName elif nameState == 3: # APPROVED names[2] = avName elif nameState == 4: # REJECTED names[3] = avName dna = HumanDNA() dna.makeFromNetString(avDNA) data.append( PotentialAvatar(avNum, names, dna, avPosition, nameOpen)) avatarList[1] = data + [OTPGlobals.AvatarSlotAvailable ] * (OTPGlobals.AvatarNumSlots - len(data)) self.cr.handleAvatarsList(avatarList)
def handleCreateAvatarResponse(self, avId): self.avId = avId newPotAv = PotentialAvatar(self.avId, [self.newName, '', '', ''], self.newDNA, self.newPosition, 1) self.loginFSM.request('waitForSetAvatarResponse', [newPotAv])