mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
A bit of a launcher cleanup, retired ClientStartRemoteDB (we are gonna supply play token directly), and instead of environ, we are now supplying server and token with argparse.
This commit is contained in:
parent
5bc056d630
commit
7171f49e3b
8 changed files with 19 additions and 100 deletions
29
client.bat
29
client.bat
|
@ -5,39 +5,26 @@ set /P PPYTHON_PATH=<PPYTHON_PATH
|
|||
echo Choose your game server!
|
||||
echo #1 - Localhost
|
||||
echo #2 - Custom
|
||||
echo #3 - Custom w/ RemoteDB
|
||||
echo.
|
||||
set /P INPUT=
|
||||
set TTU_GAMESERVER=unset
|
||||
set server=unset
|
||||
|
||||
if %INPUT%==1 set TTU_GAMESERVER=127.0.0.1
|
||||
if %TTU_GAMESERVER%==unset (
|
||||
if %INPUT%==1 set server=127.0.0.1
|
||||
if %server%==unset (
|
||||
echo.
|
||||
set /P TTU_GAMESERVER=Gameserver:
|
||||
set /P server=Gameserver:
|
||||
)
|
||||
|
||||
echo.
|
||||
set /P ttuUsername=Username:
|
||||
|
||||
if %INPUT%==3 (
|
||||
echo.
|
||||
set /P ttuPassword=Password:
|
||||
)
|
||||
|
||||
set TTU_PLAYCOOKIE=%ttuUsername%
|
||||
set /P user=Username:
|
||||
|
||||
echo ===============================
|
||||
echo Starting Toontown United...
|
||||
echo ppython: %PPYTHON_PATH%
|
||||
echo Username: %ttuUsername%
|
||||
echo Username: %user%
|
||||
echo Password: %ttuPassword%
|
||||
echo Gameserver: %TTU_GAMESERVER%
|
||||
echo Gameserver: %server%
|
||||
echo ===============================
|
||||
|
||||
if %INPUT%==3 (
|
||||
%PPYTHON_PATH% -m toontown.toonbase.ClientStartRemoteDB
|
||||
) else (
|
||||
%PPYTHON_PATH% -m toontown.toonbase.ClientStart
|
||||
)
|
||||
|
||||
%PPYTHON_PATH% -m toontown.toonbase.ClientStart %server% %user%
|
||||
pause
|
|
@ -36,9 +36,6 @@ class DummyLauncherBase:
|
|||
self.downloadDoneTask(None)
|
||||
return
|
||||
|
||||
def isTestServer(self):
|
||||
return base.config.GetBool('is-test-server', 0)
|
||||
|
||||
def setPhaseCompleteArray(self, newPhaseComplete):
|
||||
self.phaseComplete = newPhaseComplete
|
||||
|
||||
|
|
|
@ -172,8 +172,6 @@ class LauncherBase(DirectObject):
|
|||
self.notify = directNotify.newCategory('Launcher')
|
||||
self.clock = TrueClock.getGlobalPtr()
|
||||
self.logPrefix = logPrefix
|
||||
self.testServerFlag = self.getTestServerFlag()
|
||||
self.notify.info('isTestServer: %s' % self.testServerFlag)
|
||||
downloadServerString = launcherConfig.GetString('download-server', '')
|
||||
if downloadServerString:
|
||||
self.notify.info('Overriding downloadServer to %s.' % downloadServerString)
|
||||
|
@ -1518,9 +1516,6 @@ class LauncherBase(DirectObject):
|
|||
self.lastLauncherMsg = msg
|
||||
self.notify.info(msg)
|
||||
|
||||
def isTestServer(self):
|
||||
return self.testServerFlag
|
||||
|
||||
def recordPeriodTimeRemaining(self, secondsRemaining):
|
||||
self.setValue(self.PeriodTimeRemainingKey, int(secondsRemaining))
|
||||
|
||||
|
|
|
@ -579,11 +579,6 @@ class ClientRepositoryBase(ConnectionRepository):
|
|||
return None
|
||||
return worldNP
|
||||
|
||||
def isLive(self):
|
||||
if base.config.GetBool('force-live', 0):
|
||||
return True
|
||||
return not (__dev__ or launcher.isTestServer())
|
||||
|
||||
def isLocalId(self, id):
|
||||
# By default, no ID's are local. See also
|
||||
# ClientRepository.isLocalId().
|
||||
|
|
|
@ -428,8 +428,7 @@ class TTChatInputSpeedChat(DirectObject.DirectObject):
|
|||
|
||||
def createSpeedChat(self):
|
||||
structure = []
|
||||
if launcher and not launcher.isTestServer() or __dev__:
|
||||
structure.append([TTSCPromotionalMenu, OTPLocalizer.SCMenuPromotion])
|
||||
structure.append([TTSCPromotionalMenu, OTPLocalizer.SCMenuPromotion])
|
||||
structure.append([SCEmoteMenu, OTPLocalizer.SCMenuEmotions])
|
||||
structure.append([SCCustomMenu, OTPLocalizer.SCMenuCustom])
|
||||
structure.append([TTSCResistanceMenu, OTPLocalizer.SCMenuResistance])
|
||||
|
|
|
@ -573,16 +573,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
def dumpAllSubShardObjects(self):
|
||||
if self.KeepSubShardObjects:
|
||||
return
|
||||
isNotLive = not base.cr.isLive()
|
||||
if isNotLive:
|
||||
try:
|
||||
localAvatar
|
||||
except:
|
||||
self.notify.info('dumpAllSubShardObjects')
|
||||
else:
|
||||
self.notify.info('dumpAllSubShardObjects: defaultShard is %s' % localAvatar.defaultShard)
|
||||
|
||||
ignoredClasses = ('MagicWordManager', 'TimeManager', 'DistributedDistrict', 'FriendManager', 'NewsManager', 'ToontownMagicWordManager', 'WelcomeValleyManager', 'DistributedTrophyMgr', 'CatalogManager', 'DistributedBankMgr', 'EstateManager', 'RaceManager', 'SafeZoneManager', 'DeleteManager', 'TutorialManager', 'ToontownDistrict', 'DistributedDeliveryManager', 'DistributedPartyManager', 'AvatarFriendsManager', 'TTCodeRedemptionMgr')
|
||||
messenger.send('clientCleanup')
|
||||
for avId, pad in self.__queryAvatarMap.items():
|
||||
pad.delayDelete.destroy()
|
||||
|
@ -592,16 +582,8 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
doIds = self.doId2do.keys()
|
||||
for doId in doIds:
|
||||
obj = self.doId2do[doId]
|
||||
if isNotLive:
|
||||
ignoredClass = obj.__class__.__name__ in ignoredClasses
|
||||
if not ignoredClass and obj.parentId != localAvatar.defaultShard:
|
||||
self.notify.info('dumpAllSubShardObjects: %s %s parent %s is not defaultShard' % (obj.__class__.__name__, obj.doId, obj.parentId))
|
||||
if obj.parentId == localAvatar.defaultShard and obj is not localAvatar:
|
||||
if obj.neverDisable:
|
||||
if isNotLive:
|
||||
if not ignoredClass:
|
||||
self.notify.warning('dumpAllSubShardObjects: neverDisable set for %s %s' % (obj.__class__.__name__, obj.doId))
|
||||
else:
|
||||
if not obj.neverDisable:
|
||||
self.deleteObject(doId)
|
||||
self._deletedSubShardDoIds.add(doId)
|
||||
if obj.getDelayDeleteCount() != 0:
|
||||
|
@ -618,8 +600,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
s += '\n could not delete %s (%s), delayDeletes=%s' % (safeRepr(obj), itype(obj), obj.getDelayDeleteNames())
|
||||
|
||||
self.notify.error(s)
|
||||
if isNotLive:
|
||||
self.notify.info('dumpAllSubShardObjects: doIds left: %s' % self.doId2do.keys())
|
||||
|
||||
def _removeCurrentShardInterest(self, callback):
|
||||
if self.old_setzone_interest_handle is None:
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
from pandac.PandaModules import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from otp.launcher.LauncherBase import LauncherBase
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import os, sys, time, argparse
|
||||
|
||||
class LogAndOutput:
|
||||
def __init__(self, orig, log):
|
||||
|
@ -24,9 +22,13 @@ class TTULauncher(LauncherBase):
|
|||
notify = DirectNotifyGlobal.directNotify.newCategory('ToontownDummyLauncher')
|
||||
|
||||
def __init__(self):
|
||||
self.http = HTTPClient()
|
||||
|
||||
self.logPrefix = 'united-'
|
||||
self.http = HTTPClient()
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('token')
|
||||
parser.add_argument('server')
|
||||
self.args = parser.parse_args()
|
||||
|
||||
ltime = 1 and time.localtime()
|
||||
logSuffix = '%02d%02d%02d_%02d%02d%02d' % (ltime[0] - 2000, ltime[1], ltime[2],
|
||||
|
@ -46,10 +48,10 @@ class TTULauncher(LauncherBase):
|
|||
sys.stderr = logErr
|
||||
|
||||
def getPlayToken(self):
|
||||
return self.getValue('TTU_PLAYCOOKIE')
|
||||
return self.args.token
|
||||
|
||||
def getGameServer(self):
|
||||
return self.getValue('TTU_GAMESERVER')
|
||||
return self.args.server
|
||||
|
||||
def setPandaErrorCode(self, code):
|
||||
pass
|
||||
|
@ -69,15 +71,9 @@ class TTULauncher(LauncherBase):
|
|||
def getVerifyFiles(self):
|
||||
return config.GetInt('launcher-verify', 0)
|
||||
|
||||
def getTestServerFlag(self):
|
||||
return self.getValue('IS_TEST_SERVER', 0)
|
||||
|
||||
def isDownloadComplete(self):
|
||||
return 1
|
||||
|
||||
def isTestServer(self):
|
||||
return 0
|
||||
|
||||
def getPhaseComplete(self, phase):
|
||||
return 1
|
||||
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
#!/usr/bin/env python2
|
||||
import json
|
||||
import os
|
||||
import requests
|
||||
from pandac.PandaModules import *
|
||||
|
||||
|
||||
username = os.environ['ttiUsername']
|
||||
password = os.environ['ttiPassword']
|
||||
distribution = ConfigVariableString('distribution', 'dev').getValue()
|
||||
|
||||
accountServerEndpoint = ConfigVariableString(
|
||||
'account-server-endpoint',
|
||||
'https://toontownunited.com/api/').getValue()
|
||||
request = requests.post(
|
||||
accountServerEndpoint + 'login/',
|
||||
data={'n': username, 'p': password, 'dist': distribution})
|
||||
|
||||
try:
|
||||
response = json.loads(request.text)
|
||||
except ValueError:
|
||||
print "Couldn't verify account credentials."
|
||||
else:
|
||||
if not response['success']:
|
||||
print response['reason']
|
||||
else:
|
||||
os.environ['TTU_PLAYCOOKIE'] = response['token']
|
||||
|
||||
# Start the game:
|
||||
import toontown.toonbase.ClientStart
|
Loading…
Reference in a new issue