2021-06-28 21:02:41 -05:00
|
|
|
import time
|
|
|
|
|
2019-11-08 21:20:04 -06:00
|
|
|
from direct.directnotify import DirectNotifyGlobal
|
2019-11-27 23:17:22 -06:00
|
|
|
|
2019-11-08 21:20:04 -06:00
|
|
|
from otp.distributed.DistributedDirectoryAI import DistributedDirectoryAI
|
2019-11-08 22:55:55 -06:00
|
|
|
from otp.distributed.OtpDoGlobals import *
|
2019-11-27 23:17:22 -06:00
|
|
|
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
|
2021-06-28 21:02:41 -05:00
|
|
|
from toontown.parties.ToontownTimeManager import ToontownTimeManager
|
2019-11-27 23:17:22 -06:00
|
|
|
|
2019-11-08 21:20:04 -06:00
|
|
|
|
|
|
|
# TODO: Remove Astron dependence.
|
|
|
|
|
|
|
|
class ToontownUDRepository(ToontownInternalRepository):
|
2019-11-27 23:17:22 -06:00
|
|
|
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownUDRepository')
|
2019-11-08 21:20:04 -06:00
|
|
|
|
|
|
|
def __init__(self, baseChannel, serverId):
|
|
|
|
ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='UD')
|
2021-06-28 21:02:41 -05:00
|
|
|
self.toontownTimeManager = None
|
2019-11-08 21:20:04 -06:00
|
|
|
self.astronLoginManager = None
|
|
|
|
|
|
|
|
def handleConnected(self):
|
|
|
|
ToontownInternalRepository.handleConnected(self)
|
|
|
|
|
|
|
|
# Create our root object.
|
|
|
|
self.notify.info('Creating root object (%d)...' % self.getGameDoId())
|
|
|
|
rootObj = DistributedDirectoryAI(self)
|
|
|
|
rootObj.generateWithRequiredAndId(self.getGameDoId(), 0, 0)
|
|
|
|
|
2021-06-28 21:02:41 -05:00
|
|
|
# Create our local objects.
|
|
|
|
self.notify.info('Creating local objects...')
|
|
|
|
self.createLocals()
|
|
|
|
|
2019-11-08 21:20:04 -06:00
|
|
|
# Create our global objects.
|
|
|
|
self.notify.info('Creating global objects...')
|
|
|
|
self.createGlobals()
|
|
|
|
|
|
|
|
self.notify.info('UberDOG server is ready.')
|
|
|
|
|
2021-06-28 21:02:41 -05:00
|
|
|
def createLocals(self):
|
|
|
|
# Create our Toontown time manager...
|
|
|
|
self.toontownTimeManager = ToontownTimeManager(serverTimeUponLogin=int(time.time()),
|
|
|
|
globalClockRealTimeUponLogin=globalClock.getRealTime())
|
|
|
|
|
2019-11-08 21:20:04 -06:00
|
|
|
def createGlobals(self):
|
2021-06-29 12:57:22 -05:00
|
|
|
if __astron__:
|
2020-01-20 01:59:05 -06:00
|
|
|
# Create our Astron login manager...
|
|
|
|
self.astronLoginManager = self.generateGlobalObject(OTP_DO_ID_ASTRON_LOGIN_MANAGER, 'AstronLoginManager')
|