From 04233eb9f3188b4ef2daaf97f88db532fbc596a4 Mon Sep 17 00:00:00 2001 From: DenialMC Date: Tue, 7 Apr 2015 17:19:50 +0300 Subject: [PATCH] Revert "Holocausted Welcome Valley" This reverts commit ad91b2182391aad2096cd79a0fc9cc83ca4ae466. --- astron/dclass/united.dc | 7 ++ otp/distributed/PotentialShard.py | 1 + toontown/ai/ToontownAIRepository.py | 3 +- toontown/ai/WelcomeValleyManager.py | 38 ++++++++++ toontown/ai/WelcomeValleyManagerAI.py | 18 +++++ toontown/battle/BattlePlace.py | 3 +- toontown/battle/DistributedBattleBase.py | 2 +- toontown/building/DistributedBankInterior.py | 2 +- toontown/building/DistributedBoardingParty.py | 4 +- toontown/building/DistributedBuilding.py | 5 +- toontown/building/DistributedBuildingAI.py | 12 ++-- toontown/building/DistributedBuildingMgrAI.py | 22 ++++-- toontown/building/DistributedDoor.py | 1 + .../building/DistributedGagshopInterior.py | 2 +- .../building/DistributedLibraryInterior.py | 4 +- .../building/DistributedPetshopInterior.py | 2 +- .../building/DistributedToonHallInterior.py | 2 +- toontown/building/DistributedToonInterior.py | 2 +- .../building/DistributedTutorialInterior.py | 2 +- toontown/coghq/BossbotHQExterior.py | 1 + toontown/coghq/CashbotHQExterior.py | 1 + toontown/coghq/DistributedCogHQDoor.py | 4 +- toontown/coghq/FactoryExterior.py | 1 + toontown/coghq/LawbotHQExterior.py | 1 + toontown/coghq/SellbotHQExterior.py | 1 + toontown/distributed/HoodMgr.py | 5 +- toontown/distributed/PlayGame.py | 16 +++-- .../distributed/ToontownClientRepository.py | 1 + toontown/estate/DistributedHouseDoor.py | 1 + toontown/hood/GSHoodAI.py | 8 ++- toontown/hood/GZHoodAI.py | 6 +- toontown/hood/GenericAnimatedProp.py | 2 +- toontown/hood/Hood.py | 6 +- toontown/hood/HoodAI.py | 9 ++- toontown/hood/OZHoodAI.py | 12 ++-- toontown/hood/Place.py | 3 +- toontown/hood/QuietZoneState.py | 24 ++++++- toontown/hood/TrialerForceAcknowledge.py | 2 +- toontown/hood/ZoneUtil.py | 72 +++++++++++++++++-- toontown/minigame/MinigameGlobals.py | 2 +- toontown/pets/PetshopGUI.py | 6 +- toontown/quest/QuestMap.py | 8 +-- toontown/quest/QuestPoster.py | 8 +-- toontown/quest/Quests.py | 12 ++-- toontown/shtiker/MapPage.py | 4 +- toontown/shtiker/ShardPage.py | 15 +++- toontown/suit/DistributedSuitAI.py | 5 +- toontown/suit/DistributedSuitPlannerAI.py | 18 +++-- toontown/suit/SuitPlannerBase.py | 4 +- toontown/toon/DistributedNPCPetclerkAI.py | 4 +- toontown/toon/DistributedToon.py | 2 +- toontown/toon/DistributedToonAI.py | 3 + toontown/toon/NPCToons.py | 7 +- toontown/toon/ToonAvatarDetailPanel.py | 2 + toontown/toon/ToonTeleportPanel.py | 5 +- toontown/toonbase/TTLocalizerEnglish.py | 2 + toontown/toonbase/ToontownAccessAI.py | 8 ++- toontown/toonbase/ToontownGlobals.py | 3 + toontown/town/Street.py | 2 +- toontown/town/TownLoader.py | 5 +- 60 files changed, 333 insertions(+), 100 deletions(-) create mode 100644 toontown/ai/WelcomeValleyManager.py create mode 100644 toontown/ai/WelcomeValleyManagerAI.py diff --git a/astron/dclass/united.dc b/astron/dclass/united.dc index 28f65fbc..28b78efd 100644 --- a/astron/dclass/united.dc +++ b/astron/dclass/united.dc @@ -442,6 +442,7 @@ 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 @@ -844,6 +845,12 @@ 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; diff --git a/otp/distributed/PotentialShard.py b/otp/distributed/PotentialShard.py index 9763db89..c59f5e82 100644 --- a/otp/distributed/PotentialShard.py +++ b/otp/distributed/PotentialShard.py @@ -6,6 +6,7 @@ class PotentialShard: self.id = id self.name = None self.population = 0 + self.welcomeValleyPopulation = 0 self.active = 1 self.available = 1 return diff --git a/toontown/ai/ToontownAIRepository.py b/toontown/ai/ToontownAIRepository.py index a720fcbf..72df72da 100644 --- a/toontown/ai/ToontownAIRepository.py +++ b/toontown/ai/ToontownAIRepository.py @@ -218,7 +218,8 @@ class ToontownAIRepository(ToontownInternalRepository): self.send(datagram) def lookupDNAFileName(self, zoneId): - hoodId = ZoneUtil.getHoodId(zoneId) + zoneId = ZoneUtil.getCanonicalZoneId(zoneId) + hoodId = ZoneUtil.getCanonicalHoodId(zoneId) hood = ToontownGlobals.dnaMap[hoodId] if hoodId == zoneId: zoneId = 'sz' diff --git a/toontown/ai/WelcomeValleyManager.py b/toontown/ai/WelcomeValleyManager.py new file mode 100644 index 00000000..57bc3baa --- /dev/null +++ b/toontown/ai/WelcomeValleyManager.py @@ -0,0 +1,38 @@ +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]) diff --git a/toontown/ai/WelcomeValleyManagerAI.py b/toontown/ai/WelcomeValleyManagerAI.py new file mode 100644 index 00000000..a5f6679c --- /dev/null +++ b/toontown/ai/WelcomeValleyManagerAI.py @@ -0,0 +1,18 @@ +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 + diff --git a/toontown/battle/BattlePlace.py b/toontown/battle/BattlePlace.py index da6c831d..850bb9ed 100644 --- a/toontown/battle/BattlePlace.py +++ b/toontown/battle/BattlePlace.py @@ -104,7 +104,8 @@ class BattlePlace(Place.Place): self.zoneId = newZoneId def genDNAFileName(self, zoneId): - hoodId = ZoneUtil.getHoodId(zoneId) + zoneId = ZoneUtil.getCanonicalZoneId(zoneId) + hoodId = ZoneUtil.getCanonicalHoodId(zoneId) hood = ToontownGlobals.dnaMap[hoodId] phase = ToontownGlobals.streetPhaseMap[hoodId] if hoodId == zoneId: diff --git a/toontown/battle/DistributedBattleBase.py b/toontown/battle/DistributedBattleBase.py index 0ddc4ece..51b6c89a 100644 --- a/toontown/battle/DistributedBattleBase.py +++ b/toontown/battle/DistributedBattleBase.py @@ -832,7 +832,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): def __teleportToSafeZone(self, toon): self.notify.debug('teleportToSafeZone(%d)' % toon.doId) - hoodId = ZoneUtil.getHoodId(self.zoneId) + hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId) if hoodId in base.localAvatar.hoodsVisited: target_sz = ZoneUtil.getSafeZoneId(self.zoneId) else: diff --git a/toontown/building/DistributedBankInterior.py b/toontown/building/DistributedBankInterior.py index 52ec7e50..e8a0d79a 100644 --- a/toontown/building/DistributedBankInterior.py +++ b/toontown/building/DistributedBankInterior.py @@ -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.getHoodId(self.zoneId) + hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId) self.colors = ToonInteriorColors.colors[hoodId] self.replaceRandomInModel(self.interior) diff --git a/toontown/building/DistributedBoardingParty.py b/toontown/building/DistributedBoardingParty.py index 6a707722..9e1bb7e1 100644 --- a/toontown/building/DistributedBoardingParty.py +++ b/toontown/building/DistributedBoardingParty.py @@ -38,7 +38,9 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart localAvatar.boardingParty = self def announceGenerate(self): - localAvatar.chatMgr.chatInputSpeedChat.addBoardingGroupMenu(self.zoneId) + canonicalZoneId = ZoneUtil.getCanonicalZoneId(self.zoneId) + self.notify.debug('canonicalZoneId = %s' % canonicalZoneId) + localAvatar.chatMgr.chatInputSpeedChat.addBoardingGroupMenu(canonicalZoneId) if base.config.GetBool('want-singing', 0): localAvatar.chatMgr.chatInputSpeedChat.addSingingGroupMenu() diff --git a/toontown/building/DistributedBuilding.py b/toontown/building/DistributedBuilding.py index c5b34297..323d21fe 100644 --- a/toontown/building/DistributedBuilding.py +++ b/toontown/building/DistributedBuilding.py @@ -438,6 +438,7 @@ 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) @@ -540,6 +541,7 @@ 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) @@ -928,7 +930,8 @@ class DistributedBuilding(DistributedObject.DistributedObject): def getVisZoneId(self): exteriorZoneId = base.cr.playGame.hood.dnaStore.getZoneFromBlockNumber(self.block) - return exteriorZoneId + visZoneId = ZoneUtil.getTrueZoneId(exteriorZoneId, self.zoneId) + return visZoneId def getInteractiveProp(self): result = None diff --git a/toontown/building/DistributedBuildingAI.py b/toontown/building/DistributedBuildingAI.py index 272a67ea..3a75b4e9 100644 --- a/toontown/building/DistributedBuildingAI.py +++ b/toontown/building/DistributedBuildingAI.py @@ -30,6 +30,7 @@ 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( @@ -204,8 +205,9 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): def getExteriorAndInteriorZoneId(self): blockNumber = self.block - dnaStore = self.air.dnaStoreMap[self.zoneId] + dnaStore = self.air.dnaStoreMap[self.canonicalZoneId] zoneId = dnaStore.getZoneFromBlockNumber(blockNumber) + zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId) interiorZoneId = (zoneId - (zoneId%100)) + 500 + blockNumber return (zoneId, interiorZoneId) @@ -272,11 +274,13 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): def updateSavedBy(self, savedBy): if self.savedBy: for (avId, name, dna) in self.savedBy: - self.trophyMgr.removeTrophy(avId, self.numFloors) + if not ZoneUtil.isWelcomeValley(self.zoneId): + self.trophyMgr.removeTrophy(avId, self.numFloors) self.savedBy = savedBy if self.savedBy: for (avId, name, dna) in self.savedBy: - self.trophyMgr.addTrophy(avId, name, self.numFloors) + if not ZoneUtil.isWelcomeValley(self.zoneId): + self.trophyMgr.addTrophy(avId, name, self.numFloors) def enterWaitForVictors(self, victorList, savedBy): activeToons = [] @@ -383,7 +387,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 interiorZoneId == ToonHall: + 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) diff --git a/toontown/building/DistributedBuildingMgrAI.py b/toontown/building/DistributedBuildingMgrAI.py index 5d46b533..f40dbdbe 100644 --- a/toontown/building/DistributedBuildingMgrAI.py +++ b/toontown/building/DistributedBuildingMgrAI.py @@ -8,6 +8,9 @@ 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') @@ -15,6 +18,7 @@ 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 = {} @@ -168,8 +172,9 @@ class DistributedBuildingMgrAI: return self.newBuilding(blockNumber, backup=backup) def newHQBuilding(self, blockNumber): - dnaStore = self.air.dnaStoreMap[self.branchId] + dnaStore = self.air.dnaStoreMap[self.canonicalBranchId] 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) @@ -177,8 +182,9 @@ class DistributedBuildingMgrAI: return building def newGagshopBuilding(self, blockNumber): - dnaStore = self.air.dnaStoreMap[self.branchId] + dnaStore = self.air.dnaStoreMap[self.canonicalBranchId] 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) @@ -186,8 +192,9 @@ class DistributedBuildingMgrAI: return building def newPetshopBuilding(self, blockNumber): - dnaStore = self.air.dnaStoreMap[self.branchId] + dnaStore = self.air.dnaStoreMap[self.canonicalBranchId] 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) @@ -195,8 +202,9 @@ class DistributedBuildingMgrAI: return building def newKartShopBuilding(self, blockNumber): - dnaStore = self.air.dnaStoreMap[self.branchId] + dnaStore = self.air.dnaStoreMap[self.canonicalBranchId] 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) @@ -204,8 +212,9 @@ class DistributedBuildingMgrAI: return building def newBankBuilding(self, blockNumber): - dnaStore = self.air.dnaStoreMap[self.branchId] + dnaStore = self.air.dnaStoreMap[self.canonicalBranchId] 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) @@ -213,8 +222,9 @@ class DistributedBuildingMgrAI: return building def newLibraryBuilding(self, blockNumber): - dnaStore = self.air.dnaStoreMap[self.branchId] + dnaStore = self.air.dnaStoreMap[self.canonicalBranchId] 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) diff --git a/toontown/building/DistributedDoor.py b/toontown/building/DistributedDoor.py index e2c739ce..493bdcda 100644 --- a/toontown/building/DistributedDoor.py +++ b/toontown/building/DistributedDoor.py @@ -507,6 +507,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable): 'zoneId': zoneId, 'shardId': None, 'avId': -1, + 'allowRedirect': 0, 'doorDoId': self.otherDoId } return request diff --git a/toontown/building/DistributedGagshopInterior.py b/toontown/building/DistributedGagshopInterior.py index 97fb6cd4..ac17e090 100644 --- a/toontown/building/DistributedGagshopInterior.py +++ b/toontown/building/DistributedGagshopInterior.py @@ -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.getHoodId(self.zoneId) + hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId) self.colors = ToonInteriorColors.colors[hoodId] self.replaceRandomInModel(self.interior) door = self.chooseDoor() diff --git a/toontown/building/DistributedLibraryInterior.py b/toontown/building/DistributedLibraryInterior.py index 4331a8ef..56179354 100644 --- a/toontown/building/DistributedLibraryInterior.py +++ b/toontown/building/DistributedLibraryInterior.py @@ -25,7 +25,7 @@ class DistributedLibraryInterior(DistributedObject): door = self.cr.playGame.dnaStore.findNode('door_double_round_ur') doorNodePath = door.copyTo(doorOrigin) - hoodId = ZoneUtil.getHoodId(self.zoneId) + hoodId = ZoneUtil.getCanonicalHoodId(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.getHoodId(self.zoneId) + hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId) colors = ToonInteriorColors.colors[hoodId] _nodePath.setColorScale(generator.choice(colors[category])) diff --git a/toontown/building/DistributedPetshopInterior.py b/toontown/building/DistributedPetshopInterior.py index 305c0f5e..77a30ce8 100644 --- a/toontown/building/DistributedPetshopInterior.py +++ b/toontown/building/DistributedPetshopInterior.py @@ -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.getHoodId(self.zoneId) + hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId) self.colors = ToonInteriorColors.colors[hoodId] self.replaceRandomInModel(self.interior) door = self.chooseDoor() diff --git a/toontown/building/DistributedToonHallInterior.py b/toontown/building/DistributedToonHallInterior.py index 25925d9c..31974dbc 100644 --- a/toontown/building/DistributedToonHallInterior.py +++ b/toontown/building/DistributedToonHallInterior.py @@ -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.getHoodId(self.zoneId) + hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId) self.colors = ToonInteriorColors.colors[hoodId] self.replaceRandomInModel(self.interior) doorModelName = 'door_double_round_ul' diff --git a/toontown/building/DistributedToonInterior.py b/toontown/building/DistributedToonInterior.py index 40f94aa3..68c0e8ab 100644 --- a/toontown/building/DistributedToonInterior.py +++ b/toontown/building/DistributedToonInterior.py @@ -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.getHoodId(self.zoneId) + hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId) self.colors = ToonInteriorColors.colors[hoodId] self.replaceRandomInModel(self.interior) doorModelName = 'door_double_round_ul' diff --git a/toontown/building/DistributedTutorialInterior.py b/toontown/building/DistributedTutorialInterior.py index 7dc0b4f7..22796310 100644 --- a/toontown/building/DistributedTutorialInterior.py +++ b/toontown/building/DistributedTutorialInterior.py @@ -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.getHoodId(self.zoneId) + hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId) self.colors = ToonInteriorColors.colors[hoodId] self.replaceRandomInModel(self.interior) doorModelName = 'door_double_round_ul' diff --git a/toontown/coghq/BossbotHQExterior.py b/toontown/coghq/BossbotHQExterior.py index c2536e3f..4af98b26 100644 --- a/toontown/coghq/BossbotHQExterior.py +++ b/toontown/coghq/BossbotHQExterior.py @@ -75,6 +75,7 @@ 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))) diff --git a/toontown/coghq/CashbotHQExterior.py b/toontown/coghq/CashbotHQExterior.py index f969e44f..0c2d0769 100644 --- a/toontown/coghq/CashbotHQExterior.py +++ b/toontown/coghq/CashbotHQExterior.py @@ -69,6 +69,7 @@ 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))) diff --git a/toontown/coghq/DistributedCogHQDoor.py b/toontown/coghq/DistributedCogHQDoor.py index 2480129b..76fd2205 100644 --- a/toontown/coghq/DistributedCogHQDoor.py +++ b/toontown/coghq/DistributedCogHQDoor.py @@ -28,6 +28,7 @@ class DistributedCogHQDoor(DistributedDoor.DistributedDoor): 'zoneId': zoneId, 'shardId': None, 'avId': -1, + 'allowRedirect': 0, 'doorDoId': self.otherDoId} return request @@ -74,7 +75,8 @@ class DistributedCogHQDoor(DistributedDoor.DistributedDoor): def setZoneIdAndBlock(self, zoneId, block): self.zoneId = zoneId self.block = block - if zoneId in (ToontownGlobals.BossbotHQ, ToontownGlobals.BossbotLobby): + canonicalZoneId = ZoneUtil.getCanonicalZoneId(zoneId) + if canonicalZoneId in (ToontownGlobals.BossbotHQ, ToontownGlobals.BossbotLobby): self.doorX = 1.0 def enterDoor(self): diff --git a/toontown/coghq/FactoryExterior.py b/toontown/coghq/FactoryExterior.py index 17bd1957..dd06f718 100644 --- a/toontown/coghq/FactoryExterior.py +++ b/toontown/coghq/FactoryExterior.py @@ -77,6 +77,7 @@ 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))) diff --git a/toontown/coghq/LawbotHQExterior.py b/toontown/coghq/LawbotHQExterior.py index ca8bc85d..e4e8e189 100644 --- a/toontown/coghq/LawbotHQExterior.py +++ b/toontown/coghq/LawbotHQExterior.py @@ -27,6 +27,7 @@ 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))) diff --git a/toontown/coghq/SellbotHQExterior.py b/toontown/coghq/SellbotHQExterior.py index f7d28087..2afff17d 100644 --- a/toontown/coghq/SellbotHQExterior.py +++ b/toontown/coghq/SellbotHQExterior.py @@ -23,6 +23,7 @@ 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))) diff --git a/toontown/distributed/HoodMgr.py b/toontown/distributed/HoodMgr.py index bef1cfc7..6f308d75 100644 --- a/toontown/distributed/HoodMgr.py +++ b/toontown/distributed/HoodMgr.py @@ -237,7 +237,7 @@ class HoodMgr(DirectObject.DirectObject): return p def getPhaseFromHood(self, hoodId): - hoodId = ZoneUtil.getHoodId(hoodId) + hoodId = ZoneUtil.getCanonicalHoodId(hoodId) return ToontownGlobals.phaseMap[hoodId] def getPlaygroundCenterFromId(self, hoodId): @@ -263,6 +263,7 @@ 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): @@ -277,6 +278,8 @@ 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') diff --git a/toontown/distributed/PlayGame.py b/toontown/distributed/PlayGame.py index 99e6fc2b..90084be9 100644 --- a/toontown/distributed/PlayGame.py +++ b/toontown/distributed/PlayGame.py @@ -224,19 +224,20 @@ class PlayGame(StateData.StateData): def handleWaitForSetZoneResponse(self, requestStatus): hoodId = requestStatus['hoodId'] - toHoodPhrase = ToontownGlobals.hoodNameMap[hoodId][0] - hoodName = ToontownGlobals.hoodNameMap[hoodId][-1] + 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[hoodId] + count = ToontownGlobals.hoodCountMap[canonicalHoodId] if loaderName == 'safeZoneLoader': - count += ToontownGlobals.safeZoneCountMap[hoodId] + count += ToontownGlobals.safeZoneCountMap[canonicalHoodId] elif loaderName == 'townLoader': - count += ToontownGlobals.townCountMap[hoodId] + count += ToontownGlobals.townCountMap[canonicalHoodId] if not loader.inBulkBlock: if hoodId == ToontownGlobals.MyEstate: if avId == -1: @@ -268,7 +269,7 @@ class PlayGame(StateData.StateData): else: if not hasattr(self, 'dnaStore'): self.loadDnaStore() - hoodClass = self.getHoodClassByNumber(hoodId) + hoodClass = self.getHoodClassByNumber(canonicalHoodId) self.hood = hoodClass(self.fsm, self.hoodDoneEvent, self.dnaStore, hoodId) self.hood.load() self.hood.loadLoader(requestStatus) @@ -278,7 +279,8 @@ class PlayGame(StateData.StateData): def handleLeftQuietZone(self): status = self.quietZoneStateData.getRequestStatus() - hoodState = self.getHoodStateByNumber(status['hoodId']) + hoodId = ZoneUtil.getCanonicalZoneId(status['hoodId']) + hoodState = self.getHoodStateByNumber(hoodId) self.fsm.request(hoodState, [status]) def handleQuietZoneDone(self): diff --git a/toontown/distributed/ToontownClientRepository.py b/toontown/distributed/ToontownClientRepository.py index 937b8019..044bf1b8 100644 --- a/toontown/distributed/ToontownClientRepository.py +++ b/toontown/distributed/ToontownClientRepository.py @@ -79,6 +79,7 @@ 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 diff --git a/toontown/estate/DistributedHouseDoor.py b/toontown/estate/DistributedHouseDoor.py index 0f571b55..48e3d69c 100644 --- a/toontown/estate/DistributedHouseDoor.py +++ b/toontown/estate/DistributedHouseDoor.py @@ -124,6 +124,7 @@ class DistributedHouseDoor(DistributedDoor.DistributedDoor): 'zoneId': zoneId, 'shardId': None, 'avId': -1, + 'allowRedirect': 0, 'doorDoId': self.otherDoId} messenger.send('doorDoneEvent', [request]) return diff --git a/toontown/hood/GSHoodAI.py b/toontown/hood/GSHoodAI.py index a4ed4216..726737ca 100644 --- a/toontown/hood/GSHoodAI.py +++ b/toontown/hood/GSHoodAI.py @@ -62,7 +62,7 @@ class GSHoodAI(HoodAI.HoodAI): racingPads.append(racingPad) elif isinstance(dnaGroup, DNAVisGroup): - zoneId = int(dnaGroup.getName().split(':')[0]) + zoneId = ZoneUtil.getTrueZoneId(int(dnaGroup.getName().split(':')[0]), zoneId) for i in xrange(dnaGroup.getNumChildren()): (foundRacingPads, foundRacingPadGroups) = self.findRacingPads(dnaGroup.at(i), zoneId, area, padType=padType) racingPads.extend(foundRacingPads) @@ -98,9 +98,11 @@ 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': - (foundRacingPads, foundRacingPadGroups) = self.findRacingPads(dnaData, zoneId, zoneId, padType='racing_pad') - (foundViewingPads, foundViewingPadGroups) = self.findRacingPads(dnaData, zoneId, zoneId, padType='viewing_pad') + 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) diff --git a/toontown/hood/GZHoodAI.py b/toontown/hood/GZHoodAI.py index af7c77af..96a7fec2 100644 --- a/toontown/hood/GZHoodAI.py +++ b/toontown/hood/GZHoodAI.py @@ -37,7 +37,7 @@ class GZHoodAI(HoodAI.HoodAI): golfKart.generateWithRequired(zoneId) golfKarts.append(golfKart) elif isinstance(dnaGroup, DNAVisGroup) and (not overrideDNAZone): - zoneId = int(dnaGroup.getName().split(':')[0]) + zoneId = ZoneUtil.getTrueZoneId(int(dnaGroup.getName().split(':')[0]), zoneId) for i in xrange(dnaGroup.getNumChildren()): foundGolfKarts = self.findGolfKarts(dnaGroup.at(i), zoneId, area, overrideDNAZone=overrideDNAZone) golfKarts.extend(foundGolfKarts) @@ -47,8 +47,10 @@ 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': - foundGolfKarts = self.findGolfKarts(dnaData, zoneId, zoneId, overrideDNAZone=True) + area = ZoneUtil.getCanonicalZoneId(zoneId) + foundGolfKarts = self.findGolfKarts(dnaData, zoneId, area, overrideDNAZone=True) self.golfKarts.extend(foundGolfKarts) for golfKart in self.golfKarts: golfKart.start() diff --git a/toontown/hood/GenericAnimatedProp.py b/toontown/hood/GenericAnimatedProp.py index 7ac6fe4e..58de6d40 100644 --- a/toontown/hood/GenericAnimatedProp.py +++ b/toontown/hood/GenericAnimatedProp.py @@ -84,7 +84,7 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp): try: visId = int(splits[2]) self.visId = visId - self.hoodId = ZoneUtil.getHoodId(visId) + self.hoodId = ZoneUtil.getCanonicalHoodId(visId) self.notify.debug('calcHoodId %d from %s' % (self.hoodId, fullString)) except Exception, generic: if 'Editor' not in fullString: diff --git a/toontown/hood/Hood.py b/toontown/hood/Hood.py index 530ee405..86f10c51 100644 --- a/toontown/hood/Hood.py +++ b/toontown/hood/Hood.py @@ -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.getBranchZone(zoneId)) + streetName = StreetNames.get(ZoneUtil.getCanonicalBranchZone(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.getBranchZone(zoneId)][0] - streetName = StreetNames[ZoneUtil.getBranchZone(zoneId)][-1] + toPhrase = StreetNames[ZoneUtil.getCanonicalBranchZone(zoneId)][0] + streetName = StreetNames[ZoneUtil.getCanonicalBranchZone(zoneId)][-1] loader.beginBulkLoad('hood', TTLocalizer.HeadingToStreet % {'to': toPhrase, 'street': streetName}, townCountMap[self.id], 1, TTLocalizer.TIP_STREET, zoneId) self.loadLoader(requestStatus) diff --git a/toontown/hood/HoodAI.py b/toontown/hood/HoodAI.py index f6e541c3..6ed25d97 100644 --- a/toontown/hood/HoodAI.py +++ b/toontown/hood/HoodAI.py @@ -92,7 +92,7 @@ class HoodAI: fishingPonds.append(fishingPond) elif isinstance(dnaGroup, DNAVisGroup): - zoneId = int(dnaGroup.getName().split(':')[0]) + zoneId = ZoneUtil.getTrueZoneId(int(dnaGroup.getName().split(':')[0]), zoneId) for i in xrange(dnaGroup.getNumChildren()): (foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds(dnaGroup.at(i), zoneId, area) fishingPonds.extend(foundFishingPonds) @@ -120,8 +120,10 @@ 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': - (foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds(dnaData, zoneId, zoneId) + area = ZoneUtil.getCanonicalZoneId(zoneId) + (foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds(dnaData, zoneId, area) self.fishingPonds.extend(foundFishingPonds) fishingPondGroups.extend(foundFishingPondGroups) for fishingPond in self.fishingPonds: @@ -147,6 +149,7 @@ 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) @@ -164,6 +167,7 @@ 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) @@ -173,6 +177,7 @@ 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) diff --git a/toontown/hood/OZHoodAI.py b/toontown/hood/OZHoodAI.py index 35075f4b..9c7e80de 100644 --- a/toontown/hood/OZHoodAI.py +++ b/toontown/hood/OZHoodAI.py @@ -46,7 +46,7 @@ class OZHoodAI(HoodAI.HoodAI): picnicTable.generateWithRequired(zoneId) picnicTables.append(picnicTable) elif isinstance(dnaGroup, DNAVisGroup) and (not overrideDNAZone): - zoneId = int(dnaGroup.getName().split(':')[0]) + zoneId = ZoneUtil.getTrueZoneId(int(dnaGroup.getName().split(':')[0]), zoneId) for i in xrange(dnaGroup.getNumChildren()): foundPicnicTables = self.findPicnicTables( dnaGroup.at(i), zoneId, area, overrideDNAZone=overrideDNAZone) @@ -57,9 +57,11 @@ 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, zoneId, overrideDNAZone=True) + dnaData, zoneId, area, overrideDNAZone=True) self.picnicTables.extend(foundPicnicTables) for picnicTable in self.picnicTables: picnicTable.start() @@ -76,7 +78,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 = int(dnaGroup.getName().split(':')[0]) + zoneId = ZoneUtil.getTrueZoneId(int(dnaGroup.getName().split(':')[0]), zoneId) for i in xrange(dnaGroup.getNumChildren()): foundGameTables = self.findGameTables( dnaGroup.at(i), zoneId, area, overrideDNAZone=overrideDNAZone) @@ -87,7 +89,9 @@ 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, zoneId, overrideDNAZone=True) + dnaData, zoneId, area, overrideDNAZone=True) self.gameTables.extend(foundGameTables) diff --git a/toontown/hood/Place.py b/toontown/hood/Place.py index a35fc281..2ba63330 100644 --- a/toontown/hood/Place.py +++ b/toontown/hood/Place.py @@ -546,9 +546,10 @@ 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, self.getZoneId()) + tunnelName = base.cr.hoodMgr.makeLinkTunnelName(self.loader.hood.id, fromZoneId) self.doneStatus = {'loader': ZoneUtil.getLoaderName(zoneId), 'where': ZoneUtil.getToonWhereName(zoneId), 'how': how, diff --git a/toontown/hood/QuietZoneState.py b/toontown/hood/QuietZoneState.py index e7fc3362..b76f7b4a 100644 --- a/toontown/hood/QuietZoneState.py +++ b/toontown/hood/QuietZoneState.py @@ -211,7 +211,29 @@ class QuietZoneState(StateData.StateData): base.cr.handlerArgs = self._requestStatus base.cr.setInQuietZone(True) self.waitForDatabase('WaitForZoneRedirect') - self.gotZoneRedirect(self._requestStatus['zoneId']) + 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') def gotZoneRedirect(self, zoneId): self.notify.info('Redirecting to zone %s.' % zoneId) diff --git a/toontown/hood/TrialerForceAcknowledge.py b/toontown/hood/TrialerForceAcknowledge.py index cb18b849..1700008f 100644 --- a/toontown/hood/TrialerForceAcknowledge.py +++ b/toontown/hood/TrialerForceAcknowledge.py @@ -26,7 +26,7 @@ class TrialerForceAcknowledge: if base.cr.isPaid(): letThrough() return - if ZoneUtil.getHoodId(destHood) in (ToontownGlobals.ToontownCentral, ToontownGlobals.MyEstate, ToontownGlobals.GoofySpeedway): + if ZoneUtil.getCanonicalHoodId(destHood) in (ToontownGlobals.ToontownCentral, ToontownGlobals.MyEstate, ToontownGlobals.GoofySpeedway): letThrough() return else: diff --git a/toontown/hood/ZoneUtil.py b/toontown/hood/ZoneUtil.py index 857c5d6f..91060349 100644 --- a/toontown/hood/ZoneUtil.py +++ b/toontown/hood/ZoneUtil.py @@ -1,20 +1,26 @@ 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: @@ -22,6 +28,7 @@ def getStreetName(branchId): else: return StreetNames[branchId][-1] + def getLoaderName(zoneId): if tutorialDict: if zoneId == ToontownCentral: @@ -40,17 +47,21 @@ 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': @@ -58,6 +69,7 @@ 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 @@ -68,13 +80,14 @@ 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: + elif zoneId == ToontownCentral or zoneId == WelcomeValleyToken: where = 'playground' else: zoneUtilNotify.error('No known zone: ' + str(zoneId)) @@ -115,6 +128,7 @@ def getWhereName(zoneId, isToon): where = 'street' return where + def getBranchZone(zoneId): if tutorialDict: branchId = tutorialDict['branch'] @@ -125,6 +139,40 @@ 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 @@ -132,12 +180,22 @@ 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']: @@ -148,6 +206,7 @@ def isInterior(zoneId): r = zoneId % 1000 >= 500 return r + def overrideOn(branch, exteriorList, interiorList): global tutorialDict if tutorialDict: @@ -156,11 +215,13 @@ 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 @@ -169,13 +230,14 @@ def getWakeInfo(hoodId = None, zoneId = None): hoodId = base.cr.playGame.getPlaceId() if zoneId is None: zoneId = base.cr.playGame.getPlace().getZoneId() - if zoneId == DonaldsDock: + canonicalZoneId = getCanonicalZoneId(zoneId) + if canonicalZoneId == DonaldsDock: wakeWaterHeight = DDWakeWaterHeight showWake = 1 - elif zoneId == ToontownCentral: + elif canonicalZoneId == ToontownCentral: wakeWaterHeight = TTWakeWaterHeight showWake = 1 - elif zoneId == OutdoorZone: + elif canonicalZoneId == OutdoorZone: wakeWaterHeight = OZWakeWaterHeight showWake = 1 elif hoodId == MyEstate: @@ -184,4 +246,4 @@ def getWakeInfo(hoodId = None, zoneId = None): except AttributeError: pass - return (showWake, wakeWaterHeight) \ No newline at end of file + return (showWake, wakeWaterHeight) diff --git a/toontown/minigame/MinigameGlobals.py b/toontown/minigame/MinigameGlobals.py index 7c802b35..7032da44 100644 --- a/toontown/minigame/MinigameGlobals.py +++ b/toontown/minigame/MinigameGlobals.py @@ -27,7 +27,7 @@ def getDifficulty(trolleyZone): def getSafezoneId(trolleyZone): - return ZoneUtil.getHoodId(trolleyZone) + return ZoneUtil.getCanonicalHoodId(trolleyZone) def getScoreMult(trolleyZone): diff --git a/toontown/pets/PetshopGUI.py b/toontown/pets/PetshopGUI.py index 8e17aa80..d1bd11d9 100644 --- a/toontown/pets/PetshopGUI.py +++ b/toontown/pets/PetshopGUI.py @@ -53,7 +53,7 @@ class PetshopGUI(DirectObject): notify = DirectNotifyGlobal.directNotify.newCategory('PetshopGUI.NamePicker') def __init__(self, doneEvent, petSeed, gender): - zoneId = ZoneUtil.getSafeZoneId(base.localAvatar.getZoneId()) + zoneId = ZoneUtil.getCanonicalSafeZoneId(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.getSafeZoneId(base.localAvatar.getZoneId()) + zoneId = ZoneUtil.getCanonicalSafeZoneId(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.getSafeZoneId(base.localAvatar.getZoneId()) + zoneId = ZoneUtil.getCanonicalSafeZoneId(base.localAvatar.getZoneId()) name, dna, traitSeed = PetUtil.getPetInfoFromSeed(self.petSeeds[i], zoneId) cost = PetUtil.getPetCostFromSeed(self.petSeeds[i], zoneId) traits = PetTraits.PetTraits(traitSeed, zoneId) diff --git a/toontown/quest/QuestMap.py b/toontown/quest/QuestMap.py index 4358cfe5..70f63bbf 100644 --- a/toontown/quest/QuestMap.py +++ b/toontown/quest/QuestMap.py @@ -149,8 +149,8 @@ class QuestMap(DirectFrame): continue npcZoneId = NPCToons.getNPCZone(toNpcId) - hoodId = ZoneUtil.getHoodId(npcZoneId) - branchId = ZoneUtil.getBranchZone(npcZoneId) + hoodId = ZoneUtil.getCanonicalHoodId(npcZoneId) + branchId = ZoneUtil.getCanonicalBranchZone(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.getHoodId(self.av.getLocation()[1]) - zoneId = ZoneUtil.getBranchZone(self.av.getLocation()[1]) + 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: diff --git a/toontown/quest/QuestPoster.py b/toontown/quest/QuestPoster.py index abeb4872..35c75714 100644 --- a/toontown/quest/QuestPoster.py +++ b/toontown/quest/QuestPoster.py @@ -176,9 +176,9 @@ class QuestPoster(DirectFrame): def teleportToShop(self, npcId): npcZone = NPCToons.getNPCZone(npcId) - npcHood = ZoneUtil.getHoodId(npcZone) + npcHood = ZoneUtil.getCanonicalHoodId(npcZone) avZone = base.localAvatar.getZoneId() - avHood = ZoneUtil.getHoodId(avZone) + avHood = ZoneUtil.getCanonicalHoodId(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.getHoodId(npcZone) + hoodId = ZoneUtil.getCanonicalHoodId(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.getHoodId(toNpcZone) + toNpcHoodId = ZoneUtil.getCanonicalHoodId(toNpcZone) toNpcLocationName = base.cr.hoodMgr.getFullnameFromId(toNpcHoodId) toNpcBuildingName = NPCToons.getBuildingTitle(toNpcZone) toNpcBranchId = ZoneUtil.getBranchZone(toNpcZone) diff --git a/toontown/quest/Quests.py b/toontown/quest/Quests.py index 74da42c4..55703709 100644 --- a/toontown/quest/Quests.py +++ b/toontown/quest/Quests.py @@ -392,11 +392,11 @@ class LocationBasedQuest(Quest): if loc is Anywhere: return 1 if ZoneUtil.isPlayground(loc): - if loc == ZoneUtil.getHoodId(zoneId): + if loc == ZoneUtil.getCanonicalHoodId(zoneId): return 1 else: return 0 - elif loc == ZoneUtil.getBranchZone(zoneId): + elif loc == ZoneUtil.getCanonicalBranchZone(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.getHoodId(npcZone) + hoodId = ZoneUtil.getCanonicalHoodId(npcZone) hoodName = base.cr.hoodMgr.getFullnameFromId(hoodId) buildingArticle = NPCToons.getBuildingArticle(npcZone) buildingName = NPCToons.getBuildingTitle(npcZone) - branchId = ZoneUtil.getBranchZone(npcZone) + branchId = ZoneUtil.getCanonicalBranchZone(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.getBranchZone(fromNpcZone) + fromBranchId = ZoneUtil.getCanonicalBranchZone(fromNpcZone) toNpcZone = NPCToons.getNPCZone(toNpcId) - toBranchId = ZoneUtil.getBranchZone(toNpcZone) + toBranchId = ZoneUtil.getCanonicalBranchZone(toNpcZone) toNpcName, toHoodName, toBuildingArticle, toBuildingName, toStreetTo, toStreetName, isInPlayground = getNpcInfo(toNpcId) if fromBranchId == toBranchId: if isInPlayground: diff --git a/toontown/shtiker/MapPage.py b/toontown/shtiker/MapPage.py index c62e7f7a..fd4f17d7 100644 --- a/toontown/shtiker/MapPage.py +++ b/toontown/shtiker/MapPage.py @@ -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.getHoodId(zone), ('',))[-1] - streetName = ToontownGlobals.StreetNames.get(ZoneUtil.getBranchZone(zone), ('',))[-1] + 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() diff --git a/toontown/shtiker/ShardPage.py b/toontown/shtiker/ShardPage.py index beb4959d..bbf2c878 100644 --- a/toontown/shtiker/ShardPage.py +++ b/toontown/shtiker/ShardPage.py @@ -454,9 +454,18 @@ class ShardPage(ShtikerPage.ShtikerPage): def getCurrentZoneId(self): try: - return base.cr.playGame.getPlace().getZoneId() + zoneId = base.cr.playGame.getPlace().getZoneId() except: - return None + 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 def createSuitHead(self, suitName): suitDNA = SuitDNA.SuitDNA() @@ -571,7 +580,7 @@ class ShardPage(ShtikerPage.ShtikerPage): def choseShard(self, shardId): zoneId = self.getCurrentZoneId() - canonicalHoodId = ZoneUtil.getHoodId(base.localAvatar.lastHood) + canonicalHoodId = ZoneUtil.getCanonicalHoodId(base.localAvatar.lastHood) currentShardId = self.getCurrentShardId() if self.currentGroupJoined: diff --git a/toontown/suit/DistributedSuitAI.py b/toontown/suit/DistributedSuitAI.py index 8d5c541d..05635e6b 100644 --- a/toontown/suit/DistributedSuitAI.py +++ b/toontown/suit/DistributedSuitAI.py @@ -216,7 +216,7 @@ class DistributedSuitAI(DistributedSuitBaseAI.DistributedSuitBaseAI): self.setPathPosition(0, self.pathStartTime) self.pathState = 1 self.currentLeg = 0 - self.zoneId = self.legList.getZoneId(0) + self.zoneId = ZoneUtil.getTrueZoneId(self.legList.getZoneId(0), self.branchId) self.legType = self.legList.getType(0) if self.notify.getDebug(): self.notify.debug('creating suit in zone %s' % self.zoneId) @@ -236,6 +236,7 @@ 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(), @@ -251,7 +252,7 @@ class DistributedSuitAI(DistributedSuitBaseAI.DistributedSuitBaseAI): if self.pathState != 1: return Task.done nextLeg += 1 - while nextLeg + 1 < numLegs and self.legList.getZoneId(nextLeg) == self.zoneId and self.legList.getType(nextLeg) == self.legType: + while nextLeg + 1 < numLegs and self.legList.getZoneId(nextLeg) == ZoneUtil.getCanonicalZoneId(self.zoneId) and self.legList.getType(nextLeg) == self.legType: nextLeg += 1 if nextLeg < numLegs: diff --git a/toontown/suit/DistributedSuitPlannerAI.py b/toontown/suit/DistributedSuitPlannerAI.py index 04df77c4..a5bdedc1 100644 --- a/toontown/suit/DistributedSuitPlannerAI.py +++ b/toontown/suit/DistributedSuitPlannerAI.py @@ -62,6 +62,7 @@ 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 @@ -71,13 +72,15 @@ 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.zoneId: + 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 = [] @@ -357,9 +360,13 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan return False numSuitBuildings = len(self.buildingMgr.getSuitBlocks()) if (random.random() * 100) < SuitBuildingGlobals.buildingChance[self.zoneId]: - return SuitBuildingGlobals.buildingMinMax[self.zoneId][1] - numSuitBuildings + bmax = SuitBuildingGlobals.buildingMinMax[self.zoneId][1] + if ZoneUtil.isWelcomeValley(self.zoneId): + bmax = 0 + numNeeded = bmax - numSuitBuildings else: - return self.targetNumSuitBuildings - numSuitBuildings + numNeeded = self.targetNumSuitBuildings - numSuitBuildings + return numNeeded def newSuitShouldAttemptTakeover(self): if not self.SUITS_ENTER_BUILDINGS: @@ -837,7 +844,8 @@ 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)) - if zoneId not in self.battlePosDict: + canonicalZoneId = ZoneUtil.getCanonicalZoneId(zoneId) + if canonicalZoneId not in self.battlePosDict: return 0 toon = self.air.doId2do.get(toonId) if toon.getBattleId() > 0: @@ -846,7 +854,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan if toon: if hasattr(toon, 'doId'): toon.b_setBattleId(toonId) - pos = self.battlePosDict[zoneId] + pos = self.battlePosDict[canonicalZoneId] interactivePropTrackBonus = -1 self.battleMgr.newBattle( zoneId, zoneId, pos, suit, toonId, self.__battleFinished, diff --git a/toontown/suit/SuitPlannerBase.py b/toontown/suit/SuitPlannerBase.py index f5749a4b..e1f64506 100644 --- a/toontown/suit/SuitPlannerBase.py +++ b/toontown/suit/SuitPlannerBase.py @@ -514,8 +514,8 @@ class SuitPlannerBase: self.initDNAInfo() def genDNAFileName(self): - zoneId = self.getZoneId() - hoodId = ZoneUtil.getHoodId(zoneId) + zoneId = ZoneUtil.getCanonicalZoneId(self.getZoneId()) + hoodId = ZoneUtil.getCanonicalHoodId(zoneId) hood = ToontownGlobals.dnaMap[hoodId] phase = ToontownGlobals.streetPhaseMap[hoodId] if hoodId == zoneId: diff --git a/toontown/toon/DistributedNPCPetclerkAI.py b/toontown/toon/DistributedNPCPetclerkAI.py index 63131207..2daee72d 100644 --- a/toontown/toon/DistributedNPCPetclerkAI.py +++ b/toontown/toon/DistributedNPCPetclerkAI.py @@ -27,7 +27,7 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI): if self.isBusy(): self.freeAvatar(avId) return - self.petSeeds = self.air.petMgr.getAvailablePets(3, ZoneUtil.getHoodId(self.zoneId)) + self.petSeeds = self.air.petMgr.getAvailablePets(3, ZoneUtil.getCanonicalHoodId(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.getSafeZoneId(self.zoneId) + zoneId = ZoneUtil.getCanonicalSafeZoneId(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) diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index f827954c..522db9a3 100644 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -424,7 +424,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute self.defaultZone = ToontownGlobals.ToontownCentral return - if ZoneUtil.getHoodId(zoneId) == ToontownGlobals.FunnyFarm: + if ZoneUtil.getCanonicalHoodId(zoneId) == ToontownGlobals.FunnyFarm: self.defaultZone = ToontownGlobals.ToontownCentral return if not base.cr.isPaid() or launcher and not launcher.getPhaseComplete(hoodPhase): diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 363ae281..7bdb2e0d 100644 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -3104,6 +3104,9 @@ 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) diff --git a/toontown/toon/NPCToons.py b/toontown/toon/NPCToons.py index c50a2638..9d469df0 100644 --- a/toontown/toon/NPCToons.py +++ b/toontown/toon/NPCToons.py @@ -97,7 +97,7 @@ def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None): import DistributedSmartNPCAI import DistributedNPCBankerAI import DistributedNPCGloveAI - zoneId, name, dnaType, gender, protected, type = desc + canonicalZoneId, name, dnaType, gender, protected, type = desc if type == NPC_REGULAR: npc = DistributedNPCToonAI.DistributedNPCToonAI(air, npcId, questCallback=questCallback) elif type == NPC_HQ: @@ -176,7 +176,8 @@ def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None): def createNpcsInZone(air, zoneId): npcs = [] - npcIdList = zone2NpcDict.get(zoneId, []) + canonicalZoneId = ZoneUtil.getCanonicalZoneId(zoneId) + npcIdList = zone2NpcDict.get(canonicalZoneId, []) for npcId in npcIdList: while npcIdList.count(npcId) > 1: npcIdList.remove(npcId) @@ -201,7 +202,7 @@ def createLocalNPC(npcId): if npcId not in NPCToonDict: return None desc = NPCToonDict[npcId] - zoneId, name, dnaType, gender, protected, type = desc + canonicalZoneId, name, dnaType, gender, protected, type = desc npc = Toon.Toon() npc.setName(name) npc.setPickable(0) diff --git a/toontown/toon/ToonAvatarDetailPanel.py b/toontown/toon/ToonAvatarDetailPanel.py index 6e68a0d5..13fab0f6 100644 --- a/toontown/toon/ToonAvatarDetailPanel.py +++ b/toontown/toon/ToonAvatarDetailPanel.py @@ -166,6 +166,8 @@ 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) diff --git a/toontown/toon/ToonTeleportPanel.py b/toontown/toon/ToonTeleportPanel.py index 9d1ac65e..04480dbf 100644 --- a/toontown/toon/ToonTeleportPanel.py +++ b/toontown/toon/ToonTeleportPanel.py @@ -245,6 +245,7 @@ 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: @@ -252,10 +253,10 @@ class ToonTeleportPanel(DirectFrame): place = base.cr.playGame.getPlace() place.requestTeleport(hoodId, zoneId, shardId, self.avId) unloadTeleportPanel() - elif hoodId not in hoodsVisited + ToontownGlobals.HoodsAlwaysVisited: + elif canonicalHoodId not in hoodsVisited + ToontownGlobals.HoodsAlwaysVisited: teleportNotify.debug('enterTeleport: unknownHood') self.fsm.request('unknownHood', [hoodId]) - elif hoodId not in base.cr.hoodMgr.getAvailableZones(): + elif canonicalHoodId not in base.cr.hoodMgr.getAvailableZones(): print 'hoodId %d not ready' % hoodId self.fsm.request('unavailableHood', [hoodId]) else: diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index d05ddaeb..8b810113 100644 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -132,6 +132,7 @@ 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' @@ -3984,6 +3985,7 @@ 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' diff --git a/toontown/toonbase/ToontownAccessAI.py b/toontown/toonbase/ToontownAccessAI.py index 1cbc7aa4..ca5607c3 100644 --- a/toontown/toonbase/ToontownAccessAI.py +++ b/toontown/toonbase/ToontownAccessAI.py @@ -20,6 +20,7 @@ def canAccess(avatarId, zoneId, function = ''): def openToAll(zoneId, avatar): allowed = False + canonicalZoneId = ZoneUtil.getCanonicalHoodId(zoneId) allowedZones = [ToontownGlobals.ToontownCentral, ToontownGlobals.MyEstate, ToontownGlobals.GoofySpeedway, @@ -32,11 +33,11 @@ def openToAll(zoneId, avatar): for zone in simbase.air.estateMgr.getEstateZones(ownerId): specialZones.append(zone) - if zoneId in allowedZones or avatar.isInEstate(): + if canonicalZoneId in allowedZones or avatar.isInEstate(): allowed = True elif zoneId in specialZones: allowed = True - elif zoneId >= ToontownGlobals.DynamicZonesBegin and not avatar.getTutorialAck(): + elif canonicalZoneId >= ToontownGlobals.DynamicZonesBegin and not avatar.getTutorialAck(): zoneDict = simbase.air.tutorialManager.playerDict.get(avatar.doId) if zoneDict: allowed = True @@ -44,11 +45,12 @@ def openToAll(zoneId, avatar): def canWearSuit(avatarId, zoneId): + canonicalZoneId = ZoneUtil.getCanonicalHoodId(zoneId) allowedSuitZones = [ToontownGlobals.LawbotHQ, ToontownGlobals.CashbotHQ, ToontownGlobals.SellbotHQ, ToontownGlobals.BossbotHQ] - if zoneId in allowedSuitZones: + if canonicalZoneId in allowedSuitZones: return True elif zoneId >= ToontownGlobals.DynamicZonesBegin: return True diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index 9a013e35..327c81b8 100644 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -180,6 +180,7 @@ HoodHierarchy = {ToontownCentral: (SillyStreet, LoopyLane, PunchlinePlace), DaisyGardens: (ElmStreet, MapleStreet, OakStreet), DonaldsDreamland: (LullabyLane, PajamaPlace), GoofySpeedway: ()} +WelcomeValleyToken = 0 BossbotHQ = 10000 BossbotLobby = 10100 BossbotCountryClubIntA = 10500 @@ -208,6 +209,8 @@ MyEstate = 16000 GolfZone = 17000 PartyHood = 18000 HoodsAlwaysVisited = [17000, 18000] +WelcomeValleyBegin = 22000 +WelcomeValleyEnd = 61000 DynamicZonesBegin = 61000 DynamicZonesEnd = 1 << 20 cogDept2index = {'c': 0, diff --git a/toontown/town/Street.py b/toontown/town/Street.py index 08c11c29..1120dbe6 100644 --- a/toontown/town/Street.py +++ b/toontown/town/Street.py @@ -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.getHoodId(place.zoneId) == ToontownGlobals.DonaldsDreamland: + if place.zoneId and ZoneUtil.getCanonicalHoodId(place.zoneId) == ToontownGlobals.DonaldsDreamland: inDreamland = True alphaPath = 'phase_4/maps/tt_t_ara_gen_tunnelAheadSign_a.rgb' if Filename(signTexturePath).exists(): diff --git a/toontown/town/TownLoader.py b/toontown/town/TownLoader.py index 85ff3f40..fcd35e5d 100644 --- a/toontown/town/TownLoader.py +++ b/toontown/town/TownLoader.py @@ -51,7 +51,7 @@ class TownLoader(StateData.StateData): self.parentFSMState.addChild(self.fsm) self.loadBattleAnims() self.branchZone = ZoneUtil.getBranchZone(zoneId) - self.canonicalBranchZone = 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') @@ -238,6 +238,7 @@ 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') @@ -263,10 +264,12 @@ 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)