Holocausted Welcome Valley

This commit is contained in:
DenialMC 2015-04-07 16:24:15 +03:00
parent 63aa2e6446
commit ad91b21823
60 changed files with 100 additions and 333 deletions

View file

@ -442,7 +442,6 @@ dclass CallbackObject {
};
from direct.distributed import DistributedObjectGlobal
from toontown.ai import WelcomeValleyManager/AI
from toontown.building import DistributedAnimatedProp/AI
from toontown.toon import DistributedToon/AI/UD
from toontown.safezone import DistributedTrolley/AI
@ -845,12 +844,6 @@ dclass ToontownDistrictStats : DistributedObject {
setStats : setAvatarCount, setNewAvatarCount;
};
dclass WelcomeValleyManager : DistributedObject {
clientSetZone(uint32) airecv clsend;
requestZoneIdMessage(uint32, uint16) airecv clsend;
requestZoneIdResponse(uint32, uint16);
};
dclass DistributedAnimatedProp : DistributedObject {
setPropId(uint16) required broadcast ram;
setAvatarInteract(uint32) required broadcast ram;

View file

@ -6,7 +6,6 @@ class PotentialShard:
self.id = id
self.name = None
self.population = 0
self.welcomeValleyPopulation = 0
self.active = 1
self.available = 1
return

View file

@ -218,8 +218,7 @@ class ToontownAIRepository(ToontownInternalRepository):
self.send(datagram)
def lookupDNAFileName(self, zoneId):
zoneId = ZoneUtil.getCanonicalZoneId(zoneId)
hoodId = ZoneUtil.getCanonicalHoodId(zoneId)
hoodId = ZoneUtil.getHoodId(zoneId)
hood = ToontownGlobals.dnaMap[hoodId]
if hoodId == zoneId:
zoneId = 'sz'

View file

@ -1,38 +0,0 @@
from pandac.PandaModules import *
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownGlobals
from direct.showbase import PythonUtil
class WelcomeValleyManager(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('WelcomeValleyManager')
neverDisable = 1
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
def generate(self):
if base.cr.welcomeValleyManager != None:
base.cr.welcomeValleyManager.delete()
base.cr.welcomeValleyManager = self
DistributedObject.DistributedObject.generate(self)
return
def disable(self):
self.ignore(ToontownGlobals.SynchronizeHotkey)
base.cr.welcomeValleyManager = None
DistributedObject.DistributedObject.disable(self)
return
def delete(self):
self.ignore(ToontownGlobals.SynchronizeHotkey)
base.cr.welcomeValleyManager = None
DistributedObject.DistributedObject.delete(self)
return
def requestZoneId(self, origZoneId, callback):
context = self.getCallbackContext(callback)
self.sendUpdate('requestZoneIdMessage', [origZoneId, context])
def requestZoneIdResponse(self, zoneId, context):
self.doCallbackContext(context, [zoneId])

View file

@ -1,18 +0,0 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class WelcomeValleyManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("WelcomeValleyManagerAI")
def clientSetZone(self, todo0):
pass
def toonSetZone(self, doId, newZoneId):
pass #TODO
def requestZoneIdMessage(self, todo0, todo1):
pass
def requestZoneIdResponse(self, todo0, todo1):
pass

View file

@ -104,8 +104,7 @@ class BattlePlace(Place.Place):
self.zoneId = newZoneId
def genDNAFileName(self, zoneId):
zoneId = ZoneUtil.getCanonicalZoneId(zoneId)
hoodId = ZoneUtil.getCanonicalHoodId(zoneId)
hoodId = ZoneUtil.getHoodId(zoneId)
hood = ToontownGlobals.dnaMap[hoodId]
phase = ToontownGlobals.streetPhaseMap[hoodId]
if hoodId == zoneId:

View file

@ -832,7 +832,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase):
def __teleportToSafeZone(self, toon):
self.notify.debug('teleportToSafeZone(%d)' % toon.doId)
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
hoodId = ZoneUtil.getHoodId(self.zoneId)
if hoodId in base.localAvatar.hoodsVisited:
target_sz = ZoneUtil.getSafeZoneId(self.zoneId)
else:

View file

@ -200,7 +200,7 @@ class DistributedBankInterior(DistributedObject):
self.vaultOpenSfx = loader.loadSfx('phase_4/audio/sfx/vault_door_open.ogg')
self.vaultCloseSfx = loader.loadSfx('phase_4/audio/sfx/vault_door_close.ogg')
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
hoodId = ZoneUtil.getHoodId(self.zoneId)
self.colors = ToonInteriorColors.colors[hoodId]
self.replaceRandomInModel(self.interior)

View file

@ -38,9 +38,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart
localAvatar.boardingParty = self
def announceGenerate(self):
canonicalZoneId = ZoneUtil.getCanonicalZoneId(self.zoneId)
self.notify.debug('canonicalZoneId = %s' % canonicalZoneId)
localAvatar.chatMgr.chatInputSpeedChat.addBoardingGroupMenu(canonicalZoneId)
localAvatar.chatMgr.chatInputSpeedChat.addBoardingGroupMenu(self.zoneId)
if base.config.GetBool('want-singing', 0):
localAvatar.chatMgr.chatInputSpeedChat.addSingingGroupMenu()

View file

@ -438,7 +438,6 @@ class DistributedBuilding(DistributedObject.DistributedObject):
level = int(self.difficulty / 2) + 1
suitNP = dnaStore.findNode('suit_landmark_' + chr(self.track) + str(level))
zoneId = dnaStore.getZoneFromBlockNumber(self.block)
zoneId = ZoneUtil.getTrueZoneId(zoneId, self.interiorZoneId)
newParentNP = base.cr.playGame.hood.loader.zoneDict[zoneId]
suitBuildingNP = suitNP.copyTo(newParentNP)
buildingTitle = dnaStore.getTitleFromBlockNumber(self.block)
@ -541,7 +540,6 @@ class DistributedBuilding(DistributedObject.DistributedObject):
if not suitNP:
suitNP = loader.loadModel('phase_5/models/cogdominium/%s' % FO_DICT[chr(self.track)])
zoneId = dnaStore.getZoneFromBlockNumber(self.block)
zoneId = ZoneUtil.getTrueZoneId(zoneId, self.interiorZoneId)
newParentNP = base.cr.playGame.hood.loader.zoneDict[zoneId]
suitBuildingNP = suitNP.copyTo(newParentNP)
buildingTitle = dnaStore.getTitleFromBlockNumber(self.block)
@ -930,8 +928,7 @@ class DistributedBuilding(DistributedObject.DistributedObject):
def getVisZoneId(self):
exteriorZoneId = base.cr.playGame.hood.dnaStore.getZoneFromBlockNumber(self.block)
visZoneId = ZoneUtil.getTrueZoneId(exteriorZoneId, self.zoneId)
return visZoneId
return exteriorZoneId
def getInteractiveProp(self):
result = None

View file

@ -30,7 +30,6 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
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(
@ -205,9 +204,8 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
def getExteriorAndInteriorZoneId(self):
blockNumber = self.block
dnaStore = self.air.dnaStoreMap[self.canonicalZoneId]
dnaStore = self.air.dnaStoreMap[self.zoneId]
zoneId = dnaStore.getZoneFromBlockNumber(blockNumber)
zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId)
interiorZoneId = (zoneId - (zoneId%100)) + 500 + blockNumber
return (zoneId, interiorZoneId)
@ -274,13 +272,11 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
def updateSavedBy(self, savedBy):
if self.savedBy:
for (avId, name, dna) in self.savedBy:
if not ZoneUtil.isWelcomeValley(self.zoneId):
self.trophyMgr.removeTrophy(avId, self.numFloors)
self.trophyMgr.removeTrophy(avId, self.numFloors)
self.savedBy = savedBy
if self.savedBy:
for (avId, name, dna) in self.savedBy:
if not ZoneUtil.isWelcomeValley(self.zoneId):
self.trophyMgr.addTrophy(avId, name, self.numFloors)
self.trophyMgr.addTrophy(avId, name, self.numFloors)
def enterWaitForVictors(self, victorList, savedBy):
activeToons = []
@ -387,7 +383,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
def enterToon(self):
self.d_setState('toon')
(exteriorZoneId, interiorZoneId) = self.getExteriorAndInteriorZoneId()
if simbase.config.GetBool('want-new-toonhall', 1) and ZoneUtil.getCanonicalZoneId(interiorZoneId) == ToonHall:
if simbase.config.GetBool('want-new-toonhall', 1) and interiorZoneId == ToonHall:
self.interior = DistributedToonHallInteriorAI.DistributedToonHallInteriorAI(self.block, self.air, interiorZoneId, self)
else:
self.interior = DistributedToonInteriorAI.DistributedToonInteriorAI(self.block, self.air, interiorZoneId, self)

View file

@ -8,9 +8,6 @@ from toontown.building import KartShopBuildingAI
from toontown.building import PetshopBuildingAI
from toontown.building import BankBuildingAI
from toontown.building import LibraryBuildingAI
from toontown.hood import ZoneUtil
# from toontown.building import DistributedAnimBuildingAI
class DistributedBuildingMgrAI:
notify = directNotify.newCategory('DistributedBuildingMgrAI')
@ -18,7 +15,6 @@ class DistributedBuildingMgrAI:
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 = {}
@ -172,9 +168,8 @@ class DistributedBuildingMgrAI:
return self.newBuilding(blockNumber, backup=backup)
def newHQBuilding(self, blockNumber):
dnaStore = self.air.dnaStoreMap[self.canonicalBranchId]
dnaStore = self.air.dnaStoreMap[self.branchId]
exteriorZoneId = dnaStore.getZoneFromBlockNumber(blockNumber)
exteriorZoneId = ZoneUtil.getTrueZoneId(exteriorZoneId, self.branchId)
interiorZoneId = (self.branchId - (self.branchId%100)) + 500 + blockNumber
building = HQBuildingAI.HQBuildingAI(
self.air, exteriorZoneId, interiorZoneId, blockNumber)
@ -182,9 +177,8 @@ class DistributedBuildingMgrAI:
return building
def newGagshopBuilding(self, blockNumber):
dnaStore = self.air.dnaStoreMap[self.canonicalBranchId]
dnaStore = self.air.dnaStoreMap[self.branchId]
exteriorZoneId = dnaStore.getZoneFromBlockNumber(blockNumber)
exteriorZoneId = ZoneUtil.getTrueZoneId(exteriorZoneId, self.branchId)
interiorZoneId = (self.branchId - (self.branchId%100)) + 500 + blockNumber
building = GagshopBuildingAI.GagshopBuildingAI(
self.air, exteriorZoneId, interiorZoneId, blockNumber)
@ -192,9 +186,8 @@ class DistributedBuildingMgrAI:
return building
def newPetshopBuilding(self, blockNumber):
dnaStore = self.air.dnaStoreMap[self.canonicalBranchId]
dnaStore = self.air.dnaStoreMap[self.branchId]
exteriorZoneId = dnaStore.getZoneFromBlockNumber(blockNumber)
exteriorZoneId = ZoneUtil.getTrueZoneId(exteriorZoneId, self.branchId)
interiorZoneId = (self.branchId - (self.branchId%100)) + 500 + blockNumber
building = PetshopBuildingAI.PetshopBuildingAI(
self.air, exteriorZoneId, interiorZoneId, blockNumber)
@ -202,9 +195,8 @@ class DistributedBuildingMgrAI:
return building
def newKartShopBuilding(self, blockNumber):
dnaStore = self.air.dnaStoreMap[self.canonicalBranchId]
dnaStore = self.air.dnaStoreMap[self.branchId]
exteriorZoneId = dnaStore.getZoneFromBlockNumber(blockNumber)
exteriorZoneId = ZoneUtil.getTrueZoneId(exteriorZoneId, self.branchId)
interiorZoneId = (self.branchId - (self.branchId%100)) + 500 + blockNumber
building = KartShopBuildingAI.KartShopBuildingAI(
self.air, exteriorZoneId, interiorZoneId, blockNumber)
@ -212,9 +204,8 @@ class DistributedBuildingMgrAI:
return building
def newBankBuilding(self, blockNumber):
dnaStore = self.air.dnaStoreMap[self.canonicalBranchId]
dnaStore = self.air.dnaStoreMap[self.branchId]
exteriorZoneId = dnaStore.getZoneFromBlockNumber(blockNumber)
exteriorZoneId = ZoneUtil.getTrueZoneId(exteriorZoneId, self.branchId)
interiorZoneId = (self.branchId - (self.branchId%100)) + 500 + blockNumber
building = BankBuildingAI.BankBuildingAI(
self.air, exteriorZoneId, interiorZoneId, blockNumber)
@ -222,9 +213,8 @@ class DistributedBuildingMgrAI:
return building
def newLibraryBuilding(self, blockNumber):
dnaStore = self.air.dnaStoreMap[self.canonicalBranchId]
dnaStore = self.air.dnaStoreMap[self.branchId]
exteriorZoneId = dnaStore.getZoneFromBlockNumber(blockNumber)
exteriorZoneId = ZoneUtil.getTrueZoneId(exteriorZoneId, self.branchId)
interiorZoneId = (self.branchId - (self.branchId%100)) + 500 + blockNumber
building = LibraryBuildingAI.LibraryBuildingAI(
self.air, exteriorZoneId, interiorZoneId, blockNumber)

View file

@ -507,7 +507,6 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
'zoneId': zoneId,
'shardId': None,
'avId': -1,
'allowRedirect': 0,
'doorDoId': self.otherDoId
}
return request

