ai: broken welcome valley
This commit is contained in:
parent
b58d21c70e
commit
f2b0bae949
|
|
@ -7,6 +7,7 @@ from otp.ai.TimeManagerAI import TimeManagerAI
|
||||||
from otp.distributed.OtpDoGlobals import *
|
from otp.distributed.OtpDoGlobals import *
|
||||||
from toontown.ai.HolidayManagerAI import HolidayManagerAI
|
from toontown.ai.HolidayManagerAI import HolidayManagerAI
|
||||||
from toontown.ai.NewsManagerAI import NewsManagerAI
|
from toontown.ai.NewsManagerAI import NewsManagerAI
|
||||||
|
from toontown.ai.WelcomeValleyManagerAI import WelcomeValleyManagerAI
|
||||||
from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI
|
from toontown.building.DistributedTrophyMgrAI import DistributedTrophyMgrAI
|
||||||
from toontown.catalog.CatalogManagerAI import CatalogManagerAI
|
from toontown.catalog.CatalogManagerAI import CatalogManagerAI
|
||||||
from toontown.coghq.PromotionManagerAI import PromotionManagerAI
|
from toontown.coghq.PromotionManagerAI import PromotionManagerAI
|
||||||
|
|
@ -50,6 +51,7 @@ class ToontownAIRepository(ToontownInternalRepository):
|
||||||
self.cogPageManager = None
|
self.cogPageManager = None
|
||||||
self.timeManager = None
|
self.timeManager = None
|
||||||
self.newsManager = None
|
self.newsManager = None
|
||||||
|
self.welcomeValleyManager = None
|
||||||
self.inGameNewsMgr = None
|
self.inGameNewsMgr = None
|
||||||
self.catalogManager = None
|
self.catalogManager = None
|
||||||
self.trophyMgr = None
|
self.trophyMgr = None
|
||||||
|
|
@ -130,6 +132,10 @@ class ToontownAIRepository(ToontownInternalRepository):
|
||||||
self.newsManager = NewsManagerAI(self)
|
self.newsManager = NewsManagerAI(self)
|
||||||
self.newsManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
|
self.newsManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
|
||||||
|
|
||||||
|
# Generate our Welcome Valley manager...
|
||||||
|
self.welcomeValleyManager = WelcomeValleyManagerAI(self)
|
||||||
|
self.welcomeValleyManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
|
||||||
|
|
||||||
# Generate our in-game news manager...
|
# Generate our in-game news manager...
|
||||||
self.inGameNewsMgr = DistributedInGameNewsMgrAI(self)
|
self.inGameNewsMgr = DistributedInGameNewsMgrAI(self)
|
||||||
self.inGameNewsMgr.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
|
self.inGameNewsMgr.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
|
||||||
|
|
@ -208,6 +214,9 @@ class ToontownAIRepository(ToontownInternalRepository):
|
||||||
)
|
)
|
||||||
self.generateHood(DLHoodDataAI, ToontownGlobals.DonaldsDreamland)
|
self.generateHood(DLHoodDataAI, ToontownGlobals.DonaldsDreamland)
|
||||||
|
|
||||||
|
# Welcome Valley zones
|
||||||
|
self.welcomeValleyManager.createWelcomeValleyZones()
|
||||||
|
|
||||||
# Assign the initial suit buildings.
|
# Assign the initial suit buildings.
|
||||||
for suitPlanner in self.suitPlanners.values():
|
for suitPlanner in self.suitPlanners.values():
|
||||||
suitPlanner.assignInitialSuitBuildings()
|
suitPlanner.assignInitialSuitBuildings()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,41 @@
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
||||||
|
|
||||||
|
from toontown.hood import ZoneUtil
|
||||||
|
from toontown.hood.GSHoodDataAI import GSHoodDataAI
|
||||||
|
from toontown.hood.TTHoodDataAI import TTHoodDataAI
|
||||||
|
from toontown.toonbase import ToontownGlobals
|
||||||
|
|
||||||
|
|
||||||
class WelcomeValleyManagerAI(DistributedObjectAI):
|
class WelcomeValleyManagerAI(DistributedObjectAI):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('WelcomeValleyManagerAI')
|
notify = DirectNotifyGlobal.directNotify.newCategory('WelcomeValleyManagerAI')
|
||||||
|
|
||||||
|
def requestZoneIdMessage(self, zoneId, context):
|
||||||
|
avId = self.air.getAvatarIdFromSender()
|
||||||
|
if zoneId == 0:
|
||||||
|
zoneId = ToontownGlobals.WelcomeValleyBegin
|
||||||
|
|
||||||
|
self.toonSetZone(avId, zoneId)
|
||||||
|
self.sendUpdateToAvatarId(avId, 'requestZoneIdResponse', [zoneId, context])
|
||||||
|
|
||||||
|
def toonSetZone(self, doId, zoneId):
|
||||||
|
event = self.staticGetLogicalZoneChangeEvent(doId)
|
||||||
|
inWelcomeValley = self.isAccepting(event)
|
||||||
|
if not ZoneUtil.isDynamicZone(zoneId):
|
||||||
|
if ZoneUtil.isWelcomeValley(zoneId) and not inWelcomeValley:
|
||||||
|
self.air.districtStats.b_setNewAvatarCount(self.air.districtStats.getNewAvatarCount() + 1)
|
||||||
|
self.accept(event, lambda newZoneId, _: self.toonSetZone(doId, newZoneId))
|
||||||
|
self.accept(self.air.getAvatarExitEvent(doId), self.toonSetZone, extraArgs=[doId, 123])
|
||||||
|
elif (not ZoneUtil.isWelcomeValley(zoneId)) and inWelcomeValley:
|
||||||
|
self.air.districtStats.b_setNewAvatarCount(self.air.districtStats.getNewAvatarCount() - 1)
|
||||||
|
self.ignore(event)
|
||||||
|
self.ignore(self.air.getAvatarExitEvent(doId))
|
||||||
|
|
||||||
|
def createWelcomeValleyZones(self):
|
||||||
|
self.notify.info('Creating Welcome Valley zones...')
|
||||||
|
|
||||||
|
# Toontown Central
|
||||||
|
self.air.generateHood(TTHoodDataAI, 22000)
|
||||||
|
|
||||||
|
# Goofy Speedway
|
||||||
|
self.air.generateHood(GSHoodDataAI, 23000)
|
||||||
|
|
|
||||||
|
|
@ -165,16 +165,28 @@ class QuietZoneState(StateData.StateData):
|
||||||
else:
|
else:
|
||||||
base.cr.handlePlayGame(msgType, di)
|
base.cr.handlePlayGame(msgType, di)
|
||||||
|
|
||||||
def handleWaitForZoneRedirect(self, msgType, di):
|
if not config.GetBool('astron-support', True):
|
||||||
self.notify.debug('handleWaitForZoneRedirect(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')')
|
def handleWaitForZoneRedirect(self, msgType, di):
|
||||||
if msgType == CLIENT_CREATE_OBJECT_REQUIRED:
|
self.notify.debug('handleWaitForZoneRedirect(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')')
|
||||||
base.cr.handleQuietZoneGenerateWithRequired(di)
|
if msgType == CLIENT_CREATE_OBJECT_REQUIRED:
|
||||||
elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER:
|
base.cr.handleQuietZoneGenerateWithRequired(di)
|
||||||
base.cr.handleQuietZoneGenerateWithRequiredOther(di)
|
elif msgType == CLIENT_CREATE_OBJECT_REQUIRED_OTHER:
|
||||||
elif msgType == CLIENT_OBJECT_UPDATE_FIELD:
|
base.cr.handleQuietZoneGenerateWithRequiredOther(di)
|
||||||
base.cr.handleQuietZoneUpdateField(di)
|
elif msgType == CLIENT_OBJECT_UPDATE_FIELD:
|
||||||
else:
|
base.cr.handleQuietZoneUpdateField(di)
|
||||||
base.cr.handlePlayGame(msgType, di)
|
else:
|
||||||
|
base.cr.handlePlayGame(msgType, di)
|
||||||
|
else:
|
||||||
|
def handleWaitForZoneRedirect(self, msgType, di):
|
||||||
|
self.notify.debug('handleWaitForZoneRedirect(' + 'msgType=' + str(msgType) + ', di=' + str(di) + ')')
|
||||||
|
if msgType == CLIENT_ENTER_OBJECT_REQUIRED:
|
||||||
|
base.cr.handleQuietZoneGenerateWithRequired(di)
|
||||||
|
elif msgType == CLIENT_ENTER_OBJECT_REQUIRED_OTHER:
|
||||||
|
base.cr.handleQuietZoneGenerateWithRequiredOther(di)
|
||||||
|
elif msgType == CLIENT_OBJECT_SET_FIELD:
|
||||||
|
base.cr.handleQuietZoneUpdateField(di)
|
||||||
|
else:
|
||||||
|
base.cr.handlePlayGame(msgType, di)
|
||||||
|
|
||||||
def enterOff(self):
|
def enterOff(self):
|
||||||
self.notify.debug('enterOff()')
|
self.notify.debug('enterOff()')
|
||||||
|
|
|
||||||
|
|
@ -433,7 +433,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
|
||||||
|
|
||||||
def announceZoneChange(self, newZoneId, oldZoneId):
|
def announceZoneChange(self, newZoneId, oldZoneId):
|
||||||
from toontown.pets import PetObserve
|
from toontown.pets import PetObserve
|
||||||
#self.air.welcomeValleyManager.toonSetZone(self.doId, newZoneId)
|
self.air.welcomeValleyManager.toonSetZone(self.doId, newZoneId)
|
||||||
broadcastZones = [oldZoneId, newZoneId]
|
broadcastZones = [oldZoneId, newZoneId]
|
||||||
if self.isInEstate() or self.wasInEstate():
|
if self.isInEstate() or self.wasInEstate():
|
||||||
broadcastZones = union(broadcastZones, self.estateZones)
|
broadcastZones = union(broadcastZones, self.estateZones)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue