Esempio n. 1
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
Esempio n. 2
0
 def showTooltip(self, cmd):
     tooltipType = cmd.tooltipType
     itemId = cmd.itemId
     args = []
     withLongIntArgs = (TC.AWARD_SHELL,)
     withLongOnlyArgs = (TC.AWARD_VEHICLE,
      TC.AWARD_MODULE,
      TC.INVENTORY_BATTLE_BOOSTER,
      TC.BOOSTERS_BOOSTER_INFO,
      TC.BADGE,
      TC.TECH_CUSTOMIZATION_ITEM)
     if tooltipType in withLongIntArgs:
         args = [itemId, 0]
     elif tooltipType in withLongOnlyArgs:
         args = [itemId]
     elif tooltipType == TC.ACHIEVEMENT:
         dossier = self.itemsCache.items.getAccountDossier()
         dossierCompDescr = dumpDossier(self.itemsCache.items.getAccountDossier())
         achievement = dossier.getTotalStats().getAchievement((cmd.blockId, itemId))
         args = [dossier.getDossierType(),
          dossierCompDescr,
          achievement.getBlock(),
          cmd.itemId,
          isRareAchievement(achievement)]
     self.__getTooltipMgr().onCreateTypedTooltip(tooltipType, args, 'INFO')
Esempio n. 3
0
    def getDossierData(self, callback):
        """
        Returns dict of dossier data: information stats blocks and
        achievements list.
        """
        tmanDossier = g_itemsCache.items.getTankmanDossier(self.tmanInvID)
        if tmanDossier is None:
            callback(None)
            return
        else:
            achieves = tmanDossier.getTotalStats().getAchievements(isInDossier=True)
            pickledDossierCompDescr = dumpDossier(tmanDossier)
            packedAchieves = []
            for sectionIdx, section in enumerate(achieves):
                packedAchieves.append([])
                for achievement in section:
                    packedAchieves[sectionIdx].append(self.__packAchievement(achievement, pickledDossierCompDescr))

            callback(
                {
                    "achievements": packedAchieves,
                    "stats": tmanDossier.getStats(g_itemsCache.items.getTankman(self.tmanInvID)),
                    "firstMsg": self.__makeStandardText(MENU.CONTEXTMENU_PERSONALCASE_STATS_FIRSTINFO),
                    "secondMsg": self.__makeStandardText(MENU.CONTEXTMENU_PERSONALCASE_STATS_SECONDINFO),
                }
            )
            return
    def _sendAccountData(self, targetData, accountDossier):
        super(ProfileAwards, self)._sendAccountData(targetData, accountDossier)
        achievements = targetData.getAchievements(showHidden=False)
        totalItemsList = []
        for block in achievements:
            totalItemsList.append(len(block))

        if self.__achievementsFilter == PROFILE.SECTION_AWARDS_DROPDOWN_LABELS_INPROCESS:
            achievements = targetData.getAchievements(isInDossier=True,
                                                      showHidden=False)
        elif self.__achievementsFilter == PROFILE.SECTION_AWARDS_DROPDOWN_LABELS_NONE:
            achievements = targetData.getAchievements(isInDossier=False,
                                                      showHidden=False)
        packedList = []
        for achievementBlockList in achievements:
            packedList.append(
                AchievementsUtils.packAchievementList(
                    achievementBlockList, accountDossier.getDossierType(),
                    dumpDossier(accountDossier), self._userID is None))

        self.as_responseDossierS(
            self._battlesType, {
                'achievementsList': packedList,
                'totalItemsList': totalItemsList,
                'battlesCount': targetData.getBattlesCount()
            }, '', '')
        return
    def getDossierData(self, callback):
        tmanDossier = self.itemsCache.items.getTankmanDossier(self.tmanInvID)
        if tmanDossier is None:
            callback(None)
            return
        else:
            achieves = tmanDossier.getTotalStats().getAchievements(isInDossier=True)
            pickledDossierCompDescr = dumpDossier(tmanDossier)
            packedAchieves = []
            for sectionIdx, section in enumerate(achieves):
                packedAchieves.append([])
                for achievement in section:
                    packedAchieves[sectionIdx].append(self.__packAchievement(achievement, pickledDossierCompDescr))

            serverSettings = self.lobbyContext.getServerSettings()
            isWotPlusEnabled = serverSettings.isRenewableSubEnabled()
            isNewSubscriptionsEnabled = serverSettings.isWotPlusNewSubscriptionEnabled()
            hasWotPlus = BigWorld.player().renewableSubscription.isEnabled()
            secondIcon = RES_ICONS.MAPS_ICONS_CREWHEADER_ACCELERATED_CREW_TRAINING if isWotPlusEnabled else RES_ICONS.MAPS_ICONS_LIBRARY_PREM_CHECKBOX
            callbackInfo = {'achievements': packedAchieves,
             'stats': tmanDossier.getStats(self.itemsCache.items.getTankman(self.tmanInvID)),
             'firstMsg': self.__makeStandardText(MENU.CONTEXTMENU_PERSONALCASE_STATS_FIRSTINFO),
             'secondMsg': self.__makeStandardText(MENU.CONTEXTMENU_PERSONALCASE_STATS_SECONDINFO),
             'secondIcon': secondIcon}
            if isWotPlusEnabled and (isNewSubscriptionsEnabled or hasWotPlus):
                callbackInfo['wotPlusIcon'] = RES_ICONS.MAPS_ICONS_LIBRARY_WOT_PLUS
                callbackInfo['wotPlusMsg'] = self.__makeStandardText(MENU.CONTEXTMENU_PERSONALCASE_STATS_WOTPLUS)
            callback(callbackInfo)
            return