View file

@ -73,7 +73,7 @@ class DistributedGagshopInterior(DistributedObject.DistributedObject):
self.randomGenerator.seed(self.zoneId)
self.interior = loader.loadModel('phase_4/models/modules/gagShop_interior')
self.interior.reparentTo(render)
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
hoodId = ZoneUtil.getHoodId(self.zoneId)
self.colors = ToonInteriorColors.colors[hoodId]
self.replaceRandomInModel(self.interior)
door = self.chooseDoor()

View file

@ -25,7 +25,7 @@ class DistributedLibraryInterior(DistributedObject):
door = self.cr.playGame.dnaStore.findNode('door_double_round_ur')
doorNodePath = door.copyTo(doorOrigin)
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
hoodId = ZoneUtil.getHoodId(self.zoneId)
doorColor = ToonInteriorColors.colors[hoodId]['TI_door'][0]
setupDoor(
doorNodePath, self.interior, doorOrigin, self.cr.playGame.dnaStore,
@ -68,6 +68,6 @@ class DistributedLibraryInterior(DistributedObject):
_nodePath = nodePath
if name[8] == 'c':
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
hoodId = ZoneUtil.getHoodId(self.zoneId)
colors = ToonInteriorColors.colors[hoodId]
_nodePath.setColorScale(generator.choice(colors[category]))

View file

@ -81,7 +81,7 @@ class DistributedPetshopInterior(DistributedObject.DistributedObject):
self.fish.setPos(0, 6, -4)
self.fish.setPlayRate(0.7, 'swim')
self.fish.loop('swim')
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
hoodId = ZoneUtil.getHoodId(self.zoneId)
self.colors = ToonInteriorColors.colors[hoodId]
self.replaceRandomInModel(self.interior)
door = self.chooseDoor()

View file

@ -66,7 +66,7 @@ class DistributedToonHallInterior(DistributedToonInterior):
self.randomGenerator.seed(self.zoneId)
interior = self.randomDNAItem('TI_hall', self.dnaStore.findNode)
self.interior = interior.copyTo(render)
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
hoodId = ZoneUtil.getHoodId(self.zoneId)
self.colors = ToonInteriorColors.colors[hoodId]
self.replaceRandomInModel(self.interior)
doorModelName = 'door_double_round_ul'

View file

@ -99,7 +99,7 @@ class DistributedToonInterior(DistributedObject.DistributedObject):
self.randomGenerator.seed(self.zoneId)
interior = self.randomDNAItem('TI_room', self.dnaStore.findNode)
self.interior = interior.copyTo(render)
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
hoodId = ZoneUtil.getHoodId(self.zoneId)
self.colors = ToonInteriorColors.colors[hoodId]
self.replaceRandomInModel(self.interior)
doorModelName = 'door_double_round_ul'

View file

@ -98,7 +98,7 @@ class DistributedTutorialInterior(DistributedObject.DistributedObject):
self.sky.setDepthWrite(0)
self.sky.setBin('background', 100)
self.sky.find('**/Sky').reparentTo(self.sky, -1)
hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId)
hoodId = ZoneUtil.getHoodId(self.zoneId)
self.colors = ToonInteriorColors.colors[hoodId]
self.replaceRandomInModel(self.interior)
doorModelName = 'door_double_round_ul'

