Example #1
0
 def _getStatusBlock(cls, quest):
     isAvailable, reason = quest.isAvailable()
     if not isAvailable:
         if reason == 'noVehicle':
             key = TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_NOVEHICLE
         else:
             key = TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_NOTAVAILABLE
         text = text_styles.concatStylesWithSpace(icons.markerBlocked(-2),
                                                  text_styles.error(key))
     elif quest.isInProgress():
         if quest.isOnPause:
             text = text_styles.concatStylesWithSpace(
                 icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ONPAUSE,
                                    16, 16, -3, 8),
                 text_styles.playerOnline(
                     TOOLTIPS.
                     PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_ONPAUSE))
         elif quest.areTokensPawned():
             label = _ms(
                 TOOLTIPS.
                 PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_SHEETRECOVERYINPROGRESS,
                 icon=missions_helper.getHtmlAwardSheetIcon(
                     quest.getQuestBranch()),
                 count=quest.getPawnCost())
             text = text_styles.concatStylesWithSpace(
                 icons.inProgress(-1), text_styles.neutral(label))
         else:
             text = text_styles.concatStylesWithSpace(
                 icons.inProgress(-1),
                 text_styles.neutral(
                     TOOLTIPS.
                     PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_INPROGRESS))
     elif quest.isCompleted():
         if quest.areTokensPawned():
             text = text_styles.concatStylesWithSpace(
                 icons.checkmark(-2),
                 text_styles.bonusAppliedText(
                     TOOLTIPS.
                     PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_DONEFREESHEET),
                 missions_helper.getHtmlAwardSheetIcon(
                     quest.getQuestBranch()),
                 text_styles.stats('x%s' % quest.getPawnCost()))
         else:
             text = text_styles.concatStylesWithSpace(
                 icons.checkmark(-2),
                 text_styles.bonusAppliedText(
                     TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_DONE))
     else:
         text = text_styles.main(
             TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_AVAILABLE)
     return formatters.packAlignedTextBlockData(
         text=text,
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         padding=formatters.packPadding(top=-5, bottom=-5))
 def __setData(self):
     detailedData = getDetailedMissionData(self._quest)
     status = MISSIONS_STATES.COMPLETED
     isFinal = self._quest.isFinal()
     if self._isAwardListUsed:
         count = text_styles.stats(
             str(self._quest.getPawnCost()) +
             getHtmlAwardSheetIcon(self._quest.getQuestBranch()))
         statusLabel = text_styles.bonusAppliedText(
             _ms(QUESTS.PERSONALMISSION_STATUS_DONEWITHPAWN, count=count))
     elif self._mainReward and self._addReward:
         statusLabel = text_styles.bonusAppliedText(
             QUESTS.PERSONALMISSION_STATUS_FULLDONE)
         status = MISSIONS_STATES.FULL_COMPLETED
     elif self._addReward:
         statusLabel = text_styles.bonusAppliedText(
             QUESTS.PERSONALMISSION_STATUS_ONLYADDDONE)
         status = MISSIONS_STATES.FULL_COMPLETED
     else:
         statusLabel = text_styles.bonusAppliedText(
             QUESTS.PERSONALMISSION_STATUS_ONLYMAINDONE)
     questText = _ms(_PM.QUESTAWARDSCREEN_QUEST,
                     quest=self._quest.getShortUserName())
     dataVO = {
         'bgImage':
         _OPERATION_ID_TO_UI_BACKGROUND.get(self._quest.getOperationID(),
                                            ''),
         'operationText':
         text_styles.promoTitle(
             _ms(_PM.QUESTAWARDSCREEN_OPERATION,
                 operation=self._operation.getUserName())),
         'questText':
         toUpper(questText),
         'statusLabel':
         statusLabel,
         'status':
         status,
         'ribbonData': {
             'ribbonType': 'ribbon1',
             'rendererLinkage': 'RibbonAwardAnimUI',
             'gap': 20,
             'rendererWidth': 80,
             'rendererHeight': 80,
             'awards': self.__packAwards(detailedData)
         }
     }
     dataVO.update(self.__packQuestConditions(detailedData))
     dataVO.update(self.__packNextQuestTitleSection(isFinal))
     dataVO.update(self.__packButtonsSection(isFinal))
     self.as_setDataS(dataVO)
    def __updateFooter(self):
        chainState = self.__getChainState(self.getChain())
        isQuestInProgress = False
        btnVisible = False
        btnEnabled = False
        btnLabel = ''
        descr = ''
        currentOperation = self.getOperation()
        chainClassifier = currentOperation.getChainClassifier(
            self.getChainID())
        vehicleClass = getTypeShortUserName(chainClassifier.classificationAttr)
        pm = self._eventsCache.getPersonalMissions()
        branch = self.getBranch()
        freeSheets = pm.getFreeTokensCount(branch)
        pawnedSheets = pm.getPawnedTokensCount(branch)
        if not chainState.hasUnlocked:
            status = text_styles.concatStylesWithSpace(
                icons.markerBlocked(),
                text_styles.error(PERSONAL_MISSIONS.STATUSPANEL_STATUS_LOCKED))
        elif chainState.questInProgress is not None:
            quest = chainState.questInProgress
            if quest.isOnPause:
                status = text_styles.concatStylesWithSpace(
                    icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ONPAUSE,
                                       16, 16, -3, 8),
                    text_styles.playerOnline(quest.getUserName()))
            else:
                isQuestInProgress = True
                status = text_styles.concatStylesWithSpace(
                    icons.inProgress(),
                    text_styles.tutorial(quest.getUserName()))
            if quest.areTokensPawned():
                descr = text_styles.neutral(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_PAWNED,
                        count=quest.getPawnCost(),
                        icon=getHtmlAwardSheetIcon(quest.getQuestBranch())))
            elif quest.isMainCompleted():
                descr = text_styles.neutral(
                    PERSONAL_MISSIONS.STATUSPANEL_STATUS_IMPROVE)
            elif quest.canBePawned() and not quest.isDisabled():
                btnVisible = True
                pawnCost = quest.getPawnCost()
                btnLabel = _ms(
                    PERSONAL_MISSIONS.STATUSPANEL_FREESHEETBTN_LABEL,
                    count=pawnCost,
                    icon=getHtmlAwardSheetIcon(quest.getQuestBranch()))
                if pawnCost <= freeSheets:
                    btnEnabled = True
        elif chainState.isFullCompleted:
            status = text_styles.concatStylesWithSpace(
                icons.doubleCheckmark(1),
                text_styles.bonusAppliedText(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_ALLEXCELLENTDONE,
                        vehicleClass=vehicleClass)))
        elif chainState.isCompleted:
            status = text_styles.concatStylesWithSpace(
                icons.checkmark(-2),
                text_styles.bonusAppliedText(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_ALLDONE,
                        vehicleClass=vehicleClass)))
        elif not chainState.hasVehicle:
            if self.getBranch() == PM_BRANCH.PERSONAL_MISSION_2:
                template = PERSONAL_MISSIONS.OPERATIONTITLE_LABEL_NOVEHICLE_PM2
            else:
                template = PERSONAL_MISSIONS.OPERATIONTITLE_LABEL_NOVEHICLE_REGULAR
            vehData = getChainVehRequirements(currentOperation,
                                              self.getChainID(),
                                              useIcons=False)
            status = text_styles.concatStylesWithSpace(
                icons.markerBlocked(),
                text_styles.error(_ms(template, vehData=vehData)))
        else:
            status = text_styles.concatStylesWithSpace(
                icons.makeImageTag(
                    RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16,
                    -2),
                text_styles.neutral(
                    PERSONAL_MISSIONS.STATUSPANEL_STATUS_SELECTTASK))
        tankwomanQuests = []
        for operation in pm.getAllOperations().itervalues():
            tankwomanQuests.extend(
                operation.getQuestsByFilter(
                    PersonalMission.needToGetTankWoman).itervalues())

        counterText = ''
        tankwomanVisible = False
        if tankwomanQuests:
            counterText = text_styles.highlightText('x%s' %
                                                    len(tankwomanQuests))
            tankwomanVisible = True
        self.as_setStatusDataS({
            'statusText': status,
            'descrText': descr,
            'btnVisible': btnVisible,
            'btnEnabled': btnEnabled,
            'btnLabel': btnLabel,
            'sheetsBlockData': {
                'freeSheetsIcon':
                AwardSheetPresenter.getIcon(AwardSheetPresenter.Size.MID),
                'freeSheetsText':
                text_styles.main(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_FREESHEETS,
                        count=text_styles.highlightText(freeSheets))),
                'pawnedSheetsText':
                text_styles.main(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_PAWNEDSHEETS,
                        count=text_styles.highlightText(pawnedSheets))),
                'tooltipData': {
                    'isSpecial':
                    True,
                    'specialAlias':
                    TOOLTIPS_CONSTANTS.FREE_SHEET_RETURN if freeSheets
                    or pawnedSheets else TOOLTIPS_CONSTANTS.FREE_SHEET,
                    'specialArgs': [currentOperation.getCampaignID()]
                },
                'popover':
                PERSONAL_MISSIONS_ALIASES.FREE_SHEET_POPOVER,
                'popoverData': {
                    'branch': branch
                }
            },
            'tankgirlsBlockData': {
                'counterText': counterText,
                'visible': tankwomanVisible,
                'tooltipData': {
                    'isSpecial': True,
                    'specialAlias':
                    TOOLTIPS_CONSTANTS.PERSONAL_MISSIONS_TANKWOMAN,
                    'specialArgs': []
                },
                'popover': PERSONAL_MISSIONS_ALIASES.TANK_GIRLS_POPOVER
            },
            'tooltip': None,
            'isQuestInProgress': isQuestInProgress
        })
        return
