Remove QuickLauncher and UserFunnel

This commit is contained in:
Daniel 2015-03-04 19:06:27 +02:00
parent 90a4478bfc
commit a81e40be30
5 changed files with 0 additions and 1120 deletions

View file

@ -158,9 +158,6 @@ class ToontownChatManager(ChatManager.ChatManager):
directFrameText = OTPLocalizer.PaidNoParentPasswordWarning
payButtonText = OTPLocalizer.PaidNoParentPasswordWarningSet
directButtonText = OTPLocalizer.PaidNoParentPasswordWarningContinue
if 'QuickLauncher' not in str(base.cr.launcher.__class__) and not base.cr.isPaid():
directFrameText = OTPLocalizer.UnpaidNoParentPasswordWarning
self.forceHidePayButton = True
if self.unpaidChatWarning == None:
guiButton = loader.loadModel('phase_3/models/gui/quit_button')
buttonImage = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR'))

View file

@ -1,400 +0,0 @@
import sys
import os
import time
import string
import bz2
import random
from direct.showbase.MessengerGlobal import *
from direct.showbase.DirectObject import DirectObject
from direct.showbase.EventManagerGlobal import *
from direct.task.TaskManagerGlobal import *
from direct.task.Task import Task
from direct.directnotify.DirectNotifyGlobal import *
from pandac.PandaModules import *
from otp.launcher.LauncherBase import LauncherBase
from toontown.toonbase import TTLocalizer
class QuickLauncher(LauncherBase):
GameName = 'Toontown'
ArgCount = 3
LauncherPhases = [1,
2,
3,
3.5,
4,
5,
5.5,
6,
7,
8,
9,
10,
11,
12,
13]
TmpOverallMap = [0.01,
0.01,
0.23,
0.15,
0.12,
0.17,
0.08,
0.07,
0.05,
0.05,
0.017,
0.011,
0.01,
0.012,
0.01]
ForegroundSleepTime = 0.001
Localizer = TTLocalizer
DecompressMultifiles = True
launcherFileDbFilename = 'patcher.ver?%s' % random.randint(1, 1000000000)
CompressionExt = 'bz2'
PatchExt = 'pch'
def __init__(self):
print 'Running: ToontownQuickLauncher'
self.toontownBlueKey = 'TOONTOWN_BLUE'
self.launcherMessageKey = 'LAUNCHER_MESSAGE'
self.game1DoneKey = 'GAME1_DONE'
self.game2DoneKey = 'GAME2_DONE'
self.tutorialCompleteKey = 'TUTORIAL_DONE'
LauncherBase.__init__(self)
self.useTTSpecificLogin = config.GetBool('tt-specific-login', 0)
self.toontownPlayTokenKey = 'TTU_PLAYCOOKIE'
print 'useTTSpecificLogin=%s' % self.useTTSpecificLogin
self.contentDir = '/'
self.serverDbFileHash = HashVal()
self.launcherFileDbHash = HashVal()
self.DECREASE_BANDWIDTH = 0
self.httpChannel.setDownloadThrottle(0)
self.webAcctParams = 'WEB_ACCT_PARAMS'
self.parseWebAcctParams()
self.showPhase = -1
self.maybeStartGame()
self.mainLoop()
def addDownloadVersion(self, serverFilePath):
url = URLSpec(self.downloadServer)
origPath = url.getPath()
if origPath[-1] == '/':
url.setPath('%s%s' % (origPath, serverFilePath))
else:
url.setPath('%s/%s' % (origPath, serverFilePath))
return url
def downloadLauncherFileDbDone(self):
settings = {}
for line in self.ramfile.readlines():
if line.find('=') >= 0:
key, value = line.strip().split('=')
settings[key] = value
self.requiredInstallFiles = []
if sys.platform == 'win32':
fileList = settings['REQUIRED_INSTALL_FILES']
elif sys.platform == 'darwin':
fileList = settings['REQUIRED_INSTALL_FILES_OSX']
else:
self.notify.warning('Unknown sys.platform: %s' % sys.platform)
fileList = settings['REQUIRED_INSTALL_FILES']
for fileDesc in fileList.split():
fileName, flag = fileDesc.split(':')
directions = BitMask32(flag)
extract = directions.getBit(0)
required = directions.getBit(1)
optionalDownload = directions.getBit(2)
self.notify.info('fileName: %s, flag:=%s directions=%s, extract=%s required=%s optDownload=%s' % (fileName,
flag,
directions,
extract,
required,
optionalDownload))
if required:
self.requiredInstallFiles.append(fileName)
self.notify.info('requiredInstallFiles: %s' % self.requiredInstallFiles)
self.mfDetails = {}
for mfName in self.requiredInstallFiles:
currentVer = settings['FILE_%s.current' % mfName]
details = settings['FILE_%s.%s' % (mfName, currentVer)]
size, hash = details.split()
self.mfDetails[mfName] = (currentVer, int(size), hash)
self.notify.info('mfDetails[%s] = %s' % (mfName, self.mfDetails[mfName]))
self.resumeInstall()
def resumeMultifileDownload(self):
curVer, expectedSize, expectedMd5 = self.mfDetails[self.currentMfname]
localFilename = Filename(self.topDir, Filename('_%s.%s.%s' % (self.currentMfname, curVer, self.CompressionExt)))
serverFilename = '%s%s.%s.%s' % (self.contentDir,
self.currentMfname,
curVer,
self.CompressionExt)
if localFilename.exists():
fileSize = localFilename.getFileSize()
self.notify.info('Previous partial download exists for: %s size=%s' % (localFilename.cStr(), fileSize))
self.downloadMultifile(serverFilename, localFilename, self.currentMfname, self.downloadMultifileDone, 0, fileSize, self.downloadMultifileWriteToDisk)
else:
self.downloadMultifile(serverFilename, localFilename, self.currentMfname, self.downloadMultifileDone, 0, 0, self.downloadMultifileWriteToDisk)
def resumeInstall(self):
for self.currentPhaseIndex in xrange(len(self.LauncherPhases)):
self.currentPhase = self.LauncherPhases[self.currentPhaseIndex]
self.currentPhaseName = self.Localizer.LauncherPhaseNames[self.currentPhase]
self.currentMfname = 'phase_%s.mf' % self.currentPhase
if sys.platform == 'darwin' and (self.currentMfname == 'phase_1.mf' or self.currentMfname == 'phase_2.mf'):
self.currentMfname = 'phase_%sOSX.mf' % self.currentPhase
if self.currentMfname in self.requiredInstallFiles:
self.requiredInstallFiles.remove(self.currentMfname)
else:
self.notify.warning('avoiding crash ValueError: list.remove(x): x not in list')
curVer, expectedSize, expectedMd5 = self.mfDetails[self.currentMfname]
self.curPhaseFile = Filename(self.topDir, Filename(self.currentMfname))
self.notify.info('working on: %s' % self.curPhaseFile)
if self.curPhaseFile.exists():
self.notify.info('file exists')
fileSize = self.curPhaseFile.getFileSize()
clientMd5 = HashVal()
clientMd5.hashFile(self.curPhaseFile)
self.notify.info('clientMd5: %s expectedMd5: %s' % (clientMd5, expectedMd5))
self.notify.info('clientSize: %s expectedSize: %s' % (fileSize, expectedSize))
if fileSize == expectedSize and clientMd5.asHex() == expectedMd5:
self.notify.info('file is up to date')
self.finalizePhase()
continue
else:
self.notify.info('file is not valid')
self.resumeMultifileDownload()
return
else:
self.notify.info('file does not exist - start download')
self.resumeMultifileDownload()
return
if not self.requiredInstallFiles:
self.notify.info('ALL PHASES COMPLETE')
messenger.send('launcherAllPhasesComplete')
self.cleanup()
return
raise StandardError, 'Some phases not listed in LauncherPhases: %s' % self.requiredInstallFiles
def getDecompressMultifile(self, mfname):
if not self.DecompressMultifiles:
self.decompressMultifileDone()
elif 1:
self.notify.info('decompressMultifile: Decompressing multifile: ' + mfname)
curVer, expectedSize, expectedMd5 = self.mfDetails[self.currentMfname]
localFilename = Filename(self.topDir, Filename('_%s.%s.%s' % (mfname, curVer, self.CompressionExt)))
self.decompressMultifile(mfname, localFilename, self.decompressMultifileDone)
else:
self.notify.info('decompressMultifile: Multifile already decompressed: %s' % mfname)
self.decompressMultifileDone()
def decompressMultifile(self, mfname, localFilename, callback):
self.notify.info('decompressMultifile: request: ' + localFilename.cStr())
self.launcherMessage(self.Localizer.LauncherDecompressingFile % {'name': self.currentPhaseName,
'current': self.currentPhaseIndex,
'total': self.numPhases})
task = Task(self.decompressMultifileTask)
task.mfname = mfname
task.mfFilename = Filename(self.topDir, Filename('_' + task.mfname))
task.mfFile = open(task.mfFilename.toOsSpecific(), 'wb')
task.localFilename = localFilename
task.callback = callback
task.lastUpdate = 0
task.decompressor = bz2.BZ2File(localFilename.toOsSpecific(), 'rb')
taskMgr.add(task, 'launcher-decompressMultifile')
def decompressMultifileTask(self, task):
data = task.decompressor.read(8192)
if data:
task.mfFile.write(data)
now = self.getTime()
if now - task.lastUpdate >= self.UserUpdateDelay:
task.lastUpdate = now
curSize = task.mfFilename.getFileSize()
curVer, expectedSize, expectedMd5 = self.mfDetails[self.currentMfname]
progress = curSize / float(expectedSize)
self.launcherMessage(self.Localizer.LauncherDecompressingPercent % {'name': self.currentPhaseName,
'current': self.currentPhaseIndex,
'total': self.numPhases,
'percent': int(round(progress * 100))})
percentProgress = int(round(progress * self.decompressPercentage))
totalPercent = self.downloadPercentage + percentProgress
self.setPercentPhaseComplete(self.currentPhase, totalPercent)
self.foregroundSleep()
return Task.cont
else:
task.mfFile.close()
task.decompressor.close()
unlinked = task.localFilename.unlink()
if not unlinked:
self.notify.warning('unlink failed on file: %s' % task.localFilename.cStr())
realMf = Filename(self.topDir, Filename(self.currentMfname))
renamed = task.mfFilename.renameTo(realMf)
if not renamed:
self.notify.warning('rename failed on file: %s' % task.mfFilename.cStr())
self.launcherMessage(self.Localizer.LauncherDecompressingPercent % {'name': self.currentPhaseName,
'current': self.currentPhaseIndex,
'total': self.numPhases,
'percent': 100})
totalPercent = self.downloadPercentage + self.decompressPercentage
self.setPercentPhaseComplete(self.currentPhase, totalPercent)
self.notify.info('decompressMultifileTask: Decompress multifile done: ' + task.localFilename.cStr())
if self.dldb:
self.dldb.setClientMultifileDecompressed(task.mfname)
del task.decompressor
task.callback()
del task.callback
return Task.done
def decompressMultifileDone(self):
self.finalizePhase()
self.notify.info('Done updating multifiles in phase: ' + `(self.currentPhase)`)
self.progressSoFar += int(round(self.phaseOverallMap[self.currentPhase] * 100))
self.notify.info('progress so far ' + `(self.progressSoFar)`)
messenger.send('phaseComplete-' + `(self.currentPhase)`)
self.resumeInstall()
def finalizePhase(self):
mfFilename = Filename(self.topDir, Filename(self.currentMfname))
self.MakeNTFSFilesGlobalWriteable(mfFilename)
vfs = VirtualFileSystem.getGlobalPtr()
vfs.mount(mfFilename, '.', VirtualFileSystem.MFReadOnly)
self.setPercentPhaseComplete(self.currentPhase, 100)
def getValue(self, key, default = None):
return os.environ.get(key, default)
def setValue(self, key, value):
os.environ[key] = str(value)
def getVerifyFiles(self):
return config.GetInt('launcher-verify', 0)
def getTestServerFlag(self):
return self.getValue('IS_TEST_SERVER', 0)
def getGameServer(self):
return self.getValue('GAME_SERVER', '')
def getLogFileName(self):
return 'toontown'
def parseWebAcctParams(self):
s = config.GetString('fake-web-acct-params', '')
if not s:
s = self.getRegistry(self.webAcctParams)
self.notify.info('webAcctParams = %s' % s)
self.setRegistry(self.webAcctParams, '')
l = s.split('&')
length = len(l)
dict = {}
for index in xrange(0, len(l)):
args = l[index].split('=')
if len(args) == 3:
name, value = args[-2:]
dict[name] = int(value)
elif len(args) == 2:
name, value = args
dict[name] = int(value)
if 'secretsNeedsParentPassword' in dict and 1:
self.secretNeedsParentPasswordKey = dict['secretsNeedsParentPassword']
self.notify.info('secretNeedsParentPassword = %d' % self.secretNeedsParentPasswordKey)
else:
self.notify.warning('no secretNeedsParentPassword token in webAcctParams')
if 'chatEligible' in dict:
self.chatEligibleKey = dict['chatEligible']
self.notify.info('chatEligibleKey = %d' % self.chatEligibleKey)
else:
self.notify.warning('no chatEligible token in webAcctParams')
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('self.VISTA = %s' % self.VISTA)
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 getCDDownloadPath(self, origPath, serverFilePath):
return '%s/%s/CD_%d/%s' % (origPath,
self.ServerVersion,
self.fromCD,
serverFilePath)
def getDownloadPath(self, origPath, serverFilePath):
return '%s/%s' % (origPath, serverFilePath)
def hashIsValid(self, serverHash, hashStr):
return serverHash.setFromDec(hashStr)
def getAccountServer(self):
return self.getValue('ACCOUNT_SERVER', '')
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 canLeaveFirstIsland(self):
return self.getPhaseComplete(4)
def startGame(self):
self.newTaskManager()
eventMgr.restart()
from toontown.toonbase import ToontownStart