Esempio n. 6
0
    def getDossierData(self, callback):
        """
        Returns dict of dossier data: information stats blocks and
        achievements list.
        """
        tmanDossier = g_itemsCache.items.getTankmanDossier(self.tmanInvID)
        if tmanDossier is None:
            callback(None)
            return
        achieves = tmanDossier.getTotalStats().getAchievements(
            isInDossier=True)
        pickledDossierCompDescr = dumpDossier(tmanDossier)
        packedAchieves = []
        for sectionIdx, section in enumerate(achieves):
            packedAchieves.append([])
            for achievement in section:
                packedAchieves[sectionIdx].append(
                    self.__packAchievement(achievement,
                                           pickledDossierCompDescr))

        callback({
            'achievements':
            packedAchieves,
            'stats':
            tmanDossier.getStats(g_itemsCache.items.getTankman(
                self.tmanInvID)),
            'firstMsg':
            self.__makeStandardText(
                MENU.CONTEXTMENU_PERSONALCASE_STATS_FIRSTINFO),
            'secondMsg':
            self.__makeStandardText(
                MENU.CONTEXTMENU_PERSONALCASE_STATS_SECONDINFO)
        })
Esempio n. 7
0
def _makeAchievements(dossier):
    return AchievementsUtils.packAchievementList(
        dossier.getTotalStats().getSignificantAchievements(),
        dossier.getDossierType(),
        dumpDossier(dossier),
        True,
        False,
    )
Esempio n. 8
0
def _makeAchievements(dossier, club):
    achievements = dossier.getTotalStats().getAchievements()
    mergedList = list(itertools.chain(*achievements))
    isForClubMember = club.hasMember(getAccountDatabaseID())
    return AchievementsUtils.packAchievementList(mergedList,
                                                 dossier.getDossierType(),
                                                 dumpDossier(dossier),
                                                 isForClubMember, True)
Esempio n. 9
0
    def __getAchievementsList(self, targetData, vehDossier):
        packedList = []
        achievements = targetData.getAchievements(True)
        for achievementBlockList in achievements:
            packedList.append(
                AchievementsUtils.packAchievementList(
                    achievementBlockList, vehDossier.getDossierType(),
                    dumpDossier(vehDossier), self._userID is None, True,
                    ACHIEVEMENTS_ALIASES.GREY_COUNTER))

        return packedList
