本文整理汇总了Python中toontown.hood.ZoneUtil.getBranchZone方法的典型用法代码示例。如果您正苦于以下问题:Python ZoneUtil.getBranchZone方法的具体用法?Python ZoneUtil.getBranchZone怎么用?Python ZoneUtil.getBranchZone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.hood.ZoneUtil
的用法示例。
在下文中一共展示了ZoneUtil.getBranchZone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: recoverItems
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def recoverItems(self, av, suitsKilled, taskZoneId):
# Get the avatars current quests.
avQuests = av.getQuests()
questList = []
recoveredItems = []
unrecoveredItems = []
taskZoneId = ZoneUtil.getBranchZone(taskZoneId)
# Iterate through the avatars current quests.
for i in xrange(0, len(avQuests), 5):
questDesc = avQuests[i : i + 5]
questClass = Quests.getQuest(questDesc[QuestIdIndex])
if questClass.getCompletionStatus(av, questDesc) == Quests.INCOMPLETE:
if isinstance(questClass, Quests.CogQuest):
for suit in suitsKilled:
if questClass.doesCogCount(av.doId, suit, taskZoneId, suit['activeToons']):
questDesc[QuestProgressIndex] += 1
elif isinstance(questClass, Quests.RecoverItemQuest):
if questClass.getHolder() != Quests.AnyFish:
for suit in suitsKilled:
if questClass.doesCogCount(av.doId, suit, taskZoneId, suit['activeToons']):
baseChance = questClass.getPercentChance()
amountRemaining = questClass.getNumItems() - questDesc[QuestProgressIndex]
chance = Quests.calcRecoverChance(amountRemaining, baseChance)
if chance >= baseChance:
questDesc[QuestProgressIndex] += 1
recoveredItems.append(questClass.getItem())
else:
unrecoveredItems.append(questClass.getItem())
questList.append(questDesc)
av.b_setQuests(questList)
return (recoveredItems, unrecoveredItems)
示例2: recoverItems
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def recoverItems(self, toon, suitsKilled, taskZoneId):
flattenedQuests = toon.getQuests()
questList = [] #unflattened
recoveredItems = []
unrecoveredItems = []
taskZoneId = ZoneUtil.getBranchZone(taskZoneId)
for i in xrange(0, len(flattenedQuests), 5):
questDesc = flattenedQuests[i : i + 5]
questClass = Quests.getQuest(questDesc[0])
if questClass.getCompletionStatus(toon, questDesc) == Quests.INCOMPLETE:
if isinstance(questClass, Quests.CogQuest):
for suit in suitsKilled:
if questClass.doesCogCount(toon.doId, suit, taskZoneId, suit['activeToons']):
questDesc[4] += 1
elif isinstance(questClass, Quests.RecoverItemQuest):
if questClass.getHolder() != Quests.AnyFish:
for suit in suitsKilled:
if questClass.doesCogCount(toon.doId, suit, taskZoneId, suit['activeToons']):
minchance = questClass.getPercentChance()
import random
chance = random.randint(minchance - 40, 100)
if chance <= minchance:
questDesc[4] += 1
recoveredItems.append(questClass.getItem())
else:
unrecoveredItems.append(questClass.getItem())
questList.append(questDesc)
toon.b_setQuests(questList)
return (recoveredItems, unrecoveredItems)
示例3: begin
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def begin(self, range, label, gui, tipCategory, zoneId):
self.waitBar['range'] = range
self.title['text'] = label
loadingScreenTex = self.zone2picture.get(ZoneUtil.getBranchZone(zoneId), self.defaultTex)
self.background = loader.loadTexture(loadingScreenTex)
self.__count = 0
self.__expectedCount = range
if gui:
if base.localAvatarStyle:
from toontown.toon import Toon
self.toon = Toon.Toon()
self.toon.setDNA(base.localAvatarStyle)
self.toon.loop('bored', fromFrame=135, toFrame=135)
self.toon.getGeomNode().setDepthWrite(1)
self.toon.getGeomNode().setDepthTest(1)
self.toon.setHpr(205, 0, 0)
self.toon.setScale(0.18)
self.toon.setPos(base.a2dBottomRight.getX()/1.25, 0, -0.034)
self.toon.reparentTo(self.waitBar)
self.waitBar['frameSize'] = (base.a2dLeft+(base.a2dRight/8.15), base.a2dRight-(base.a2dRight/2.57), -0.03, 0.03)
self.title.reparentTo(base.a2dpBottomLeft, LOADING_SCREEN_SORT_INDEX)
self.title.setPos(0.24, 0, 0.23)
self.gui.setPos(0, -0.1, 0)
self.gui.reparentTo(aspect2d, LOADING_SCREEN_SORT_INDEX)
self.gui.setTexture(self.background, 1)
if loadingScreenTex == self.defaultTex:
self.logo.reparentTo(base.a2dpTopCenter, LOADING_SCREEN_SORT_INDEX)
else:
self.title.reparentTo(base.a2dpBottomLeft, LOADING_SCREEN_SORT_INDEX)
self.gui.reparentTo(hidden)
self.logo.reparentTo(hidden)
self.waitBar.reparentTo(base.a2dpBottomCenter, LOADING_SCREEN_SORT_INDEX)
self.waitBar.update(self.__count)
示例4: enter
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def enter(self, requestStatus, visibilityFlag = 1, arrowsOn = 1):
teleportDebug(requestStatus, 'Street.enter(%s)' % (requestStatus,))
self._ttfToken = None
self.fsm.enterInitialState()
base.playMusic(self.loader.music, looping=1, volume=0.8)
self.loader.geom.reparentTo(render)
if visibilityFlag:
self.visibilityOn()
base.localAvatar.setGeom(self.loader.geom)
base.localAvatar.setOnLevelGround(1)
self._telemLimiter = TLGatherAllAvs('Street', RotationLimitToH)
NametagGlobals.setMasterArrowsOn(arrowsOn)
self.zone = ZoneUtil.getBranchZone(requestStatus['zoneId'])
def __lightDecorationOn__():
geom = base.cr.playGame.getPlace().loader.geom
self.halloweenLights = geom.findAllMatches('**/*light*')
self.halloweenLights += geom.findAllMatches('**/*lamp*')
self.halloweenLights += geom.findAllMatches('**/prop_snow_tree*')
for light in self.halloweenLights:
light.setColorScaleOff(1)
if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HALLOWEEN) and self.loader.hood.spookySkyFile:
lightsOff = Sequence(LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(0.55, 0.55, 0.65, 1)), Func(self.loader.hood.startSpookySky))
lightsOff.start()
else:
self.loader.hood.startSky()
lightsOn = LerpColorScaleInterval(base.cr.playGame.hood.loader.geom, 0.1, Vec4(1, 1, 1, 1))
lightsOn.start()
self.accept('doorDoneEvent', self.handleDoorDoneEvent)
self.accept('DistributedDoor_doorTrigger', self.handleDoorTrigger)
self.enterZone(requestStatus['zoneId'])
self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.loader.nodeList)
self.fsm.request(requestStatus['how'], [requestStatus])
示例5: enter
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def enter(self, requestStatus):
CogHQExterior.CogHQExterior.enter(self, requestStatus)
for train in self.trains:
train.show()
# Load the CogHQ DNA file:
dnaStore = DNAStorage()
dnaFileName = self.genDNAFileName(self.zoneId)
loadDNAFileAI(dnaStore, dnaFileName)
# Collect all of the vis group zone IDs:
self.zoneVisDict = {}
for i in xrange(dnaStore.getNumDNAVisGroupsAI()):
groupFullName = dnaStore.getDNAVisGroupName(i)
visGroup = dnaStore.getDNAVisGroupAI(i)
visZoneId = int(base.cr.hoodMgr.extractGroupName(groupFullName))
visZoneId = ZoneUtil.getTrueZoneId(visZoneId, self.zoneId)
visibles = []
for i in xrange(visGroup.getNumVisibles()):
visibles.append(int(visGroup.getVisible(i)))
visibles.append(ZoneUtil.getBranchZone(visZoneId))
self.zoneVisDict[visZoneId] = visibles
# Next, we want interest in all vis groups due to this being a Cog HQ:
base.cr.sendSetZoneMsg(self.zoneId, self.zoneVisDict.values()[0])
示例6: spawn
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def spawn(air, zone, element, match):
if zone % 1000 != 0:
# This should hopefully create the Fishermen NPCs on streets.
NPCToons.createNpcsInZone(air, zone)
pond = DistributedFishingPondAI(air)
area = ZoneUtil.getBranchZone(zone)
pond.setArea(area)
pond.generateWithRequired(zone)
bingoMgr = DistributedPondBingoManagerAI(air)
bingoMgr.setPondDoId(pond.getDoId())
bingoMgr.generateWithRequired(zone)
pond.bingoMgr = bingoMgr
pond.bingoMgr.createGame()
simbase.air.fishManager.ponds[zone] = pond
for i in range(FishingTargetGlobals.getNumTargets(area)):
target = DistributedFishingTargetAI(simbase.air)
target.setPondDoId(pond.getDoId())
target.generateWithRequired(zone)
for child in element.children:
if isinstance(child, DNAProp) and 'fishing_spot' in child.code:
spot = DistributedFishingSpotAI(air)
spot.setPondDoId(pond.getDoId())
x, y, z = child.getPos()
h, p, r = child.getHpr()
spot.setPosHpr(x, y, z, h, p, r)
spot.generateWithRequired(zone)
示例7: knockKnockTrack
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def knockKnockTrack(self, avatar, duration):
if avatar == None:
return
self.rimshot = base.loadSfx('phase_5/audio/sfx/AA_heal_telljoke.ogg')
self.knockSfx = base.loadSfx('phase_5/audio/sfx/GUI_knock_3.ogg')
joke = KnockKnockJokes[self.propId % len(KnockKnockJokes)]
place = base.cr.playGame.getPlace()
doorName = TTLocalizer.DoorNametag
if place:
zone = place.getZoneId()
branch = ZoneUtil.getBranchZone(zone)
self.nametag = None
self.nametagNP = None
doorNP = render.find('**/KnockKnockDoorSphere_' + str(self.propId) + ';+s')
if doorNP.isEmpty():
self.notify.warning('Could not find KnockKnockDoorSphere_%s' % self.propId)
return
self.nametag = NametagGroup()
self.nametag.setAvatar(doorNP)
self.nametag.setFont(ToontownGlobals.getToonFont())
self.nametag.setName(doorName)
self.nametag.setActive(0)
self.nametag.manage(base.marginManager)
self.nametag.getNametag3d().setBillboardOffset(4)
nametagNode = self.nametag.getNametag3d()
self.nametagNP = render.attachNewNode(nametagNode)
self.nametagNP.setName('knockKnockDoor_nt_' + str(self.propId))
pos = doorNP.node().getSolid(0).getCenter()
self.nametagNP.setPos(pos + Vec3(0, 0, avatar.getHeight() + 2))
d = duration * 0.125
track = Sequence(Parallel(Sequence(Wait(d * 0.5), SoundInterval(self.knockSfx)), Func(self.nametag.setChat, TTLocalizer.DoorKnockKnock, CFSpeech), Wait(d)), Func(avatar.setChatAbsolute, TTLocalizer.DoorWhosThere, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChat, joke[0], CFSpeech), Wait(d), Func(avatar.setChatAbsolute, joke[0] + TTLocalizer.DoorWhoAppendix, CFSpeech | CFTimeout, openEnded=0), Wait(d), Func(self.nametag.setChat, joke[1], CFSpeech), Parallel(SoundInterval(self.rimshot, startTime=2.0), Wait(d * 4)), Func(self.cleanupTrack))
track.delayDelete = DelayDelete.DelayDelete(avatar, 'knockKnockTrack')
return track
示例8: handleToonInteriorDone
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def handleToonInteriorDone(self):
status = self.place.doneStatus
if ZoneUtil.getBranchZone(status['zoneId']) == self.hood.hoodId and status['shardId'] == None:
self.fsm.request('quietZone', [status])
else:
self.doneStatus = status
messenger.send(self.doneEvent)
return
示例9: streetDone
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def streetDone(self):
self.requestStatus = self.place.doneStatus
status = self.place.doneStatus
if status['loader'] == 'townLoader' and ZoneUtil.getBranchZone(status['zoneId']) == self.branchZone and status['shardId'] == None:
self.fsm.request('quietZone', [status])
else:
self.doneStatus = status
messenger.send(self.doneEvent)
return
示例10: handlePlaygroundDone
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def handlePlaygroundDone(self):
status = self.place.doneStatus
if self.enteringARace(status) and status.get('shardId') == None:
zoneId = status['zoneId']
self.fsm.request('quietZone', [status])
elif ZoneUtil.getBranchZone(status['zoneId']) == self.hood.hoodId and status['shardId'] == None:
self.fsm.request('quietZone', [status])
else:
self.doneStatus = status
messenger.send(self.doneEvent)
示例11: makeDictionaries
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def makeDictionaries(self, dnaStore):
self.nodeDict = {}
self.zoneDict = {}
self.zoneVisDict = {}
self.nodeList = []
self.fadeInDict = {}
self.fadeOutDict = {}
a1 = Vec4(1, 1, 1, 1)
a0 = Vec4(1, 1, 1, 0)
numVisGroups = dnaStore.getNumDNAVisGroupsAI()
for i in xrange(numVisGroups):
groupFullName = dnaStore.getDNAVisGroupName(i)
visGroup = dnaStore.getDNAVisGroupAI(i)
groupName = base.cr.hoodMgr.extractGroupName(groupFullName)
zoneId = int(groupName)
zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId)
groupNode = self.geom.find('**/' + groupFullName)
if groupNode.isEmpty():
self.notify.error('Could not find visgroup')
else:
if ':' in groupName:
groupName = '%s%s' % (zoneId, groupName[groupName.index(':'):])
else:
groupName = '%s' % zoneId
groupNode.setName(groupName)
groupNode.flattenMedium()
self.nodeDict[zoneId] = []
self.nodeList.append(groupNode)
self.zoneDict[zoneId] = groupNode
visibles = []
for i in xrange(visGroup.getNumVisibles()):
visibles.append(int(visGroup.visibles[i]))
visibles.append(ZoneUtil.getBranchZone(zoneId))
self.zoneVisDict[zoneId] = visibles
fadeDuration = 0.5
self.fadeOutDict[groupNode] = Sequence(Func(groupNode.setTransparency, 1), LerpColorScaleInterval(groupNode, fadeDuration, a0, startColorScale=a1), Func(groupNode.clearColorScale), Func(groupNode.clearTransparency), Func(groupNode.stash), name='fadeZone-' + str(zoneId), autoPause=1)
self.fadeInDict[groupNode] = Sequence(Func(groupNode.unstash), Func(groupNode.setTransparency, 1), LerpColorScaleInterval(groupNode, fadeDuration, a1, startColorScale=a0), Func(groupNode.clearColorScale), Func(groupNode.clearTransparency), name='fadeZone-' + str(zoneId), autoPause=1)
for i in xrange(numVisGroups):
groupFullName = dnaStore.getDNAVisGroupName(i)
zoneId = int(base.cr.hoodMgr.extractGroupName(groupFullName))
zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId)
for j in xrange(dnaStore.getNumVisiblesInDNAVisGroup(i)):
visName = dnaStore.getVisibleName(i, j)
groupName = base.cr.hoodMgr.extractGroupName(visName)
nextZoneId = int(groupName)
nextZoneId = ZoneUtil.getTrueZoneId(nextZoneId, self.zoneId)
visNode = self.zoneDict[nextZoneId]
self.nodeDict[zoneId].append(visNode)
self.hood.dnaStore.resetPlaceNodes()
self.hood.dnaStore.resetDNAGroups()
self.hood.dnaStore.resetDNAVisGroups()
self.hood.dnaStore.resetDNAVisGroupsAI()
示例12: handlePlaygroundDone
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def handlePlaygroundDone(self):
status = self.place.doneStatus
teleportDebug(status, 'handlePlaygroundDone, doneStatus=%s' % (status,))
if ZoneUtil.getBranchZone(status['zoneId']) == self.hood.hoodId and status['shardId'] == None:
teleportDebug(status, 'same branch')
self.fsm.request('quietZone', [status])
else:
self.doneStatus = status
teleportDebug(status, 'different hood')
messenger.send(self.doneEvent)
return
示例13: handlePlaygroundDone
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def handlePlaygroundDone(self):
status = self.place.doneStatus
if self.enteringAGolfCourse(status) and status.get("shardId") == None:
zoneId = status["zoneId"]
self.fsm.request("quietZone", [status])
elif ZoneUtil.getBranchZone(status["zoneId"]) == self.hood.hoodId and status["shardId"] == None:
self.fsm.request("quietZone", [status])
else:
self.doneStatus = status
messenger.send(self.doneEvent)
return
示例14: load
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def load(self, zoneId):
self.zoneId = zoneId
self.parentFSMState.addChild(self.fsm)
self.loadBattleAnims()
self.branchZone = ZoneUtil.getBranchZone(zoneId)
self.canonicalBranchZone = ZoneUtil.getCanonicalBranchZone(zoneId)
self.music = base.loadMusic(self.musicFile)
self.activityMusic = base.loadMusic(self.activityMusicFile)
self.battleMusic = base.loadMusic('phase_3.5/audio/bgm/encntr_general_bg.ogg')
self.townBattle = TownBattle.TownBattle(self.townBattleDoneEvent)
self.townBattle.load()
示例15: recoverItems
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getBranchZone [as 别名]
def recoverItems(self, av, suitsKilled, taskZoneId):
# Get the avatars current quests.
avQuests = av.getQuests()
questList = []
recoveredItems = []
unrecoveredItems = []
taskZoneId = ZoneUtil.getBranchZone(taskZoneId)
# Iterate through the avatars current quests.
for i in xrange(0, len(avQuests), 5):
questDesc = avQuests[i : i + 5]
questClass = Quests.getQuest(questDesc[QuestIdIndex])
# Check if the Quest isnt already complete
if questClass.getCompletionStatus(av, questDesc) == Quests.INCOMPLETE:
# Check if we are dealing with a RecoverItemQuest
if isinstance(questClass, Quests.RecoverItemQuest):
# Iterate through all the Cogs that were killed in the battle
for suit in suitsKilled:
# Because the RecoveItemQuest class doesn't have a
# function to see if a Cog counts. We need to manually
# check if the Cog is valid for the Quest
if (questClass.getHolder() == Quests.Any) or \
(questClass.getHolderType() == 'type' and \
questClass.getHolder() == suit['type']) or \
(questClass.getHolderType() == 'track' and \
questClass.getHolder() == suit['track']) or \
(questClass.getHolderType() == 'level' and \
questClass.getHolder() <= suit['level']):
# It looks like the Cog was valid. Lets see if they
# found what they were looking for.
baseChance = questClass.getPercentChance()
amountRemaining = questClass.getNumItems() - questDesc[QuestProgressIndex]
chance = Quests.calcRecoverChance(amountRemaining, baseChance)
# They found it! Give them their reward!
if chance >= baseChance:
questDesc[QuestProgressIndex] += 1
recoveredItems.append(questClass.getItem())
# Better luck next time :(
else:
unrecoveredItems.append(questClass.getItem())
questList.append(questDesc)
av.b_setQuests(questList)
return (recoveredItems, unrecoveredItems)