Ejemplo n.º 1
0
 def _getHeaderData(self, data):
     targetData = data[0]
     avgPointsPercent = PUtils.formatFloatPercent(
         PUtils.getValueOrUnavailable(targetData.getStepsEfficiency()))
     avgPointsTooltipData = (BigWorld.wg_getIntegralFormat(
         targetData.getStepsCount()),
                             BigWorld.wg_getIntegralFormat(
                                 targetData.getBattlesCount()))
     return (PUtils.getTotalBattlesHeaderParam(
         targetData, PROFILE.SECTION_STATISTICS_SCORES_TOTALBATTLES,
         PROFILE.PROFILE_PARAMS_TOOLTIP_BATTLESCOUNT),
             PUtils.packLditItemData(
                 BigWorld.wg_getIntegralFormat(targetData.getLadderPts()),
                 PROFILE.SECTION_STATISTICS_SCORES_RANKED_POINTS,
                 PROFILE.PROFILE_PARAMS_TOOLTIP_RANKED_POINTS,
                 'rankPoints40x32.png'),
             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),
             PUtils.packLditItemData(
                 BigWorld.wg_getNiceNumberFormat(
                     PUtils.getValueOrUnavailable(
                         targetData.getAvgFrags())),
                 PROFILE.SECTION_STATISTICS_SCORES_RANKED_AVGFRAGS,
                 PROFILE.PROFILE_PARAMS_TOOLTIP_RANKED_AVGFRAGS,
                 'icon_statistics_average_frags_40x32.png'))
Ejemplo n.º 2
0
 def __init__(self, targetData, accountDossier, isCurrentUser):
     self._isCurrentUser = isCurrentUser
     self._formattedWinsEfficiency = PUtils.getFormattedWinsEfficiency(targetData)
     self._dmgDealt = targetData.getDamageDealt()
     self._dmgReceived = targetData.getDamageReceived()
     self._damageEfficiency = backport.getNiceNumberFormat(PUtils.getValueOrUnavailable(targetData.getDamageEfficiency()))
     self._armorUsingEfficiency = PUtils.getValueOrUnavailable(targetData.getArmorUsingEfficiency())
     self._avgXP = PUtils.getValueOrUnavailable(targetData.getAvgXP())
     self._avgDmg = PUtils.getValueOrUnavailable(targetData.getAvgDamage())
     maxXP = targetData.getMaxXp()
     self._maxXP_formattedStr = backport.getIntegralFormat(maxXP)
     self._armorUsingToolTipData = PUtils.createToolTipData([PUtils.getAvgDamageBlockedValue(targetData)])
     self._avgAssistDmg = backport.getNiceNumberFormat(PUtils.getValueOrUnavailable(targetData.getDamageAssistedEfficiency()))
     super(ProfileDictStatisticsVO, self).__init__((targetData, accountDossier))
Ejemplo n.º 3
0
 def __getIndicatorData(self, value, formater, description, icon, tooltip):
     val = ProfileUtils.getValueOrUnavailable(value)
     return {'value': formater(val),
      'description': description,
      'iconSource': icon,
      'tooltip': tooltip,
      'enabled': val != ProfileUtils.UNAVAILABLE_VALUE}
Ejemplo n.º 4
0
 def __getIndicatorData(self, value, formater, description, icon, tooltip):
     val = ProfileUtils.getValueOrUnavailable(value)
     return {'value': formater(val),
      'description': description,
      'iconSource': icon,
      'tooltip': tooltip,
      'enabled': val != ProfileUtils.UNAVAILABLE_VALUE}