Esempio n. 10
0
 def __packAchievement(self, stats, vehDossier, record):
     """
     The method packs desired achievement record for the provided vehicle dossier.
     :param stats: vehicle's stats block (_VehiclesStatsBlock instance)
     :param vehDossier: VehicleDossier instance
     :param record: one from dossiers2/ui/achievements.py
     :return: dict
     """
     return AchievementsUtils.packAchievement(stats.getAchievement(record),
                                              vehDossier.getDossierType(),
                                              dumpDossier(vehDossier),
                                              self._userID is None)
Esempio n. 11
0
 def _receiveVehicleDossier(self, vehicleIntCD, databaseId):
     vehDossier = g_itemsCache.items.getVehicleDossier(
         vehicleIntCD, databaseId)
     achievementsList = None
     specialMarksStats = []
     if self._battlesType == PROFILE_DROPDOWN_KEYS.ALL:
         stats = vehDossier.getRandomStats()
         achievementsList = self.__getAchievementsList(stats, vehDossier)
         if g_itemsCache.items.getItemByCD(int(vehicleIntCD)).level > 4:
             specialMarksStats.append(
                 AchievementsUtils.packAchievement(
                     stats.getAchievement(MARK_ON_GUN_RECORD),
                     vehDossier.getDossierType(), dumpDossier(vehDossier),
                     self._userID is None))
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.TEAM:
         stats = vehDossier.getTeam7x7Stats()
         achievementsList = self.__getAchievementsList(stats, vehDossier)
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.STATICTEAM:
         stats = vehDossier.getRated7x7Stats()
         achievementsList = self.__getAchievementsList(stats, vehDossier)
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.HISTORICAL:
         stats = vehDossier.getHistoricalStats()
         achievementsList = self.__getAchievementsList(stats, vehDossier)
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FORTIFICATIONS_SORTIES:
         stats = vehDossier.getFortSortiesStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FORTIFICATIONS_BATTLES:
         stats = vehDossier.getFortBattlesStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.CLAN:
         stats = vehDossier.getGlobalMapStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FALLOUT:
         stats = vehDossier.getFalloutStats()
     else:
         raise ValueError('Profile Technique: Unknown battle type: ' +
                          self._battlesType)
     if achievementsList is not None:
         achievementsList.insert(0, specialMarksStats)
     if self._battlesType == PROFILE_DROPDOWN_KEYS.FORTIFICATIONS_BATTLES:
         layout = FORT_STATISTICS_LAYOUT
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FALLOUT:
         layout = FALLOUT_STATISTICS_LAYOUT
     else:
         layout = STATISTICS_LAYOUT
     preparedStatistics = DetailedStatisticsUtils.getStatistics(
         stats, self._userID is None, layout)
     self.as_responseVehicleDossierS({
         'detailedData': preparedStatistics,
         'achievements': achievementsList
     })
     return
Esempio n. 12
0
 def _receiveVehicleDossier(self, vehicleIntCD, databaseId):
     vehDossier = g_itemsCache.items.getVehicleDossier(vehicleIntCD, databaseId)
     achievementsList = None
     specialMarksStats = []
     if self._battlesType == PROFILE.PROFILE_DROPDOWN_LABELS_ALL:
         stats = vehDossier.getRandomStats()
         achievementsList = self.__getAchievementsList(stats, vehDossier)
         if g_itemsCache.items.getItemByCD(int(vehicleIntCD)).level > 4:
             specialMarksStats.append(AchievementsUtils.packAchievement(stats.getAchievement(MARK_ON_GUN_RECORD), vehDossier.getDossierType(), dumpDossier(vehDossier), self._userID is None))
     elif self._battlesType == PROFILE.PROFILE_DROPDOWN_LABELS_TEAM:
         stats = vehDossier.getTeam7x7Stats()
         achievementsList = self.__getAchievementsList(stats, vehDossier)
     elif self._battlesType == PROFILE.PROFILE_DROPDOWN_LABELS_STATICTEAM:
         stats = vehDossier.getRated7x7Stats()
         achievementsList = self.__getAchievementsList(stats, vehDossier)
     elif self._battlesType == PROFILE.PROFILE_DROPDOWN_LABELS_HISTORICAL:
         stats = vehDossier.getHistoricalStats()
         achievementsList = self.__getAchievementsList(stats, vehDossier)
     elif self._battlesType == PROFILE.PROFILE_DROPDOWN_LABELS_FORTIFICATIONS_SORTIES:
         stats = vehDossier.getFortSortiesStats()
     elif self._battlesType == PROFILE.PROFILE_DROPDOWN_LABELS_FORTIFICATIONS_BATTLES:
         stats = vehDossier.getFortBattlesStats()
     else:
         raise ValueError('Profile Technique: Unknown battle type: ' + self._battlesType)
     if achievementsList is not None:
         achievementsList.insert(0, specialMarksStats)
     preparedStatistics = DetailedStatisticsUtils.getStatistics(stats, self._userID is None)
     if self._battlesType == PROFILE.PROFILE_DROPDOWN_LABELS_FORTIFICATIONS_BATTLES:
         preparedStatistics[0]['data'][0]['tooltip'] = PROFILE.PROFILE_PARAMS_TOOLTIP_DIF_FORT_BATTLESCOUNT
     self.as_responseVehicleDossierS({'detailedData': preparedStatistics,
      'achievements': achievementsList})
     return
