本文整理汇总了Python中src.toontown.hood.ZoneUtil.getCanonicalHoodId方法的典型用法代码示例。如果您正苦于以下问题:Python ZoneUtil.getCanonicalHoodId方法的具体用法?Python ZoneUtil.getCanonicalHoodId怎么用?Python ZoneUtil.getCanonicalHoodId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类src.toontown.hood.ZoneUtil
的用法示例。
在下文中一共展示了ZoneUtil.getCanonicalHoodId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def setup(self):
self.dnaStore = base.cr.playGame.dnaStore
self.randomGenerator = random.Random()
self.randomGenerator.seed(self.zoneId)
self.interior = loader.loadModel('phase_4/models/modules/PetShopInterior')
self.interior.reparentTo(render)
self.fish = Actor.Actor('phase_4/models/props/interiorfish-zero', {'swim': 'phase_4/models/props/interiorfish-swim'})
self.fish.reparentTo(self.interior)
self.fish.setColorScale(0.8, 0.9, 1, 0.8)
self.fish.setScale(0.8)
self.fish.setPos(0, 6, -4)
self.fish.setPlayRate(0.7, 'swim')
self.fish.loop('swim')
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
self.colors = ToonInteriorColors.colors[hoodId]
self.replaceRandomInModel(self.interior)
door = self.chooseDoor()
doorOrigin = render.find('**/door_origin;+s')
doorNP = door.copyTo(doorOrigin)
doorOrigin.setScale(0.8, 0.8, 0.8)
doorOrigin.setPos(doorOrigin, 0, -0.25, 0)
doorColor = self.randomGenerator.choice(self.colors['TI_door'])
setupDoor(doorNP, self.interior, doorOrigin, self.dnaStore, str(self.block), doorColor)
doorFrame = doorNP.find('door_*_flat')
doorFrame.wrtReparentTo(self.interior)
doorFrame.setColor(doorColor)
del self.colors
del self.dnaStore
del self.randomGenerator
self.interior.flattenMedium()
for npcToon in self.cr.doFindAllInstances(DistributedNPCToonBase):
npcToon.initToonState()
示例2: setup
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def setup(self):
self.dnaStore = base.cr.playGame.dnaStore
self.randomGenerator = random.Random()
self.randomGenerator.seed(self.zoneId)
self.interior = loader.loadModel('phase_3.5/models/modules/toon_interior_tutorial')
self.interior.reparentTo(render)
dnaStore = DNAStorage()
node = loader.loadDNAFile(self.cr.playGame.hood.dnaStore, 'phase_3.5/dna/tutorial_street.pdna')
self.street = render.attachNewNode(node)
self.street.flattenMedium()
self.street.setPosHpr(-17, 42, -0.5, 180, 0, 0)
self.street.find('**/tb2:toon_landmark_TT_A1_DNARoot').stash()
self.street.find('**/tb1:toon_landmark_hqTT_DNARoot/**/door_flat_0').stash()
self.street.findAllMatches('**/+CollisionNode').stash()
self.skyFile = 'phase_3.5/models/props/TT_sky'
self.sky = loader.loadModel(self.skyFile)
self.sky.setScale(0.8)
self.sky.reparentTo(render)
self.sky.setDepthTest(0)
self.sky.setDepthWrite(0)
self.sky.setBin('background', 100)
self.sky.find('**/Sky').reparentTo(self.sky, -1)
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
self.colors = ToonInteriorColors.colors[hoodId]
self.replaceRandomInModel(self.interior)
doorModelName = 'door_double_round_ul'
if doorModelName[-1:] == 'r':
doorModelName = doorModelName[:-1] + 'l'
else:
doorModelName = doorModelName[:-1] + 'r'
door = self.dnaStore.findNode(doorModelName)
door_origin = render.find('**/door_origin;+s')
doorNP = door.copyTo(door_origin)
door_origin.setScale(0.8, 0.8, 0.8)
door_origin.setPos(door_origin, 0, -0.025, 0)
color = self.randomGenerator.choice(self.colors['TI_door'])
setupDoor(doorNP, self.interior, door_origin, self.dnaStore, str(self.block), color)
doorFrame = doorNP.find('door_*_flat')
doorFrame.wrtReparentTo(self.interior)
doorFrame.setColor(color)
del self.colors
del self.dnaStore
del self.randomGenerator
self.interior.flattenMedium()
npcOrigin = self.interior.find('**/npc_origin_' + `(self.cr.doId2do[self.npcId].posIndex)`)
if not npcOrigin.isEmpty():
self.cr.doId2do[self.npcId].reparentTo(npcOrigin)
self.cr.doId2do[self.npcId].clearMat()
self.createSuit()
base.localAvatar.setPosHpr(-2, 12, 0, -10, 0, 0)
self.cr.doId2do[self.npcId].setChatAbsolute(TTLocalizer.QuestScript101_0, CFSpeech)
place = base.cr.playGame.getPlace()
if place and hasattr(place, 'fsm') and place.fsm.getCurrentState().getName():
self.notify.info('Tutorial movie: Place ready.')
self.playMovie()
else:
self.notify.info('Tutorial movie: Waiting for place=%s, has fsm=%s' % (place, hasattr(place, 'fsm')))
if hasattr(place, 'fsm'):
self.notify.info('Tutorial movie: place state=%s' % place.fsm.getCurrentState().getName())
self.acceptOnce('enterTutorialInterior', self.playMovie)
示例3: setup
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def setup(self):
self.dnaStore = base.cr.playGame.dnaStore
self.randomGenerator = random.Random()
self.randomGenerator.seed(self.zoneId)
interior = self.randomDNAItem('TI_hall', self.dnaStore.findNode)
self.interior = interior.copyTo(render)
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
self.colors = ToonInteriorColors.colors[hoodId]
self.replaceRandomInModel(self.interior)
doorModelName = 'door_double_round_ul'
if doorModelName[-1:] == 'r':
doorModelName = doorModelName[:-1] + 'l'
else:
doorModelName = doorModelName[:-1] + 'r'
door = self.dnaStore.findNode(doorModelName)
door_origin = render.find('**/door_origin;+s')
doorNP = door.copyTo(door_origin)
door_origin.setScale(0.8, 0.8, 0.8)
door_origin.setPos(door_origin, 0, -0.025, 0)
color = self.randomGenerator.choice(self.colors['TI_door'])
setupDoor(doorNP, self.interior, door_origin, self.dnaStore, str(self.block), color)
doorFrame = doorNP.find('door_*_flat')
doorFrame.wrtReparentTo(self.interior)
doorFrame.setColor(color)
del self.colors
del self.dnaStore
del self.randomGenerator
self.interior.flattenMedium()
for npcToon in self.cr.doFindAllInstances(DistributedNPCToonBase.DistributedNPCToonBase):
npcToon.initToonState()
self.createSillyMeter()
示例4: updateMap
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def updateMap(self):
if self.av:
hoodId = ZoneUtil.getCanonicalHoodId(self.av.getLocation()[1])
zoneId = ZoneUtil.getCanonicalBranchZone(self.av.getLocation()[1])
try:
mapsGeom = loader.loadModel('phase_4/models/questmap/%s_maps' % ToontownGlobals.dnaMap[hoodId])
except:
self.stop()
return
mapImage = mapsGeom.find('**/%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
if not mapImage.isEmpty():
self.container['image'] = mapImage
self.resetFrameSize()
self.cornerPosInfo = QuestMapGlobals.CornerPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
self.hqPosInfo = QuestMapGlobals.HQPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
self.fishingSpotInfo = QuestMapGlobals.FishingSpotPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
self.cogInfoPos = QuestMapGlobals.CogInfoPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
self.cogInfoFrame.setPos(self.cogInfoPos)
self.hide()
self.hoodId = hoodId
self.zoneId = zoneId
self.updateQuestInfo()
self.updateCogInfo()
taskMgr.add(self.update, 'questMapUpdate')
else:
self.stop()
mapsGeom.removeNode()
示例5: enter
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def enter(self):
ShtikerPage.ShtikerPage.enter(self)
try:
zone = base.cr.playGame.getPlace().getZoneId()
except:
zone = 0
if base.localAvatar.lastHood >= ToontownGlobals.BossbotHQ:
self.safeZoneButton['text'] = TTLocalizer.MapPageBackToCogHQ
else:
self.safeZoneButton['text'] = TTLocalizer.MapPageBackToPlayground
if zone and ZoneUtil.isPlayground(zone) or self.book.safeMode:
self.safeZoneButton.hide()
else:
self.safeZoneButton.show()
if base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate and base.cr.playGame.hood.loader.atMyEstate() or self.book.safeMode:
self.goHomeButton.hide()
elif base.housingEnabled:
self.goHomeButton.show()
if base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate:
if base.cr.playGame.hood.loader.atMyEstate():
self.hoodLabel['text'] = TTLocalizer.MapPageYouAreAtHome
self.hoodLabel.show()
else:
avatar = base.cr.identifyAvatar(base.cr.playGame.hood.loader.estateOwnerId)
if avatar:
avName = avatar.getName()
self.hoodLabel['text'] = TTLocalizer.MapPageYouAreAtSomeonesHome % TTLocalizer.GetPossesive(avName)
self.hoodLabel.show()
elif zone:
hoodName = ToontownGlobals.hoodNameMap.get(ZoneUtil.getCanonicalHoodId(zone), ('',))[-1]
streetName = ToontownGlobals.StreetNames.get(ZoneUtil.getCanonicalBranchZone(zone), ('',))[-1]
if hoodName:
self.hoodLabel['text'] = TTLocalizer.MapPageYouAreHere % (hoodName, streetName)
self.hoodLabel.show()
else:
self.hoodLabel.hide()
else:
self.hoodLabel.hide()
hoodsVisited = base.localAvatar.hoodsVisited
hoodTeleportList = base.localAvatar.getTeleportAccess()
for hood in self.allZones:
label = self.labels[self.allZones.index(hood)]
clouds = self.clouds[self.allZones.index(hood)]
if not self.book.safeMode and hood in hoodsVisited:
label['text_fg'] = (0, 0, 0, 1)
label.show()
for cloud in clouds:
cloud.hide()
fullname = base.cr.hoodMgr.getFullnameFromId(hood)
if hood in hoodTeleportList:
text = TTLocalizer.MapPageGoTo % fullname
label['text'] = ('', text, text)
else:
label['text'] = ('', fullname, fullname)
else:
label.hide()
for cloud in clouds:
cloud.show()
示例6: genDNAFileName
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def genDNAFileName(self):
zoneId = ZoneUtil.getCanonicalZoneId(self.getZoneId())
hoodId = ZoneUtil.getCanonicalHoodId(zoneId)
hood = ToontownGlobals.dnaMap[hoodId]
phase = ToontownGlobals.streetPhaseMap[hoodId]
if hoodId == zoneId:
zoneId = 'sz'
return 'phase_%s/dna/%s_%s.pdna' % (phase, hood, zoneId)
示例7: lookupDNAFileName
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def lookupDNAFileName(self, zoneId):
zoneId = ZoneUtil.getCanonicalZoneId(zoneId)
hoodId = ZoneUtil.getCanonicalHoodId(zoneId)
hood = ToontownGlobals.dnaMap[hoodId]
if hoodId == zoneId:
zoneId = 'sz'
phaseNum = ToontownGlobals.phaseMap[hoodId]
else:
phaseNum = ToontownGlobals.streetPhaseMap[hoodId]
return 'phase_%s/dna/%s_%s.pdna' % (phaseNum, hood, zoneId)
示例8: setup
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def setup(self):
self.dnaStore = base.cr.playGame.dnaStore
self.randomGenerator = random.Random()
self.randomGenerator.seed(self.zoneId)
interior = self.randomDNAItem('TI_room', self.dnaStore.findNode)
self.interior = interior.copyTo(render)
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
self.colors = ToonInteriorColors.colors[hoodId]
self.replaceRandomInModel(self.interior)
doorModelName = 'door_double_round_ul'
if doorModelName[-1:] == 'r':
doorModelName = doorModelName[:-1] + 'l'
else:
doorModelName = doorModelName[:-1] + 'r'
door = self.dnaStore.findNode(doorModelName)
door_origin = render.find('**/door_origin;+s')
doorNP = door.copyTo(door_origin)
door_origin.setScale(0.8, 0.8, 0.8)
door_origin.setPos(door_origin, 0, -0.025, 0)
color = self.randomGenerator.choice(self.colors['TI_door'])
setupDoor(doorNP, self.interior, door_origin, self.dnaStore, str(self.block), color)
doorFrame = doorNP.find('door_*_flat')
doorFrame.wrtReparentTo(self.interior)
doorFrame.setColor(color)
sign = hidden.find('**/tb%s:*_landmark_*_DNARoot/**/sign;+s' % (self.block,))
if not sign.isEmpty():
signOrigin = self.interior.find('**/sign_origin;+s')
newSignNP = sign.copyTo(signOrigin)
newSignNP.setDepthWrite(1, 1)
newSignNP.flattenLight()
ll = Point3()
ur = Point3()
newSignNP.calcTightBounds(ll, ur)
width = ur[0] - ll[0]
height = ur[2] - ll[2]
if width != 0 and height != 0:
xScale = (SIGN_RIGHT - SIGN_LEFT) / width
zScale = (SIGN_TOP - SIGN_BOTTOM) / height
scale = min(xScale, zScale)
xCenter = (ur[0] + ll[0]) / 2.0
zCenter = (ur[2] + ll[2]) / 2.0
newSignNP.setPosHprScale((SIGN_RIGHT + SIGN_LEFT) / 2.0 - xCenter * scale, -0.1, (SIGN_TOP + SIGN_BOTTOM) / 2.0 - zCenter * scale, 0.0, 0.0, 0.0, scale, scale, scale)
trophyOrigin = self.interior.find('**/trophy_origin')
trophy = self.buildTrophy()
if trophy:
trophy.reparentTo(trophyOrigin)
del self.colors
del self.dnaStore
del self.randomGenerator
self.interior.flattenMedium()
for npcToon in self.cr.doFindAllInstances(DistributedNPCToonBase):
npcToon.initToonState()
示例9: calcHoodId
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def calcHoodId(self, node):
self.hoodId = ToontownGlobals.ToontownCentral
fullString = str(node)
splits = fullString.split('/')
if len(splits) >= 5:
visId = int(splits[4])
self.visId = visId
self.hoodId = ZoneUtil.getCanonicalHoodId(visId)
self.notify.debug('calcHoodId %d from %s' % (self.hoodId, fullString))
else:
self.notify.warning("calcHoodId couldn't parse %s using 0" % fullString)
self.hoodId = 0
self.visId = 0
示例10: teleportToShop
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def teleportToShop(self, npcId):
npcZone = NPCToons.getNPCZone(npcId)
npcHood = ZoneUtil.getCanonicalHoodId(npcZone)
avZone = base.localAvatar.getZoneId()
avHood = ZoneUtil.getCanonicalHoodId(avZone)
avShard = base.localAvatar.defaultShard
avPlace = base.cr.playGame.getPlace()
hqZone = {2000:2520, 1000:1507, 3000:3508, 4000:4504, 5000:5502, 7000:7503, 9000:9505}
def callback(flag):
if flag:
npcZone = None
base.cr.buildingQueryMgr.d_isSuit(npcZone, callback)
if avShard not in base.cr.activeDistrictMap:
return
if npcZone in [-1, 0, None]:
return
if not ZoneUtil.isInterior(npcZone):
return
if ZoneUtil.isHQ(npcZone):
args = (avHood, hqZone[avHood], avShard, -1)
else:
args = (npcHood, npcZone, avShard, -1)
avPlace.requestTeleport(*args)
示例11: choseShard
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def choseShard(self, shardId):
zoneId = self.getCurrentZoneId()
canonicalHoodId = ZoneUtil.getCanonicalHoodId(base.localAvatar.lastHood)
currentShardId = base.localAvatar.defaultShard
if self.currentGroupJoined:
self.rejectGroup(5)
return
if shardId == currentShardId:
return
else:
try:
place = base.cr.playGame.getPlace()
except:
try:
place = base.cr.playGame.hood.loader.place
except:
place = base.cr.playGame.hood.place
place.requestTeleport(canonicalHoodId, canonicalHoodId, shardId, -1)
示例12: updateQuestInfo
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def updateQuestInfo(self):
for marker in self.buildingMarkers:
marker.destroy()
self.buildingMarkers = []
for (i, questDesc) in enumerate(self.av.quests):
mapIndex = i + 1
quest = Quests.getQuest(questDesc[0])
toNpcId = questDesc[2]
completed = quest.getCompletionStatus(self.av, questDesc) == Quests.COMPLETE
if not completed:
if quest.getType() == Quests.RecoverItemQuest:
if quest.getHolder() == Quests.AnyFish:
self.putBuildingMarker(self.fishingSpotInfo, mapIndex=mapIndex)
continue
elif quest.getType() not in (
Quests.DeliverGagQuest, Quests.DeliverItemQuest,
Quests.VisitQuest, Quests.TrackChoiceQuest):
continue
if toNpcId == Quests.ToonHQ:
self.putBuildingMarker(self.hqPosInfo, mapIndex=mapIndex)
continue
npcZoneId = NPCToons.getNPCZone(toNpcId)
hoodId = ZoneUtil.getCanonicalHoodId(npcZoneId)
branchId = ZoneUtil.getCanonicalBranchZone(npcZoneId)
if (self.hoodId != hoodId) or (self.zoneId != branchId):
continue
for blockIndex in xrange(base.cr.playGame.dnaStore.getNumBlockNumbers()):
blockNumber = base.cr.playGame.dnaStore.getBlockNumberAt(blockIndex)
zoneId = base.cr.playGame.dnaStore.getZoneFromBlockNumber(blockNumber)
interiorZoneId = (zoneId - (zoneId%100)) + 500 + blockNumber
if npcZoneId == interiorZoneId:
self.putBuildingMarker(
base.cr.playGame.dnaStore.getDoorPosHprFromBlockNumber(blockNumber).getPos(render),
base.cr.playGame.dnaStore.getDoorPosHprFromBlockNumber(blockNumber).getHpr(render),
mapIndex=mapIndex, zoneId=zoneId)
示例13: avatarEnter
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def avatarEnter(self):
avId = self.air.getAvatarIdFromSender()
if not avId in self.air.doId2do:
self.notify.warning('Avatar: %s not found' % avId)
return
if self.isBusy():
self.freeAvatar(avId)
return
self.petSeeds = self.air.petMgr.getAvailablePets(ZoneUtil.getCanonicalHoodId(self.zoneId))
numGenders = len(PetDNA.PetGenders)
self.petSeeds *= numGenders
self.petSeeds.sort()
self.sendUpdateToAvatarId(avId, 'setPetSeeds', [self.petSeeds])
self.transactionType = ''
av = self.air.doId2do[avId]
self.busy = avId
self.acceptOnce(self.air.getAvatarExitEvent(avId), self.__handleUnexpectedExit, extraArgs=[avId])
flag = NPCToons.SELL_MOVIE_START
self.d_setMovie(avId, flag)
taskMgr.doMethodLater(PetConstants.PETCLERK_TIMER, self.sendTimeoutMovie, self.uniqueName('clearMovie'))
DistributedNPCToonBaseAI.avatarEnter(self)
示例14: showChoicePoster
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def showChoicePoster(self, questId, fromNpcId, toNpcId, rewardId, callback):
self.update((questId,
fromNpcId,
toNpcId,
rewardId,
0))
quest = Quests.getQuest(questId)
self.rewardText.show()
self.rewardText.setZ(-0.205)
self.questProgress.hide()
if not hasattr(self, 'chooseButton'):
guiButton = loader.loadModel('phase_3/models/gui/quit_button')
self.chooseButton = DirectButton(parent=self.questFrame, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(0.7, 1, 1), text=TTLocalizer.QuestPageChoose, text_scale=0.06, text_pos=(0, -0.02), pos=(0.285, 0, 0.245), scale=0.65)
guiButton.removeNode()
npcZone = NPCToons.getNPCZone(toNpcId)
hoodId = ZoneUtil.getCanonicalHoodId(npcZone)
self.chooseButton['command'] = callback
self.chooseButton['extraArgs'] = [questId]
self.unbind(DGG.WITHIN)
self.unbind(DGG.WITHOUT)
if not quest.getType() == Quests.TrackChoiceQuest:
self.questInfo.setZ(-0.0625)
return
示例15: getSafezoneId
# 需要导入模块: from src.toontown.hood import ZoneUtil [as 别名]
# 或者: from src.toontown.hood.ZoneUtil import getCanonicalHoodId [as 别名]
def getSafezoneId(trolleyZone):
return ZoneUtil.getCanonicalHoodId(trolleyZone)