View file

@ -75,7 +75,6 @@ class BossbotHQExterior(CogHQExterior.CogHQExterior):
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)))

View file

@ -69,7 +69,6 @@ class CashbotHQExterior(CogHQExterior.CogHQExterior):
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)))

View file

@ -28,7 +28,6 @@ class DistributedCogHQDoor(DistributedDoor.DistributedDoor):
'zoneId': zoneId,
'shardId': None,
'avId': -1,
'allowRedirect': 0,
'doorDoId': self.otherDoId}
return request
@ -75,8 +74,7 @@ class DistributedCogHQDoor(DistributedDoor.DistributedDoor):
def setZoneIdAndBlock(self, zoneId, block):
self.zoneId = zoneId
self.block = block
canonicalZoneId = ZoneUtil.getCanonicalZoneId(zoneId)
if canonicalZoneId in (ToontownGlobals.BossbotHQ, ToontownGlobals.BossbotLobby):
if zoneId in (ToontownGlobals.BossbotHQ, ToontownGlobals.BossbotLobby):
self.doorX = 1.0
def enterDoor(self):

View file

@ -77,7 +77,6 @@ class FactoryExterior(BattlePlace.BattlePlace):
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)))

View file

@ -27,7 +27,6 @@ class LawbotHQExterior(CogHQExterior.CogHQExterior):
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)))

View file

@ -23,7 +23,6 @@ class SellbotHQExterior(CogHQExterior.CogHQExterior):
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)))

View file

@ -237,7 +237,7 @@ class HoodMgr(DirectObject.DirectObject):
return p
def getPhaseFromHood(self, hoodId):
hoodId = ZoneUtil.getCanonicalHoodId(hoodId)
hoodId = ZoneUtil.getHoodId(hoodId)
return ToontownGlobals.phaseMap[hoodId]
def getPlaygroundCenterFromId(self, hoodId):
@ -263,7 +263,6 @@ class HoodMgr(DirectObject.DirectObject):
self.notify.error('No such hood id as: %s' % hoodId)
def getFullnameFromId(self, hoodId):
hoodId = ZoneUtil.getCanonicalZoneId(hoodId)
return ToontownGlobals.hoodNameMap[hoodId][-1]
def addLinkTunnelHooks(self, hoodPart, nodeList, currentZoneId):
@ -278,8 +277,6 @@ class HoodMgr(DirectObject.DirectObject):
zoneStr = nameParts[2]
hoodId = self.getIdFromName(hoodStr)
zoneId = int(zoneStr)
hoodId = ZoneUtil.getTrueZoneId(hoodId, currentZoneId)
zoneId = ZoneUtil.getTrueZoneId(zoneId, currentZoneId)
linkSphere = linkTunnel.find('**/tunnel_trigger')
if linkSphere.isEmpty():
linkSphere = linkTunnel.find('**/tunnel_sphere')

View file

@ -224,20 +224,19 @@ class PlayGame(StateData.StateData):
def handleWaitForSetZoneResponse(self, requestStatus):
hoodId = requestStatus['hoodId']
canonicalHoodId = ZoneUtil.getCanonicalZoneId(hoodId)
toHoodPhrase = ToontownGlobals.hoodNameMap[canonicalHoodId][0]
hoodName = ToontownGlobals.hoodNameMap[canonicalHoodId][-1]
toHoodPhrase = ToontownGlobals.hoodNameMap[hoodId][0]
hoodName = ToontownGlobals.hoodNameMap[hoodId][-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]
count = ToontownGlobals.hoodCountMap[hoodId]
if loaderName == 'safeZoneLoader':
count += ToontownGlobals.safeZoneCountMap[canonicalHoodId]
count += ToontownGlobals.safeZoneCountMap[hoodId]
elif loaderName == 'townLoader':
count += ToontownGlobals.townCountMap[canonicalHoodId]
count += ToontownGlobals.townCountMap[hoodId]
if not loader.inBulkBlock:
if hoodId == ToontownGlobals.MyEstate:
if avId == -1:
@ -269,7 +268,7 @@ class PlayGame(StateData.StateData):
else:
if not hasattr(self, 'dnaStore'):
self.loadDnaStore()
hoodClass = self.getHoodClassByNumber(canonicalHoodId)
hoodClass = self.getHoodClassByNumber(hoodId)
self.hood = hoodClass(self.fsm, self.hoodDoneEvent, self.dnaStore, hoodId)
self.hood.load()
self.hood.loadLoader(requestStatus)
@ -279,8 +278,7 @@ class PlayGame(StateData.StateData):
def handleLeftQuietZone(self):
status = self.quietZoneStateData.getRequestStatus()
hoodId = ZoneUtil.getCanonicalZoneId(status['hoodId'])
hoodState = self.getHoodStateByNumber(hoodId)
hoodState = self.getHoodStateByNumber(status['hoodId'])
self.fsm.request(hoodState, [status])
def handleQuietZoneDone(self):

View file

@ -79,7 +79,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.bankManager = None
self.catalogManager = None
self.tutorialManager = None
self.welcomeValleyManager = None
self.newsManager = None
self.streetSign = None
self.distributedDistrict = None

View file

@ -124,7 +124,6 @@ class DistributedHouseDoor(DistributedDoor.DistributedDoor):
'zoneId': zoneId,
'shardId': None,
'avId': -1,
'allowRedirect': 0,
'doorDoId': self.otherDoId}
messenger.send('doorDoneEvent', [request])
return

View file

@ -62,7 +62,7 @@ class GSHoodAI(HoodAI.HoodAI):
racingPads.append(racingPad)
elif isinstance(dnaGroup, DNAVisGroup):
zoneId = ZoneUtil.getTrueZoneId(int(dnaGroup.getName().split(':')[0]), zoneId)
zoneId = int(dnaGroup.getName().split(':')[0])
for i in xrange(dnaGroup.getNumChildren()):
(foundRacingPads, foundRacingPadGroups) = self.findRacingPads(dnaGroup.at(i), zoneId, area, padType=padType)
racingPads.extend(foundRacingPads)
@ -98,11 +98,9 @@ class GSHoodAI(HoodAI.HoodAI):
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')
(foundRacingPads, foundRacingPadGroups) = self.findRacingPads(dnaData, zoneId, zoneId, padType='racing_pad')
(foundViewingPads, foundViewingPadGroups) = self.findRacingPads(dnaData, zoneId, zoneId, padType='viewing_pad')
self.racingPads.extend(foundRacingPads)
racingPadGroups.extend(foundRacingPadGroups)
self.viewingPads.extend(foundViewingPads)

