Example #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'))
 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
Example #3
0
 def _getHeaderData(self, data):
     targetData = data[0]
     stepsEfficiency = targetData.getStepsEfficiency()
     avgPointsPercent = PUtils.formatFloatPercent(stepsEfficiency) if stepsEfficiency > 0 else PUtils.UNAVAILABLE_SYMBOL
     stepsCount = targetData.getStepsCount()
     stepsCount = backport.getIntegralFormat(stepsCount) if stepsCount >= 0 else PUtils.UNAVAILABLE_SYMBOL
     avgPointsTooltipData = (stepsCount, backport.getIntegralFormat(targetData.getBattlesCount()))
     return (PUtils.getTotalBattlesHeaderParam(targetData, PROFILE.SECTION_STATISTICS_SCORES_TOTALBATTLES, PROFILE.PROFILE_PARAMS_TOOLTIP_BATTLESCOUNT),
      PUtils.packLditItemData(avgPointsPercent, PROFILE.SECTION_STATISTICS_SCORES_RANKED_AVGPOINTS, PROFILE.PROFILE_PARAMS_TOOLTIP_RANKED_AVGPOINTS, 'rankStageFactor40x32.png', PUtils.createToolTipData(avgPointsTooltipData)),
      _packAvgDmgLditItemData(self._avgDmg),
      _packAvgXPLditItemData(self._avgXP))
def _getLevelParams(i18nFunc, battlesCountGetter, winsEfficiencyGetter, eloRatingGetter, placeGetter, favArenaNameGetter, ratingOutdated):
    battlesCount = formatField(getter=battlesCountGetter, formatter=BigWorld.wg_getIntegralFormat)
    winsEfficiency = formatField(getter=winsEfficiencyGetter, formatter=lambda x: PUtils.formatFloatPercent(x))
    eloRating = formatField(getter=eloRatingGetter, formatter=BigWorld.wg_getIntegralFormat)
    place = formatField(getter=placeGetter, formatter=BigWorld.wg_getIntegralFormat)
    favArenaName = formatField(getter=favArenaNameGetter, formatter=lambda x: getI18ArenaById(getArenaGeomentryName(x)))
    return [_getDataObject('battles', i18nFunc, battlesCount),
     _getDataObject('wins', i18nFunc, winsEfficiency),
     _getDataObject('eloRating', i18nFunc, eloRating),
     _getDataObject('place', i18nFunc, place, ratingOutdated),
     _getDataObjectTruncatedValue('favoriteMap', i18nFunc, favArenaName)]
Example #5
0
def _getLevelParams(i18nFunc, battlesCountGetter, winsEfficiencyGetter,
                    eloRatingGetter, placeGetter, favArenaNameGetter,
                    ratingOutdated):
    battlesCount = formatField(getter=battlesCountGetter,
                               formatter=BigWorld.wg_getIntegralFormat)
    winsEfficiency = formatField(
        getter=winsEfficiencyGetter,
        formatter=lambda x: PUtils.formatFloatPercent(x))
    eloRating = formatField(getter=eloRatingGetter,
                            formatter=BigWorld.wg_getIntegralFormat)
    place = formatField(getter=placeGetter,
                        formatter=BigWorld.wg_getIntegralFormat)
    favArenaName = formatField(
        getter=favArenaNameGetter,
        formatter=lambda arena_id: getI18ArenaById(arena_id))
    return [
        _getDataObject('battles', i18nFunc, battlesCount),
        _getDataObject('wins', i18nFunc, winsEfficiency),
        _getDataObject('eloRating', i18nFunc, eloRating),
        _getDataObject('place', i18nFunc, place, ratingOutdated),
        _getDataObjectTruncatedValue('favoriteMap', i18nFunc, favArenaName)
    ]
 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
 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