def _packMergedBonuses(self, mergedBonuses, size=AWARDS_SIZES.SMALL):
        blueprints = True
        for bonus in mergedBonuses:
            if bonus.postProcessTags != 'blueprints':
                blueprints = False

        if blueprints:
            return {
                'label': '',
                'imgSource': RES_ICONS.getBonusIcon(size, 'blueprint_tube'),
                'isSpecial': True,
                'specialAlias': TOOLTIPS_CONSTANTS.ADDITIONAL_AWARDS,
                'specialArgs': self._getShortBonusesData(mergedBonuses, size)
            }
        label = ''
        if self._displayedRewardsCount > 1:
            label = text_styles.stats(
                i18n.makeString(QUESTS.MISSIONS_AWARDS_MERGED,
                                count=len(mergedBonuses)))
        return {
            'label': label,
            'imgSource': RES_ICONS.getBonusIcon(size, 'default'),
            'isSpecial': True,
            'specialAlias': TOOLTIPS_CONSTANTS.ADDITIONAL_AWARDS,
            'specialArgs': self._getShortBonusesData(mergedBonuses, size)
        }
Пример #2
0
def getNationBigFlagIcon(nation, forVehicle):
    if nation in nations.AVAILABLE_NAMES:
        if forVehicle:
            return RES_ICONS.getEventBoardNationTankFlagIcon(nation)
        return RES_ICONS.getEventBoardNationFlagIcon(nation)
    else:
        return None
    def __setSeasonData(self, forceAnim=False):
        seasonRenderersList = []
        filledSeasonSlots = 0
        for season in SEASONS_ORDER:
            seasonName = SEASON_TYPE_TO_NAME.get(season)
            if self.__ctx.mode == C11nMode.CUSTOM:
                isFilled = self.__ctx.checkSlotsFillingForSeason(season)
            else:
                isFilled = self.__ctx.modifiedStyle is not None
            filledSeasonSlots += int(isFilled)
            seasonRenderersList.append({
                'nameText':
                VEHICLE_CUSTOMIZATION.getSeasonName(seasonName),
                'nameSelectedText':
                VEHICLE_CUSTOMIZATION.getSeasonSelectedName(seasonName),
                'seasonImageSrc':
                RES_ICONS.getSeasonImage(seasonName),
                'seasonBGImageSrc':
                RES_ICONS.getSeasonBGImage(seasonName),
                'seasonShineImageSrc':
                RES_ICONS.getSeasonShineImage(seasonName),
                'isFilled':
                isFilled,
                'forceAnim':
                forceAnim,
                'tooltip':
                makeTooltip(
                    body=VEHICLE_CUSTOMIZATION.getSheetSeasonName(seasonName))
            })

        self.as_setSeasonsBarDataS(seasonRenderersList)
        self._seasonSoundAnimantion.setFilledSeasonSlots(
            filledSeasonSlots, forceAnim)
        return
    def __getVehicleAwardVO(self):
        slots = []
        finalQuestsMap = {}
        for q in self.getOperation().getFinalQuests().itervalues():
            finalQuestsMap[q.getMajorTag()] = q

        if not finalQuestsMap:
            return {}
        for tokenID, tokenIcon in _TOKEN_SLOTS[self.getBranch()]:
            finalQuest = finalQuestsMap.get(tokenID)
            isCompleted = finalQuest.isCompleted()
            slots.append(
                self.__getVehiclePartSlot(
                    tokenID, tokenIcon, isCompleted,
                    self._eventsCache.getPersonalMissions().mayPawnQuest(
                        finalQuest), finalQuest.getPawnCost()))

        vehicleId = _FRAME_NAME[self.getOperationID() - 1]
        return {
            'vehicleSlotData': {
                'vehicleId':
                vehicleId,
                'vehicleImg':
                RES_ICONS.getPersonalMissionVehicleImg(vehicleId),
                'vehicleSmallImg':
                RES_ICONS.getPersonalMissionVehicleSmallImg(vehicleId),
                'pathImg':
                RES_ICONS.getPersonalMissionVehiclePathsImg(vehicleId),
                'pathSmallImg':
                RES_ICONS.getPersonalMissionVehiclePathsSmallImg(vehicleId)
            },
            'slots': slots
        }
    def __updateDetailedData(self, cardIndex):
        cardIndex = self.__normalizeSlotIndex(cardIndex)
        blocksLen = self.__CARDS[cardIndex]
        blocks = []
        for blockIndex in xrange(0, blocksLen):
            blocks.append({
                'title':
                PERSONAL_MISSIONS.getBlockTitle(cardIndex, blockIndex),
                'description':
                PERSONAL_MISSIONS.getBlockDescription(cardIndex, blockIndex),
                'image':
                RES_ICONS.getBlockImageByStep(cardIndex, blockIndex)
            })

        item = self.__R_PERSONAL_MISSION_FIRST_ENTRY_VIEW.dyn(
            'item{}'.format(cardIndex))
        data = {
            'index':
            cardIndex,
            'icon':
            RES_ICONS.getInfoIcon(cardIndex),
            'title':
            PERSONAL_MISSIONS.getCardHeader(cardIndex),
            'description':
            PERSONAL_MISSIONS.getCardInnerDescription(cardIndex),
            'blocks':
            blocks,
            'notificationIcon':
            RES_ICONS.MAPS_ICONS_LIBRARY_WARNINGICON_1,
            'notificationLabel':
            backport.text(item.warning())
            if item and 'warning' in item.keys() else ''
        }
        self.as_setDetailedCardDataS(data)
 def __getRules(self):
     topWinNum = self.rankedController.getRanksChanges(
         isLoser=False).count(1)
     topLoserNum = self.rankedController.getRanksChanges(
         isLoser=True).count(1)
     teamStr = text_styles.bonusAppliedText(
         RANKED_BATTLES.WELCOMESCREEN_POSITIVE_TEAM)
     descr = text_styles.hightlight(
         RANKED_BATTLES.WELCOMESCREEN_POSITIVE_BODY)
     rulePositive = {
         'image': RES_ICONS.getRankedPostBattleTopIcon(topWinNum),
         'description': descr.format(team=teamStr, topNumber=topWinNum)
     }
     if topLoserNum:
         teamStr = text_styles.error(
             RANKED_BATTLES.WELCOMESCREEN_NEGATIVE_TEAM)
         descr = text_styles.hightlight(
             RANKED_BATTLES.WELCOMESCREEN_NEGATIVE_BODY)
         ruleNegative = {
             'image': RES_ICONS.getRankedPostBattleLoseIcon(topLoserNum),
             'description': descr.format(team=teamStr,
                                         topNumber=topLoserNum)
         }
     else:
         ruleNegative = None
     return (rulePositive, ruleNegative)
    def __updateDetailedData(self, cardIndex):
        cardIndex = self.__normalizeSlotIndex(cardIndex)
        blocksLen = self.__CARDS[cardIndex]
        blocks = []
        for blockIndex in xrange(0, blocksLen):
            blocks.append({
                'title':
                PERSONAL_MISSIONS.getBlockTitle(cardIndex, blockIndex),
                'description':
                PERSONAL_MISSIONS.getBlockDescription(cardIndex, blockIndex),
                'image':
                RES_ICONS.getBlockImageByStep(cardIndex, blockIndex)
            })

        data = {
            'index':
            cardIndex,
            'icon':
            RES_ICONS.getInfoIcon(cardIndex),
            'title':
            PERSONAL_MISSIONS.getCardHeader(cardIndex),
            'description':
            PERSONAL_MISSIONS.getCardInnerDescription(cardIndex),
            'blocks':
            blocks,
            'notificationIcon':
            RES_ICONS.MAPS_ICONS_LIBRARY_WARNINGICON_1,
            'notificationLabel':
            i18n.makeString(PERSONAL_MISSIONS.getBlockWarning(cardIndex))
        }
        self.as_setDetailedCardDataS(data)
 def makeRankAndShieldInfo(self):
     rankState = self.getState()
     shieldIcon = ''
     plateIcon = ''
     shieldCount = ''
     if rankState in self.__WITH_SHIELD_STATES:
         rankInfo = self.__reusable.personal.getRankInfo()
         shieldState = rankInfo.shieldState
         if shieldState is not None:
             if shieldState in (RANKEDBATTLES_ALIASES.SHIELD_LOSE_STEP,
                                RANKEDBATTLES_ALIASES.SHIELD_LOSE,
                                RANKEDBATTLES_ALIASES.SHIELD_ENABLED):
                 rankState = shieldState
             if rankInfo.shieldHP > 0:
                 shieldCount = str(rankInfo.shieldHP)
                 shieldIcon = RES_ICONS.getRankShieldIcon(
                     size=RANKEDBATTLES_ALIASES.WIDGET_SMALL)
                 plateIcon = RES_ICONS.getRankShieldPlateIcon(
                     size=RANKEDBATTLES_ALIASES.WIDGET_SMALL)
     suffix, resource = self.__RANK_ICON_MAP[rankState]
     if suffix is not None:
         rankAfterBattle, isMaster = self.__getRankAfterBattle()
         if self.getState() == RANK_CHANGE_STATES.RANK_LOST:
             rankAfterBattle += 1
         val = 'VehMaster{}'.format(suffix) if isMaster else '{}{}'.format(
             rankAfterBattle, suffix)
         resource = resource('58x80', val)
     return (resource, shieldCount, shieldIcon, plateIcon)
    def __getVehicleAwardVO(self):
        slots = []
        finalQuestsMap = {}
        for q in self.getOperation().getFinalQuests().itervalues():
            finalQuestsMap[first(q.getVehicleClasses())] = q

        for vehType, tokenIcon in _TOKEN_SLOTS:
            finalQuest = finalQuestsMap[vehType]
            isCompleted = finalQuest.isCompleted()
            slots.append(
                self.__getVehiclePartSlot(
                    vehType, tokenIcon, isCompleted,
                    self._eventsCache.personalMissions.mayPawnQuest(
                        finalQuest), finalQuest.getPawnCost()))

        vehicleId = _FRAME_NAME[self.getOperationID() - 1]
        return {
            'vehicleSlotData': {
                'vehicleId':
                vehicleId,
                'vehicleImg':
                RES_ICONS.getPersonalMissionVehicleImg(vehicleId),
                'vehicleSmallImg':
                RES_ICONS.getPersonalMissionVehicleSmallImg(vehicleId),
                'pathImg':
                RES_ICONS.getPersonalMissionVehiclePathsImg(vehicleId),
                'pathSmallImg':
                RES_ICONS.getPersonalMissionVehiclePathsSmallImg(vehicleId)
            },
            'slots': slots
        }
