def __formatBlueprintBalance(self): bpRequester = self._itemsCache.items.blueprints self.__intelligenceAmount = bpRequester.getIntelligenceData() self.__nationalFragmentsData = bpRequester.getAllNationalFragmentsData( ) selectedNation = SelectedNation.getIndex() nationalAmount = self.__nationalFragmentsData.get(selectedNation, 0) balanceStr = text_styles.main( backport.text( R.strings.blueprints.blueprintScreen.resourcesOnStorage())) intFragmentVO = { 'iconPath': backport.image(R.images.gui.maps.icons.blueprints.fragment.small. intelligence()), 'title': backport.getIntegralFormat(self.__intelligenceAmount), 'fragmentCD': BlueprintTypes.INTELLIGENCE_DATA } natFragmentVO = { 'iconPath': backport.image( R.images.gui.maps.icons.blueprints.fragment.small.dyn( SelectedNation.getName())()), 'title': backport.getIntegralFormat(nationalAmount), 'fragmentCD': getNationalFragmentCD(selectedNation) } balanceVO = { 'balanceStr': balanceStr, 'internationalItemVO': intFragmentVO, 'nationalItemVO': natFragmentVO } return balanceVO
def _getHeaderData(self, data): targetData = data[0] histBattleFieldAchievesCount = 0 for record in layouts.HISTORY_BATTLEFIELD_GROUP: achieve = targetData.getAchievement(record) if achieve.isInDossier(): histBattleFieldAchievesCount += 1 histBattleFieldAchievesCount = backport.getIntegralFormat( histBattleFieldAchievesCount) return (PUtils.getTotalBattlesHeaderParam( targetData, PROFILE.SECTION_STATISTICS_SCORES_TOTALBATTLES, PROFILE.PROFILE_PARAMS_TOOLTIP_BATTLESCOUNT), PUtils.packLditItemData( self._formattedWinsEfficiency, PROFILE.SECTION_STATISTICS_SCORES_TOTALWINS, PROFILE.PROFILE_PARAMS_TOOLTIP_WINS, 'wins40x32.png'), PUtils.packLditItemData( histBattleFieldAchievesCount, PROFILE.SECTION_STATISTICS_SCORES_ACHIEVEMENTSCOUNT, PROFILE.PROFILE_PARAMS_TOOLTIP_ACHIEVEMENTSCOUNT, 'honors40x32.png'), PUtils.packLditItemData( backport.getIntegralFormat(len(targetData.getVehicles())), PROFILE.SECTION_STATISTICS_SCORES_USEDTECHNICS, PROFILE.PROFILE_PARAMS_TOOLTIP_USEDTECHNICS, 'techRatio40x32.png'))
def getItemPricesViewModel(statsMoney, *itemPrices, **kwargs): result = [] for itemPrice in itemPrices: priceModels = [] if itemPrice.isDefined(): for currency in Currency.ALL: currencyValue = itemPrice.price.get(currency) if currencyValue is not None: actionPriceModel = ActionPriceModel() isEnough = statsMoney.get(currency) >= currencyValue if not isEnough and 'exchangeRate' in kwargs and currency == Currency.CREDITS: isEnough = canBuyWithGoldExchange(itemPrice.price, statsMoney, kwargs.get('exchangeRate')) actionPriceModel.setIsEnough(isEnough) currencyAction = itemPrice.getActionPrcAsMoney().get(currency) hasAction = currencyAction is not None if hasAction: updateActionInViewModel(currency, actionPriceModel, itemPrice) actionPriceModel.setType(currency) actionPriceModel.setIsWithAction(hasAction) actionPriceModel.setPrice(backport.getIntegralFormat(currencyValue)) defPrice = backport.getIntegralFormat(itemPrice.defPrice.get(currency, 0)) actionPriceModel.setDefPrice(defPrice) if 'isBootcamp' in kwargs: actionPriceModel.setIsBootcamp(kwargs.get('isBootcamp')) priceModels.append(actionPriceModel) else: actionPriceModel = ActionPriceModel() actionPriceModel.setIsFree(True) priceModels.append(actionPriceModel) if priceModels: result.append(priceModels) return result
def _getHeaderData(self, data): targetData = data[0] return ( PUtils.getTotalBattlesHeaderParam( targetData, PROFILE.SECTION_STATISTICS_SCORES_TOTALBATTLES, PROFILE.PROFILE_PARAMS_TOOLTIP_BATTLESCOUNT), PUtils.packLditItemData( self._formattedWinsEfficiency, PROFILE.SECTION_STATISTICS_SCORES_TOTALWINS, PROFILE.PROFILE_PARAMS_TOOLTIP_WINS, 'wins40x32.png'), _packAvgDmgLditItemData(self._avgDmg), _packAvgXPLditItemData(self._avgXP), PUtils.packLditItemData( self._maxXP_formattedStr, PROFILE.SECTION_STATISTICS_SCORES_MAXEXPERIENCE, PROFILE.PROFILE_PARAMS_TOOLTIP_MAXEXP, 'maxExp40x32.png', PUtils.getVehicleRecordTooltipData( targetData.getMaxXpVehicle)), PUtils.packLditItemData( self._damageEfficiency, PROFILE. SECTION_STATISTICS_SCORES_CLAN_SUMMARYDAMAGECOEFFICIENT, PROFILE.PROFILE_PARAMS_TOOLTIP_CLAN_SUMMARYDAMAGECOEFFICIENT, 'dmgRatio40x32.png', PUtils.createToolTipData( (backport.getIntegralFormat(self._dmgDealt), backport.getIntegralFormat(self._dmgReceived)))))
def getI18nValue(self): maxValue = RECORD_MAX_VALUES.get(self.getRecordName()) return i18n.makeString( '#achievements:achievement/maxMedalValue' ) % backport.getIntegralFormat( maxValue - 1 ) if maxValue is not None and self._value >= maxValue else backport.getIntegralFormat( self._value)
def getTotalBattlesHeaderParam(targetData, description, tooltip): battlesCount = targetData.getBattlesCount() lossesCount = targetData.getLossesCount() winsCount = targetData.getWinsCount() drawsCount = targetData.getDrawsCount() drawsStr = backport.getIntegralFormat(drawsCount) if drawsCount >= 0 else ProfileUtils.UNAVAILABLE_SYMBOL battlesToolTipData = (backport.getIntegralFormat(winsCount), backport.getIntegralFormat(lossesCount), drawsStr) return ProfileUtils.packLditItemData(backport.getIntegralFormat(battlesCount), description, tooltip, 'battles40x32.png', ProfileUtils.createToolTipData(battlesToolTipData))
def __formatFragmentProgress(self, current, total, discount): return text_styles.alignText( ''.join((text_styles.credits(backport.getIntegralFormat(current)), text_styles.main(''.join( (' / ', backport.getIntegralFormat(total)))), text_styles.credits(''.join( (' ', backport.getIntegralFormat(discount), '%'))) if discount > 0 else '')), 'right')
def getItemTitle(rawItem, item, forBox=False, additionalInfo=False): if item is not None: title = item.userName if forBox and item.itemTypeName != '': tooltipKey = TOOLTIPS.getItemBoxTooltip(item.itemTypeName) if tooltipKey: title = _ms(tooltipKey, group=item.userType, value=item.userName) title = title.replace(_DOUBLE_OPEN_QUOTES, _OPEN_QUOTES).replace( _DOUBLE_CLOSE_QUOTES, _CLOSE_QUOTES) elif rawItem.type == ItemPackType.CUSTOM_SLOT: title = _ms(key=TOOLTIPS.AWARDITEM_SLOTS_HEADER) elif rawItem.type == ItemPackType.CUSTOM_GOLD: title = _ms(key=QUESTS.BONUSES_GOLD_DESCRIPTION, value=rawItem.count) elif rawItem.type == ItemPackType.CUSTOM_CREDITS: title = backport.text(R.strings.quests.bonuses.credits.description(), value=backport.getIntegralFormat(rawItem.count)) elif rawItem.type == ItemPackType.CUSTOM_CRYSTAL: title = _ms(key=QUESTS.BONUSES_CRYSTAL_DESCRIPTION, value=backport.getIntegralFormat(rawItem.count)) elif rawItem.type in (ItemPackType.CUSTOM_EVENT_COIN, ItemPackType.CUSTOM_EVENT_COIN_EXTERNAL): title = _ms(key=QUESTS.BONUSES_EVENTCOIN_DESCRIPTION, value=rawItem.count) elif rawItem.type == ItemPackType.CUSTOM_SUPPLY_POINT: title = _ms(EPIC_BATTLE.EPICBATTLEITEM_SUPPLYPOINTS_HEADER) elif rawItem.type == ItemPackType.CUSTOM_REWARD_POINT: title = _ms(EPIC_BATTLE.EPICBATTLEITEM_REWARDPOINTS_HEADER) elif rawItem.type == ItemPackType.CUSTOM_PREMIUM: title = backport.text(R.strings.tooltips.premium.days.header(), rawItem.count) elif rawItem.type == ItemPackType.CUSTOM_PREMIUM_PLUS: title = backport.text(R.strings.tooltips.premiumPlus.days.header(), rawItem.count) elif rawItem.type == ItemPackType.CUSTOM_REFERRAL_CREW: vehicle = g_currentPreviewVehicle.item title = _ms(TOOLTIPS.CUSTOMCREW_REFERRAL_HEADER, vehicle=vehicle.userName) elif rawItem.type in ItemPackTypeGroup.CREW: if additionalInfo: title = _ms(TOOLTIPS.CREW_BODY, value={ ItemPackType.CREW_50: CrewTypes.SKILL_50, ItemPackType.CREW_75: CrewTypes.SKILL_75, ItemPackType.CREW_100: CrewTypes.SKILL_100, ItemPackType.CUSTOM_CREW_100: CrewTypes.SKILL_100 }.get(rawItem.type)) else: title = _ms(TOOLTIPS.CREW_HEADER) elif rawItem.type == ItemPackType.CUSTOM_EVENT_PROGRESSION_REWARD_POINT: title = backport.text(R.strings.tooltips.vehiclePreview.buyingPanel. eventProgression.price.header()) else: title = rawItem.title or '' return title
def setRecord(self, result, _): noDamage = result.noDamageDirectHitsReceived damageBlocked = result.damageBlockedByArmor self.usedArmorCount = noDamage if noDamage > 0 or damageBlocked > 0: self._isEmpty = False rickochets = result.rickochetsReceived self.armorValues = [backport.getIntegralFormat(rickochets), backport.getIntegralFormat(noDamage), backport.getIntegralFormat(damageBlocked)] self.armorNames = [i18n.makeString(BATTLE_RESULTS.COMMON_TOOLTIP_ARMOR_PART1), i18n.makeString(BATTLE_RESULTS.COMMON_TOOLTIP_ARMOR_PART2), i18n.makeString(BATTLE_RESULTS.COMMON_TOOLTIP_ARMOR_PART3, vals=style.getTooltipParamsStyle())]
def setRecord(self, result, reusable): piercings = result.piercings damageDealt = result.damageDealt self.piercings = piercings self._isEmpty = piercings <= 0 if damageDealt > 0: self._isEmpty = False self.damageDealtValues = [backport.getIntegralFormat(damageDealt), backport.getIntegralFormat(piercings)] self.damageDealtNames = [i18n.makeString(BATTLE_RESULTS.COMMON_TOOLTIP_DAMAGE_PART1, vals=style.getTooltipParamsStyle()), i18n.makeString(BATTLE_RESULTS.COMMON_TOOLTIP_DAMAGE_PART2)]
def _buildTooltipData(self, targetData, isCurrentUser): lossesCount = targetData.getLossesCount() winsCount = targetData.getWinsCount() drawsCount = targetData.getDrawsCount() drawsStr = backport.getIntegralFormat( drawsCount) if drawsCount >= 0 else ProfileUtils.UNAVAILABLE_SYMBOL return ProfileUtils.createToolTipData( (backport.getIntegralFormat(winsCount), backport.getIntegralFormat(lossesCount), drawsStr))
def processRatioValue(value): if value.ratio is not None: return backport.getNiceNumberFormat(float(value.ratio)) elif value.dealt is not None and value.received is not None: ctx = {'numerator': backport.getIntegralFormat(value.dealt), 'denominator': backport.getIntegralFormat(value.received)} sourceKey = 'inverse' if value.dealt == 0 else 'normal' return makeHtmlString('html_templates:lobby/session_stats/', 'ratio', ctx, sourceKey=sourceKey) else: return '-'
def __makeConfirmator(self): xpLimit = self.itemsCache.items.shop.freeXPConversionLimit extra = {'resultCurrencyAmount': backport.getIntegralFormat(self.xp), 'primaryCurrencyAmount': backport.getGoldFormat(self.gold)} if self.__freeConversion: sourceKey = 'XP_EXCHANGE_FOR_FREE' extra['freeXPLimit'] = backport.getIntegralFormat(xpLimit) else: sourceKey = 'XP_EXCHANGE_FOR_GOLD' return plugins.HtmlMessageConfirmator('exchangeXPConfirmation', 'html_templates:lobby/dialogs', 'confirmExchangeXP', extra, sourceKey=sourceKey)
def setRecord(self, result, _): count = result.stunNum assisted = result.damageAssistedStun duration = result.stunDuration self.stunNum = count self.stunDuration = duration if count > 0 or assisted > 0 or duration > 0: self._isEmpty = False self.stunValues = [backport.getIntegralFormat(assisted), backport.getIntegralFormat(count), backport.getFractionalFormat(duration)] self.stunNames = [i18n.makeString(BATTLE_RESULTS.COMMON_TOOLTIP_STUN_PART1, vals=style.getTooltipParamsStyle()), i18n.makeString(BATTLE_RESULTS.COMMON_TOOLTIP_STUN_PART2), i18n.makeString(BATTLE_RESULTS.COMMON_TOOLTIP_STUN_PART3, vals=style.getTooltipParamsStyle(BATTLE_RESULTS.COMMON_TOOLTIP_PARAMS_VAL_SECONDS))]
def _buildTooltipData(self, targetData, isCurrentUser): destructionToolTipData = [ backport.getIntegralFormat(targetData.getFragsCount()), backport.getIntegralFormat(targetData.getDeathsCount()) ] if isinstance(targetData, _FalloutStatsBlock): if isinstance(targetData, _VehiclesStatsBlock): destructionToolTipData.append( backport.getIntegralFormat( targetData.getConsumablesFragsCount())) return ProfileUtils.createToolTipData(destructionToolTipData)
def setRecord(self, result, _): capturePoints = result.capturePoints defencePoints = result.droppedCapturePoints self.captureTotalItems = capturePoints self.defenceTotalItems = defencePoints if self._showCapturePoints and capturePoints > 0: self.captureValues = (backport.getIntegralFormat(capturePoints),) self.captureNames = (i18n.makeString(BATTLE_RESULTS.COMMON_TOOLTIP_CAPTURE_TOTALPOINTS),) if self._showDefencePoints and defencePoints > 0: self.defenceValues = (backport.getIntegralFormat(defencePoints),) self.defenceNames = (i18n.makeString(BATTLE_RESULTS.COMMON_TOOLTIP_DEFENCE_TOTALPOINTS),)
def _buildTooltipData(self, targetData, isCurrentUser): damageToolTipData = [ backport.getIntegralFormat(targetData.getDamageDealt()), backport.getIntegralFormat(targetData.getDamageReceived()) ] if isinstance(targetData, _FalloutStatsBlock): if isinstance(targetData, _VehiclesStatsBlock): damageToolTipData.append( backport.getIntegralFormat( targetData.getConsumablesDamageDealt())) return ProfileUtils.createToolTipData(damageToolTipData)
def _getHeaderData(self, data): targetData = data[0] stepsEfficiency = targetData.getStepsEfficiency() avgPointsPercent = PUtils.formatFloatPercent(stepsEfficiency) if stepsEfficiency > 0 else PUtils.UNAVAILABLE_SYMBOL stepsCount = targetData.getStepsCount() stepsCount = backport.getIntegralFormat(stepsCount) if stepsCount >= 0 else PUtils.UNAVAILABLE_SYMBOL avgPointsTooltipData = (stepsCount, backport.getIntegralFormat(targetData.getBattlesCount())) return (PUtils.getTotalBattlesHeaderParam(targetData, PROFILE.SECTION_STATISTICS_SCORES_TOTALBATTLES, PROFILE.PROFILE_PARAMS_TOOLTIP_BATTLESCOUNT), PUtils.packLditItemData(avgPointsPercent, PROFILE.SECTION_STATISTICS_SCORES_RANKED_AVGPOINTS, PROFILE.PROFILE_PARAMS_TOOLTIP_RANKED_AVGPOINTS, 'rankStageFactor40x32.png', PUtils.createToolTipData(avgPointsTooltipData)), _packAvgDmgLditItemData(self._avgDmg), _packAvgXPLditItemData(self._avgXP))
def _getlocalizeLinkedSetQuestString(localizedKey, quest): curProgress, totalProgress = getProgressFromQuestWithSingleAccumulative( quest) kwargs = {} if curProgress is not None and totalProgress is not None: kwargs.update({ 'cur_progress': backport.getIntegralFormat(curProgress), 'total_progress': backport.getIntegralFormat(totalProgress) }) return _ms(localizedKey, **kwargs)
def getStats(self): clusterCCU = self.__stats.get('clusterCCU', 0) regionCCU = self.__stats.get('regionCCU', 0) if regionCCU and not constants.IS_CHINA: clusterUsers = backport.getIntegralFormat(clusterCCU) regionUsers = backport.getIntegralFormat(regionCCU) if clusterCCU == regionCCU: tooltipType = STATS_TYPE.CLUSTER else: tooltipType = STATS_TYPE.FULL else: clusterUsers = regionUsers = '-' tooltipType = STATS_TYPE.UNAVAILABLE return (clusterUsers, regionUsers, tooltipType)
def _makeVO(self, province): isRobbed = self.__isRobbed(province) result = { 'front': '%s %s' % (self.__getFront(province), text_styles.standard( formatField(province.getFrontLevel, formatter=int2roman))), 'province': self.__getProvinceName(province), 'map': self.__getMap(province), 'primeTime': text_styles.main(province.getUserPrimeTime()), 'days': text_styles.main( backport.getIntegralFormat(self.__getDays(province))), 'isRobbed': isRobbed } if isRobbed: restoreTime = province.getPillageEndDatetime() result.update({ 'robbedTooltip': makeTooltip( None, text_styles.concatStylesToMultiLine( text_styles.main( _ms(CLANS. GLOBALMAPVIEW_TABLE_PROVINCEROBBED_TOOLTIP_NOINCOME )), text_styles.neutral( _ms(CLANS. GLOBALMAPVIEW_TABLE_PROVINCEROBBED_TOOLTIP_RESTORETIME, date=text_styles.main( formatters.formatShortDateShortTimeString( restoreTime)))))) }) if self.__showTreasuryData: result.update({ 'income': text_styles.gold( backport.getIntegralFormat(self.__getIncome(province))), 'noIncomeIconVisible': not province.isHqConnected() or isRobbed, 'noIncomeTooltip': CLANS.GLOBALMAPVIEW_NOINCOME_TOOLTIP }) return result
def makeBuildingIndicatorsVO(buildingLevel, progress, hpVal, hpTotalVal, defResVal, maxDefResVal): FORMAT_PATTERN = '###' if progress == FORT_ALIAS.STATE_FOUNDATION_DEF or progress == FORT_ALIAS.STATE_FOUNDATION: hpValueFormatter = text_styles.alert(FORMAT_PATTERN) else: hpValueFormatter = text_styles.defRes(FORMAT_PATTERN) hpTotalFormatted = str(backport.getIntegralFormat(hpTotalVal)) + ' ' formattedHpTotal = ''.join( (text_styles.standard(hpTotalFormatted), icons.nut())) defResValueFormatter = text_styles.alert( FORMAT_PATTERN) if defResVal > maxDefResVal else text_styles.defRes( FORMAT_PATTERN) maxDefDerFormatted = str(backport.getIntegralFormat(maxDefResVal)) + ' ' formattedDefResTotal = ''.join( (text_styles.standard(maxDefDerFormatted), icons.nut())) hpProgressLabels = { 'currentValue': str(backport.getIntegralFormat(hpVal)), 'currentValueFormatter': hpValueFormatter, 'totalValue': formattedHpTotal, 'separator': '/' } storeProgressLabels = { 'currentValue': str(backport.getIntegralFormat(defResVal)), 'currentValueFormatter': defResValueFormatter, 'totalValue': formattedDefResTotal, 'separator': '/' } result = { 'hpLabel': i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_HPLBL), 'defResLabel': i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_DEFRESLBL), 'hpCurrentValue': hpVal, 'hpTotalValue': hpTotalVal, 'defResCurrentValue': defResVal, 'defResCompensationValue': max(0, defResVal - maxDefResVal), 'defResTotalValue': maxDefResVal, 'hpProgressLabels': hpProgressLabels, 'defResProgressLabels': storeProgressLabels } return result
def __formatLabel(self, data): labelFormat = data.get('label_format') if labelFormat is None: return else: ctx = self.bootcampController.getContext() if 'bonuses' not in ctx: return lessonBonuses = ctx['bonuses']['battle'][self.bootcampController.getLessonNum() - 1] if labelFormat == 'getCredits': nationId = ctx['nation'] nationsData = lessonBonuses.get('nations', None) if nationsData is not None: formattedValue = backport.getIntegralFormat(nationsData[NATION_NAMES[nationId]]['credits']['win'][0]) data['label'] = data['label'].format(formattedValue) elif labelFormat == 'getExperience': nationId = ctx['nation'] nationsData = lessonBonuses.get('nations', None) if nationsData is not None: formattedValue = backport.getIntegralFormat(nationsData[NATION_NAMES[nationId]]['xp']['win'][0]) data['label'] = data['label'].format(formattedValue) elif labelFormat == 'getGold': data['label'] = data['label'].format(lessonBonuses['gold']) elif labelFormat == 'getPremiumHours': premiumType = PREMIUM_ENTITLEMENTS.PLUS if PREMIUM_ENTITLEMENTS.PLUS in lessonBonuses else PREMIUM_ENTITLEMENTS.BASIC days = lessonBonuses[premiumType] timeInSeconds = days * time_utils.ONE_DAY if timeInSeconds > time_utils.ONE_DAY: time = ceil(timeInSeconds / time_utils.ONE_DAY) timeMetric = backport.text(R.strings.menu.header.account.premium.days()) else: time = ceil(timeInSeconds / time_utils.ONE_HOUR) timeMetric = backport.text(R.strings.menu.header.account.premium.hours()) data['label'] = data['label'].format(str(int(time)) + ' ' + timeMetric) elif labelFormat == 'getRepairKits': data['label'] = data['label'].format(lessonBonuses['equipment']['largeRepairkit']['count']) elif labelFormat == 'getFirstAid': data['label'] = data['label'].format(lessonBonuses['equipment']['largeMedkit']['count']) elif labelFormat == 'getFireExtinguisher': data['label'] = data['label'].format(lessonBonuses['equipment']['handExtinguishers']['count']) elif labelFormat == 'getExtraHealthReserve': count = 0 for key, value in lessonBonuses['optional'].iteritems(): if key.startswith('extraHealthReserve'): count += value['count'] data['label'] = data['label'].format(count) return
def _getUnlockDiscountBlock(percentValue, xpValue, title, showPlus=False): if percentValue == 100: discountPadding = 8 if showPlus else 19 elif percentValue < 10: discountPadding = 30 if showPlus else 41 else: discountPadding = 19 if showPlus else 30 percentStr = ''.join(('+' if showPlus else '', str(percentValue), '%')) discountValueStr = text_styles.concatStylesToSingleLine( text_styles.bonusLocalText(percentStr), text_styles.main( i18n.makeString(TOOLTIPS.VEHICLE_TEXTDELIMITER_OR).join( (' ', ' '))), icons.xpCost(), text_styles.expText(backport.getIntegralFormat(xpValue))) blockPadding = -discountPadding - (0 if showPlus else -10) imgPadding = -79 - (3 if percentValue < 10 else 0) return formatters.packImageTextBlockData( title=text_styles.main(title), desc=discountValueStr, img=backport.image(R.images.gui.maps.icons.blueprints. blueprintScreen.discountShine()), txtGap=-6, imgPadding=formatters.packPadding(top=0, right=imgPadding), txtPadding=formatters.packPadding(left=discountPadding), padding=formatters.packPadding(top=4, left=blockPadding, bottom=-6), blockWidth=300)
def _getMsgCtx(self): return { 'name': self.item.userName, 'kind': self.item.userType, 'count': backport.getIntegralFormat(int(self.count)), 'money': formatPrice(self._getOpPrice().price) }
def _getHeaderData(self, data): targetData = data[0] accountDossier = data[1] numTotalRandomVehicles = self._getListOfUniqueVehicles( targetData, accountDossier) return (PUtils.getTotalBattlesHeaderParam( targetData, PROFILE.SECTION_STATISTICS_SCORES_TOTALBATTLES, PROFILE.PROFILE_PARAMS_TOOLTIP_BATTLESCOUNT), PUtils.packLditItemData( self._formattedWinsEfficiency, PROFILE.SECTION_STATISTICS_SCORES_TOTALWINS, PROFILE.PROFILE_PARAMS_TOOLTIP_WINS, 'wins40x32.png'), _packAvgDmgLditItemData(self._avgDmg), _packAvgXPLditItemData(self._avgXP), PUtils.packLditItemData( self._maxXP_formattedStr, PROFILE.SECTION_STATISTICS_SCORES_MAXEXPERIENCE, PROFILE.PROFILE_PARAMS_TOOLTIP_MAXEXP, 'maxExp40x32.png', PUtils.getVehicleRecordTooltipData( targetData.getMaxXpVehicle)), PUtils.packLditItemData( style.makeMarksOfMasteryText( backport.getIntegralFormat( targetData.getMarksOfMastery()[3]), numTotalRandomVehicles), PROFILE.SECTION_STATISTICS_SCORES_COOLSIGNS, PROFILE.PROFILE_PARAMS_TOOLTIP_MARKOFMASTERY, 'markOfMastery40x32.png'))
def _getVehicleStats(self, vehicle): if vehicle.isOnlyForBattleRoyaleBattles: return {'statsText': '', 'visibleStats': False} else: intCD = vehicle.intCD vehicleRandomStats = self._randomStats.getVehicles() if self._randomStats is not None else {} if intCD in vehicleRandomStats: battlesCount, wins, _ = vehicleRandomStats.get(intCD) markOfMastery = self._randomStats.getMarkOfMasteryForVehicle(intCD) if isMarkOfMasteryAchieved(markOfMastery): markOfMasteryText = makeHtmlString('html_templates:lobby/tank_carousel/statistic', 'markOfMastery', ctx={'markOfMastery': markOfMastery}) else: markOfMasteryText = '' winsEfficiency = 100.0 * wins / battlesCount if battlesCount else 0 winsEfficiencyStr = backport.getIntegralFormat(round(winsEfficiency)) + '%' winsText = makeHtmlString('html_templates:lobby/tank_carousel/statistic', 'wins', ctx={'wins': winsEfficiencyStr}) vehDossier = self._itemsCache.items.getVehicleDossier(intCD) vehStats = vehDossier.getTotalStats() marksOnGun = vehStats.getAchievement(MARK_ON_GUN_RECORD) marksOnGunText = '' if marksOnGun.getValue() > 0: marksOnGunText = makeHtmlString('html_templates:lobby/tank_carousel/statistic', 'marksOnGun', ctx={'count': marksOnGun.getValue()}) template = '{} {} {}' if vehicle.isEarnCrystals else '{} {} {}' statsText = template.format(markOfMasteryText, winsText, marksOnGunText) else: statsText = '#menu:tankCarousel/statsStatus/unavailable' return {'statsText': text_styles.stats(statsText), 'visibleStats': self._showVehicleStats}
def getDescription(self): return text_styles.main( i18n.makeString( '#menu:awardWindow/specialAchievement/victory/description%d' % self.messageNumber, victoriesCount=backport.getIntegralFormat( self.victoriesCount)))
def getWGMCurrencyValue(self, key): if not self.isWGMAvailable(): return _UNKNOWN_VALUE elif self.__data is None: return _WAITING_FOR_DATA else: return backport.getIntegralFormat(int(self.__data[key])) if key in self.__data else _UNKNOWN_VALUE
def makePlayerVO(pInfo, user, colorGetter, isPlayerSpeaking=False): if user is not None: colors = colorGetter(user.getGuiType()) tags = list(user.getTags()) else: colors = colorGetter(USER_GUI_TYPE.OTHER) tags = [] rating = backport.getIntegralFormat(pInfo.rating) badge = pInfo.getBadge() badgeVO = badge.getBadgeVO(ICONS_SIZES.X24, {'isAtlasSource': False}) if badge else {} return { 'isInvite': pInfo.isInvite(), 'dbID': pInfo.dbID, 'accID': pInfo.accID, 'isCommander': pInfo.isCommander(), 'userName': pInfo.name, 'fullName': pInfo.getFullName(), 'clanAbbrev': pInfo.clanAbbrev, 'region': pInfo.getRegion(), 'colors': colors, 'rating': rating, 'readyState': pInfo.isReady, 'tags': tags, 'isPlayerSpeaking': isPlayerSpeaking, 'isOffline': pInfo.isOffline(), 'igrType': pInfo.igrType, 'isRatingAvailable': True, 'badgeVisualVO': badgeVO }