Example #4
0
 def __setData(self):
     detailedData = getDetailedMissionData(self._quest)
     status = MISSIONS_STATES.COMPLETED
     showExtraBtn = False
     isFinal = self._quest.isFinal()
     if self._isAwardListUsed:
         count = text_styles.stats(
             str(self._quest.getPawnCost()) +
             getHtmlAwardSheetIcon(self._quest.getQuestBranch()))
         statusLabel = text_styles.bonusAppliedText(
             _ms(QUESTS.PERSONALMISSION_STATUS_DONEWITHPAWN, count=count))
         if not isFinal:
             showExtraBtn = True
     elif self._mainReward and self._addReward:
         statusLabel = text_styles.bonusAppliedText(
             QUESTS.PERSONALMISSION_STATUS_FULLDONE)
         status = MISSIONS_STATES.FULL_COMPLETED
     elif self._addReward:
         statusLabel = text_styles.bonusAppliedText(
             QUESTS.PERSONALMISSION_STATUS_ONLYADDDONE)
     else:
         statusLabel = text_styles.bonusAppliedText(
             QUESTS.PERSONALMISSION_STATUS_ONLYMAINDONE)
         showExtraBtn = True
     questText = _ms(_PM.QUESTAWARDSCREEN_QUEST,
                     quest=self._quest.getShortUserName())
     dataVO = {
         'bgImage':
         _OPERATION_ID_TO_UI_BACKGROUND.get(self._quest.getOperationID(),
                                            ''),
         'operationText':
         text_styles.promoTitle(
             _ms(_PM.QUESTAWARDSCREEN_OPERATION,
                 operation=self._operation.getUserName())),
         'questText':
         toUpper(questText),
         'statusLabel':
         statusLabel,
         'status':
         status,
         'ribbonData': {
             'ribbonType': 'ribbon1',
             'rendererLinkage': 'RibbonAwardAnimUI',
             'gap': 20,
             'rendererWidth': 80,
             'rendererHeight': 80,
             'awards': self.__packAwards(detailedData)
         }
     }
     dataVO.update(self.__packQuestsConditions(detailedData))
     if self._addReward:
         if self._nextQuest:
             nextQuestTitle = _PM.QUESTAWARDSCREEN_NEXTQUEST_TITLE_QUESTACCEPT
             nextQuestText = self._nextQuest.getUserName()
             dataVO.update({
                 'nextQuestText':
                 text_styles.promoTitle(nextQuestText),
                 'nextQuestTitle':
                 text_styles.highlightText(nextQuestTitle)
             })
         else:
             chainName = getTypeShortUserName(
                 self._quest.getQuestClassifier().classificationAttr)
             nextQuestTitle = _ms(_PM.STATUSPANEL_STATUS_ALLDONE,
                                  vehicleClass=chainName)
             dataVO.update({
                 'nextQuestTitle':
                 text_styles.highlightText(nextQuestTitle)
             })
     elif self._isAwardListUsed and isFinal:
         dataVO.update({
             'nextQuestTitle':
             text_styles.highlightText(
                 QUESTS.PERSONALMISSION_STATUS_LASTDONEWITHPAWN)
         })
     else:
         dataVO.update(self.__getQuestImproveTitleData(self._quest))
     if showExtraBtn:
         extraLbl = _PM.QUESTAWARDSCREEN_RECRUITBTN_LABEL if isFinal else _PM.QUESTAWARDSCREEN_NEXTQUESTBTN_LABEL
         dataVO.update({
             'mainBtnLabel': _PM.QUESTAWARDSCREEN_CONTINUEBTN_LABEL,
             'extraBtnLabel': extraLbl
         })
     else:
         mainLbl = _PM.QUESTAWARDSCREEN_RECRUITBTN_LABEL if isFinal and self._mainReward else _PM.QUESTAWARDSCREEN_OKBTN_LABEL
         dataVO.update({'mainBtnLabel': mainLbl})
     self.as_setDataS(dataVO)
