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
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
class Heartbeat():
    
    def __init__(self):
        self.http = HTTPClient()
        
        self.SendHeartbeat()
        #taskMgr.doMethodLater(10, self.SendHeartbeat, 'SendHeartbeat')
        
    def SendHeartbeat(self, task = None):
        baseUrl = 'http://modifire.net/heartbeat.php?'
        values = {'name' : Settings.SERVER_NAME,
                  'currentPlayers' : Globals.CURRENT_PLAYERS,
                  'maxPlayers' : Globals.MAX_PLAYERS,
                  'public' : Settings.SERVER_PUBLIC,
                  'port' : Globals.PORT_SERVER_LISTENER,
                  'version' : Globals.VERSION}
        
        for key, value in values.iteritems():
            values[key] = urllib.quote(str(value))
        
        params = [
                  baseUrl,
                  'name=%s' % (values['name']),
                  'currentPlayers=%s' % (values['currentPlayers']),
                  'maxPlayers=%s' % (values['maxPlayers']),
                  'public=%s' % (values['public']),
                  'port=%s' % (values['port']),
                  'version=%s' % (values['version'])
                  ]
        
        req = '&'.join(params)
        self.channel = self.http.makeChannel(True)
        self.channel.beginGetDocument(DocumentSpec(req))
        self.rf = Ramfile()
        self.channel.downloadToRam(self.rf)
        taskMgr.add(self.downloadTask, 'download')
        
        if(task):
            return task.again
         
    def downloadTask(self, task):
        if self.channel.run():
            return task.cont
        if not self.channel.isDownloadComplete():
            return task.done
        data = self.rf.getData()
        return task.done
Ejemplo n.º 4
0
 def getFunnelURL(self):
     # print 'VRS URL: ' + self.dynamicVRFunnel
     if (patcherVer() == ['OFFLINE']):
         # print "Funnel System Offline"
         return
     if (patcherVer() == []):
         # print "Funnel URL not set. Setting now"
         patcherHTTP = HTTPClient()
         if checkParamFile() == None:
             patcherDoc = patcherHTTP.getDocument(
                 URLSpec(
                     'http://download.toontown.com/english/currentVersion/content/patcher.ver'
                 ))
             # Now set vcon (Content Group) to the Release string
             vconGroup('w', self.cgRelease)
         else:
             patcherDoc = patcherHTTP.getDocument(URLSpec(checkParamFile()))
             # Set vcon (Content Group) to the Beta string
             vconGroup('w', self.cgBeta)
         # patcherDoc = patcherHTTP.getDocument(URLSpec('http://build64:3120/english/currentVersion/dev/content/patcher.ver'))
         rf = Ramfile()
         patcherDoc.downloadToRam(rf)
         self.patcherURL = rf.getData()
         if self.patcherURL.find('FUNNEL_LOG') == -1:
             # The file did not download, need to set
             # the patcherVer to offline
             patcherVer('w', 'OFFLINE')
             # print 'Patcher system could not be reached'
             return
         self.patcherURL = self.patcherURL.split('\n')
         del rf, patcherDoc, 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]