def _packBlocks(self, *args, **kwargs): self.__isReceived = bool(args[1]) items = super(NyDecorationWithStatusTooltipData, self)._packBlocks(*args, **kwargs) if self.__isReceived: statusText = text_styles.concatStylesWithSpace( icons.makeImageTag(RES_ICONS.MAPS_ICONS_NY_ICONS_CHECK, width=24, height=24, vSpace=-6, hSpace=-2), text_styles.statInfo( NY.COLLECTIONS_TOOLTIP_DECORATION_OBTAINED)) statusPadding = formatters.packPadding(left=4, top=-12, bottom=-14) else: statusText = text_styles.concatStylesWithSpace( text_styles.critical( NY.COLLECTIONS_TOOLTIP_DECORATION_NOTOBTAINED)) statusPadding = formatters.packPadding(left=16, top=-8, bottom=-10) bottomBuildUpBlock = [ formatters.packAlignedTextBlockData( text=statusText, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=statusPadding) ] items.append(formatters.packBuildUpBlockData(bottomBuildUpBlock)) return items
def _packBlocks(self, paramName): extendedData = self.context.getComparator().getExtendedData(paramName) self.__paramName = extendedData.name title = text_styles.highTitle(MENU.tank_params(paramName)) if param_formatter.isRelativeParameter(paramName): value = param_formatter.colorizedFormatParameter(extendedData, self.context.formatters) title += ' ' + text_styles.warning(_ms(TOOLTIPS.VEHICLEPARAMS_TITLE_VALUETEMPLATE, value=value)) else: title += ' ' + text_styles.middleTitle(MEASURE_UNITS.get(paramName, '')) desc = _ms(TOOLTIPS.tank_params_desc(paramName)) possibleBonuses = sorted(extendedData.possibleBonuses, _bonusCmp) if possibleBonuses is not None and len(possibleBonuses) > 0: desc += ' ' + _ms(TOOLTIPS.VEHICLEPARAMS_POSSIBLEBONUSES_DESC) desc += '\n' + self.__createBonusesStr(possibleBonuses) blocks = [formatters.packTitleDescBlock(title, text_styles.main(desc))] bonuses = sorted(extendedData.bonuses, _bonusCmp) if bonuses is not None and len(bonuses) > 0: blocks.append(formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.VEHICLEPARAMS_BONUSES_TITLE), text_styles.main(self.__createBonusesStr(bonuses)))) penalties = extendedData.penalties actualPenalties, nullPenaltyTypes = self.__getNumNotNullPenaltyTankman(penalties) penaltiesLen = len(penalties) numNotNullPenaltyTankman = len(actualPenalties) if numNotNullPenaltyTankman > 0: blocks.append(formatters.packTitleDescBlock(text_styles.critical(TOOLTIPS.VEHICLEPARAMS_PENALTIES_TITLE), text_styles.main(self.__createPenaltiesStr(actualPenalties)))) if penaltiesLen > numNotNullPenaltyTankman: blocks.append(formatters.packImageTextBlockData(self.__createTankmanIsOutStr(nullPenaltyTypes), img=RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, imgPadding=formatters.packPadding(top=2, left=3, right=6))) return blocks
def __updateMultiselectionData(self): falloutCfg = self.__falloutCtrl.getConfig() showSlots, msg = self.__getMultiselectionStatus() canDo, _ = self.prbDispatcher.canPlayerDoAction() data = { 'multiSelectionIsEnabled': self.__multiselectionMode, 'formattedMessage': msg, 'showSlots': showSlots, 'slots': self.__getMultiselectionSlots(), 'indicatorIsEnabled': canDo, 'vehicleTypes': middleTitle( i18n.makeString(FALLOUT.MULTISELECTIONSLOT_SELECTIONSTATUS)) + ' ' + main( i18n.makeString( FALLOUT.MULTISELECTIONSLOT_SELECTIONREQUIREMENTS, level=toRomanRangeString(list(falloutCfg.allowedLevels), 1))), 'statusSrt': statInfo(FALLOUT.MULTISELECTIONSLOT_GROUPREADY) if canDo else critical(FALLOUT.MULTISELECTIONSLOT_GROUPNOTREADY) } self.as_setMultiselectionModeS(data)
def __getMultiselectionInfoVO(self): allowedLevels = self.falloutCtrl.getConfig().allowedLevels showSlots, message = self.__getMultiselectionStatus() result = self.prbEntity.canPlayerDoAction() if result.isValid: statusString = text_styles.statInfo( '#fallout:multiselectionSlot/groupReady') else: statusString = text_styles.critical( '#fallout:multiselectionSlot/groupNotReady') return { 'formattedMessage': message, 'showSlots': showSlots, 'indicatorIsEnabled': result.isValid, 'vehicleTypes': text_styles.concatStylesWithSpace( text_styles.middleTitle( i18n.makeString( '#fallout:multiselectionSlot/selectionStatus')), text_styles.main( i18n.makeString( '#fallout:multiselectionSlot/selectionRequirements', level=toRomanRangeString(allowedLevels, step=1)))), 'statusSrt': statusString }
def __getCycleWithoutAchievements(self, cycle): if cycle.status == CYCLE_STATUS.PAST: text = _ms(RANKED_BATTLES. RANKEDBATTLESCYCLESVIEW_NOACHIEVEMENTS_PAST_FOOTER, points=text_styles.critical(0)) isDateOff = True contentID = RANKEDBATTLES_ALIASES.PAST_MISSED else: dateFormatKey = RANKED_BATTLES.RANKEDBATTLEHEADER_TOOLTIP_DATE text = _ms(RANKED_BATTLES. RANKEDBATTLESCYCLESVIEW_NOACHIEVEMENTS_FUTURE_FOOTER, start=time_formatters.formatDate( dateFormatKey, cycle.startDate), end=time_formatters.formatDate(dateFormatKey, cycle.endDate)) isDateOff = False contentID = RANKEDBATTLES_ALIASES.FUTURE return { 'contentID': contentID, 'nextStage': { 'header': text_styles.promoSubTitle( _ms(RANKED_BATTLES.RANKEDBATTLEVIEW_NEXTSTAGEBLOCK_STAGE, cycleNumber=cycle.ordinalNumber)), 'calendarDay': time_formatters.formatDate('%d', cycle.startDate), 'dateOff': isDateOff, 'points': text_styles.main(text) }, 'awardsRibbon': None }
def _getStatusBlock(division, isLocked, isCompleted): statusTitle = text_styles.warning( backport.text( R.strings.ranked_battles.division.tooltip.status.current())) statusText = None if division.isQualification(): statusTitle = text_styles.warning( backport.text(R.strings.ranked_battles.division.tooltip.status. currentQual())) if isLocked: statusTitle = text_styles.critical( backport.text( R.strings.ranked_battles.division.tooltip.status.locked())) statusText = text_styles.standard( backport.text(R.strings.ranked_battles.division.tooltip.status. locked.desc())) if division.isPostQualification(): statusText = text_styles.standard( backport.text(R.strings.ranked_battles.division.tooltip. status.locked.descQual())) if isCompleted: statusTitle = text_styles.statInfo( backport.text(R.strings.ranked_battles.division.tooltip.status. completed())) if division.isQualification(): statusTitle = text_styles.statInfo( backport.text(R.strings.ranked_battles.division.tooltip. status.completedQual())) return formatters.packImageTextBlockData( title=statusTitle, desc=statusText, txtPadding=formatters.packPadding(left=10))
def _packAppliedBlock(self): vehicles = set(self.installedToVehs) if self.appliedCount > 0: vehicles.add(self.currentVehicle.intCD) elif not self.installedToVehs: return None if self._item.mayApply or self.currentVehicle.intCD in self.installedToVehs: return formatters.packTitleDescBlock( title=text_styles.middleTitle( VEHICLE_CUSTOMIZATION.CUSTOMIZATION_LIMITED_ON_VEHICLE), desc=text_styles.main( self.__makeVehiclesShortNamesString(vehicles)), padding=formatters.packPadding(top=-2)) else: blocks = [ formatters.packImageTextBlockData( title=text_styles.critical( VEHICLE_CUSTOMIZATION. CUSTOMIZATION_LIMITED_ON_OTHER_VEHICLE), img=RES_ICONS.MAPS_ICONS_LIBRARY_MARKER_BLOCKED, imgPadding=formatters.packPadding(left=-3, top=2)), formatters.packTextBlockData(text=text_styles.main( _ms(self.__makeVehiclesShortNamesString(vehicles)))) ] return formatters.packBuildUpBlockData( blocks, gap=3, padding=formatters.packPadding(bottom=-5))
def _packReceivedBlock(self, winEarnedCount, loseEarnedCount): block = [] block.append( self._getConditionHeaderBlock( strValue=RANKED_BATTLES.TOOLTIP_STEP_CONDITIONS_HEADER)) if winEarnedCount > 0: winIcon = RES_ICONS.getRankedTooltipTopIcon(winEarnedCount) block.append( formatters.packImageTextBlockData( desc=text_styles.main( _ms(RANKED_BATTLES.TOOLTIP_STEP_CONDITIONS, battlesNum=winEarnedCount, team=text_styles.statInfo( RANKED_BATTLES.TOOLTIP_STEP_WINNERS))), img=winIcon, txtPadding=formatters.packPadding(left=17))) if winEarnedCount > 0 and loseEarnedCount > 0: block.append( self._getOrBlock( padding=formatters.packPadding(left=70, bottom=10))) if loseEarnedCount > 0: loseIcon = RES_ICONS.getRankedTooltipLoseIcon(loseEarnedCount) block.append( formatters.packImageTextBlockData( desc=text_styles.main( _ms(RANKED_BATTLES.TOOLTIP_STEP_CONDITIONS, battlesNum=loseEarnedCount, team=text_styles.critical( RANKED_BATTLES.TOOLTIP_STEP_LOSERS))), img=loseIcon, txtPadding=formatters.packPadding(left=17))) return formatters.packBuildUpBlockData( block, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)
def __packStatusBlock(self, status): statusBlock = [] statusDyn = R.strings.ranked_battles.yearRewards.tooltip.status.dyn( status) statusStr = backport.text(statusDyn.title()) if status in (_RBC.YEAR_REWARD_STATUS_PASSED, _RBC.YEAR_REWARD_STATUS_PASSED_FINAL): statusStr = text_styles.warning(statusStr) elif status in (_RBC.YEAR_REWARD_STATUS_CURRENT, _RBC.YEAR_REWARD_STATUS_CURRENT_FINAL): statusStr = text_styles.statInfo(statusStr) else: statusStr = text_styles.critical(statusStr) statusBlock.append( formatters.packAlignedTextBlockData( statusStr, BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(top=-4))) statusBlock.append( formatters.packAlignedTextBlockData( text_styles.main(backport.text(statusDyn.description())), BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(top=2, bottom=-2))) return formatters.packBuildUpBlockData( statusBlock, linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
def atReturn(self, cd): original_return_value = cd.returned original_args = cd.args if not self.__vehicle_is_available(original_args[0]): state = _ms('#menu:tankCarousel/vehicleStates/%s' % Vehicle.VEHICLE_STATE.UNAVAILABLE) original_return_value['infoText'] = text_styles.vehicleStatusCriticalText(state) original_return_value['smallInfoText'] = text_styles.critical(state) return original_return_value
def __showProhibitedNumberSystemMsg(self, item, number): seasonName = _ms(SEASON_TYPE_TO_INFOTYPE_MAP[self.__ctx.season]) msg = _ms(SYSTEM_MESSAGES.CUSTOMIZATION_PERSONAL_NUMBER_PROHIBITED, value=text_styles.critical(number), itemType=item.userType, itemName=item.userName, seasonName=seasonName) msgType = SystemMessages.SM_TYPE.Error SystemMessages.pushMessage(msg, msgType)
def _getResearchPageStatus(self): module = self.module configuration = self.configuration vehicle = configuration.vehicle node = configuration.node block = [] def status(title=None, desc=None): if title is not None or desc is not None: block.append( formatters.packTitleDescBlock( title=text_styles.middleTitle(title) if title is not None else '', desc=text_styles.main(desc) if desc is not None else '')) return block header, text = (None, None) nodeState = int(node.state) statusTemplate = '#tooltips:researchPage/module/status/%s' parentCD = vehicle.intCD if vehicle is not None else None _, _, need = getUnlockPrice(module.intCD, parentCD) if not nodeState & NODE_STATE_FLAGS.UNLOCKED: if not vehicle.isUnlocked: header, text = getComplexStatus(statusTemplate % 'rootVehicleIsLocked') elif not nodeState & NODE_STATE_FLAGS.NEXT_2_UNLOCK: header, text = getComplexStatus(statusTemplate % 'parentModuleIsLocked') elif need > 0: header, text = getComplexStatus(statusTemplate % 'notEnoughXP') header = text_styles.critical(header) return status(header, text) elif not vehicle.isInInventory: header, text = getComplexStatus(statusTemplate % 'needToBuyTank') text %= {'vehiclename': vehicle.userName} return status(header, text) elif nodeState & NODE_STATE_FLAGS.INSTALLED: return status() else: if vehicle is not None: if vehicle.isInInventory: vState = vehicle.getState() if vState == 'battle': header, text = getComplexStatus(statusTemplate % 'vehicleIsInBattle') elif vState == 'locked': header, text = getComplexStatus( statusTemplate % 'vehicleIsReadyToFight') elif vState == 'damaged' or vState == 'exploded' or vState == 'destroyed': header, text = getComplexStatus(statusTemplate % 'vehicleIsBroken') if header is not None or text is not None: return status(header, text) return self._getStatus()
def _packConversionFormulaBlock(self, intelRequired, nationRequired, vehicle): nationalRequiredOptions, nationalAllianceFragments = self.context.getAllianceNationFragmentsData(vehicle) blocks = [] if intelRequired > self.context.getUniversalCount(): intelText = text_styles.critical(str(intelRequired)) else: intelText = text_styles.warning(str(intelRequired)) blocks.append(formatters.packImageTextBlockData(desc=intelText, img=backport.image(R.images.gui.maps.icons.blueprints.fragment.special.intelligence()), imgAtLeft=False, txtAlign=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, imgPadding=formatters.packPadding(top=4, left=2), padding=formatters.packPadding(top=4))) blocks.append(formatters.packImageTextBlockData(desc=text_styles.main(backport.text(R.strings.tooltips.blueprint.VehicleBlueprintTooltip.chose())), img=backport.image(R.images.gui.maps.icons.blueprints.blueprintScreen.icPlus()), txtPadding=formatters.packPadding(top=1, left=4), padding=formatters.packPadding(top=3, left=6))) for index, (nationId, cost) in enumerate(nationalRequiredOptions.iteritems()): nationName = nations.MAP[nationId] if cost > nationalAllianceFragments[nationId]: nationText = text_styles.critical(backport.getIntegralFormat(cost)) else: nationText = text_styles.warning(backport.getIntegralFormat(cost)) blocks.append(formatters.packImageTextBlockData(desc=nationText, img=backport.image(R.images.gui.maps.icons.blueprints.fragment.special.dyn(nationName)()), imgAtLeft=False, txtAlign=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, imgPadding=formatters.packPadding(top=4, left=2), padding=formatters.packPadding(top=4))) if index < len(nationalRequiredOptions) - 1: blocks.append(formatters.packImageBlockData(img=backport.image(R.images.gui.maps.icons.library.delimeter()), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(top=-4, left=2, right=-2, bottom=4))) return formatters.packBuildUpBlockData(blocks=blocks, layout=BLOCKS_TOOLTIP_TYPES.LAYOUT_HORIZONTAL, align=BLOCKS_TOOLTIP_TYPES.ALIGN_LEFT, padding=formatters.packPadding(top=1, bottom=-15))
def __getMultiselectionStatus(self): config = self._falloutCtrl.getConfig() battleType = self._falloutCtrl.getBattleType() messageTemplate = '#fallout:multiselectionSlot/{}'.format(battleType) if not config.hasRequiredVehicles(): return (False, text_styles.critical(i18n.makeString('{}/topTierVehicleRequired'.format(messageTemplate), level=toRomanRangeString(config.allowedLevels, step=1), requiredLevel=int2roman(config.vehicleLevelRequired)))) if self._falloutCtrl.getSelectedVehicles(): return (True, text_styles.concatStylesToMultiLine(text_styles.middleTitle(i18n.makeString('#fallout:multiselectionSlot/selectionStatus')), text_styles.main(i18n.makeString('#fallout:multiselectionSlot/selectionRequirements', level=toRomanRangeString(config.allowedLevels, step=1))))) if config.getAllowedVehicles(): return (False, text_styles.concatStylesToMultiLine(text_styles.highTitle(i18n.makeString('{}/descriptionTitle'.format(messageTemplate), topLevel=int2roman(max(config.allowedLevels)))), text_styles.main(i18n.makeString('{}/message'.format(messageTemplate), level=toRomanRangeString(config.allowedLevels, step=1))))) return (False, '')
def __updateMultiselectionData(self): falloutCfg = self.__falloutCtrl.getConfig() showSlots, msg = self.__getMultiselectionStatus() canDo, _ = self.prbDispatcher.canPlayerDoAction() data = {'multiSelectionIsEnabled': self.__multiselectionMode, 'formattedMessage': msg, 'showSlots': showSlots, 'slots': self.__getMultiselectionSlots(), 'indicatorIsEnabled': canDo, 'vehicleTypes': middleTitle(i18n.makeString(FALLOUT.MULTISELECTIONSLOT_SELECTIONSTATUS)) + ' ' + main(i18n.makeString(FALLOUT.MULTISELECTIONSLOT_SELECTIONREQUIREMENTS, level=toRomanRangeString(list(falloutCfg.allowedLevels), 1))), 'statusSrt': statInfo(FALLOUT.MULTISELECTIONSLOT_GROUPREADY) if canDo else critical(FALLOUT.MULTISELECTIONSLOT_GROUPNOTREADY)} self.as_setMultiselectionModeS(data)
def _packBlocks(self, paramName): blocks = super(VehicleAdvancedParametersTooltipData, self)._packBlocks(paramName) self.__paramName = self._extendedData.name bonuses, hasSituational = self._getBonuses() self._packListBlock(blocks, bonuses, text_styles.warning(_ms(TOOLTIPS.VEHICLEPARAMS_BONUSES_TITLE))) penalties = self._getPenalties() self._packListBlock(blocks, penalties, text_styles.critical(_ms(TOOLTIPS.VEHICLEPARAMS_PENALTIES_TITLE))) if self._extendedData.inactiveBonuses: blocks.append(formatters.packBuildUpBlockData(self._getFootNoteBlock('inactive'), padding=0)) if hasSituational: blocks.append(formatters.packBuildUpBlockData(self._getFootNoteBlock('optional'), padding=0)) return blocks
def __getMultiselectionInfoVO(self): allowedLevels = self._falloutCtrl.getConfig().allowedLevels showSlots, message = self.__getMultiselectionStatus() canDoAction, _ = self.prbDispatcher.canPlayerDoAction() if canDoAction: statusString = text_styles.statInfo('#fallout:multiselectionSlot/groupReady') else: statusString = text_styles.critical('#fallout:multiselectionSlot/groupNotReady') return {'formattedMessage': message, 'showSlots': showSlots, 'indicatorIsEnabled': canDoAction, 'vehicleTypes': text_styles.concatStylesWithSpace(text_styles.middleTitle(i18n.makeString('#fallout:multiselectionSlot/selectionStatus')), text_styles.main(i18n.makeString('#fallout:multiselectionSlot/selectionRequirements', level=toRomanRangeString(allowedLevels, step=1)))), 'statusSrt': statusString}
def getDisplayableData(self, *args, **kwargs): if self.__lobbyContext.getServerSettings().isCollectorVehicleEnabled(): _logger.error('Vehicle collector is enabled') return {} return { 'header': text_styles.critical( backport.text(R.strings.tooltips.collectibleVehicleTooltip. switchOff.header())), 'body': text_styles.main( backport.text(R.strings.tooltips.collectibleVehicleTooltip. switchOff.text())) }
def _getBottom(self, state): vehicle = g_currentVehicle.item isObtained = self._marathonEvent.isRewardObtained() if isObtained: statusLabel = text_styles.bonusAppliedText(icons.makeImageTag(self.__iconsData.okIcon, width=32, height=32, vSpace=-10, hSpace=-10) + backport.text(self.__tooltipData.extraStateCompleted)) return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center', 'message': statusLabel}), padding=formatters.packPadding(bottom=20)) if state == MarathonState.IN_PROGRESS: warning = self._marathonEvent.checkForWarnings(vehicle) if warning == MarathonWarning.WRONG_BATTLE_TYPE: return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center', 'message': text_styles.critical(backport.text(self.__tooltipData.errorBattleType))}), padding=formatters.packPadding(bottom=20)) if warning == MarathonWarning.WRONG_VEH_TYPE: return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center', 'message': text_styles.critical(backport.text(self.__tooltipData.errorVehType))}), padding=formatters.packPadding(bottom=20)) currentStep, allStep = self._marathonEvent.getMarathonProgress() if allStep: return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center', 'message': text_styles.middleTitle(backport.text(self.__tooltipData.extraStateSteps, currentStep=currentStep, allStep=text_styles.main(allStep)))}), padding=formatters.packPadding(bottom=20)) else: discount = self._marathonEvent.getMarathonDiscount() return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center', 'message': text_styles.statusAttention(backport.text(self.__tooltipData.extraStateDiscount, discount=discount))}), padding=formatters.packPadding(bottom=20))
def _packBlocks(self, vehicleCD): items = super(BlueprintEmptySlotTooltipData, self)._packBlocks(vehicleCD) self.__vehicle, self.__blueprintData, _ = self.context.getVehicleBlueprintData(vehicleCD) _, _, self.__allianceName = self.context.getFragmentData(vehicleCD) items.extend([self.__packTitleBlock(), self.__packDiscountBlock(), self.__packDescriptionBlock()]) intelRequired, nationRequired = self.context.getFragmentConvertData(self.__vehicle.level) items.append(self._packConversionFormulaBlock(intelRequired, nationRequired, self.__vehicle)) if not self.__blueprintData.canConvert: statusStr = text_styles.critical(TOOLTIPS.BLUEPRINT_BLUEPRINTEMPTYSLOT_STATUSNOTENOUGH) else: statusStr = text_styles.statusAttention(TOOLTIPS.BLUEPRINT_BLUEPRINTEMPTYSLOT_STATUSENOUGH) statusStr = text_styles.alignText(statusStr, 'center') items.append(formatters.packTextBlockData(text=statusStr, padding=formatters.packPadding(top=5, bottom=-3))) return items
def _packBlocks(self, perfType, *args, **kwargs): items = super(PerfAttentionSimpleTooltip, self)._packBlocks(*args, **kwargs) message = backport.text(R.strings.tooltips.battle_royale.hangar.perf.dyn(perfType).header()) problemIcon = None if perfType == BattleRoyalePerfProblems.HIGH_RISK: problemIcon = icons.notAvailableRed() formattedMessage = text_styles.critical(message) elif perfType == BattleRoyalePerfProblems.MEDIUM_RISK: problemIcon = icons.alert() formattedMessage = text_styles.alert(message) else: formattedMessage = '' title = text_styles.concatStylesWithSpace(problemIcon, formattedMessage) description = text_styles.main(backport.text(R.strings.tooltips.battle_royale.hangar.perf.dyn(perfType).description())) items.append(formatters.packTitleDescBlock(title=title, desc=description)) return items
def __constructInactiveStateBlock(skillInfo): return [ formatters.packTitleDescBlock( title=text_styles.critical( backport.text(R.strings.epic_battle.metaAbilityScreen. Ability_not_unlocked())), desc=text_styles.standard( backport.text(R.strings.epic_battle.metaAbilityScreen. how_to_activate(), price=text_styles.stats(skillInfo.price), img=icons.makeImageTag(backport.image( R.images.gui.maps.icons.epicBattles. awards.c_16x16.abilityToken()), vSpace=-3))), gap=2) ]
def __getMultiselectionStatus(self): if self.__multiselectionMode: falloutCfg = self.__falloutCtrl.getConfig() messageTemplate = '#fallout:multiselectionSlot/{0}'.format(self.__falloutCtrl.getBattleType()) if not falloutCfg.hasRequiredVehicles(): levels = list(falloutCfg.allowedLevels) return (False, critical(i18n.makeString(messageTemplate + '/topTierVehicleRequired', level=toRomanRangeString(levels, 1), requiredLevel=int2roman(falloutCfg.vehicleLevelRequired)))) if self.__falloutCtrl.getSelectedVehicles(): return (True, middleTitle(i18n.makeString(FALLOUT.MULTISELECTIONSLOT_SELECTIONSTATUS)) + '\n' + main(i18n.makeString(FALLOUT.MULTISELECTIONSLOT_SELECTIONREQUIREMENTS, level=toRomanRangeString(list(falloutCfg.allowedLevels), 1)))) if falloutCfg.getAllowedVehicles(): levels = list(falloutCfg.allowedLevels) topLevel = levels[-1] header = highTitle(i18n.makeString(messageTemplate + '/descriptionTitle', topLevel=int2roman(topLevel))) body = main(i18n.makeString(messageTemplate + '/message', level=toRomanRangeString(levels, 1))) return (False, header + '\n' + body) return (False, '')
def _packBlocks(self, paramName): extendedData = self.context.getComparator().getExtendedData(paramName) self.__paramName = extendedData.name title = text_styles.highTitle(MENU.tank_params(paramName)) if param_formatter.isRelativeParameter(paramName): value = '' if self.context.showTitleValue: value = param_formatter.colorizedFormatParameter( extendedData, self.context.formatters) title += ' ' + text_styles.warning( _ms(TOOLTIPS.VEHICLEPARAMS_TITLE_VALUETEMPLATE, value=value)) else: title += ' ' + text_styles.middleTitle( MEASURE_UNITS.get(paramName, '')) desc = _ms(TOOLTIPS.tank_params_desc(paramName)) possibleBonuses = sorted(extendedData.possibleBonuses, _bonusCmp) if possibleBonuses is not None and len(possibleBonuses) > 0: desc += ' ' + _ms(TOOLTIPS.VEHICLEPARAMS_POSSIBLEBONUSES_DESC) desc += '\n' + self.__createBonusesStr(possibleBonuses) blocks = [formatters.packTitleDescBlock(title, text_styles.main(desc))] bonuses = sorted(extendedData.bonuses, _bonusCmp) if bonuses is not None and len(bonuses) > 0: blocks.append( formatters.packTitleDescBlock( text_styles.middleTitle( TOOLTIPS.VEHICLEPARAMS_BONUSES_TITLE), text_styles.main(self.__createBonusesStr(bonuses)))) penalties = extendedData.penalties actualPenalties, nullPenaltyTypes = self.__getNumNotNullPenaltyTankman( penalties) penaltiesLen = len(penalties) numNotNullPenaltyTankman = len(actualPenalties) if numNotNullPenaltyTankman > 0: blocks.append( formatters.packTitleDescBlock( text_styles.critical( TOOLTIPS.VEHICLEPARAMS_PENALTIES_TITLE), text_styles.main( self.__createPenaltiesStr(actualPenalties)))) if penaltiesLen > numNotNullPenaltyTankman: blocks.append( formatters.packImageTextBlockData( self.__createTankmanIsOutStr(nullPenaltyTypes), img=RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, imgPadding=formatters.packPadding(top=2, left=3, right=6))) return blocks
def __updateSelectedVehicle(self): vehicle = g_currentVehicle.item suitableVehicles = self.__carousel.getSuitableVehicles() if suitableVehicles and vehicle and vehicle.intCD in suitableVehicles: selectedVeh = getVehicleDataVO(vehicle) selectedVeh.update( {'tooltip': TOOLTIPS.MISSIONS_VEHICLE_SELECTOR_LIST}) status = text_styles.statInfo( 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 = text_styles.critical( QUESTS.MISSIONS_VEHICLESELECTOR_STATUS_NOTAVAILABLE) selectedVeh.update(isUseRightBtn=False) suitableVehiclesCount = self.__carousel.getSuitableVehiclesCount() totalVehiclesCount = self.__carousel.getTotalVehiclesCount() if suitableVehiclesCount == 0: suitableStyle = text_styles.unavailable else: suitableStyle = text_styles.highTitle count = '{} / {}'.format(suitableStyle(suitableVehiclesCount), text_styles.main(totalVehiclesCount)) title = text_styles.highTitle( ms(QUESTS.MISSIONS_VEHICLESELECTOR_TITLE, count=count)) self.as_setInitDataS({'title': title, 'statusText': status}) self.as_showSelectedVehicleS(selectedVeh)
def _packConditionsBlock(self, *args, **kwargs): block = [] winnersBattlesNum = self.rankedController.getRanksTops(isLoser=False, earned=True) losersBattlesNum = self.rankedController.getRanksTops(isLoser=True, earned=True) block.append( formatters.packTextBlockData( text_styles.middleTitle( RANKED_BATTLES.TOOLTIP_STEP_CONDITIONS_HEADER), padding=formatters.packPadding(bottom=7))) if winnersBattlesNum: winIcon = RES_ICONS.getRankedTooltipTopIcon(winnersBattlesNum) block.append( formatters.packImageTextBlockData( desc=text_styles.main( _ms(RANKED_BATTLES.TOOLTIP_STEP_CONDITIONS, battlesNum=winnersBattlesNum, team=text_styles.statInfo( RANKED_BATTLES.TOOLTIP_STEP_WINNERS))), img=winIcon, txtPadding=formatters.packPadding(left=17))) if winnersBattlesNum and losersBattlesNum: block.append( formatters.packTextBlockData( text_styles.hightlight(RANKED_BATTLES.TOOLTIP_STEP_OR), padding=formatters.packPadding(left=70, bottom=10))) if losersBattlesNum: loseIcon = RES_ICONS.getRankedTooltipTopIcon(losersBattlesNum) block.append( formatters.packImageTextBlockData( desc=text_styles.main( _ms(RANKED_BATTLES.TOOLTIP_STEP_CONDITIONS, battlesNum=losersBattlesNum, team=text_styles.critical( RANKED_BATTLES.TOOLTIP_STEP_LOSERS))), img=loseIcon, txtPadding=formatters.packPadding(left=17))) return formatters.packBuildUpBlockData( block, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)
def _packReceivedBlock(self, winEarnedCount, loseEarnedCount): block = [] block.append( self._getConditionHeaderBlock(strValue=backport.text( R.strings.ranked_battles.tooltip.step.conditions.header()))) if winEarnedCount > 0: winIcon = R.images.gui.maps.icons.rankedBattles.tops.top.c_54x50.dyn( 'top{}'.format(winEarnedCount)) block.append( formatters.packImageTextBlockData( desc=text_styles.main( backport.text( R.strings.ranked_battles.tooltip.step.conditions(), battlesNum=winEarnedCount, team=text_styles.statInfo( backport.text(R.strings.ranked_battles.tooltip. step.winners())))), img=winIcon, txtPadding=formatters.packPadding(left=17))) if winEarnedCount > 0 and loseEarnedCount > 0: block.append( self._getOrBlock( padding=formatters.packPadding(left=70, bottom=10))) if loseEarnedCount > 0: loseIcon = R.images.gui.maps.icons.rankedBattles.tops.lose.c_54x50.dyn( 'top{}'.format(loseEarnedCount)) block.append( formatters.packImageTextBlockData( desc=text_styles.main( backport.text( R.strings.ranked_battles.tooltip.step.conditions(), battlesNum=loseEarnedCount, team=text_styles.critical( backport.text(R.strings.ranked_battles.tooltip. step.losers())))), img=loseIcon, txtPadding=formatters.packPadding(left=17))) return formatters.packBuildUpBlockData( block, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)
def _packAppliedBlock(self): if self.__ctx is not None and self.__ctx.modeId == CustomizationModes.STYLED: if self._item.itemTypeID != GUI_ITEM_TYPE.STYLE: return if self._item.isStyleOnly: return else: vehicles = set(self.installedVehs) if self._appliedCount > 0: vehicles.add(self.__vehicle.intCD) elif not self.installedVehs: return if self.__vehicle.intCD not in vehicles and self._item.descriptor.filter is not None and not self._item.descriptor.filter.match( self.__vehicle.descriptor): return if self._item.mayApply or self.__vehicle.intCD in self.installedVehs: return formatters.packTitleDescBlock( title=text_styles.middleTitle( VEHICLE_CUSTOMIZATION.CUSTOMIZATION_LIMITED_ON_VEHICLE ), desc=text_styles.main( makeVehiclesShortNamesString(vehicles, self.__vehicle)), padding=formatters.packPadding(top=-2)) blocks = [ formatters.packImageTextBlockData( title=text_styles.critical( VEHICLE_CUSTOMIZATION. CUSTOMIZATION_LIMITED_ON_OTHER_VEHICLE), img=RES_ICONS.MAPS_ICONS_LIBRARY_MARKER_BLOCKED, imgPadding=formatters.packPadding(left=2, top=2)), formatters.packTextBlockData(text=text_styles.main( _ms(makeVehiclesShortNamesString(vehicles, self.__vehicle))), padding=formatters.packPadding( top=-7)) ] return formatters.packBuildUpBlockData( blocks, gap=3, padding=formatters.packPadding(bottom=-5))
def __getMultiselectionStatus(self): if self.__multiselectionMode: falloutCfg = self.__falloutCtrl.getConfig() messageTemplate = '#fallout:multiselectionSlot/{0}'.format( self.__falloutCtrl.getBattleType()) if not falloutCfg.hasRequiredVehicles(): levels = list(falloutCfg.allowedLevels) return (False, critical( i18n.makeString( messageTemplate + '/topTierVehicleRequired', level=toRomanRangeString(levels, 1), requiredLevel=int2roman( falloutCfg.vehicleLevelRequired)))) if self.__falloutCtrl.getSelectedVehicles(): return ( True, middleTitle( i18n.makeString( FALLOUT.MULTISELECTIONSLOT_SELECTIONSTATUS)) + '\n' + main( i18n.makeString( FALLOUT.MULTISELECTIONSLOT_SELECTIONREQUIREMENTS, level=toRomanRangeString( list(falloutCfg.allowedLevels), 1)))) if falloutCfg.getAllowedVehicles(): levels = list(falloutCfg.allowedLevels) topLevel = levels[-1] header = highTitle( i18n.makeString(messageTemplate + '/descriptionTitle', topLevel=int2roman(topLevel))) body = main( i18n.makeString(messageTemplate + '/message', level=toRomanRangeString(levels, 1))) return (False, header + '\n' + body) return (False, '')
def __getNotObtainedStatus(self): return text_styles.critical( PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_STATUS_NOTOBTAINED)
def _getVehicleName(self, vehicle=None, nativeVehicle=None): return text_styles.main( nativeVehicle.shortUserName ) if not vehicle or nativeVehicle.shortUserName == vehicle.shortUserName else text_styles.critical( nativeVehicle.shortUserName)
def _getBottom(self, state): vehicle = g_currentVehicle.item isObtained = self._marathonEvent.isVehicleObtained() if isObtained: statusLabel = text_styles.bonusAppliedText( icons.makeImageTag(self.__iconsData.libraryOkIcon, vSpace=-2) + ' ' + _ms(self.__tooltipData.extraStateCompleted)) return formatters.packTextBlockData( text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', { 'align': 'center', 'message': statusLabel }), padding=formatters.packPadding(bottom=20)) if state == MARATHON_STATE.IN_PROGRESS: warning = self._marathonEvent.checkForWarnings(vehicle) if warning == MARATHON_WARNING.WRONG_BATTLE_TYPE: return formatters.packTextBlockData( text=makeHtmlString( 'html_templates:lobby/textStyle', 'alignText', { 'align': 'center', 'message': text_styles.critical( _ms(self.__tooltipData.errorBattleType)) }), padding=formatters.packPadding(bottom=20)) if warning == MARATHON_WARNING.WRONG_VEH_TYPE: return formatters.packTextBlockData( text=makeHtmlString( 'html_templates:lobby/textStyle', 'alignText', { 'align': 'center', 'message': text_styles.critical( _ms(self.__tooltipData.errorVehType)) }), padding=formatters.packPadding(bottom=20)) currentStep, allStep = self._marathonEvent.getMarathonProgress() if allStep: return formatters.packTextBlockData( text=makeHtmlString( 'html_templates:lobby/textStyle', 'alignText', { 'align': 'center', 'message': text_styles.middleTitle( _ms(self.__tooltipData.extraStateSteps, currentStep=currentStep, allStep=text_styles.main(allStep))) }), padding=formatters.packPadding(bottom=20)) else: discount = self._marathonEvent.getMarathonDiscount() return formatters.packTextBlockData( text=makeHtmlString( 'html_templates:lobby/textStyle', 'alignText', { 'align': 'center', 'message': text_styles.bonusPreviewText( _ms(self.__tooltipData.extraStateDiscount, discount=discount)) }), padding=formatters.packPadding(bottom=20))
def _packBlocks(self, *args, **kwargs): items = super(TankmanTooltipDataBlock, self)._packBlocks() item = self.context.buildItem(*args, **kwargs) self.item = item vehicle = None nativeVehicle = self.itemsCache.items.getItemByCD( item.vehicleNativeDescr.type.compactDescr) if item.isInTank: vehicle = self.itemsCache.items.getVehicle(item.vehicleInvID) items.append( formatters.packImageTextBlockData( title=text_styles.highTitle(item.fullUserName), desc=text_styles.main(item.rankUserName))) innerBlock = [] if vehicle: innerBlock.append( formatters.packTextBlockData(text=makeHtmlString( 'html_templates:lobby/textStyle', 'grayTitle', {'message': makeString(TOOLTIPS.HANGAR_CREW_ASSIGNEDTO)}))) innerBlock.append( formatters.packImageTextBlockData( img=vehicle.iconContour, txtGap=-4, padding=formatters.packPadding(bottom=0, top=10, left=0), title=text_styles.stats(vehicle.shortUserName), desc=text_styles.stats('#menu:header/vehicleType/%s' % vehicle.type), flipHorizontal=True)) if innerBlock: items.append( formatters.packBuildUpBlockData( innerBlock, padding=formatters.packPadding(left=0, right=50, top=-5, bottom=0), linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)) commonStatsBlock = [ formatters.packTextBlockData(text=makeHtmlString( 'html_templates:lobby/textStyle', 'grayTitle', {'message': makeString(TOOLTIPS.HANGAR_CREW_SPECIALTY_SKILLS)}) ) ] penalty = self._getBonusValue( item, [TankmanRoleBonusesField.BONUSES.PENALTY]) addition = self._getBonusValue(item, [ TankmanRoleBonusesField.BONUSES.COMMANDER, TankmanRoleBonusesField.BONUSES.EQUIPMENTS, TankmanRoleBonusesField.BONUSES.DEVICES, TankmanRoleBonusesField.BONUSES.BROTHERHOOD ]) addition_ = '' if addition == 0 else self._getSign(addition) + str( addition) penalty_ = '' if penalty == 0 else self._getSign(penalty) + str( penalty) if penalty != 0 or addition != 0: addRoleLevels = ' (' + str( item.roleLevel) + addition_ + penalty_ + ')' else: addRoleLevels = '' if not vehicle or nativeVehicle.shortUserName == vehicle.shortUserName: vehicleName = text_styles.main(nativeVehicle.shortUserName) else: vehicleName = text_styles.critical(nativeVehicle.shortUserName) commonStatsBlock.append( formatters.packTextParameterBlockData( text_styles.main(item.roleUserName + ' ') + vehicleName, text_styles.stats( str(item.roleLevel + penalty + addition) + '%' + addRoleLevels), valueWidth=90, padding=formatters.packPadding(left=0, right=0, top=5, bottom=0))) field = TankmanSkillListField(self, 'skills') _, value = field.buildData() skills = value or [] maxPopUpBlocks = 14 for skill in skills[:maxPopUpBlocks]: commonStatsBlock.append( formatters.packTextParameterBlockData( text_styles.main(skill['label']), text_styles.stats(str(skill['level']) + '%'), valueWidth=90)) if len(skills) > maxPopUpBlocks: diff = str(len(skills) - maxPopUpBlocks) commonStatsBlock.append( formatters.packAlignedTextBlockData( text=text_styles.middleTitle( makeString(TOOLTIPS.HANGAR_CREW_MORESKILLS, skill_cnt=diff)), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)) items.append(formatters.packBuildUpBlockData(commonStatsBlock, gap=5)) field = TankmanNewSkillCountField(self, '') _, newSkillCount = field.buildData() if newSkillCount > 0: items.append( formatters.packImageTextBlockData( img='../maps/icons/tankmen/skills/small/new_skill.png', txtOffset=20, padding=formatters.packPadding(bottom=0, top=5, left=0), imgPadding=formatters.packPadding(left=0, top=3), title=makeHtmlString( 'html_templates:lobby/textStyle', 'goldTextTitle', { 'message': makeString(TOOLTIPS. HANGAR_CREW_NEW_SKILL_AVAILABLE_HEADER) }), desc=makeHtmlString( 'html_templates:lobby/textStyle', 'goldTextField', { 'message': makeString( TOOLTIPS.HANGAR_CREW_NEW_SKILL_AVAILABLE_TEXT) }))) field = TankmanStatusField(self, '') _, value = field.buildData() status = value or {} if 'header' in status and status['header'] != '': items.append( formatters.packImageTextBlockData( title=text_styles.warning(status['header']), desc=makeHtmlString('html_templates:lobby/textStyle', 'statusWarningField', {'message': status['text']}))) return items
def _getBottom(self, state): vehicle = g_currentVehicle.item isObtained = self._marathonCtrl.isVehicleObtained() if isObtained: statusLabel = text_styles.bonusAppliedText( icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_OKICON, vSpace=-2) + ' ' + _ms(TOOLTIPS.MARATHON_EXTRA_STATE_COMPLETED)) return formatters.packTextBlockData( text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', { 'align': 'center', 'message': statusLabel }), padding=formatters.packPadding(bottom=20)) if state == MARATHON_STATE.IN_PROGRESS: warning = self._marathonCtrl.checkForWarnings(vehicle) if warning == MARATHON_WARNING.WRONG_BATTLE_TYPE: return formatters.packTextBlockData( text=makeHtmlString( 'html_templates:lobby/textStyle', 'alignText', { 'align': 'center', 'message': text_styles.critical( _ms(TOOLTIPS.MARATHON_ERROR_BATTLE_TYPE)) }), padding=formatters.packPadding(bottom=20)) if warning == MARATHON_WARNING.WRONG_VEH_TYPE: return formatters.packTextBlockData( text=makeHtmlString( 'html_templates:lobby/textStyle', 'alignText', { 'align': 'center', 'message': text_styles.critical( _ms(TOOLTIPS.MARATHON_ERROR_VEH_TYPE)) }), padding=formatters.packPadding(bottom=20)) currentStep, allStep = self._marathonCtrl.getMarathonProgress() if allStep: return formatters.packTextBlockData( text=makeHtmlString( 'html_templates:lobby/textStyle', 'alignText', { 'align': 'center', 'message': text_styles.middleTitle( _ms(TOOLTIPS.MARATHON_EXTRA_STATE_STEPS, currentStep=currentStep, allStep=text_styles.main(allStep))) }), padding=formatters.packPadding(bottom=20)) else: discount = self._marathonCtrl.getMarathonDiscount() return formatters.packTextBlockData( text=makeHtmlString( 'html_templates:lobby/textStyle', 'alignText', { 'align': 'center', 'message': text_styles.bonusPreviewText( _ms(TOOLTIPS.MARATHON_EXTRA_STATE_DISCOUNT, discount=discount)) }), padding=formatters.packPadding(bottom=20))