View file

@ -37,7 +37,7 @@ class GZHoodAI(HoodAI.HoodAI):
golfKart.generateWithRequired(zoneId)
golfKarts.append(golfKart)
elif isinstance(dnaGroup, DNAVisGroup) and (not overrideDNAZone):
zoneId = ZoneUtil.getTrueZoneId(int(dnaGroup.getName().split(':')[0]), zoneId)
zoneId = int(dnaGroup.getName().split(':')[0])
for i in xrange(dnaGroup.getNumChildren()):
foundGolfKarts = self.findGolfKarts(dnaGroup.at(i), zoneId, area, overrideDNAZone=overrideDNAZone)
golfKarts.extend(foundGolfKarts)
@ -47,10 +47,8 @@ class GZHoodAI(HoodAI.HoodAI):
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)
foundGolfKarts = self.findGolfKarts(dnaData, zoneId, zoneId, overrideDNAZone=True)
self.golfKarts.extend(foundGolfKarts)
for golfKart in self.golfKarts:
golfKart.start()

View file

@ -84,7 +84,7 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp):
try:
visId = int(splits[2])
self.visId = visId
self.hoodId = ZoneUtil.getCanonicalHoodId(visId)
self.hoodId = ZoneUtil.getHoodId(visId)
self.notify.debug('calcHoodId %d from %s' % (self.hoodId, fullString))
except Exception, generic:
if 'Editor' not in fullString:

View file

@ -44,7 +44,7 @@ class Hood(StateData.StateData):
def getHoodText(self, zoneId):
hoodText = base.cr.hoodMgr.getFullnameFromId(self.id)
if self.id != Tutorial:
streetName = StreetNames.get(ZoneUtil.getCanonicalBranchZone(zoneId))
streetName = StreetNames.get(ZoneUtil.getBranchZone(zoneId))
if streetName:
hoodText = hoodText + '\n' + streetName[-1]
return hoodText
@ -168,8 +168,8 @@ class Hood(StateData.StateData):
elif loaderName == 'townLoader':
if not loader.inBulkBlock:
zoneId = requestStatus['zoneId']
toPhrase = StreetNames[ZoneUtil.getCanonicalBranchZone(zoneId)][0]
streetName = StreetNames[ZoneUtil.getCanonicalBranchZone(zoneId)][-1]
toPhrase = StreetNames[ZoneUtil.getBranchZone(zoneId)][0]
streetName = StreetNames[ZoneUtil.getBranchZone(zoneId)][-1]
loader.beginBulkLoad('hood', TTLocalizer.HeadingToStreet % {'to': toPhrase,
'street': streetName}, townCountMap[self.id], 1, TTLocalizer.TIP_STREET, zoneId)
self.loadLoader(requestStatus)

View file

@ -92,7 +92,7 @@ class HoodAI:
fishingPonds.append(fishingPond)
elif isinstance(dnaGroup, DNAVisGroup):
zoneId = ZoneUtil.getTrueZoneId(int(dnaGroup.getName().split(':')[0]), zoneId)
zoneId = int(dnaGroup.getName().split(':')[0])
for i in xrange(dnaGroup.getNumChildren()):
(foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds(dnaGroup.at(i), zoneId, area)
fishingPonds.extend(foundFishingPonds)
@ -120,10 +120,8 @@ class HoodAI:
fishingPondGroups = []
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)
(foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds(dnaData, zoneId, area)
(foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds(dnaData, zoneId, zoneId)
self.fishingPonds.extend(foundFishingPonds)
fishingPondGroups.extend(foundFishingPondGroups)
for fishingPond in self.fishingPonds:
@ -149,7 +147,6 @@ class HoodAI:
self.partyGates = []
for zoneId in self.getZoneTable():
dnaData = self.air.dnaDataMap.get(zoneId, None)
zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId)
if dnaData.getName() == 'root':
foundPartyGates = self.findPartyGates(dnaData, zoneId)
self.partyGates.extend(foundPartyGates)
@ -167,7 +164,6 @@ class HoodAI:
def createBuildingManagers(self):
for zoneId in self.getZoneTable():
dnaStore = self.air.dnaStoreMap[zoneId]
zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId)
buildingManager = DistributedBuildingMgrAI.DistributedBuildingMgrAI(
self.air, zoneId, dnaStore, self.air.trophyMgr)
self.buildingManagers.append(buildingManager)
@ -177,7 +173,6 @@ class HoodAI:
for zoneId in self.getZoneTable():
if zoneId == self.zoneId:
continue
zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId)
suitPlanner = DistributedSuitPlannerAI.DistributedSuitPlannerAI(self.air, zoneId)
suitPlanner.generateWithRequired(zoneId)
suitPlanner.d_setZoneId(zoneId)

View file

@ -46,7 +46,7 @@ class OZHoodAI(HoodAI.HoodAI):
picnicTable.generateWithRequired(zoneId)
picnicTables.append(picnicTable)
elif isinstance(dnaGroup, DNAVisGroup) and (not overrideDNAZone):
zoneId = ZoneUtil.getTrueZoneId(int(dnaGroup.getName().split(':')[0]), zoneId)
zoneId = int(dnaGroup.getName().split(':')[0])
for i in xrange(dnaGroup.getNumChildren()):
foundPicnicTables = self.findPicnicTables(
dnaGroup.at(i), zoneId, area, overrideDNAZone=overrideDNAZone)
@ -57,11 +57,9 @@ class OZHoodAI(HoodAI.HoodAI):
self.picnicTables = []
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)
foundPicnicTables = self.findPicnicTables(
dnaData, zoneId, area, overrideDNAZone=True)
dnaData, zoneId, zoneId, overrideDNAZone=True)
self.picnicTables.extend(foundPicnicTables)
for picnicTable in self.picnicTables:
picnicTable.start()
@ -78,7 +76,7 @@ class OZHoodAI(HoodAI.HoodAI):
gameTable.setPosHpr(pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2])
gameTable.generateWithRequired(zoneId)
elif isinstance(dnaGroup, DNAVisGroup) and (not overrideDNAZone):
zoneId = ZoneUtil.getTrueZoneId(int(dnaGroup.getName().split(':')[0]), zoneId)
zoneId = int(dnaGroup.getName().split(':')[0])
for i in xrange(dnaGroup.getNumChildren()):
foundGameTables = self.findGameTables(
dnaGroup.at(i), zoneId, area, overrideDNAZone=overrideDNAZone)
@ -89,9 +87,7 @@ class OZHoodAI(HoodAI.HoodAI):
self.gameTables = []
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)
foundGameTables = self.findGameTables(
dnaData, zoneId, area, overrideDNAZone=True)
dnaData, zoneId, zoneId, overrideDNAZone=True)
self.gameTables.extend(foundGameTables)

View file