Esempio n. 13
0
 def __packAchievement(self, stats, vehDossier, record):
     return AchievementsUtils.packAchievement(stats.getAchievement(record),
                                              vehDossier.getDossierType(),
                                              dumpDossier(vehDossier),
                                              self._userID is None)
Esempio n. 14
0
def _makeAchievements(dossier, club):
    achievements = dossier.getTotalStats().getAchievements()
    mergedList = list(itertools.chain(*achievements))
    isForClubMember = club.hasMember(getAccountDatabaseID())
    return AchievementsUtils.packAchievementList(mergedList, dossier.getDossierType(), dumpDossier(dossier), isForClubMember, True)
Esempio n. 15
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'] = 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
Esempio n. 16
0
    def _sendAccountData(self, targetData, accountDossier):
        super(ProfileAwards, self)._sendAccountData(targetData, accountDossier)
        achievements = targetData.getAchievements()
        totalItemsList = []
        for block in achievements:
            totalItemsList.append(len(block))

        if self.__achievementsFilter == PROFILE.SECTION_AWARDS_DROPDOWN_LABELS_INPROCESS:
            achievements = targetData.getAchievements(isInDossier=True)
        elif self.__achievementsFilter == PROFILE.SECTION_AWARDS_DROPDOWN_LABELS_NONE:
            achievements = targetData.getAchievements(isInDossier=False)
        packedList = []
        for achievementBlockList in achievements:
            packedList.append(AchievementsUtils.packAchievementList(achievementBlockList, accountDossier.getDossierType(), dumpDossier(accountDossier), self._userID is None))

        self.as_responseDossierS(self._battlesType, {'achievementsList': packedList,
         'totalItemsList': totalItemsList,
         'battlesCount': targetData.getBattlesCount()}, '', '')
        return
Esempio n. 17
0
    def __getAchievementsList(self, targetData, vehDossier):
        packedList = []
        achievements = targetData.getAchievements(True)
        for achievementBlockList in achievements:
            packedList.append(AchievementsUtils.packAchievementList(achievementBlockList, vehDossier.getDossierType(), dumpDossier(vehDossier), self._userID is None, True, ACHIEVEMENTS_ALIASES.GREY_COUNTER))

        return packedList
