Exemple #1
0
    def __init__(self, ctx):
        self.__cache = []
        self.__isEpic = ctx.get('isEpic', False)
        for arenaTypeID, arenaType in ArenaType.g_cache.iteritems():
            if arenaType.explicitRequestOnly or not gameplay_ctx.isCreationEnabled(arenaType.gameplayName, self.__isEpic):
                continue
            try:
                nameSuffix = ''
                if arenaType.gameplayName != 'ctf':
                    arenaGameplayName = '#arenas:type/%s/%s/name' % (arenaType.gameplayName, arenaType.geometryName)
                    if i18n.doesTextExist(arenaGameplayName):
                        nameSuffix = i18n.makeString(arenaGameplayName)
                    else:
                        nameSuffix = i18n.makeString('#arenas:type/%s/name' % arenaType.gameplayName)
                self.__cache.append({'label': '%s - %s' % (arenaType.name, nameSuffix) if nameSuffix else arenaType.name,
                 'name': arenaType.name,
                 'arenaType': nameSuffix,
                 'key': arenaTypeID,
                 'size': arenaType.maxPlayersInTeam,
                 'time': arenaType.roundLength / 60,
                 'description': '',
                 'icon': formatters.getMapIconPath(arenaType)})
            except Exception:
                LOG_ERROR('There is error while reading arenas cache', arenaTypeID, arenaType)
                LOG_CURRENT_EXCEPTION()
                continue

        self.__cache = sorted(self.__cache, key=lambda x: (x['label'].lower(), x['name'].lower()))
    def __init__(self):
        self.__cache = []
        for arenaTypeID, arenaType in ArenaType.g_cache.iteritems():
            if arenaType.explicitRequestOnly or not gameplay_ctx.isCreationEnabled(arenaType.gameplayName):
                continue
            try:
                nameSuffix = (
                    ""
                    if arenaType.gameplayName == "ctf"
                    else i18n.makeString("#arenas:type/%s/name" % arenaType.gameplayName)
                )
                self.__cache.append(
                    {
                        "label": "%s - %s" % (arenaType.name, nameSuffix) if len(nameSuffix) else arenaType.name,
                        "name": arenaType.name,
                        "arenaType": nameSuffix,
                        "key": arenaTypeID,
                        "size": arenaType.maxPlayersInTeam,
                        "time": arenaType.roundLength / 60,
                        "description": "",
                        "icon": formatters.getMapIconPath(arenaType),
                    }
                )
            except Exception:
                LOG_ERROR("There is error while reading arenas cache", arenaTypeID, arenaType)
                LOG_CURRENT_EXCEPTION()
                continue

        self.__cache = sorted(self.__cache, key=lambda x: (x["label"].lower(), x["name"].lower()))
    def __init__(self):
        self.__cache = []
        self.__playerTeam = 1
        for arenaTypeID, arenaType in ArenaType.g_cache.iteritems():
            if arenaType.explicitRequestOnly or not gameplay_ctx.isCreationEnabled(
                    arenaType.gameplayName, False):
                continue
            iconRes = R.images.gui.maps.icons.map.num(arenaType.geometryName)
            if iconRes.isValid():
                icon = backport.image(iconRes())
            else:
                _logger.warning(
                    'Resource id is not found for area geometry %s',
                    arenaType.geometryName)
                icon = ''
            self.__cache.append({
                'id': arenaTypeID,
                'name': arenaType.name,
                'gameplayName': arenaType.gameplayName,
                'icon': icon,
                'points': self.__getPointsList(arenaType),
                'enabled': False
            })

        self.__cache = sorted(self.__cache,
                              key=lambda x:
                              (x['gameplayName'].lower(), x['name'].lower()))
    def __init__(self):
        self.__cache = []
        for arenaTypeID, arenaType in ArenaType.g_cache.iteritems():
            if arenaType.explicitRequestOnly or not gameplay_ctx.isCreationEnabled(arenaType.gameplayName):
                continue
            try:
                nameSuffix = '' if arenaType.gameplayName == 'ctf' else i18n.makeString('#arenas:type/%s/name' % arenaType.gameplayName)
                self.__cache.append({'label': '%s - %s' % (arenaType.name, nameSuffix) if len(nameSuffix) else arenaType.name,
                 'name': arenaType.name,
                 'arenaType': nameSuffix,
                 'key': arenaTypeID,
                 'size': arenaType.maxPlayersInTeam,
                 'time': arenaType.roundLength / 60,
                 'description': '',
                 'icon': formatters.getMapIconPath(arenaType)})
            except Exception:
                LOG_ERROR('There is error while reading arenas cache', arenaTypeID, arenaType)
                LOG_CURRENT_EXCEPTION()
                continue

        self.__cache = sorted(self.__cache, key=lambda x: (x['label'].lower(), x['name'].lower()))