コード例 #1
0
 def __setTotalData(self, *_):
     cart = getTotalPurchaseInfo(self.__purchaseItems)
     totalPriceVO = getItemPricesVO(cart.totalPrice)
     state = g_currentVehicle.getViewState()
     inFormationAlert = ''
     if not state.isCustomizationEnabled():
         inFormationAlert = text_styles.concatStylesWithSpace(icons.markerBlocked(), text_styles.error(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_FORMATION_ALERT))
     price = cart.totalPrice.price
     money = self.itemsCache.items.stats.money
     exchangeRate = self.itemsCache.items.shop.exchangeRate
     shortage = money.getShortage(price)
     if not shortage:
         self.__moneyState = _MoneyForPurchase.ENOUGH
     else:
         money = money - price + shortage
         price = shortage
         money = money.exchange(Currency.GOLD, Currency.CREDITS, exchangeRate, default=0)
         shortage = money.getShortage(price)
         if not shortage:
             self.__moneyState = _MoneyForPurchase.ENOUGH_WITH_EXCHANGE
         else:
             self.__moneyState = _MoneyForPurchase.NOT_ENOUGH
     validTransaction = self.__moneyState != _MoneyForPurchase.NOT_ENOUGH or Currency.GOLD in shortage.getCurrency() and isIngameShopEnabled()
     self.as_setTotalDataS({'totalLabel': text_styles.highTitle(_ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST, selected=cart.numSelected, total=cart.numApplying)),
      'enoughMoney': validTransaction,
      'inFormationAlert': inFormationAlert,
      'totalPrice': totalPriceVO[0]})
     self.__setBuyButtonState(validTransaction)
コード例 #2
0
 def _packProgressStateBlock(self):
     currentLevel = self._item.getLatestOpenedProgressionLevel(
         self.__vehicle)
     if currentLevel == -1 and self._progressionLevel == 1:
         currentLevel = 0
     if self._progressionLevel < 1:
         return None
     else:
         if currentLevel >= self._progressionLevel:
             desc = text_styles.concatStylesToSingleLine(
                 icons.checkmark(),
                 text_styles.bonusAppliedText(
                     getProgressionItemStatusText(self._progressionLevel)))
         elif currentLevel + 1 == self._progressionLevel:
             desc = text_styles.concatStylesToSingleLine(
                 icons.inProgress(),
                 text_styles.neutral(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.inProgressState())))
         else:
             desc = text_styles.concatStylesToSingleLine(
                 icons.markerBlocked(),
                 text_styles.error(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.notAvailableState.title())))
             desc = text_styles.concatStylesToMultiLine(
                 desc,
                 text_styles.main(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.notAvailableState.desc())))
         return formatters.packAlignedTextBlockData(
             text=desc, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
コード例 #3
0
 def __getUnlockedStatusFields(self):
     quest = self.event
     operations = events_helpers.getPersonalMissionsCache().getOperations()
     operationID = quest.getOperationID()
     operation = operations.get(operationID)
     if not operation.isUnlocked():
         prevOperationID = max(operationID - 1, 0)
         prevOperation = operations.get(prevOperationID)
         statusTooltipData = {'tooltip': makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYPREVOPERATION_HEADER, body=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYPREVOPERATION_BODY)}
         statusLabel = text_styles.error(icons.markerBlocked() + ' ' + _ms(QUESTS.PERSONALMISSION_STATUS_LOCKEDBYPREVOPERATION, prevCampaign=prevOperation.getShortUserName()))
     else:
         statusTooltipData = {'tooltip': makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYPREVMISSIONS_HEADER, body=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYPREVMISSIONS_BODY)}
         statusLabel = text_styles.error(icons.markerBlocked() + ' ' + _ms(QUESTS.PERSONALMISSION_STATUS_LOCKEDBYPREVMISSIONS))
     return {'addBottomStatusText': statusLabel,
      'status': MISSIONS_STATES.NOT_AVAILABLE,
      'bottomStatusTooltipData': statusTooltipData}
