本文整理汇总了Python中toontown.hood.ZoneUtil.getCanonicalZoneId方法的典型用法代码示例。如果您正苦于以下问题:Python ZoneUtil.getCanonicalZoneId方法的具体用法?Python ZoneUtil.getCanonicalZoneId怎么用?Python ZoneUtil.getCanonicalZoneId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.hood.ZoneUtil
的用法示例。
在下文中一共展示了ZoneUtil.getCanonicalZoneId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def __init__(self, air, blockNumber, zoneId, trophyMgr):
DistributedObjectAI.DistributedObjectAI.__init__(self, air)
self.block = blockNumber
self.zoneId = zoneId
self.canonicalZoneId = ZoneUtil.getCanonicalZoneId(zoneId)
self.trophyMgr = trophyMgr
self.victorResponses = None
self.fsm = ClassicFSM.ClassicFSM('DistributedBuildingAI', [State.State('off', self.enterOff, self.exitOff, ['waitForVictors',
'becomingToon',
'toon',
'clearOutToonInterior',
'becomingSuit',
'suit',
'clearOutToonInteriorForCogdo',
'becomingCogdo',
'cogdo']),
State.State('waitForVictors', self.enterWaitForVictors, self.exitWaitForVictors, ['becomingToon']),
State.State('waitForVictorsFromCogdo', self.enterWaitForVictorsFromCogdo, self.exitWaitForVictorsFromCogdo, ['becomingToonFromCogdo']),
State.State('becomingToon', self.enterBecomingToon, self.exitBecomingToon, ['toon']),
State.State('becomingToonFromCogdo', self.enterBecomingToonFromCogdo, self.exitBecomingToonFromCogdo, ['toon']),
State.State('toon', self.enterToon, self.exitToon, ['clearOutToonInterior', 'clearOutToonInteriorForCogdo']),
State.State('clearOutToonInterior', self.enterClearOutToonInterior, self.exitClearOutToonInterior, ['becomingSuit']),
State.State('becomingSuit', self.enterBecomingSuit, self.exitBecomingSuit, ['suit']),
State.State('suit', self.enterSuit, self.exitSuit, ['waitForVictors', 'becomingToon']),
State.State('clearOutToonInteriorForCogdo', self.enterClearOutToonInteriorForCogdo, self.exitClearOutToonInteriorForCogdo, ['becomingCogdo']),
State.State('becomingCogdo', self.enterBecomingCogdo, self.exitBecomingCogdo, ['cogdo']),
State.State('cogdo', self.enterCogdo, self.exitCogdo, ['waitForVictorsFromCogdo', 'becomingToonFromCogdo'])], 'off', 'off')
self.fsm.enterInitialState()
self.track = 'c'
self.difficulty = 1
self.numFloors = 0
self.savedBy = None
self.becameSuitTime = 0
self.frontDoorPoint = None
self.suitPlannerExt = None
示例2: requestBattle
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def requestBattle(self, zoneId, suit, toonId):
self.notify.debug('requestBattle() - zone: %s suit: %s toon: %s' % (zoneId, suit.doId, toonId))
canonicalZoneId = ZoneUtil.getCanonicalZoneId(zoneId)
if canonicalZoneId not in self.battlePosDict:
return 0
toon = self.air.doId2do.get(toonId)
if toon.getBattleId() > 0:
self.notify.warning('We tried to request a battle when the toon was already in battle')
return 0
if toon:
if hasattr(toon, 'doId'):
toon.b_setBattleId(toonId)
pos = self.battlePosDict[canonicalZoneId]
interactivePropTrackBonus = -1
if config.GetBool('props-buff-battles', True) and canonicalZoneId in self.cellToGagBonusDict:
interactivePropTrackBonus = self.cellToGagBonusDict[canonicalZoneId]
self.battleMgr.newBattle(
zoneId, zoneId, pos, suit, toonId, self.__battleFinished,
self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_SMAX],
interactivePropTrackBonus)
for currOther in self.zoneInfo[zoneId]:
self.notify.debug('Found suit %s in this new battle zone %s' % (currOther.getDoId(), zoneId))
if currOther != suit:
if currOther.pathState == 1 and currOther.legType == SuitLeg.TWalk:
self.checkForBattle(zoneId, currOther)
return 1
示例3: enterToon
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def enterToon(self):
self.d_setState("toon")
(exteriorZoneId, interiorZoneId) = self.getExteriorAndInteriorZoneId()
if simbase.config.GetBool("want-new-toonhall", 1) and ZoneUtil.getCanonicalZoneId(interiorZoneId) == ToonHall:
self.interior = DistributedToonHallInteriorAI.DistributedToonHallInteriorAI(
self.block, self.air, interiorZoneId, self
)
else:
self.interior = DistributedToonInteriorAI.DistributedToonInteriorAI(
self.block, self.air, interiorZoneId, self
)
self.interior.generateWithRequired(interiorZoneId)
door = self.createExteriorDoor()
insideDoor = DistributedDoorAI.DistributedDoorAI(self.air, self.block, DoorTypes.INT_STANDARD)
door.setOtherDoor(insideDoor)
insideDoor.setOtherDoor(door)
door.zoneId = exteriorZoneId
insideDoor.zoneId = interiorZoneId
door.generateWithRequired(exteriorZoneId)
insideDoor.generateWithRequired(interiorZoneId)
self.door = door
self.insideDoor = insideDoor
self.becameSuitTime = 0
self.knockKnock = DistributedKnockKnockDoorAI.DistributedKnockKnockDoorAI(self.air, self.block)
self.knockKnock.generateWithRequired(exteriorZoneId)
self.air.writeServerEvent("building-toon", self.doId, "%s|%s" % (self.zoneId, self.block))
示例4: createStartingBlocks
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
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)
示例5: enterTeleport
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def enterTeleport(self, shardId, hoodId, zoneId):
teleportNotify.debug('enterTeleport%s' % ((shardId, hoodId, zoneId),))
hoodsVisited = base.localAvatar.hoodsVisited
canonicalHoodId = ZoneUtil.getCanonicalZoneId(hoodId)
if hoodId == ToontownGlobals.MyEstate:
teleportNotify.debug('enterTeleport: estate')
if shardId == base.localAvatar.defaultShard:
shardId = None
place = base.cr.playGame.getPlace()
place.requestTeleport(hoodId, zoneId, shardId, self.avId)
unloadTeleportPanel()
elif canonicalHoodId not in hoodsVisited + ToontownGlobals.HoodsAlwaysVisited:
teleportNotify.debug('enterTeleport: unknownHood')
self.fsm.request('unknownHood', [
hoodId])
elif canonicalHoodId not in base.cr.hoodMgr.getAvailableZones():
print 'hoodId %d not ready' % hoodId
self.fsm.request('unavailableHood', [
hoodId])
elif shardId == base.localAvatar.defaultShard:
shardId = None
teleportNotify.debug('enterTeleport: requesting teleport')
place = base.cr.playGame.getPlace()
place.requestTeleport(hoodId, zoneId, shardId, self.avId)
unloadTeleportPanel()
示例6: __init__
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def __init__(self, air, branchId, dnaStore, trophyMgr):
self.air = air
self.branchId = branchId
self.canonicalBranchId = ZoneUtil.getCanonicalZoneId(self.branchId)
self.dnaStore = dnaStore
self.trophyMgr = trophyMgr
self.__buildings = {}
self.findAllLandmarkBuildings()
示例7: genDNAFileName
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def genDNAFileName(self, zoneId):
zoneId = ZoneUtil.getCanonicalZoneId(zoneId)
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)
示例8: handleWaitForSetZoneResponse
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def handleWaitForSetZoneResponse(self, requestStatus):
hoodId = requestStatus['hoodId']
canonicalHoodId = ZoneUtil.getCanonicalZoneId(hoodId)
toHoodPhrase = ToontownGlobals.hoodNameMap[canonicalHoodId][0]
hoodName = ToontownGlobals.hoodNameMap[canonicalHoodId][-1]
zoneId = requestStatus['zoneId']
loaderName = requestStatus['loader']
avId = requestStatus.get('avId', -1)
ownerId = requestStatus.get('ownerId', avId)
if base.config.GetBool('want-qa-regression', 0):
self.notify.info('QA-REGRESSION: NEIGHBORHOODS: Visit %s' % hoodName)
count = ToontownGlobals.hoodCountMap[canonicalHoodId]
if loaderName == 'safeZoneLoader':
count += ToontownGlobals.safeZoneCountMap[canonicalHoodId]
elif loaderName == 'townLoader':
count += ToontownGlobals.townCountMap[canonicalHoodId]
if not loader.inBulkBlock:
if hoodId == ToontownGlobals.MyEstate:
if avId == -1:
loader.beginBulkLoad('hood', TTLocalizer.HeadingToYourEstate, count, 1, TTLocalizer.TIP_ESTATE)
else:
owner = base.cr.identifyAvatar(ownerId)
if owner == None:
friend = base.cr.identifyAvatar(avId)
if friend != None:
avName = friend.getName()
loader.beginBulkLoad('hood', TTLocalizer.HeadingToFriend % avName, count, 1, TTLocalizer.TIP_ESTATE)
else:
self.notify.warning("we can't perform this teleport")
return None
else:
avName = owner.getName()
loader.beginBulkLoad('hood', TTLocalizer.HeadingToEstate % avName, count, 1, TTLocalizer.TIP_ESTATE)
elif ZoneUtil.isCogHQZone(zoneId):
loader.beginBulkLoad('hood', TTLocalizer.HeadingToHood % {
'to': toHoodPhrase,
'hood': hoodName }, count, 1, TTLocalizer.TIP_COGHQ)
elif ZoneUtil.isGoofySpeedwayZone(zoneId):
loader.beginBulkLoad('hood', TTLocalizer.HeadingToHood % {
'to': toHoodPhrase,
'hood': hoodName }, count, 1, TTLocalizer.TIP_KARTING)
else:
loader.beginBulkLoad('hood', TTLocalizer.HeadingToHood % {
'to': toHoodPhrase,
'hood': hoodName }, count, 1, TTLocalizer.TIP_GENERAL)
if hoodId == ToontownGlobals.Tutorial:
self.loadDnaStoreTutorial()
else:
self.loadDnaStore()
hoodClass = self.getHoodClassByNumber(canonicalHoodId)
self.hood = hoodClass(self.fsm, self.hoodDoneEvent, self.dnaStore, hoodId)
self.hood.load()
self.hood.loadLoader(requestStatus)
if not base.placeBeforeObjects:
loader.endBulkLoad('hood')
示例9: createGameTables
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def createGameTables(self):
self.gameTables = []
for zoneId in self.getZoneTable():
dnaData = self.air.dnaDataMap.get(zoneId, None)
if dnaData.getName() == 'root':
area = ZoneUtil.getCanonicalZoneId(zoneId)
foundGameTables = self.findGameTables(
dnaData, zoneId, area, overrideDNAZone=True)
self.gameTables.extend(foundGameTables)
示例10: enterDFA
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def enterDFA(self, requestStatus):
doneEvent = 'dfaDoneEvent'
self.accept(doneEvent, self.enterDFACallback, [requestStatus])
self.dfa = DownloadForceAcknowledge.DownloadForceAcknowledge(doneEvent)
hood = ZoneUtil.getCanonicalZoneId(requestStatus['hoodId'])
if hood == ToontownGlobals.MyEstate:
self.dfa.enter(base.cr.hoodMgr.getPhaseFromHood(ToontownGlobals.MyEstate))
else:
self.dfa.enter(5)
示例11: __init__
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def __init__(self, air, zoneId):
DistributedObjectAI.DistributedObjectAI.__init__(self, air)
SuitPlannerBase.SuitPlannerBase.__init__(self)
self.air = air
self.zoneId = zoneId
self.canonicalZoneId = ZoneUtil.getCanonicalZoneId(zoneId)
if simbase.air.wantCogdominiums:
if not hasattr(self.__class__, 'CogdoPopAdjusted'):
self.__class__.CogdoPopAdjusted = True
for index in xrange(len(self.SuitHoodInfo)):
SuitBuildingGlobals[self.zoneId][0] = int(0.5 + self.CogdoPopFactor * SuitBuildingGlobals[self.zoneId][0])
SuitBuildingGlobals[self.zoneId][1] = int(0.5 + self.CogdoPopFactor * SuitBuildingGlobals[self.zoneId][1])
self.hoodInfoIdx = -1
for index in xrange(len(self.SuitHoodInfo)):
currHoodInfo = self.SuitHoodInfo[index]
if currHoodInfo[self.SUIT_HOOD_INFO_ZONE] == self.canonicalZoneId:
self.hoodInfoIdx = index
self.currDesired = None
self.baseNumSuits = (
self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_MIN] +
self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_MAX]) / 2
self.targetNumSuitBuildings = SuitBuildingGlobals.buildingMinMax[self.zoneId][0]
if ZoneUtil.isWelcomeValley(self.zoneId):
self.targetNumSuitBuildings = 0
self.pendingBuildingTracks = []
self.pendingBuildingHeights = []
self.suitList = []
self.numFlyInSuits = 0
self.numBuildingSuits = 0
self.numAttemptingTakeover = 0
self.zoneInfo = {}
self.zoneIdToPointMap = None
self.cogHQDoors = []
self.battleList = []
self.battleMgr = BattleManagerAI.BattleManagerAI(self.air)
self.setupDNA()
if self.notify.getDebug():
self.notify.debug('Creating a building manager AI in zone' + str(self.zoneId))
self.buildingMgr = self.air.buildingManagers.get(self.zoneId)
if self.buildingMgr:
(blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks, animBldgBlocks) = self.buildingMgr.getDNABlockLists()
for currBlock in blocks:
bldg = self.buildingMgr.getBuilding(currBlock)
bldg.setSuitPlannerExt(self)
for currBlock in animBldgBlocks:
bldg = self.buildingMgr.getBuilding(currBlock)
bldg.setSuitPlannerExt(self)
self.dnaStore.resetBlockNumbers()
self.initBuildingsAndPoints()
numSuits = simbase.config.GetInt('suit-count', -1)
if numSuits >= 0:
self.currDesired = numSuits
suitHood = simbase.config.GetInt('suits-only-in-hood', -1)
if suitHood >= 0:
if self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_ZONE] != suitHood:
self.currDesired = 0
self.suitCountAdjust = 0
示例12: createGameTables
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def createGameTables(self):
self.gameTables = []
for zoneId in self.getZoneTable():
dnaData = self.air.dnaDataMap.get(zoneId, None)
zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId)
if isinstance(dnaData, DNAData):
area = ZoneUtil.getCanonicalZoneId(zoneId)
foundGameTables = self.findGameTables(dnaData, zoneId, area, overrideDNAZone=True)
self.gameTables.extend(foundGameTables)
示例13: lookupDNAFileName
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [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)
示例14: createGolfKarts
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def createGolfKarts(self):
self.golfKarts = []
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)
foundGolfKarts = self.findGolfKarts(dnaData, zoneId, area, overrideDNAZone=True)
self.golfKarts.extend(foundGolfKarts)
for golfKart in self.golfKarts:
golfKart.start()
示例15: genDNAFileName
# 需要导入模块: from toontown.hood import ZoneUtil [as 别名]
# 或者: from toontown.hood.ZoneUtil import getCanonicalZoneId [as 别名]
def genDNAFileName(self):
try:
return simbase.air.genDNAFileName(self.getZoneId())
except:
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.dna' % (phase, hood, zoneId)