Fix pet shop

This commit is contained in:
Daniel 2015-03-29 19:46:50 +03:00
parent 35abc0b1c3
commit 983eb61b68
3 changed files with 14 additions and 13 deletions

View file

@ -2,6 +2,7 @@ from toontown.toon import ToonDNA
from pandac.PandaModules import VBase4
from toontown.toonbase import TTLocalizer, ToontownGlobals
from direct.showbase import PythonUtil
import random
NumFields = 9
Fields = {'head': 0,
'ears': 1,
@ -179,17 +180,17 @@ PetEyeColors = (VBase4(0.29, 0.29, 0.69, 1.0),
VBase4(0.49, 0.99, 0.49, 1.0))
PetGenders = [0, 1]
def getRandomPetDNA(zoneId = ToontownGlobals.DonaldsDreamland):
from random import choice
head = choice(range(-1, len(HeadParts)))
ears = choice(range(-1, len(EarParts)))
nose = choice(range(-1, len(NoseParts)))
tail = choice(range(-1, len(TailParts)))
def getRandomPetDNA(seed = 0, zoneId = ToontownGlobals.DonaldsDreamland):
random.seed(seed + zoneId)
head = random.choice(range(-1, len(HeadParts)))
ears = random.choice(range(-1, len(EarParts)))
nose = random.choice(range(-1, len(NoseParts)))
tail = random.choice(range(-1, len(TailParts)))
body = getSpecies(zoneId)
color = choice(range(0, len(getColors(body))))
colorScale = choice(range(0, len(ColorScales)))
eyes = choice(range(0, len(PetEyeColors)))
gender = choice(range(0, len(PetGenders)))
color = random.choice(range(0, len(getColors(body))))
colorScale = random.choice(range(0, len(ColorScales)))
eyes = random.choice(range(0, len(PetEyeColors)))
gender = random.choice(range(0, len(PetGenders)))
return [head,
ears,
nose,

View file

@ -3,9 +3,9 @@ from toontown.toonbase import TTLocalizer
from direct.showbase import PythonUtil
def getPetInfoFromSeed(seed, safezoneId):
dnaArray = PetDNA.getRandomPetDNA(safezoneId)
dnaArray = PetDNA.getRandomPetDNA(seed, safezoneId)
gender = PetDNA.getGender(dnaArray)
nameString = TTLocalizer.getRandomPetName(gender=gender, seed=seed + safezoneId)
nameString = TTLocalizer.getRandomPetName(gender=gender, seed=seed)
traitSeed = PythonUtil.randUint31()
return (nameString, dnaArray, traitSeed)

View file

@ -105,7 +105,7 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI):
if av.petId != 0:
simbase.air.petMgr.deleteToonsPet(avId)
gender = petNum % len(PetDNA.PetGenders)
if nameIndex not in xrange(0, TTLocalizer.PetNameIndexMAX):
if nameIndex not in xrange(0, len(TTLocalizer.PetNameDictionary) - 1):
self.air.writeServerEvent('avoid_crash', avId, "DistributedNPCPetclerkAI.petAdopted and didn't have valid nameIndex!")
self.notify.warning("somebody called petAdopted and didn't have valid nameIndex to adopt! avId: %s" % avId)
return