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 = [] 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()))
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)
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)
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)
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)
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)
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()))