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)