def _initDBVals(self,
                    ownerId,
                    name=None,
                    traitSeed=0,
                    dna=None,
                    safeZone=ToontownGlobals.ToontownCentral):
        self.b_setOwnerId(ownerId)
        if name is None:
            name = 'pet%s' % self.doId
        self.b_setPetName(name)
        self.b_setTraitSeed(traitSeed)
        self.b_setSafeZone(safeZone)
        traits = PetTraits.PetTraits(traitSeed, safeZone)
        for traitName in PetTraits.getTraitNames():
            setter = self.getSetterName(traitName, 'b_set')
            self.__dict__[setter](traits.getTraitValue(traitName))

        self.traits = traits
        for component in PetMood.PetMood.Components:
            setterName = self.getSetterName(component, 'b_set')
            self.__dict__[setterName](0.0)

        if not dna:
            dna = PetDNA.getRandomPetDNA()
        self.setDNA(dna)
        self.b_setLastSeenTimestamp(self.getCurEpochTimestamp())
        for component in PetMood.PetMood.Components:
            self.setMoodComponent(component, 0.0)

        self.b_setTrickAptitudes([])
 def load(self):
     SafeZoneLoader.load(self)
     self.flippy = NPCToons.createLocalNPC(2001)
     self.flippy.reparentTo(render)
     self.flippy.setPickable(0)
     self.flippy.setPos(188, -260, 11.187)
     self.flippy.setH(108.411)
     self.flippy.initializeBodyCollisions('toon')
     self.flippy.addActive()
     self.flippy.startBlink()
     # Just keeping things relevant to 2.5.2, keeping away from TTR and TTO phrases...
     self.flippyBlatherSequence = Sequence(Wait(10), Func(self.flippy.setChatAbsolute, 'Hello and welcome Toons, far and wide!', CFSpeech | CFTimeout), Func(self.flippy.play, 'wave'), Func(self.flippy.loop, 'neutral'), Wait(12), Func(self.flippy.setChatAbsolute, "It's been a great time at Toontown, with you helping us stop the Cogs from ruining the experience with their destructive bugs, and we're glad you could join us!", CFSpeech | CFTimeout), Wait(10), Func(self.flippy.setChatAbsolute, "Oh, don't mind the little guy back there. That's my new-found lovable yet mysterious pet, Fluffy. That's what he calls himself.", CFSpeech | CFTimeout), Wait(8), Func(self.flippy.setChatAbsolute, "He came out of nowhere...", CFSpeech | CFTimeout), Wait(13), Func(self.flippy.setChatAbsolute,  "Just when I thought Toontown couldn't be any sillier! He's a real rascal, but he already has the Cog-fighting down to a science!", CFSpeech | CFTimeout), Wait(12), Func(self.flippy.setChatAbsolute, 'Doctor Surlee says he\'s some sort of creature called a "Doodle". Funny name, right?', CFSpeech | CFTimeout), Wait(16), Func(self.flippy.setChatAbsolute, "He also says Fluffy might have some friends and we may learn more about them soon.", CFSpeech | CFTimeout), Wait(8), Func(self.flippy.setChatAbsolute, 'Anyway, what are you waiting for?', CFSpeech | CFTimeout), Wait(8), Func(self.flippy.setChatAbsolute, 'Grab some pies and go for a spin. ToonFest is in full swing!', CFSpeech | CFTimeout), Wait(13), Func(self.flippy.setChatAbsolute, 'Buddy over there has made a few mistakes at the office so I have asked him to manage the balloon ride.', CFSpeech | CFTimeout), Wait(13), Func(self.flippy.setChatAbsolute, 'Hop in the balloon with Buddy and have a ride.', CFSpeech | CFTimeout))
     self.flippyBlatherSequence.loop()
     self.fluffy = Pet.Pet()
     self.fluffy.addActive()
     self.flippy.startBlink()
     self.fluffy.setDNA(PetDNA.getRandomPetDNA())
     self.fluffy.setName('Fluffy')
     self.fluffy.setPickable(0)
     self.fluffy.reparentTo(render)
     self.fluffy.setPos(191, -263, 11.382)
     self.fluffy.setH(829)
     self.fluffy.enterNeutralHappy()
     self.fluffy.initializeBodyCollisions('pet')
     try:
         self.towerGeom = self.geom.find('**/toonfest_tower_DNARoot')
         self.base1 = self.towerGeom.find('**/base1')
         self.base2 = self.towerGeom.find('**/base2')
         self.base3 = self.towerGeom.find('**/base3')
     except:
         self.notify.warning('Something messed up loading the tower bases!')
