uberdog: Generate Toontown time manager, implement getLastLoggedInStr
This commit is contained in:
parent
dba9006efa
commit
a47f6a2e28
3 changed files with 20 additions and 3 deletions
|
@ -265,7 +265,12 @@ class LoginOperation(GameOperation):
|
|||
self._handleDone()
|
||||
|
||||
def getLastLoggedInStr(self):
|
||||
return '' # TODO
|
||||
lastLoggedInStr = ''
|
||||
if hasattr(self.loginManager.air, 'toontownTimeManager') and self.loginManager.air.toontownTimeManager:
|
||||
lastLoggedInStr = datetime.strftime(self.loginManager.air.toontownTimeManager.getCurServerDateTime(),
|
||||
self.loginManager.air.toontownTimeManager.formatStr)
|
||||
|
||||
return lastLoggedInStr
|
||||
|
||||
def getAccountCreationDate(self):
|
||||
accountCreationDate = self.account.get('CREATED', '')
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import time
|
||||
from datetime import datetime, timedelta
|
||||
import pytz
|
||||
from direct.distributed import DistributedObject
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from toontown.toonbase import TTLocalizer
|
||||
|
||||
class ToontownTimeManager(DistributedObject.DistributedObject):
|
||||
class ToontownTimeManager:
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownTimeManager')
|
||||
ClockFormat = '%I:%M:%S %p'
|
||||
formatStr = '%Y-%m-%d %H:%M:%S'
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import time
|
||||
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
|
||||
from otp.distributed.DistributedDirectoryAI import DistributedDirectoryAI
|
||||
from otp.distributed.OtpDoGlobals import *
|
||||
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
|
||||
from toontown.parties.ToontownTimeManager import ToontownTimeManager
|
||||
|
||||
|
||||
# TODO: Remove Astron dependence.
|
||||
|
@ -12,6 +15,7 @@ class ToontownUDRepository(ToontownInternalRepository):
|
|||
|
||||
def __init__(self, baseChannel, serverId):
|
||||
ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='UD')
|
||||
self.toontownTimeManager = None
|
||||
self.astronLoginManager = None
|
||||
|
||||
def handleConnected(self):
|
||||
|
@ -22,12 +26,21 @@ class ToontownUDRepository(ToontownInternalRepository):
|
|||
rootObj = DistributedDirectoryAI(self)
|
||||
rootObj.generateWithRequiredAndId(self.getGameDoId(), 0, 0)
|
||||
|
||||
# Create our local objects.
|
||||
self.notify.info('Creating local objects...')
|
||||
self.createLocals()
|
||||
|
||||
# Create our global objects.
|
||||
self.notify.info('Creating global objects...')
|
||||
self.createGlobals()
|
||||
|
||||
self.notify.info('UberDOG server is ready.')
|
||||
|
||||
def createLocals(self):
|
||||
# Create our Toontown time manager...
|
||||
self.toontownTimeManager = ToontownTimeManager(serverTimeUponLogin=int(time.time()),
|
||||
globalClockRealTimeUponLogin=globalClock.getRealTime())
|
||||
|
||||
def createGlobals(self):
|
||||
# Create our Astron login manager...
|
||||
self.astronLoginManager = self.generateGlobalObject(OTP_DO_ID_ASTRON_LOGIN_MANAGER, 'AstronLoginManager')
|
||||
|
|
Loading…
Reference in a new issue