本文整理汇总了Python中toontown.hood.ZoneUtil类的典型用法代码示例。如果您正苦于以下问题:Python ZoneUtil类的具体用法?Python ZoneUtil怎么用?Python ZoneUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ZoneUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: enteringARace
def enteringARace(self, status):
if not status['where'] == 'racetrack':
return 0
if ZoneUtil.isDynamicZone(status['zoneId']):
return status['hoodId'] == self.hood.hoodId
else:
return ZoneUtil.getHoodId(status['zoneId']) == self.hood.hoodId
示例2: requestTeleport
def requestTeleport(self, loaderId, whereId, hoodId, zoneId, avId):
place = base.cr.playGame.getPlace()
if loaderId == "":
loaderId = ZoneUtil.getBranchLoaderName(zoneId)
if whereId == "":
whereId = ZoneUtil.getToonWhereName(zoneId)
if hoodId == 0:
hoodId = place.loader.hood.id
if avId == 0:
avId = -1
place.fsm.forceTransition(
"teleportOut",
[
{
"loader": loaderId,
"where": whereId,
"how": "teleportIn",
"hoodId": hoodId,
"zoneId": zoneId,
"shardId": None,
"avId": avId,
}
],
)
return
示例3: updateMap
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()
示例4: enteringAGolfCourse
def enteringAGolfCourse(self, status):
if not status['where'] == 'golfcourse':
return 0
if ZoneUtil.isDynamicZone(status['zoneId']):
return status['hoodId'] == self.hood.hoodId
else:
return ZoneUtil.getHoodId(status['zoneId']) == self.hood.hoodId
示例5: enter
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: updateQuestInfo
def updateQuestInfo(self):
for marker in self.buildingMarkers:
marker.destroy()
self.buildingMarkers = []
dnaData = base.cr.playGame.dnaData
for questIndex in self.av.questPage.quests.keys():
questDesc = self.av.questPage.quests.get(questIndex)
if questDesc is None:
continue
mapIndex = questIndex + 1
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
quest = Quests.getQuest(questId)
fComplete = quest.getCompletionStatus(self.av, questDesc) == Quests.COMPLETE
if not fComplete:
if quest.getType() == Quests.RecoverItemQuest:
if quest.getHolder() == Quests.AnyFish:
self.putBuildingMarker(self.fishingSpotInfo, mapIndex=mapIndex)
continue
elif quest.getType() != Quests.DeliverGagQuest and quest.getType() != Quests.DeliverItemQuest and quest.getType() != Quests.VisitQuest and quest.getType() != Quests.TrackChoiceQuest:
continue
if toNpcId == Quests.ToonHQ:
self.putBuildingMarker(self.hqPosInfo, mapIndex=mapIndex)
else:
npcZone = NPCToons.getNPCZone(toNpcId)
hoodId = ZoneUtil.getCanonicalHoodId(npcZone)
branchId = ZoneUtil.getCanonicalBranchZone(npcZone)
if self.hoodId == hoodId and self.zoneId == branchId:
for blockId, block in dnaData.getBlocks():
zone = block.zone
branchZone = zone - zone % 100
finalZone = branchZone + 500 + blockId
if npcZone == finalZone:
building = block.node
self.putBuildingMarker(Point3(building.getPos()), building.getHpr(), mapIndex=mapIndex)
示例7: enter
def enter(self, hoodId, zoneId, avId):
if hoodId == ToontownGlobals.Tutorial:
loaderName = "townLoader"
whereName = "toonInterior"
elif hoodId == ToontownGlobals.MyEstate:
self.getEstateZoneAndGoHome(avId, zoneId)
return
elif hoodId == ToontownGlobals.PartyHood:
self.getPartyZoneAndGoToParty(avId, zoneId)
return
else:
loaderName = ZoneUtil.getLoaderName(zoneId)
whereName = ZoneUtil.getToonWhereName(zoneId)
self.fsm.request(
"quietZone",
[
{
"loader": loaderName,
"where": whereName,
"how": "teleportIn",
"hoodId": hoodId,
"zoneId": zoneId,
"shardId": None,
"avId": avId,
}
],
)
return
示例8: handleStageWinEvent
def handleStageWinEvent(self):
StageInterior.notify.debug("handleStageWinEvent")
if base.cr.playGame.getPlace().fsm.getCurrentState().getName() == "died":
return
self.stageDefeated = 1
if 1:
zoneId = ZoneUtil.getHoodId(self.zoneId)
else:
zoneId = ZoneUtil.getSafeZoneId(base.localAvatar.defaultZone)
self.fsm.request(
"teleportOut",
[
{
"loader": ZoneUtil.getLoaderName(zoneId),
"where": ZoneUtil.getToonWhereName(zoneId),
"how": "teleportIn",
"hoodId": zoneId,
"zoneId": zoneId,
"shardId": None,
"avId": -1,
}
],
)
示例9: teleportToShop
def teleportToShop(self, npcId):
if base.cr.playGame.getPlace().getState() != 'walk':
return
npcZone = NPCToons.getNPCZone(npcId)
npcHood = ZoneUtil.getCanonicalHoodId(npcZone)
hqZone = {2000:2520, 1000:1507, 3000:3508, 4000:4504, 5000:5502, 7000:7503, 9000:9505}
if npcZone in (-1, 0, None):
zoneId = base.localAvatar.getZoneId()
if ZoneUtil.isDynamicZone(zoneId) or ZoneUtil.isCogHQZone(zoneId):
zoneId = 2000
npcHood = ZoneUtil.getCanonicalHoodId(zoneId)
npcZone = hqZone.get(npcHood, 2520)
cost = ToontownGlobals.getTeleportButtonCost(npcHood)
self.destroyDialog()
base.cr.playGame.getPlace().setState('stopped')
if base.localAvatar.getTotalMoney() < cost:
self.dialog = TTDialog.TTDialog(style=TTDialog.Acknowledge, text=TTLocalizer.TeleportButtonNoMoney % cost, command=self.destroyDialog)
else:
self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.TeleportButtonConfirm % cost, command=lambda value: self.teleportToShopConfirm(npcZone, npcHood, cost, value))
self.dialog.show()
示例10: kickToPlayground
def kickToPlayground(self, retCode):
if retCode == 0:
msg = TTLocalizer.EstateOwnerLeftMessage % HouseGlobals.BOOT_GRACE_PERIOD
self.__popupKickoutMessage(msg)
elif retCode == 1:
zoneId = base.localAvatar.lastHood
self.doneStatus = {'loader': ZoneUtil.getBranchLoaderName(zoneId),
'where': ZoneUtil.getToonWhereName(zoneId),
'how': 'teleportIn',
'hoodId': zoneId,
'zoneId': zoneId,
'shardId': None,
'avId': -1}
messenger.send(self.doneEvent)
elif retCode == 2:
zoneId = base.localAvatar.lastHood
self.doneStatus = {'loader': ZoneUtil.getBranchLoaderName(zoneId),
'where': ZoneUtil.getToonWhereName(zoneId),
'how': 'teleportIn',
'hoodId': zoneId,
'zoneId': zoneId,
'shardId': None,
'avId': -1}
messenger.send(self.doneEvent)
else:
self.notify.error('unknown reason for exiting estate')
示例11: goHomeFailed
def goHomeFailed(self, task):
self.notify.debug("goHomeFailed")
failedToVisitAvId = self.doneStatus.get("avId")
if failedToVisitAvId > 0:
message = TTLocalizer.EstateTeleportFailedNotFriends % base.cr.identifyAvatar(failedToVisitAvId).getName()
else:
message = TTLocalizer.EstateTeleportFailed
self.notify.debug("goHomeFailed, why =: %s" % message)
self.ignore("setLocalEstateZone")
zoneId = base.localAvatar.lastHood
loaderName = ZoneUtil.getLoaderName(zoneId)
whereName = ZoneUtil.getToonWhereName(zoneId)
base.localAvatar.setSystemMessage(0, message)
self.fsm.request(
"quietZone",
[
{
"loader": loaderName,
"where": whereName,
"how": "teleportIn",
"hoodId": zoneId,
"zoneId": zoneId,
"shardId": None,
}
],
)
return Task.done
示例12: createStartingBlocks
def createStartingBlocks(self):
self.racingPads = []
self.viewingPads = []
racingPadGroups = []
viewingPadGroups = []
for zoneId in self.getZoneTable():
dnaData = self.air.dnaDataMap.get(zoneId, None)
zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId)
if dnaData.getName() == 'root':
area = ZoneUtil.getCanonicalZoneId(zoneId)
(foundRacingPads, foundRacingPadGroups) = self.findRacingPads(dnaData, zoneId, area, padType='racing_pad')
(foundViewingPads, foundViewingPadGroups) = self.findRacingPads(dnaData, zoneId, area, padType='viewing_pad')
self.racingPads.extend(foundRacingPads)
racingPadGroups.extend(foundRacingPadGroups)
self.viewingPads.extend(foundViewingPads)
viewingPadGroups.extend(foundViewingPadGroups)
self.startingBlocks = []
for (dnaGroup, racePad) in zip(racingPadGroups, self.racingPads):
foundStartingBlocks = self.findStartingBlocks(dnaGroup, racePad)
self.startingBlocks.extend(foundStartingBlocks)
for startingBlock in foundStartingBlocks:
racePad.addStartingBlock(startingBlock)
self.viewingBlocks = []
for (dnaGroup, viewPad) in zip(viewingPadGroups, self.viewingPads):
foundViewingBlocks = self.findStartingBlocks(dnaGroup, viewPad)
self.viewingBlocks.extend(foundViewingBlocks)
for viewingBlock in foundViewingBlocks:
viewPad.addStartingBlock(viewingBlock)
示例13: __lightDecorationOn__
def __lightDecorationOn__():
try:
geom = base.cr.playGame.getPlace().loader.geom
except:
loaderId = ZoneUtil.getBranchLoaderName(2000) # TEMP hack. This will port you to ttc if ^ fails
whereId = ZoneUtil.getToonWhereName(200)
how = 'teleportIn'
print ("This Should not happen.")
requestStatus = [{
'loader': loaderId,
'where': whereId,
'how': how,
'hoodId': 2000,
'zoneId': 2000,
'shardId': None,
'avId': -1
}]
base.cr.playGame.getPlace().fsm.forceTransition('teleportOut', requestStatus)
self.loader.hood.eventLights = geom.findAllMatches('**/*light*')
self.loader.hood.eventLights += geom.findAllMatches('**/*lamp*')
self.loader.hood.eventLights += geom.findAllMatches('**/prop_snow_tree*')
self.loader.hood.eventLights += geom.findAllMatches('**/prop_tree*')
self.loader.hood.eventLights += geom.findAllMatches('**/*christmas*')
for light in self.loader.hood.eventLights:
light.setColorScaleOff(1)
示例14: canAccess
def canAccess(self, zoneId=None):
if base.cr.isPaid():
return True
allowed = False
allowedZones = [
ToontownGlobals.ToontownCentral,
ToontownGlobals.MyEstate,
ToontownGlobals.GoofySpeedway,
ToontownGlobals.Tutorial,
]
specialZones = [ToontownGlobals.SellbotLobby]
if hasattr(base.cr, "newsManager") and base.cr.newsManager:
holidayIds = base.cr.newsManager.getHolidayIdList()
if ToontownGlobals.SELLBOT_NERF_HOLIDAY in holidayIds:
specialZones.append(ToontownGlobals.SellbotHQ)
place = base.cr.playGame.getPlace()
if zoneId:
myHoodId = ZoneUtil.getCanonicalHoodId(zoneId)
else:
myHoodId = ZoneUtil.getCanonicalHoodId(place.zoneId)
if hasattr(place, "id"):
myHoodId = place.id
if myHoodId in allowedZones:
allowed = True
elif zoneId and zoneId in specialZones:
allowed = True
return allowed
示例15: enter
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()
safeZonesVisited = 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 safeZonesVisited:
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()