Example #1
0
 def getAvailability(self):
     return DaysAvailabilityIterator(
         time_utils.getTimeTodayForLocal(*self.getLocalDefHour()),
         (self.getLocalOffDay(),),
         (self.getVacationPeriod(),),
         fortified_regions.g_cache.attackPreorderTime,
     ).next()
Example #2
0
    def getAvailability(self):
        from ClientFortifiedRegion import ATTACK_PLAN_RESULT
        maxPreorderLimit = FORTIFICATION_ALIASES.ACTIVE_EVENTS_FUTURE_LIMIT * time_utils.ONE_DAY
        initialTime = time_utils.getTimeTodayForLocal(*self.getLocalDefHour())
        availableTimestamp = initialTime
        while not self.__fort.canPlanAttackOn(availableTimestamp, self) == ATTACK_PLAN_RESULT.OK:
            if time_utils.getTimeDeltaFromNow(availableTimestamp) <= maxPreorderLimit:
                availableTimestamp += time_utils.ONE_DAY
            else:
                availableTimestamp = initialTime
                break

        currentDayStart, _ = time_utils.getDayTimeBoundsForLocal()
        availableDayStart, _ = time_utils.getDayTimeBoundsForLocal(availableTimestamp)
        return availableTimestamp
Example #3
0
    def getAvailability(self):
        from ClientFortifiedRegion import ATTACK_PLAN_RESULT
        maxPreorderLimit = FORTIFICATION_ALIASES.ACTIVE_EVENTS_FUTURE_LIMIT * time_utils.ONE_DAY
        initialTime = time_utils.getTimeTodayForLocal(*self.getLocalDefHour())
        availableTimestamp = initialTime
        while not self.__fort.canPlanAttackOn(availableTimestamp, self) == ATTACK_PLAN_RESULT.OK:
            if time_utils.getTimeDeltaFromNow(availableTimestamp) <= maxPreorderLimit:
                availableTimestamp += time_utils.ONE_DAY
            else:
                availableTimestamp = initialTime
                break

        currentDayStart, _ = time_utils.getDayTimeBoundsForLocal()
        availableDayStart, _ = time_utils.getDayTimeBoundsForLocal(availableTimestamp)
        return availableTimestamp
Example #4
0
 def __adjustTimeToGM(self):
     if self.__extStartDefHour != NOT_ACTIVATED:
         attackDay = time_utils.getTimeTodayForLocal(self.__extStartDefHour)
         from gui.shared.fortifications.fort_helpers import adjustDefenceHourToUTC
         defenceHourGMTFrom = adjustDefenceHourToUTC(self.__extStartDefHour)
         defenceHourGMTTo = defenceHourGMTFrom + 1
     else:
         attackDay = calendar.timegm(time.gmtime())
         defenceHourGMTFrom = 0
         defenceHourGMTTo = 24
     if self.__attackDay != NOT_ACTIVATED:
         attackDay += self.__attackDay * time_utils.ONE_DAY
     else:
         startsFrom = 3
         endsAt = 13
         randomDay = random.randint(startsFrom, endsAt)
         attackDay += randomDay * time_utils.ONE_DAY
     return (defenceHourGMTFrom, defenceHourGMTTo, attackDay)
Example #5
0
 def __adjustTimeToGM(self):
     if self.__extStartDefHour != NOT_ACTIVATED:
         attackDay = time_utils.getTimeTodayForLocal(self.__extStartDefHour)
         from gui.shared.fortifications.fort_helpers import adjustDefenceHourToUTC
         defenceHourGMTFrom = adjustDefenceHourToUTC(self.__extStartDefHour)
         defenceHourGMTTo = defenceHourGMTFrom + 1
     else:
         attackDay = calendar.timegm(time.gmtime())
         defenceHourGMTFrom = 0
         defenceHourGMTTo = 24
     if self.__attackDay != NOT_ACTIVATED:
         attackDay += self.__attackDay * time_utils.ONE_DAY
     else:
         startsFrom = 3
         endsAt = 13
         randomDay = random.randint(startsFrom, endsAt)
         attackDay += randomDay * time_utils.ONE_DAY
     return (defenceHourGMTFrom, defenceHourGMTTo, attackDay)
Example #6
0
 def getAvailability(self):
     return DaysAvailabilityIterator(time_utils.getTimeTodayForLocal(*self.getLocalDefHour()), (self.getLocalOffDay(),), (self.getVacationPeriod(),), fortified_regions.g_cache.attackPreorderTime).next()