Example #3
0
    def _initDBVals(self, ownerId, name = None, traitSeed = 0, dna = None, safeZone = ToontownGlobals.ToontownCentral):
        self.b_setOwnerId(ownerId)
        if name is None:
            name = 'pet%s' % self.doId
        self.b_setPetName(name)
        self.b_setTraitSeed(traitSeed)
        self.b_setSafeZone(safeZone)
        traits = PetTraits.PetTraits(traitSeed, safeZone)
        for traitName in PetTraits.getTraitNames():
            setter = self.getSetterName(traitName, 'b_set')
            self.__dict__[setter](traits.getTraitValue(traitName))

        self.traits = traits
        for component in PetMood.PetMood.Components:
            setterName = self.getSetterName(component, 'b_set')
            self.__dict__[setterName](0.0)

        if not dna:
            dna = PetDNA.getRandomPetDNA()
        self.setDNA(dna)
        self.b_setLastSeenTimestamp(self.getCurEpochTimestamp())
        for component in PetMood.PetMood.Components:
            self.setMoodComponent(component, 0.0)

        self.b_setTrickAptitudes([])
        return
 def getPicture(self, avatar):
     from toontown.pets import PetDNA, Pet
     pet = Pet.Pet(forGui=1)
     dna = PetDNA.getRandomPetDNA()
     pet.setDNA(dna)
     pet.setH(180)
     model, ival = self.makeFrameModel(pet, 0)
     pet.setScale(2.0)
     pet.setP(-40)
     track = PetTricks.getTrickIval(pet, self.trickId)
     name = 'petTrick-item-%s' % self.sequenceNumber
     CatalogPetTrickItem.sequenceNumber += 1
     if track is not None:
         track = Sequence(
             Sequence(track),
             ActorInterval(
                 pet,
                 'neutral',
                 duration=2),
             name=name)
     else:
         pet.animFSM.request('neutral')
         track = Sequence(Wait(4), name=name)
     self.petPicture = pet
     self.hasPicture = True
     return model, track
def getPetInfoFromSeed(seed, safezoneId):
    S = random.getstate()
    random.seed(seed)
    dnaArray = PetDNA.getRandomPetDNA(safezoneId)
    gender = PetDNA.getGender(dnaArray)
    nameString = TTLocalizer.getRandomPetName(gender=gender, seed=seed)
    traitSeed = PythonUtil.randUint31()
    random.setstate(S)
    return (nameString, dnaArray, traitSeed)
Example #6
0
    def getPicture(self, avatar):
        # Returns a (DirectWidget, Interval) pair to draw and animate a
        # little representation of the item, or (None, None) if the
        # item has no representation.  This method is only called on
        # the client.

        # Don't import this at the top of the file, since this code
        # must run on the AI.
        from toontown.pets import PetDNA, Pet

        pet = Pet.Pet(forGui = 1)

        # We use the avatar's own pet if he/she has a pet (and we know
        # its DNA), otherwise use a random pet.
        dna = avatar.petDNA
        if dna == None:
            dna = PetDNA.getRandomPetDNA()
        pet.setDNA(dna)
        
        pet.setH(180)
        model, ival = self.makeFrameModel(pet, 0)
        pet.setScale(2.0)
        pet.setP(-40)

        # Discard the ival from makeFrameModel, since we don't want to
        # spin.

        track = PetTricks.getTrickIval(pet, self.trickId)
        name = "petTrick-item-%s" % (self.sequenceNumber)
        CatalogPetTrickItem.sequenceNumber += 1
        if track != None:
            track = Sequence(Sequence(track),
                             ActorInterval(pet, 'neutral', duration = 2),
                             name = name)
        else:
            pet.animFSM.request('neutral')
            track = Sequence(Wait(4),
                             name = name)
        self.petPicture = pet

        assert (not self.hasPicture)
        self.hasPicture=True
        
        return (model, track)
Example #7
0
 def makeRandomPet(self):
     dna = PetDNA.getRandomPetDNA()
     self.setDNA(dna)
Example #8
0
 def makeRandomPet(self):
     dna = PetDNA.getRandomPetDNA()
     self.setDNA(dna)