コード例 #4
0
 def _getStatusBlock(self, operation):
     _, postpone = missions_helper.getPostponedOperationState(
         operation.getID())
     return 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.concatStylesToSingleLine(
             text_styles.main(
                 TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_POSTPONED
             ),
             icons.makeImageTag(RES_ICONS.getPersonalMissionOperationState(
                 PERSONAL_MISSIONS_ALIASES.OPERATION_POSTPONED_STATE),
                                width=24,
                                height=24,
                                vSpace=-9),
             text_styles.vehicleStatusCriticalText(postpone)),
                                  align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                                  padding=formatters.packPadding(bottom=14))
     ])
コード例 #5
0
 def __getNoVehicleStatusFields(self):
     addBottomStatusText = text_styles.error(
         icons.markerBlocked() + ' ' +
         _ms(QUESTS.PERSONALMISSION_STATUS_LOCKEDBYVEHICLE))
     bottomStatusTooltipData = {
         'tooltip':
         makeTooltip(
             header=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYVEHICLE_HEADER,
             body=_ms(TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYVEHICLE_BODY,
                      vehType=', '.join([
                          _ms(MENU.classesShort(vehType))
                          for vehType in self.event.getVehicleClasses()
                      ]),
                      minLevel=int2roman(self.event.getVehMinLevel()),
                      maxLevel=int2roman(self.event.getVehMaxLevel())))
     }
     if self.event.isInProgress():
         statusData = self._getProgressStatusFields()
         statusData.update(addBottomStatusText=addBottomStatusText)
         statusData.update(bottomStatusTooltipData=bottomStatusTooltipData)
         return statusData
     if self.event.isMainCompleted():
         statusData = self._getCompleteStatusFields()
         statusData.update(addBottomStatusText=addBottomStatusText)
         statusData.update(bottomStatusTooltipData=bottomStatusTooltipData)
         return statusData
     return {
         'addBottomStatusText': addBottomStatusText,
         'status': MISSIONS_STATES.NOT_AVAILABLE,
         'bottomStatusTooltipData': bottomStatusTooltipData
     }
コード例 #6
0
 def __setTotalData(self, *_):
     cart = getTotalPurchaseInfo(self._purchaseItems)
     totalPriceVO = getItemPricesVO(cart.totalPrice)
     state = g_currentVehicle.getViewState()
     shortage = self.itemsCache.items.stats.money.getShortage(
         cart.totalPrice.price)
     inFormationAlert = ''
     if not state.isCustomizationEnabled():
         inFormationAlert = text_styles.concatStylesWithSpace(
             icons.markerBlocked(),
             text_styles.error(
                 VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_FORMATION_ALERT))
     self.as_setTotalDataS({
         'totalLabel':
         text_styles.highTitle(
             _ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST,
                 selected=cart.numSelected,
                 total=cart.numApplying)),
         'enoughMoney':
         getItemPricesVO(ItemPrice(shortage, shortage))[0],
         'inFormationAlert':
         inFormationAlert,
         'totalPrice':
         totalPriceVO[0]
     })
コード例 #7
0
 def __setTotalData(self, *args):
     if self.__controller.cart.processingMultiplePurchase:
         return
     priceGold = self.__controller.cart.totalPriceGold
     priceCredits = self.__controller.cart.totalPriceCredits
     notEnoughGoldTooltip = notEnoughCreditsTooltip = ''
     enoughGold = self.itemsCache.items.stats.gold >= priceGold
     enoughCredits = self.itemsCache.items.stats.credits >= priceCredits
     state = g_currentVehicle.getViewState()
     canBuy = bool(
         priceGold or priceCredits
     ) and enoughGold and enoughCredits and state.isCustomizationEnabled()
     if not enoughGold:
         diff = text_styles.gold(priceGold -
                                 self.itemsCache.items.stats.gold)
         notEnoughGoldTooltip = makeTooltip(
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER),
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_BODY,
                 count='{0}{1}'.format(diff, icons.gold())))
     if not enoughCredits:
         diff = text_styles.credits(priceCredits -
                                    self.itemsCache.items.stats.credits)
         notEnoughCreditsTooltip = makeTooltip(
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER),
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_BODY,
                 count='{0}{1}'.format(diff, icons.credits())))
     inFormationAlert = text_styles.concatStylesWithSpace(
         icons.markerBlocked(),
         text_styles.error(
             VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_FORMATION_ALERT)
     ) if not state.isCustomizationEnabled() else ''
     self.as_setTotalDataS({
         'credits':
         formatPriceCredits(priceCredits),
         'gold':
         formatPriceGold(priceGold),
         'totalLabel':
         text_styles.highTitle(
             _ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST,
                 selected=len(self.__searchDP.selectedItems),
                 total=len(self.__searchDP.items))),
         'enoughGold':
         enoughGold,
         'enoughCredits':
         enoughCredits,
         'notEnoughGoldTooltip':
         notEnoughGoldTooltip,
         'notEnoughCreditsTooltip':
         notEnoughCreditsTooltip,
         'inFormationAlert':
         inFormationAlert
     })
     self.as_setBuyBtnEnabledS(canBuy)
コード例 #8
0
 def __formatDescription(self, quests):
     season = self._eventProgression.getCurrentSeason(
     ) or self._eventProgression.getNextSeason()
     currentTime = time_utils.getCurrentLocalServerTimestamp()
     cycle = season.getCycleInfo()
     if not self._eventProgression.modeIsAvailable() or cycle is None:
         return ''
     elif self._eventProgression.isNeedAchieveMaxLevelForDailyQuest():
         maxLevel = self._eventProgression.getMaxPlayerLevel()
         description = backport.text(_R_EPIC_BATTLE.unavailable(),
                                     reason=backport.text(
                                         _R_EPIC_BATTLE.restrict.level(),
                                         level=maxLevel))
         return text_styles.concatStylesWithSpace(
             icons.markerBlocked(), text_styles.error(description))
     elif cycle.endDate - currentTime < time_utils.ONE_DAY:
         icon = icons.inProgress(vspace=-3)
         messageID = _R_EPIC_BATTLE.timeLeft
         valueStyle = text_styles.stats
         timeStr = valueStyle(
             backport.text(R.strings.epic_battle.questsTooltip.epicBattle.
                           lessThanDay()))
         textStyle = text_styles.main
         description = textStyle(
             backport.text(messageID(),
                           cycle=int2roman(cycle.ordinalNumber),
                           time=timeStr))
         return text_styles.concatStylesWithSpace(icon, description)
     elif all(
         (q.isCompleted() for q in quests
          )) and self._eventProgression.isDailyQuestsRefreshAvailable():
         data = time_utils.ONE_DAY - time_utils.getServerRegionalTimeCurrentDay(
         )
         valueStyle = text_styles.tutorial
         timeToStr = valueStyle(
             getTimeStr(data, R.strings.menu.Time.timeLeftShort))
         icon = icons.clockGold()
         textStyle = text_styles.tutorial
         description = textStyle(
             backport.text(_R_EPIC_BATTLE.startIn(), time=timeToStr))
         return text_styles.concatStylesWithSpace(icon, description)
     else:
         getDate = lambda c: c.endDate
         messageID = _R_EPIC_BATTLE.timeLeft
         icon = icons.inProgress(vspace=-3)
         textStyle = text_styles.main
         valueStyle = text_styles.stats
         timeToStr = valueStyle(
             getTimeStr(
                 getDate(cycle) - currentTime,
                 R.strings.menu.Time.timeLeftShort))
         description = textStyle(
             backport.text(messageID(),
                           cycle=int2roman(cycle.ordinalNumber),
                           time=timeToStr))
         return text_styles.concatStylesWithSpace(icon, description)
コード例 #9
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 packPerformanceWarningBlock(performanceGroup, leftPadding=0, rightPadding=0):
    attention = R.strings.epic_battle.selectorTooltip.epicBattle.attention
    if performanceGroup == BattleRoyalePerfProblems.HIGH_RISK:
        icon = icons.markerBlocked()
        titleStyle = text_styles.error
        attention = attention.assuredLowPerformance
    elif performanceGroup == BattleRoyalePerfProblems.MEDIUM_RISK:
        icon = icons.alert()
        titleStyle = text_styles.alert
        attention = attention.possibleLowPerformance
    else:
        icon = icons.attention()
        titleStyle = text_styles.stats
        attention = attention.informativeLowPerformance
    return formatters.packTitleDescBlock(title=text_styles.concatStylesWithSpace(icon, titleStyle(backport.text(attention.title()))), desc=text_styles.main(backport.text(attention.description())), padding=formatters.packPadding(left=leftPadding, right=rightPadding))
 def __packPerformanceWarningBlock(self):
     performanceGroup = self.__epicController.getPerformanceGroup()
     attention = R.strings.epic_battle.selectorTooltip.epicBattle.attention
     if performanceGroup == EPIC_PERF_GROUP.HIGH_RISK:
         icon = icons.markerBlocked()
         titleStyle = text_styles.error
         attention = attention.assuredLowPerformance
     elif performanceGroup == EPIC_PERF_GROUP.MEDIUM_RISK:
         icon = icons.alert()
         titleStyle = text_styles.alert
         attention = attention.possibleLowPerformance
     else:
         icon = icons.attention()
         titleStyle = text_styles.stats
         attention = attention.informativeLowPerformance
     return formatters.packTitleDescBlock(title=text_styles.concatStylesWithSpace(icon, titleStyle(backport.text(attention.title()))), desc=text_styles.main(backport.text(attention.description())), padding=formatters.packPadding(left=20, right=20))
コード例 #12
0
 def _populate(self):
     super(LobbyChannelWindow, self)._populate()
     channel = self._controller.getChannel()
     if self._controller.hasUntrustedMembers() and antispam_message.isShown(
     ):
         self.as_showWarningS('{} {}\n{}'.format(
             icons.markerBlocked(),
             text_styles.error(
                 i18n.makeString(
                     MESSENGER.CHAT_PERSONALMESSAGE_WARNINGHEAD)),
             i18n.makeString(MESSENGER.CHAT_PERSONALMESSAGE_WARNINGBODY)))
     if channel.haveMembers():
         membersDP = MembersDataProvider()
         membersDP.setFlashObject(self.as_getMembersDPS())
         self._controller.setMembersDP(membersDP)
     else:
         self.as_hideMembersListS()
コード例 #13
0
 def __getStatusText(self, isMain):
     if not self.__hasBattleProgress:
         return ''
     statusConditionValues = self.__getStatusConditionValues(isMain)
     if statusConditionValues:
         current, goal, state = statusConditionValues
         currentStr = BigWorld.wg_getNiceNumberFormat(current)
         goalStr = BigWorld.wg_getIntegralFormat(goal)
         if state == QUEST_PROGRESS_STATE.COMPLETED:
             return ''.join([
                 text_styles.bonusAppliedText(currentStr),
                 text_styles.success(' / %s' % goalStr)
             ])
         if state == QUEST_PROGRESS_STATE.FAILED:
             return text_styles.concatStylesWithSpace(
                 icons.markerBlocked(),
                 text_styles.error(QUESTS.PERSONALMISSION_STATUS_NOTDONE))
         return ''.join([
             text_styles.stats(currentStr),
             text_styles.main(' / %s' % goalStr)
         ])