@ -546,10 +546,9 @@ class Place(StateData.StateData, FriendsListManager.FriendsListManager):
zoneId = requestStatus['zoneId']
how = requestStatus['how']
tunnelOrigin = requestStatus['tunnelOrigin']
fromZoneId = ZoneUtil.getCanonicalZoneId(self.getZoneId())
tunnelName = requestStatus.get('tunnelName')
if tunnelName == None:
tunnelName = base.cr.hoodMgr.makeLinkTunnelName(self.loader.hood.id, fromZoneId)
tunnelName = base.cr.hoodMgr.makeLinkTunnelName(self.loader.hood.id, self.getZoneId())
self.doneStatus = {'loader': ZoneUtil.getLoaderName(zoneId),
'where': ZoneUtil.getToonWhereName(zoneId),
'how': how,

View file

@ -211,29 +211,7 @@ class QuietZoneState(StateData.StateData):
base.cr.handlerArgs = self._requestStatus
base.cr.setInQuietZone(True)
self.waitForDatabase('WaitForZoneRedirect')
zoneId = self._requestStatus['zoneId']
avId = self._requestStatus.get('avId', -1)
allowRedirect = self._requestStatus.get('allowRedirect', 1)
if avId != -1:
allowRedirect = 0
if not base.cr.welcomeValleyManager:
newZoneId = ZoneUtil.getCanonicalZoneId(zoneId)
if newZoneId != zoneId:
self.gotZoneRedirect(newZoneId)
return
if allowRedirect and ZoneUtil.isWelcomeValley(zoneId):
self.notify.info('Requesting AI redirect from zone %s.' % zoneId)
if base.slowQuietZone:
def rZI(task, zoneId = zoneId, self = self):
base.cr.welcomeValleyManager.requestZoneId(zoneId, self.gotZoneRedirect)
return Task.done
taskMgr.doMethodLater(base.slowQuietZoneDelay, rZI, 'slowQuietZone-welcomeValleyRedirect')
else:
base.cr.welcomeValleyManager.requestZoneId(zoneId, self.gotZoneRedirect)
else:
self.fsm.request('waitForSetZoneResponse')
self.gotZoneRedirect(self._requestStatus['zoneId'])
def gotZoneRedirect(self, zoneId):
self.notify.info('Redirecting to zone %s.' % zoneId)

View file

@ -26,7 +26,7 @@ class TrialerForceAcknowledge:
if base.cr.isPaid():
letThrough()
return
if ZoneUtil.getCanonicalHoodId(destHood) in (ToontownGlobals.ToontownCentral, ToontownGlobals.MyEstate, ToontownGlobals.GoofySpeedway):
if ZoneUtil.getHoodId(destHood) in (ToontownGlobals.ToontownCentral, ToontownGlobals.MyEstate, ToontownGlobals.GoofySpeedway):
letThrough()
return
else:

View file

@ -1,26 +1,20 @@
from toontown.toonbase.ToontownGlobals import *
zoneUtilNotify = directNotify.newCategory('ZoneUtil')
tutorialDict = None
def isGoofySpeedwayZone(zoneId):
return zoneId == 8000
def isCogHQZone(zoneId):
return zoneId >= 10000 and zoneId < 15000
def isMintInteriorZone(zoneId):
return zoneId in (CashbotMintIntA, CashbotMintIntB, CashbotMintIntC)
def isDynamicZone(zoneId):
return zoneId >= DynamicZonesBegin and zoneId < DynamicZonesEnd
def getStreetName(branchId):
global tutorialDict
if tutorialDict:
@ -28,7 +22,6 @@ def getStreetName(branchId):
else:
return StreetNames[branchId][-1]
def getLoaderName(zoneId):
if tutorialDict:
if zoneId == ToontownCentral:
@ -47,21 +40,17 @@ def getLoaderName(zoneId):
loaderName = 'townLoader'
return loaderName
def getBranchLoaderName(zoneId):
return getLoaderName(getBranchZone(zoneId))
def getSuitWhereName(zoneId):
where = getWhereName(zoneId, 0)
return where
def getToonWhereName(zoneId):
where = getWhereName(zoneId, 1)
return where
def isPlayground(zoneId):
whereName = getWhereName(zoneId, False)
if whereName == 'cogHQExterior':
@ -69,7 +58,6 @@ def isPlayground(zoneId):
else:
return zoneId % 1000 == 0 and zoneId < DynamicZonesBegin
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
@ -80,14 +68,13 @@ def isPetshop(zoneId):
return True
return False
def getWhereName(zoneId, isToon):
if tutorialDict:
if zoneId in tutorialDict['interiors']:
where = 'toonInterior'
elif zoneId in tutorialDict['exteriors']:
where = 'street'
elif zoneId == ToontownCentral or zoneId == WelcomeValleyToken:
elif zoneId == ToontownCentral:
where = 'playground'
else:
zoneUtilNotify.error('No known zone: ' + str(zoneId))
@ -128,7 +115,6 @@ def getWhereName(zoneId, isToon):
where = 'street'
return where
def getBranchZone(zoneId):
if tutorialDict:
branchId = tutorialDict['branch']
@ -139,40 +125,6 @@ def getBranchZone(zoneId):
branchId -= 500
return branchId
def getCanonicalBranchZone(zoneId):
return getBranchZone(getCanonicalZoneId(zoneId))
def isWelcomeValley(zoneId):
return zoneId == WelcomeValleyToken or zoneId >= WelcomeValleyBegin and zoneId < WelcomeValleyEnd
def getCanonicalZoneId(zoneId):
if zoneId == WelcomeValleyToken:
zoneId = ToontownCentral
elif zoneId >= WelcomeValleyBegin and zoneId < WelcomeValleyEnd:
zoneId = zoneId % 2000
if zoneId < 1000:
zoneId = zoneId + ToontownCentral
else:
zoneId = zoneId - 1000 + GoofySpeedway
return zoneId
def getTrueZoneId(zoneId, currentZoneId):
if zoneId >= WelcomeValleyBegin and zoneId < WelcomeValleyEnd or zoneId == WelcomeValleyToken:
zoneId = getCanonicalZoneId(zoneId)
if currentZoneId >= WelcomeValleyBegin and currentZoneId < WelcomeValleyEnd:
hoodId = getHoodId(zoneId)
offset = currentZoneId - currentZoneId % 2000
if hoodId == ToontownCentral:
return zoneId - ToontownCentral + offset
elif hoodId == GoofySpeedway:
return zoneId - GoofySpeedway + offset + 1000
return zoneId
def getHoodId(zoneId):
if tutorialDict:
hoodId = Tutorial
@ -180,22 +132,12 @@ def getHoodId(zoneId):
hoodId = zoneId - zoneId % 1000
return hoodId
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))
def isInterior(zoneId):
if tutorialDict:
if zoneId in tutorialDict['interiors']:
@ -206,7 +148,6 @@ def isInterior(zoneId):
r = zoneId % 1000 >= 500
return r
def overrideOn(branch, exteriorList, interiorList):
global tutorialDict
if tutorialDict:
@ -215,13 +156,11 @@ def overrideOn(branch, exteriorList, interiorList):
'exteriors': exteriorList,
'interiors': interiorList}
def overrideOff():
global tutorialDict
tutorialDict = None
return
def getWakeInfo(hoodId = None, zoneId = None):
wakeWaterHeight = 0
showWake = 0
@ -230,14 +169,13 @@ def getWakeInfo(hoodId = None, zoneId = None):
hoodId = base.cr.playGame.getPlaceId()
if zoneId is None:
zoneId = base.cr.playGame.getPlace().getZoneId()
canonicalZoneId = getCanonicalZoneId(zoneId)
if canonicalZoneId == DonaldsDock:
if zoneId == DonaldsDock:
wakeWaterHeight = DDWakeWaterHeight
showWake = 1
elif canonicalZoneId == ToontownCentral:
elif zoneId == ToontownCentral:
wakeWaterHeight = TTWakeWaterHeight
showWake = 1
elif canonicalZoneId == OutdoorZone:
elif zoneId == OutdoorZone:
wakeWaterHeight = OZWakeWaterHeight
showWake = 1
elif hoodId == MyEstate:
@ -246,4 +184,4 @@ def getWakeInfo(hoodId = None, zoneId = None):
except AttributeError:
pass
return (showWake, wakeWaterHeight)
return (showWake, wakeWaterHeight)

