def __showCongratulations(self): if self.viewStatus != ViewStatus.LOADED: _logger.warning( 'Can not show congratulations! The view is not loaded anymore.' ) return else: self.viewModel.setIsContentHidden(True) with self.viewModel.congradulationAnim.transaction() as model: vehicleType = '{}_elite'.format( self.__vehicle.type ) if self.__vehicle.isElite else self.__vehicle.type image = self.__vehicle.getShopIcon( size=STORE_CONSTANTS.ICON_SIZE_LARGE) defaultImage = RES_SHOP.getVehicleIcon( STORE_CONSTANTS.ICON_SIZE_LARGE, 'empty_tank') model.setIsElite(self.__vehicle.isElite) model.setVehicleType(vehicleType) model.setLvl(int2roman(self.__vehicle.level)) model.setVName(self.__vehicle.userName) model.setImage(image if image is not None else defaultImage) model.setImageAlt(defaultImage) model.setTitle(R.strings.store.congradulationAnim.titleLabel) model.setBtnLbl( R.strings.store.congradulationAnim.showPreviewBtn) return
def getStorageVehicleVo(vehicle): name = getVehicleName(vehicle) description = _getVehicleDescription(vehicle) imageSmall = func_utils.makeFlashPath( vehicle.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL)) stateIcon, stateText = _getVehicleInfo(vehicle) if not imageSmall and not stateText: stateText = text_styles.vehicleStatusInfoText( _ms(STORAGE.INHANGAR_NOIMAGE)) vo = createStorageDefVO( vehicle.intCD, name, description, vehicle.inventoryCount, getItemPricesVO(vehicle.getSellPrice())[0], imageSmall, RES_SHOP.getVehicleIcon(STORE_CONSTANTS.ICON_SIZE_SMALL, 'empty_tank'), itemType=vehicle.getHighlightType(), nationFlagIcon=RES_SHOP.getNationFlagIcon( nations.NAMES[vehicle.nationID]), contextMenuId=CONTEXT_MENU_HANDLER_TYPE.STORAGE_VEHICLES_REGULAR_ITEM) vo.update({'infoImgSrc': stateIcon, 'infoText': stateText}) if vehicle.canTradeOff: vo.update( {'tradeOffPrice': { 'price': getMoneyVO(vehicle.tradeOffPrice) }}) return vo
def _buildVehicle(self, item): name = _getVehicleName(vehicle=item) description = _getVehicleDescription(vehicle=item) stateIcon, stateText = _getVehicleInfo(vehicle=item) vo = createStorageDefVO( item.intCD, name, description, item.inventoryCount, getItemPricesVO(item.getSellPrice())[0], item.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL), item.getShopIcon(), RES_SHOP.getVehicleIcon(STORE_CONSTANTS.ICON_SIZE_SMALL, 'empty_tank'), itemType=getBoosterType(item), nationFlagIcon=RES_SHOP.getNationFlagIcon( nations.NAMES[item.nationID]), infoImgSrc=stateIcon, infoText=stateText) return vo
def __showCongratulationsView(self): if self.viewStatus != ViewStatus.LOADED: _logger.warning( 'Can not show congratulations! The view is not loaded anymore.' ) return else: self.viewModel.setIsContentHidden(True) with self.viewModel.congratulationAnim.transaction() as vm: vehicleType = '{}_elite'.format( self.__vehicle.type ) if self.__vehicle.isElite else self.__vehicle.type image = func_utils.makeFlashPath( self.__vehicle.getShopIcon( size=STORE_CONSTANTS.ICON_SIZE_LARGE)) defaultImage = RES_SHOP.getVehicleIcon( STORE_CONSTANTS.ICON_SIZE_LARGE, 'empty_tank') settings = self.__congratsViewSettings if settings and 'bgSource' in settings: self.viewModel.setBgSource(settings['bgSource']) if settings and 'backBtnEnabled' in settings: vm.setNeedBackBtn(settings['backBtnEnabled']) if settings and 'backBtnLabel' in settings: vm.setBackBtnLbl(settings['backBtnLabel']) vm.setIsElite(self.__vehicle.isElite) vm.setIsCollectible(self.__vehicle.isCollectible) vm.setVehicleType(vehicleType) vm.setLvl(int2roman(self.__vehicle.level)) vm.setVName(self.__vehicle.userName) vm.setImage(image if image is not None else defaultImage) vm.setImageAlt(defaultImage) vm.setTitle(R.strings.store.congratulationAnim.restoreLabel( ) if self.viewModel.getIsRestore() else R.strings.store. congratulationAnim.buyingLabel()) vm.setBtnLbl( R.strings.store.congratulationAnim.showPreviewBtnLabel()) return
def imageAlt(self): return RES_SHOP.getVehicleIcon(STORE_CONSTANTS.ICON_SIZE_LARGE, 'empty_tank')
def _buildVehicle(self, item): bpRequester = self._itemsCache.items.blueprints name = getVehicleName(vehicle=item) intelligenceIcon = RES_ICONS.getBlueprintFragment( 'special', 'intelligence') current, total = bpRequester.getBlueprintCount(item.intCD, item.level) _, intelligenceCost = bpRequester.getRequiredIntelligenceAndNational( item.level) nationalsCost = bpRequester.getNationalRequiredOptions( item.intCD, item.level) availableCount = bpRequester.getConvertibleFragmentCount( item.intCD, item.level) if availableCount > 0: description = makeString( STORAGE.BLUEPRINTS_CARD_CONVERTAVAILABLE, count=text_styles.stats( backport.getIntegralFormat(availableCount))) else: description = text_styles.error( STORAGE.BLUEPRINTS_CARD_CONVERTREQUIRED) availableToUnlock, _ = g_techTreeDP.isNext2Unlock( item.intCD, unlocked=self._itemsCache.items.stats.unlocks, xps=self._itemsCache.items.stats.vehiclesXPs, freeXP=self._itemsCache.items.stats.actualFreeXP, level=item.level) intelligenceCostText, fragmentsCost = self.__formatFragmentsCost( intelligenceCost=intelligenceCost, intelligenceIcon=intelligenceIcon, nationalsCost=nationalsCost) discount = bpRequester.getBlueprintDiscount(item.intCD, item.level) fragmentsProgress = self.__formatFragmentProgress( current, total, discount) image = func_utils.makeFlashPath( item.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL)) return { 'id': item.intCD, 'title': name, 'description': description, 'image': image, 'imageAlt': RES_SHOP.getVehicleIcon(STORE_CONSTANTS.ICON_SIZE_SMALL, 'empty_tank'), 'fragmentsCost': fragmentsCost, 'intelligenceCostText': intelligenceCostText, 'fragmentsProgress': fragmentsProgress, 'hasDiscount': discount > 0, 'availableToUnlock': availableToUnlock, 'convertAvailable': availableCount > 0, 'contextMenuId': CONTEXT_MENU_HANDLER_TYPE.STORAGE_BLUEPRINTS_ITEM }
def _getRootData(self): root = self.vehicle rootNode = self._data.getRootNode() nodeState = rootNode.getState() bpfProps = rootNode.getBpfProps() isNext2Unlock = NODE_STATE.isNext2Unlock(nodeState) isPremium = NODE_STATE.isCollectibleActionVehicle( nodeState) or NODE_STATE.isPremium(nodeState) comparisonState, comparisonTooltip = resolveStateTooltip( self._cmpBasket, root, enabledTooltip='', fullTooltip=TOOLTIPS.RESEARCHPAGE_VEHICLE_BUTTON_COMPARE_DISABLED) tankTier = int2roman(root.level) tankHasNationGroup = (root.isInInventory or root.isRented) and root.hasNationGroup isNationChangeAvailable = root.isNationChangeAvailable isShownNationChangeTooltip = tankHasNationGroup and not isNationChangeAvailable result = { 'vehicleTitle': { 'intCD': self._data.getRootCD(), 'tankTierStr': text_styles.grandTitle(tankTier), 'tankNameStr': text_styles.grandTitle(root.userName), 'tankTierStrSmall': text_styles.promoTitle(tankTier), 'tankNameStrSmall': text_styles.promoTitle(root.userName), 'typeIconPath': getTypeBigIconPath(root.type, root.isElite), 'isElite': root.isElite, 'statusStr': self.__getRootStatusStr(root), 'roleText': getRoleTextWithIcon(root.role, root.roleLabel) }, 'vehicleButton': { 'shopIconPath': RES_SHOP.getVehicleIcon(STORE_CONSTANTS.ICON_SIZE_MEDIUM, root.name.split(':')[1]), 'compareBtnVisible': not self.__bootcamp.isInBootcamp(), 'compareBtnEnabled': comparisonState, 'compareBtnLabel': backport.text( R.strings.menu.research.labels.button.addToCompare()), 'compareBtnTooltip': comparisonTooltip, 'previewBtnEnabled': root.isPreviewAllowed(), 'previewBtnLabel': backport.text( R.strings.menu.research.labels.button.vehiclePreview()), 'isPremium': isPremium, 'vehicleId': self._data.getRootCD(), 'vehicleState': nodeState, 'isInInventory': NODE_STATE.inInventory(nodeState), 'previewAlias': VIEW_ALIAS.LOBBY_RESEARCH, 'cmHandlerType': CONTEXT_MENU_HANDLER_TYPE.RESEARCH_VEHICLE }, 'isInteractive': self.__getIsInteractive(root, rootNode), 'buttonLabel': self.__getMainButtonLabel(root, rootNode), 'blueprintLabel': self.__getResearchPageBlueprintLabel(rootNode), 'blueprintProgress': rootNode.getBlueprintProgress(), 'blueprintCanConvert': bpfProps.canConvert if bpfProps is not None else False, 'bpbGlowEnabled': isNext2Unlock, 'itemPrices': rootNode.getItemPrices(), 'discountStr': self.__getDiscountBannerStr(root, rootNode), 'rentBtnLabel': self.__getRentButtonLabel(rootNode), 'changeNationBtnVisibility': tankHasNationGroup, 'isTankNationChangeAvailable': isNationChangeAvailable, 'nationChangeIsNew': not AccountSettings.getSettings(NATION_CHANGE_VIEWED), 'nationChangeTooltip': self.__getNationChangeTooltip(root) if isShownNationChangeTooltip else '' } return result
def _buildVehicle(self, item): bpRequester = self._itemsCache.items.blueprints name = getVehicleName(vehicle=item) intelligenceIcon = RES_ICONS.getBlueprintFragment( 'small', 'intelligence') nationalIcon = RES_ICONS.getBlueprintFragment('small', item.nationName) current, total = bpRequester.getBlueprintCount(item.intCD, item.level) nationalCost, intelligenceCost = bpRequester.getRequiredIntelligenceAndNational( item.level) availableCount = bpRequester.getConvertibleFragmentCount( item.intCD, item.level) if availableCount > 0: description = self.__getConvertAvailableDescription(availableCount) else: existingNational = bpRequester.getNationalFragments(item.intCD) existingIntelligence = bpRequester.getIntelligenceData() intelligenceRequired = max( (0, intelligenceCost - existingIntelligence)) nationalRequired = max((0, nationalCost - existingNational)) description = self.__getConvertRequiredDescription( intelligenceRequired, intelligenceIcon, nationalRequired, nationalIcon) availableToUnlock, _ = g_techTreeDP.isNext2Unlock( item.intCD, unlocked=self._itemsCache.items.stats.unlocks, xps=self._itemsCache.items.stats.vehiclesXPs, freeXP=self._itemsCache.items.stats.actualFreeXP, level=item.level) fragmentsCostText = self.__formatFragmentsCost( intelligenceCost=intelligenceCost, intelligenceIcon=intelligenceIcon, nationalCost=nationalCost, nationalIcon=nationalIcon) discount = bpRequester.getBlueprintDiscount(item.intCD, item.level) fragmentsProgress = self.__formatFragmentProgress( current, total, discount) image = func_utils.makeFlashPath( item.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL)) return { 'id': item.intCD, 'title': name, 'description': description, 'image': image, 'imageAlt': RES_SHOP.getVehicleIcon(STORE_CONSTANTS.ICON_SIZE_SMALL, 'empty_tank'), 'fragmentsCostText': fragmentsCostText, 'fragmentsProgress': fragmentsProgress, 'hasDiscount': discount > 0, 'availableToUnlock': availableToUnlock, 'convertAvailable': availableCount > 0, 'contextMenuId': CONTEXT_MENU_HANDLER_TYPE.STORAGE_BLUEPRINTS_ITEM }