Exemplo n.º 1
0
def getRankedMainSeasonOnHeader(season, itemID):
    title = backport.text(R.strings.ranked_battles.rankedBattle.title())
    leftSideText = ''
    rightSideText = ''
    tooltip = TOOLTIPS_CONSTANTS.RANKED_CALENDAR_DAY_INFO
    if itemID in _EMPTY_WEB_PAGES:
        title = ''
        tooltip = ''
    elif itemID == RANKEDBATTLES_CONSTS.RANKED_BATTLES_INFO_ID:
        leftSideText = backport.text(
            R.strings.ranked_battles.rankedBattleMainView.infoPage.header())
        tooltip = ''
    elif season is not None:
        startDate = season.getStartDate()
        endDate = season.getEndDate()
        timeDelta = time_utils.getTimeDeltaFromNowInLocal(
            time_utils.makeLocalServerTime(endDate))
        if timeDelta > time_utils.ONE_WEEK:
            leftSideText = backport.text(
                R.strings.ranked_battles.rankedBattleMainView.date.period(),
                start=backport.getLongDateFormat(startDate),
                finish=backport.getLongDateFormat(endDate))
        else:
            leftSideText = backport.getTillTimeStringByRClass(
                timeDelta, R.strings.ranked_battles.rankedBattleMainView.date)
        rightSideText = backport.text(
            R.strings.ranked_battles.rankedBattleMainView.season(),
            season=season.getUserName())
    return {
        'title': title,
        'leftSideText': leftSideText,
        'rightSideText': rightSideText,
        'tooltip': tooltip
    }
Exemplo n.º 2
0
 def __getRankedOverrides(self, quest):
     header = body = ''
     isLeagues = self.__rankedController.isAccountMastered()
     isAnyPrimeNow = self.__rankedController.hasAvailablePrimeTimeServers()
     isAnyPrimeLeftTotal = self.__rankedController.hasPrimeTimesTotalLeft()
     isAnyPrimeLeftNext = self.__rankedController.hasPrimeTimesNextDayLeft()
     if not isAnyPrimeLeftTotal or not isAnyPrimeLeftNext and quest.isCompleted() and quest.bonusCond.isDaily():
         header = backport.text(R.strings.ranked_battles.quests.tooltip.unavailable.header.seasonEnd())
         body = backport.text(R.strings.ranked_battles.quests.tooltip.unavailable.body.seasonEnd.default())
         season = self.__rankedController.getCurrentSeason()
         if season is not None:
             seasonEnd = time_utils.getTimeDeltaFromNowInLocal(time_utils.makeLocalServerTime(season.getEndDate()))
             timeRes = R.strings.ranked_battles.quests.tooltip.unavailable.body.seasonEnd
             body = backport.getTillTimeStringByRClass(seasonEnd, timeRes)
     elif not isLeagues:
         header = backport.text(R.strings.ranked_battles.quests.tooltip.unavailable.header.notInLeagues())
         body = backport.text(R.strings.ranked_battles.quests.tooltip.unavailable.body.notInLeagues())
     elif not isAnyPrimeNow:
         header = backport.text(R.strings.ranked_battles.quests.tooltip.unavailable.header.allServersPrime())
         body = backport.text(R.strings.ranked_battles.quests.tooltip.unavailable.body.allServersPrime())
     if body and header:
         body = text_styles.main(body)
         bullet = backport.text(R.strings.tooltips.quests.unavailable.bullet())
         return [formatters.packTextBlockData(text=text_styles.highTitle(header)), formatters.packBuildUpBlockData(self.__getList([{'text': body,
            'bullet': bullet}]), linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE), self.__getBootom(backport.text(R.strings.ranked_battles.quests.tooltip.unavailable.bottom()))]
     else:
         return []
Exemplo n.º 3
0
def getPostponedOperationState(operationID):
    _eventsCache = dependency.instance(IEventsCache)
    disabledOperations = _eventsCache.getPersonalMissions().getDisabledPMOperations()
    state = None
    postponeTime = ''
    if operationID in disabledOperations:
        timestamp = disabledOperations[operationID]
        state = PERSONAL_MISSIONS_ALIASES.OPERATION_DISABLED_STATE
        if timestamp:
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_POSTPONED_STATE
            timeLeft = time_utils.getTimeDeltaFromNowInLocal(timestamp)
            if timeLeft <= time_utils.ONE_DAY:
                postponeTime = PERSONAL_MISSIONS.OPERATIONINFO_OPERATIONBTN_POSTPONED_LESSTHANDAY
            else:
                days = int(timeLeft / time_utils.ONE_DAY)
                postponeTime = i18n.makeString(PERSONAL_MISSIONS.OPERATIONINFO_OPERATIONBTN_POSTPONED_DAYS, days=days)
    return PostponedOperationState(state, postponeTime)
Exemplo n.º 4
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)
 def __timeTillCurrentSeasonEnd(self):
     if self.__currentSeason:
         seasonEnd = time_utils.makeLocalServerTime(
             self.__currentSeason.getEndDate())
         return time_utils.getTimeDeltaFromNowInLocal(seasonEnd)
     return time_utils.ONE_MINUTE
Exemplo n.º 6
0
 def getDestroyingTimeLeft(self):
     return time_utils.getTimeDeltaFromNowInLocal(self.getDestroyingTime())
Exemplo n.º 7
0
 def getCreationTimeLeft(self):
     return time_utils.getTimeDeltaFromNowInLocal(self.getCreationTime())
Exemplo n.º 8
0
 def getFinishTimeLeft(self):
     return time_utils.getTimeDeltaFromNowInLocal(self.getFinishTime())
 def getFinishTimeLeft(self):
     return time_utils.getTimeDeltaFromNowInLocal(self.getFinishTime())
Exemplo n.º 10
0
 def __getTimeTillCurrentSeasonEnd(self):
     return time_utils.getTimeDeltaFromNowInLocal(time_utils.makeLocalServerTime(self.__currentSeason.getEndDate())) if self.__currentSeason else time_utils.ONE_MINUTE
Exemplo n.º 11
0
 def getCreationTimeLeft(self):
     return time_utils.getTimeDeltaFromNowInLocal(self.getCreationTime())
Exemplo n.º 12
0
 def getDestroyingTimeLeft(self):
     return time_utils.getTimeDeltaFromNowInLocal(self.getDestroyingTime())