def __formatDescription(self, quests):
     season = self._eventProgression.getCurrentSeason(
     ) or self._eventProgression.getNextSeason()
     currentTime = time_utils.getCurrentLocalServerTimestamp()
     cycle = season.getCycleInfo()
     if not self._eventProgression.modeIsAvailable() or cycle is None:
         return ''
     elif self._eventProgression.isNeedAchieveMaxLevelForDailyQuest():
         maxLevel = self._eventProgression.getMaxPlayerLevel()
         description = backport.text(_R_EPIC_BATTLE.unavailable(),
                                     reason=backport.text(
                                         _R_EPIC_BATTLE.restrict.level(),
                                         level=maxLevel))
         return text_styles.concatStylesWithSpace(
             icons.markerBlocked(), text_styles.error(description))
     elif cycle.endDate - currentTime < time_utils.ONE_DAY:
         icon = icons.inProgress(vspace=-3)
         messageID = _R_EPIC_BATTLE.timeLeft
         valueStyle = text_styles.stats
         timeStr = valueStyle(
             backport.text(R.strings.epic_battle.questsTooltip.epicBattle.
                           lessThanDay()))
         textStyle = text_styles.main
         description = textStyle(
             backport.text(messageID(),
                           cycle=int2roman(cycle.ordinalNumber),
                           time=timeStr))
         return text_styles.concatStylesWithSpace(icon, description)
     elif all(
         (q.isCompleted() for q in quests
          )) and self._eventProgression.isDailyQuestsRefreshAvailable():
         data = time_utils.ONE_DAY - time_utils.getServerRegionalTimeCurrentDay(
         )
         valueStyle = text_styles.tutorial
         timeToStr = valueStyle(
             getTimeStr(data, R.strings.menu.Time.timeLeftShort))
         icon = icons.clockGold()
         textStyle = text_styles.tutorial
         description = textStyle(
             backport.text(_R_EPIC_BATTLE.startIn(), time=timeToStr))
         return text_styles.concatStylesWithSpace(icon, description)
     else:
         getDate = lambda c: c.endDate
         messageID = _R_EPIC_BATTLE.timeLeft
         icon = icons.inProgress(vspace=-3)
         textStyle = text_styles.main
         valueStyle = text_styles.stats
         timeToStr = valueStyle(
             getTimeStr(
                 getDate(cycle) - currentTime,
                 R.strings.menu.Time.timeLeftShort))
         description = textStyle(
             backport.text(messageID(),
                           cycle=int2roman(cycle.ordinalNumber),
                           time=timeToStr))
         return text_styles.concatStylesWithSpace(icon, description)
def getQuestsDescriptionForHangarFlag(battleRoyaleController=None):
    quests = battleRoyaleController.getQuests()
    season = battleRoyaleController.getCurrentSeason(
    ) or battleRoyaleController.getNextSeason()
    currentTime = time_utils.getCurrentLocalServerTimestamp()
    cycle = season.getCycleInfo()
    if not battleRoyaleController.isActive() or cycle is None:
        return ''
    elif cycle.endDate - currentTime < time_utils.ONE_DAY:
        icon = icons.inProgress(vspace=-3)
        messageID = _R_BATTLE_ROYALE.timeLeft
        valueStyle = text_styles.stats
        timeStr = valueStyle(
            backport.text(R.strings.battle_royale.questsTooltip.lessThanDay()))
        textStyle = text_styles.main
        description = textStyle(
            backport.text(messageID(),
                          cycle=int2roman(cycle.ordinalNumber),
                          time=timeStr))
        return text_styles.concatStylesWithSpace(icon, description)
    elif all((q.isCompleted() for _, q in quests.items())):
        data = time_utils.ONE_DAY - time_utils.getServerRegionalTimeCurrentDay(
        )
        valueStyle = text_styles.tutorial
        timeToStr = valueStyle(
            getTimeStr(data, R.strings.menu.Time.timeLeftShort))
        icon = icons.clockGold()
        textStyle = text_styles.tutorial
        description = textStyle(
            backport.text(_R_BATTLE_ROYALE.startIn(), time=timeToStr))
        return text_styles.concatStylesWithSpace(icon, description)
    else:
        getDate = lambda c: c.endDate
        messageID = _R_BATTLE_ROYALE.timeLeft
        icon = icons.inProgress(vspace=-3)
        textStyle = text_styles.main
        valueStyle = text_styles.stats
        timeToStr = valueStyle(
            getTimeStr(
                getDate(cycle) - currentTime,
                R.strings.menu.Time.timeLeftShort))
        description = textStyle(
            backport.text(messageID(),
                          cycle=int2roman(cycle.ordinalNumber),
                          time=timeToStr))
        return text_styles.concatStylesWithSpace(icon, description)
Example #3
0
 def __packDescription(self, quests, season, isLeagues, isAnyPrimeNow,
                       isAnyPrimeLeftTotal):
     resShortCut = R.strings.ranked_battles.questsTooltip
     isAllCompleted = all((q.isCompleted() for q in quests))
     isAnyPrimeLeftNextDay = self.__rankedController.hasPrimeTimesNextDayLeft(
     )
     icon = icons.markerBlocked()
     timeDelta = time_utils.getTimeDeltaFromNowInLocal(
         time_utils.makeLocalServerTime(season.getEndDate()))
     timeDeltaStr = text_styles.stats(
         backport.getTillTimeStringByRClass(timeDelta,
                                            resShortCut.available))
     text = text_styles.main(
         backport.text(resShortCut.available(), timeDelta=timeDeltaStr))
     if not isAnyPrimeLeftTotal:
         text = text_styles.error(
             backport.getTillTimeStringByRClass(
                 timeDelta, resShortCut.unavailable.seasonEnd))
     elif not isLeagues:
         text = text_styles.error(
             backport.text(resShortCut.unavailable.notInLeagues()))
     elif not isAllCompleted:
         if isAnyPrimeNow:
             icon = icons.inProgress(vspace=-3)
         else:
             text = text_styles.error(
                 backport.text(resShortCut.unavailable.allServersPrime()))
     elif not isAnyPrimeLeftNextDay:
         icon = icons.inProgress(vspace=-3)
     else:
         icon = icons.clockGold()
         timeDelta = EventInfoModel.getDailyProgressResetTimeDelta()
         text = text_styles.tutorial(
             backport.getTillTimeStringByRClass(timeDelta,
                                                resShortCut.cooldown))
     return text_styles.concatStylesWithSpace(icon, text)