View file

@ -27,7 +27,7 @@ def getDifficulty(trolleyZone):
def getSafezoneId(trolleyZone):
return ZoneUtil.getCanonicalHoodId(trolleyZone)
return ZoneUtil.getHoodId(trolleyZone)
def getScoreMult(trolleyZone):

View file

@ -53,7 +53,7 @@ class PetshopGUI(DirectObject):
notify = DirectNotifyGlobal.directNotify.newCategory('PetshopGUI.NamePicker')
def __init__(self, doneEvent, petSeed, gender):
zoneId = ZoneUtil.getCanonicalSafeZoneId(base.localAvatar.getZoneId())
zoneId = ZoneUtil.getSafeZoneId(base.localAvatar.getZoneId())
name, dna, traitSeed = PetUtil.getPetInfoFromSeed(petSeed, zoneId)
self.gui = loader.loadModel('phase_4/models/gui/PetNamePanel')
self.guiScale = 0.09
@ -201,7 +201,7 @@ class PetshopGUI(DirectObject):
notify = DirectNotifyGlobal.directNotify.newCategory('PetshopGUI.AdoptPetDlg')
def __init__(self, doneEvent, petSeed, petNameIndex):
zoneId = ZoneUtil.getCanonicalSafeZoneId(base.localAvatar.getZoneId())
zoneId = ZoneUtil.getSafeZoneId(base.localAvatar.getZoneId())
name, dna, traitSeed = PetUtil.getPetInfoFromSeed(petSeed, zoneId)
name = TTLocalizer.getPetName(petNameIndex)
cost = PetUtil.getPetCostFromSeed(petSeed, zoneId)
@ -326,7 +326,7 @@ class PetshopGUI(DirectObject):
self.petCost = []
for i in range(self.numPets):
random.seed(self.petSeeds[i])
zoneId = ZoneUtil.getCanonicalSafeZoneId(base.localAvatar.getZoneId())
zoneId = ZoneUtil.getSafeZoneId(base.localAvatar.getZoneId())
name, dna, traitSeed = PetUtil.getPetInfoFromSeed(self.petSeeds[i], zoneId)
cost = PetUtil.getPetCostFromSeed(self.petSeeds[i], zoneId)
traits = PetTraits.PetTraits(traitSeed, zoneId)

View file

@ -149,8 +149,8 @@ class QuestMap(DirectFrame):
continue
npcZoneId = NPCToons.getNPCZone(toNpcId)
hoodId = ZoneUtil.getCanonicalHoodId(npcZoneId)
branchId = ZoneUtil.getCanonicalBranchZone(npcZoneId)
hoodId = ZoneUtil.getHoodId(npcZoneId)
branchId = ZoneUtil.getBranchZone(npcZoneId)
if (self.hoodId != hoodId) or (self.zoneId != branchId):
continue
@ -189,8 +189,8 @@ class QuestMap(DirectFrame):
def updateMap(self):
if self.av:
hoodId = ZoneUtil.getCanonicalHoodId(self.av.getLocation()[1])
zoneId = ZoneUtil.getCanonicalBranchZone(self.av.getLocation()[1])
hoodId = ZoneUtil.getHoodId(self.av.getLocation()[1])
zoneId = ZoneUtil.getBranchZone(self.av.getLocation()[1])
try:
mapsGeom = loader.loadModel('phase_4/models/questmap/%s_maps' % ToontownGlobals.dnaMap[hoodId])
except:

View file

@ -176,9 +176,9 @@ class QuestPoster(DirectFrame):
def teleportToShop(self, npcId):
npcZone = NPCToons.getNPCZone(npcId)
npcHood = ZoneUtil.getCanonicalHoodId(npcZone)
npcHood = ZoneUtil.getHoodId(npcZone)
avZone = base.localAvatar.getZoneId()
avHood = ZoneUtil.getCanonicalHoodId(avZone)
avHood = ZoneUtil.getHoodId(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}
@ -263,7 +263,7 @@ class QuestPoster(DirectFrame):
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)
hoodId = ZoneUtil.getHoodId(npcZone)
self.chooseButton['command'] = callback
self.chooseButton['extraArgs'] = [questId]
self.unbind(DGG.WITHIN)
@ -331,7 +331,7 @@ class QuestPoster(DirectFrame):
self.teleportButton.setPos(0.285, 0, -0.15)
toNpcName = NPCToons.getNPCName(toNpcId)
toNpcZone = NPCToons.getNPCZone(toNpcId)
toNpcHoodId = ZoneUtil.getCanonicalHoodId(toNpcZone)
toNpcHoodId = ZoneUtil.getHoodId(toNpcZone)
toNpcLocationName = base.cr.hoodMgr.getFullnameFromId(toNpcHoodId)
toNpcBuildingName = NPCToons.getBuildingTitle(toNpcZone)
toNpcBranchId = ZoneUtil.getBranchZone(toNpcZone)

View file

@ -392,11 +392,11 @@ class LocationBasedQuest(Quest):
if loc is Anywhere:
return 1
if ZoneUtil.isPlayground(loc):
if loc == ZoneUtil.getCanonicalHoodId(zoneId):
if loc == ZoneUtil.getHoodId(zoneId):
return 1
else:
return 0
elif loc == ZoneUtil.getCanonicalBranchZone(zoneId):
elif loc == ZoneUtil.getBranchZone(zoneId):
return 1
elif loc == zoneId:
return 1
@ -3795,11 +3795,11 @@ def chooseQuestDialogTierNotDone():
def getNpcInfo(npcId):
npcName = NPCToons.getNPCName(npcId)
npcZone = NPCToons.getNPCZone(npcId)
hoodId = ZoneUtil.getCanonicalHoodId(npcZone)
hoodId = ZoneUtil.getHoodId(npcZone)
hoodName = base.cr.hoodMgr.getFullnameFromId(hoodId)
buildingArticle = NPCToons.getBuildingArticle(npcZone)
buildingName = NPCToons.getBuildingTitle(npcZone)
branchId = ZoneUtil.getCanonicalBranchZone(npcZone)
branchId = ZoneUtil.getBranchZone(npcZone)
toStreet = ToontownGlobals.StreetNames[branchId][0]
streetName = ToontownGlobals.StreetNames[branchId][-1]
isInPlayground = ZoneUtil.isPlayground(branchId)
@ -3819,9 +3819,9 @@ def getNpcLocationDialog(fromNpcId, toNpcId):
fromBranchId = None
if fromNpcId:
fromNpcZone = NPCToons.getNPCZone(fromNpcId)
fromBranchId = ZoneUtil.getCanonicalBranchZone(fromNpcZone)
fromBranchId = ZoneUtil.getBranchZone(fromNpcZone)
toNpcZone = NPCToons.getNPCZone(toNpcId)
toBranchId = ZoneUtil.getCanonicalBranchZone(toNpcZone)
toBranchId = ZoneUtil.getBranchZone(toNpcZone)
toNpcName, toHoodName, toBuildingArticle, toBuildingName, toStreetTo, toStreetName, isInPlayground = getNpcInfo(toNpcId)
if fromBranchId == toBranchId:
if isInPlayground:

View file

@ -180,8 +180,8 @@ class MapPage(ShtikerPage.ShtikerPage):
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]
hoodName = ToontownGlobals.hoodNameMap.get(ZoneUtil.getHoodId(zone), ('',))[-1]
streetName = ToontownGlobals.StreetNames.get(ZoneUtil.getBranchZone(zone), ('',))[-1]
if hoodName:
self.hoodLabel['text'] = TTLocalizer.MapPageYouAreHere % (hoodName, streetName)
self.hoodLabel.show()