Пример #10
0
 def _packReceivedBlock(self, winEarnedCount, loseEarnedCount):
     block = []
     block.append(
         self._getConditionHeaderBlock(
             strValue=RANKED_BATTLES.TOOLTIP_STEP_CONDITIONS_HEADER))
     if winEarnedCount > 0:
         winIcon = RES_ICONS.getRankedTooltipTopIcon(winEarnedCount)
         block.append(
             formatters.packImageTextBlockData(
                 desc=text_styles.main(
                     _ms(RANKED_BATTLES.TOOLTIP_STEP_CONDITIONS,
                         battlesNum=winEarnedCount,
                         team=text_styles.statInfo(
                             RANKED_BATTLES.TOOLTIP_STEP_WINNERS))),
                 img=winIcon,
                 txtPadding=formatters.packPadding(left=17)))
     if winEarnedCount > 0 and loseEarnedCount > 0:
         block.append(
             self._getOrBlock(
                 padding=formatters.packPadding(left=70, bottom=10)))
     if loseEarnedCount > 0:
         loseIcon = RES_ICONS.getRankedTooltipLoseIcon(loseEarnedCount)
         block.append(
             formatters.packImageTextBlockData(
                 desc=text_styles.main(
                     _ms(RANKED_BATTLES.TOOLTIP_STEP_CONDITIONS,
                         battlesNum=loseEarnedCount,
                         team=text_styles.critical(
                             RANKED_BATTLES.TOOLTIP_STEP_LOSERS))),
                 img=loseIcon,
                 txtPadding=formatters.packPadding(left=17)))
     return formatters.packBuildUpBlockData(
         block, 0,
         BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)