Example #5
0
 def _getStatusBlock(self, operation):
     if operation.isDisabled():
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.markerBlocked(-2),
                     text_styles.error(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE
                     )),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.main(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_DESCR_DISABLED),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     elif not operation.isUnlocked():
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.markerBlocked(-2),
                     text_styles.error(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE
                     )),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.main(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_DESCR_DOPREVOPERATION
                 ),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     elif operation.isFullCompleted():
         block = formatters.packAlignedTextBlockData(
             text=text_styles.concatStylesWithSpace(
                 icons.doubleCheckmark(1),
                 text_styles.bonusAppliedText(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_TITLE_EXCELLENTDONE)
             ),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=formatters.packPadding(top=-5, bottom=12))
     elif operation.isAwardAchieved():
         data = [
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.checkmark(-2),
                     text_styles.bonusAppliedText(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_DONE)),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5))
         ]
         currentCount = operation.getFreeTokensCount()
         totalCount = operation.getFreeTokensTotalCount()
         if currentCount < totalCount:
             data.append(
                 formatters.packAlignedTextBlockData(
                     text=text_styles.concatStylesToSingleLine(
                         text_styles.main(
                             TOOLTIPS.
                             PERSONALMISSIONS_OPERATION_FOOTER_DESCR_FREESHEETS
                         ),
                         missions_helper.getHtmlAwardSheetIcon(
                             operation.getBranch()),
                         text_styles.bonusAppliedText(currentCount),
                         text_styles.main(' / %s' % totalCount)),
                     align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                     padding=formatters.packPadding(bottom=14)))
         else:
             currentCount = len(operation.getFullCompletedQuests())
             totalCount = operation.getQuestsCount()
             data.append(
                 formatters.packAlignedTextBlockData(
                     text=text_styles.concatStylesToSingleLine(
                         text_styles.main(
                             TOOLTIPS.
                             PERSONALMISSIONS_OPERATION_FOOTER_DESCR_QUESTSFULLYDONE
                         ), text_styles.bonusAppliedText(currentCount),
                         text_styles.main(' / %s' % totalCount)),
                     align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                     padding=formatters.packPadding(bottom=14)))
         block = formatters.packBuildUpBlockData(data)
     elif operation.isInProgress():
         currentCount, totalCount = operation.getTokensCount()
         if operation.getBranch() == PM_BRANCH.PERSONAL_MISSION_2:
             footerDescrKey = TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_COMPLETIONTOKENS_PM2
         else:
             footerDescrKey = TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_COMPLETIONTOKENS
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.inProgress(-1),
                     text_styles.neutral(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_INPROGRESS)
                 ),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesToSingleLine(
                     text_styles.main(footerDescrKey),
                     text_styles.bonusAppliedText(currentCount),
                     text_styles.main(' / %s' % totalCount)),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     elif not operation.hasRequiredVehicles():
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.markerBlocked(-2),
                     text_styles.error(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE
                     )),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.main(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_DESCR_NOVEHICLE),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     else:
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.stats(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_TITLE_AVAILABLE),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.main(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_DESCR_SELECTQUEST),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     return block