def readPet(self): # Reads and returns a Pet object. Note that the same warnings # apply as readToon() re: empty object and fields being filled # in later from toontown.pets import DistributedPetAI pet = DistributedPetAI.DistributedPetAI(self.air) self.readObject(pet, None) return pet
def createPet(self, ownerId, seed): zoneId = self.interiorZone safeZoneId = ZoneUtil.getCanonicalSafeZoneId(zoneId) name, dna, traitSeed = PetUtil.getPetInfoFromSeed(seed, safeZoneId) pet = DistributedPetAI.DistributedPetAI(self.air, dna=dna) pet.setOwnerId(ownerId) pet.setPetName(name) pet.traits = PetTraits.PetTraits(traitSeed=traitSeed, safeZoneId=safeZoneId) pet.generateWithRequired(zoneId) pet.setPos(0, 0, 0) pet.b_setParent(ToontownGlobals.SPRender)
def __gotData(self, db, retcode): self.requested.remove(db.doId) if retcode == 0 and len( intersection(list(db.values.keys()), self.fieldsToGet(None))) > 0: pet = DistributedPetAI.DistributedPetAI(self.air) db.fillin(pet, self.dclass) self.processPet(pet, db) self.nonPet = 0 else: if self.objIdList != None: print("Not a pet: %s" % (db.doId)) self.nonPet += 1 self.getNextPet() if self.timeToStop() and (len(self.requested) == 0): self.stop() self.done()
def readPet(self): from toontown.pets import DistributedPetAI pet = DistributedPetAI.DistributedPetAI(self.air) self.readObject(pet, None) return pet