當前位置: 首頁>>代碼示例>>Python>>正文


Python pets.PetDNA類代碼示例

本文整理匯總了Python中toontown.pets.PetDNA的典型用法代碼示例。如果您正苦於以下問題:Python PetDNA類的具體用法?Python PetDNA怎麽用?Python PetDNA使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PetDNA類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: makePetList

        def makePetList(self):
            self.numPets = len(self.petSeeds)
            self.curPet = 0
            self.petDNA = []
            self.petName = []
            self.petDesc = []
            self.petCost = []
            for i in xrange(self.numPets):
                random.seed(self.petSeeds[i])
                zoneId = ZoneUtil.getCanonicalSafeZoneId(base.localAvatar.getZoneId())
                name, dna, traitSeed = PetUtil.getPetInfoFromSeed(self.petSeeds[i], zoneId)
                cost = PetUtil.getPetCostFromSeed(self.petSeeds[i], zoneId)
                traits = PetTraits.PetTraits(traitSeed, zoneId)
                traitList = traits.getExtremeTraitDescriptions()
                numGenders = len(PetDNA.PetGenders)
                gender = i % numGenders
                PetDNA.setGender(dna, gender)
                self.petDNA.append(dna)
                self.petName.append(TTLocalizer.PetshopUnknownName)
                descList = []
                descList.append(TTLocalizer.PetshopDescGender % PetDNA.getGenderString(gender=gender))
                if traitList:
                    descList.append(TTLocalizer.PetshopDescTrait % traitList[0])
                else:
                    descList.append(TTLocalizer.PetshopDescTrait % TTLocalizer.PetshopDescStandard)
                traitList.extend(['',
                 '',
                 '',
                 ''])
                for trait in traitList[1:4]:
                    descList.append('\t%s' % trait)

                descList.append(TTLocalizer.PetshopDescCost % cost)
                self.petDesc.append('\n'.join(descList))
                self.petCost.append(cost)
開發者ID:BmanGames,項目名稱:ToontownStride,代碼行數:35,代碼來源:PetshopGUI.py

示例2: getPetInfoFromSeed

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)
開發者ID:BmanGames,項目名稱:ToontownStride,代碼行數:9,代碼來源:PetUtil.py

示例3: _initDBVals

    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
開發者ID:nate97,項目名稱:src,代碼行數:26,代碼來源:DistributedPetAI.py

示例4: getPicture

 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
開發者ID:Toonerz,項目名稱:Toontown-World-Online-Leak,代碼行數:26,代碼來源:CatalogPetTrickItem.py

示例5: getPetCostFromSeed

def getPetCostFromSeed(seed, safezoneId):
    name, dna, traitSeed = getPetInfoFromSeed(seed, safezoneId)
    traits = PetTraits.PetTraits(traitSeed, safezoneId)
    traitValue = traits.getOverallValue()
    traitValue -= 0.3
    traitValue = max(0, traitValue)
    rarity = PetDNA.getRarity(dna)
    rarity *= 1.0 - traitValue
    rarity = pow(0.001, rarity) - 0.001
    minCost, maxCost = PetConstants.ZoneToCostRange[safezoneId]
    cost = rarity * (maxCost - minCost) + minCost
    cost = int(cost)
    return cost
開發者ID:BmanGames,項目名稱:ToontownStride,代碼行數:13,代碼來源:PetUtil.py

示例6: makeRandomPet

 def makeRandomPet(self):
     dna = PetDNA.getRandomPetDNA()
     self.setDNA(dna)
開發者ID:Teku16,項目名稱:MikeyTheRepository,代碼行數:3,代碼來源:Pet.py


注:本文中的toontown.pets.PetDNA類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。