def _packStatusBlock(self, data): status = '' if data['status'] == STATUS.ON_BOARD: status = text_styles.statInfo( _ms('#vehicle_customization:customization/tooltip/status/onBoard' )) elif data['status'] == STATUS.ALREADY_HAVE: status = text_styles.statInfo( _ms('#vehicle_customization:customization/tooltip/status/alreadyHave' )) elif data['status'] == STATUS.AVAILABLE_FOR_BUY: status = text_styles.warning( _ms('#vehicle_customization:customization/tooltip/status/availableForBuy' )) elif data['status'] == STATUS.DO_MISSION: status = text_styles.warning( _ms('#vehicle_customization:customization/tooltip/status/doMission' )) elif data['status'] == STATUS.DO_IGR: status = icons.premiumIgrBig() return formatters.packTextBlockData(text=makeHtmlString( 'html_templates:lobby/textStyle', 'alignText', { 'align': 'center', 'message': status }), padding={ 'bottom': -4, 'top': -4 })
def __getHelpText(self): visitor = g_sessionProvider.arenaVisitor isSolo = visitor.isSoloTeam(avatar_getter.getPlayerTeam()) plusStr = makeString(FALLOUT.INFOPANEL_SINGLEHELPTEXT_PLUS) isMultiteam = visitor.gui.isFalloutMultiTeam() headerStr = makeHtmlString( _HTML_TEMPLATE_FALLOUT_INFO_KEY, 'header', makeString(FALLOUT.INFOPANEL_SECRETWIN_HEAD)) additionalBlockTemplate = makeHtmlString( _HTML_TEMPLATE_FALLOUT_INFO_KEY, 'winPoints') costKill, costFlags, costDamage = visitor.type.getWinPointsCosts( isSolo=isSolo, forVehicle=True) helpStr = '' if visitor.hasFlags() and len(costFlags) > 0: costFlags = list(costFlags)[0] helpStr = self.__getAdditionalBlockStr( additionalBlockTemplate, FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_FLAGCAPTURE, warning(plusStr + str(costFlags))) if isMultiteam and isSolo: helpStr = self.__getAdditionalBlockStr( additionalBlockTemplate, FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_FLAGDESTROY, warning(plusStr + str(costFlags))) helpStr += self.__getAdditionalBlockStr( additionalBlockTemplate, FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_KILL, warning(plusStr + str(costKill))) damageDealt, points = costDamage points = warning(plusStr + str(points)) helpStr += additionalBlockTemplate % makeString( FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_DAMAGE, points=points, damageDealt=damageDealt) return headerStr + helpStr
def _onRegisterFlashComponent(self, viewPy, alias): if len(self._tankman.skills) < 1: if self._tankman.roleLevel < 100: controlNumber = 0 question = _ms(DIALOGS.DISMISSTANKMAN_MESSAGE) else: controlNumber = self._tankman.roleLevel question = _ms(DIALOGS.PROTECTEDDISMISSTANKMAN_MAINMESSAGE, roleLevel=text_styles.warning( str(controlNumber))) else: lastSkill = self._tankman.skills[-1] if lastSkill.isPerk: skillType = DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE_ISPERK else: skillType = DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE_ISABILLITY question = _ms(DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE, skillType=_ms(skillType), skillName=text_styles.neutral(lastSkill.userName), roleLevel=text_styles.warning(str(lastSkill.level))) controlNumber = lastSkill.level viewPy.setControlNumbers(str(controlNumber)) viewPy.questionBody = text_styles.main(question) viewPy.errorMsg = text_styles.error( DIALOGS.PROTECTEDDISMISSTANKMAN_ERRORMESSAGE)
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 _getDivisionText(ladderInfo): if ladderInfo.isInLadder(): leagueStr = text_styles.warning(getLeagueString(ladderInfo.getLeague())) divisionStr = text_styles.warning(getDivisionString(ladderInfo.division)) return text_styles.middleTitle(_ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_LADDER_LEAGUEDIVISION, league=leagueStr, division=divisionStr)) else: return text_styles.alert(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOTENOUGHGAMES_WARNING)
def _getDivisionText(ladderInfo): if ladderInfo.isInLadder(): leagueStr = text_styles.warning(getLeagueString( ladderInfo.getLeague())) divisionStr = text_styles.warning( getDivisionString(ladderInfo.division)) return text_styles.middleTitle( _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_LADDER_LEAGUEDIVISION, league=leagueStr, division=divisionStr)) else: return text_styles.alert( CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOTENOUGHGAMES_WARNING)
def _packStatusBlock(self, item): status = '' if item['status'] == STATUS.ON_BOARD: status = text_styles.statInfo(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_STATUS_ONBOARD)) elif item['status'] == STATUS.ALREADY_HAVE: status = text_styles.statInfo(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_STATUS_ALREADYHAVE)) elif item['status'] == STATUS.AVAILABLE_FOR_BUY: status = text_styles.warning(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_STATUS_AVAILABLEFORBUY)) elif item['status'] == STATUS.DO_MISSION: status = text_styles.warning(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_STATUS_DOMISSION)) elif item['status'] == STATUS.DO_IGR: status = icons.premiumIgrBig() return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center', 'message': status}), padding={'bottom': -4, 'top': -4})
def _packStatusBlock(self, data): status = '' if data['status'] == STATUS.ON_BOARD: status = text_styles.statInfo(_ms('#vehicle_customization:customization/tooltip/status/onBoard')) elif data['status'] == STATUS.ALREADY_HAVE: status = text_styles.statInfo(_ms('#vehicle_customization:customization/tooltip/status/alreadyHave')) elif data['status'] == STATUS.AVAILABLE_FOR_BUY: status = text_styles.warning(_ms('#vehicle_customization:customization/tooltip/status/availableForBuy')) elif data['status'] == STATUS.DO_MISSION: status = text_styles.warning(_ms('#vehicle_customization:customization/tooltip/status/doMission')) elif data['status'] == STATUS.DO_IGR: status = icons.premiumIgrBig() return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center', 'message': status}), padding={'bottom': -4, 'top': -4})
def __packStatusBlock(self): result = [] if self.item.isQualification(): if self.item.isCurrent(): status = text_styles.warning( backport.text(R.strings.tooltips.battleTypes.ranked.rank. status.qualificationNotEarned())) else: status = text_styles.statInfo( backport.text(R.strings.tooltips.battleTypes.ranked.rank. status.receivedQualification())) elif self.item.isAcquired(): status = text_styles.statInfo( backport.text(R.strings.tooltips.battleTypes.ranked.rank. status.received())) elif self.item.isLost(): status = text_styles.statusAlert( backport.text( R.strings.tooltips.battleTypes.ranked.rank.status.lost())) else: status = text_styles.warning( backport.text(R.strings.tooltips.battleTypes.ranked.rank. status.notearned())) result.append( formatters.packAlignedTextBlockData( status, BLOCKS_TOOLTIP_TYPES.ALIGN_LEFT, padding=formatters.packPadding(top=-4))) division = self.item.getDivision() if not division.isCurrent() and not division.isCompleted(): result.append( formatters.packTextBlockData( text_styles.main( backport.text(R.strings.tooltips.battleTypes.ranked. rank.anotherDivision(), division=division.getUserName())))) if self.item.isQualification() and self.item.isCurrent(): result.append( formatters.packTextBlockData( text_styles.main( backport.text(R.strings.tooltips.battleTypes.ranked. rank.conditions.qualification(), count=self.rankedController. getTotalQualificationBattles())))) if not self.item.isAcquired(): result.append(formatters.packTextBlockData( self.__packStepsBlock())) return result
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 _makeLockBlock(self): clanLockTime = self.vehicle.clanLock if clanLockTime and clanLockTime <= time_utils.getCurrentTimestamp(): LOG_DEBUG("clan lock time is less than current time: %s" % clanLockTime) clanLockTime = None isDisabledInRoaming = self.vehicle.isDisabledInRoaming if clanLockTime or isDisabledInRoaming: headerLock = text_styles.concatStylesToMultiLine(text_styles.warning(_ms(TOOLTIPS.TANKCARUSEL_LOCK_HEADER))) if isDisabledInRoaming: textLock = text_styles.main(_ms(TOOLTIPS.TANKCARUSEL_LOCK_ROAMING)) else: time = time_utils.getDateTimeFormat(clanLockTime) timeStr = text_styles.main(text_styles.concatStylesWithSpace(_ms(TOOLTIPS.TANKCARUSEL_LOCK_TO), time)) textLock = text_styles.concatStylesToMultiLine( timeStr, text_styles.main(_ms(TOOLTIPS.TANKCARUSEL_LOCK_CLAN)) ) lockHeaderBlock = formatters.packTextBlockData( headerLock, padding=formatters.packPadding(left=77 + self.leftPadding, top=5) ) lockTextBlock = formatters.packTextBlockData( textLock, padding=formatters.packPadding(left=77 + self.leftPadding) ) return formatters.packBuildUpBlockData( [lockHeaderBlock, lockTextBlock], stretchBg=False, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LOCK_BG_LINKAGE, padding=formatters.packPadding(left=-17, top=20, bottom=0), ) else: return return
def __getAvailableStatus(self, pawnsCount): return text_styles.warning( _ms(PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_STATUS_AVAILABLE, count=pawnsCount, img=icons.makeImageTag( RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_FREE_SHEET, 24, 24, -6, 0)))
def _getStatusData(self): message = '' if self.vehicleStats.battleCnt: message = text_styles.statInfo(backport.text(R.strings.session_stats.tankInfo.status.total(), total=self.vehicleStats.battleCnt)) else: message = text_styles.warning(backport.text(R.strings.session_stats.tankInfo.status.warning())) return TankStatusVO(status=message)
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 _packStatusBlock(self, item): status = "" if item["status"] == STATUS.ON_BOARD: status = text_styles.statInfo(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_STATUS_ONBOARD)) elif item["status"] == STATUS.ALREADY_HAVE: status = text_styles.statInfo(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_STATUS_ALREADYHAVE)) elif item["status"] == STATUS.AVAILABLE_FOR_BUY: status = text_styles.warning(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_STATUS_AVAILABLEFORBUY)) elif item["status"] == STATUS.DO_MISSION: status = text_styles.warning(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_STATUS_DOMISSION)) elif item["status"] == STATUS.DO_IGR: status = icons.premiumIgrBig() return formatters.packTextBlockData( text=makeHtmlString("html_templates:lobby/textStyle", "alignText", {"align": "center", "message": status}), padding={"bottom": -4, "top": -4}, )
def __getAvailableStatus(self, pawnsCount): return text_styles.warning( _ms(PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_STATUS_AVAILABLE, count=pawnsCount, img=icons.makeImageTag( AwardSheetPresenter.getIcon(AwardSheetPresenter.Size.TINY), 24, 24, -6, 0)))
def _prepareData(self, serverList, serverName, serverTimeLeft): if len(serverList) == 1: serversDDEnabled = False else: serversDDEnabled = True applyButtonLabel = _ms(RANKED_BATTLES.PRIMETIME_APPLYBTN) title = text_styles.epicTitle(RANKED_BATTLES.PRIMETIME_TITLE) if self._isEnabled: timeLeftStr = time_utils.getTillTimeString( serverTimeLeft, MENU.HEADERBUTTONS_BATTLE_TYPES_RANKED_AVAILABILITY) status = text_styles.main( _ms(RANKED_BATTLES.PRIMETIME_STATUS_THISENABLE, server=serverName, time=text_styles.warning(timeLeftStr))) mainBackground = RES_ICONS.MAPS_ICONS_RANKEDBATTLES_PRIMETIME_PRIME_TIME_BACK_DEFAULT title = text_styles.epicTitle( RANKED_BATTLES.PRIMETIME_TITLEWELCOME) else: applyButtonLabel = _ms(RANKED_BATTLES.PRIMETIME_CONTINUEBTN) status = '{} {}\n{}'.format( icons.alert(-3), text_styles.alert( RANKED_BATTLES.PRIMETIME_STATUS_DISABLEFIRST), text_styles.main(RANKED_BATTLES.PRIMETIME_STATUS_DISABLE)) mainBackground = RES_ICONS.MAPS_ICONS_RANKEDBATTLES_PRIMETIME_PRIME_TIME_BACK_BW return { 'title': title, 'apply': applyButtonLabel, 'mainBackground': mainBackground, 'status': status, 'serversDDEnabled': serversDDEnabled, 'serverDDVisible': True }
def __buildStatusBlock(self): if self.__isForVehicleRank(): maxRank = self.rankedController.getMaxRank( vehicle=self.item.getVehicle()) achievedCount = '0' if maxRank is not None and maxRank.getType() == RANK_TYPES.VEHICLE: achievedCount = maxRank.getSerialID() vehicleName = self.item.getVehicle().userName achievedStr = text_styles.middleTitle(achievedCount) descr = text_styles.main( _ms(TOOLTIPS.BATTLETYPES_RANKED_VEHRANK_ACHIEVEDCOUNT, vehName=vehicleName)) descr = descr + achievedStr return formatters.packCounterTextBlockData( achievedCount, descr, padding=formatters.packPadding(left=3, bottom=-5)) else: if self.item.isAcquired(): status = text_styles.statInfo( TOOLTIPS.BATTLETYPES_RANKED_RANK_STATUS_RECEIVED) elif self.item.isLost(): status = text_styles.statusAlert( TOOLTIPS.BATTLETYPES_RANKED_RANK_STATUS_LOST) else: status = text_styles.warning( TOOLTIPS.BATTLETYPES_RANKED_RANK_STATUS_NOTEARNED) return formatters.packAlignedTextBlockData( status, BLOCKS_TOOLTIP_TYPES.ALIGN_LEFT, padding=formatters.packPadding(top=-4))
def _populate(self): super(ReferralReferralsIntroWindow, self)._populate() contentKey = 'referrals' if self.__isNewbie else 'phenix' referrerNameFmt = text_styles.warning(self.__referrerName) handIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_REFERRAL_REFERRALSMALLHAND, 16, 16, -4, 0) self.as_setDataS({'titleTF': text_styles.promoTitle(i18n.makeString(MENU.REFERRALREFERRALSINTROWINDOW_TEXT_BLOCK_TITLE, userName=getattr(BigWorld.player(), 'name', 'Unknown'))), 'bodyTF': text_styles.main(i18n.makeString(MENU.referralreferralsintrowindow_text_block_body(contentKey), referrerName=referrerNameFmt, handIcon=handIcon)), 'squadTF': text_styles.main(i18n.makeString(MENU.REFERRALREFERRALSINTROWINDOW_TEXT_BLOCK_SQUAD_TEXT))})
def __packStatusBlock(self): if self.__blueprintData.filledCount == 0: status = text_styles.warning(TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_EMPTYSTATUS) elif self.__blueprintData.filledCount == self.__blueprintData.totalCount: status = text_styles.statInfo(TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_COMPLETESTATUS) else: status = text_styles.statusAttention(TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_INCOMPLETESTATUS) status = text_styles.alignText(status, 'center') return formatters.packTextBlockData(text=status, padding=formatters.packPadding(top=5, bottom=-3))
def _getLadderPointsText(ladderInfo): if ladderInfo.isInLadder(): ladderPtsStr = text_styles.warning(str(ladderInfo.getRatingPoints())) return text_styles.main( _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_LADDER_LADDERPTS, points=ladderPtsStr)) else: return text_styles.main( CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOTENOUGHGAMES_INFO)
def __wrapWithGiftCongrats(self, text, giftInfo, userResolved): lootboxType = self.__lootbox.getType() resourceShortcut = R.strings.ny.giftSystem.notification.congrats congratsText = text_styles.warning( getGiftSystemCongratulationText( giftInfo.metaInfo.get('message_id', 0))) if userResolved: clanAbbrev = getClanAbbrevString( self._clanAbbrev) if self._clanAbbrev else '' user = text_styles.warning( text_styles.concatStylesWithSpace(self._userName, clanAbbrev)) giftMessage = backport.text( resourceShortcut.withName.dyn(lootboxType)(), name=user, text=congratsText) else: giftMessage = backport.text( resourceShortcut.empty.dyn(lootboxType)(), text=congratsText) return text_styles.concatStylesToMultiLine(giftMessage, '', text)
def _packSeparator(cls, key): return { 'linkage': MISSIONS_ALIASES.OR_CONDITIONS_SEPARATOR, 'linkageBig': MISSIONS_ALIASES.OR_CONDITIONS_SEPARATOR, 'rendererLinkage': None, 'data': { 'label': text_styles.warning(i18n.makeString(key).upper()) }, 'isDetailed': True }
def _packBlocks(self, paramName): blocks = super(VehicleSimpleParametersTooltipData, self)._packBlocks(paramName) title = text_styles.highTitle(MENU.tank_params(paramName)) value = param_formatter.colorizedFormatParameter(self._extendedData, self.context.formatters) desc = text_styles.main(_ms(TOOLTIPS.tank_params_desc(paramName))) comparator = self.context.getComparator() icon = param_formatter.getGroupPenaltyIcon(comparator.getExtendedData(paramName), comparator) valueLeftPadding = -3 if icon else 6 blocks.append(formatters.packTitleDescParameterWithIconBlockData(title, text_styles.warning(_ms(TOOLTIPS.VEHICLEPARAMS_TITLE_VALUETEMPLATE, value=value)), icon=icon, desc=desc, valueAtRight=True, iconPadding=formatters.packPadding(left=0, top=6), valuePadding=formatters.packPadding(left=valueLeftPadding, top=4))) return blocks
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 _createMoreInfoBlock(self, items): 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']})))
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 _makeEntity(self, _, userResolved=False): if userResolved: clanAbbrev = getClanAbbrevString( self._clanAbbrev) if self._clanAbbrev else '' user = text_styles.warning( text_styles.concatStylesWithSpace(self._userName, clanAbbrev)) text = backport.text( R.strings.ny.giftSystem.notification.sent.withName(), name=user) else: text = backport.text( R.strings.ny.giftSystem.notification.sent.empty()) return g_settings.msgTemplates.format(self._TEMPLATE, ctx={'text': text})
def __getHelpText(self): visitor = self.sessionProvider.arenaVisitor isSolo = visitor.isSoloTeam(avatar_getter.getPlayerTeam()) plusStr = makeString(FALLOUT.INFOPANEL_SINGLEHELPTEXT_PLUS) headerStr = makeHtmlString( _HTML_TEMPLATE_FALLOUT_INFO_KEY, 'header', makeString(FALLOUT.INFOPANEL_SECRETWIN_HEAD)) additionalBlockTemplate = makeHtmlString( _HTML_TEMPLATE_FALLOUT_INFO_KEY, 'winPoints') costKill, costFlags, costDamage = visitor.type.getWinPointsCosts( isSolo=isSolo, forVehicle=True) helpStr = '' helpStr += self.__getAdditionalBlockStr( additionalBlockTemplate, FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_KILL, warning(plusStr + str(costKill))) damageDealt, points = costDamage points = warning(plusStr + str(points)) helpStr += additionalBlockTemplate % makeString( FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_DAMAGE, points=points, damageDealt=damageDealt) return headerStr + helpStr
def __packStatusBlock(self): if self.__vehicle.isUnlocked: status = text_styles.statInfo( TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_UNLOCKEDSTATUS) elif self.__blueprintData.filledCount == 0: status = text_styles.warning( TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_EMPTYSTATUS) elif self.__blueprintData.filledCount == self.__blueprintData.totalCount: status = text_styles.statInfo( TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_COMPLETESTATUS) else: status = text_styles.statusAttention( TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_INCOMPLETESTATUS) status = text_styles.alignText(status, 'center') return formatters.packTextBlockData(text=status)
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 __getHelpText(self): visitor = g_sessionProvider.arenaVisitor isSolo = visitor.isSoloTeam(avatar_getter.getPlayerTeam()) plusStr = makeString(FALLOUT.INFOPANEL_SINGLEHELPTEXT_PLUS) isMultiteam = visitor.gui.isFalloutMultiTeam() headerStr = makeHtmlString(_HTML_TEMPLATE_FALLOUT_INFO_KEY, 'header', makeString(FALLOUT.INFOPANEL_SECRETWIN_HEAD)) additionalBlockTemplate = makeHtmlString(_HTML_TEMPLATE_FALLOUT_INFO_KEY, 'winPoints') costKill, costFlags, costDamage = visitor.type.getWinPointsCosts(isSolo=isSolo, forVehicle=True) helpStr = '' if visitor.hasFlags() and len(costFlags) > 0: costFlags = list(costFlags)[0] helpStr = self.__getAdditionalBlockStr(additionalBlockTemplate, FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_FLAGCAPTURE, warning(plusStr + str(costFlags))) if isMultiteam and isSolo: helpStr = self.__getAdditionalBlockStr(additionalBlockTemplate, FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_FLAGDESTROY, warning(plusStr + str(costFlags))) helpStr += self.__getAdditionalBlockStr(additionalBlockTemplate, FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_KILL, warning(plusStr + str(costKill))) damageDealt, points = costDamage points = warning(plusStr + str(points)) helpStr += additionalBlockTemplate % makeString(FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_DAMAGE, points=points, damageDealt=damageDealt) return headerStr + helpStr
def _getMainAwards(self, bonuses): awards = [] strAwardsList = [] strAwards = '' for b in bonuses: formatter = self._formatters.get(b.getName(), None) if callable(formatter): for bonus in formatter(b): awards.append({'value': bonus.value, 'itemSource': bonus.icon, 'tooltip': bonus.tooltip, 'boosterVO': bonus.bonusVO}) else: strAwardsList.append(text_styles.warning(b.format())) if len(strAwardsList): strAwards = ', '.join(strAwardsList) return (awards, strAwards)
def __getAwards(self): awards = [] strAwards = '' result = [] bonuses = self.__content.get('bonuses', {}) for n, v in bonuses.iteritems(): b = getTutorialBonusObj(n, v) if b is not None: formatter = self._formatters.get(b.getName(), None) if callable(formatter): for bonus in formatter(b): awards.append({'value': bonus.value, 'itemSource': bonus.icon}) else: result.append(text_styles.warning(b.format())) if len(result): strAwards = ', '.join(result) return (awards, strAwards)
def _getMainAwards(self, bonuses): awards = [] strAwardsList = [] strAwards = '' for b in bonuses: formatter = self._formatters.get(b.getName(), None) if callable(formatter): for bonus in formatter(b): awards.append({'value': bonus.value, 'itemSource': bonus.icon, 'tooltip': bonus.tooltip, 'boosterVO': bonus.bonusVO}) formattedBonus = b.format() if formattedBonus: strAwardsList.append(text_styles.warning(formattedBonus)) if strAwardsList: strAwards = ', '.join(strAwardsList) return (awards, strAwards)
def _prepareData(self, serverList, serverName, serverTimeLeft): enableTitle, enableWelcomeTitle, enableBtnTitle, disableTitle, disableStatusTitle, disableStatusDescr, disableBtnTitle = self._getLocaleData() enableBackground, disableBackground = self._getImgsData() if self._isEnabled: timeLeftStr = time_utils.getTillTimeString(serverTimeLeft, MENU.HEADERBUTTONS_BATTLE_TYPES_RANKED_AVAILABILITY) status = text_styles.main(_ms(enableTitle, server=serverName, time=text_styles.warning(timeLeftStr))) mainBackground = enableBackground title = text_styles.epicTitle(enableWelcomeTitle) applyButtonLabel = _ms(enableBtnTitle) else: status = '{} {}\n{}'.format(icons.alert(-3), text_styles.alert(disableStatusTitle), text_styles.main(disableStatusDescr)) mainBackground = disableBackground title = text_styles.epicTitle(disableTitle) applyButtonLabel = _ms(disableBtnTitle) return {'title': title, 'apply': applyButtonLabel, 'mainBackground': mainBackground, 'status': status, 'serversDDEnabled': len(serverList) > 1, 'serverDDVisible': True}
def __getHelpText(self): arena = BigWorld.player().arena arenaType = arena.arenaType isSolo = len(list(g_sessionProvider.getArenaDP().getVehiclesIterator())) == 1 plusStr = makeString(FALLOUT.INFOPANEL_SINGLEHELPTEXT_PLUS) isMultiteam = isFalloutMultiTeam() headerStr = makeHtmlString(_HTML_TEMPLATE_FALLOUT_INFO_KEY, 'header', makeString(FALLOUT.INFOPANEL_SECRETWIN_HEAD)) additionalBlockTemplate = makeHtmlString(_HTML_TEMPLATE_FALLOUT_INFO_KEY, 'winPoints') costKill, costFlags, costDamage = getCosts(arenaType, isSolo, True) helpStr = '' if hasFlags(arenaType, arena.bonusType) and len(costFlags) > 0: costFlags = list(costFlags)[0] helpStr = self.__getAdditionalBlockStr(additionalBlockTemplate, FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_FLAGCAPTURE, warning(plusStr + str(costFlags))) if isMultiteam and isSolo: helpStr = self.__getAdditionalBlockStr(additionalBlockTemplate, FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_FLAGDESTROY, warning(plusStr + str(costFlags))) helpStr += self.__getAdditionalBlockStr(additionalBlockTemplate, FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_KILL, warning(plusStr + str(costKill))) damageDealt, points = costDamage points = warning(plusStr + str(points)) helpStr += additionalBlockTemplate % makeString(FALLOUT.INFOPANEL_SINGLEHELPTEXT_WINPOINTS_DAMAGE, points=points, damageDealt=damageDealt) return headerStr + helpStr
def _getValue(self): header = '' text = '' statusTemplate = '#tooltips:tankman/status/%s' tankman = self._tooltip.item vehicle = None if tankman.isInTank: vehicle = self.itemsCache.items.getVehicle(tankman.vehicleInvID) nativeVehicle = self.itemsCache.items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr) if tankman.isDismissed: return {'header': text_styles.warning(TOOLTIPS.BARRACKS_TANKMEN_RECOVERY_HEADER), 'text': getRecoveryStatusText(getTankmenRestoreInfo(tankman)), 'level': TANKMAN_DISMISSED} else: inactiveRoles = list() if tankman.isInTank: for skill in tankman.skills: if not skill.isEnable: role = self.__getRoleBySkill(skill) if role not in inactiveRoles: inactiveRoles.append(role) if vehicle is not None and nativeVehicle.innationID != vehicle.innationID: if (vehicle.isPremium or vehicle.isPremiumIGR) and vehicle.type in nativeVehicle.tags: header = makeString(statusTemplate % 'wrongPremiumVehicle/header') text = makeString(statusTemplate % 'wrongPremiumVehicle/text') % {'vehicle': vehicle.shortUserName} else: header = makeString(statusTemplate % 'wrongVehicle/header') % {'vehicle': vehicle.shortUserName} text = makeString(statusTemplate % 'wrongVehicle/text') elif inactiveRoles: def roleFormat(role): return makeString(statusTemplate % 'inactiveSkillsRoleFormat') % makeString(getSkillsConfig().getSkill(role).userString) header = makeString(statusTemplate % 'inactiveSkills/header') text = makeString(statusTemplate % 'inactiveSkills/text') % {'skills': ', '.join([ roleFormat(role) for role in inactiveRoles ])} return {'header': header, 'text': text, 'level': Vehicle.VEHICLE_STATE_LEVEL.WARNING} return
def _getValue(self): header = '' text = '' statusTemplate = '#tooltips:tankman/status/%s' tankman = self._tooltip.item vehicle = None if tankman.isInTank: vehicle = g_itemsCache.items.getVehicle(tankman.vehicleInvID) nativeVehicle = g_itemsCache.items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr) if tankman.isDismissed: return {'header': text_styles.warning(TOOLTIPS.BARRACKS_TANKMEN_RECOVERY_HEADER), 'text': getRecoveryStatusText(getTankmenRestoreInfo(tankman)), 'level': TANKMAN_DISMISSED} else: inactiveRoles = list() if tankman.isInTank: for skill in tankman.skills: if not skill.isEnable: role = self.__getRoleBySkill(skill) if role not in inactiveRoles: inactiveRoles.append(role) if vehicle is not None and nativeVehicle.innationID != vehicle.innationID: if (vehicle.isPremium or vehicle.isPremiumIGR) and vehicle.type in nativeVehicle.tags: header = makeString(statusTemplate % 'wrongPremiumVehicle/header') text = makeString(statusTemplate % 'wrongPremiumVehicle/text') % {'vehicle': vehicle.shortUserName} else: header = makeString(statusTemplate % 'wrongVehicle/header') % {'vehicle': vehicle.shortUserName} text = makeString(statusTemplate % 'wrongVehicle/text') elif len(inactiveRoles): def roleFormat(role): return makeString(statusTemplate % 'inactiveSkillsRoleFormat') % makeString(getSkillsConfig()[role]['userString']) header = makeString(statusTemplate % 'inactiveSkills/header') text = makeString(statusTemplate % 'inactiveSkills/text') % {'skills': ', '.join([ roleFormat(role) for role in inactiveRoles ])} return {'header': header, 'text': text, 'level': Vehicle.VEHICLE_STATE_LEVEL.WARNING} return
def __getAwards(self): awards = [] strAwards = '' result = [] bonuses = self.__content.get('bonuses', {}) for n, v in bonuses.iteritems(): b = getTutorialBonusObj(n, v) if b is not None: formatter = self._formatters.get(b.getName(), None) if callable(formatter): for bonus in formatter(b): awards.append({ 'value': bonus.value, 'itemSource': bonus.icon }) else: result.append(text_styles.warning(b.format())) if len(result): strAwards = ', '.join(result) return (awards, strAwards)
def __updateData(self): selectedIdx = self.__serversDP.getSelectedIdx() serverItem = self.__serversList[selectedIdx] selectedItem = self.__serversDP.getVO(selectedIdx) currentServerName = selectedItem['label'] if len(self.__serversList) == 1: serverDDName = text_styles.concatStylesToSingleLine( text_styles.main(currentServerName), ' ', selectedItem['pingValue']) serversDDEnabled = False else: serverDDName = '' serversDDEnabled = True applyButtonLabel = _ms(RANKED_BATTLES.PRIMETIME_APPLYBTN) title = _ms(RANKED_BATTLES.PRIMETIME_TITLE) if self.__isEnabled: timeLeftStr = time_utils.getTillTimeString( serverItem['timeLeft'], MENU.HEADERBUTTONS_BATTLE_TYPES_RANKED_AVAILABILITY) status = text_styles.main( _ms(RANKED_BATTLES.PRIMETIME_STATUS_THISENABLE, server=currentServerName, time=text_styles.warning(timeLeftStr))) mainBackground = RES_ICONS.MAPS_ICONS_RANKEDBATTLES_PRIMETIME_PRIME_TIME_BACK_DEFAULT title = _ms(RANKED_BATTLES.PRIMETIME_TITLEWELCOME) else: applyButtonLabel = _ms(RANKED_BATTLES.PRIMETIME_CONTINUEBTN) status = '{} {}'.format( icons.alert(-3), text_styles.main(_ms(RANKED_BATTLES.PRIMETIME_STATUS_DISABLE))) mainBackground = RES_ICONS.MAPS_ICONS_RANKEDBATTLES_PRIMETIME_PRIME_TIME_BACK_BW self.as_setDataS({ 'title': title, 'apply': applyButtonLabel, 'mainBackground': mainBackground, 'status': status, 'serversDDEnabled': serversDDEnabled, 'serverDDVisible': True })
def _packAwardsReceivedFootnoteBlock(self, alreadyReachedPrestigeLevel): if alreadyReachedPrestigeLevel: rewardBlockText = formatters.packImageTextBlockData( title=text_styles.statInfo( i18n.makeString( EPIC_BATTLE.PRESTIGEPROGRESS_TOOLTIP_AWARDRECEIVED)), img=RES_ICONS.MAPS_ICONS_BUTTONS_CHECKMARK, imgPadding=formatters.packPadding(left=2, top=3), padding=formatters.packPadding(top=0, left=20, bottom=0, right=20)) else: rewardBlockText = formatters.packTextBlockData(text_styles.warning( i18n.makeString( EPIC_BATTLE.PRESTIGEPROGRESS_TOOLTIP_AWARDNOTYETCLAIMED)), padding=formatters. packPadding( top=0, left=20, bottom=0, right=20)) return rewardBlockText
def _getLadderPointsText(ladderInfo): if ladderInfo.isInLadder(): ladderPtsStr = text_styles.warning(str(ladderInfo.getRatingPoints())) return text_styles.main(_ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_LADDER_LADDERPTS, points=ladderPtsStr)) else: return text_styles.main(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOTENOUGHGAMES_INFO)
def _onRegisterFlashComponent(self, viewPy, alias): if len(self._tankman.skills) < 1: if self._tankman.roleLevel < 100: controlNumber = 0 question = _ms(DIALOGS.DISMISSTANKMAN_MESSAGE) else: controlNumber = self._tankman.roleLevel question = _ms(DIALOGS.PROTECTEDDISMISSTANKMAN_MAINMESSAGE, roleLevel=text_styles.warning(str(controlNumber))) else: lastSkill = self._tankman.skills[-1] if lastSkill.isPerk: skillType = DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE_ISPERK else: skillType = DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE_ISABILLITY question = _ms(DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE, skillType=_ms(skillType), skillName=text_styles.neutral(lastSkill.userName), roleLevel=text_styles.warning(str(lastSkill.level))) controlNumber = lastSkill.level viewPy.setControlNumbers(str(controlNumber)) viewPy.questionBody = text_styles.main(question) viewPy.errorMsg = text_styles.error(DIALOGS.PROTECTEDDISMISSTANKMAN_ERRORMESSAGE)