示例#1
0
    def perspective_enumLiveWorlds(self,
                                   launching=False,
                                   demo=False,
                                   wm=False,
                                   testing=False):
        """Enumerated verified, and active worlds"""

        winfos = []
        worlds = list(World.select())
        for w in worlds:
            #if not w.verified:
            #world is not verfied, not valid until verified
            #    continue

            #if bool(demo) != bool(w.demoWorld):
            #    continue

            if testing and not w.allowGuests:
                continue

            if not testing and w.allowGuests:
                continue

            if not launching:
                t = datetime.now() - w.announceTime

                if t.days or t.seconds / 60 > 2:
                    #no announce within 2 minutes, counts as not being up
                    continue

            else:
                if w.announceTime != datetime(1973, 1, 1):
                    t = datetime.now() - w.announceTime

                    if t.days or t.seconds / 60 > 2:
                        #no announce within 2 minutes, counts as not being up
                        continue

            wi = WorldInfo()
            wi.worldName = w.name
            wi.worldIP = w.announceIP
            wi.worldPort = w.announcePort
            if w.playerPassword:
                wi.hasPlayerPassword = True
            if w.zonePassword:
                wi.hasZonePassword = True

            wi.allowGuests = w.allowGuests
            p = ACTIVEPLAYERS.get(w.name)
            if p:
                wi.numLivePlayers = p[0]
                wi.maxPlayers = p[1]
            else:
                wi.numLivePlayers = 0
                wi.maxPlayers = 0

            wi.numLiveZones = 0

            winfos.append(wi)
        return winfos
示例#2
0
 def perspective_enumLiveWorlds(self, launching = False, demo = False, wm = False, testing = False):
     """Enumerated verified, and active worlds"""
     
     
     winfos = []
     worlds = list(World.select())
     for w in worlds:
         #if not w.verified:
             #world is not verfied, not valid until verified
         #    continue
         
         #if bool(demo) != bool(w.demoWorld):
         #    continue
         
         if testing and not w.allowGuests:
             continue
         
         if not testing and w.allowGuests:
             continue
         
         if not launching:
             t = datetime.now() - w.announceTime
             
             if t.days or t.seconds/60 > 2:
             #no announce within 2 minutes, counts as not being up
                 continue
                 
         else:
             if w.announceTime != datetime(1973, 1, 1):
                 t = datetime.now() - w.announceTime
                 
                 if t.days or t.seconds/60 > 2:
                 #no announce within 2 minutes, counts as not being up
                     continue
             
         wi = WorldInfo()
         wi.worldName = w.name
         wi.worldIP = w.announceIP
         wi.worldPort = w.announcePort
         if w.playerPassword:
             wi.hasPlayerPassword = True
         if w.zonePassword:
             wi.hasZonePassword = True
             
         wi.allowGuests = w.allowGuests
         p = ACTIVEPLAYERS.get(w.name)
         if p:
             wi.numLivePlayers = p[0]
             wi.maxPlayers = p[1]
         else:
             wi.numLivePlayers = 0
             wi.maxPlayers = 0
             
         wi.numLiveZones = 0
         
         winfos.append(wi)
     return winfos
示例#3
0
    def perspective_enumLiveWorlds(self,
                                   launching=False,
                                   demo=False,
                                   wm=False,
                                   testing=False):
        """Enumerated verified, and active worlds"""

        print "####Enumerating Live World"

        winfos = []
        worlds = list(World.select())
        for w in worlds:
            print "####Checking World: " + str(w.name)
            #if not w.verified:
            #world is not verfied, not valid until verified
            #    continue

            #if bool(demo) != bool(w.demoWorld):
            #    continue

            #if testing and w.allowGuests:
            #    print "####Skipped World: Testing and not allowGuests"
            #    continue

            if not testing and not w.allowGuests:
                print "####Skipped World: Not Testing and not allowGuests"
                continue

            if not launching:
                t = datetime.now() - w.announceTime

                if t.days or t.seconds / 60 > 2:
                    #no announce within 2 minutes, counts as not being up
                    print "####Skipped World: Not responding - duration since announcement:" + str(
                        datetime.now() - w.announceTime)
                    continue

            else:
                if w.announceTime != datetime(1973, 1, 1):
                    t = datetime.now() - w.announceTime

                    if t.days or t.seconds / 60 > 2:
                        #no announce within 2 minutes, counts as not being up
                        print "####Skipped World: Not up yet, Launching - last announceTime" + str(
                            w.announceTime)
                        continue

            wi = WorldInfo()
            wi.worldName = w.name
            wi.worldIP = w.announceIP
            wi.worldPort = w.announcePort
            if w.playerPassword:
                wi.hasPlayerPassword = True
            if w.zonePassword:
                wi.hasZonePassword = True

            wi.allowGuests = w.allowGuests
            p = ACTIVEPLAYERS.get(w.name)
            if p:
                wi.numLivePlayers = p[0]
                wi.maxPlayers = p[1]
            else:
                wi.numLivePlayers = 0
                wi.maxPlayers = 0

            wi.numLiveZones = 0

            print "####Adding World: " + str(w.name)
            winfos.append(wi)
        print "####Num. Live Worlds: " + str(len(winfos))
        return winfos