def __makeTileData(cardIndex):
     return {
         'index': cardIndex,
         'iconSource': RES_ICONS.getInfoIcon(cardIndex),
         'titleLabel': PERSONAL_MISSIONS.getCardHeader(cardIndex),
         'descriptionLabel': PERSONAL_MISSIONS.getCardDescription(cardIndex)
     }
    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 __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 getChainName(self, chainID):
     classifier = self.getChainClassifier(chainID).classificationAttr
     if self.__branch == PM_BRANCH.REGULAR:
         return PERSONAL_MISSIONS.chainNameByVehicleType(classifier)
     if self.__branch == PM_BRANCH.PERSONAL_MISSION_2:
         allianceId = nations.ALLIANCE_IDS[classifier]
         return PERSONAL_MISSIONS.getAllianceName(allianceId)
 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
 def getWarningText(self):
     if not self.__quest.hasRequiredVehicles():
         classifier = self.__quest.getQuestClassifier().classificationAttr
         return _ms(PERSONAL_MISSIONS.sheetNoVehicleWarning(
             self.__quest.getQuestBranchName()),
                    vehicleClass=_ms('#menu:classes/short/' + classifier))
     return _ms(PERSONAL_MISSIONS.USEAWARDSHEETWINDOW_LOCKED
                ) if not self.__quest.isUnlocked() else ''
Exemple #7
0
    def _packBlocks(self, chainID):
        personalMissions = dependency.instance(
            IEventsCache).getPersonalMissions()
        operation = first(
            personalMissions.getOperationsForBranch(
                PM_BRANCH.PERSONAL_MISSION_2).values())
        blocks = [
            formatters.packImageTextBlockData(
                title=text_styles.highTitle(operation.getChainName(chainID)),
                desc=text_styles.standard(
                    operation.getChainDescription(chainID)),
                img=RES_ICONS.getAlliance54x54Icon(chainID),
                imgPadding=formatters.packPadding(top=3, left=-5),
                txtOffset=78)
        ]
        nations = getNationsForChain(operation, chainID)
        nationBlocks = []
        separator = '   '
        for nation in GUI_NATIONS:
            if nation in nations:
                icon = icons.makeImageTag(getNationsFilterAssetPath(nation),
                                          26, 16, -4)
                nationName = text_styles.main(NATIONS.all(nation))
                nationBlocks.append(
                    formatters.packTextBlockData(
                        text_styles.concatStylesToSingleLine(
                            icon, separator, nationName)))

        blocks.append(
            formatters.packBuildUpBlockData(
                nationBlocks,
                linkage=BLOCKS_TOOLTIP_TYPES.
                TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
                padding=formatters.packPadding(left=40)))
        allianceID = operation.getAllianceID(chainID)
        blocks.append(
            formatters.packBuildUpBlockData([
                formatters.packTextBlockData(
                    text_styles.middleTitle(
                        PERSONAL_MISSIONS.CHAINTOOLTIPDATA_DESCRIPTION_TITLE),
                    padding=formatters.packPadding(bottom=4)),
                formatters.packTextBlockData(
                    text_styles.main(
                        PERSONAL_MISSIONS.getAllianceChainTooltipDescr(
                            allianceID)),
                    padding=formatters.packPadding(bottom=7))
            ],
                                            padding=formatters.packPadding(
                                                top=-7, bottom=-3)))
        return blocks
    def __updateSideBar(self):
        chains = []
        currChainID = self.getChainID()
        currentOperation = self.getOperation()
        currentVehicleType = currentOperation.getChainVehicleClass(currChainID)
        for vehicleType in VEHICLE_TYPES_ORDER:
            chainID, quests = currentOperation.getChainByVehicleType(
                vehicleType)
            chainState = self.__getChainState(quests)
            progress = self.__getProgress(quests)
            if chainState.isCompleted:
                currentProgress = text_styles.bonusAppliedText(
                    progress['value'])
            else:
                currentProgress = text_styles.stats(progress['value'])
            if currentVehicleType == vehicleType:
                label = text_styles.tutorial(
                    PERSONAL_MISSIONS.chainNameByVehicleType(
                        currentVehicleType))
            elif chainState.questInProgress is not None:
                label = text_styles.main(
                    chainState.questInProgress.getShortUserName())
            elif chainState.isFullCompleted:
                label = text_styles.bonusAppliedText(
                    PERSONAL_MISSIONS.SIDEBAR_FULLCOMPLETED)
            elif chainState.isCompleted:
                label = text_styles.bonusAppliedText(
                    PERSONAL_MISSIONS.SIDEBAR_COMPLETED)
            else:
                label = text_styles.main(PERSONAL_MISSIONS.SIDEBAR_NOTSELECTED)
            progressText = text_styles.main(' / ').join(
                (currentProgress, text_styles.main(progress['maxValue'])))
            chains.append({
                'chainID':
                chainID,
                'progressText':
                progressText,
                'label':
                label,
                'tankIcon':
                Vehicle.getTypeBigIconPath(vehicleType, False),
                'progress':
                progress
            })

        self.as_updateBranchesDataS({'chains': chains})
        self.as_setSelectedBranchIndexS(currChainID)
        return
 def getFormattedMultiplierValue(self, scope='card'):
     multiplier = self.getMultiplier()
     if multiplier:
         multiplierValue = first(multiplier['task'].values())
         descr = text_styles.main(
             i18n.makeString(PERSONAL_MISSIONS.getMultiplierDescr(
                 multiplier['type'], scope),
                             value=multiplierValue))
         if multiplier['type'] == MULTIPLIER_TYPE.ATTEMPTS:
             return text_styles.concatStylesToSingleLine(
                 text_styles.neutral(
                     i18n.makeString(
                         PERSONAL_MISSIONS.BONUS_MULTIPLIER_ATTEMPTS)), ' ',
                 descr)
         if multiplier['type'] == MULTIPLIER_TYPE.PROGRESS:
             return text_styles.concatStylesToSingleLine(
                 text_styles.neutral(
                     i18n.makeString(
                         PERSONAL_MISSIONS.BONUS_MULTIPLIER_PROGRESS,
                         value=multiplierValue)), ' ', descr)