Ejemplo n.º 5
0
 def _sendAccountData(self, targetData, accountDossier):
     super(ProfileSummary, self)._sendAccountData(targetData,
                                                  accountDossier)
     outcome = ProfileUtils.packProfileDossierInfo(targetData,
                                                   accountDossier)
     outcome['avgDamage'] = ProfileUtils.getValueOrUnavailable(
         targetData.getAvgDamage())
     outcome['maxDestroyed'] = targetData.getMaxFrags()
     vehicle = self.itemsCache.items.getItemByCD(
         targetData.getMaxFragsVehicle())
     outcome[
         'maxDestroyedByVehicle'] = vehicle.shortUserName if vehicle is not None else ''
     outcome['globalRating'] = self.getGlobalRating(self._databaseID)
     totalStats = accountDossier.getTotalStats()
     outcome[
         'significantAchievements'] = AchievementsUtils.packAchievementList(
             totalStats.getSignificantAchievements(),
             accountDossier.getDossierType(), dumpDossier(accountDossier),
             self._userID is None, False)
     outcome['nearestAchievements'] = AchievementsUtils.packAchievementList(
         totalStats.getNearestAchievements(),
         accountDossier.getDossierType(), dumpDossier(accountDossier),
         self._userID is None, True)
     self.as_responseDossierS(self._battlesType, outcome, '', '')
     return
 def __init__(self, targetData, accountDossier, isCurrentUser):
     self.__avgVictoryPoints = PUtils.getValueOrUnavailable(targetData.getAvgVictoryPoints())
     self.__maxVictoryPoints = targetData.getMaxVictoryPoints()
     self.__kdr = targetData.getFragsEfficiency()
     self.__kills = targetData.getFragsCount()
     self.__consumablesKills = targetData.getConsumablesFragsCount()
     self.__deaths = targetData.getDeathsCount()
     super(ProfileFalloutStatisticsVO, self).__init__(targetData, accountDossier, isCurrentUser)
Ejemplo n.º 7
0
 def __init__(self, targetData, accountDossier, isCurrentUser):
     self.__avgVictoryPoints = PUtils.getValueOrUnavailable(targetData.getAvgVictoryPoints())
     self.__maxVictoryPoints = targetData.getMaxVictoryPoints()
     self.__kdr = targetData.getFragsEfficiency()
     self.__kills = targetData.getFragsCount()
     self.__consumablesKills = targetData.getConsumablesFragsCount()
     self.__deaths = targetData.getDeathsCount()
     super(ProfileFalloutStatisticsVO, self).__init__(targetData, accountDossier, isCurrentUser)
Ejemplo n.º 8
0
 def __init__(self, targetData, accountDossier, isCurrentUser):
     self._isCurrentUser = isCurrentUser
     self._formattedWinsEfficiency = PUtils.getFormattedWinsEfficiency(targetData)
     self._dmgDealt = targetData.getDamageDealt()
     self._dmgReceived = targetData.getDamageReceived()
     self._damageEfficiency = BigWorld.wg_getNiceNumberFormat(PUtils.getValueOrUnavailable(targetData.getDamageEfficiency()))
     damageBlockedByArmor = targetData.getDamageBlockedByArmor()
     potentialDamageReceived = targetData.getPotentialDamageReceived()
     pResDmg = potentialDamageReceived - damageBlockedByArmor
     self._armorUsingEfficiency = PUtils.getValueOrUnavailable(targetData.getArmorUsingEfficiency())
     self._avgXP = PUtils.getValueOrUnavailable(targetData.getAvgXP())
     self._avgDmg = PUtils.getValueOrUnavailable(targetData.getAvgDamage())
     maxXP = targetData.getMaxXp()
     self._maxXP_formattedStr = BigWorld.wg_getIntegralFormat(maxXP)
     self._armorUsingToolTipData = PUtils.createToolTipData([PUtils.getAvgDamageBlockedValue(targetData)])
     self._avgAssistDmg = BigWorld.wg_getNiceNumberFormat(PUtils.getValueOrUnavailable(targetData.getDamageAssistedEfficiency()))
     super(ProfileDictStatisticsVO, self).__init__((targetData, accountDossier))
Ejemplo n.º 9
0
 def __packAvgPosition(self):
     res = PUtils.getValueOrUnavailable(
         self.__targetData.getAveragePosition())
     return PUtils.packLditItemData(
         backport.getNiceNumberFormat(res),
         PROFILE.SECTION_SUMMARY_SCORES_AVERAGERANK,
         PROFILE.PROFILE_PARAMS_TOOLTIP_BRAVERAGERANK,
         'avgPosition40x32.png')
Ejemplo n.º 10
0
 def __getIndicatorData(self, value, formater, description, icon, tooltip):
     val = ProfileUtils.getValueOrUnavailable(value)
     return {
         "value": formater(val),
         "description": description,
         "iconSource": icon,
         "tooltip": tooltip,
         "enabled": val != ProfileUtils.UNAVAILABLE_VALUE,
     }
