mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
parent
31d212c329
commit
04233eb9f3
60 changed files with 333 additions and 100 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
38
toontown/ai/WelcomeValleyManager.py
Normal file
38
toontown/ai/WelcomeValleyManager.py
Normal file
|
@ -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])
|
18
toontown/ai/WelcomeValleyManagerAI.py
Normal file
18
toontown/ai/WelcomeValleyManagerAI.py
Normal file
|
@ -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
|
||||
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -507,6 +507,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
|
|||
'zoneId': zoneId,
|
||||
'shardId': None,
|
||||
'avId': -1,
|
||||
'allowRedirect': 0,
|
||||
'doorDoId': self.otherDoId
|
||||
}
|
||||
return request
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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]))
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -124,6 +124,7 @@ class DistributedHouseDoor(DistributedDoor.DistributedDoor):
|
|||
'zoneId': zoneId,
|
||||
'shardId': None,
|
||||
'avId': -1,
|
||||
'allowRedirect': 0,
|
||||
'doorDoId': self.otherDoId}
|
||||
messenger.send('doorDoneEvent', [request])
|
||||
return
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
return (showWake, wakeWaterHeight)
|
||||
|
|
|
@ -27,7 +27,7 @@ def getDifficulty(trolleyZone):
|
|||
|
||||
|
||||
def getSafezoneId(trolleyZone):
|
||||
return ZoneUtil.getHoodId(trolleyZone)
|
||||
return ZoneUtil.getCanonicalHoodId(trolleyZone)
|
||||
|
||||
|
||||
def getScoreMult(trolleyZone):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue