Esempio n. 1
0
 def _getActiveDateTimeString(self):
     timeLeft = self.event.getFinishTimeLeft()
     if timeLeft <= GUI_SETTINGS.actionComeToEnd:
         return formatters.formatYellow(QUESTS.DETAILS_HEADER_COMETOEND)
     if timeLeft <= time_utils.THREE_QUARTER_HOUR:
         return formatters.formatYellow(QUESTS.DETAILS_HEADER_COMETOENDINMINUTES, minutes=getMinutesRoundByTime(timeLeft))
     return super(_ActionInfo, self)._getActiveDateTimeString()
Esempio n. 2
0
 def _getActiveDateTimeString(self):
     timeLeft = self.event.getFinishTimeLeft()
     if timeLeft <= GUI_SETTINGS.actionComeToEnd:
         return formatters.formatYellow(QUESTS.DETAILS_HEADER_COMETOEND)
     if timeLeft <= time_utils.THREE_QUARTER_HOUR:
         return formatters.formatYellow(QUESTS.DETAILS_HEADER_COMETOENDINMINUTES, minutes=getMinutesRoundByTime(timeLeft))
     return super(_ActionInfo, self)._getActiveDateTimeString()
Esempio n. 3
0
 def _getConditions(self, svrEvents):
     subBlocks = []
     bonus = self.event.bonusCond
     battlesLeft, battlesCount, inrow = None, None, False
     battles = bonus.getConditions().find('battles')
     if battles is not None:
         battlesCount = battles._getTotalValue()
         if not self.event.isCompleted() and bonus.getGroupByValue() is None:
             progress = battles.getProgressPerGroup()
             if None in progress:
                 curProg, totalProg, _, _ = progress[None]
                 battlesLeft = totalProg - curProg
     bonusFmtConds = bonus.format(svrEvents, event=self.event)
     if len(bonusFmtConds):
         subBlocks.extend(formatters.indexing(bonusFmtConds))
     postBattleFmtConds = self.event.postBattleCond.format(svrEvents, event=self.event)
     if len(postBattleFmtConds):
         if len(bonusFmtConds):
             subBlocks.append(formatters.packSeparator(label=i18n.makeString('#quests:details/conditions/postBattle/separator')))
         subBlocks.extend(formatters.indexing(postBattleFmtConds))
     if bonus.isDaily():
         resetHourOffset = (time_utils.ONE_DAY - self._getDailyProgressResetTimeOffset()) / 3600
         if resetHourOffset >= 0:
             subBlocks.append(formatters.packTextBlock(label=formatters.formatYellow('#quests:details/conditions/postBattle/dailyReset') % {'time': time.strftime(i18n.makeString('#quests:details/conditions/postBattle/dailyReset/timeFmt'), time_utils.getTimeStructInLocal(time_utils.getTimeTodayForUTC(hour=resetHourOffset)))}))
     result = []
     if len(subBlocks) or battlesCount:
         if not self.event.isGuiDisabled():
             result.append(formatters.packConditionsBlock(battlesCount, battlesLeft, bonus.isInRow(), conditions=subBlocks))
         else:
             result.append(formatters.packConditionsBlock(conditions=subBlocks))
     if bonus.getGroupByValue() is not None and not self.event.isGuiDisabled():
         progressesFmt = bonus.formatGroupByProgresses(svrEvents, self.event)
         if len(progressesFmt):
             result.append(formatters.packTopLevelContainer(i18n.makeString('#quests:details/conditions/groupBy/%s' % bonus.getGroupByValue()), subBlocks=progressesFmt, isResizable=len(progressesFmt) > 5))
     return formatters.todict(result)
Esempio n. 4
0
 def _getActiveDateTimeString(self):
     timeLeft = self.event.getFinishTimeLeft()
     return formatters.formatYellow(
         QUESTS.DETAILS_HEADER_COMETOENDINMINUTES,
         minutes=getMinutesRoundByTime(timeLeft)
     ) if timeLeft <= time_utils.THREE_QUARTER_HOUR else super(
         QuestInfoModel, self)._getActiveDateTimeString()
Esempio n. 5
0
 def _packConditions(self, svrEvents):
     subBlocks = []
     bonus = self.event.bonusCond
     battlesLeft, battlesCount, inrow = None, None, False
     battles = bonus.getConditions().find('battles')
     if battles is not None:
         battlesCount = battles._getTotalValue()
         if not self.event.isCompleted() and bonus.getGroupByValue() is None:
             progress = battles.getProgressPerGroup()
             if None in progress:
                 curProg, totalProg, _, _ = progress[None]
                 battlesLeft = totalProg - curProg
     bonusFmtConds = bonus.format(svrEvents, event=self.event)
     if len(bonusFmtConds):
         subBlocks.extend(formatters.indexing(bonusFmtConds))
     postBattleFmtConds = self.event.postBattleCond.format(svrEvents, event=self.event)
     if len(postBattleFmtConds):
         if len(bonusFmtConds):
             subBlocks.append(formatters.packSeparator(label=i18n.makeString('#quests:details/conditions/postBattle/separator')))
         subBlocks.extend(formatters.indexing(postBattleFmtConds))
     if bonus.isDaily():
         resetHourOffset = (time_utils.ONE_DAY - self._getDailyProgressResetTimeOffset()) / 3600
         if resetHourOffset >= 0:
             subBlocks.append(formatters.packTextBlock(label=formatters.formatYellow('#quests:details/conditions/postBattle/dailyReset') % {'time': time.strftime(i18n.makeString('#quests:details/conditions/postBattle/dailyReset/timeFmt'), time_utils.getTimeStructInLocal(time_utils.getTimeTodayForUTC(hour=resetHourOffset)))}))
     result = []
     if len(subBlocks) or battlesCount:
         if not self.event.isGuiDisabled():
             result.append(formatters.packConditionsBlock(battlesCount, battlesLeft, bonus.isInRow(), conditions=subBlocks))
         else:
             result.append(formatters.packConditionsBlock(conditions=subBlocks))
     if bonus.getGroupByValue() is not None and not self.event.isGuiDisabled():
         progressesFmt = bonus.formatGroupByProgresses(svrEvents, self.event)
         if len(progressesFmt):
             result.append(formatters.packTopLevelContainer(i18n.makeString('#quests:details/conditions/groupBy/%s' % bonus.getGroupByValue()), subBlocks=progressesFmt, isResizable=len(progressesFmt) > 5))
     return result
Esempio n. 6
0
 def _getActiveDateTimeString(self):
     if self.event.getFinishTimeLeft() <= time_utils.QUARTER_HOUR:
         return formatters.formatYellow(QUESTS.DETAILS_HEADER_COMETOEND)
     return super(_ActionInfo, self)._getActiveDateTimeString()