Ejemplo n.º 11
0
 def __updateHeader(self):
     isCreator = self.unitFunctional.getPlayerInfo().isCreator() if self.unitFunctional is not None else False
     club = self.clubsCtrl.getClub(self.__clubDBID)
     hasRankForModeChange = club is not None and club.getPermissions().canSetRanked()
     seasonActive = isSeasonInProgress()
     modeLabel = ''
     modeTooltip = ''
     modeTextStyle = TEXT_MANAGER_STYLES.STANDARD_TEXT
     if not seasonActive:
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_NOSEASON
         modeTooltip = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_NOSEASONTOOLTIP
     elif isCreator:
         if not hasRankForModeChange:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_LOWRANK
             modeTooltip = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_LOWRANKTOOLTIP
         elif self.__extra.isRatedBattle:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_SETUNRANKEDMODE
         else:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_SETRANKEDMODE
     elif self.__extra.isRatedBattle:
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_RANKEDMODE
         modeTextStyle = TEXT_MANAGER_STYLES.NEUTRAL_TEXT
     else:
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_WRONGROLE
         modeTooltip = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_WRONGROLETOOLTIP
     bgSource = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_LEAGUERIBBONS_UNRANKED
     battles = self.ABSENT_VALUES
     winRate = self.ABSENT_VALUES
     leagueIcon = getLadderChevron64x64()
     enableWinRateTF = False
     if club is not None:
         clubTotalStats = club.getTotalDossier().getTotalStats()
         battles = BigWorld.wg_getNiceNumberFormat(clubTotalStats.getBattlesCount())
         division = club.getLadderInfo().division
         leagueIcon = getLadderChevron64x64(division)
         winRateValue = ProfileUtils.getValueOrUnavailable(clubTotalStats.getWinsEfficiency())
         if winRateValue != ProfileUtils.UNAVAILABLE_VALUE:
             enableWinRateTF = True
             winRate = ProfileUtils.formatFloatPercent(winRateValue)
         else:
             winRate = self.ABSENT_VALUES
         if self.__extra.isRatedBattle:
             bgSource = getLadderBackground(division)
         self.requestClubEmblem64x64(club.getClubDbID(), club.getEmblem64x64())
     self.as_setHeaderDataS({'teamName': self.__extra.clubName,
      'isRankedMode': bool(self.__extra.isRatedBattle),
      'battles': battles,
      'winRate': winRate,
      'enableWinRateTF': enableWinRateTF,
      'leagueIcon': leagueIcon,
      'isFixedMode': not seasonActive or not isCreator,
      'modeLabel': TextManager.getText(modeTextStyle, _ms(modeLabel)),
      'modeTooltip': modeTooltip,
      'bgSource': bgSource})
     return
Ejemplo n.º 12
0
 def _sendAccountData(self, targetData, accountDossier):
     outcome = ProfileUtils.packProfileDossierInfo(targetData)
     outcome['avgDamage'] = ProfileUtils.getValueOrUnavailable(targetData.getAvgDamage())
     outcome['maxDestroyed'] = targetData.getMaxFrags()
     vehicle = g_itemsCache.items.getItemByCD(targetData.getMaxFragsVehicle())
     outcome['maxDestroyedByVehicle'] = vehicle.shortUserName if vehicle is not None else ''
     outcome['globalRating'] = self.getGlobalRating(self._databaseID)
     totalStats = accountDossier.getTotalStats()
     outcome['significantAchievements'] = ProfileUtils.packAchievementList(totalStats.getSignificantAchievements(), accountDossier, self._userID is None)
     outcome['nearestAchievements'] = ProfileUtils.packAchievementList(totalStats.getNearestAchievements(), accountDossier, self._userID is None)
     self.as_responseDossierS(self._battlesType, outcome)
