def __getDiscountBannerStr(self, root, rootNode): htmlStr = '' nodeState = rootNode.getState() if NODE_STATE.canTradeIn( nodeState ) and self.__tradeIn.tradeOffSelectedApplicableForLevel(root.level): return htmlStr if NODE_STATE.isRestoreAvailable(nodeState): restoreDueDate = getDueDateOrTimeStr( rootNode.getRestoreFinishTime()) if restoreDueDate: return _BANNER_GETTERS[States.RESTORE](restoreDueDate) if not root.isUnlocked and not root.isCollectible: unlockDiscount = self._itemsCache.items.blueprints.getBlueprintDiscount( root.intCD, root.level) if unlockDiscount > 0: return _BANNER_GETTERS[States.UNLOCKED](unlockDiscount) if root.isRented: discount = rootNode.getActionDiscount() if discount != 0: return _BANNER_GETTERS[States.RENT](discount) if not NODE_STATE.inInventory(nodeState) and NODE_STATE.isActionVehicle( nodeState) or NODE_STATE.isCollectibleActionVehicle(nodeState): discount, isPersonalDiscount = rootNode.getActionDetails() if discount != 0: actionDueDate = '' if isPersonalDiscount else getDueDateOrTimeStr( rootNode.getActionFinishTime(), isShortDateFormat=True) return _BANNER_GETTERS[States.ACTION](discount, actionDueDate) return htmlStr
def __getMainButtonLabel(self, rootItem, rootNode): if NODE_STATE.isCollectible(rootNode.getState()): btnLabel = R.strings.menu.research.labels.button.toCollection() elif not rootItem.isUnlocked: btnLabel = R.strings.menu.unlocks.unlockButton() elif NODE_STATE.isRestoreAvailable(rootNode.getState()): btnLabel = R.strings.menu.research.labels.button.restore() elif NODE_STATE.inInventory(rootNode.getState( )) and not rootItem.isRented or rootItem.isHidden: btnLabel = R.strings.menu.research.labels.button.showInHangar() elif NODE_STATE.canTradeIn(rootNode.getState( )) and self.__tradeIn.getActiveTradeOffVehicle() is not None: btnLabel = R.strings.menu.research.labels.button.trade_in() else: btnLabel = R.strings.menu.research.labels.button.buy() return backport.text(btnLabel)
def __getIsInteractive(self, root, rootNode): return self.__tradeIn.getActiveTradeOffVehicle( ) is None or self.__tradeIn.tradeOffSelectedApplicableForLevel( root.level) if NODE_STATE.canTradeIn(rootNode.getState()) else True
def __getIsInteractive(self, root, rootNode): return self.__tradeIn.getSelectedVehicleToSell( ) is None or self.__tradeIn.validatePossibleVehicleToBuy( root) if NODE_STATE.canTradeIn(rootNode.getState()) else True