Пример #11
0
 def __getPersonalQuestsVO(self, vehicle):
     """ Get part of VO responsible for personal quests flag.
     """
     pqState, quest, chain, tile = _findPersonalQuestsState(self._eventsCache, vehicle)
     if pqState == WIDGET_PQ_STATE.AVAILABLE:
         icon = RES_ICONS.MAPS_ICONS_LIBRARY_OUTLINE_PLUS
     elif pqState == WIDGET_PQ_STATE.AWARD:
         icon = RES_ICONS.MAPS_ICONS_LIBRARY_OUTLINE_REWARD
     elif pqState in WIDGET_PQ_STATE.UNSUITABLE:
         icon = RES_ICONS.vehicleTypeInactiveOutline(vehicle.type)
     else:
         icon = RES_ICONS.vehicleTypeOutline(vehicle.type)
     if pqState in WIDGET_PQ_STATE.UNSUITABLE:
         labelState = LABEL_STATE.INACTIVE
     elif pqState == WIDGET_PQ_STATE.AVAILABLE:
         labelState = LABEL_STATE.EMPTY
     else:
         labelState = LABEL_STATE.ACTIVE
     ctx = {}
     if all((quest, chain, tile)):
         self._personalQuestID = quest.getID()
         chainType = tile.getChainMajorTag(quest.getChainID())
         ctx.update({'questName': quest.getUserName(),
          'description': quest.getUserMainCondition(),
          'current': len(filter(lambda q: q.isCompleted(), chain.itervalues())),
          'total': len(chain),
          'tileName': tile.getUserName(),
          'chainName': _ms(MENU.classesShort(chainType))})
     else:
         self._personalQuestID = None
     return {'personalQuestsLabel': _ms(MENU.hangarHeaderPersonalQuestsLabel(labelState), **ctx),
      'personalQuestsIcon': icon,
      'personalQuestsTooltip': _getPersonalQuestsTooltip(pqState, **ctx),
      'personalQuestsEnable': pqState not in WIDGET_PQ_STATE.UNSUITABLE}
Пример #12
0
def makeRankIcon(rank):
    if not rank:
        return ''
    else:
        icon = RES_ICONS.getRankIcon('24x24', rank)
        if icon is not None:
            return icon
        return RES_ICONS.getRankIcon('24x24', 0)
Пример #13
0
    def _getImages(cls, rent):
        result = {}
        for size in AWARDS_SIZES.ALL():
            if rent:
                image = RES_ICONS.getRentVehicleAwardIcon(size)
            else:
                image = RES_ICONS.getVehicleAwardIcon(size)
            result[size] = image

        return result
Пример #14
0
 def __makeFragmentVO(count, iconName, tooltipData=None):
     style = text_styles.stats if count > 0 else text_styles.main
     label = style(backport.getIntegralFormat(count))
     return {
         'hasFragments': count > 0,
         'label': label,
         'iconSmall': RES_ICONS.getBlueprintFragment('medium', iconName),
         'iconBig': RES_ICONS.getBlueprintFragment('big', iconName),
         'tooltipData': tooltipData
     }