View file

@ -454,18 +454,9 @@ class ShardPage(ShtikerPage.ShtikerPage):
def getCurrentZoneId(self):
try:
zoneId = base.cr.playGame.getPlace().getZoneId()
return base.cr.playGame.getPlace().getZoneId()
except:
zoneId = None
return zoneId
def getCurrentShardId(self):
zoneId = self.getCurrentZoneId()
if zoneId != None and ZoneUtil.isWelcomeValley(zoneId):
return ToontownGlobals.WelcomeValleyToken
else:
return base.localAvatar.defaultShard
return None
def createSuitHead(self, suitName):
suitDNA = SuitDNA.SuitDNA()
@ -580,7 +571,7 @@ class ShardPage(ShtikerPage.ShtikerPage):
def choseShard(self, shardId):
zoneId = self.getCurrentZoneId()
canonicalHoodId = ZoneUtil.getCanonicalHoodId(base.localAvatar.lastHood)
canonicalHoodId = ZoneUtil.getHoodId(base.localAvatar.lastHood)
currentShardId = self.getCurrentShardId()
if self.currentGroupJoined:

View file

@ -216,7 +216,7 @@ class DistributedSuitAI(DistributedSuitBaseAI.DistributedSuitBaseAI):
self.setPathPosition(0, self.pathStartTime)
self.pathState = 1
self.currentLeg = 0
self.zoneId = ZoneUtil.getTrueZoneId(self.legList.getZoneId(0), self.branchId)
self.zoneId = self.legList.getZoneId(0)
self.legType = self.legList.getType(0)
if self.notify.getDebug():
self.notify.debug('creating suit in zone %s' % self.zoneId)
@ -236,7 +236,6 @@ class DistributedSuitAI(DistributedSuitBaseAI.DistributedSuitBaseAI):
self.currentLeg = nextLeg
self.__beginLegType(self.legList.getType(nextLeg))
zoneId = self.legList.getZoneId(nextLeg)
zoneId = ZoneUtil.getTrueZoneId(zoneId, self.branchId)
if zoneId:
self.__enterZone(zoneId)
self.notify.debug('Suit %s reached leg %s of %s in zone %s.' % (self.getDoId(),
@ -252,7 +251,7 @@ class DistributedSuitAI(DistributedSuitBaseAI.DistributedSuitBaseAI):
if self.pathState != 1:
return Task.done
nextLeg += 1
while nextLeg + 1 < numLegs and self.legList.getZoneId(nextLeg) == ZoneUtil.getCanonicalZoneId(self.zoneId) and self.legList.getType(nextLeg) == self.legType:
while nextLeg + 1 < numLegs and self.legList.getZoneId(nextLeg) == self.zoneId and self.legList.getType(nextLeg) == self.legType:
nextLeg += 1
if nextLeg < numLegs:

View file

@ -62,7 +62,6 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
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
@ -72,15 +71,13 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
self.hoodInfoIdx = -1
for index in xrange(len(self.SuitHoodInfo)):
currHoodInfo = self.SuitHoodInfo[index]
if currHoodInfo[self.SUIT_HOOD_INFO_ZONE] == self.canonicalZoneId:
if currHoodInfo[self.SUIT_HOOD_INFO_ZONE] == self.zoneId:
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 = []
@ -360,13 +357,9 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
return False
numSuitBuildings = len(self.buildingMgr.getSuitBlocks())
if (random.random() * 100) < SuitBuildingGlobals.buildingChance[self.zoneId]:
bmax = SuitBuildingGlobals.buildingMinMax[self.zoneId][1]
if ZoneUtil.isWelcomeValley(self.zoneId):
bmax = 0
numNeeded = bmax - numSuitBuildings
return SuitBuildingGlobals.buildingMinMax[self.zoneId][1] - numSuitBuildings
else:
numNeeded = self.targetNumSuitBuildings - numSuitBuildings
return numNeeded
return self.targetNumSuitBuildings - numSuitBuildings
def newSuitShouldAttemptTakeover(self):
if not self.SUITS_ENTER_BUILDINGS:
@ -844,8 +837,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
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:
if zoneId not in self.battlePosDict:
return 0
toon = self.air.doId2do.get(toonId)
if toon.getBattleId() > 0:
@ -854,7 +846,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
if toon:
if hasattr(toon, 'doId'):
toon.b_setBattleId(toonId)
pos = self.battlePosDict[canonicalZoneId]
pos = self.battlePosDict[zoneId]
interactivePropTrackBonus = -1
self.battleMgr.newBattle(
zoneId, zoneId, pos, suit, toonId, self.__battleFinished,

View file

@ -514,8 +514,8 @@ class SuitPlannerBase:
self.initDNAInfo()
def genDNAFileName(self):
zoneId = ZoneUtil.getCanonicalZoneId(self.getZoneId())
hoodId = ZoneUtil.getCanonicalHoodId(zoneId)
zoneId = self.getZoneId()
hoodId = ZoneUtil.getHoodId(zoneId)
hood = ToontownGlobals.dnaMap[hoodId]
phase = ToontownGlobals.streetPhaseMap[hoodId]
if hoodId == zoneId:

View file

@ -27,7 +27,7 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI):
if self.isBusy():
self.freeAvatar(avId)
return
self.petSeeds = self.air.petMgr.getAvailablePets(3, ZoneUtil.getCanonicalHoodId(self.zoneId))
self.petSeeds = self.air.petMgr.getAvailablePets(3, ZoneUtil.getHoodId(self.zoneId))
numGenders = len(PetDNA.PetGenders)
self.petSeeds *= numGenders
self.petSeeds.sort()
@ -92,7 +92,7 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI):
av = simbase.air.doId2do.get(avId)
if av:
from toontown.hood import ZoneUtil
zoneId = ZoneUtil.getCanonicalSafeZoneId(self.zoneId)
zoneId = ZoneUtil.getSafeZoneId(self.zoneId)
if petNum not in xrange(0, len(self.petSeeds)):
self.air.writeServerEvent('suspicious', avId, 'DistributedNPCPetshopAI.petAdopted and no such pet!')
self.notify.warning('somebody called petAdopted on a non-existent pet! avId: %s' % avId)

View file

@ -424,7 +424,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
self.defaultZone = ToontownGlobals.ToontownCentral
return
if ZoneUtil.getCanonicalHoodId(zoneId) == ToontownGlobals.FunnyFarm:
if ZoneUtil.getHoodId(zoneId) == ToontownGlobals.FunnyFarm:
self.defaultZone = ToontownGlobals.ToontownCentral
return
if not base.cr.isPaid() or launcher and not launcher.getPhaseComplete(hoodPhase):

View file

@ -3104,9 +3104,6 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
self.air.writeServerEvent('suspicious', self.doId, 'bogus cog summons')
self.sendUpdate('cogSummonsResponse', ['fail', suitIndex, 0])
return
if ZoneUtil.isWelcomeValley(self.zoneId):
self.sendUpdate('cogSummonsResponse', ['fail', suitIndex, 0])
return
returnCode = None
if type == 'single':
returnCode = self.doSummonSingleCog(suitIndex)

View file

@ -97,7 +97,7 @@ def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None):
import DistributedSmartNPCAI
import DistributedNPCBankerAI
import DistributedNPCGloveAI
canonicalZoneId, name, dnaType, gender, protected, type = desc
zoneId, name, dnaType, gender, protected, type = desc
if type == NPC_REGULAR:
npc = DistributedNPCToonAI.DistributedNPCToonAI(air, npcId, questCallback=questCallback)
elif type == NPC_HQ:
@ -176,8 +176,7 @@ def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None):
def createNpcsInZone(air, zoneId):
npcs = []
canonicalZoneId = ZoneUtil.getCanonicalZoneId(zoneId)
npcIdList = zone2NpcDict.get(canonicalZoneId, [])
npcIdList = zone2NpcDict.get(zoneId, [])
for npcId in npcIdList:
while npcIdList.count(npcId) > 1:
npcIdList.remove(npcId)
@ -202,7 +201,7 @@ def createLocalNPC(npcId):
if npcId not in NPCToonDict:
return None
desc = NPCToonDict[npcId]
canonicalZoneId, name, dnaType, gender, protected, type = desc
zoneId, name, dnaType, gender, protected, type = desc
npc = Toon.Toon()
npc.setName(name)
npc.setPickable(0)