Exemple #10
0
 def __packAwardProgress(self, bonusName, stats, opName):
     acquired, total = stats['acquired'], stats['possible']
     if bonusName not in money.Currency.ALL:
         progressStr = ' / '.join((text_styles.stats(acquired), text_styles.main(total)))
     else:
         progressStr = currency.applyAll(bonusName, acquired)
     if bonusName == 'questsCompleted':
         tooltip = makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_AWARDS_STATS_QUESTSCOMPLETED_HEADER, body=_ms(TOOLTIPS.PERSONALMISSIONS_AWARDS_STATS_QUESTSCOMPLETED_BODY, name=opName, acquired=acquired, excellentAcquired=len(self.getOperation().getFullCompletedQuests()), total=total))
     elif bonusName == 'completionTokens':
         tooltip = makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_AWARDS_STATS_COMPLETIONTOKENS_HEADER, body=_ms(TOOLTIPS.PERSONALMISSIONS_AWARDS_STATS_COMPLETIONTOKENS_BODY, name=opName, acquired=acquired, total=total))
     elif bonusName == 'tankwomanBonus':
         tooltip = makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_AWARDS_STATS_TANKWOMANBONUS_HEADER, body=_ms(TOOLTIPS.PERSONALMISSIONS_AWARDS_STATS_TANKWOMANBONUS_BODY, name=opName, acquired=acquired, total=total))
     else:
         currencyFormatter = currency.getBWFormatter(bonusName)
         tooltip = makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_AWARDS_STATS_CREDITS_HEADER, body=_ms(TOOLTIPS.PERSONALMISSIONS_AWARDS_STATS_CREDITS_BODY, name=opName, acquired=currencyFormatter(acquired), total=currencyFormatter(total)))
     return {'operationId': self.getOperationID(),
      'title': text_styles.highlightText(PERSONAL_MISSIONS.awards_progress_label(bonusName)),
      'progress': progressStr,
      'awardSource': _STATS_ICONS[bonusName],
      'progressBarData': {'value': acquired,
                          'maxValue': total},
      'tooltip': tooltip}
 def getChainDescription(self, chainID):
     if self.__branch == PM_BRANCH.PERSONAL_MISSION_2:
         classifier = self.getChainClassifier(chainID).classificationAttr
         allianceId = nations.ALLIANCE_IDS[classifier]
         return PERSONAL_MISSIONS.getAllianceDetails(allianceId)