Пример #15
0
 def __getPersonalQuestsVO(self, vehicle):
     """ Get part of VO responsible for personal quests flag.
     """
     pqState, quest, chain, tile = _findPersonalQuestsState(
         self._eventsCache, vehicle)
     if pqState == WIDGET_PQ_STATE.AVAILABLE:
         icon = RES_ICONS.MAPS_ICONS_LIBRARY_OUTLINE_PLUS
     elif pqState == WIDGET_PQ_STATE.AWARD:
         icon = RES_ICONS.MAPS_ICONS_LIBRARY_OUTLINE_REWARD
     elif pqState in WIDGET_PQ_STATE.UNSUITABLE:
         icon = RES_ICONS.vehicleTypeInactiveOutline(vehicle.type)
     else:
         icon = RES_ICONS.vehicleTypeOutline(vehicle.type)
     if pqState in WIDGET_PQ_STATE.UNSUITABLE:
         labelState = LABEL_STATE.INACTIVE
     elif pqState == WIDGET_PQ_STATE.AVAILABLE:
         labelState = LABEL_STATE.EMPTY
     else:
         labelState = LABEL_STATE.ACTIVE
     ctx = {}
     if all((quest, chain, tile)):
         self._personalQuestID = quest.getID()
         chainType = tile.getChainMajorTag(quest.getChainID())
         ctx.update({
             'questName':
             quest.getUserName(),
             'description':
             '{}\n{}\n\n{}\n{}'.format(
                 text_styles.standard(
                     _ms(QUESTS.QUESTTASKDETAILSVIEW_MAINCONDITIONS)),
                 quest.getUserMainCondition(),
                 text_styles.standard(
                     _ms(QUESTS.QUESTTASKDETAILSVIEW_ADDITIONALCONDITIONS)),
                 quest.getUserAddCondition()),
             'current':
             len(filter(lambda q: q.isCompleted(), chain.itervalues())),
             'total':
             len(chain),
             'tileName':
             tile.getUserName(),
             'chainName':
             _ms(MENU.classesShort(chainType))
         })
     else:
         self._personalQuestID = None
     return {
         'personalQuestsLabel':
         _ms(MENU.hangarHeaderPersonalQuestsLabel(labelState), **ctx),
         'personalQuestsIcon':
         icon,
         'personalQuestsTooltip':
         _getPersonalQuestsTooltip(pqState, **ctx),
         'personalQuestsEnable':
         pqState not in WIDGET_PQ_STATE.UNSUITABLE
     }
Пример #16
0
 def __getPersonalQuestsVO(self, vehicle):
     if not self._lobbyContext.getServerSettings().isPersonalMissionsEnabled():
         return {'personalQuestsLabel': _ms(MENU.hangarHeaderPersonalQuestsLabel(LABEL_STATE.INACTIVE)),
          'personalQuestsIcon': RES_ICONS.vehicleTypeInactiveOutline(vehicle.type),
          'personalQuestsEnable': False,
          'personalQuestsVisible': True,
          'isPersonalReward': False,
          'personalQuestsTooltip': None,
          'personalQuestsTooltipIsSpecial': False}
     else:
         pqState, quest, chain, tile = _findPersonalQuestsState(self._eventsCache, vehicle)
         enable = True
         if pqState & WIDGET_PQ_STATE.AWARD:
             icon = RES_ICONS.MAPS_ICONS_LIBRARY_OUTLINE_REWARD
             labelState = LABEL_STATE.ACTIVE
             tooltip = makeTooltip(_ms(TOOLTIPS.HANGAR_HEADER_PERSONALQUESTS_AWARD_HEADER, tileName=tile.getUserName()), _ms(TOOLTIPS.HANGAR_HEADER_PERSONALQUESTS_AWARD_BODY, chainName=_ms(MENU.classesShort(tile.getChainMajorTag(quest.getChainID())))))
         elif pqState & WIDGET_PQ_STATE.IN_PROGRESS:
             icon = RES_ICONS.vehicleTypeOutline(vehicle.type)
             labelState = LABEL_STATE.ACTIVE
             tooltip = TOOLTIPS_CONSTANTS.PERSONAL_QUESTS_PREVIEW
         elif pqState & WIDGET_PQ_STATE.AVAILABLE:
             icon = RES_ICONS.MAPS_ICONS_LIBRARY_OUTLINE_PLUS
             labelState = LABEL_STATE.EMPTY
             tooltip = TOOLTIPS.HANGAR_HEADER_PERSONALQUESTS_AVAILABLE
         elif pqState & WIDGET_PQ_STATE.COMPLETED:
             icon = RES_ICONS.vehicleTypeOutline(vehicle.type)
             labelState = LABEL_STATE.ALL_DONE
             if pqState & WIDGET_PQ_STATE.UNAVAILABLE:
                 tooltip = TOOLTIPS.HANGAR_HEADER_PERSONALQUESTS_UNAVAILABLE
             else:
                 tooltip = TOOLTIPS.HANGAR_HEADER_PERSONALQUESTS_COMPLETED
         elif pqState & WIDGET_PQ_STATE.DONE:
             icon = RES_ICONS.vehicleTypeInactiveOutline(vehicle.type)
             labelState = LABEL_STATE.INACTIVE
             tooltip = TOOLTIPS.HANGAR_HEADER_PERSONALQUESTS_DONE
             enable = False
         else:
             icon = RES_ICONS.vehicleTypeInactiveOutline(vehicle.type)
             labelState = LABEL_STATE.INACTIVE
             tooltip = TOOLTIPS.HANGAR_HEADER_PERSONALQUESTS_DISABLED
             enable = False
         if all((quest, chain, tile)):
             self._personalQuestID = quest.getID()
             ctx = {'current': quest.getInternalID()}
         else:
             self._personalQuestID = None
             ctx = {'icon': icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_OUTLINE_QUESTS_ALL_DONE)}
         return {'personalQuestsLabel': _ms(MENU.hangarHeaderPersonalQuestsLabel(labelState), **ctx),
          'personalQuestsIcon': icon,
          'personalQuestsEnable': enable,
          'personalQuestsVisible': True,
          'isPersonalReward': bool(pqState & WIDGET_PQ_STATE.AWARD),
          'personalQuestsTooltip': tooltip,
          'personalQuestsTooltipIsSpecial': bool(pqState & WIDGET_PQ_STATE.IN_PROGRESS)}
