2019-11-02 17:27:54 -05:00
|
|
|
import os
|
|
|
|
from direct.showbase.EventManagerGlobal import *
|
|
|
|
from pandac.PandaModules import *
|
|
|
|
from otp.launcher.LauncherBase import LauncherBase
|
|
|
|
from toontown.toonbase import TTLocalizer
|
|
|
|
|
|
|
|
class QuickLauncher(LauncherBase):
|
|
|
|
GameName = 'Toontown'
|
|
|
|
Localizer = TTLocalizer
|
|
|
|
|
|
|
|
def __init__(self):
|
2019-12-30 00:07:56 -06:00
|
|
|
print('Running: ToontownQuickLauncher')
|
2019-11-02 17:27:54 -05:00
|
|
|
self.toontownBlueKey = 'TOONTOWN_BLUE'
|
|
|
|
LauncherBase.__init__(self)
|
|
|
|
self.useTTSpecificLogin = config.GetBool('tt-specific-login', 0)
|
|
|
|
if self.useTTSpecificLogin:
|
|
|
|
self.toontownPlayTokenKey = 'LOGIN_TOKEN'
|
|
|
|
else:
|
|
|
|
self.toontownPlayTokenKey = 'PLAYTOKEN'
|
2019-12-30 00:07:56 -06:00
|
|
|
print('useTTSpecificLogin=%s' % self.useTTSpecificLogin)
|
2021-06-29 19:49:47 -05:00
|
|
|
self.secretNeedsParentPasswordKey = False
|
|
|
|
self.chatEligibleKey = True
|
2019-11-02 17:27:54 -05:00
|
|
|
self.showPhase = -1
|
|
|
|
self.maybeStartGame()
|
|
|
|
self.mainLoop()
|
|
|
|
|
|
|
|
def getValue(self, key, default = None):
|
|
|
|
return os.environ.get(key, default)
|
|
|
|
|
|
|
|
def setValue(self, key, value):
|
|
|
|
os.environ[key] = str(value)
|
|
|
|
|
|
|
|
def getTestServerFlag(self):
|
|
|
|
return self.getValue('IS_TEST_SERVER', 0)
|
|
|
|
|
|
|
|
def getGameServer(self):
|
|
|
|
return self.getValue('GAME_SERVER', '')
|
|
|
|
|
|
|
|
def getLogFileName(self):
|
|
|
|
return 'toontown'
|
|
|
|
|
|
|
|
def getBlue(self):
|
|
|
|
blue = self.getValue(self.toontownBlueKey)
|
|
|
|
self.setValue(self.toontownBlueKey, '')
|
|
|
|
if blue == 'NO BLUE':
|
|
|
|
blue = None
|
|
|
|
return blue
|
|
|
|
|
|
|
|
def getPlayToken(self):
|
|
|
|
playToken = self.getValue(self.toontownPlayTokenKey)
|
|
|
|
self.setValue(self.toontownPlayTokenKey, '')
|
|
|
|
if playToken == 'NO PLAYTOKEN':
|
|
|
|
playToken = None
|
|
|
|
return playToken
|
|
|
|
|
|
|
|
def setRegistry(self, name, value):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def getRegistry(self, name, missingValue = None):
|
|
|
|
self.notify.info('getRegistry %s' % ((name, missingValue),))
|
|
|
|
self.notify.info('checking env' % os.environ)
|
|
|
|
if missingValue == None:
|
|
|
|
missingValue = ''
|
|
|
|
value = os.environ.get(name, missingValue)
|
|
|
|
try:
|
|
|
|
value = int(value)
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
|
|
|
|
return value
|
|
|
|
|
|
|
|
def getGame2Done(self):
|
|
|
|
return True
|
|
|
|
|
|
|
|
def getNeedPwForSecretKey(self):
|
|
|
|
if self.useTTSpecificLogin:
|
|
|
|
self.notify.info('getNeedPwForSecretKey using tt-specific-login')
|
|
|
|
try:
|
|
|
|
if base.cr.chatChatCodeCreationRule == 'PARENT':
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
return False
|
|
|
|
except:
|
|
|
|
return True
|
|
|
|
|
|
|
|
else:
|
|
|
|
return self.secretNeedsParentPasswordKey
|
|
|
|
|
|
|
|
def getParentPasswordSet(self):
|
|
|
|
if self.useTTSpecificLogin:
|
|
|
|
self.notify.info('getParentPasswordSet using tt-specific-login')
|
|
|
|
try:
|
|
|
|
if base.cr.isPaid():
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
return False
|
|
|
|
except:
|
|
|
|
return False
|
|
|
|
|
|
|
|
else:
|
|
|
|
return self.chatEligibleKey
|
|
|
|
|
|
|
|
def startGame(self):
|
|
|
|
self.newTaskManager()
|
|
|
|
eventMgr.restart()
|
|
|
|
from toontown.toonbase import ToontownStart
|