Poodletooth-iLand/toontown/uberdog/ToontownUberRepository.py

45 lines
2 KiB
Python
Raw Normal View History

2015-03-03 16:10:12 -06:00
from direct.distributed.PyDatagram import *
import urlparse
from otp.distributed.OtpDoGlobals import *
2015-06-20 04:24:08 -05:00
from otp.distributed.DistributedDirectoryAI import DistributedDirectoryAI
2015-03-03 16:10:12 -06:00
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
import toontown.minigame.MinigameCreatorAI
2015-07-21 11:04:01 -05:00
from toontown.uberdog.TopToonsManagerUD import TopToonsManagerUD
2015-03-03 16:10:12 -06:00
if config.GetBool('want-rpc-server', False):
from toontown.rpc.ToontownRPCServer import ToontownRPCServer
from toontown.rpc.ToontownRPCHandler import ToontownRPCHandler
class ToontownUberRepository(ToontownInternalRepository):
def __init__(self, baseChannel, serverId):
ToontownInternalRepository.__init__(self, baseChannel, serverId, dcSuffix='UD')
self.notify.setInfo(True)
2015-08-01 09:01:28 -05:00
self.wantTopToons = self.config.GetBool('want-top-toons', True)
2015-03-03 16:10:12 -06:00
def handleConnected(self):
2015-07-12 11:48:58 -05:00
ToontownInternalRepository.handleConnected(self)
rootObj = DistributedDirectoryAI(self)
rootObj.generateWithRequiredAndId(self.getGameDoId(), 0, 0)
2015-03-03 16:10:12 -06:00
if config.GetBool('want-rpc-server', False):
endpoint = config.GetString('rpc-server-endpoint', 'http://localhost:8080/')
self.rpcServer = ToontownRPCServer(endpoint, ToontownRPCHandler(self))
self.rpcServer.start(useTaskChain=True)
self.createGlobals()
self.notify.info('Done.')
def createGlobals(self):
"""
Create "global" objects.
"""
self.csm = simbase.air.generateGlobalObject(OTP_DO_ID_CLIENT_SERVICES_MANAGER, 'ClientServicesManager')
self.chatAgent = simbase.air.generateGlobalObject(OTP_DO_ID_CHAT_MANAGER, 'ChatAgent')
2015-05-16 20:04:41 -05:00
self.friendsManager = simbase.air.generateGlobalObject(OTP_DO_ID_TTS_FRIENDS_MANAGER, 'TTSFriendsManager')
2015-03-03 16:10:12 -06:00
self.globalPartyMgr = simbase.air.generateGlobalObject(OTP_DO_ID_GLOBAL_PARTY_MANAGER, 'GlobalPartyManager')
2015-08-01 09:01:28 -05:00
if self.wantTopToons:
self.topToonsMgr = TopToonsManagerUD(self)
2015-07-12 14:42:55 -05:00