コード例 #14
0
 def __packDescription(self, quests, season, isLeagues, isAnyPrimeNow,
                       isAnyPrimeLeftTotal):
     resShortCut = R.strings.ranked_battles.questsTooltip
     isAllCompleted = all((q.isCompleted() for q in quests))
     isAnyPrimeLeftNextDay = self.__rankedController.hasPrimeTimesNextDayLeft(
     )
     icon = icons.markerBlocked()
     timeDelta = time_utils.getTimeDeltaFromNowInLocal(
         time_utils.makeLocalServerTime(season.getEndDate()))
     timeDeltaStr = text_styles.stats(
         backport.getTillTimeStringByRClass(timeDelta,
                                            resShortCut.available))
     text = text_styles.main(
         backport.text(resShortCut.available(), timeDelta=timeDeltaStr))
     if not isAnyPrimeLeftTotal:
         text = text_styles.error(
             backport.getTillTimeStringByRClass(
                 timeDelta, resShortCut.unavailable.seasonEnd))
     elif not isLeagues:
         text = text_styles.error(
             backport.text(resShortCut.unavailable.notInLeagues()))
     elif not isAllCompleted:
         if isAnyPrimeNow:
             icon = icons.inProgress(vspace=-3)
         else:
             text = text_styles.error(
                 backport.text(resShortCut.unavailable.allServersPrime()))
     elif not isAnyPrimeLeftNextDay:
         icon = icons.inProgress(vspace=-3)
     else:
         icon = icons.clockGold()
         timeDelta = EventInfoModel.getDailyProgressResetTimeDelta()
         text = text_styles.tutorial(
             backport.getTillTimeStringByRClass(timeDelta,
                                                resShortCut.cooldown))
     return text_styles.concatStylesWithSpace(icon, text)
コード例 #15
0
    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
コード例 #16
0
 def _getStatusBlock(self, operation):
     if 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.AWARD_SHEET_ICON,
                         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(True))
             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()
         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(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_DESCR_COMPLETIONTOKENS
                     ), 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
コード例 #17
0
    def __updateFooter(self):
        chainState = self.__getChainState(self.getChain())
        isQuestInProgress = False
        btnVisible = False
        btnEnabled = False
        btnLabel = ''
        descr = ''
        currentOperation = self.getOperation()
        currentVehicleType = currentOperation.getChainVehicleClass(
            self.getChainID())
        vehicleClass = getTypeShortUserName(currentVehicleType)
        pm = self._eventsCache.personalMissions
        freeSheets = pm.getFreeTokensCount()
        pawnedSheets = pm.getPawnedTokensCount()
        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
            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=icons.makeImageTag(
                            RES_ICONS.
                            MAPS_ICONS_PERSONALMISSIONS_SHEET_RECEIVED_SMALL,
                            16, 16, -3, 8)))
            elif quest.isMainCompleted():
                descr = text_styles.neutral(
                    PERSONAL_MISSIONS.STATUSPANEL_STATUS_IMPROVE)
            elif quest.canBePawned():
                btnVisible = True
                pawnCost = quest.getPawnCost()
                btnLabel = _ms(
                    PERSONAL_MISSIONS.STATUSPANEL_FREESHEETBTN_LABEL,
                    count=pawnCost,
                    icon=icons.makeImageTag(
                        RES_ICONS.
                        MAPS_ICONS_PERSONALMISSIONS_SHEET_RECEIVED_SMALL, 16,
                        16, -3, 8))
                if pawnCost <= freeSheets:
                    btnEnabled = True
        elif chainState.isFullCompleted:
            status = text_styles.concatStylesWithSpace(
                icons.checkmark(-2),
                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:
            status = text_styles.concatStylesWithSpace(
                icons.markerBlocked(),
                text_styles.error(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_NOVEHICLE,
                        vehicleClass=vehicleClass)))
        else:
            status = text_styles.concatStylesWithSpace(
                icons.makeImageTag(
                    RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16,
                    -2),
                text_styles.neutral(
                    PERSONAL_MISSIONS.STATUSPANEL_STATUS_SELECTTASK))

        def tankwomanFilter(quest):
            tankman, isMainBonus = quest.getTankmanBonus()
            return tankman and (quest.needToGetAddReward() and not isMainBonus
                                or quest.needToGetMainReward() and isMainBonus)

        tankwomanQuests = []
        for operation in pm.getOperations().itervalues():
            tankwomanQuests.extend(
                operation.getQuestsByFilter(tankwomanFilter).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': {
                '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': []
                },
                'popover':
                PERSONAL_MISSIONS_ALIASES.FREE_SHEET_POPOVER
            },
            '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