Пример #17
0
 def __createVO(self, vehicle=None):
     vehiclesAvailable = bool(self.__tradeIn.getTradeOffVehicles())
     vo = {'showTradeOff': vehicle is None,
      'available': vehiclesAvailable}
     if vehicle is not None:
         vo.update({'vehicleNationFlag': RES_ICONS.getTradeInNationFlag(vehicle.nationName),
          'vehicleType': Vehicle.getTypeSmallIconPath(vehicle.type, vehicle.isElite),
          'vehicleLevel': RES_ICONS.getLevelIcon(vehicle.level),
          'vehicleIcon': getSmallIconPath(vehicle.name),
          'vehicleTitle': vehicle.shortUserName})
     return vo
Пример #18
0
def _getPersonalMissionsIcon(vehicle, branch, active):
    if branch == PM_BRANCH.REGULAR:
        if active:
            return RES_ICONS.vehicleTypeOutline(vehicle.type)
        return RES_ICONS.vehicleTypeInactiveOutline(vehicle.type)
    if branch == PM_BRANCH.PERSONAL_MISSION_2:
        allianceId = nations.NATION_TO_ALLIANCE_IDS_MAP[vehicle.nationID]
        alliance = nations.ALLIANCES_TAGS_ORDER[allianceId]
        if active:
            return RES_ICONS.getAlliance32x32Icon(alliance)
        return RES_ICONS.getAlliance32x32InactiveIcon(alliance)
Пример #19
0
def getOperations(branch, currOperationID):
    _eventsCache = dependency.instance(IEventsCache)
    operations = []
    for oID, o in sorted(_eventsCache.getPersonalMissions().getOperationsForBranch(branch).iteritems(), key=operator.itemgetter(0)):
        state = PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE
        descr = text_styles.stats(PERSONAL_MISSIONS.OPERATIONS_UNLOCKED_DESC)
        title = text_styles.highTitle(o.getShortUserName())
        if o.isDisabled():
            state, _ = getPostponedOperationState(oID)
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        elif not o.isUnlocked():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_LOCKED_STATE
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        elif o.isFullCompleted():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_FULL_STATE
            descr = text_styles.bonusAppliedText(PERSONAL_MISSIONS.OPERATIONS_FULLYCOMPLETED_DESC)
        elif o.isAwardAchieved():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_STATE
            descr = text_styles.bonusAppliedText(PERSONAL_MISSIONS.OPERATIONS_COMPLETED_DESC)
        elif o.isInProgress():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_CURRENT_STATE
            descr = text_styles.neutral(PERSONAL_MISSIONS.OPERATIONS_CURRENT_DESC)
        elif not o.hasRequiredVehicles():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_LOCKED_STATE
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        if state != PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE:
            iconStateSource = RES_ICONS.getPersonalMissionOperationState(state)
        else:
            iconStateSource = None
        freeSheetIcon = ''
        freeSheetCounter = ''
        tokensPawned = o.getTokensPawnedCount()
        if tokensPawned:
            freeSheetIcon = AwardSheetPresenter.getIcon(AwardSheetPresenter.Size.X_16, o.getBranch())
            freeSheetCounter = text_styles.counter('x%d' % tokensPawned)
        if state == PERSONAL_MISSIONS_ALIASES.OPERATION_POSTPONED_STATE:
            tooltipAlias = TOOLTIPS_CONSTANTS.OPERATION_POSTPONED
        else:
            tooltipAlias = TOOLTIPS_CONSTANTS.OPERATION
        operationVO = {'title': title,
         'desc': descr,
         'iconSource': RES_ICONS.getPersonalMissionOperationImage(oID),
         'iconStateSource': iconStateSource,
         'freeSheetIconSource': freeSheetIcon,
         'freeSheetCounter': freeSheetCounter,
         'state': state,
         'isSelected': oID == currOperationID,
         'id': oID,
         'tooltipAlias': tooltipAlias}
        operations.append(operationVO)

    return operations
