def getTankmen(self, maxDuration):
        filteredBuffer = {}
        tankmenBuffer = self.recycleBin.get('tankmen', {}).get('buffer', {})
        for tankmanId, (strCD, dismissedAt) in tankmenBuffer.iteritems():
            if time_utils.getTimeDeltaTilNow(dismissedAt) < maxDuration:
                filteredBuffer[tankmanId] = (strCD, dismissedAt)

        return dict(((k * -1, v) for k, v in filteredBuffer.iteritems()))
    def getTankmen(self, maxDuration):
        filteredBuffer = {}
        tankmenBuffer = self.recycleBin.get('tankmen', {}).get('buffer', {})
        for tankmanId, (strCD, dismissedAt) in tankmenBuffer.iteritems():
            if time_utils.getTimeDeltaTilNow(dismissedAt) < maxDuration:
                filteredBuffer[tankmanId] = (strCD, dismissedAt)

        return dict(map(lambda (k, v): (k * -1, v), filteredBuffer.iteritems()))
 def __getTimeGone(self):
     """
     Get time gone in seconds from last operation
     (restore operation for notInShop vehicles or sell operation for regular premium vehicles)
     :return: <int>
     """
     if self.changedAt:
         return float(time_utils.getTimeDeltaTilNow(time_utils.makeLocalServerTime(self.changedAt)))
     return 0
Exemple #4
0
 def __checkLimitedRestoreNotification(self):
     criteria = REQ_CRITERIA.CUSTOM(lambda item: item.hasLimitedRestore())
     vehicles = g_itemsCache.items.getVehicles(criteria).values()
     lastRestoreNotification = AccountSettings.getSettings(LAST_RESTORE_NOTIFICATION)
     if lastRestoreNotification is None:
         showMessage = True
     else:
         showMessage = time_utils.getTimeDeltaTilNow(lastRestoreNotification) >= time_utils.ONE_DAY
     if len(vehicles) and showMessage and not self.__checkForNotify:
         AccountSettings.setSettings(LAST_RESTORE_NOTIFICATION, time.time())
         SystemMessages.g_instance.pushI18nMessage('#system_messages:restoreController/hasLimitedRestoreVehicles', type=SystemMessages.SM_TYPE.Warning)
     self.__checkForNotify = True
     return
Exemple #5
0
    def getBonus(self):
        if self.isConfirmedFirstBattle():
            delta = time_utils.getTimeDeltaTilNow(self.__firstBattleTime)
            try:
                maxXPPool = _getMaxReferralXPPool()
                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)
        return (1.0, 0)
Exemple #6
0
    def getBonus(self):
        if self.isConfirmedFirstBattle():
            delta = time_utils.getTimeDeltaTilNow(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)
Exemple #7
0
 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.getTimeDeltaTilNow(
             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
Exemple #8
0
 def getDaysInClan(self):
     return getTimeDeltaTilNow(self.getJoiningTime()) / ONE_DAY
Exemple #9
0
 def getDaysInClan(self):
     return getTimeDeltaTilNow(self.getJoiningTime()) / ONE_DAY
Exemple #10
0
 def getStartTimePast(self):
     return time_utils.getTimeDeltaTilNow(time_utils.makeLocalServerTime(self.getStartTime()))
 def getDaysAfterVacation(self):
     if not self.isVacationEnabled():
         return 0
     start, finish = self.getVacationDate()
     return int(time_utils.getTimeDeltaTilNow(finish) / time_utils.ONE_DAY)
Exemple #12
0
 def getDaysAfterVacation(self):
     if not self.isVacationEnabled():
         return 0
     start, finish = self.getVacationDate()
     return int(time_utils.getTimeDeltaTilNow(finish) / time_utils.ONE_DAY)
 def getStartTimePast(self):
     return time_utils.getTimeDeltaTilNow(time_utils.makeLocalServerTime(self.getStartTime()))
def getTankmenRestoreInfo(tankman):
    config = g_itemsCache.items.shop.tankmenRestoreConfig
    dismissalLength = time_utils.getTimeDeltaTilNow(tankman.dismissedAt)
    price = config.cost if dismissalLength >= config.freeDuration else Money()
    return (price, config.creditsDuration - dismissalLength)
 def __getTimeGone(self):
     return float(
         time_utils.getTimeDeltaTilNow(
             time_utils.makeLocalServerTime(
                 self.changedAt))) if self.changedAt else 0
Exemple #16
0
def getTankmenRestoreInfo(tankman, itemsCache=None):
    config = itemsCache.items.shop.tankmenRestoreConfig
    dismissalLength = time_utils.getTimeDeltaTilNow(tankman.dismissedAt)
    price = config.cost if dismissalLength >= config.freeDuration else MONEY_UNDEFINED
    return (price, config.billableDuration - dismissalLength)
def getTankmenRestoreInfo(tankman):
    config = g_itemsCache.items.shop.tankmenRestoreConfig
    dismissalLength = time_utils.getTimeDeltaTilNow(tankman.dismissedAt)
    price = config.cost if dismissalLength >= config.freeDuration else Money()
    return (price, config.creditsDuration - dismissalLength)