Ejemplo n.º 13
0
    def _sendAccountData(self, targetData, accountDossier):
        formattedWinsEfficiency = ProfileUtils.getFormattedWinsEfficiency(targetData)
        dmgDealt = targetData.getDamageDealt()
        dmgReceived = targetData.getDamageReceived()
        damageEfficiency = BigWorld.wg_getNiceNumberFormat(ProfileUtils.getValueOrUnavailable(targetData.getDamageEfficiency()))
        damageBlockedByArmor = targetData.getDamageBlockedByArmor()
        potentialDamageReceived = targetData.getPotentialDamageReceived()
        pResDmg = potentialDamageReceived - damageBlockedByArmor
        armorUsingEfficiency = ProfileUtils.getValueOrUnavailable(targetData.getArmorUsingEfficiency())
        avgXP = ProfileUtils.getValueOrUnavailable(targetData.getAvgXP())
        avgDmg = ProfileUtils.getValueOrUnavailable(targetData.getAvgDamage())
        maxXP = targetData.getMaxXp()
        maxXP_formattedStr = BigWorld.wg_getIntegralFormat(maxXP)
        armorUsingToolTipData = ProfileUtils.createToolTipData([ProfileUtils.getAvgDamageBlockedValue(targetData)])
        avgAssistDmg = BigWorld.wg_getNiceNumberFormat(ProfileUtils.getValueOrUnavailable(targetData.getDamageAssistedEfficiency()))
        vehicles = targetData.getVehicles()
        vehiclesLen = len(vehicles)
        headerParams = []
        dataList = []
        if self._battlesType == PROFILE.PROFILE_DROPDOWN_LABELS_TEAM:
            headerText = i18n.makeString(PROFILE.SECTION_STATISTICS_HEADERTEXT_TEAM)
            headerParams.append(ProfileUtils.getTotalBattlesHeaderParam(targetData, PROFILE.SECTION_STATISTICS_SCORES_TOTALBATTLES, PROFILE.PROFILE_PARAMS_TOOLTIP_BATTLESCOUNT))
            headerParams.append(ProfileUtils.packLditItemData(damageEfficiency, PROFILE.SECTION_STATISTICS_DETAILED_DAMAGECOEFFICIENT, PROFILE.PROFILE_PARAMS_TOOLTIP_DAMAGECOEFF, 'dmgRatio40x32.png', {'tooltipData': ProfileUtils.createToolTipData((BigWorld.wg_getIntegralFormat(dmgDealt), BigWorld.wg_getIntegralFormat(dmgReceived)))}, HeaderItemsTypes.VALUES))
            headerParams.append(self.__packAvgDmgLditItemData(avgDmg))
            headerParams.append(self.__packAvgXPLditItemData(avgXP))
            headerParams.append(ProfileUtils.packLditItemData(avgAssistDmg, PROFILE.SECTION_STATISTICS_SCORES_AVGASSISTEDDAMAGE, PROFILE.PROFILE_PARAMS_TOOLTIP_AVGASSISTEDDAMAGE, 'assist40x32.png'))
            headerParams.append(ProfileUtils.packLditItemData(BigWorld.wg_getNiceNumberFormat(armorUsingEfficiency), PROFILE.SECTION_STATISTICS_SCORES_ARMORUSING, PROFILE.PROFILE_PARAMS_TOOLTIP_ARMORUSING, 'armorUsing40x32.png', {'tooltipData': armorUsingToolTipData}, HeaderItemsTypes.VALUES))
            dataList.append(self.__getDetailedStatisticsData(PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_DETAILED, targetData))
            dataList.append(self.__getChartsData(targetData))
        elif self._battlesType == PROFILE.PROFILE_DROPDOWN_LABELS_HISTORICAL:
            headerParams.append(ProfileUtils.getTotalBattlesHeaderParam(targetData, PROFILE.SECTION_STATISTICS_SCORES_TOTALBATTLES, PROFILE.PROFILE_PARAMS_TOOLTIP_BATTLESCOUNT))
            headerText = i18n.makeString(PROFILE.SECTION_STATISTICS_HEADERTEXT_HISTORICAL)
            histBattleFieldAchievesCount = 0
            for record in layouts.HISTORY_BATTLEFIELD_GROUP:
                achieve = targetData.getAchievement(record)
                if achieve.isInDossier():
                    histBattleFieldAchievesCount += 1

            histBattleFieldAchievesCount = BigWorld.wg_getIntegralFormat(histBattleFieldAchievesCount)
            histBattleFieldAchievesCountTotal = BigWorld.wg_getIntegralFormat(len(layouts.HISTORY_BATTLEFIELD_GROUP))
            headerParams.append(ProfileUtils.packLditItemData(formattedWinsEfficiency, PROFILE.SECTION_STATISTICS_SCORES_TOTALWINS, PROFILE.PROFILE_PARAMS_TOOLTIP_WINS, 'wins40x32.png'))
            headerParams.append(ProfileUtils.packLditItemData(histBattleFieldAchievesCount, PROFILE.SECTION_STATISTICS_SCORES_ACHIEVEMENTSCOUNT, PROFILE.PROFILE_PARAMS_TOOLTIP_ACHIEVEMENTSCOUNT, 'honors40x32.png', {'total': histBattleFieldAchievesCountTotal}, HeaderItemsTypes.RATIO))
            headerParams.append(ProfileUtils.packLditItemData(BigWorld.wg_getIntegralFormat(vehiclesLen), PROFILE.SECTION_STATISTICS_SCORES_USEDTECHNICS, PROFILE.PROFILE_PARAMS_TOOLTIP_USEDTECHNICS, 'techRatio40x32.png'))
            dataList.append(self.__getDetailedStatisticsData(PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_DETAILED, targetData))
        elif self._battlesType == PROFILE.PROFILE_DROPDOWN_LABELS_FORTIFICATIONS:
            headerText = i18n.makeString(PROFILE.SECTION_STATISTICS_HEADERTEXT_FORTIFICATIONS)
            fortBattlesTargetData = accountDossier.getFortBattlesStats()
            fortMiscTargetData = accountDossier.getFortMiscStats()
            if isFortificationBattlesEnabled():
                headerParams.append(ProfileUtils.getTotalBattlesHeaderParam(fortBattlesTargetData, PROFILE.SECTION_STATISTICS_SCORES_FORT_BATTLES, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_BATTLES))
                headerParams.append(ProfileUtils.packLditItemData(ProfileUtils.getFormattedWinsEfficiency(fortBattlesTargetData), PROFILE.SECTION_STATISTICS_SCORES_FORT_BATTLESWINSEFFICIENCY, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_BATTLESWINSEFFICIENCY, 'wins40x32.png'))
            else:
                headerParams.append(ProfileUtils.packLditItemData(str(ProfileUtils.UNAVAILABLE_VALUE), PROFILE.SECTION_STATISTICS_SCORES_FORT_BATTLES, PROFILE.PROFILE_PARAMS_TOOLTIP_UNAVAILABLE_FORT_BATTLES, 'battles40x32.png'))
                headerParams.append(ProfileUtils.packLditItemData(str(ProfileUtils.UNAVAILABLE_VALUE), PROFILE.SECTION_STATISTICS_SCORES_FORT_BATTLESWINSEFFICIENCY, PROFILE.PROFILE_PARAMS_TOOLTIP_UNAVAILABLE_FORT_WINSEFFICIENCY, 'wins40x32.png'))
            headerParams.append(ProfileUtils.getTotalBattlesHeaderParam(targetData, PROFILE.SECTION_STATISTICS_SCORES_FORT_SORTIE, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_SORTIE))
            headerParams.append(ProfileUtils.packLditItemData(formattedWinsEfficiency, PROFILE.SECTION_STATISTICS_SCORES_FORT_SORTIEWINSEFFICIENCY, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_SORTIEWINSEFFICIENCY, 'wins40x32.png'))
            totalSortiesLoot = fortMiscTargetData.getLootInSorties()
            avgFortSortiesLoot = self.__getFortAvgLoot(targetData, totalSortiesLoot)
            headerParams.append(ProfileUtils.packLditItemData(str(avgFortSortiesLoot), PROFILE.SECTION_STATISTICS_SCORES_FORT_RESOURCE, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_RESOURCE, 'resources40x32.png'))
            if isFortificationBattlesEnabled():
                fortBattlesDetaildStatisticsTabData = self.__getDetailedStatisticsData(PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_FORTBATTLES, fortBattlesTargetData)
                fortBattlesDetaildStatisticsTabData['data'][0][0]['data'][0]['tooltip'] = PROFILE.PROFILE_PARAMS_TOOLTIP_DIF_FORT_BATTLESCOUNT
                dataList.append(fortBattlesDetaildStatisticsTabData)
            dataList.append(self.__getDetailedStatisticsData(PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_FORTSORTIE, targetData))
            specificData = []
            battlesCount = fortBattlesTargetData.getBattlesCount()
            lossesCount = fortBattlesTargetData.getLossesCount()
            winsCount = fortBattlesTargetData.getWinsCount()
            battlesToolTipData = [BigWorld.wg_getIntegralFormat(winsCount), BigWorld.wg_getIntegralFormat(lossesCount)]
            formattedBattlesCount = BigWorld.wg_getIntegralFormat(battlesCount)
            specificDataColumn1 = []
            if isFortificationBattlesEnabled():
                specificDataColumn1.append(ProfileUtils.getLabelDataObject(PROFILE.SECTION_STATISTICS_BODYPARAMS_LABEL_FORTBATTLES, [DetailedStatisticsUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTTOTALBATTLES, formattedBattlesCount, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_BATTLES, ProfileUtils.createToolTipData(battlesToolTipData)),
                 DetailedStatisticsUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLESTOTALWINS, ProfileUtils.getFormattedWinsEfficiency(fortBattlesTargetData), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLESWINS),
                 DetailedStatisticsUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_LOOTING, fortMiscTargetData.getEnemyBasePlunderNumber(), PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_LOOTING),
                 DetailedStatisticsUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_ATTACKS, fortMiscTargetData.getAttackNumber(), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_ATTACKS),
                 DetailedStatisticsUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_DEFENCES, fortMiscTargetData.getDefenceHours(), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_DEFENCES)]))
            battlesCount = targetData.getBattlesCount()
            lossesCount = targetData.getLossesCount()
            winsCount = targetData.getWinsCount()
            drawsCount = ProfileUtils.getDrawCount(battlesCount, lossesCount, winsCount)
            battlesToolTipData = [BigWorld.wg_getIntegralFormat(winsCount), BigWorld.wg_getIntegralFormat(lossesCount), BigWorld.wg_getIntegralFormat(drawsCount)]
            formattedBattlesCount = BigWorld.wg_getIntegralFormat(battlesCount)
            specificDataColumn1.append(ProfileUtils.getLabelDataObject(PROFILE.SECTION_STATISTICS_BODYPARAMS_LABEL_FORTSORTIE, [DetailedStatisticsUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORT_SORTIE, formattedBattlesCount, PROFILE.PROFILE_PARAMS_TOOLTIP_FORT_SORTIE, ProfileUtils.createToolTipData(battlesToolTipData)), DetailedStatisticsUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTSORTIETOTALWINS, formattedWinsEfficiency, PROFILE.PROFILE_PARAMS_TOOLTIP_FORTSORTIEWINS)]))
            specificData.append(specificDataColumn1)
            resourcesDataList = []
            resourcesDataList.append(DetailedStatisticsUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTSORTIES_AVGRESOURCES, avgFortSortiesLoot, PROFILE.PROFILE_PARAMS_TOOLTIP_FORTSORTIES_AVGRESOURCES))
            resourcesDataList.append(DetailedStatisticsUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTSORTIES_TOTALRESOURCES, BigWorld.wg_getIntegralFormat(totalSortiesLoot), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTSORTIES_TOTALRESOURCES))
            if isFortificationBattlesEnabled():
                resourcesDataList.append(DetailedStatisticsUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_TOTALRESOURCES, BigWorld.wg_getIntegralFormat(fortMiscTargetData.getLootInBattles()), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_TOTALRESOURCES))
                resourcesDataList.append(DetailedStatisticsUtils.getDetailedDataObject(PROFILE.SECTION_STATISTICS_SCORES_FORTBATTLES_MAXRESOURCES, BigWorld.wg_getIntegralFormat(fortMiscTargetData.getMaxLootInBattles()), PROFILE.PROFILE_PARAMS_TOOLTIP_FORTBATTLES_MAXRESOURCES))
            specificData.append([ProfileUtils.getLabelDataObject(PROFILE.SECTION_STATISTICS_BODYPARAMS_LABEL_RESOURCE, resourcesDataList)])
            dataList.append(ProfileUtils.getLabelViewTypeDataObject(PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_SPECIFIC, specificData, ProfileUtils.VIEW_TYPE_TABLES))
        else:
            maxExpToolTipData = ProfileUtils.getVehicleRecordTooltipData(targetData.getMaxXpVehicle)
            headerText = i18n.makeString(PROFILE.SECTION_STATISTICS_HEADERTEXT_ALL)
            headerParams.append(ProfileUtils.getTotalBattlesHeaderParam(targetData, PROFILE.SECTION_STATISTICS_SCORES_TOTALBATTLES, PROFILE.PROFILE_PARAMS_TOOLTIP_BATTLESCOUNT))
            headerParams.append(ProfileUtils.packLditItemData(formattedWinsEfficiency, PROFILE.SECTION_STATISTICS_SCORES_TOTALWINS, PROFILE.PROFILE_PARAMS_TOOLTIP_WINS, 'wins40x32.png'))
            headerParams.append(self.__packAvgDmgLditItemData(avgDmg))
            headerParams.append(self.__packAvgXPLditItemData(avgXP))
            headerParams.append(ProfileUtils.packLditItemData(maxXP_formattedStr, PROFILE.SECTION_STATISTICS_SCORES_MAXEXPERIENCE, PROFILE.PROFILE_PARAMS_TOOLTIP_MAXEXP, 'maxExp40x32.png', {'tooltipData': maxExpToolTipData}, HeaderItemsTypes.VALUES))
            headerParams.append(ProfileUtils.packLditItemData(BigWorld.wg_getIntegralFormat(targetData.getMarksOfMastery()[3]), PROFILE.SECTION_STATISTICS_SCORES_COOLSIGNS, PROFILE.PROFILE_PARAMS_TOOLTIP_MARKOFMASTERY, 'markOfMastery40x32.png', {'total': BigWorld.wg_getIntegralFormat(vehiclesLen)}, HeaderItemsTypes.RATIO))
            dataList.append(self.__getDetailedStatisticsData(PROFILE.SECTION_STATISTICS_BODYBAR_LABEL_DETAILED, targetData))
            dataList.append(self.__getChartsData(targetData))
        bodyParams = {'dataList': dataList}
        self.as_responseDossierS(self._battlesType, {'headerText': headerText,
         'headerParams': headerParams,
         'bodyParams': bodyParams})
Ejemplo n.º 14
0
 def __packAverageDamageDealt(self):
     res = PUtils.getValueOrUnavailable(self.__targetData.getAvgDamage())
     return PUtils.packLditItemData(
         backport.getIntegralFormat(res),
         PROFILE.SECTION_STATISTICS_DETAILED_AVGDAMAGE,
         PROFILE.PROFILE_PARAMS_TOOLTIP_BRAVGDAMAGE, 'avgDamage40x32.png')
 def __updateHeader(self):
     club = self.clubsCtrl.getClub(self.__clubDBID)
     canSetRanked = club is not None and club.getPermissions().canSetRanked()
     seasonState = self.clubsCtrl.getSeasonState()
     modeLabel = ''
     modeTooltip = ''
     modeTooltipType = ''
     isFixedMode = True
     isModeTooltip = False
     if self.__extra.isRatedBattle:
         isFixedMode = not canSetRanked
         if canSetRanked:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_SETUNRANKEDMODE
         else:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_RANKEDMODE
     elif seasonState.isSuspended():
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONPAUSED
         isModeTooltip = True
         modeTooltipType = TOOLTIPS_CONSTANTS.COMPLEX
         modeTooltip = makeTooltip(CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONPAUSEDTOOLTIP_HEADER, CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONPAUSEDTOOLTIP_BODY)
     elif seasonState.isFinished():
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONFINISHED
         isModeTooltip = True
         modeTooltipType = TOOLTIPS_CONSTANTS.COMPLEX
         modeTooltip = makeTooltip(CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONFINISHEDTOOLTIP_HEADER, CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONFINISHEDTOOLTIP_BODY)
     elif canSetRanked:
         isFixedMode = False
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_SETRANKEDMODE
     if len(modeLabel):
         if canSetRanked and seasonState.isActive() or self.__extra.isRatedBattle:
             modeLabel = text_styles.neutral(modeLabel)
         else:
             modeLabel = text_styles.standard(modeLabel)
     if isHourInForbiddenList(self.clubsCtrl.getAvailabilityCtrl().getForbiddenHours()):
         modeLabel = '{0}{1}'.format(icons.alert(), text_styles.main(CYBERSPORT.LADDERREGULATIONS_WARNING))
         isFixedMode = True
         isModeTooltip = True
         modeTooltipType = TOOLTIPS_CONSTANTS.LADDER_REGULATIONS
     bgSource = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_LEAGUERIBBONS_UNRANKED
     battles = self.ABSENT_VALUES
     winRate = self.ABSENT_VALUES
     leagueIcon = getLadderChevron64x64()
     enableWinRateTF = False
     if club is not None:
         clubTotalStats = club.getTotalDossier().getTotalStats()
         battles = BigWorld.wg_getNiceNumberFormat(clubTotalStats.getBattlesCount())
         division = club.getLadderInfo().division
         leagueIcon = getLadderChevron64x64(division)
         winRateValue = ProfileUtils.getValueOrUnavailable(clubTotalStats.getWinsEfficiency())
         if winRateValue != ProfileUtils.UNAVAILABLE_VALUE:
             enableWinRateTF = True
             winRate = ProfileUtils.formatFloatPercent(winRateValue)
         else:
             winRate = self.ABSENT_VALUES
         if self.__extra.isRatedBattle:
             bgSource = getLadderBackground(division)
         self.requestClubEmblem64x64(club.getClubDbID(), club.getEmblem64x64())
     self.as_setHeaderDataS({'clubId': self.__extra.clubDBID,
      'teamName': self.__extra.clubName,
      'isRankedMode': bool(self.__extra.isRatedBattle),
      'battles': battles,
      'winRate': winRate,
      'enableWinRateTF': enableWinRateTF,
      'leagueIcon': leagueIcon,
      'isFixedMode': isFixedMode,
      'modeLabel': modeLabel,
      'modeTooltip': modeTooltip,
      'bgSource': bgSource,
      'modeTooltipType': modeTooltipType,
      'isModeTooltip': isModeTooltip})
     return
