コード例 #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()))
コード例 #2
0
    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()))
コード例 #3
0
 def __init__(self):
     self.cache = []
     for arenaTypeID, arenaType in ArenaType.g_cache.iteritems():
         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()))
コード例 #4
0
ファイル: trainings.py プロジェクト: jamesxia4/wot_client
    def onPrbListReceived(self, prebattles):
        listData = []
        playersTotal = 0
        for item in prebattles:
            arena = ArenaType.g_cache[item.arenaTypeID]
            playersTotal += item.playersCount
            listData.append({
                'id':
                item.prbID,
                'comment':
                item.getCensoredComment(),
                'arena':
                getArenaFullName(item.arenaTypeID),
                'count':
                item.playersCount,
                'total':
                arena.maxPlayersInTeam,
                'owner':
                item.getCreatorFullName(),
                'creatorName':
                item.creator,
                'creatorClan':
                item.clanAbbrev,
                'creatorIgrType':
                item.creatorIgrType,
                'creatorRegion':
                g_lobbyContext.getRegionCode(item.creatorDbId),
                'icon':
                formatters.getMapIconPath(arena, prefix='small/'),
                'disabled':
                not item.isOpened
            })

        self.sendData(listData, playersTotal)
コード例 #5
0
ファイル: trainings.py プロジェクト: v3ss0n/WOTDecompiled
    def __onTrainingsListReceived(self, prebattles):
        result = []
        totalPlayersCount = 0
        for item in prebattles:
            arena = ArenaType.g_cache[item.arenaTypeID]
            totalPlayersCount += item.playersCount
            result.append({
                'id':
                item.prbID,
                'comment':
                item.getCensoredComment(),
                'arena':
                getArenaFullName(item.arenaTypeID),
                'count':
                item.playersCount,
                'total':
                arena.maxPlayersInTeam,
                'owner':
                item.getCreatorFullName(),
                'icon':
                formatters.getMapIconPath(arena, prefix='small/'),
                'disabled':
                not item.isOpened
            })

        self.as_setListS(result, totalPlayersCount)
コード例 #6
0
ファイル: trainings.py プロジェクト: 19colt87/WOTDecompiled
    def __onTrainingsListReceived(self, prebattles):
        result = []
        totalPlayersCount = 0
        for item in prebattles:
            arena = ArenaType.g_cache[item.arenaTypeID]
            totalPlayersCount += item.playersCount
            result.append({'id': item.prbID,
             'comment': item.getCensoredComment(),
             'arena': getArenaFullName(item.arenaTypeID),
             'count': item.playersCount,
             'total': arena.maxPlayersInTeam,
             'owner': item.getCreatorFullName(),
             'icon': formatters.getMapIconPath(arena, prefix='small/'),
             'disabled': not item.isOpened})

        self.as_setListS(result, totalPlayersCount)
コード例 #7
0
    def onLegacyListReceived(self, prebattles):
        if Waiting.isOpened('Flash'):
            Waiting.hide('Flash')
        listData = []
        playersTotal = 0
        addObservers = self.prbEntity.getEntityType() in OBSERVERS_BONUS_TYPES
        for item in prebattles:
            arena = ArenaType.g_cache[item.arenaTypeID]
            playersTotal += item.playersCount
            maxPlayersInTeam = arena.maxPlayersInTeam
            if addObservers:
                maxPlayersInTeam += PREBATTLE_MAX_OBSERVERS_IN_TEAM
            badge = item.getBadge()
            badgeVO = badge.getBadgeVO(
                ICONS_SIZES.X24, {'isAtlasSource': False}) if badge else {}
            listData.append({
                'id':
                item.prbID,
                'comment':
                item.getCensoredComment(),
                'arena':
                getArenaFullName(item.arenaTypeID),
                'count':
                item.playersCount,
                'total':
                maxPlayersInTeam,
                'owner':
                item.getCreatorFullName(),
                'creatorName':
                item.creator,
                'creatorClan':
                item.clanAbbrev,
                'creatorIgrType':
                item.creatorIgrType,
                'creatorRegion':
                self._lobbyContext.getRegionCode(item.creatorDbId),
                'icon':
                formatters.getMapIconPath(arena, prefix='small/'),
                'disabled':
                not item.isOpened,
                'badgeVisualVO':
                badgeVO
            })

        self.sendData(listData, playersTotal)
コード例 #8
0
ファイル: trainings.py プロジェクト: webiumsk/WOT-0.9.12
    def onPrbListReceived(self, prebattles):
        listData = []
        playersTotal = 0
        for item in prebattles:
            arena = ArenaType.g_cache[item.arenaTypeID]
            playersTotal += item.playersCount
            listData.append({'id': item.prbID,
             'comment': item.getCensoredComment(),
             'arena': getArenaFullName(item.arenaTypeID),
             'count': item.playersCount,
             'total': arena.maxPlayersInTeam,
             'owner': item.getCreatorFullName(),
             'creatorName': item.creator,
             'creatorClan': item.clanAbbrev,
             'creatorIgrType': item.creatorIgrType,
             'creatorRegion': g_lobbyContext.getRegionCode(item.creatorDbId),
             'icon': formatters.getMapIconPath(arena, prefix='small/'),
             'disabled': not item.isOpened})

        self.sendData(listData, playersTotal)
コード例 #9
0
    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()))