View file

@ -1,6 +0,0 @@
import sys
sys.path = ['']
import Phase2
from toontown.launcher.QuickLauncher import QuickLauncher
launcher = QuickLauncher()
launcher.notify.info('Reached end of StartQuickLauncher.py.')

View file

@ -8,7 +8,6 @@ from direct.gui.DirectGui import *
from toontown.toonbase import TTLocalizer
from direct.directnotify import DirectNotifyGlobal
from toontown.toontowngui import TeaserPanel
#from toontown.toonbase import UserFunnel
NAME_ROTATIONS = (7, -11, 1, -5, 3.5, -5)
NAME_POSITIONS = ((0, 0, 0.26),
(-0.03, 0, 0.25),
@ -177,8 +176,6 @@ class AvatarChoice(DirectButton):
def __handleChoice(self):
cleanupDialog('globalDialog')
messenger.send(self.doneEvent, ['chose', self.position])
#UserFunnel.loggingAvID('write', str(self.avForLogging))
#UserFunnel.logSubmit(0, 'AvatarChoice')
def __handleCreate(self):
cleanupDialog('globalDialog')

View file

@ -1,708 +0,0 @@
import os, sys, socket, random
#from urllib import quote_plus
from pandac.PandaModules import HTTPClient
from pandac.PandaModules import HTTPCookie
from pandac.PandaModules import URLSpec
from pandac.PandaModules import Ramfile
from pandac.PandaModules import Ostream
from pandac.PandaModules import HTTPDate
from pandac.PandaModules import DocumentSpec
from direct.task.Task import Task
from direct.directnotify.DirectNotifyGlobal import directNotify
notify = directNotify.newCategory('UserFunnel')
class UserFunnel:
def __init__(self):
self.hitboxAcct = 'DM53030620EW'
self.language = 'en-us'
self.cgRoot = 'ToonTown_Online'
self.cgBeta = 'Beta'
self.cgRelease = 'Release'
self.cgLocation = 'US'
self.campaignID = ''
self.cfCookieFile = 'cf.txt'
self.dynamicVRFunnel = 'http://download.toontown.com/'
self.hostDict = {0: 'Internal Disney PHP Collector Site',
1: 'ehg-dig.hitbox.com/HG?',
2: 'ehg-dig.hitbox.com/HG?',
3: 'build64.online.disney.com:5020/index.php?'}
self.CurrentHost = ''
self.URLtoSend = ''
self.gameName = 'ToonTown'
self.browserName = 'Panda3D%20(' + self.gameName + ';%20' + sys.platform + ')'
self.HTTPUserHeader = [('User-agent', 'Panda3D')]
self.osMajorver = ''
self.osMinorver = ''
self.osRevver = ''
self.osBuild = ''
self.osType = ''
self.osComments = ''
self.msWinTypeDict = {0: 'Win32s on Windows 3.1',
1: 'Windows 95/98/ME',
2: 'Windows NT/2000/XP',
3: 'Windows CE'}
self.milestoneDict = {0: 'New User',
1: 'Create Account',
2: 'View EULA',
3: 'Accept EULA',
4: 'Download Start',
5: 'Download End',
6: 'Installer Run',
7: 'Launcher Start',
8: 'Launcher Login',
9: 'Client Opens',
10: 'Create Pirate Loads',
11: 'Create Pirate Exit',
12: 'Cutscene One Start',
13: 'Cutscene One Ends',
14: 'Cutscene Two Start',
15: 'Cutscene Thee Start',
16: 'Cutscene Three Ends',
17: 'Access Cannon',
18: 'Cutscene Four Starts',
19: 'Cutscene Four Ends',
20: 'Dock - Start Game'}
self.macTypeDict = {2: 'Jaguar',
1: 'Puma',
3: 'Panther',
4: 'Tiger',
5: 'Lepard'}
self.milestone = ''
self.pandaHTTPClientVarWSS = []
self.pandaHTTPClientVarCTG = []
self.pandaHTTPClientVarDM = []
self.checkForCFfile()
self.httpSession = HTTPClient()
self.whatOSver()
def checkForCFfile(self):
if firstRun() == True:
pass
elif os.path.isfile(self.cfCookieFile) == False:
firstRun('write', True)
def whatOSver(self):
if sys.platform == 'win32':
self.osMajorver = str(sys.getwindowsversion()[0])
self.osMinorver = str(sys.getwindowsversion()[1])
self.osBuild = str(sys.getwindowsversion()[2])
self.osType = str(sys.getwindowsversion()[3])
self.osComments = str(sys.getwindowsversion()[4])
return
if sys.platform == 'darwin':
self.osMajorver = '10'
osxcmd = '/usr/sbin/system_profiler SPSoftwareDataType |/usr/bin/grep "System Version"'
infopipe = os.popen(osxcmd, 'r')
parseLine = infopipe.read()
infopipe.close()
del infopipe
notify.info('parseLine = %s' % str(parseLine))
versionStringStart = parseLine.find('10.')
notify.info('versionStringStart = %s' % str(versionStringStart))
testPlist = False
try:
self.osMinorver = parseLine[versionStringStart + 3]
self.osRevver = parseLine[versionStringStart + 5:versionStringStart + 7].strip(' ')
self.osBuild = parseLine[int(parseLine.find('(')) + 1:parseLine.find(')')]
except:
notify.info("couldn't parse the system_profiler output, using zeros")
self.osMinorver = '0'
self.osRevver = '0'
self.osBuild = '0000'
testPlist = True
del versionStringStart
del parseLine
del osxcmd
if testPlist:
try:
import plistlib
pl = plistlib.readPlist('/System/Library/CoreServices/SystemVersion.plist')
notify.info('pl=%s' % str(pl))
parseLine = pl['ProductVersion']
numbers = parseLine.split('.')
notify.info('parseline =%s numbers =%s' % (parseLine, numbers))
self.osMinorver = numbers[1]
self.osRevver = numbers[2]
self.osBuild = pl['ProductBuildVersion']
except:
notify.info('tried plist but still got exception')
self.osMinorver = '0'
self.osRevver = '0'
self.osBuild = '0000'
return
def setmilestone(self, ms):
if firstRun() == False:
self.milestone = ms
else:
self.milestone = '%s_INITIAL' % ms
def setgamename(self, gamename):
self.gameName = gamename
def printosComments(self):
return self.osComments
def setHost(self, hostID):
self.CurrentHost = hostID
def getFunnelURL(self):
if patcherVer() == ['OFFLINE']:
return
if patcherVer() == []:
patcherHTTP = HTTPClient()
if checkParamFile() == None:
patcherDoc = patcherHTTP.getDocument(URLSpec('http://download.toontown.com/english/currentVersion/content/patcher.ver'))
vconGroup('w', self.cgRelease)
else:
patcherDoc = patcherHTTP.getDocument(URLSpec(checkParamFile()))
vconGroup('w', self.cgBeta)
rf = Ramfile()
patcherDoc.downloadToRam(rf)
self.patcherURL = rf.getData()
if self.patcherURL.find('FUNNEL_LOG') == -1:
patcherVer('w', 'OFFLINE')
return
self.patcherURL = self.patcherURL.split('\n')
del rf
del patcherDoc
del patcherHTTP
while self.patcherURL:
self.confLine = self.patcherURL.pop()
if self.confLine.find('FUNNEL_LOG=') != -1 and self.confLine.find('#FUNNEL_LOG=') == -1:
self.dynamicVRFunnel = self.confLine[11:].strip('\n')
patcherVer('w', self.confLine[11:].strip('\n'))
else:
self.dynamicVRFunnel = patcherVer()[0]
return
def isVarSet(self, varInQuestion):
try:
tempvar = type(varInQuestion)
return 1
except NameError:
return 0
def buildURL(self):
if sys.platform == 'win32':
hitboxOSType = 'c3'
else:
hitboxOSType = 'c4'
if self.CurrentHost == 1:
self.URLtoSend = 'http://' + self.hostDict[self.CurrentHost] + 'hb=' + str(self.hitboxAcct) + '&n=' + str(self.milestone) + '&ln=' + self.language + '&gp=STARTGAME&fnl=TOONTOWN_FUNNEL&vcon=/' + self.cgRoot + '/' + self.cgLocation + '/' + str(vconGroup()) + '&c1=' + str(sys.platform) + '&' + str(hitboxOSType) + '=' + str(self.osMajorver) + '_' + str(self.osMinorver) + '_' + str(self.osRevver) + '_' + str(self.osBuild)
if self.CurrentHost == 2:
self.URLtoSend = 'http://' + self.hostDict[self.CurrentHost] + 'hb=' + str(self.hitboxAcct) + '&n=' + str(self.milestone) + '&ln=' + self.language + '&vcon=/' + self.cgRoot + '/' + self.cgLocation + '/' + str(vconGroup()) + '&c1=' + str(sys.platform) + '&' + str(hitboxOSType) + '=' + str(self.osMajorver) + '_' + str(self.osMinorver) + '_' + str(self.osRevver) + '_' + str(self.osBuild)
if self.CurrentHost == 0:
localMAC = str(getMAC())
self.URLtoSend = str(self.dynamicVRFunnel) + '?funnel=' + str(self.milestone) + '&platform=' + str(sys.platform) + '&sysver=' + str(self.osMajorver) + '_' + str(self.osMinorver) + '_' + str(self.osRevver) + '_' + str(self.osBuild) + '&mac=' + localMAC + '&username=' + str(loggingSubID()) + '&id=' + str(loggingAvID())
def readInPandaCookie(self):
thefile = open(self.cfCookieFile, 'r')
thedata = thefile.read().split('\n')
thefile.close()
del thefile
if thedata[0].find('Netscape HTTP Cookie File') != -1:
return
thedata.pop()
try:
while thedata:
temp = thedata.pop()
temp = temp.split('\t')
domain = temp[0]
loc = temp[1]
variable = temp[2]
value = temp[3]
if variable == 'CTG':
self.pandaHTTPClientVarCTG = [domain,
loc,
variable,
value]
self.setTheHTTPCookie(self.pandaHTTPClientVarCTG)
if variable == self.hitboxAcct + 'V6':
self.pandaHTTPClientVarDM = [domain,
loc,
variable,
value]
self.setTheHTTPCookie(self.pandaHTTPClientVarDM)
if variable == 'WSS_GW':
self.pandaHTTPClientVarWSS = [domain,
loc,
variable,
value]
self.setTheHTTPCookie(self.pandaHTTPClientVarWSS)
except IndexError:
print 'UserFunnel(Warning): Cookie Data file bad'
del thedata
def updateInstanceCookieValues(self):
a = self.httpSession.getCookie(HTTPCookie('WSS_GW', '/', '.hitbox.com'))
if a.getName():
self.pandaHTTPClientVarWSS = ['.hitbox.com',
'/',
'WSS_GW',
a.getValue()]
b = self.httpSession.getCookie(HTTPCookie('CTG', '/', '.hitbox.com'))
if b.getName():
self.pandaHTTPClientVarCTG = ['.hitbox.com',
'/',
'CTG',
b.getValue()]
c = self.httpSession.getCookie(HTTPCookie(self.hitboxAcct + 'V6', '/', 'ehg-dig.hitbox.com'))
if c.getName():
self.pandaHTTPClientVarDM = ['ehg-dig.hitbox.com',
'/',
self.hitboxAcct + 'V6',
c.getValue()]
del a
del b
del c
def setTheHTTPCookie(self, cookieParams):
c = HTTPCookie(cookieParams[2], cookieParams[1], cookieParams[0])
c.setValue(cookieParams[3])
self.httpSession.setCookie(c)
def writeOutPandaCookie(self):
try:
thefile = open(self.cfCookieFile, 'w')
if len(self.pandaHTTPClientVarWSS) == 4:
thefile.write(self.pandaHTTPClientVarWSS[0] + '\t' + self.pandaHTTPClientVarWSS[1] + '\t' + self.pandaHTTPClientVarWSS[2] + '\t' + self.pandaHTTPClientVarWSS[3] + '\n')
if len(self.pandaHTTPClientVarCTG) == 4:
thefile.write(self.pandaHTTPClientVarCTG[0] + '\t' + self.pandaHTTPClientVarCTG[1] + '\t' + self.pandaHTTPClientVarCTG[2] + '\t' + self.pandaHTTPClientVarCTG[3] + '\n')
if len(self.pandaHTTPClientVarDM) == 4:
thefile.write(self.pandaHTTPClientVarDM[0] + '\t' + self.pandaHTTPClientVarDM[1] + '\t' + self.pandaHTTPClientVarDM[2] + '\t' + self.pandaHTTPClientVarDM[3] + '\n')
thefile.close()
except IOError:
return
def prerun(self):
self.getFunnelURL()
self.buildURL()
if os.path.isfile(self.cfCookieFile) == True:
if self.CurrentHost == 1 or self.CurrentHost == 2:
self.readInPandaCookie()
def run(self):
if self.CurrentHost == 0 and patcherVer() == ['OFFLINE']:
return
self.nonBlock = self.httpSession.makeChannel(False)
self.nonBlock.beginGetDocument(DocumentSpec(self.URLtoSend))
instanceMarker = str(random.randint(1, 1000))
instanceMarker = 'FunnelLoggingRequest-%s' % instanceMarker
self.startCheckingAsyncRequest(instanceMarker)
def startCheckingAsyncRequest(self, name):
taskMgr.remove(name)
taskMgr.doMethodLater(0.5, self.pollFunnelTask, name)
def stopCheckingFunnelTask(self, name):
taskMgr.remove('pollFunnelTask')
def pollFunnelTask(self, task):
result = self.nonBlock.run()
if result == 0:
self.stopCheckingFunnelTask(task)
if self.CurrentHost == 1 or self.CurrentHost == 2:
self.updateInstanceCookieValues()
self.writeOutPandaCookie()
else:
return Task.again
def logSubmit(setHostID, setMileStone):
if __dev__:
return
trackItem = UserFunnel()
trackItem.setmilestone(setMileStone)
trackItem.setHost(setHostID)
trackItem.prerun()
trackItem.run()
def getVRSFunnelURL():
a = UserFunnel()
a.getFunnelURL()
class HitBoxCookie:
def __init__(self):
self.ieCookieDir = os.getenv('USERPROFILE') + '\\Cookies'
self.pythonCookieFile = 'cf.txt'
self.hitboxCookieFile = None
self.ehgdigCookieFile = None
self.hitboxAcct = 'DM53030620EW'
self.ctg = None
self.wss_gw = None
self.dmAcct = None
self.pythonCookieHeader = ' # Netscape HTTP Cookie File\n # http://www.netscape.com/newsref/std/cookie_spec.html\n # This is a generated file! Do not edit.\n\n'
return
def returnIECookieDir(self):
return self.ieCookieDir
def findIECookieFiles(self):
try:
sdir = os.listdir(self.ieCookieDir)
except WindowsError:
print 'Dir does not exist, do nothing'
return
while sdir:
temp = sdir.pop()
if temp.find('@hitbox[') != -1:
self.hitboxCookieFile = temp
if temp.find('@ehg-dig.hitbox[') != -1:
self.ehgdigCookieFile = temp
if self.hitboxCookieFile != None and self.ehgdigCookieFile != None:
return 1
if self.hitboxCookieFile == None and self.ehgdigCookieFile == None:
return 0
else:
return -1
return
def openHitboxFile(self, filename, type = 'python'):
if type == 'ie':
fullfile = self.ieCookieDir + '\\' + filename
else:
fullfile = filename
cf = open(fullfile, 'r')
data = cf.read()
cf.close()
return data
def splitIECookie(self, filestream):
return filestream.split('*\n')
def sortIECookie(self, filestreamListElement):
return [filestreamListElement.split('\n')[2], filestreamListElement.split('\n')[0], filestreamListElement.split('\n')[1]]
def sortPythonCookie(self, filestreamListElement):
return [filestreamListElement.split('\t')[0], filestreamListElement.split('\t')[5], filestreamListElement.split('\t')[6]]
def writeIEHitBoxCookies(self):
if self.ctg == None or self.wss_gw == None or self.dmAcct == None:
return
if sys.platform != 'win32':
return
self.findIECookieFiles()
iecData = self.openHitboxFile(self.ehgdigCookieFile, 'ie')
iecData = iecData.split('*\n')
x = 0
while x < len(iecData):
if iecData[x].find(self.hitboxAcct) != -1:
iecData.pop(x)
print 'Removed it from the list'
break
x += 1
iecWrite = open(self.ieCookieDir + '\\' + self.ehgdigCookieFile, 'w')
while iecData:
iecBuffer = iecData.pop() + '*\n'
iecBuffer = iecBuffer.strip('/')
if iecBuffer[0] == '.':
iecBuffer = iecBuffer[1:]
iecWrite.write(iecBuffer)
tempDMBUFFER = self.dmAcct[0]
if tempDMBUFFER[0].find('.') == 0:
tempDMBUFFER = tempDMBUFFER[1:]
iecWrite.write(self.dmAcct[1] + '\n' + self.dmAcct[2] + '\n' + tempDMBUFFER + '/\n*\n')
iecWrite.close()
del iecData
del iecWrite
del iecBuffer
iecWrite = open(self.ieCookieDir + '\\' + self.hitboxCookieFile, 'w')
iecBuffer = self.ctg[0]
if iecBuffer[0] == '.':
iecBuffer = iecBuffer[1:]
if iecBuffer.find('/') == -1:
iecBuffer = iecBuffer + '/'
iecWrite.write(self.ctg[1] + '\n' + self.ctg[2] + '\n' + iecBuffer + '\n*\n')
iecWrite.write(self.wss_gw[1] + '\n' + self.wss_gw[2] + '\n' + iecBuffer + '\n*\n')
iecWrite.close()
return
def OLDwritePythonHitBoxCookies(self, filename = 'cf.txt'):
if self.ctg == None or self.wss_gw == None or self.dmAcct == None:
return
outputfile = open(filename, 'w')
outputfile.write(self.pythonCookieHeader)
outputfile.write('.' + self.dmAcct[0].strip('/') + '\tTRUE\t/\tFALSE\t9999999999\t' + self.dmAcct[1] + '\t' + self.dmAcct[2] + '\n')
outputfile.write('.' + self.ctg[0].strip('/') + '\tTRUE\t/\tFALSE\t9999999999\t' + self.ctg[1] + '\t' + self.ctg[2] + '\n')
outputfile.write('.' + self.wss_gw[0].strip('/') + '\tTRUE\t/\tFALSE\t9999999999\t' + self.wss_gw[1] + '\t' + self.wss_gw[2] + '\n')
outputfile.close()
return
def writePythonHitBoxCookies(self, filename = 'cf.txt'):
if self.ctg == None or self.wss_gw == None or self.dmAcct == None:
return
outputfile = open(filename, 'w')
outputfile.write('.' + self.dmAcct[0].strip('/') + '\t/\t' + self.dmAcct[1] + '\t' + self.dmAcct[2] + '\n')
outputfile.write('.' + self.ctg[0].strip('/') + '\t/\t' + self.ctg[1] + '\t' + self.ctg[2] + '\n')
outputfile.write('.' + self.wss_gw[0].strip('/') + '\t/\t' + self.wss_gw[1] + '\t' + self.wss_gw[2] + '\n')
outputfile.close()
return
def loadPythonHitBoxCookies(self):
if os.path.isfile(self.pythonCookieFile) != 1:
return
pythonStandard = self.openHitboxFile(self.pythonCookieFile, 'python')
pythonStandard = pythonStandard.split('\n\n').pop(1)
pythonStandard = pythonStandard.split('\n')
for x in pythonStandard:
if x.find('\t' + self.hitboxAcct) != -1:
self.dmAcct = self.sortPythonCookie(x)
if x.find('\tCTG\t') != -1:
self.ctg = self.sortPythonCookie(x)
if x.find('\tWSS_GW\t') != -1:
self.wss_gw = self.sortPythonCookie(x)
def loadIEHitBoxCookies(self):
if self.findIECookieFiles() != 1:
return
if sys.platform != 'win32':
return
hitboxStandard = self.openHitboxFile(self.hitboxCookieFile, 'ie')
hitboxDIG = self.openHitboxFile(self.ehgdigCookieFile, 'ie')
hitboxStandard = self.splitIECookie(hitboxStandard)
hitboxDIG = self.splitIECookie(hitboxDIG)
ctg = None
wss = None
for x in hitboxStandard:
if x.find('CTG\n') != -1:
ctg = x
if x.find('WSS_GW\n') != -1:
wss = x
if ctg == None or wss == None:
return
DM = None
for x in hitboxDIG:
if x.find(self.hitboxAcct) != -1:
DM = x
if DM == None:
return
self.ctg = self.sortIECookie(ctg)
self.wss_gw = self.sortIECookie(wss)
self.dm560804E8WD = self.sortIECookie(DM)
return
def convertHitBoxIEtoPython():
if sys.platform != 'win32':
print 'Cookie Converter: Warning: System is not MS-Windows. I have not been setup to work with other systems yet. Sorry ' + sys.platform + ' user. The game client will create a cookie.'
return
if __dev__:
return
a = HitBoxCookie()
a.loadIEHitBoxCookies()
a.writePythonHitBoxCookies()
del a
def convertHitBoxPythontoIE():
if sys.platform != 'win32':
print 'System is not MS-Windows. I have not been setup to work with other systems yet. Sorry ' + sys.platform + ' user.'
return
if os.path.isfile('cf.txt') == True:
return
a = HitBoxCookie()
a.loadPythonHitBoxCookies()
a.writeIEHitBoxCookies()
del a
def getreg(regVar):
if sys.platform != 'win32':
print "System is not MS-Windows. I haven't been setup yet to work with systems other than MS-Win using MS-Internet Explorer Cookies"
return ''
siteName = 'toontown.online.disney'
cookiedir = os.getenv('USERPROFILE') + '\\Cookies'
sdir = os.listdir(cookiedir)
wholeCookie = None
while sdir:
temp = sdir.pop()
if temp.find(siteName) != -1:
wholeCookie = temp
break
if wholeCookie == None:
print 'Cookie not found for site name: ' + siteName
return ''
CompleteCookiePath = cookiedir + '\\' + wholeCookie
cf = open(CompleteCookiePath, 'r')
data = cf.read()
cf.close()
del cf
data = data.replace('%3D', '=')
data = data.replace('%26', '&')
regNameStart = data.find(regVar)
if regNameStart == -1:
return ''
regVarStart = data.find('=', regNameStart + 1)
regVarEnd = data.find('&', regNameStart + 1)
return data[regVarStart + 1:regVarEnd]
def getMAC(staticMAC = [None]):
if staticMAC[0] == None:
if sys.platform == 'win32':
correctSection = 0
try:
ipconfdata = os.popen('/WINDOWS/SYSTEM32/ipconfig /all').readlines()
except:
staticMAC[0] = 'NO_MAC'
return staticMAC[0]
for line in ipconfdata:
if line.find('Local Area Connection') >= 0:
correctSection = 1
if line.find('Physical Address') >= 0 and correctSection == 1:
pa = line.split(':')[-1].strip()
correctSection = 0
staticMAC[0] = pa
return pa
if sys.platform == 'darwin':
macconfdata = os.popen('/usr/sbin/system_profiler SPNetworkDataType |/usr/bin/grep MAC').readlines()
result = '-1'
if macconfdata:
if macconfdata[0].find('MAC Address') != -1:
pa = macconfdata[0][macconfdata[0].find(':') + 2:macconfdata[0].find(':') + 22].strip('\n')
staticMAC[0] = pa.replace(':', '-')
result = staticMAC[0]
return result
if sys.platform != 'darwin' and sys.platform != 'win32':
print 'System is not running OSX or MS-Windows.'
return '-2'
else:
return staticMAC[0]
return
def firstRun(operation = 'read', newPlayer = None, newPlayerBool = [False]):
if operation != 'read':
if len(newPlayerBool) != 0:
newPlayerBool.pop()
newPlayerBool.append(newPlayer)
return newPlayerBool[0]
def patcherVer(operation = 'read', url = None, patchfile = []):
return ['OFFLINE']
if operation != 'read':
if len(patchfile) != 0:
patchfile.pop()
patchfile.append(url)
return patchfile
def loggingAvID(operation = 'read', newId = None, localAvId = [None]):
if operation == 'write':
localAvId[0] = newId
else:
return localAvId[0]
def loggingSubID(operation = 'read', newId = None, localSubId = [None]):
if operation == 'write':
localSubId[0] = newId
else:
return localSubId[0]
def vconGroup(operation = 'read', group = None, staticStore = []):
if operation != 'read':
if len(staticStore) != 0:
staticStore.pop()
staticStore.append(group)
try:
return staticStore[0]
except IndexError:
return None
return None
def printUnreachableLen():
import gc
gc.set_debug(gc.DEBUG_SAVEALL)
gc.collect()
unreachableL = []
for it in gc.garbage:
unreachableL.append(it)
return len(str(unreachableL))
def printUnreachableNum():
import gc
gc.set_debug(gc.DEBUG_SAVEALL)
gc.collect()
return len(gc.garbage)
def reportMemoryLeaks():
if printUnreachableNum() == 0:
return
import bz2, gc
gc.set_debug(gc.DEBUG_SAVEALL)
gc.collect()
uncompressedReport = ''
for s in gc.garbage:
try:
uncompressedReport += str(s) + '&'
except TypeError:
pass
reportdata = bz2.compress(uncompressedReport, 9)
headers = {'Content-type': 'application/x-bzip2',
'Accept': 'text/plain'}
try:
baseURL = patcherVer()[0].split('/lo')[0]
except IndexError:
print 'Base URL not available for leak submit'
return
basePort = 80
if baseURL.count(':') == 2:
basePort = baseURL[-4:]
baseURL = baseURL[:-5]
baseURL = baseURL[7:]
if basePort != 80:
finalURL = 'http://' + baseURL + ':' + str(basePort) + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum())
else:
finalURL = 'http://' + baseURL + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum())
reporthttp = HTTPClient()
reporthttp.postForm(URLSpec(finalURL), reportdata)
def checkParamFile():
if os.path.exists('parameters.txt') == 1:
paramfile = open('parameters.txt', 'r')
contents = paramfile.read()
paramfile.close()
del paramfile
contents = contents.split('\n')
newURL = ''
while contents:
checkLine = contents.pop()
if checkLine.find('PATCHER_BASE_URL=') != -1 and checkLine[0] == 'P':
newURL = checkLine.split('=')[1]
newURL = newURL.replace(' ', '')
break
if newURL == '':
return
else:
return newURL + 'patcher.ver'