예제 #1
0
def PyOnDirectSelectWorld():
    global WORLDINFO
    TGEEval("Canvas.popDialog(DirectConnectWnd);")
    pname = TGEGetGlobal("$pref::PublicName")
    if pname == "ThePlayer": #this causes problems, conflict with Single Player ?
        TGESetGlobal("$pref::PublicName","")
        
    ip = TGEObject("DIRECTIP_IP").getValue()  

    #FIX ME!!!
    if "72.36." in ip:
        return
    if "72.232." in ip:
        return
    
    TGECall("MessagePopup","Contacting World...","Please wait...")

      
    port = TGEObject("DIRECTIP_PORT").getValue()    
    #if you just paste into a textctrl it's variable isn't being updated, unless you type into it... grrrr
    TGESetGlobal("$pref::DirectConnectIP",ip)
    TGESetGlobal("$pref::DirectConnectPort",port)
    
    try:
        port = int(port)
    except:
        port = 2006
        
    from mud.client.playermind import SimMind
    SimMind.directConnect = ip


    WORLDINFO = WorldInfo()
    WORLDINFO.worldName = "DirectConnection"
    WORLDINFO.worldIP = ip
    WORLDINFO.worldPort = port
    WORLDINFO.hasPlayerPassword = True
    
    
    TGESetGlobal("$Py::WORLDNAME","DirectConnection")

    password = ""
    from md5 import md5
    password = md5(password).digest()

    factory = pb.PBClientFactory()
    reactor.connectTCP(ip,port,factory)
    factory.login(UsernamePassword("NewPlayer-NewPlayer", password),pb.Root()).addCallbacks(NewPlayerConnected, Failure)
예제 #2
0
def PyOnDirectSelectWorld():
    global WORLDINFO
    TGEEval("Canvas.popDialog(DirectConnectWnd);")
    pname = TGEGetGlobal("$pref::PublicName")
    if pname == "ThePlayer":  #this causes problems, conflict with Single Player ?
        TGESetGlobal("$pref::PublicName", "")

    ip = TGEObject("DIRECTIP_IP").getValue()

    #FIX ME!!!
    if "72.36." in ip:
        return
    if "72.232." in ip:
        return

    TGECall("MessagePopup", "Contacting World...", "Please wait...")

    port = TGEObject("DIRECTIP_PORT").getValue()
    #if you just paste into a textctrl it's variable isn't being updated, unless you type into it... grrrr
    TGESetGlobal("$pref::DirectConnectIP", ip)
    TGESetGlobal("$pref::DirectConnectPort", port)

    try:
        port = int(port)
    except:
        port = 2006

    from mud.client.playermind import SimMind
    SimMind.directConnect = ip

    WORLDINFO = WorldInfo()
    WORLDINFO.worldName = "DirectConnection"
    WORLDINFO.worldIP = ip
    WORLDINFO.worldPort = port
    WORLDINFO.hasPlayerPassword = True

    TGESetGlobal("$Py::WORLDNAME", "DirectConnection")

    password = ""
    from md5 import md5
    password = md5(password).digest()

    factory = pb.PBClientFactory()
    reactor.connectTCP(ip, port, factory)
    factory.login(UsernamePassword("NewPlayer-NewPlayer", password),
                  pb.Root()).addCallbacks(NewPlayerConnected, Failure)
예제 #3
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
예제 #4
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
예제 #5
0
파일: main.py 프로젝트: MoMReborn/MoMServer
    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