Esempio n. 18
0
 def _receiveVehicleDossier(self, vehicleIntCD, databaseId):
     vehDossier = g_itemsCache.items.getVehicleDossier(vehicleIntCD, databaseId)
     achievementsList = None
     specialMarksStats = []
     if self._battlesType == PROFILE_DROPDOWN_KEYS.ALL:
         stats = vehDossier.getRandomStats()
         achievementsList = self.__getAchievementsList(stats, vehDossier)
         if g_itemsCache.items.getItemByCD(int(vehicleIntCD)).level > 4:
             specialMarksStats.append(AchievementsUtils.packAchievement(stats.getAchievement(MARK_ON_GUN_RECORD), vehDossier.getDossierType(), dumpDossier(vehDossier), self._userID is None))
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.TEAM:
         stats = vehDossier.getTeam7x7Stats()
         achievementsList = self.__getAchievementsList(stats, vehDossier)
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.STATICTEAM:
         stats = vehDossier.getRated7x7Stats()
         achievementsList = self.__getAchievementsList(stats, vehDossier)
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.HISTORICAL:
         stats = vehDossier.getHistoricalStats()
         achievementsList = self.__getAchievementsList(stats, vehDossier)
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FORTIFICATIONS_SORTIES:
         stats = vehDossier.getFortSortiesStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FORTIFICATIONS_BATTLES:
         stats = vehDossier.getFortBattlesStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.CLAN:
         stats = vehDossier.getGlobalMapStats()
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FALLOUT:
         stats = vehDossier.getFalloutStats()
     else:
         raise ValueError('Profile Technique: Unknown battle type: ' + self._battlesType)
     if achievementsList is not None:
         achievementsList.insert(0, specialMarksStats)
     if self._battlesType == PROFILE_DROPDOWN_KEYS.FORTIFICATIONS_BATTLES:
         layout = FORT_STATISTICS_LAYOUT
     elif self._battlesType == PROFILE_DROPDOWN_KEYS.FALLOUT:
         layout = FALLOUT_STATISTICS_LAYOUT
     else:
         layout = STATISTICS_LAYOUT
     preparedStatistics = DetailedStatisticsUtils.getStatistics(stats, self._userID is None, layout)
     self.as_responseVehicleDossierS({'detailedData': preparedStatistics,
      'achievements': achievementsList})
     return
Esempio n. 19
0
def _makeAchievements(dossier):
    return AchievementsUtils.packAchievementList(
        dossier.getTotalStats().getSignificantAchievements(),
        dossier.getDossierType(), dumpDossier(dossier), True, False)
Esempio n. 20
0
 def getVO(self, club=None, currentState=None, profile=None):
     if club is None or currentState is None or profile is None:
         return
     else:
         _ms = i18n.makeString
         ladderInfo = club.getLadderInfo()
         if ladderInfo.isInLadder():
             ladderLeagueStr = getLeagueString(ladderInfo.getLeague())
             ladderDivStr = getDivisionString(ladderInfo.getDivision())
             ladderInfoStr = text_styles.middleTitle(
                 _ms(CYBERSPORT.WINDOW_STATICRALLYINFO_LADDERINFO,
                     league=ladderLeagueStr,
                     division=ladderDivStr))
         else:
             ladderInfoStr = ''
         dossier = club.getTotalDossier()
         clubTotalStats = dossier.getTotalStats()
         isButtonDisabled = False
         buttonLabel = '#cyberSport:window/staticRallyInfo/joinBtnLabel'
         buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/join'
         buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/join'
         limits = currentState.getLimits()
         canSendApp, appReason = limits.canSendApplication(profile, club)
         if currentState.getStateID() == CLIENT_CLUB_STATE.SENT_APP:
             if currentState.getClubDbID() == club.getClubDbID():
                 buttonLabel = '#cyberSport:window/staticRallyInfo/cancelBtnLabel'
                 buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/inProcess'
                 buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/inProcess'
             else:
                 isButtonDisabled = True
                 buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/inProcessOther'
                 buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/inProcessOther'
         elif currentState.getStateID() == CLIENT_CLUB_STATE.HAS_CLUB:
             isButtonDisabled = True
             buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/alreadyJoined'
             buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/alreadyJoined'
         elif not canSendApp:
             isButtonDisabled = True
             buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/applicationCooldown'
             buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/applicationCooldown'
         return {
             'battlesCount':
             self.__getIndicatorData(
                 clubTotalStats.getBattlesCount(),
                 BigWorld.wg_getIntegralFormat,
                 _ms(CYBERSPORT.WINDOW_STATICRALLYINFO_STATSBATTLESCOUNT),
                 RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_BATTLES40X32,
                 TOOLTIPS.CYBERSPORT_STATICRALLYINFO_STATSBATTLESCOUNT),
             'winsPercent':
             self.__getIndicatorData(
                 clubTotalStats.getWinsEfficiency(),
                 ProfileUtils.formatFloatPercent,
                 _ms(CYBERSPORT.
                     WINDOW_STATICRALLYINFO_STATICRALLY_STATSWINSPERCENT),
                 RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_WINS40X32,
                 TOOLTIPS.CYBERSPORT_STATICRALLYINFO_STATSWINSPERCENT),
             'ladderIcon':
             getLadderChevron128x128(ladderInfo.getDivision()),
             'ladderInfo':
             ladderInfoStr,
             'joinInfo':
             text_styles.main(_ms(buttonInfo)),
             'joinBtnLabel':
             _ms(buttonLabel),
             'joinBtnTooltip':
             buttonTooltip,
             'joinBtnDisabled':
             isButtonDisabled,
             'noAwardsText':
             CYBERSPORT.WINDOW_STATICRALLYINFO_NOAWARDS,
             'achievements':
             AchievementsUtils.packAchievementList(
                 clubTotalStats.getTopAchievements(3),
                 dossier.getDossierType(), dumpDossier(dossier), False,
                 False),
             'rallyInfo': {
                 'icon':
                 None,
                 'name':
                 text_styles.highTitle(club.getUserName()),
                 'profileBtnLabel':
                 CYBERSPORT.RALLYINFO_PROFILEBTN_LABEL,
                 'profileBtnTooltip':
                 TOOLTIPS.RALLYINFO_PROFILEBTN,
                 'description':
                 text_styles.main(
                     html.escape(club.getUserShortDescription())),
                 'ladderIcon':
                 None,
                 'id':
                 club.getClubDbID(),
                 'showLadder':
                 False
             }
         }
