def __init__(self, vehicle, item, slotIdx, gunCompDescr, conflictedEqs = None): self.__vehInvID = vehicle.inventoryID self.__slotIdx = int(slotIdx) self.__gunCompDescr = gunCompDescr self.__vehicle = vehicle conflictedEqs = conflictedEqs or tuple() conflictMsg = '' if conflictedEqs: self.__makeConflictMsg("', '".join([ eq.userName for eq in conflictedEqs ])) self.__mayInstall, installReason = item.mayInstall(vehicle, slotIdx) super(BuyAndInstallItemProcessor, self).__init__(item, 1, True) self.addPlugins([plugins.ModuleValidator(item)]) if self.__mayInstall: self.addPlugins([plugins.VehicleValidator(vehicle, True, prop={'isBroken': True, 'isLocked': True}), plugins.CompatibilityInstallValidator(vehicle, item, slotIdx), plugins.ModuleBuyerConfirmator('confirmBuyAndInstall', ctx={'userString': item.userName, 'typeString': self.item.userType, 'conflictedEqs': conflictMsg, 'credits': BigWorld.wg_getIntegralFormat(self._getOpPrice().credits)})]) if item.itemTypeID == GUI_ITEM_TYPE.TURRET: self.addPlugin(plugins.TurretCompatibilityInstallValidator(vehicle, item, self.__gunCompDescr)) elif item.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE: self.addPlugin(plugins.MessageConfirmator('installConfirmationNotRemovable', ctx={'name': item.userName}, isEnabled=not item.isRemovable)) self.addPlugin(plugins.MessageConfirmator('removeIncompatibleEqs', ctx={'name': "', '".join([ eq.userName for eq in conflictedEqs ])}, isEnabled=bool(conflictedEqs))) else: self.addPlugins([plugins.ModuleBuyerConfirmator('confirmBuyNotInstall', ctx={'userString': item.userName, 'typeString': self.item.userType, 'credits': BigWorld.wg_getIntegralFormat(self._getOpPrice().credits), 'reason': self.__makeInstallReasonMsg(installReason)})])
def _getTechniqueListVehicles(self, targetData, addVehiclesThatInHangarOnly = False): result = [] for intCD, (battlesCount, wins, markOfMastery, xp) in targetData.getVehicles().iteritems(): avgXP = xp / battlesCount if battlesCount else 0 vehicle = g_itemsCache.items.getItemByCD(intCD) if vehicle is not None: isInHangar = vehicle.invID > 0 if addVehiclesThatInHangarOnly and not isInHangar: continue if self._battlesType == PROFILE_DROPDOWN_KEYS.FALLOUT: winsEfficiency = wins winsEfficiencyStr = BigWorld.wg_getIntegralFormat(winsEfficiency) else: winsEfficiency = 100.0 * wins / battlesCount if battlesCount else 0 winsEfficiencyStr = BigWorld.wg_getIntegralFormat(round(winsEfficiency)) + '%' result.append({'id': intCD, 'inventoryID': vehicle.invID, 'shortUserName': vehicle.shortUserName, 'battlesCount': battlesCount, 'winsEfficiency': winsEfficiency, 'winsEfficiencyStr': winsEfficiencyStr, 'avgExperience': avgXP, 'userName': vehicle.userName, 'typeIndex': VEHICLE_TABLE_TYPES_ORDER_INDICES_REVERSED[vehicle.type], 'nationIndex': GUI_NATIONS_ORDER_INDEX[NAMES[vehicle.nationID]], 'nationID': vehicle.nationID, 'level': vehicle.level, 'markOfMastery': self.__getMarkOfMasteryVal(markOfMastery), 'markOfMasteryBlock': ACHIEVEMENT_BLOCK.TOTAL, 'tankIconPath': vehicle.iconSmall, 'typeIconPath': '../maps/icons/filters/tanks/%s.png' % vehicle.type, 'isInHangar': isInHangar}) return result
def _getShortInfo(self, vehicle = None, expanded = False): description = i18n.makeString('#menu:descriptions/' + self.itemTypeName) caliber = self.descriptor.gun['shots'][0]['shell']['caliber'] armor = findVehicleArmorMinMax(self.descriptor) return description % {'weight': BigWorld.wg_getNiceNumberFormat(float(self.descriptor.physics['weight']) / 1000), 'hullArmor': BigWorld.wg_getIntegralFormat(armor[1]), 'caliber': BigWorld.wg_getIntegralFormat(caliber)}
def _makeStats(totalStats): battlesNumData = { "text": BigWorld.wg_getIntegralFormat(totalStats.getBattlesCount()), "description": _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_STATS_BATTLES), "iconPath": RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_BATTLES40X32, "tooltip": TOOLTIPS.STATICFORMATIONSUMMARYVIEW_STATS_BATTLES, } winsEfficiency = totalStats.getWinsEfficiency() * 100 if totalStats.getWinsEfficiency() else 0 winsPercentData = { "text": BigWorld.wg_getNiceNumberFormat(winsEfficiency) + "%", "description": _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_STATS_WINSPERCENT), "iconPath": RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_WINS40X32, "tooltip": TOOLTIPS.STATICFORMATIONSUMMARYVIEW_STATS_WINSPERCENT, } attackDamageEfficiency = { "text": BigWorld.wg_getIntegralFormat(totalStats.getAttackDamageEfficiency() or 0), "description": _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_STATS_ATTACKDAMAGEEFFICIENCY), "iconPath": RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_AVGATTACKDMG40X32, "tooltip": TOOLTIPS.STATICFORMATIONSUMMARYVIEW_STATS_WINSBYCAPTURE, } defenceDamageEfficiency = { "text": BigWorld.wg_getIntegralFormat(totalStats.getDefenceDamageEfficiency() or 0), "description": _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_STATS_DEFENCEDAMAGEEFFICIENCY), "iconPath": RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_AVGDEFENCEDMG40X32, "tooltip": TOOLTIPS.STATICFORMATIONSUMMARYVIEW_STATS_TECHDEFEATS, } return (battlesNumData, winsPercentData, attackDamageEfficiency, defenceDamageEfficiency)
def makeBuildingIndicatorsVO(buildingLevel, progress, hpVal, hpTotalVal, defResVal, maxDefResVal): textStyle = TextType.DEFRES_TEXT if progress == FORT_ALIAS.STATE_FOUNDATION_DEF or progress == FORT_ALIAS.STATE_FOUNDATION: textStyle = TextType.ALERT_TEXT formattedHpValue = TextManager.reference().getText(textStyle, str(BigWorld.wg_getIntegralFormat(hpVal))) hpTotalFormatted = str(BigWorld.wg_getIntegralFormat(hpTotalVal)) + ' ' formattedHpTotal = TextManager.reference().concatStyles(((TextType.STANDARD_TEXT, hpTotalFormatted), (TextIcons.NUT_ICON,))) formattedDefResValue = TextManager.reference().getText(TextType.DEFRES_TEXT, str(BigWorld.wg_getIntegralFormat(defResVal))) maxDefDerFormatted = str(BigWorld.wg_getIntegralFormat(maxDefResVal)) + ' ' formattedDefResTotal = TextManager.reference().concatStyles(((TextType.STANDARD_TEXT, maxDefDerFormatted), (TextIcons.NUT_ICON,))) hpProgressLabels = {'currentValue': formattedHpValue, 'totalValue': formattedHpTotal, 'separator': '/'} storeProgressLabels = {'currentValue': formattedDefResValue, 'totalValue': formattedDefResTotal, 'separator': '/'} result = {'hpLabel': i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_HPLBL), 'defResLabel': i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_DEFRESLBL), 'hpCurrentValue': hpVal, 'hpTotalValue': hpTotalVal, 'defResCurrentValue': defResVal, 'defResTotalValue': maxDefResVal, 'hpProgressLabels': hpProgressLabels, 'defResProgressLabels': storeProgressLabels} return result
def _getDetailedData(self, data): targetData = data[0] dataList = [] if isFortificationBattlesEnabled(): dataList.append(_getDetailedStatisticsData(PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_FORTBATTLES, self.__fortBattlesTargetData, isCurrentUser=self._isCurrentUser, layout=FORT_STATISTICS_LAYOUT)) dataList.append(_getDetailedStatisticsData(PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_FORTSORTIE, targetData, isCurrentUser=self._isCurrentUser)) specificData = [] battlesCount = self.__fortBattlesTargetData.getBattlesCount() lossesCount = self.__fortBattlesTargetData.getLossesCount() winsCount = self.__fortBattlesTargetData.getWinsCount() formattedBattlesCount = BigWorld.wg_getIntegralFormat(battlesCount) specificDataColumn1 = [] if isFortificationBattlesEnabled(): specificDataColumn1.append(PUtils.getLabelDataObject(PROFILE.SECTION_STATISTICS_BODYPARAMS_LABEL_FORTBATTLES, (DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTTOTALBATTLES, formattedBattlesCount, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_BATTLES, PUtils.createToolTipData((BigWorld.wg_getIntegralFormat(winsCount), BigWorld.wg_getIntegralFormat(lossesCount)))), DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLESTOTALWINS, PUtils.getFormattedWinsEfficiency(self.__fortBattlesTargetData), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLESWINS), DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_LOOTING, self.__fortMiscTargetData.getEnemyBasePlunderNumber(), PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_LOOTING), DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_ATTACKS, self.__fortMiscTargetData.getAttackNumber(), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_ATTACKS), DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_DEFENCES, self.__fortMiscTargetData.getDefenceHours(), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_DEFENCES)))) battlesCount = targetData.getBattlesCount() lossesCount = targetData.getLossesCount() winsCount = targetData.getWinsCount() drawsCount = targetData.getDrawsCount() formattedBattlesCount = BigWorld.wg_getIntegralFormat(battlesCount) specificDataColumn1.append(PUtils.getLabelDataObject(PROFILE.SECTION_STATISTICS_BODYPARAMS_LABEL_FORTSORTIE, (DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORT_SORTIE, formattedBattlesCount, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_SORTIE, PUtils.createToolTipData((BigWorld.wg_getIntegralFormat(winsCount), BigWorld.wg_getIntegralFormat(lossesCount), BigWorld.wg_getIntegralFormat(drawsCount)))), DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTSORTIETOTALWINS, self._formattedWinsEfficiency, PROFILE.PROFILE_PARAMS_TOOLTIP_FORTSORTIEWINS)))) specificData.append(specificDataColumn1) resourcesDataList = [DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTSORTIES_AVGRESOURCES, self.__avgFortSortiesLoot, PROFILE.PROFILE_PARAMS_TOOLTIP_FORTSORTIES_AVGRESOURCES), DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTSORTIES_TOTALRESOURCES, BigWorld.wg_getIntegralFormat(self.__totalSortiesLoot), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTSORTIES_TOTALRESOURCES)] specificDataColumn2 = [] if isFortificationBattlesEnabled(): resourcesDataList.append(DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_TOTALRESOURCES, BigWorld.wg_getIntegralFormat(self.__fortMiscTargetData.getLootInBattles()), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_TOTALRESOURCES)) resourcesDataList.append(DSUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_MAXRESOURCES, BigWorld.wg_getIntegralFormat(self.__fortMiscTargetData.getMaxLootInBattles()), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_MAXRESOURCES)) specificDataColumn2.append(PUtils.getLabelDataObject(PROFILE.SECTION_STATISTICS_BODYPARAMS_LABEL_RESOURCE, resourcesDataList)) specificData.append(specificDataColumn2) dataList.append(PUtils.getLabelViewTypeDataObject(PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_SPECIFIC, specificData, PUtils.VIEW_TYPE_TABLES)) return dataList
def shout_damage(self): if self.avgDMG != 0: self.num += 1 self.SumAvgDmg += self.avgDMG format_str = {'NumDmg': BigWorld.wg_getIntegralFormat(self.num), 'AvgDmg': BigWorld.wg_getIntegralFormat(self.SumAvgDmg)} self.flash.data.set_text(config.language['main_text'].format(**format_str)) self.clear_data()
def getVehicleParameters(self, vd, _ = None): pPower = (BigWorld.wg_getIntegralFormat(round(vd.shot[PIERCING_POWER_PROP_NAME][0] - vd.shot[PIERCING_POWER_PROP_NAME][0] * vd.shot['shell']['piercingPowerRandomization'])), BigWorld.wg_getIntegralFormat(round(vd.shot[PIERCING_POWER_PROP_NAME][0] + vd.shot[PIERCING_POWER_PROP_NAME][0] * vd.shot['shell']['piercingPowerRandomization']))) damage = (BigWorld.wg_getIntegralFormat(round(vd.shot['shell'][DAMAGE_PROP_NAME][0] - vd.shot['shell'][DAMAGE_PROP_NAME][0] * vd.shot['shell']['damageRandomization'])), BigWorld.wg_getIntegralFormat(round(vd.shot['shell'][DAMAGE_PROP_NAME][0] + vd.shot['shell'][DAMAGE_PROP_NAME][0] * vd.shot['shell']['damageRandomization']))) weight = (vd.physics['weight'] / 1000, vd.miscAttrs['maxWeight'] / 1000) enginePower = round(vd.physics['enginePower'] / vehicles.HP_TO_WATTS) shotsPerMinute = self._getShotsPerMinute(vd.gun) explosionRadius = round(vd.shot['shell']['explosionRadius'], 2) if vd.shot['shell']['kind'] == 'HIGH_EXPLOSIVE' else 0 return {'maxHealth': vd.maxHealth, 'weight': weight, 'enginePower': enginePower, 'enginePowerPerTon': round(enginePower / weight[0], 2), 'speedLimits': round(vd.physics['speedLimits'][0] * 3.6, 2), 'chassisRotationSpeed': round(180 / math.pi * vd.chassis['rotationSpeed'], 0), 'hullArmor': vd.hull['primaryArmor'], DAMAGE_PROP_NAME: damage, 'damageAvg': vd.shot['shell'][DAMAGE_PROP_NAME][0], 'damageAvgPerMinute': round(shotsPerMinute * vd.shot['shell'][DAMAGE_PROP_NAME][0]), PIERCING_POWER_PROP_NAME: pPower, RELOAD_TIME_PROP_NAME: self._getShotsPerMinute(vd.gun), 'turretRotationSpeed': round(180.0 / math.pi * vd.turret['rotationSpeed']), 'gunRotationSpeed': round(180.0 / math.pi * vd.turret['rotationSpeed']), 'circularVisionRadius': vd.turret['circularVisionRadius'], 'radioDistance': vd.radio['distance'], 'turretArmor': vd.turret['primaryArmor'], 'explosionRadius': explosionRadius, AIMING_TIME_PROP_NAME: round(vd.gun[AIMING_TIME_PROP_NAME], 1), 'shotDispersionAngle': round(vd.gun['shotDispersionAngle'] * 100, 2), 'reloadTimeSecs': round(self.__SEC_IN_MINUTE / shotsPerMinute)}
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(BigWorld.wg_getIntegralFormat(hpTotalVal)) + ' ' formattedHpTotal = ''.join((text_styles.standard(hpTotalFormatted), icons.nut())) defResValueFormatter = text_styles.defRes(FORMAT_PATTERN) maxDefDerFormatted = str(BigWorld.wg_getIntegralFormat(maxDefResVal)) + ' ' formattedDefResTotal = ''.join((text_styles.standard(maxDefDerFormatted), icons.nut())) hpProgressLabels = {'currentValue': str(BigWorld.wg_getIntegralFormat(hpVal)), 'currentValueFormatter': hpValueFormatter, 'totalValue': formattedHpTotal, 'separator': '/'} storeProgressLabels = {'currentValue': str(BigWorld.wg_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, 'defResTotalValue': maxDefResVal, 'hpProgressLabels': hpProgressLabels, 'defResProgressLabels': storeProgressLabels} return result
def __packStaffData(self, club, syncUserInfo=False): members = [] membersDict = club.getMembers() membersCount = len(membersDict) for dbID, member in membersDict.iteritems(): memberType = _getFlashMemberType(member) isSelf = dbID == self.__viewerDbID limits = self.clubsState.getLimits() profile = self.clubsCtrl.getProfile() memberStats = member.getSeasonDossier().getRated7x7Stats() battlesCount = memberStats.getBattlesCount() rating = self.getUserRating(dbID) damageCoef = memberStats.getDamageEfficiency() or 0 avgDamage = memberStats.getAvgDamage() or 0 avgAssistDamage = memberStats.getDamageAssistedEfficiency() or 0 avgExperience = memberStats.getAvgXP() or 0 armorUsingEfficiency = memberStats.getArmorUsingEfficiency() or 0 joinDate = member.getJoiningTime() if isSelf: removeBtnTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_REMOVEHIMSELFBTN else: removeBtnTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_REMOVEMEMBERBTN userData = self.getGuiUserData(dbID) userData.update({"igrType": getIGRCtrl().getRoomType()}) members.append( { "memberId": dbID, "canRemoved": self.__canBeRemoved(profile, club, member, membersCount, limits), "canPassOwnership": limits.canTransferOwnership(profile, club).success, "canShowContextMenu": not isSelf, "removeMemberBtnIcon": RES_ICONS.MAPS_ICONS_LIBRARY_CROSS, "removeMemberBtnTooltip": removeBtnTooltip, "appointmentSortValue": memberType, "appointment": _packAppointment(profile, club, member, memberType, limits), "ratingSortValue": rating, "rating": self.getGuiUserRating(dbID, text_styles.neutral), "battlesCountSortValue": battlesCount, "battlesCount": text_styles.main(BigWorld.wg_getIntegralFormat(battlesCount)), "damageCoefSortValue": damageCoef, "damageCoef": text_styles.main(BigWorld.wg_getNiceNumberFormat(damageCoef)), "avrDamageSortValue": avgDamage, "avrDamage": text_styles.main(BigWorld.wg_getIntegralFormat(avgDamage)), "avrAssistDamageSortValue": avgAssistDamage, "avrAssistDamage": text_styles.main(BigWorld.wg_getNiceNumberFormat(avgAssistDamage)), "avrExperienceSortValue": avgExperience, "avrExperience": text_styles.main(BigWorld.wg_getIntegralFormat(avgExperience)), "tauntSortValue": armorUsingEfficiency, "taunt": text_styles.main(BigWorld.wg_getNiceNumberFormat(armorUsingEfficiency)), "joinDateSortValue": joinDate, "joinDate": text_styles.standard(BigWorld.wg_getShortDateFormat(joinDate)), "userDataSortValue": self.getUserFullName(dbID).lower(), "userData": userData, "clubDbID": self._clubDbID, } ) if syncUserInfo: self.syncUsersInfo() return {"members": sorted(members, key=lambda k: k["userDataSortValue"].lower())}
def getTotalBattlesHeaderParam(targetData, description, tooltip): battlesCount = targetData.getBattlesCount() lossesCount = targetData.getLossesCount() winsCount = targetData.getWinsCount() drawsCount = targetData.getDrawsCount() drawsStr = BigWorld.wg_getIntegralFormat(drawsCount) if drawsCount >= 0 else ProfileUtils.UNAVAILABLE_SYMBOL battlesToolTipData = (BigWorld.wg_getIntegralFormat(winsCount), BigWorld.wg_getIntegralFormat(lossesCount), drawsStr) return ProfileUtils.packLditItemData(BigWorld.wg_getIntegralFormat(battlesCount), description, tooltip, 'battles40x32.png', ProfileUtils.createToolTipData(battlesToolTipData))
def _getKilledTanksStats(stats): killedTanks = stats.getKilledVehiclesCount() lostTanks = stats.getLostVehiclesCount() killedLostRatio = stats.getKilledLostVehiclesRatio() or 0 return [{'label': text_styles.main(CYBERSPORT.STATICFORMATIONSTATSVIEW_ADDSTATS_KILLED), 'value': text_styles.stats(BigWorld.wg_getIntegralFormat(killedTanks))}, {'label': text_styles.main(CYBERSPORT.STATICFORMATIONSTATSVIEW_ADDSTATS_LOST), 'value': text_styles.stats(BigWorld.wg_getIntegralFormat(lostTanks))}, {'label': text_styles.main(CYBERSPORT.STATICFORMATIONSTATSVIEW_ADDSTATS_KILLEDLOSTRATIO), 'value': text_styles.stats(BigWorld.wg_getNiceNumberFormat(killedLostRatio))}]
def _getDamageStats(totalStats): dmgInflicted = totalStats.getDamageDealt() dmgReceived = totalStats.getDamageReceived() damageEfficiency = totalStats.getDamageEfficiency() or 0 return [{'label': text_styles.main(CYBERSPORT.STATICFORMATIONSTATSVIEW_ADDSTATS_DMGINFLICTED), 'value': text_styles.stats(BigWorld.wg_getIntegralFormat(dmgInflicted))}, {'label': text_styles.main(CYBERSPORT.STATICFORMATIONSTATSVIEW_ADDSTATS_DMGRECEIVED), 'value': text_styles.stats(BigWorld.wg_getIntegralFormat(dmgReceived))}, {'label': text_styles.main(CYBERSPORT.STATICFORMATIONSTATSVIEW_ADDSTATS_DMGRATIO), 'value': text_styles.stats(BigWorld.wg_getNiceNumberFormat(damageEfficiency))}]
def __prepareIndicatorData(self, isCanModernization, increment = False, resLeft = 0): if increment: hpTotalVal = self.nextLevel.levelRef.hp hpVal = self.nextLevel.hp defResVal = self.__defResVal - self.__cost + resLeft maxDefResVal = self.nextLevel.levelRef.storage else: hpTotalVal = self.__hpTotalVal hpVal = self.__hpVal defResVal = self.__defResVal maxDefResVal = self.__maxDerResVal formatter = text_styles.defRes if self.__progress == FORTIFICATION_ALIASES.STATE_FOUNDATION_DEF or self.__progress == FORTIFICATION_ALIASES.STATE_FOUNDATION: formatter = text_styles.alert if not isCanModernization and increment: currentHpLabel = text_styles.main('--') currentHpValue = 0 else: currentHpLabel = str(BigWorld.wg_getIntegralFormat(hpVal)) currentHpValue = hpVal FORMAT_PATTERN = '###' formattedHpValue = formatter(FORMAT_PATTERN) formatter = text_styles.standard if increment: formatter = text_styles.neutral formattedHpTotal = formatter(str(BigWorld.wg_getIntegralFormat(hpTotalVal))) formattedHpTotal += ' ' + icons.nut() if not isCanModernization and increment: currentDefResLabel = text_styles.main('--') currentDefResValue = 0 else: currentDefResLabel = str(BigWorld.wg_getIntegralFormat(defResVal)) currentDefResValue = defResVal defResValueFormatter = text_styles.alert(FORMAT_PATTERN) if defResVal > maxDefResVal else text_styles.defRes(FORMAT_PATTERN) formattedDefResTotal = formatter(str(BigWorld.wg_getIntegralFormat(maxDefResVal))) formattedDefResTotal += ' ' + icons.nut() result = {} result['hpLabel'] = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_HPLBL) result['defResLabel'] = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_DEFRESLBL) result['hpCurrentValue'] = currentHpValue result['hpTotalValue'] = hpTotalVal result['defResCurrentValue'] = currentDefResValue result['defResTotalValue'] = maxDefResVal result['defResTotalValue'] = maxDefResVal result['defResCompensationValue'] = max(0, defResVal - maxDefResVal) hpProgressLabels = {} hpProgressLabels['currentValue'] = currentHpLabel hpProgressLabels['currentValueFormatter'] = formattedHpValue hpProgressLabels['totalValue'] = formattedHpTotal hpProgressLabels['separator'] = '/' storeProgressLabels = {} storeProgressLabels['currentValue'] = currentDefResLabel storeProgressLabels['currentValueFormatter'] = defResValueFormatter storeProgressLabels['totalValue'] = formattedDefResTotal storeProgressLabels['separator'] = '/' result['hpProgressLabels'] = hpProgressLabels result['defResProgressLabels'] = storeProgressLabels return result
def getVehicleParameters(self, vd, _=None): pPower = ( BigWorld.wg_getIntegralFormat( round( vd.shot[PIERCING_POWER_PROP_NAME][0] - vd.shot[PIERCING_POWER_PROP_NAME][0] * vd.shot["shell"]["piercingPowerRandomization"] ) ), BigWorld.wg_getIntegralFormat( round( vd.shot[PIERCING_POWER_PROP_NAME][0] + vd.shot[PIERCING_POWER_PROP_NAME][0] * vd.shot["shell"]["piercingPowerRandomization"] ) ), ) damage = ( BigWorld.wg_getIntegralFormat( round( vd.shot["shell"][DAMAGE_PROP_NAME][0] - vd.shot["shell"][DAMAGE_PROP_NAME][0] * vd.shot["shell"]["damageRandomization"] ) ), BigWorld.wg_getIntegralFormat( round( vd.shot["shell"][DAMAGE_PROP_NAME][0] + vd.shot["shell"][DAMAGE_PROP_NAME][0] * vd.shot["shell"]["damageRandomization"] ) ), ) weight = (vd.physics["weight"] / 1000, vd.miscAttrs["maxWeight"] / 1000) enginePower = round(vd.physics["enginePower"] / vehicles.HP_TO_WATTS) shotsPerMinute = self._getShotsPerMinute(vd.gun) explosionRadius = ( round(vd.shot["shell"]["explosionRadius"], 2) if vd.shot["shell"]["kind"] == "HIGH_EXPLOSIVE" else 0 ) return { "maxHealth": vd.maxHealth, "weight": weight, "enginePower": enginePower, "enginePowerPerTon": round(enginePower / weight[0], 2), "speedLimits": round(vd.physics["speedLimits"][0] * 3.6, 2), "chassisRotationSpeed": round(180 / math.pi * vd.chassis["rotationSpeed"], 0), "hullArmor": vd.hull["primaryArmor"], DAMAGE_PROP_NAME: damage, "damageAvg": vd.shot["shell"][DAMAGE_PROP_NAME][0], "damageAvgPerMinute": round(shotsPerMinute * vd.shot["shell"][DAMAGE_PROP_NAME][0]), PIERCING_POWER_PROP_NAME: pPower, RELOAD_TIME_PROP_NAME: self._getShotsPerMinute(vd.gun), "turretRotationSpeed": round(180.0 / math.pi * vd.turret["rotationSpeed"]), "gunRotationSpeed": round(180.0 / math.pi * vd.turret["rotationSpeed"]), "circularVisionRadius": vd.turret["circularVisionRadius"], "radioDistance": vd.radio["distance"], "turretArmor": vd.turret["primaryArmor"], "explosionRadius": explosionRadius, AIMING_TIME_PROP_NAME: round(vd.gun[AIMING_TIME_PROP_NAME], 1), "shotDispersionAngle": round(vd.gun["shotDispersionAngle"] * 100, 2), "reloadTimeSecs": round(self.__SEC_IN_MINUTE / shotsPerMinute), }
def __packStaffData(self, club, syncUserInfo = False): members = [] membersDict = club.getMembers() membersCount = len(membersDict) for dbID, member in membersDict.iteritems(): memberType = _getFlashMemberType(member) isSelf = dbID == self.__viewerDbID limits = self.clubsState.getLimits() profile = self.clubsCtrl.getProfile() memberStats = member.getSeasonDossier().getRated7x7Stats() battlesCount = memberStats.getBattlesCount() rating = self.getUserRating(dbID) damageCoef = memberStats.getDamageEfficiency() or 0 avgDamage = memberStats.getAvgDamage() or 0 avgAssistDamage = memberStats.getDamageAssistedEfficiency() or 0 avgExperience = memberStats.getAvgXP() or 0 armorUsingEfficiency = memberStats.getArmorUsingEfficiency() or 0 joinDate = member.getJoiningTime() contact = self.getContact(dbID) if isSelf: removeBtnTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_REMOVEHIMSELFBTN else: removeBtnTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_REMOVEMEMBERBTN isValid, userData = self.getGuiUserDataWithStatus(dbID) userData.update({'igrType': getIGRCtrl().getRoomType()}) members.append({'memberId': dbID, 'canRemoved': self.__canBeRemoved(profile, club, member, membersCount, limits), 'canPassOwnership': limits.canTransferOwnership(profile, club).success, 'canShowContextMenu': not isSelf and isValid, 'removeMemberBtnIcon': RES_ICONS.MAPS_ICONS_LIBRARY_CROSS, 'removeMemberBtnTooltip': removeBtnTooltip, 'appointmentSortValue': memberType, 'appointment': _packAppointment(profile, club, member, memberType, limits), 'ratingSortValue': rating, 'rating': self.getGuiUserRating(dbID, text_styles.neutral), 'battlesCountSortValue': battlesCount, 'battlesCount': text_styles.main(BigWorld.wg_getIntegralFormat(battlesCount)), 'damageCoefSortValue': damageCoef, 'damageCoef': text_styles.main(BigWorld.wg_getNiceNumberFormat(damageCoef)), 'avrDamageSortValue': avgDamage, 'avrDamage': text_styles.main(BigWorld.wg_getIntegralFormat(avgDamage)), 'avrAssistDamageSortValue': avgAssistDamage, 'avrAssistDamage': text_styles.main(BigWorld.wg_getNiceNumberFormat(avgAssistDamage)), 'avrExperienceSortValue': avgExperience, 'avrExperience': text_styles.main(BigWorld.wg_getIntegralFormat(avgExperience)), 'tauntSortValue': armorUsingEfficiency, 'taunt': text_styles.main(BigWorld.wg_getNiceNumberFormat(armorUsingEfficiency)), 'joinDateSortValue': joinDate, 'joinDate': text_styles.standard(BigWorld.wg_getShortDateFormat(joinDate)), 'userDataSortValue': self.getUserFullName(dbID).lower(), 'userData': userData, 'clubDbID': self._clubDbID, 'statusIcon': _getStatusIcon(contact)}) if syncUserInfo: self.syncUsersInfo() return {'members': sorted(members, key=lambda k: k['userDataSortValue'].lower())}
def _doUnlockItem(self, unlockCtx, costCtx, plugins): result = yield unlock.UnlockItemProcessor(unlockCtx.vehCD, unlockCtx.unlockIdx, plugins=plugins).request() item = g_itemsCache.items.getItemByCD(unlockCtx.unlockCD) if result.success: costCtx['xpCost'] = BigWorld.wg_getIntegralFormat(costCtx['xpCost']) costCtx['freeXP'] = BigWorld.wg_getIntegralFormat(costCtx['freeXP']) showUnlockMsg('unlock_success', item, msgType=SystemMessages.SM_TYPE.PowerLevel, **costCtx) elif len(result.userMsg): showUnlockMsg(result.userMsg, item)
def __prepareIndicatorData(self, isCanModernization, increment = False, resLeft = 0): if increment: hpTotalVal = self.nextLevel.levelRef.hp hpVal = self.nextLevel.hp defResVal = self.__defResVal - self.__cost + resLeft maxDerResVal = self.nextLevel.levelRef.storage else: hpTotalVal = self.__hpTotalVal hpVal = self.__hpVal defResVal = self.__defResVal maxDerResVal = self.__maxDerResVal textStyle = TEXT_MANAGER_STYLES.DEFRES_TEXT if self.__progress == FORTIFICATION_ALIASES.STATE_FOUNDATION_DEF or self.__progress == FORTIFICATION_ALIASES.STATE_FOUNDATION: textStyle = TEXT_MANAGER_STYLES.ALERT_TEXT if not isCanModernization and increment: currentHpLabel = self.app.utilsManager.textManager.getText(TEXT_MANAGER_STYLES.MAIN_TEXT, '--') currentHpValue = 0 else: currentHpLabel = str(BigWorld.wg_getIntegralFormat(hpVal)) currentHpValue = hpVal FORMAT_PATTERN = '###' formattedHpValue = self.app.utilsManager.textManager.getText(textStyle, FORMAT_PATTERN) hpTextColor = TEXT_MANAGER_STYLES.STANDARD_TEXT if increment: hpTextColor = TEXT_MANAGER_STYLES.NEUTRAL_TEXT formattedHpTotal = self.app.utilsManager.textManager.getText(hpTextColor, str(BigWorld.wg_getIntegralFormat(hpTotalVal))) formattedHpTotal += ' ' + self.app.utilsManager.textManager.getIcon(TextIcons.NUT_ICON) if not isCanModernization and increment: currentDefResLabel = self.app.utilsManager.textManager.getText(TEXT_MANAGER_STYLES.MAIN_TEXT, '--') currentDefResValue = 0 else: currentDefResLabel = str(BigWorld.wg_getIntegralFormat(defResVal)) currentDefResValue = defResVal defResValueFormatter = self.app.utilsManager.textManager.getText(TEXT_MANAGER_STYLES.DEFRES_TEXT, FORMAT_PATTERN) formattedDefResTotal = self.app.utilsManager.textManager.getText(hpTextColor, str(BigWorld.wg_getIntegralFormat(maxDerResVal))) formattedDefResTotal += ' ' + self.app.utilsManager.textManager.getIcon(TextIcons.NUT_ICON) result = {} result['hpLabel'] = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_HPLBL) result['defResLabel'] = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_DEFRESLBL) result['hpCurrentValue'] = currentHpValue result['hpTotalValue'] = hpTotalVal result['defResCurrentValue'] = currentDefResValue result['defResTotalValue'] = maxDerResVal hpProgressLabels = {} hpProgressLabels['currentValue'] = currentHpLabel hpProgressLabels['currentValueFormatter'] = formattedHpValue hpProgressLabels['totalValue'] = formattedHpTotal hpProgressLabels['separator'] = '/' storeProgressLabels = {} storeProgressLabels['currentValue'] = currentDefResLabel storeProgressLabels['currentValueFormatter'] = defResValueFormatter storeProgressLabels['totalValue'] = formattedDefResTotal storeProgressLabels['separator'] = '/' result['hpProgressLabels'] = hpProgressLabels result['defResProgressLabels'] = storeProgressLabels return result
def __cb_onUnlock(self, itemCD, costCtx, resultID): Waiting.hide('research') RequestState.received('unlock') ctx = {'xpCost': BigWorld.wg_getIntegralFormat(costCtx['xpCost']), 'freeXP': BigWorld.wg_getIntegralFormat(costCtx['freeXP']), 'vehXP': BigWorld.wg_getIntegralFormat(costCtx['vehXP'])} if RES_SUCCESS == resultID: self._showUnlockItemMsg(itemCD, ctx) else: self._showMessage(self.MSG_SCOPE.Unlocks, 'server_error', itemCD)
def __getData(blockName, fieldType, dossier): if fieldType == 'effectiveShots': if dossier['a15x15']['shots'] != 0: return '%d%%' % round(float(dossier['a15x15']['directHits']) / dossier['a15x15']['shots'] * 100) return '0%' if fieldType == 'avgExperience': if dossier['a15x15']['battlesCount'] != 0: return BigWorld.wg_getIntegralFormat(round(float(dossier['a15x15']['xp']) / dossier['a15x15']['battlesCount'])) return BigWorld.wg_getIntegralFormat(0) return BigWorld.wg_getIntegralFormat(dossier[blockName][fieldType])
def __makeConfirmator(self): xpLimit = g_itemsCache.items.shop.freeXPConversionLimit extra = {'resultCurrencyAmount': BigWorld.wg_getIntegralFormat(self.xp), 'primaryCurrencyAmount': BigWorld.wg_getGoldFormat(self.gold)} if self.__freeConversion: sourceKey = 'XP_EXCHANGE_FOR_FREE' extra['freeXPLimit'] = BigWorld.wg_getIntegralFormat(xpLimit) else: sourceKey = 'XP_EXCHANGE_FOR_GOLD' return plugins.HtmlMessageConfirmator('exchangeXPConfirmation', 'html_templates:lobby/dialogs', 'confirmExchangeXP', extra, sourceKey=sourceKey)
def _doUnlockItem(self, unlockCtx, costCtx, plugins): self._canBeClosed = False result = yield unlock.UnlockItemProcessor(unlockCtx.vehCD, unlockCtx.unlockIdx, plugins=plugins).request() self._canBeClosed = True if result.success: costCtx['xpCost'] = BigWorld.wg_getIntegralFormat(costCtx['xpCost']) costCtx['freeXP'] = BigWorld.wg_getIntegralFormat(costCtx['freeXP']) self._showMessage(self.MSG_SCOPE.Unlocks, 'unlock_success', self._data.getItem(unlockCtx.unlockCD), msgType=SystemMessages.SM_TYPE.PowerLevel, **costCtx) elif len(result.userMsg): self._showMessage(self.MSG_SCOPE.Unlocks, result.userMsg, self._data.getItem(unlockCtx.unlockCD))
def shout_damage(self): if self.avgDMG != 0: self.num += 1 self.SumAvgDmg += self.avgDMG format_str = { 'NumDmg': BigWorld.wg_getIntegralFormat(self.num), 'AvgDmg': BigWorld.wg_getIntegralFormat(self.SumAvgDmg) } text = '%s' % _config.i18n['UI_in_battle_main_text'] self.flash.set_text(text.format(**format_str)) self.clear_data()
def _makeVO(self, province): result = {'front': '%s %s' % (self.__getFront(province), text_styles.standard(formatField(province.getFrontLevel, formatter=fort_formatters.getTextLevel))), 'province': self.__getProvinceName(province), 'map': self.__getMap(province), 'primeTime': text_styles.main(province.getUserPrimeTime()), 'days': text_styles.main(BigWorld.wg_getIntegralFormat(self.__getDays(province)))} if self.__showTreasuryData: result.update({'income': text_styles.gold(BigWorld.wg_getIntegralFormat(self.__getIncome(province))), 'noIncomeIconVisible': not province.isHqConnected(), 'noIncomeTooltip': CLANS.GLOBALMAPVIEW_NOINCOME_TOOLTIP}) return result
def __getData(blockName, fieldType, dossier): if fieldType == "effectiveShots": if dossier["a15x15"]["shots"] != 0: return "%d%%" % round(float(dossier["a15x15"]["directHits"]) / dossier["a15x15"]["shots"] * 100) return "0%" if fieldType == "avgExperience": if dossier["a15x15"]["battlesCount"] != 0: return BigWorld.wg_getIntegralFormat( round(float(dossier["a15x15"]["xp"]) / dossier["a15x15"]["battlesCount"]) ) return BigWorld.wg_getIntegralFormat(0) return BigWorld.wg_getIntegralFormat(dossier[blockName][fieldType])
def _getUnlockConfirmMeta(self, itemCD, costCtx): itemTypeID, nationID, itemID = vehicles.parseIntCompactDescr(itemCD) ctx = {'xpCost': BigWorld.wg_getIntegralFormat(costCtx['xpCost']), 'freeXP': BigWorld.wg_getIntegralFormat(costCtx['freeXP']), 'typeString': getTypeInfoByIndex(itemTypeID)['userString']} if itemTypeID == _VEHICLE: key = 'confirmUnlockVehicle' ctx['userString'] = vehicles.getVehicleType(itemCD).userString else: key = 'confirmUnlockItem' ctx['userString'] = vehicles.getDictDescr(itemCD)['userString'] return HtmlMessageLocalDialogMeta('html_templates:lobby/dialogs', key, ctx=ctx)
def _packWayToBuyBlock(self, item): subBlocks = [ formatters.packTextBlockData( text=text_styles.middleTitle(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_WAYTOBUY_TITLE)), padding={"bottom": 6}, ) ] padding = {"left": 0} for buyItem in item["buyItems"]: buyItemDesc = text_styles.main(buyItem["desc"]) if buyItem["type"] == BUY_ITEM_TYPE.WAYS_TO_BUY_FOREVER: if buyItem["isSale"]: subBlocks.append( formatters.packSaleTextParameterBlockData( name=buyItemDesc, saleData={"newPrice": (0, buyItem["value"])}, padding=padding ) ) else: price = text_styles.concatStylesWithSpace( text_styles.gold(BigWorld.wg_getIntegralFormat(long(buyItem["value"]))), icons.gold() ) subBlocks.append( formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70) ) elif buyItem["type"] == BUY_ITEM_TYPE.WAYS_TO_BUY_TEMP: if buyItem["isSale"]: subBlocks.append( formatters.packSaleTextParameterBlockData( name=buyItemDesc, saleData={"newPrice": (buyItem["value"], 0)}, padding=padding ) ) else: price = text_styles.concatStylesWithSpace( text_styles.credits(BigWorld.wg_getIntegralFormat(long(buyItem["value"]))), icons.credits() ) subBlocks.append( formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70) ) elif buyItem["type"] == BUY_ITEM_TYPE.WAYS_TO_BUY_IGR: subBlocks.append( formatters.packTextParameterBlockData( name=buyItemDesc, value=icons.premiumIgrSmall(), padding=padding ) ) elif buyItem["type"] == BUY_ITEM_TYPE.WAYS_TO_BUY_MISSION: subBlocks.append( formatters.packTextParameterBlockData(name=buyItemDesc, value=icons.quest(), padding=padding) ) return formatters.packBuildUpBlockData( subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {"left": 3} )
def _makeMeta(self): item = g_itemsCache.items.getItemByCD(self._unlockCtx.unlockCD) xpCost = BigWorld.wg_getIntegralFormat(self._costCtx['xpCost']) freeXp = BigWorld.wg_getIntegralFormat(self._costCtx['freeXP']) ctx = {'xpCost': text_styles.expText(xpCost), 'freeXP': text_styles.expText(freeXp), 'typeString': item.userType, 'userString': item.userName} if item.itemTypeID == GUI_ITEM_TYPE.VEHICLE: key = 'confirmUnlockVehicle' else: key = 'confirmUnlockItem' return dialogs.I18nConfirmDialogMeta('confirmUnlock', meta=dialogs.HtmlMessageLocalDialogMeta('html_templates:lobby/dialogs', key, ctx=ctx))
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 = BigWorld.wg_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(BigWorld.wg_getIntegralFormat(len(targetData.getVehicles())), PROFILE.SECTION_STATISTICS_SCORES_USEDTECHNICS, PROFILE.PROFILE_PARAMS_TOOLTIP_USEDTECHNICS, 'techRatio40x32.png'))
def __makeConfirmator(self): xpLimit = g_itemsCache.items.shop.freeXPConversionLimit extra = { "resultCurrencyAmount": BigWorld.wg_getIntegralFormat(self.xp), "primaryCurrencyAmount": BigWorld.wg_getGoldFormat(self.gold), } if self.__freeConversion: sourceKey = "XP_EXCHANGE_FOR_FREE" extra["freeXPLimit"] = BigWorld.wg_getIntegralFormat(xpLimit) else: sourceKey = "XP_EXCHANGE_FOR_GOLD" return plugins.HtmlMessageConfirmator( "exchangeXPConfirmation", "html_templates:lobby/dialogs", "confirmExchangeXP", extra, sourceKey=sourceKey )
def _getWeekMiningStr(self, weekMining): randWeek = BigWorld.wg_getIntegralFormat(weekMining) return text_styles.defRes(randWeek)
def getVehicleParams(item, vehicle, callback): vd = item.descriptor if GUI_SETTINGS.technicalInfo: parameters = { 'parameters': [('maxHealth', vd.maxHealth), ('weight', '%s/%s' % (BigWorld.wg_getNiceNumberFormat(vd.physics['weight'] / 1000), BigWorld.wg_getNiceNumberFormat( vd.miscAttrs['maxWeight'] / 1000))), ('enginePower', BigWorld.wg_getIntegralFormat( round(vd.physics['enginePower'] / 735.5))), ('speedLimits', BigWorld.wg_getNiceNumberFormat( round(vd.physics['speedLimits'][0] * 3.6, 2))), ('chassisRotationSpeed', BigWorld.wg_getNiceNumberFormat( round(180 / math.pi * vd.chassis['rotationSpeed'], 0))), ('hullArmor', '%d/%d/%d' % vd.hull['primaryArmor'])] } if item.hasTurrets: parameters['parameters'].append( ('turretArmor', '%d/%d/%d' % vd.turret['primaryArmor'])) pPower = (BigWorld.wg_getIntegralFormat( round(vd.shot['piercingPower'][0] - vd.shot['piercingPower'][0] * vd.shot['shell']['piercingPowerRandomization'])), BigWorld.wg_getIntegralFormat( round(vd.shot['piercingPower'][0] + vd.shot['piercingPower'][0] * vd.shot['shell']['piercingPowerRandomization']))) damage = (BigWorld.wg_getIntegralFormat( round(vd.shot['shell']['damage'][0] - vd.shot['shell']['damage'][0] * vd.shot['shell']['damageRandomization'])), BigWorld.wg_getIntegralFormat( round(vd.shot['shell']['damage'][0] + vd.shot['shell']['damage'][0] * vd.shot['shell']['damageRandomization']))) parameters['parameters'].extend([ ('damage', '%s-%s' % damage), ('piercingPower', '%s-%s' % pPower), ('reloadTime', _getShotsPerMinute(vd.gun)), ('turretRotationSpeed' if item.hasTurrets else 'gunRotationSpeed', BigWorld.wg_getIntegralFormat( round(180.0 / math.pi * vd.turret['rotationSpeed']))), ('circularVisionRadius', BigWorld.wg_getIntegralFormat(vd.turret['circularVisionRadius'])), ('radioDistance', BigWorld.wg_getIntegralFormat(vd.radio['distance'])) ]) else: parameters = {'parameters': []} parameters['base'] = [] shortName = getTypeInfoByName( 'vehicleGun')['userString'] + ' ' + item.descriptor.gun['userString'] parameters['base'].append(shortName) if item.hasTurrets: shortName = getTypeInfoByName('vehicleTurret')[ 'userString'] + ' ' + item.descriptor.turret['userString'] parameters['base'].append(shortName) shortName = getTypeInfoByName('vehicleEngine')[ 'userString'] + ' ' + item.descriptor.engine['userString'] parameters['base'].append(shortName) shortName = getTypeInfoByName('vehicleChassis')[ 'userString'] + ' ' + item.descriptor.chassis['userString'] parameters['base'].append(shortName) shortName = getTypeInfoByName('vehicleRadio')[ 'userString'] + ' ' + item.descriptor.radio['userString'] parameters['base'].append(shortName) parameters['stats'] = [] callback(parameters)
def __formatValueForUI(self, value): if value is None: return '%s' % i18n.makeString('#menu:profile/stats/items/empty') else: return BigWorld.wg_getIntegralFormat(value) return
def _buildData(self, targetData, isCurrentUser): return BigWorld.wg_getIntegralFormat( targetData.getMaxDamage()) if targetData.getBattlesCountVer3( ) > 0 else ProfileUtils.UNAVAILABLE_VALUE
def _buildData(self, targetData, isCurrentUser): return BigWorld.wg_getIntegralFormat( ProfileUtils.getValueOrUnavailable(targetData.getStunNumber()))
def _totalVehiclesField(targetData, isCurrentUser): formattedVehicles = BigWorld.wg_getIntegralFormat( targetData.getTotalVehicles()) return DetailedStatisticsUtils.getDetailedDataObject( PROFILE.SECTION_STATISTICS_SCORES_TOTALVEHS, formattedVehicles, PROFILE.PROFILE_PARAMS_TOOLTIP_TOTALVEHS)
def _buildData(self, targetData, isCurrentUser): return BigWorld.wg_getIntegralFormat( targetData.getDroppedCapturePoints())
def makeCrystalLabel(value): return makeHtmlString('html_templates:lobby/battle_results', 'crystal_small_label', {'value': BigWorld.wg_getIntegralFormat(int(value))})
def getIntegralFormatIfNoEmpty(value): return BigWorld.wg_getIntegralFormat(value) if value else markValueAsEmpty( value)
def _getDetailedData(self, data): targetData = data[0] dataList = [] if g_lobbyContext.getServerSettings().isFortsEnabled(): dataList.append( _getDetailedStatisticsData( PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_FORTBATTLES, self.__fortBattlesTargetData, isCurrentUser=self._isCurrentUser, layout=FORT_STATISTICS_LAYOUT)) dataList.append( _getDetailedStatisticsData( PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_FORTSORTIE, targetData, isCurrentUser=self._isCurrentUser)) specificData = [] battlesCount = self.__fortBattlesTargetData.getBattlesCount() lossesCount = self.__fortBattlesTargetData.getLossesCount() winsCount = self.__fortBattlesTargetData.getWinsCount() formattedBattlesCount = BigWorld.wg_getIntegralFormat(battlesCount) specificDataColumn1 = [] if g_lobbyContext.getServerSettings().isFortsEnabled(): specificDataColumn1.append( PUtils.getLabelDataObject( PROFILE.SECTION_STATISTICS_BODYPARAMS_LABEL_FORTBATTLES, (DSUtils.getDetailedDataObject( PROFILE.SECTION_STATISTICS_SCORES_FORTTOTALBATTLES, formattedBattlesCount, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_BATTLES, PUtils.createToolTipData( (BigWorld.wg_getIntegralFormat(winsCount), BigWorld.wg_getIntegralFormat(lossesCount)))), DSUtils.getDetailedDataObject( PROFILE. SECTION_STATISTICS_SCORES_FORTBATTLESTOTALWINS, PUtils.getFormattedWinsEfficiency( self.__fortBattlesTargetData), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLESWINS), DSUtils.getDetailedDataObject( PROFILE.SECTION_STATISTICS_SCORES_LOOTING, self.__fortMiscTargetData.getEnemyBasePlunderNumber(), PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_LOOTING), DSUtils.getDetailedDataObject( PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_ATTACKS, self.__fortMiscTargetData.getAttackNumber(), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_ATTACKS), DSUtils.getDetailedDataObject( PROFILE. SECTION_STATISTICS_SCORES_FORTBATTLES_DEFENCES, self.__fortMiscTargetData.getDefenceHours(), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_DEFENCES) ))) battlesCount = targetData.getBattlesCount() lossesCount = targetData.getLossesCount() winsCount = targetData.getWinsCount() drawsCount = targetData.getDrawsCount() formattedBattlesCount = BigWorld.wg_getIntegralFormat(battlesCount) specificDataColumn1.append( PUtils.getLabelDataObject( PROFILE.SECTION_STATISTICS_BODYPARAMS_LABEL_FORTSORTIE, (DSUtils.getDetailedDataObject( PROFILE.SECTION_STATISTICS_SCORES_FORT_SORTIE, formattedBattlesCount, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_SORTIE, PUtils.createToolTipData( (BigWorld.wg_getIntegralFormat(winsCount), BigWorld.wg_getIntegralFormat(lossesCount), BigWorld.wg_getIntegralFormat(drawsCount)))), DSUtils.getDetailedDataObject( PROFILE.SECTION_STATISTICS_SCORES_FORTSORTIETOTALWINS, self._formattedWinsEfficiency, PROFILE.PROFILE_PARAMS_TOOLTIP_FORTSORTIEWINS)))) specificData.append(specificDataColumn1) resourcesDataList = [ DSUtils.getDetailedDataObject( PROFILE.SECTION_STATISTICS_SCORES_FORTSORTIES_AVGRESOURCES, self.__avgFortSortiesLoot, PROFILE.PROFILE_PARAMS_TOOLTIP_FORTSORTIES_AVGRESOURCES), DSUtils.getDetailedDataObject( PROFILE.SECTION_STATISTICS_SCORES_FORTSORTIES_TOTALRESOURCES, BigWorld.wg_getIntegralFormat(self.__totalSortiesLoot), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTSORTIES_TOTALRESOURCES) ] specificDataColumn2 = [] if g_lobbyContext.getServerSettings().isFortsEnabled(): resourcesDataList.append( DSUtils.getDetailedDataObject( PROFILE. SECTION_STATISTICS_SCORES_FORTBATTLES_TOTALRESOURCES, BigWorld.wg_getIntegralFormat( self.__fortMiscTargetData.getLootInBattles()), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_TOTALRESOURCES)) resourcesDataList.append( DSUtils.getDetailedDataObject( PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_MAXRESOURCES, BigWorld.wg_getIntegralFormat( self.__fortMiscTargetData.getMaxLootInBattles()), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_MAXRESOURCES)) specificDataColumn2.append( PUtils.getLabelDataObject( PROFILE.SECTION_STATISTICS_BODYPARAMS_LABEL_RESOURCE, resourcesDataList)) specificData.append(specificDataColumn2) dataList.append( PUtils.getLabelViewTypeDataObject( PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_SPECIFIC, specificData, PUtils.VIEW_TYPE_TABLES)) return dataList
def _packAvgXPLditItemData(avgExp): return PUtils.packLditItemData( BigWorld.wg_getIntegralFormat(avgExp), PROFILE.SECTION_STATISTICS_SCORES_AVGEXPERIENCE, PROFILE.PROFILE_PARAMS_TOOLTIP_AVGEXP, 'avgExp40x32.png')
def getGlobalRatingFmt(globalRating): if globalRating >= 0: return BigWorld.wg_getIntegralFormat(globalRating) return '--'
def __packAvgVictoryPointsData(self, avgVictoryPoints): return PUtils.packLditItemData( BigWorld.wg_getIntegralFormat(avgVictoryPoints), PROFILE.SECTION_STATISTICS_SCORES_AVGVICTORYPOINTS, PROFILE.PROFILE_PARAMS_TOOLTIP_AVGVICTORYPOINTS, 'avgVictoryPoints48x48.png')
def _getTotalMiningStr(self, totalMining): allTime = BigWorld.wg_getIntegralFormat(totalMining) return text_styles.defRes(allTime)
def _maxWinPointsField(targetData, isCurrentUser): formatedMaxWP = BigWorld.wg_getIntegralFormat( targetData.getMaxVictoryPoints()) return DetailedStatisticsUtils.getDetailedDataObject( PROFILE.SECTION_STATISTICS_SCORES_MAXVICTORYPOINTS, formatedMaxWP, PROFILE.PROFILE_PARAMS_TOOLTIP_MAXVICTORYPOINTS)
def getGlobalRatingFmt(globalRating): return BigWorld.wg_getIntegralFormat(globalRating) if globalRating >= 0 else '--'
def _flagsAbsorbedField(targetData, isCurrentUser): formattedAbsorbed = BigWorld.wg_getIntegralFormat( targetData.getFlagsAbsorbed()) return DetailedStatisticsUtils.getDetailedDataObject( PROFILE.SECTION_STATISTICS_SCORES_FLAGSABSORBED, formattedAbsorbed, PROFILE.PROFILE_PARAMS_TOOLTIP_FLAGSABSORBED)
def getI18nValue(self): return BigWorld.wg_getIntegralFormat(self._value)
def _buildData(self, targetData, isCurrentUser): return BigWorld.wg_getIntegralFormat(targetData.getTotalVehicles())
def _populate(self): super(VehicleSellDialog, self)._populate() g_clientUpdateManager.addCallbacks({'stats.gold': self.onSetGoldHndlr}) g_itemsCache.onSyncCompleted += self.__shopResyncHandler items = g_itemsCache.items vehicle = items.getVehicle(self.vehInvID) sellPrice = vehicle.sellPrice sellForGold = sellPrice.gold > 0 priceTextColor = CURRENCIES_CONSTANTS.GOLD_COLOR if sellForGold else CURRENCIES_CONSTANTS.CREDITS_COLOR priceTextValue = _ms(DIALOGS.VEHICLESELLDIALOG_PRICE_SIGN_ADD) + _ms( BigWorld.wg_getIntegralFormat( sellPrice.gold if sellForGold else sellPrice.credits)) currencyIcon = CURRENCIES_CONSTANTS.GOLD if sellForGold else CURRENCIES_CONSTANTS.CREDITS invVehs = items.getVehicles(REQ_CRITERIA.INVENTORY) if vehicle.isPremium or vehicle.level >= 3: self.as_visibleControlBlockS(True) self.__initCtrlQuestion() else: self.as_visibleControlBlockS(False) modules = items.getItems( criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle]) | REQ_CRITERIA.INVENTORY).values() shells = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE( [vehicle], [GUI_ITEM_TYPE.SHELL]) | REQ_CRITERIA.INVENTORY).values() otherVehsShells = set() for invVeh in invVehs.itervalues(): if invVeh.invID != self.vehInvID: for shot in invVeh.descriptor.gun['shots']: otherVehsShells.add(shot['shell']['compactDescr']) vehicleAction = None if sellPrice != vehicle.defaultSellPrice: vehicleAction = packItemActionTooltipData(vehicle, False) if vehicle.isElite: description = TOOLTIPS.tankcaruseltooltip_vehicletype_elite( vehicle.type) else: description = DIALOGS.vehicleselldialog_vehicletype(vehicle.type) levelStr = text_styles.concatStylesWithSpace( text_styles.stats(int2roman(vehicle.level)), text_styles.main(_ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_LEVEL))) restoreController = getRestoreController() tankmenGoingToBuffer, deletedTankmen = restoreController.getTankmenDeletedBySelling( vehicle) deletedCount = len(deletedTankmen) if deletedCount > 0: recoveryBufferFull = True deletedStr = formatDeletedTankmanStr(deletedTankmen[0]) maxCount = restoreController.getMaxTankmenBufferLength() currCount = len(restoreController.getDismissedTankmen()) if deletedCount == 1: crewTooltip = text_styles.concatStylesToMultiLine( text_styles.middleTitle( _ms(TOOLTIPS. VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)), text_styles.main( _ms(TOOLTIPS. VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_BODY, maxVal=maxCount, curVal=currCount, sourceName=tankmenGoingToBuffer[-1].fullUserName, targetInfo=deletedStr))) else: crewTooltip = text_styles.concatStylesToMultiLine( text_styles.middleTitle( _ms(TOOLTIPS. VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)), text_styles.main( _ms(TOOLTIPS. DISMISSTANKMANDIALOG_BUFFERISFULLMULTIPLE_BODY, deletedStr=deletedStr, extraCount=deletedCount - 1, maxCount=maxCount, currCount=currCount))) else: crewTooltip = None recoveryBufferFull = False barracksDropDownData = [{ 'label': _ms(MENU.BARRACKS_BTNUNLOAD) }, { 'label': _ms(MENU.BARRACKS_BTNDISSMISS) }] sellVehicleData = { 'intCD': vehicle.intCD, 'userName': vehicle.userName, 'icon': vehicle.icon, 'level': vehicle.level, 'isElite': vehicle.isElite, 'isPremium': vehicle.isPremium, 'type': vehicle.type, 'nationID': vehicle.nationID, 'sellPrice': sellPrice, 'priceTextValue': priceTextValue, 'priceTextColor': priceTextColor, 'currencyIcon': currencyIcon, 'action': vehicleAction, 'hasCrew': vehicle.hasCrew, 'isRented': vehicle.isRented, 'description': description, 'levelStr': levelStr, 'priceLabel': _ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_EMPTYSELLPRICE), 'crewLabel': _ms(DIALOGS.VEHICLESELLDIALOG_CREW_LABEL), 'crewTooltip': crewTooltip, 'barracksDropDownData': barracksDropDownData, 'crewRecoveryBufferFull': recoveryBufferFull } onVehicleOptionalDevices = [] for o in vehicle.optDevices: if o is not None: action = None if o.sellPrice != o.defaultSellPrice: action = packItemActionTooltipData(o, False) data = { 'intCD': o.intCD, 'isRemovable': o.isRemovable, 'userName': o.userName, 'sellPrice': o.sellPrice, 'toInventory': True, 'action': action } onVehicleOptionalDevices.append(data) onVehicleoShells = [] for shell in vehicle.shells: if shell is not None: action = None if shell.sellPrice != shell.defaultSellPrice: action = packItemActionTooltipData(shell, False) data = { 'intCD': shell.intCD, 'count': shell.count, 'sellPrice': shell.sellPrice, 'userName': shell.userName, 'kind': shell.type, 'toInventory': shell in otherVehsShells or shell.isPremium, 'action': action } onVehicleoShells.append(data) onVehicleEquipments = [] for equipmnent in vehicle.eqs: if equipmnent is not None: action = None if equipmnent.sellPrice != equipmnent.defaultSellPrice: action = packItemActionTooltipData(equipmnent, False) data = { 'intCD': equipmnent.intCD, 'userName': equipmnent.userName, 'sellPrice': equipmnent.sellPrice, 'toInventory': True, 'action': action } onVehicleEquipments.append(data) inInventoryModules = [] for m in modules: inInventoryModules.append({ 'intCD': m.intCD, 'inventoryCount': m.inventoryCount, 'toInventory': True, 'sellPrice': m.sellPrice }) inInventoryShells = [] for s in shells: action = None if s.sellPrice != s.defaultSellPrice: action = packItemActionTooltipData(s, False) inInventoryShells.append({ 'intCD': s.intCD, 'count': s.inventoryCount, 'sellPrice': s.sellPrice, 'userName': s.userName, 'kind': s.type, 'toInventory': s in otherVehsShells or s.isPremium, 'action': action }) removePrice = items.shop.paidRemovalCost removePrices = Money(gold=removePrice) defRemovePrice = Money(gold=items.shop.defaults.paidRemovalCost) removeAction = None if removePrices != defRemovePrice: removeAction = packActionTooltipData( ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost', True, removePrices, defRemovePrice) settings = self.getDialogSettings() isSlidingComponentOpened = settings['isOpened'] self.as_setDataS({ 'accountGold': items.stats.gold, 'sellVehicleVO': sellVehicleData, 'optionalDevicesOnVehicle': onVehicleOptionalDevices, 'shellsOnVehicle': onVehicleoShells, 'equipmentsOnVehicle': onVehicleEquipments, 'modulesInInventory': inInventoryModules, 'shellsInInventory': inInventoryShells, 'removeActionPrice': removeAction, 'removePrice': removePrice, 'isSlidingComponentOpened': isSlidingComponentOpened }) return
def _buildData(self, targetData, isCurrentUser): return BigWorld.wg_getIntegralFormat(targetData.getMaxFrags())
def _packInventoryBlock(self): container = self.app.containerManager.getContainer(ViewTypes.LOBBY_SUB) view = container.getView() if view.alias == VIEW_ALIAS.LOBBY_CUSTOMIZATION: getInventoryCount = view.getItemInventoryCount else: getInventoryCount = getItemInventoryCount subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_INVENTORY_TITLE), padding={'bottom': 4})] money = self.itemsCache.items.stats.money if not self._item.isHidden: for itemPrice in self._item.buyPrices: currency = itemPrice.getCurrency() value = itemPrice.price.getSignValue(currency) defValue = itemPrice.defPrice.getSignValue(currency) needValue = value - money.getSignValue(currency) actionPercent = itemPrice.getActionPrc() if not self._item.isRentable: setting = CURRENCY_SETTINGS.getBuySetting forcedText = '' else: setting = CURRENCY_SETTINGS.getRentSetting forcedText = _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_INVENTORY_COST_RENT, battlesNum=self._item.rentCount) subBlocks.append(makePriceBlock(value, setting(currency), needValue if needValue > 0 else None, defValue if defValue > 0 else None, actionPercent, valueWidth=88, leftPadding=49, forcedText=forcedText)) if not self._item.isRentable: for itemPrice in self._item.sellPrices: currency = itemPrice.getCurrency() value = itemPrice.price.getSignValue(currency) defValue = itemPrice.defPrice.getSignValue(currency) actionPercent = itemPrice.getActionPrc() if actionPercent > 0: subBlocks.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(TOOLTIPS.ACTIONPRICE_SELL_BODY_SIMPLE), value=text_styles.concatStylesToSingleLine(text_styles.credits(BigWorld.wg_getIntegralFormat(value)), ' ', icons.credits()), icon='alertMedium', valueWidth=88, padding=formatters.packPadding(left=-5))) subBlocks.append(makePriceBlock(value, CURRENCY_SETTINGS.SELL_PRICE, oldPrice=defValue if defValue > 0 else None, percent=actionPercent, valueWidth=88, leftPadding=49)) inventoryCount = getInventoryCount(self._item) info = text_styles.concatStylesWithSpace(text_styles.stats(inventoryCount)) if self._item.isRentable and inventoryCount > 0 or not self._item.isRentable: title = text_styles.main(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_INVENTORY_RENT_BATTLESLEFT if self._item.isRentable else VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_INVENTORY_AVAILABLE) icon = RES_ICONS.MAPS_ICONS_LIBRARY_CLOCKICON_1 if self._item.isRentable else RES_ICONS.MAPS_ICONS_CUSTOMIZATION_STORAGE_ICON padding = formatters.packPadding(left=83, bottom=-14 if self._item.isRentable else 0) titlePadding = formatters.packPadding(left=-8 if self._item.isRentable else -1) iconPadding = formatters.packPadding(top=-7 if self._item.isRentable else -2, left=-3 if self._item.isRentable else -2) subBlocks.append(formatters.packTitleDescParameterWithIconBlockData(title=title, value=info, icon=icon, padding=padding, titlePadding=titlePadding, iconPadding=iconPadding)) return formatters.packBuildUpBlockData(blocks=subBlocks, gap=-1)
def _buildData(self, targetData, isCurrentUser): return BigWorld.wg_getIntegralFormat( ProfileUtils.getValueOrUnavailable( targetData.getAvgDamageAssistedStun()))
def getPersonalScoreWarningText(self, data): battlesCount = BigWorld.wg_getIntegralFormat(data) return i18n.makeString(PROFILE.SECTION_SUMMARY_WARNING_PERSONALSCORE, count=battlesCount)
def _avgExpField(targetData, isCurrentUser): formatedExp = BigWorld.wg_getIntegralFormat( ProfileUtils.getValueOrUnavailable(targetData.getAvgXP())) return DetailedStatisticsUtils.getDetailedDataObject( PROFILE.SECTION_STATISTICS_SCORES_AVGEXPERIENCE_SHORT, formatedExp, PROFILE.PROFILE_PARAMS_TOOLTIP_AVGEX_SHORT)
def __prepareAndPassVehiclesData(self): values = [] for vehicleCD in g_itemsCache.items.stats.eliteVehicles: try: vehicle = g_itemsCache.items.getItemByCD(vehicleCD) if not vehicle.xp: continue values.append({ 'id': vehicle.intCD, 'vehicleType': getVehicleTypeAssetPath(vehicle.type), 'vehicleName': vehicle.shortUserName, 'xp': vehicle.xp, 'xpStrValue': BigWorld.wg_getIntegralFormat(vehicle.xp), 'isSelectCandidate': vehicle.isFullyElite, 'vehicleIco': vehicle.iconSmall, 'nationIco': getNationsAssetPath(vehicle.nationID, namePrefix=NATION_ICON_PREFIX_131x31) }) except: continue labelBuilder = builder().addStyledText( 'middleTitle', i18n.makeString(MENU.EXCHANGE_RATE)) if self.__xpForFree is not None: labelBuilder.addStyledText( self.__getActionStyle(), i18n.makeString(MENU.EXCHANGEXP_AVAILABLE_FORFREE_LABEL)) labelBuilder.addStyledText( 'expText', i18n.makeString( MENU.EXCHANGEXP_AVAILABLE_FORFREE_VALUE, icon=icons.makeImageTag( RES_ICONS.MAPS_ICONS_LIBRARY_ELITEXPICON_2), forFree=BigWorld.wg_getNiceNumberFormat(self.__xpForFree))) exchangeHeaderData = { 'labelText': labelBuilder.render(), 'rateFromIcon': ICON_TEXT_FRAMES.GOLD, 'rateToIcon': ICON_TEXT_FRAMES.ELITE_XP, 'rateFromTextColor': self.app.colorManager.getColorScheme('textColorGold').get('rgb'), 'rateToTextColor': self.app.colorManager.getColorScheme('textColorCredits').get('rgb') } vehicleData = { 'isHaveElite': bool(values), 'vehicleList': values, 'tableHeader': self._getTableHeader(), 'xpForFree': self.__xpForFree, 'exchangeHeaderData': exchangeHeaderData } self.as_vehiclesDataChangedS(vehicleData) return
def __format_value_for_ui(value): if value is None: return '%s' % i18n.makeString(MENU.PROFILE_STATS_ITEMS_EMPTY) else: return BigWorld.wg_getIntegralFormat(value)
def _buildData(self, targetData, isCurrentUser): return BigWorld.wg_getIntegralFormat(targetData.getWinsCount())
def __packAvgDmgData(self, avgDmg): return PUtils.packLditItemData( BigWorld.wg_getIntegralFormat(avgDmg), PROFILE.SECTION_SUMMARY_SCORES_AVGDAMAGE, PROFILE.PROFILE_PARAMS_TOOLTIP_DIF_FALLOUT_AVGDAMAGE, 'avgDamage40x32.png')
def __packMaxVictoryPoints(self, maxVictoryPoints): return PUtils.packLditItemData( BigWorld.wg_getIntegralFormat(maxVictoryPoints), PROFILE.SECTION_STATISTICS_SCORES_MAXVICTORYPOINTS, PROFILE.PROFILE_PARAMS_TOOLTIP_MAXVICTORYPOINTS, 'maxVictoryPoints48x48.png')