Пример #20
0
 def __getPicture(self):
     if self.__eventType == _et.NATION:
         return getNationEmblemIcon(self.__value)
     elif self.__eventType == _et.CLASS:
         return RES_ICONS.getEventBoardVehicleClass(self.__value)
     elif self.__eventType == _et.LEVEL:
         return RES_ICONS.getEventBoardVehicleLevel(self.__value)
     elif self.__eventType == _et.VEHICLE:
         vehicle = self.itemsCache.items.getItemByCD(self.__value)
         name = vehicle.name.split(':', 1)[-1].lower()
         return RES_ICONS.getEventBoardTank(name)
     else:
         return None
    def _getImages(cls, vehicle, isRent=False):
        result = {}
        for size in AWARDS_SIZES.ALL():
            image = '../maps/icons/quests/bonuses/{}/{}'.format(size, getItemIconName(vehicle.name))
            if image in RES_ICONS.MAPS_ICONS_QUESTS_BONUSES_ALL_ENUM:
                result[size] = image
            if isRent:
                image = RES_ICONS.getRentVehicleAwardIcon(size)
            else:
                image = RES_ICONS.getVehicleAwardIcon(size)
            result[size] = image

        return result
 def _getVehicleDescrStr(vehicle):
     if vehicle.isElite:
         vehTypeIcon = icons.makeImageTag(
             source=RES_ICONS.maps_icons_vehicletypes_elite_all_png(
                 vehicle.type),
             width=24,
             height=24,
             vSpace=-6)
     else:
         vehTypeIcon = icons.makeImageTag(
             RES_ICONS.maps_icons_vehicletypes_all_png(vehicle.type))
     return text_styles.concatStylesToSingleLine(
         text_styles.stats(int2roman(vehicle.level)), vehTypeIcon,
         text_styles.main(vehicle.userName))
def getOperations(currOperationID):
    operations = []
    for oID, o in sorted(events_helpers.getPersonalMissionsCache().
                         getOperations().iteritems(),
                         key=operator.itemgetter(0)):
        state = PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE
        descr = text_styles.stats(PERSONAL_MISSIONS.OPERATIONS_UNLOCKED_DESC)
        title = text_styles.highTitle(o.getShortUserName())
        if not o.isUnlocked():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_LOCKED_STATE
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        elif o.isFullCompleted():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_FULL_STATE
            descr = text_styles.bonusAppliedText(
                PERSONAL_MISSIONS.OPERATIONS_FULLYCOMPLETED_DESC)
        elif o.isAwardAchieved():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_STATE
            descr = text_styles.bonusAppliedText(
                PERSONAL_MISSIONS.OPERATIONS_COMPLETED_DESC)
        elif o.isInProgress():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_CURRENT_STATE
            descr = text_styles.neutral(
                PERSONAL_MISSIONS.OPERATIONS_CURRENT_DESC)
        elif not o.hasRequiredVehicles():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_LOCKED_STATE
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        if state != PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE:
            iconStateSource = RES_ICONS.getPersonalMissionOperationState(state)
        else:
            iconStateSource = None
        freeSheetIcon = ''
        freeSheetCounter = ''
        tokensPawned = o.getTokensPawnedCount()
        if tokensPawned:
            freeSheetIcon = RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_SHEET_RECEIVED_SMALL
            freeSheetCounter = text_styles.counter('x%d' % tokensPawned)
        operationVO = {
            'title': title,
            'desc': descr,
            'iconSource': RES_ICONS.getPersonalMissionOperationImage(oID),
            'iconStateSource': iconStateSource,
            'freeSheetIconSource': freeSheetIcon,
            'freeSheetCounter': freeSheetCounter,
            'state': state,
            'isSelected': oID == currOperationID,
            'id': oID
        }
        operations.append(operationVO)

    return operations
