def _getCompleteStatusFields(self, *args): quest = self.event if quest.areTokensPawned(): statusTooltipData = { 'tooltip': makeTooltip( header=TOOLTIPS. PERSONALMISSIONS_STATUS_DONEWITHPAWN_HEADER, body=TOOLTIPS.PERSONALMISSIONS_STATUS_DONEWITHPAWN_BODY) } count = text_styles.stats( str(quest.getPawnCost()) + AWARD_SHEET_ICON) statusLabel = text_styles.bonusAppliedText( icons.checkmark() + _ms(QUESTS.PERSONALMISSION_STATUS_DONEWITHPAWN, count=count)) else: statusLabel = text_styles.bonusAppliedText( icons.checkmark() + _ms(QUESTS.PERSONALMISSION_STATUS_MAINDONE)) statusTooltipData = { 'tooltip': makeTooltip( header=TOOLTIPS.PERSONALMISSIONS_STATUS_MAINDONE_HEADER, body=TOOLTIPS.PERSONALMISSIONS_STATUS_MAINDONE_BODY) } return { 'statusLabel': statusLabel, 'status': MISSIONS_STATES.COMPLETED, 'statusTooltipData': statusTooltipData }
def __getSkillTexts(skillLearnt, replaceText, boostText, applyStyles): if applyStyles: if skillLearnt: return (text_styles.main(replaceText), text_styles.bonusAppliedText(boostText)) else: return (text_styles.bonusAppliedText(replaceText), text_styles.main(boostText)) else: return (text_styles.main(replaceText), text_styles.main(boostText))
def construct(self): module = self.module block = [] def checkLocalization(key): localization = _ms('#artefacts:%s' % key) return (key != localization, localization) if self.lobbyContext.getServerSettings( ).spgRedesignFeatures.isStunEnabled(): isRemovingStun = module.isRemovingStun else: isRemovingStun = False onUseStr = '%s/removingStun/onUse' if isRemovingStun else '%s/onUse' onUse = checkLocalization(onUseStr % module.descriptor.name) always = checkLocalization('%s/always' % module.descriptor.name) restriction = checkLocalization('%s/restriction' % module.descriptor.name) if bonus_helper.isSituationalBonus(module.name): effectDesc = text_styles.bonusPreviewText( _ms(module.shortDescription)) icon = icons.makeImageTag( RES_ICONS.MAPS_ICONS_TOOLTIP_ASTERISK_OPTIONAL, 16, 16, 0, 4) desc = params_formatters.packSituationalIcon(effectDesc, icon) else: desc = text_styles.bonusAppliedText(_ms(module.shortDescription)) if module.itemTypeID == ITEM_TYPES.optionalDevice: block.append( formatters.packTitleDescBlock( title='', desc=desc, padding=formatters.packPadding(top=-8))) else: topPadding = 0 if always[0] and len(always[1]) > 0: block.append( formatters.packTitleDescBlock( title=text_styles.middleTitle( TOOLTIPS.EQUIPMENT_ALWAYS), desc=text_styles.bonusAppliedText(always[1]))) topPadding = 5 if onUse[0] and len(onUse[1]) > 0: block.append( formatters.packTitleDescBlock( title=text_styles.middleTitle( TOOLTIPS.EQUIPMENT_ONUSE), desc=text_styles.main(onUse[1]), padding=formatters.packPadding(top=topPadding))) topPadding = 5 if restriction[0] and len(restriction[1]) > 0: block.append( formatters.packTitleDescBlock( title=text_styles.middleTitle( TOOLTIPS.EQUIPMENT_RESTRICTION), desc=text_styles.main(restriction[1]), padding=formatters.packPadding(top=topPadding))) return block
def _getCompleteLabel(cls, progress): currentProgress = '%s / %s' % (text_styles.bonusAppliedText( progress.getCurrent()), text_styles.success(progress.getGoal())) label = i18n.makeString( PERSONAL_MISSIONS.CONDITIONS_CURRENTPROGRESS_BOTTOMLABEL, currentProgress=currentProgress) status = text_styles.bonusAppliedText( PERSONAL_MISSIONS.CONDITIONS_COMPLETED_BOTTOMLABEL) return '%s %s' % (label, status)
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 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
def _getStatus(self, pCur=None, pmComplete=None): if pmComplete: if pmComplete.isAddComplete: msg = text_styles.bonusAppliedText( QUESTS.PERSONALMISSION_STATUS_FULLDONE) return (PERSONAL_MISSIONS_ALIASES.POST_BATTLE_STATE_FULL_DONE, msg) if pmComplete.isMainComplete: msg = text_styles.bonusAppliedText( QUESTS.PERSONALMISSION_STATUS_MAINDONE) return (PERSONAL_MISSIONS_ALIASES.POST_BATTLE_STATE_DONE, msg) msg = text_styles.neutral(QUESTS.PERSONALMISSION_STATUS_INPROGRESS) return (PERSONAL_MISSIONS_ALIASES.POST_BATTLE_STATE_IN_PROGRESS, msg)
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 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
def _getCompleteStatusFields(self, isLimited, bonusCount, bonusLimit): """ Gets status fields data for completed mission state. Data used in detailed mission view to display its completed state. For completed daily quests return unavailable state fields. """ statusTooltipData = None dateLabel = self._getActiveTimeDateLabel() resetDateLabel = '' status = EVENT_STATUS.COMPLETED if isLimited and bonusLimit > 1: statusLabel = text_styles.bonusAppliedText( _ms(QUESTS.MISSIONDETAILS_MISSIONSCOMPLETE, count=text_styles.bonusAppliedText(bonusCount), total=text_styles.standard(bonusLimit))) statusTooltipData = getCompletetBonusLimitTooltip() else: progressDesc = text_styles.success(_ms(QUESTS.QUESTS_STATUS_DONE)) icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_OKICON, 16, 16, -2, 8) statusLabel = text_styles.concatStylesToSingleLine( icon, progressDesc) if self.event.bonusCond.isDaily(): status = EVENT_STATUS.NOT_AVAILABLE dateLabel = text_styles.concatStylesWithSpace( icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_TIMERICON, 16, 16, -2, 8), text_styles.error(QUESTS.MISSIONDETAILS_STATUS_NOTAVAILABLE), self._getCompleteDailyStatus( QUESTS.MISSIONDETAILS_STATUS_COMPLETED_DAILY)) resetDateLabel = self._getDailyResetStatusLabel() return { 'statusLabel': statusLabel, 'dateLabel': dateLabel, 'status': status, 'bottomStatusText': text_styles.concatStylesWithSpace( icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_DONE, 32, 32, -8), text_styles.missionStatusAvailable( QUESTS.MISSIONDETAILS_BOTTOMSTATUSCOMPLETE)), 'statusTooltipData': statusTooltipData, 'resetDateLabel': resetDateLabel }
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 construct(self): block = [] module = self.module vehicle = self.configuration.vehicle header = formatters.packTextBlockData( text=text_styles.middleTitle( backport.text( R.strings.tooltips.battleBooster.installationEffects())), padding=formatters.packPadding(bottom=5)) block.append(header) if module.isCrewBooster(): skillLearnt = module.isAffectedSkillLearnt(vehicle) skillName = backport.text( R.strings.item_types.tankman.skills.dyn( module.getAffectedSkillName())()) replaceText = module.getCrewBoosterAction(True) boostText = module.getCrewBoosterAction(False) skillNotLearntText = text_styles.standard( backport.text( R.strings.tooltips.battleBooster.skill.not_learnt())) skillLearntText = text_styles.standard( backport.text(R.strings.tooltips.battleBooster.skill.learnt())) applyStyles = vehicle is not None replaceText, boostText = self.__getSkillTexts( skillLearnt, replaceText, boostText, applyStyles) block.append( formatters.packImageTextBlockData( title=replaceText, img=backport.image( R.images.gui.maps.icons.buttons.checkmark()) if not skillLearnt and applyStyles else None, imgPadding=formatters.packPadding(left=2, top=3), txtOffset=20)) block.append( formatters.packImageTextBlockData(title=skillNotLearntText % skillName, txtOffset=20)) block.append( formatters.packImageTextBlockData( title=boostText, img=backport.image( R.images.gui.maps.icons.buttons.checkmark()) if skillLearnt and applyStyles else None, imgPadding=formatters.packPadding(left=2, top=3), txtOffset=20, padding=formatters.packPadding(top=15))) block.append( formatters.packImageTextBlockData(title=skillLearntText % skillName, txtOffset=20)) else: block.append( formatters.packTextParameterBlockData( text_styles.main( module.shortDescription.replace('%s ', '', 1)), text_styles.bonusAppliedText( module.getOptDeviceBoosterGainValue(vehicle=vehicle)), valueWidth=110, gap=15)) return block
def __getSlotBonusString(self, qualifier, isInDossier): bonus = makeHtmlString('html_templates:lobby/customization', 'bonusString', {'bonusIcon': getAbsoluteUrl(qualifier.getIcon16x16()), 'bonusValue': qualifier.getValue(), 'isConditional': '' if qualifier.getDescription() is None else '*'}) if not isInDossier: bonus = text_styles.bonusAppliedText(bonus) return bonus
def getEfficiencyVO(currentSeasonEfficiency, currentSeasonEfficiencyDiff): delta = '' if currentSeasonEfficiencyDiff is not None: if currentSeasonEfficiencyDiff > 0: delta = text_styles.concatStylesToSingleLine( icons.makeImageTag( backport.image(R.images.gui.maps.icons.rankedBattles. league.delta_plus()), 11, 16, -3), text_styles.bonusAppliedText( ranked_formatters.getFloatPercentStrStat( currentSeasonEfficiencyDiff))) if currentSeasonEfficiencyDiff < 0: delta = text_styles.concatStylesToSingleLine( icons.makeImageTag( backport.image(R.images.gui.maps.icons.rankedBattles. league.delta_minus()), 11, 16, -3), text_styles.error( ranked_formatters.getFloatPercentStrStat( currentSeasonEfficiencyDiff))) return { 'icon': 'efficiency', 'label': '', 'value': ranked_formatters.getFloatPercentStrStat(currentSeasonEfficiency), 'delta': delta }
def __updateSelectedVehicle(self): vehicle = g_currentVehicle.item suitableVehicles = self._carousel.getSuitableVehicles() if self.__isQuestForBattleRoyale: selectedVeh = None status = '' title = '' else: if suitableVehicles and vehicle and vehicle.intCD in suitableVehicles: selectedVeh = getVehicleDataVO(vehicle) selectedVeh.update({'tooltip': TOOLTIPS.MISSIONS_VEHICLE_SELECTOR_LIST}) status = text_styles.bonusAppliedText(QUESTS.MISSIONS_VEHICLESELECTOR_STATUS_SELECTED) elif suitableVehicles: label = QUESTS.MISSIONS_VEHICLESELECTOR_STATUS_SELECT style = text_styles.premiumVehicleName selectedVeh = {'buyTank': True, 'iconSmall': RES_ICONS.MAPS_ICONS_LIBRARY_EMPTY_SELECTION, 'smallInfoText': style(label), 'tooltip': TOOLTIPS.MISSIONS_VEHICLE_SELECTOR_SELECT} status = '' else: label = QUESTS.MISSIONS_VEHICLESELECTOR_STATUS_LIST style = text_styles.premiumVehicleName selectedVeh = {'buyTank': True, 'iconSmall': RES_ICONS.MAPS_ICONS_LIBRARY_EMPTY_SELECTION, 'smallInfoText': style(label), 'tooltip': TOOLTIPS.MISSIONS_VEHICLE_SELECTOR_LIST} status = self._getNotAvailableStatusText() selectedVeh.update(isUseRightBtn=False) selectedVeh.update(clickEnabled=True) title = self._getTitle() self.as_setInitDataS({'title': title, 'statusText': status}) self.as_showSelectedVehicleS(selectedVeh) return
def _getCompleteStatusFields(self, *args): quest = self.event addBottomStatusText = self.__getAddBottomInfo() if quest.areTokensPawned(): statusTooltipData = {'tooltip': makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_STATUS_DONEWITHPAWN_HEADER, body=TOOLTIPS.PERSONALMISSIONS_STATUS_DONEWITHPAWN_BODY)} count = text_styles.stats(str(quest.getPawnCost()) + getHtmlAwardSheetIcon(quest.getQuestBranch())) statusLabel = text_styles.bonusAppliedText(_ms(QUESTS.PERSONALMISSION_STATUS_DONEWITHPAWN, count=count)) else: statusLabel = text_styles.bonusAppliedText(QUESTS.PERSONALMISSION_STATUS_MAINDONE) statusTooltipData = {'tooltip': makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_STATUS_MAINDONE_HEADER, body=TOOLTIPS.PERSONALMISSIONS_STATUS_MAINDONE_BODY)} showIcon = False return {'showIcon': showIcon, 'addBottomStatusText': addBottomStatusText, 'statusLabel': statusLabel, 'status': MISSIONS_STATES.COMPLETED, 'statusTooltipData': statusTooltipData}
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)
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 minimizedTitleCumulativeFormat(current, total): if current == total: current = text_styles.bonusAppliedText(BigWorld.wg_getNiceNumberFormat(int(current))) else: current = text_styles.stats(BigWorld.wg_getNiceNumberFormat(int(current))) total = text_styles.standard(int(total)) return text_styles.disabled('%s / %s' % (current, total))
def _getSlotBonusString(qualifier, isInDossier): bonus = makeHtmlString('html_templates:lobby/customization', 'bonusString', {'bonusIcon': getAbsoluteUrl(qualifier.getIcon16x16()), 'bonusValue': qualifier.getValue(), 'isConditional': '' if qualifier.getDescription() is None else '*'}) if not isInDossier: bonus = text_styles.bonusAppliedText(bonus) return bonus
def getCounterText(self): if self.gotCount == self.needCount: tokensGot = text_styles.bonusAppliedText(self.gotCount) else: tokensGot = text_styles.stats(self.gotCount) tokensNeed = text_styles.standard(self.needCount) return text_styles.disabled('{} / {}'.format(tokensGot, tokensNeed))
def __setAppliedState(self): self.xpValue = '' self.statusBonusLabel = '{}{}'.format( makeImageTag(source=backport.image( R.images.gui.maps.icons.library.ConfirmIcon_1())), text_styles.bonusAppliedText( backport.text(R.strings.battle_results.common.premiumBonus. appliedBonus())))
def _getCompleteStatusFields(self, isLimited, bonusCount, bonusLimit): """ Gets status fields data for completed mission state. Data used in mission card to display its completed state. For completed daily quests return unavailable state fields. """ if self.event.bonusCond.isDaily(): status = EVENT_STATUS.NOT_AVAILABLE clockIcon = icons.makeImageTag( RES_ICONS.MAPS_ICONS_LIBRARY_TIMERICON, 16, 16, -2, 8) statusText = _ms(QUESTS.MISSIONDETAILS_STATUS_NOTAVAILABLE) statusLabel = text_styles.concatStylesWithSpace( clockIcon, text_styles.error(statusText)) statusTooltipData = { 'tooltip': makeTooltip( _ms(TOOLTIPS.QUESTS_UNAVAILABLE_TIME_STATUSTOOLTIP), self._getCompleteDailyStatus( QUESTS.MISSIONDETAILS_STATUS_COMPLETED_DAILY)), 'isSpecial': False, 'args': None } else: status = EVENT_STATUS.COMPLETED if isLimited and bonusLimit > 1: statusLabel = text_styles.bonusAppliedText( _ms(QUESTS.MISSIONDETAILS_MISSIONSCOMPLETE, count=text_styles.bonusAppliedText(bonusCount), total=text_styles.standard(bonusLimit))) statusTooltipData = getCompletetBonusLimitTooltip() else: statusTooltipData = None progressDesc = text_styles.success( _ms(QUESTS.QUESTS_STATUS_DONE)) icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_OKICON, 16, 16, -2, 8) statusLabel = text_styles.concatStylesToSingleLine( icon, progressDesc) return { 'statusLabel': statusLabel, 'status': status, 'statusTooltipData': statusTooltipData }
def construct(self): module = self.module block = [] def checkLocalization(key): localization = _ms('#artefacts:%s' % key) return (key != localization, localization) onUse = checkLocalization('%s/onUse' % module.descriptor['name']) always = checkLocalization('%s/always' % module.descriptor['name']) restriction = checkLocalization('%s/restriction' % module.descriptor['name']) if module.itemTypeID == ITEM_TYPES.optionalDevice: block.append( formatters.packTitleDescBlock( title='', desc=text_styles.bonusAppliedText(module.shortDescription), padding=formatters.packPadding(top=-8))) else: topPadding = 0 if always[0] and len(always[1]) > 0: block.append( formatters.packTitleDescBlock( title=text_styles.middleTitle( TOOLTIPS.EQUIPMENT_ALWAYS), desc=text_styles.bonusAppliedText(always[1]))) topPadding = 5 if onUse[0] and len(onUse[1]) > 0: block.append( formatters.packTitleDescBlock( title=text_styles.middleTitle( TOOLTIPS.EQUIPMENT_ONUSE), desc=text_styles.main(onUse[1]), padding=formatters.packPadding(top=topPadding))) topPadding = 5 if restriction[0] and len(restriction[1]) > 0: block.append( formatters.packTitleDescBlock( title=text_styles.middleTitle( TOOLTIPS.EQUIPMENT_RESTRICTION), desc=text_styles.main(restriction[1]), padding=formatters.packPadding(top=topPadding))) return block
def __collectSideBarData(self): currentOperation = self.getOperation() chains = [] if self.getBranch() == PM_BRANCH.PERSONAL_MISSION_2: tooltip = TOOLTIPS_CONSTANTS.OPERATIONS_CHAIN_DETAILS else: tooltip = None for classifierAttr in currentOperation.getIterationChain(): chainID, q = currentOperation.getChainByClassifierAttr( classifierAttr) chainState = self.__getChainState(q) progress = self.__getProgress(q) if chainState.isCompleted: currentProgress = text_styles.bonusAppliedText( progress['value']) else: currentProgress = text_styles.stats(progress['value']) if chainID == self.getChainID(): label = text_styles.tutorial( currentOperation.getChainName(chainID)) 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': currentOperation.getChainIcon(chainID), 'progress': progress, 'tooltip': tooltip }) return chains
def _getFullCompleteStatusFields(self): quest = self.event statusTooltipData = {'tooltip': makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_STATUS_FULLDONE_HEADER, body=TOOLTIPS.PERSONALMISSIONS_STATUS_FULLDONE_BODY)} statusLabel = text_styles.bonusAppliedText(icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_DOUBLECHECKMARK, vSpace=-2) + ' ' + _ms(QUESTS.PERSONALMISSION_STATUS_FULLDONE)) bottomStatusText = '' if quest.isDone(): bottomStatusText = text_styles.missionStatusAvailable(QUESTS.PERSONALMISSION_BOTTOMSTATUS_ALLAWARDSRECEIVED) return {'statusLabel': statusLabel, 'status': MISSIONS_STATES.FULL_COMPLETED, 'statusTooltipData': statusTooltipData, 'bottomStatusText': bottomStatusText}
def __getStatusText(self, isMain): if not self.__hasBattleProgress: return '' statusConditionValues = self.__getStatusConditionValues(isMain) if statusConditionValues: current, goal, isCompleted = statusConditionValues currentStr = BigWorld.wg_getIntegralFormat(current) goalStr = BigWorld.wg_getIntegralFormat(goal) if isCompleted: return ''.join([text_styles.bonusAppliedText(currentStr), text_styles.success(' / %s' % goalStr)]) return ''.join([text_styles.stats(currentStr), text_styles.main(' / %s' % goalStr)])
def _getFullCompleteStatusFields(self): quest = self.event statusTooltipData = {'tooltip': makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_STATUS_FULLDONE_HEADER, body=TOOLTIPS.PERSONALMISSIONS_STATUS_FULLDONE_BODY)} statusLabel = text_styles.bonusAppliedText(QUESTS.PERSONALMISSION_STATUS_FULLDONE) bottomStatusText = '' if quest.isDone(): bottomStatusText = text_styles.missionStatusAvailable(QUESTS.PERSONALMISSION_BOTTOMSTATUS_ALLAWARDSRECEIVED) showIcon = False return {'showIcon': showIcon, 'statusLabel': statusLabel, 'status': MISSIONS_STATES.FULL_COMPLETED, 'statusTooltipData': statusTooltipData, 'bottomStatusText': bottomStatusText}
def packTokenProgress(tokenId, questId, title, image, gotCount, needCount, isBigSize = False): if gotCount == needCount: tokensGot = text_styles.bonusAppliedText(gotCount) else: tokensGot = text_styles.stats(gotCount) tokensNeed = text_styles.standard(needCount) counterText = text_styles.disabled('{} / {}'.format(tokensGot, tokensNeed)) return {'tokenId': tokenId, 'questId': questId, 'titleText': title, 'isNormalSize': not isBigSize, 'imgSrc': image, 'countText': counterText}
def _getPreformattedTankwomanBonus(self, operation): if not operation.isFullCompleted(): current, total = _getTankwomansCountInOperation(operation) currentStr = text_styles.bonusAppliedText( current) if current else text_styles.stats(current) images = dict(((size, RES_ICONS.getBonusIcon(size, 'tankwoman')) for size in AWARDS_SIZES.ALL())) return PreformattedBonus(bonusName=self._TANKWOMAN_BONUS, label='%s / %s' % (currentStr, str(total)), images=images, labelFormatter=text_styles.main) else: return None
def __packBonusBlock(self): blocks = [ formatters.packTextParameterBlockData( name=self.__camo.bonus.description, value=text_styles.bonusAppliedText('+{}'.format( self.__camo.bonus.getFormattedValue(self.__vehicle))), valueWidth=53, gap=18, padding=formatters.packPadding(top=-5, bottom=-7)) ] return formatters.packBuildUpBlockData( blocks, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE )
def construct(self): module = self.module block = [] def checkLocalization(key): localization = _ms('#artefacts:%s' % key) return (key != localization, localization) onUse = checkLocalization('%s/onUse' % module.descriptor['name']) always = checkLocalization('%s/always' % module.descriptor['name']) restriction = checkLocalization('%s/restriction' % module.descriptor['name']) if module.itemTypeID == ITEM_TYPES.optionalDevice: block.append(formatters.packTitleDescBlock(title='', desc=text_styles.bonusAppliedText(module.shortDescription), padding=formatters.packPadding(top=-8))) else: topPadding = 0 if always[0] and len(always[1]) > 0: block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(TOOLTIPS.EQUIPMENT_ALWAYS), desc=text_styles.bonusAppliedText(always[1]))) topPadding = 5 if onUse[0] and len(onUse[1]) > 0: block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(TOOLTIPS.EQUIPMENT_ONUSE), desc=text_styles.main(onUse[1]), padding=formatters.packPadding(top=topPadding))) topPadding = 5 if restriction[0] and len(restriction[1]) > 0: block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(TOOLTIPS.EQUIPMENT_RESTRICTION), desc=text_styles.main(restriction[1]), padding=formatters.packPadding(top=topPadding))) return block
def __setAnimations(self): for qTypeName in QUALIFIER_TYPE_NAMES.iterkeys(): oldBonusAppliedCount = self.__bonusData[qTypeName]["oldBonusAppliedCount"] appliedBonusValue = self.__bonusData[qTypeName]["bonusAppliedCount"] oldBonusTotalCount = self.__bonusData[qTypeName]["oldBonusTotalCount"] bonusTotalCount = self.__bonusData[qTypeName]["bonusTotalCount"] formattedString = "+{0}%" bonusFormatter = text_styles.bonusAppliedText color = CUSTOMIZATION_BONUS_ANIMATION_TYPES.COLOR_GREEN additionalValue = "" if oldBonusTotalCount != bonusTotalCount: if self.__animationStarted: animationType = CUSTOMIZATION_BONUS_ANIMATION_TYPES.BUY else: animationType = CUSTOMIZATION_BONUS_ANIMATION_TYPES.NONE bonusFormatter = text_styles.bonusLocalText animationValue = bonusTotalCount if appliedBonusValue > 0: additionalValue = text_styles.bonusAppliedText("+{0}%".format(appliedBonusValue)) elif appliedBonusValue < 0: additionalValue = text_styles.error("{0}%".format(appliedBonusValue)) if self.__bonusData[qTypeName]["bonusTotalDescriptionCount"] != 0: formattedString += "*" elif appliedBonusValue == oldBonusAppliedCount: animationType = CUSTOMIZATION_BONUS_ANIMATION_TYPES.NONE bonusFormatter = text_styles.bonusLocalText animationValue = bonusTotalCount if appliedBonusValue > 0: additionalValue = text_styles.bonusAppliedText("+{0}%".format(appliedBonusValue)) elif appliedBonusValue < 0: additionalValue = text_styles.error("{0}%".format(appliedBonusValue)) if self.__bonusData[qTypeName]["bonusTotalDescriptionCount"] != 0: formattedString += "*" elif appliedBonusValue == 0: if oldBonusAppliedCount < 0: formattedString = "{0}%" bonusFormatter = text_styles.error color = CUSTOMIZATION_BONUS_ANIMATION_TYPES.COLOR_RED animationType = CUSTOMIZATION_BONUS_ANIMATION_TYPES.RESET animationValue = oldBonusAppliedCount if self.__bonusData[qTypeName]["bonusAppliedDescriptionCount"] != 0: formattedString += "*" else: if appliedBonusValue < 0: formattedString = "{0}%" bonusFormatter = text_styles.error color = CUSTOMIZATION_BONUS_ANIMATION_TYPES.COLOR_RED animationType = CUSTOMIZATION_BONUS_ANIMATION_TYPES.SET animationValue = appliedBonusValue if self.__bonusData[qTypeName]["bonusAppliedDescriptionCount"] != 0: formattedString += "*" self.__bonusData[qTypeName]["oldBonusAppliedCount"] = appliedBonusValue self.__bonusData[qTypeName]["oldBonusTotalCount"] = bonusTotalCount self.__bonusData[qTypeName]["animationPanel"] = { "animationType": animationType, "install": False, "color": color, "value1": bonusFormatter(formattedString.format(animationValue)), "value2": additionalValue, } self.__animationStarted = True self.__processingPurchase = False
def __setAnimations(self): for qTypeName in QUALIFIER_TYPE_NAMES.iterkeys(): oldBonusAppliedCount = self.__bonusData[qTypeName]['oldBonusAppliedCount'] appliedBonusValue = self.__bonusData[qTypeName]['bonusAppliedCount'] oldBonusTotalCount = self.__bonusData[qTypeName]['oldBonusTotalCount'] bonusTotalCount = self.__bonusData[qTypeName]['bonusTotalCount'] formattedString = '+{0}%' bonusFormatter = text_styles.bonusAppliedText color = CUSTOMIZATION_BONUS_ANIMATION_TYPES.COLOR_GREEN additionalValue = '' if oldBonusTotalCount != bonusTotalCount: if self.__animationStarted: animationType = CUSTOMIZATION_BONUS_ANIMATION_TYPES.BUY else: animationType = CUSTOMIZATION_BONUS_ANIMATION_TYPES.NONE bonusFormatter = text_styles.bonusLocalText animationValue = bonusTotalCount if appliedBonusValue > 0: additionalValue = text_styles.bonusAppliedText('+{0}%'.format(appliedBonusValue)) elif appliedBonusValue < 0: additionalValue = text_styles.error('{0}%'.format(appliedBonusValue)) if self.__bonusData[qTypeName]['bonusTotalDescriptionCount'] != 0: formattedString += '*' elif appliedBonusValue == oldBonusAppliedCount: animationType = CUSTOMIZATION_BONUS_ANIMATION_TYPES.NONE bonusFormatter = text_styles.bonusLocalText animationValue = bonusTotalCount if appliedBonusValue > 0: additionalValue = text_styles.bonusAppliedText('+{0}%'.format(appliedBonusValue)) elif appliedBonusValue < 0: additionalValue = text_styles.error('{0}%'.format(appliedBonusValue)) if self.__bonusData[qTypeName]['bonusTotalDescriptionCount'] != 0: formattedString += '*' elif appliedBonusValue == 0: if oldBonusAppliedCount < 0: formattedString = '{0}%' bonusFormatter = text_styles.error color = CUSTOMIZATION_BONUS_ANIMATION_TYPES.COLOR_RED animationType = CUSTOMIZATION_BONUS_ANIMATION_TYPES.RESET animationValue = oldBonusAppliedCount if self.__bonusData[qTypeName]['bonusAppliedDescriptionCount'] != 0: formattedString += '*' else: if appliedBonusValue < 0: formattedString = '{0}%' bonusFormatter = text_styles.error color = CUSTOMIZATION_BONUS_ANIMATION_TYPES.COLOR_RED animationType = CUSTOMIZATION_BONUS_ANIMATION_TYPES.SET animationValue = appliedBonusValue if self.__bonusData[qTypeName]['bonusAppliedDescriptionCount'] != 0: formattedString += '*' self.__bonusData[qTypeName]['oldBonusAppliedCount'] = appliedBonusValue self.__bonusData[qTypeName]['oldBonusTotalCount'] = bonusTotalCount self.__bonusData[qTypeName]['animationPanel'] = {'animationType': animationType, 'install': False, 'color': color, 'value1': bonusFormatter(formattedString.format(animationValue)), 'value2': additionalValue} self.__animationStarted = True self.__processingPurchase = False