def getCurrentCycleID(self):
     isCurrent, seasonInfo = ranked_common.getRankedSeason(self.__getSettings().asDict())
     if isCurrent:
         _, _, _, cycleID = seasonInfo
         return cycleID
     else:
         return None
예제 #2
0
    def getLeagueAwards(self):
        isCurrent, seasonInfo = ranked_common.getRankedSeason(
            self.__getSettings().asDict())
        result = []
        percentTotal = 0
        if isCurrent:
            _, _, seasonID, _ = seasonInfo
            seasonQuests = self.eventsCache.getHiddenQuests(
                lambda q: q.getType() == EVENT_TYPE.TOKEN_QUEST and
                ranked_helpers.isRankedQuestID(q.getID()))
            for qID in sorted(seasonQuests):
                season, cohort, percent = ranked_helpers.getRankedDataFromTokenQuestID(
                    qID)
                percentTotal += percent
                if season == seasonID:
                    quest = seasonQuests[qID]
                    awards = []
                    for bonus in quest.getBonuses():
                        awards.extend(bonus.getRankedAwardVOs(iconSize='big'))

                    result.append({
                        'cohortNumber': cohort,
                        'playersPercent': percent,
                        'awards': awards
                    })

        result.append({
            'cohortNumber': 0,
            'playersPercent': 100 - percentTotal,
            'awards': []
        })
        return result
 def getCurrentSeason(self):
     settings = self.__getSettings()
     isCurrent, seasonInfo = ranked_common.getRankedSeason(settings.asDict())
     if isCurrent:
         _, _, seasonID, _ = seasonInfo
         currPoints = self.getLadderPoints()
         return RankedSeason(seasonInfo, settings.seasons.get(seasonID, {}), self.__getRankedDossier(), currPoints)
     else:
         return None
    def __getSettings(cycleID=None):
        lobbyContext = dependency.instance(ILobbyContext)
        generalSettings = lobbyContext.getServerSettings().rankedBattles
        if cycleID is None:
            _, cycleInfo = ranked_common.getRankedSeason(generalSettings.asDict())
            if cycleInfo:
                _, _, _, cycleID = cycleInfo
        for season in generalSettings.seasons.values():
            if cycleID in season.get('cycles', {}):
                return generalSettings.replace(season).replace(season['cycles'][cycleID])

        return generalSettings
예제 #5
0
 def getSeason(self):
     rankedConfig = self.__account.serverSettings['ranked_config']
     return ranked_common.getRankedSeason(rankedConfig)