Пример #24
0
def makeTableHeaderVO(method, objective, eventType):
    if objective == _op.WINS:
        icons = (RES_ICONS.getEventBoardIcon('win_quantity'),
                 RES_ICONS.getEventBoardIcon('battle_exp_average'),
                 RES_ICONS.getEventBoardIcon('battle_quantity'))
    else:
        try:
            icons = [
                (RES_ICONS.getEventBoardIcon(icon) if '%s' not in icon else
                 RES_ICONS.getEventBoardIcon(icon %
                                             _OBJECTIVE_STRINGS[objective]))
                for icon in _METHOD_ICON_NAMES[method]
            ]
        except KeyError:
            LOG_ERROR('WGELEN: Wrong method/objective: %s/%s!' %
                      (method, objective))
            return None

    return {
        'columns': [{
            'tooltip':
            makeTooltip(
                TOOLTIPS.elen_excel_objparam_all_all_header(method, objective),
                TOOLTIPS.elen_excel_objparam_all_all_body(method, objective)),
            'icon':
            icons[0]
        }, {
            'tooltip':
            makeTooltip(
                TOOLTIPS.elen_excel_addparam_all_all_header(method, objective),
                TOOLTIPS.elen_excel_addparam_all_all_body(method, objective)),
            'icon':
            icons[1]
        }, {
            'tooltip':
            makeTooltip(
                TOOLTIPS.ELEN_EXCEL_INFOPARAM_WINS_HEADER,
                TOOLTIPS.elen_excel_infoparam_wins_all_body(eventType)),
            'icon':
            icons[2]
        }],
        'positionTooltip':
        makeTooltip(TOOLTIPS.ELEN_EXCEL_POSITION_HEADER,
                    TOOLTIPS.ELEN_EXCEL_POSITION_BODY),
        'playerTooltip':
        makeTooltip(TOOLTIPS.ELEN_EXCEL_PLAYER_HEADER,
                    TOOLTIPS.ELEN_EXCEL_PLAYER_BODY)
    }
 def _packBlocks(self, operationID, vehicleType):
     pmController = dependency.instance(IEventsCache).personalMissions
     operation = pmController.getOperations()[operationID]
     chainID, _ = operation.getChainByVehicleType(vehicleType)
     finalQuest = operation.getFinalQuests()[chainID]
     bonus = findFirst(lambda q: q.getName() == 'completionTokens',
                       finalQuest.getBonuses('tokens'))
     formattedBonus = first(CompletionTokensBonusFormatter().format(bonus))
     operationTitle = str(operation.getVehicleBonus().userName).replace(
         ' ', ' ')
     if finalQuest.isCompleted():
         statusText = self.__getObtainedStatus()
     elif pmController.mayPawnQuest(finalQuest):
         statusText = self.__getAvailableStatus(finalQuest.getPawnCost())
     else:
         statusText = self.__getNotObtainedStatus()
     vehIcon = RES_ICONS.vehicleTypeInactiveOutline(vehicleType)
     blocks = [
         formatters.packImageTextBlockData(
             title=text_styles.highTitle(formattedBonus.userName),
             desc=text_styles.standard(
                 _ms(PERSONAL_MISSIONS.OPERATIONTITLE_TITLE,
                     title=operationTitle)),
             img=formattedBonus.getImage(AWARDS_SIZES.BIG),
             imgPadding=formatters.packPadding(right=20),
             txtPadding=formatters.packPadding(top=10)),
         formatters.packBuildUpBlockData(
             [
                 formatters.packImageTextBlockData(
                     title=text_styles.main(
                         _ms(PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_INFO,
                             vehName=text_styles.neutral(operationTitle))),
                     img=RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED,
                     imgPadding=formatters.packPadding(
                         left=8, right=10, top=2))
             ],
             linkage=BLOCKS_TOOLTIP_TYPES.
             TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
             padding=formatters.packPadding(top=-7, bottom=-3))
     ]
     if not finalQuest.isCompleted():
         blocks.append(
             formatters.packBuildUpBlockData([
                 formatters.packTextBlockData(text_styles.middleTitle(
                     PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_HELP_TITLE),
                                              padding=formatters.
                                              packPadding(bottom=4)),
                 formatters.packImageTextBlockData(title=text_styles.main(
                     _ms(PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_HELP_BODY,
                         vehType=_ms(
                             PERSONAL_MISSIONS.chainNameByVehicleType(
                                 vehicleType)))),
                                                   img=vehIcon,
                                                   imgPadding=formatters.
                                                   packPadding(right=2))
             ]))
     blocks.append(
         formatters.packAlignedTextBlockData(
             text=statusText, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
     return blocks
Пример #26
0
 def makeVO(cls, contact, useBigIcons=False):
     dbID = contact.getID()
     tags = contact.getTags()
     note = contact.getNote()
     isOnline = contact.isOnline()
     if USER_TAG.CLAN_MEMBER in tags:
         pass
     elif contact.getClanAbbrev():
         tags.add(USER_TAG.OTHER_CLAN_MEMBER)
     baseUserProps = cls.makeBaseUserProps(contact)
     baseUserProps['rgb'] = cls.getColor(tags, isOnline)
     baseUserProps['icons'] = cls.getIcons(tags, note)
     baseUserProps['tags'] = list(tags)
     resourceIconId = cls.getGuiResourceID(contact)
     isColorBlind = cls.settingsCore.getSetting('isColorBlind')
     if resourceIconId == WG_GAMES.TANKS:
         if contact.isOnline():
             if USER_TAG.PRESENCE_DND in tags:
                 resourceIconId = _WOT_GAME_RESOURCE.BUSY_BLIND if isColorBlind else _WOT_GAME_RESOURCE.BUSY
             else:
                 resourceIconId = _WOT_GAME_RESOURCE.ONLINE
         else:
             resourceIconId = _WOT_GAME_RESOURCE.UNKNOWN
     return {'userProps': baseUserProps,
      'dbID': dbID,
      'note': escape(note),
      'resource': RES_ICONS.getContactStatusIcon('48x48' if useBigIcons else '24x24', resourceIconId)}
 def _format(self, bonus):
     tokens = bonus.getTokens()
     unlockTokenID = findFirst(lambda ID: ID.endswith(self.__TOKEN_POSTFIX),
                               tokens.keys())
     if unlockTokenID is not None:
         camouflages = self.c11n.getCamouflages(
             criteria=REQ_CRITERIA.CUSTOMIZATION.UNLOCKED_BY(unlockTokenID))
         images = {
             size: RES_ICONS.getBonusIcon(size, self.__ICON_NAME)
             for size in AWARDS_SIZES.ALL()
         }
         result = [
             PreformattedBonus(
                 bonusName=bonus.getName(),
                 label=formatCountLabel(len(camouflages)),
                 align=LABEL_ALIGN.RIGHT,
                 images=images,
                 isSpecial=False,
                 tooltip=makeTooltip(
                     TOOLTIPS.PERSONALMISSIONS_AWARDS_CAMOUFLAGE_HEADER,
                     TOOLTIPS.PERSONALMISSIONS_AWARDS_CAMOUFLAGE_BODY))
         ]
     else:
         result = []
     return result
Пример #28
0
def getEpicVehicleDataVO(vehicle):
    return {
        'vehicleID':
        vehicle.intCD,
        'vehicleName':
        vehicle.shortUserName if vehicle.isPremiumIGR else vehicle.userName,
        'flagIcon':
        respawn_utils.FLAG_ICON_TEMPLATE % nations.NAMES[vehicle.nationID],
        'vehicleIcon':
        vehicle.icon,
        'vehicleTypeIcon':
        (respawn_utils.VEHICLE_ELITE_TYPE_TEMPLATE if vehicle.isElite else
         respawn_utils.VEHICLE_TYPE_TEMPLATE) % vehicle.type,
        'isElite':
        vehicle.isElite,
        'isPremium':
        vehicle.isPremium,
        'vehicleLevelIcon':
        RES_ICONS.getLevelIcon(vehicle.level),
        'favorite':
        vehicle.isFavorite,
        'enabled':
        True,
        'cooldown':
        '',
        'settings':
        0
    }
Пример #29
0
def formatPingStatus(csisStatus, isColorBlind, isSelected, pingStatus, pingValue, useBigSize = False):
    """
    
    :param csisStatus:
    :param isColorBlind:
    :param isSelected:
    :param pingStatus:
    :param pingValue:
    :param useBigSize: If True result str has 14 font size, otherwise - 11 font size
    :return:
    """
    if pingStatus == PING_STATUSES.REQUESTED:
        return None
    else:
        if csisStatus != HOST_AVAILABILITY.NOT_AVAILABLE and pingStatus != PING_STATUSES.UNDEFINED:
            if pingStatus == PING_STATUSES.LOW:
                formattedPing = text_styles.goodPing(pingValue)
            else:
                formattedPing = text_styles.main(pingValue) if isSelected else text_styles.standartPing(pingValue)
        else:
            pingValue = _UNAVAILABLE_DATA_PLACEHOLDER
            pingStatus = PING_STATUSES.UNDEFINED
            formattedPing = text_styles.standard(pingValue)
        colorBlindName = ''
        if isColorBlind and pingStatus == PING_STATUSES.HIGH:
            colorBlindName = '_color_blind'
        pingStatusIcon = formatPingStatusIcon(RES_ICONS.maps_icons_pingstatus_stairs_indicator(str(pingStatus) + colorBlindName + '.png'))
        if useBigSize:
            return text_styles.concatStylesToSingleLine(text_styles.main(' '), formattedPing, pingStatusIcon)
        return text_styles.concatStylesToSingleLine(formattedPing, '', pingStatusIcon)
        return None
    def _getImages(cls, item):
        result = {}
        c11nItem = cls.__getC11nItem(item)
        for size in AWARDS_SIZES.ALL():
            result[size] = RES_ICONS.getBonusIcon(size, c11nItem.itemTypeName)

        return result
    def __hasUniqueIcon(cls, vehicle):
        for size in AWARDS_SIZES.ALL():
            if cls._getImages(vehicle).get(
                    size) != RES_ICONS.getVehicleAwardIcon(size):
                return True

        return False
Пример #32
0
    def __makeRequiredVehicles(self):
        strResult = []
        for vehicle in self.__eventVehicles:
            icon = RES_ICONS.maps_icons_vehicletypes_elite(vehicle.type + '.png')
            userName = self.textMgr.getText(TEXT_MANAGER_STYLES.MAIN_TEXT, vehicle.userName)
            voData = {'resIcon': icon,
             'vehicleName': userName}
            strResult.append(voData)

        return strResult
Пример #33
0
 def __getBattleQuestsVO(self, vehicle):
     """ Get part of VO responsible for battle quests flag.
     """
     bqState, quests = _findBattleQuestsState(self._eventsCache, vehicle)
     if bqState == WIDGET_BQ_STATE.AVAILABLE:
         labelState = LABEL_STATE.ACTIVE
         self._battleQuestId = first(quests).getID()
     else:
         labelState = LABEL_STATE.INACTIVE
         self._battleQuestId = None
     ctx = {'total': len(quests)}
     return {'commonQuestsLabel': _ms(MENU.hangarHeaderBattleQuestsLabel(labelState), **ctx),
      'commonQuestsIcon': RES_ICONS.questsStateIconOutline(bqState),
      'commonQuestsTooltip': _getBattleQuestsTooltip(bqState, **ctx),
      'commonQuestsEnable': bqState == WIDGET_BQ_STATE.AVAILABLE}
Пример #34
0
 def __onChanged(self, changedData):
     """
     gui.game_control.VehComparisonBasket.onChange event handler
     :param changedData: instance of gui.game_control.veh_comparison_basket._ChangedData
     """
     comparisonBasket = getVehicleComparisonBasketCtrl()
     if changedData.addedCDs:
         cMgr = self.__getContainerManager()
         if not cMgr.isViewAvailable(ViewTypes.LOBBY_SUB, {POP_UP_CRITERIA.VIEW_ALIAS: VIEW_ALIAS.VEHICLE_COMPARE}):
             if comparisonBasket.getVehiclesCount() == 1:
                 self.__view.as_openVehicleCompareCartPopoverS(True)
             else:
                 vehicle = g_itemsCache.items.getItemByCD(changedData.addedCDs[-1])
                 vehName = '  '.join([int2roman(vehicle.level), vehicle.shortUserName])
                 vehTypeIcon = RES_ICONS.maps_icons_vehicletypes_gold(vehicle.type + '.png')
                 self.__view.as_showAddVehicleCompareAnimS({'vehName': vehName,
                  'vehType': vehTypeIcon})
     if changedData.addedCDs or changedData.removedCDs:
         self.__updateBtnVisibility(comparisonBasket)