Poodletooth-iLand/toontown/hood/ZoneUtil.py

225 lines
6.1 KiB
Python
Raw Normal View History

2015-03-03 16:10:12 -06:00
from toontown.toonbase.ToontownGlobals import *
2015-03-03 16:10:12 -06:00
zoneUtilNotify = directNotify.newCategory('ZoneUtil')
tutorialDict = None
2015-03-03 16:10:12 -06:00
def isGoofySpeedwayZone(zoneId):
return zoneId == 8000
2015-03-03 16:10:12 -06:00
def isCogHQZone(zoneId):
return zoneId >= 10000 and zoneId < 15000
2015-03-03 16:10:12 -06:00
def isMintInteriorZone(zoneId):
return zoneId in (CashbotMintIntA, CashbotMintIntB, CashbotMintIntC)
2015-03-03 16:10:12 -06:00
def isDynamicZone(zoneId):
return zoneId >= DynamicZonesBegin and zoneId < DynamicZonesEnd
2015-03-03 16:10:12 -06:00
def getStreetName(branchId):
global tutorialDict
if tutorialDict:
return StreetNames[20000][-1]
else:
return StreetNames[branchId][-1]
2015-03-03 16:10:12 -06:00
def getLoaderName(zoneId):
if tutorialDict:
if zoneId == ToontownCentral:
loaderName = 'safeZoneLoader'
else:
loaderName = 'townLoader'
else:
suffix = zoneId % 1000
if suffix >= 500:
suffix -= 500
if isCogHQZone(zoneId):
loaderName = 'cogHQLoader'
elif suffix < 100:
loaderName = 'safeZoneLoader'
else:
loaderName = 'townLoader'
return loaderName
2015-03-03 16:10:12 -06:00
def getBranchLoaderName(zoneId):
return getLoaderName(getBranchZone(zoneId))
2015-03-03 16:10:12 -06:00
def getSuitWhereName(zoneId):
where = getWhereName(zoneId, 0)
return where
2015-03-03 16:10:12 -06:00
def getToonWhereName(zoneId):
where = getWhereName(zoneId, 1)
return where
2015-03-03 16:10:12 -06:00
def isPlayground(zoneId):
whereName = getWhereName(zoneId, False)
if whereName == 'cogHQExterior':
return True
else:
return zoneId % 1000 == 0 and zoneId < DynamicZonesBegin
2015-03-03 16:10:12 -06:00
def isHQ(zoneId):
if zoneId == 2520 or zoneId == 1507 or zoneId == 3508 or zoneId == 4504 or zoneId == 5502 or zoneId == 7503 or zoneId == 9505:
return True
return False
def isPetshop(zoneId):
if zoneId == 2522 or zoneId == 1510 or zoneId == 3511 or zoneId == 4508 or zoneId == 5505 or zoneId == 7504 or zoneId == 9508:
return True
return False
2015-03-03 16:10:12 -06:00
def getWhereName(zoneId, isToon):
if tutorialDict:
if zoneId in tutorialDict['interiors']:
where = 'toonInterior'
elif zoneId in tutorialDict['exteriors']:
where = 'street'
2015-05-26 12:12:34 -05:00
elif zoneId == ToontownCentral or zoneId == WelcomeValleyToken:
2015-03-03 16:10:12 -06:00
where = 'playground'
else:
zoneUtilNotify.error('No known zone: ' + str(zoneId))
else:
suffix = zoneId % 1000
suffix = suffix - suffix % 100
if isCogHQZone(zoneId):
if suffix == 0:
where = 'cogHQExterior'
elif suffix == 100:
where = 'cogHQLobby'
elif suffix == 200:
where = 'factoryExterior'
elif getHoodId(zoneId) == LawbotHQ and suffix in (300, 400, 500, 600):
where = 'stageInterior'
elif getHoodId(zoneId) == BossbotHQ and suffix in (500, 600, 700):
where = 'countryClubInterior'
elif suffix >= 500:
if getHoodId(zoneId) == SellbotHQ:
if suffix == 600:
2015-03-04 04:42:16 -06:00
where = 'megaCorpInterior'
2015-07-05 18:59:25 -05:00
else:
2015-03-03 16:10:12 -06:00
where = 'factoryInterior'
elif getHoodId(zoneId) == CashbotHQ:
where = 'mintInterior'
else:
zoneUtilNotify.error('unknown cogHQ interior for hood: ' + str(getHoodId(zoneId)))
else:
zoneUtilNotify.error('unknown cogHQ where: ' + str(zoneId))
elif suffix == 0:
where = 'playground'
elif suffix >= 500:
if isToon:
where = 'toonInterior'
else:
where = 'suitInterior'
else:
where = 'street'
return where
2015-03-03 16:10:12 -06:00
def getBranchZone(zoneId):
if tutorialDict:
branchId = tutorialDict['branch']
else:
branchId = zoneId - zoneId % 100
if not isCogHQZone(zoneId):
if zoneId % 1000 >= 500:
branchId -= 500
return branchId
def getCanonicalBranchZone(zoneId):
return getBranchZone(getCanonicalZoneId(zoneId))
def getCanonicalZoneId(zoneId):
return zoneId
2015-03-03 16:10:12 -06:00
def getHoodId(zoneId):
if tutorialDict:
hoodId = Tutorial
else:
hoodId = zoneId - zoneId % 1000
return hoodId
2015-03-03 16:10:12 -06:00
def getSafeZoneId(zoneId):
hoodId = getHoodId(zoneId)
if hoodId in HQToSafezone:
hoodId = HQToSafezone[hoodId]
return hoodId
def getCanonicalHoodId(zoneId):
return getHoodId(getCanonicalZoneId(zoneId))
def getCanonicalSafeZoneId(zoneId):
return getSafeZoneId(getCanonicalZoneId(zoneId))
2015-03-03 16:10:12 -06:00
def isInterior(zoneId):
if tutorialDict:
if zoneId in tutorialDict['interiors']:
r = 1
else:
r = 0
else:
r = zoneId % 1000 >= 500
return r
def overrideOn(branch, exteriorList, interiorList):
global tutorialDict
if tutorialDict:
zoneUtilNotify.warning('setTutorialDict: tutorialDict is already set!')
tutorialDict = {'branch': branch,
'exteriors': exteriorList,
'interiors': interiorList}
def overrideOff():
global tutorialDict
tutorialDict = None
return
def getWakeInfo(hoodId = None, zoneId = None):
wakeWaterHeight = 0
showWake = 0
try:
if hoodId is None:
hoodId = base.cr.playGame.getPlaceId()
if zoneId is None:
zoneId = base.cr.playGame.getPlace().getZoneId()
canonicalZoneId = getCanonicalZoneId(zoneId)
if canonicalZoneId == DonaldsDock:
2015-03-03 16:10:12 -06:00
wakeWaterHeight = DDWakeWaterHeight
showWake = 1
elif canonicalZoneId == ToontownCentral:
2015-03-03 16:10:12 -06:00
wakeWaterHeight = TTWakeWaterHeight
showWake = 1
elif canonicalZoneId == OutdoorZone:
2015-03-03 16:10:12 -06:00
wakeWaterHeight = OZWakeWaterHeight
showWake = 1
elif hoodId == MyEstate:
wakeWaterHeight = EstateWakeWaterHeight
showWake = 1
except AttributeError:
pass
return (showWake, wakeWaterHeight)
2015-04-07 16:15:58 -05:00
def canWearSuit(zoneId):
zoneId = getCanonicalHoodId(zoneId)
2015-07-05 18:59:25 -05:00
2015-04-07 16:15:58 -05:00
return zoneId >= DynamicZonesBegin or zoneId in [LawbotHQ, CashbotHQ, SellbotHQ, BossbotHQ]