コード例 #1
0
 def getRequestRestriction(self):
     if not self._isRequestsEnabled():
         return GifterResponseState.REQUESTS_DISABLED
     elif isLongDisconnectedFromCenter():
         return GifterResponseState.CENTER_DISCONNECTED
     elif not self.__webController.isAvailable():
         return GifterResponseState.WGCG_NOT_AVAILABLE
     else:
         return GifterResponseState.REQUEST_IN_PROGRESS if self.__requestCtx is not None else None
コード例 #2
0
 def runBootcamp(self):
     if self.isInBootcamp():
         if not self.needAwarding():
             self.stopBootcamp(inBattle=False)
         else:
             self.__doBootcamp(isSkip=True)
     elif isLongDisconnectedFromCenter():
         DialogsInterface.showI18nInfoDialog('bootcampCenterUnavailable',
                                             lambda result: None)
     else:
         self.__doBootcamp(isSkip=False)
コード例 #3
0
 def _populate(self):
     self._isDismissState = False
     super(RestoreTankmanDialog, self)._populate()
     restorePrice, _ = getTankmenRestoreInfo(self._tankman)
     isEnabled = True
     if g_itemsCache.items.stats.money.getShortage(restorePrice):
         isEnabled = False
     if isLongDisconnectedFromCenter():
         isEnabled = False
     self.as_setButtonEnablingS(DIALOG_BUTTON_ID.SUBMIT, isEnabled)
     if not isEnabled:
         self.as_setButtonFocusS(DIALOG_BUTTON_ID.CLOSE)
コード例 #4
0
 def _populate(self):
     self._isDismissState = False
     super(RestoreTankmanDialog, self)._populate()
     restorePrice, _ = getTankmenRestoreInfo(self._tankman)
     isEnabled = True
     if g_itemsCache.items.stats.money.getShortage(restorePrice):
         isEnabled = False
     if isLongDisconnectedFromCenter():
         isEnabled = False
     self.as_setButtonEnablingS(DIALOG_BUTTON_ID.SUBMIT, isEnabled)
     if not isEnabled:
         self.as_setButtonFocusS(DIALOG_BUTTON_ID.CLOSE)
コード例 #5
0
 def _buildVO(self):
     actionPriceVO = None
     restorePrice, lengthInHours = getTankmenRestoreInfo(self._tankman)
     warningTexts = []
     if not restorePrice:
         currencyTextFrame = ICON_TEXT_FRAMES.EMPTY
         restorePriceStr = text_styles.success(
             _ms(DIALOGS.RESTORETANKMAN_FORFREE))
         isEnoughMoney = True
     else:
         currencyName = restorePrice.getCurrency()
         currencyTextFrame = self._CURRENCY_TO_TEXT_FRAME[currencyName]
         restorePriceStr = str(
             currency.getBWFormatter(currencyName)(
                 restorePrice.getSignValue(currencyName)))
         isEnoughMoney = self.itemsCache.items.stats.money.get(
             currencyName, 0) >= restorePrice.get(currencyName, 0)
         if self._showPeriodEndWarning and restorePrice.isSet(
                 Currency.GOLD):
             daysCount = lengthInHours / time_utils.HOURS_IN_DAY
             warningTexts.append(
                 text_styles.alert(
                     _ms(DIALOGS.RESTORETANKMAN_NEWPERIODWARNING,
                         daysCount=daysCount)))
         if constants.IS_KOREA and restorePrice.isSet(Currency.GOLD):
             warningTexts.append(
                 text_styles.standard(DIALOGS.BUYVEHICLEDIALOG_WARNING))
     if isLongDisconnectedFromCenter():
         warningTexts.append(
             text_styles.error(
                 DIALOGS.RESTORETANKMAN_DISCONNECTEDFROMCENTER))
     return {
         'questionText':
         text_styles.stats(_ms(DIALOGS.RESTORETANKMAN_PRICE)),
         'restoreCurrency': currencyTextFrame,
         'restorePrice': restorePriceStr,
         'isEnoughMoneyForRestore': isEnoughMoney,
         'actionPriceVO': actionPriceVO,
         'warningText': '\n\n'.join(warningTexts)
     }
コード例 #6
0
 def _buildVO(self):
     actionPriceVO = None
     restorePrice, lengthInHours = getTankmenRestoreInfo(self._tankman)
     warningTexts = []
     if restorePrice.credits == 0:
         restoreCurrency = ICON_TEXT_FRAMES.EMPTY
         restorePriceStr = text_styles.success(
             _ms(DIALOGS.RESTORETANKMAN_FORFREE))
     else:
         restoreCurrency = ICON_TEXT_FRAMES.CREDITS
         restorePriceStr = str(
             currency.getBWFormatter(Currency.CREDITS)(
                 restorePrice.credits))
         if self._showPeriodEndWarning:
             daysCount = lengthInHours / time_utils.HOURS_IN_DAY
             warningTexts.append(
                 text_styles.alert(
                     _ms(DIALOGS.RESTORETANKMAN_NEWPERIODWARNING,
                         daysCount=daysCount)))
         if constants.IS_KOREA and restorePrice.gold > 0:
             warningTexts.append(
                 text_styles.standard(DIALOGS.BUYVEHICLEDIALOG_WARNING))
     if isLongDisconnectedFromCenter():
         warningTexts.append(
             text_styles.error(
                 DIALOGS.RESTORETANKMAN_DISCONNECTEDFROMCENTER))
     return {
         'questionText':
         text_styles.stats(_ms(DIALOGS.RESTORETANKMAN_PRICE)),
         'restoreCurrency':
         restoreCurrency,
         'restorePrice':
         restorePriceStr,
         'isEnoughMoneyForRestore':
         g_itemsCache.items.stats.money.credits >= restorePrice.credits,
         'actionPriceVO':
         actionPriceVO,
         'warningText':
         '\n\n'.join(warningTexts)
     }
コード例 #7
0
ファイル: processorsplugins.py プロジェクト: aevitas/wotsdk
 def _validate(self):
     if isLongDisconnectedFromCenter():
         return makeError('disconnected_from_center')
     return makeSuccess()
コード例 #8
0
 def mayConsume(cls, balance, price):
     if isLongDisconnectedFromCenter():
         return PurchaseCheckResult(False, _ExtEconomyCode.CENTER_UNAVAILABLE)
     return PurchaseCheckResult(False, _ExtEconomyCode.WALLET_NOT_AVAILABLE) if not cls.__wallet.isAvailable else cls.isEnoughMoney(balance, price)