Ejemplo n.º 16
0
 def __packAverageXP(self):
     res = PUtils.getValueOrUnavailable(self.__targetData.getAvgXP())
     return PUtils.packLditItemData(
         backport.getIntegralFormat(res),
         PROFILE.SECTION_STATISTICS_SCORES_AVGEXPERIENCE_SHORT,
         PROFILE.PROFILE_PARAMS_TOOLTIP_AVGEX_SHORT, 'maxExp40x32.png')
 def __updateHeader(self):
     club = self.clubsCtrl.getClub(self.__clubDBID)
     canSetRanked = club is not None and club.getPermissions().canSetRanked(
     )
     seasonState = self.clubsCtrl.getSeasonState()
     modeLabel = ''
     modeTooltip = ''
     modeTooltipType = ''
     isFixedMode = True
     isModeTooltip = False
     if self.__extra.isRatedBattle:
         isFixedMode = not canSetRanked
         if canSetRanked:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_SETUNRANKEDMODE
         else:
             modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_RANKEDMODE
     elif seasonState.isSuspended():
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONPAUSED
         isModeTooltip = True
         modeTooltipType = TOOLTIPS_CONSTANTS.COMPLEX
         modeTooltip = makeTooltip(
             CYBERSPORT.
             STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONPAUSEDTOOLTIP_HEADER,
             CYBERSPORT.
             STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONPAUSEDTOOLTIP_BODY
         )
     elif seasonState.isFinished():
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONFINISHED
         isModeTooltip = True
         modeTooltipType = TOOLTIPS_CONSTANTS.COMPLEX
         modeTooltip = makeTooltip(
             CYBERSPORT.
             STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONFINISHEDTOOLTIP_HEADER,
             CYBERSPORT.
             STATICFORMATION_UNITVIEW_MODECHANGEWARNING_SEASONFINISHEDTOOLTIP_BODY
         )
     elif canSetRanked:
         isFixedMode = False
         modeLabel = CYBERSPORT.STATICFORMATION_UNITVIEW_SETRANKEDMODE
     if len(modeLabel):
         if canSetRanked and seasonState.isActive(
         ) or self.__extra.isRatedBattle:
             modeLabel = text_styles.neutral(modeLabel)
         else:
             modeLabel = text_styles.standard(modeLabel)
     if isHourInForbiddenList(
             self.clubsCtrl.getAvailabilityCtrl().getForbiddenHours()):
         modeLabel = '{0}{1}'.format(
             icons.alert(),
             text_styles.main(CYBERSPORT.LADDERREGULATIONS_WARNING))
         isFixedMode = True
         isModeTooltip = True
         modeTooltipType = TOOLTIPS_CONSTANTS.LADDER_REGULATIONS
     bgSource = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_LEAGUERIBBONS_UNRANKED
     battles = self.ABSENT_VALUES
     winRate = self.ABSENT_VALUES
     leagueIcon = getLadderChevron64x64()
     enableWinRateTF = False
     if club is not None:
         clubTotalStats = club.getTotalDossier().getTotalStats()
         battles = BigWorld.wg_getNiceNumberFormat(
             clubTotalStats.getBattlesCount())
         division = club.getLadderInfo().division
         leagueIcon = getLadderChevron64x64(division)
         winRateValue = ProfileUtils.getValueOrUnavailable(
             clubTotalStats.getWinsEfficiency())
         if winRateValue != ProfileUtils.UNAVAILABLE_VALUE:
             enableWinRateTF = True
             winRate = ProfileUtils.formatFloatPercent(winRateValue)
         else:
             winRate = self.ABSENT_VALUES
         if self.__extra.isRatedBattle:
             bgSource = getLadderBackground(division)
         self.requestClubEmblem64x64(club.getClubDbID(),
                                     club.getEmblem64x64())
     self.as_setHeaderDataS({
         'clubId': self.__extra.clubDBID,
         'teamName': self.__extra.clubName,
         'isRankedMode': bool(self.__extra.isRatedBattle),
         'battles': battles,
         'winRate': winRate,
         'enableWinRateTF': enableWinRateTF,
         'leagueIcon': leagueIcon,
         'isFixedMode': isFixedMode,
         'modeLabel': modeLabel,
         'modeTooltip': modeTooltip,
         'bgSource': bgSource,
         'modeTooltipType': modeTooltipType,
         'isModeTooltip': isModeTooltip
     })
     return