Beispiel #1
0
    def updateServerList(self):
        def _serverDottedHost(ip):
            return '%d.%d.%d.%d' % (ip >> 24 & 255, ip >> 16 & 255,
                                    ip >> 8 & 255, ip >> 0 & 255)

        def _serverNetName(details):
            name = _serverDottedHost(details.ip)
            if details.port:
                name += ':%d' % details.port
                return name

        def _serverNiceName(details):
            name = details.hostName
            if not name:
                name = _serverNetName(details)
            elif details.port:
                name += ':%d' % details.port
            if details.ownerName:
                name += ' (' + details.ownerName + ')'
            return name

        servers = [(_serverNiceName(server), server.serverString)
                   for server in BigWorld.serverDiscovery.servers]
        baseServerList = g_preDefinedHosts.shortList()
        for friendlyName, hostName in servers:
            if not g_preDefinedHosts.predefined(hostName):
                baseServerList.append(
                    (hostName, friendlyName,
                     g_preDefinedHosts.getDefaultCSISStatus(), None))

        self._setServerList(baseServerList)
        return
Beispiel #2
0
    def updateServerList(self):

        def _serverDottedHost(ip):
            return '%d.%d.%d.%d' % (ip >> 24 & 255,
             ip >> 16 & 255,
             ip >> 8 & 255,
             ip >> 0 & 255)

        def _serverNetName(details):
            name = _serverDottedHost(details.ip)
            if details.port:
                name += ':%d' % details.port
                return name

        def _serverNiceName(details):
            name = details.hostName
            if not name:
                name = _serverNetName(details)
            elif details.port:
                name += ':%d' % details.port
            if details.ownerName:
                name += ' (' + details.ownerName + ')'
            return name

        servers = [ (_serverNiceName(server), server.serverString) for server in BigWorld.serverDiscovery.servers ]
        baseServerList = g_preDefinedHosts.shortList()
        for friendlyName, hostName in servers:
            if not g_preDefinedHosts.predefined(hostName):
                baseServerList.append((hostName,
                 friendlyName,
                 g_preDefinedHosts.getDefaultCSISStatus(),
                 None))

        self._setServerList(baseServerList)
        return