Esempio n. 21
0
 def getVO(self, club = None, currentState = None, profile = None):
     if club is None or currentState is None or profile is None:
         return
     else:
         _ms = i18n.makeString
         ladderInfo = club.getLadderInfo()
         if ladderInfo.isInLadder():
             ladderLeagueStr = getLeagueString(ladderInfo.getLeague())
             ladderDivStr = getDivisionString(ladderInfo.getDivision())
             ladderInfoStr = text_styles.middleTitle(_ms(CYBERSPORT.WINDOW_STATICRALLYINFO_LADDERINFO, league=ladderLeagueStr, division=ladderDivStr))
         else:
             ladderInfoStr = ''
         dossier = club.getTotalDossier()
         clubTotalStats = dossier.getTotalStats()
         isButtonDisabled = False
         buttonLabel = '#cyberSport:window/staticRallyInfo/joinBtnLabel'
         buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/join'
         buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/join'
         limits = currentState.getLimits()
         canSendApp, appReason = limits.canSendApplication(profile, club)
         if currentState.getStateID() == CLIENT_CLUB_STATE.SENT_APP:
             if currentState.getClubDbID() == club.getClubDbID():
                 buttonLabel = '#cyberSport:window/staticRallyInfo/cancelBtnLabel'
                 buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/inProcess'
                 buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/inProcess'
             else:
                 isButtonDisabled = True
                 buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/inProcessOther'
                 buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/inProcessOther'
         elif currentState.getStateID() == CLIENT_CLUB_STATE.HAS_CLUB:
             isButtonDisabled = True
             buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/alreadyJoined'
             buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/alreadyJoined'
         elif not canSendApp:
             isButtonDisabled = True
             buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/applicationCooldown'
             buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/applicationCooldown'
         return {'battlesCount': self.__getIndicatorData(clubTotalStats.getBattlesCount(), BigWorld.wg_getIntegralFormat, _ms(CYBERSPORT.WINDOW_STATICRALLYINFO_STATSBATTLESCOUNT), RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_BATTLES40X32, TOOLTIPS.CYBERSPORT_STATICRALLYINFO_STATSBATTLESCOUNT),
          'winsPercent': self.__getIndicatorData(clubTotalStats.getWinsEfficiency(), ProfileUtils.formatFloatPercent, _ms(CYBERSPORT.WINDOW_STATICRALLYINFO_STATICRALLY_STATSWINSPERCENT), RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_WINS40X32, TOOLTIPS.CYBERSPORT_STATICRALLYINFO_STATSWINSPERCENT),
          'ladderIcon': getLadderChevron128x128(ladderInfo.getDivision()),
          'ladderInfo': ladderInfoStr,
          'joinInfo': text_styles.main(_ms(buttonInfo)),
          'joinBtnLabel': _ms(buttonLabel),
          'joinBtnTooltip': buttonTooltip,
          'joinBtnDisabled': isButtonDisabled,
          'noAwardsText': CYBERSPORT.WINDOW_STATICRALLYINFO_NOAWARDS,
          'achievements': AchievementsUtils.packAchievementList(clubTotalStats.getTopAchievements(3), dossier.getDossierType(), dumpDossier(dossier), False, False),
          'rallyInfo': {'icon': None,
                        'name': text_styles.highTitle(club.getUserName()),
                        'profileBtnLabel': CYBERSPORT.RALLYINFO_PROFILEBTN_LABEL,
                        'profileBtnTooltip': TOOLTIPS.RALLYINFO_PROFILEBTN,
                        'description': text_styles.main(html.escape(club.getUserShortDescription())),
                        'ladderIcon': None,
                        'id': club.getClubDbID(),
                        'showLadder': False}}
