what if i like environ

This commit is contained in:
Loudrob 2015-05-15 08:27:32 -04:00
parent 2dfc68ed8b
commit 568eb60cca
2 changed files with 21 additions and 17 deletions

View file

@ -10,23 +10,23 @@ echo.
set /P INPUT=
set server=unset
if %INPUT%==1 set server=127.0.0.1
if %INPUT%==3 set server=71.200.196.180
if %INPUT%==1 set TTU_GAMESERVER=127.0.0.1
if %INPUT%==3 set TTU_GAMESERVER=71.200.196.180
if %server%==unset (
if %TTU_GAMESERVER%==unset (
echo.
set /P server=Gameserver:
set /P TTU_GAMESERVER=Gameserver:
)
echo.
set /P user=Username:
set /P TTU_PLAYCOOKIE=Username:
echo ===============================
echo Starting Toontown United...
echo ppython: %PPYTHON_PATH%
echo Username: %user%
echo Gameserver: %server%
echo Username: %TTU_PLAYCOOKIE%
echo Gameserver: %TTU_GAMESERVER%
echo ===============================
%PPYTHON_PATH% -m toontown.toonbase.ClientStart %user% %server%
%PPYTHON_PATH% -m toontown.toonbase.ClientStart
pause

View file

@ -1,6 +1,8 @@
from pandac.PandaModules import *
from direct.directnotify import DirectNotifyGlobal
import os, sys, time, argparse
import os
import sys
import time
class LogAndOutput:
def __init__(self, orig, log):
@ -21,13 +23,9 @@ class TTULauncher:
notify = DirectNotifyGlobal.directNotify.newCategory('TTULauncher')
def __init__(self):
self.logPrefix = 'united-'
self.http = HTTPClient()
parser = argparse.ArgumentParser()
parser.add_argument('token')
parser.add_argument('server')
self.args = parser.parse_args()
self.logPrefix = 'united-'
ltime = 1 and time.localtime()
logSuffix = '%02d%02d%02d_%02d%02d%02d' % (ltime[0] - 2000, ltime[1], ltime[2], ltime[3], ltime[4], ltime[5])
@ -45,10 +43,16 @@ class TTULauncher:
sys.stderr = logErr
def getPlayToken(self):
return self.args.token
return self.getValue('TTU_PLAYCOOKIE')
def getGameServer(self):
return self.args.server
return self.getValue('TTU_GAMESERVER')
def getValue(self, key, default = None):
return os.environ.get(key, default)
def setValue(self, key, value):
os.environ[key] = str(value)
def setPandaErrorCode(self):
pass