View file

@ -166,8 +166,6 @@ class ToonAvatarDetailPanel(DirectFrame):
if online:
shardName = base.cr.getShardName(av.defaultShard)
hoodName = base.cr.hoodMgr.getFullnameFromId(av.lastHood)
if ZoneUtil.isWelcomeValley(av.lastHood):
shardName = '%s (%s)' % (TTLocalizer.WelcomeValley[-1], shardName)
if self.playerInfo:
guiButton = loader.loadModel('phase_3/models/gui/quit_button')
self.gotoAvatarButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=1.1, text=TTLocalizer.AvatarShowPlayer, text_scale=0.07, text_pos=(0.0, -0.02), textMayChange=0, pos=(0.44, 0, 0.41), command=self.__showAvatar)

View file

@ -245,7 +245,6 @@ class ToonTeleportPanel(DirectFrame):
shardName = 'unknown'
print 'enterTeleport: %r, %r, %r, %r, %r' % (shardId, shardName, hoodId, zoneId, self.avId)
hoodsVisited = base.localAvatar.hoodsVisited
canonicalHoodId = ZoneUtil.getCanonicalZoneId(hoodId)
if hoodId == ToontownGlobals.MyEstate:
teleportNotify.debug('enterTeleport: estate')
if shardId == base.localAvatar.defaultShard:
@ -253,10 +252,10 @@ class ToonTeleportPanel(DirectFrame):
place = base.cr.playGame.getPlace()
place.requestTeleport(hoodId, zoneId, shardId, self.avId)
unloadTeleportPanel()
elif canonicalHoodId not in hoodsVisited + ToontownGlobals.HoodsAlwaysVisited:
elif hoodId not in hoodsVisited + ToontownGlobals.HoodsAlwaysVisited:
teleportNotify.debug('enterTeleport: unknownHood')
self.fsm.request('unknownHood', [hoodId])
elif canonicalHoodId not in base.cr.hoodMgr.getAvailableZones():
elif hoodId not in base.cr.hoodMgr.getAvailableZones():
print 'hoodId %d not ready' % hoodId
self.fsm.request('unavailableHood', [hoodId])
else:

View file

@ -132,7 +132,6 @@ CashbotHQ = ('to', 'in', 'Cashbot HQ')
LawbotHQ = ('to', 'in', 'Lawbot HQ')
Tutorial = ('to the', 'in the', 'Toon-torial')
MyEstate = ('to', 'in', 'your house')
WelcomeValley = ('to', 'in', 'Welcome Valley')
GolfZone = ('to', 'in', lGolfZone)
PartyHood = ('to the', 'in the', lPartyHood)
Factory = 'Factory'
@ -3985,7 +3984,6 @@ QuestPosterDialogNo = 'Cancel'
ShardPageTitle = 'Districts'
ShardPageHelpIntro = 'Each District is a copy of the Toontown world.'
ShardPageHelpWhere = ' You are currently in the "%s" District.'
ShardPageHelpWelcomeValley = ' You are currently in the "Welcome Valley" District, within "%s".'
ShardPageHelpMove = ' To move to a new District, click on its name.'
ShardPagePopulationTotal = 'Total Toontown Population:\n%d'
ShardPageScrollTitle = 'Name Population'

View file

@ -20,7 +20,6 @@ def canAccess(avatarId, zoneId, function = ''):
def openToAll(zoneId, avatar):
allowed = False
canonicalZoneId = ZoneUtil.getCanonicalHoodId(zoneId)
allowedZones = [ToontownGlobals.ToontownCentral,
ToontownGlobals.MyEstate,
ToontownGlobals.GoofySpeedway,
@ -33,11 +32,11 @@ def openToAll(zoneId, avatar):
for zone in simbase.air.estateMgr.getEstateZones(ownerId):
specialZones.append(zone)
if canonicalZoneId in allowedZones or avatar.isInEstate():
if zoneId in allowedZones or avatar.isInEstate():
allowed = True
elif zoneId in specialZones:
allowed = True
elif canonicalZoneId >= ToontownGlobals.DynamicZonesBegin and not avatar.getTutorialAck():
elif zoneId >= ToontownGlobals.DynamicZonesBegin and not avatar.getTutorialAck():
zoneDict = simbase.air.tutorialManager.playerDict.get(avatar.doId)
if zoneDict:
allowed = True
@ -45,12 +44,11 @@ def openToAll(zoneId, avatar):
def canWearSuit(avatarId, zoneId):
canonicalZoneId = ZoneUtil.getCanonicalHoodId(zoneId)
allowedSuitZones = [ToontownGlobals.LawbotHQ,
ToontownGlobals.CashbotHQ,
ToontownGlobals.SellbotHQ,
ToontownGlobals.BossbotHQ]
if canonicalZoneId in allowedSuitZones:
if zoneId in allowedSuitZones:
return True
elif zoneId >= ToontownGlobals.DynamicZonesBegin:
return True

View file

@ -180,7 +180,6 @@ HoodHierarchy = {ToontownCentral: (SillyStreet, LoopyLane, PunchlinePlace),
DaisyGardens: (ElmStreet, MapleStreet, OakStreet),
DonaldsDreamland: (LullabyLane, PajamaPlace),
GoofySpeedway: ()}
WelcomeValleyToken = 0
BossbotHQ = 10000
BossbotLobby = 10100
BossbotCountryClubIntA = 10500
@ -209,8 +208,6 @@ MyEstate = 16000
GolfZone = 17000
PartyHood = 18000
HoodsAlwaysVisited = [17000, 18000]
WelcomeValleyBegin = 22000
WelcomeValleyEnd = 61000
DynamicZonesBegin = 61000
DynamicZonesEnd = 1 << 20
cogDept2index = {'c': 0,

View file

@ -394,7 +394,7 @@ class Street(BattlePlace.BattlePlace):
loaderTexturePath = Filename(str(signTexturePath))
alphaPath = 'phase_4/maps/tt_t_ara_gen_tunnelAheadSign_a.rgb'
inDreamland = False
if place.zoneId and ZoneUtil.getCanonicalHoodId(place.zoneId) == ToontownGlobals.DonaldsDreamland:
if place.zoneId and ZoneUtil.getHoodId(place.zoneId) == ToontownGlobals.DonaldsDreamland:
inDreamland = True
alphaPath = 'phase_4/maps/tt_t_ara_gen_tunnelAheadSign_a.rgb'
if Filename(signTexturePath).exists():

View file

@ -51,7 +51,7 @@ class TownLoader(StateData.StateData):
self.parentFSMState.addChild(self.fsm)
self.loadBattleAnims()
self.branchZone = ZoneUtil.getBranchZone(zoneId)
self.canonicalBranchZone = ZoneUtil.getCanonicalBranchZone(zoneId)
self.canonicalBranchZone = ZoneUtil.getBranchZone(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')
@ -238,7 +238,6 @@ class TownLoader(StateData.StateData):
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')
@ -264,12 +263,10 @@ class TownLoader(StateData.StateData):
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)