def getTankmen(self, maxDuration): filteredBuffer = {} tankmenBuffer = self.recycleBin.get('tankmen', {}).get('buffer', {}) for tankmanId, (strCD, dismissedAt) in tankmenBuffer.iteritems(): if time_utils.getTimeDeltaTillNow(dismissedAt) < maxDuration: filteredBuffer[tankmanId] = (strCD, dismissedAt) return filteredBuffer
def __checkLimitedRestoreNotification(self): criteria = IntCDProtectionRequestCriteria(_hasLimitedRestore, self.itemsCache.items.recycleBin.getVehiclesIntCDs()) vehicles = self.itemsCache.items.getVehicles(criteria).values() lastRestoreNotification = AccountSettings.getSettings(LAST_RESTORE_NOTIFICATION) if lastRestoreNotification is None: showMessage = True else: showMessage = time_utils.getTimeDeltaTillNow(lastRestoreNotification) >= time_utils.ONE_DAY if vehicles and showMessage and not self.__checkForNotify: AccountSettings.setSettings(LAST_RESTORE_NOTIFICATION, time.time()) SystemMessages.pushI18nMessage('#system_messages:restoreController/hasLimitedRestoreVehicles', type=SystemMessages.SM_TYPE.Warning) self.__checkForNotify = True return
def getBonus(self): if self.isConfirmedFirstBattle(): delta = time_utils.getTimeDeltaTillNow(self.__firstBattleTime) try: maxXPPool = _getMaxReferralXPPool() periodTime = 0 for period, bonus in _getRefSystemPeriods(): periodTime += period * time_utils.ONE_HOUR if delta < periodTime and self.__xpPool < maxXPPool: timeLeft = 0 if periodTime <= time_utils.ONE_YEAR: timeLeft = periodTime - delta return (bonus, timeLeft) except KeyError: LOG_ERROR('Cannot read refSystem from shop') elif self.isConfirmedInvite(): return (3.0, 0)
def __getTimeGone(self): return float( time_utils.getTimeDeltaTillNow( time_utils.makeLocalServerTime( self.changedAt))) if self.changedAt else 0
def getDaysInClan(self): return getTimeDeltaTillNow(self.getJoiningTime()) / ONE_DAY
def getTankmenRestoreInfo(tankman, itemsCache=None): config = itemsCache.items.shop.tankmenRestoreConfig dismissalLength = time_utils.getTimeDeltaTillNow(tankman.dismissedAt) price = config.cost if dismissalLength >= config.freeDuration else MONEY_UNDEFINED return (price, config.billableDuration - dismissalLength)
def getTimeFromStartTillNow(self): return time_utils.getTimeDeltaTillNow(self.getStartTime())