def __setup(self, defHour): defHourUTC = adjustDefenceHourToUTC(defHour) result = yield self.fortProvider.sendRequest(DefenceHourCtx(defHourUTC, waitingID='fort/settings')) if result: start = time_utils.getTimeTodayForUTC(defHourUTC) finish = time_utils.getTimeTodayForUTC(defHourUTC + 1) defenceHourStr = '%s - %s' % (BigWorld.wg_getShortTimeFormat(start), BigWorld.wg_getShortTimeFormat(finish)) SystemMessages.g_instance.pushI18nMessage(SYSTEM_MESSAGES.FORTIFICATION_DEFENCEHOURSET, defenceHour=defenceHourStr, type=SystemMessages.SM_TYPE.Warning)
def __setup(self, defHour, offDay, peripheryID): defHourUTC = adjustDefenceHourToUTC(defHour) offDayUTC = offDay if offDay != NOT_ACTIVATED: offDayUTC = adjustOffDayToUTC(offDay, defHour) result = yield self.fortProvider.sendRequest(SettingsCtx(defHourUTC, offDayUTC, peripheryID, waitingID='fort/settings')) if result: g_fortSoundController.playDefencePeriodActivated() self.destroy()
def __setup(self, defHour, offDay, peripheryID): defHourUTC = adjustDefenceHourToUTC(defHour) offDayUTC = offDay if offDay != NOT_ACTIVATED: offDayUTC = adjustOffDayToUTC(offDay, defHour) result = yield self.fortProvider.sendRequest( SettingsCtx(defHourUTC, offDayUTC, peripheryID, waitingID='fort/settings')) if result: g_fortSoundController.playDefencePeriodActivated() self.destroy()
def __setup(self, defHour): defHourUTC = adjustDefenceHourToUTC(defHour) result = yield self.fortProvider.sendRequest( DefenceHourCtx(defHourUTC, waitingID='fort/settings')) if result: start = time_utils.getTimeTodayForUTC(defHourUTC) finish = time_utils.getTimeTodayForUTC(defHourUTC + 1) defenceHourStr = '%s - %s' % (BigWorld.wg_getShortTimeFormat( start), BigWorld.wg_getShortTimeFormat(finish)) SystemMessages.g_instance.pushI18nMessage( SYSTEM_MESSAGES.FORTIFICATION_DEFENCEHOURSET, defenceHour=defenceHourStr, type=SystemMessages.SM_TYPE.Warning)
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)