Esempio n. 22
0
 def __makeAchievements(self, dossier, club):
     achievements = dossier.getTotalStats().getAchievements()
     mergedList = list(itertools.chain(*achievements))
     isForClubMember = club.getMember(getPlayerDatabaseID()) is not None
     return AchievementsUtils.packAchievementList(mergedList, dossier.getDossierType(), dumpDossier(dossier), isForClubMember, True)
Esempio n. 23
0
 def packAchievement(achievement, dossier, isDossierForCurrentUser, defaultShowProgress = True, defaultSeriesCounter = None):
     atype = achievement.getType()
     total = achievement.getLevelUpTotalValue() or 0
     lvlUpValue = achievement.getLevelUpValue() or 0
     current = total - lvlUpValue
     progress = None
     section = achievement.getSection()
     if atype == ACHIEVEMENT_TYPE.REPEATABLE:
         if section == ACHIEVEMENT_SECTION.SPECIAL or section == ACHIEVEMENT_SECTION.BATTLE:
             if total > 0:
                 progress = (0, current, total)
     elif atype == ACHIEVEMENT_TYPE.SERIES:
         if section == ACHIEVEMENT_SECTION.SPECIAL:
             minRecordValue = -1
             if atype == ACHIEVEMENT_TYPE.SERIES and section == ACHIEVEMENT_SECTION.SPECIAL:
                 minRecordValue = RECORD_CONFIGS.get(achievement.getName())
             MIN_PROGRESS_PERCENT = 0.9
             divisionVal = 0
             if total != 0:
                 divisionVal = current / total
             if divisionVal >= MIN_PROGRESS_PERCENT or current != 0 and lvlUpValue < minRecordValue:
                 progress = (0, current, total)
     elif atype == ACHIEVEMENT_TYPE.CUSTOM:
         if section == ACHIEVEMENT_SECTION.SPECIAL:
             if current != total:
                 progress = (0, current, total)
         else:
             progress = (0, current, total)
     elif atype == ACHIEVEMENT_TYPE.CLASS:
         if current != total:
             progress = (0, current, total)
     elif atype == ACHIEVEMENT_TYPE.SINGLE:
         if current != total and not achievement.getValue():
             progress = (0, current, total)
     isRare = isRareAchievement(achievement)
     if isRare:
         rareIconID = achievement.requestImageID()
     else:
         rareIconID = None
     if not defaultShowProgress or not isDossierForCurrentUser:
         progress = None
     commonData = AchievementsUtils.getCommonAchievementData(achievement, dossier.getDossierType(), dumpDossier(dossier), 1 if achievement.isInDossier() else 0.2)
     commonData.update({'isRare': isRare,
      'rareIconId': rareIconID,
      'counterType': AchievementsUtils.getCounterType(achievement, defaultSeriesCounter),
      'progress': progress,
      'isDossierForCurrentUser': isDossierForCurrentUser})
     return commonData