def _makePriceBlock(self, price, text, currencyType, neededValue = None, oldPrice = None, percent = 0): needFormatted = '' oldPriceText = '' hasAction = percent != 0 if currencyType == ICON_TEXT_FRAMES.CREDITS: valueFormatted = text_styles.credits(_int(price)) icon = icons.credits() if neededValue is not None: needFormatted = text_styles.credits(_int(neededValue)) if hasAction: oldPriceText = text_styles.concatStylesToSingleLine(icons.credits(), text_styles.credits(_int(oldPrice))) elif currencyType == ICON_TEXT_FRAMES.GOLD: valueFormatted = text_styles.gold(_int(price)) icon = icons.gold() if neededValue is not None: needFormatted = text_styles.gold(_int(neededValue)) if hasAction: oldPriceText = text_styles.concatStylesToSingleLine(icons.gold(), text_styles.gold(_int(oldPrice))) elif currencyType == ICON_TEXT_FRAMES.XP: valueFormatted = text_styles.expText(_int(price)) icon = icons.xp() if neededValue is not None: needFormatted = text_styles.expText(_int(neededValue)) else: LOG_ERROR('Unsupported currency type "' + currencyType + '"!') return neededText = '' if neededValue is not None: neededText = text_styles.concatStylesToSingleLine(text_styles.main('( '), text_styles.error(TOOLTIPS.VEHICLE_GRAPH_BODY_NOTENOUGH), ' ', needFormatted, ' ', icon, text_styles.main(' )')) text = text_styles.concatStylesWithSpace(text_styles.main(text), neededText) if hasAction: actionText = text_styles.main(_ms(TOOLTIPS.VEHICLE_ACTION_PRC, actionPrc=text_styles.stats(str(percent) + '%'), oldPrice=oldPriceText)) text = text_styles.concatStylesToMultiLine(text, actionText) return formatters.packTextParameterWithIconBlockData(name=text, value=valueFormatted, icon=currencyType, valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=20))
def _getDurationTypeVO(): durationTypeVOs = [] for duration, (tooltipText, tooltipLowercaseText) in _DURATION_TOOLTIPS.items(): if duration == DURATION.PERMANENT: icon = icons.gold() else: icon = icons.credits() label = '{0}{1}'.format(_ms(tooltipText), icon) tooltip = makeTooltip( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(tooltipText)), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_BODY, time=_ms(tooltipLowercaseText))) tooltipDisabled = makeTooltip( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(tooltipText)), VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_DISABLED) durationTypeVOs.append({ 'label': label, 'tooltip': tooltip, 'tooltipDisabled': tooltipDisabled }) return durationTypeVOs
def __makeModulePurchaseVO(self, item, unlockProps, creditPrice): formattedPrice = BigWorld.wg_getIntegralFormat(creditPrice) + icons.credits() return {'title': _ms(BATTLE_RESULTS.COMMON_FITTING_PURCHASE), 'description': text_styles.main(item.userName), 'fittingType': item.itemTypeName, 'lvlIcon': getLevelIconPath(item.level), 'price': text_styles.credits(formattedPrice), 'linkEvent': PROGRESS_ACTION.PURCHASE_UNLOCK_TYPE, 'linkId': unlockProps.parentID}
def __setTotalData(self, *args): if self.__controller.cart.processingMultiplePurchase: return priceGold = self.__controller.cart.totalPriceGold priceCredits = self.__controller.cart.totalPriceCredits notEnoughGoldTooltip = notEnoughCreditsTooltip = '' enoughGold = self.itemsCache.items.stats.gold >= priceGold enoughCredits = self.itemsCache.items.stats.credits >= priceCredits state = g_currentVehicle.getViewState() canBuy = bool( priceGold or priceCredits ) and enoughGold and enoughCredits and state.isCustomizationEnabled() if not enoughGold: diff = text_styles.gold(priceGold - self.itemsCache.items.stats.gold) notEnoughGoldTooltip = makeTooltip( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold()))) if not enoughCredits: diff = text_styles.credits(priceCredits - self.itemsCache.items.stats.credits) notEnoughCreditsTooltip = makeTooltip( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits()))) inFormationAlert = text_styles.concatStylesWithSpace( icons.markerBlocked(), text_styles.error( VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_FORMATION_ALERT) ) if not state.isCustomizationEnabled() else '' self.as_setTotalDataS({ 'credits': formatPriceCredits(priceCredits), 'gold': formatPriceGold(priceGold), 'totalLabel': text_styles.highTitle( _ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST, selected=len(self.__searchDP.selectedItems), total=len(self.__searchDP.items))), 'enoughGold': enoughGold, 'enoughCredits': enoughCredits, 'notEnoughGoldTooltip': notEnoughGoldTooltip, 'notEnoughCreditsTooltip': notEnoughCreditsTooltip, 'inFormationAlert': inFormationAlert }) self.as_setBuyBtnEnabledS(canBuy)
def __makeVehiclePurchaseVO(self, item, unlockProps, creditPrice): formattedPrice = BigWorld.wg_getIntegralFormat(creditPrice) + icons.credits() return {'title': _ms(BATTLE_RESULTS.COMMON_VEHICLE_PURCHASE), 'description': self.__makeVehicleDescription(item), 'vehicleIcon': item.iconSmall, 'lvlIcon': getLevelIconPath(item.level), 'price': text_styles.credits(formattedPrice), 'linkEvent': PROGRESS_ACTION.PURCHASE_UNLOCK_TYPE, 'linkId': unlockProps.parentID}
def __makeModulePurchaseVO(self, item, unlockProps, creditPrice): formattedPrice = BigWorld.wg_getIntegralFormat(creditPrice) + icons.credits() return {'title': _ms(BATTLE_RESULTS.COMMON_FITTING_PURCHASE), 'description': text_styles.main(item.userName), 'fittingType': item.itemTypeName, 'lvlIcon': getLevelIconPath(item.level), 'price': text_styles.credits(formattedPrice), 'linkEvent': PROGRESS_ACTION.PURCHASE_UNLOCK_TYPE, 'linkId': unlockProps.parentID}
def __makeVehiclePurchaseVO(self, item, unlockProps, creditPrice): formattedPrice = BigWorld.wg_getIntegralFormat(creditPrice) + icons.credits() return {'title': _ms(BATTLE_RESULTS.COMMON_VEHICLE_PURCHASE), 'description': self.__makeVehicleDescription(item), 'vehicleIcon': item.iconSmall, 'lvlIcon': getLevelIconPath(item.level), 'price': text_styles.credits(formattedPrice), 'linkEvent': PROGRESS_ACTION.PURCHASE_UNLOCK_TYPE, 'linkId': unlockProps.parentID}
def __setCarouselData(self, blData): itemVOs = [] selectedIndex = -1 for item in blData['items']: element = item['element'] isInQuest = checkInQuest(element, self.__controller.filter.purchaseType) if item['installedInCurrentSlot']: label = text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_ITEMLABEL_APPLIED) elif element.isInDossier: label = text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED) elif element.getIgrType() != IGR_TYPE.NONE: if element.getIgrType() == self.igrCtrl.getRoomType(): label = text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED) else: label = icons.premiumIgrSmall() elif isInQuest: label = icons.quest() else: if item['duration'] == DURATION.PERMANENT: priceFormatter = text_styles.gold priceIcon = icons.gold() else: priceFormatter = text_styles.credits priceIcon = icons.credits() label = priceFormatter('{0}{1}'.format(element.getPrice(item['duration']), priceIcon)) data = {'id': element.getID(), 'icon': element.getTexturePath(), 'label': label, 'selected': item['appliedToCurrentSlot'] or item['installedInCurrentSlot'] and not blData['hasAppliedItem'], 'goToTaskBtnVisible': isInQuest, 'goToTaskBtnText': _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_ITEMCAROUSEL_RENDERER_GOTOTASK), 'newElementIndicatorVisible': item['isNewElement']} if element.qualifier.getValue() > 0: data['bonusType'] = element.qualifier.getIcon16x16() data['bonusPower'] = text_styles.stats('+{0}%{1}'.format(element.qualifier.getValue(), '*' if element.qualifier.getDescription() is not None else '')) if data['selected']: selectedIndex = blData['items'].index(item) if element.isOnSale(item['duration']) and not element.isInDossier and not item['installedInCurrentSlot'] and not isInQuest: data['salePrice'] = getSalePriceString(self.__controller.slots.currentType, element, item['duration']) itemVOs.append(data) carouselLength = len(itemVOs) self.as_setCarouselDataS({'rendererList': itemVOs, 'rendererWidth': blData['rendererWidth'], 'filterCounter': '{0}{1}'.format(text_styles.stats(carouselLength) if carouselLength > 0 else text_styles.error(carouselLength), text_styles.main(_ms(VEHICLE_CUSTOMIZATION.CAROUSEL_FILTER_COUNTER, all=blData['unfilteredLength']))), 'messageVisible': carouselLength == 0, 'counterVisible': True, 'goToIndex': blData['goToIndex'], 'selectedIndex': selectedIndex}) return
def __setCarouselData(self, blData): itemVOs = [] selectedIndex = -1 for item in blData['items']: element = item['element'] isInQuest = checkInQuest(element, self.__controller.filter.purchaseType) if item['installedInCurrentSlot']: label = text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_ITEMLABEL_APPLIED) elif element.isInDossier: label = text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED) elif element.getIgrType() != IGR_TYPE.NONE: if element.getIgrType() == getIGRCtrl().getRoomType(): label = text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED) else: label = icons.premiumIgrSmall() elif isInQuest: label = icons.quest() else: if item['duration'] == DURATION.PERMANENT: priceFormatter = text_styles.gold priceIcon = icons.gold() else: priceFormatter = text_styles.credits priceIcon = icons.credits() label = priceFormatter('{0}{1}'.format(element.getPrice(item['duration']), priceIcon)) data = {'id': element.getID(), 'icon': element.getTexturePath(), 'bonusType': element.qualifier.getIcon16x16(), 'bonusPower': text_styles.stats('+{0}%{1}'.format(element.qualifier.getValue(), '*' if element.qualifier.getDescription() is not None else '')), 'label': label, 'selected': item['appliedToCurrentSlot'] or item['installedInCurrentSlot'] and not blData['hasAppliedItem'], 'goToTaskBtnVisible': isInQuest, 'goToTaskBtnText': _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_ITEMCAROUSEL_RENDERER_GOTOTASK), 'newElementIndicatorVisible': item['isNewElement']} if data['selected']: selectedIndex = blData['items'].index(item) if element.isOnSale(item['duration']) and not element.isInDossier and not item['installedInCurrentSlot'] and not isInQuest: data['salePrice'] = getSalePriceString(self.__controller.slots.currentType, element, item['duration']) itemVOs.append(data) carouselLength = len(itemVOs) self.as_setCarouselDataS({'rendererList': itemVOs, 'rendererWidth': blData['rendererWidth'], 'filterCounter': '{0}{1}'.format(text_styles.stats(carouselLength) if carouselLength > 0 else text_styles.error(carouselLength), text_styles.main(_ms(VEHICLE_CUSTOMIZATION.CAROUSEL_FILTER_COUNTER, all=blData['unfilteredLength']))), 'messageVisible': carouselLength == 0, 'counterVisible': True, 'goToIndex': blData['goToIndex'], 'selectedIndex': selectedIndex}) return
def __setBottomPanelData(self, *args): if self.__isCarouselHidden: occupiedSlotsNum, totalSlotsNum = self.__controller.slots.getSummary( ) label = text_styles.highTitle( _ms(VEHICLE_CUSTOMIZATION.TYPESWITCHSCREEN_SLOTSUMMARY, occupiedSlotsNum=occupiedSlotsNum, totalSlotsNum=totalSlotsNum)) else: label = text_styles.middleTitle( _ms('#vehicle_customization:typeSwitchScreen/typeName/plural/{0}' .format(self.__controller.slots.currentType))) totalGold = self.__controller.cart.totalPriceGold totalCredits = self.__controller.cart.totalPriceCredits notEnoughGoldTooltip = notEnoughCreditsTooltip = '' enoughGold = g_itemsCache.items.stats.gold >= totalGold enoughCredits = g_itemsCache.items.stats.credits >= totalCredits if not enoughGold: diff = text_styles.gold(totalGold - g_itemsCache.items.stats.gold) notEnoughGoldTooltip = makeTooltip( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold()))) if not enoughCredits: diff = text_styles.credits(totalCredits - g_itemsCache.items.stats.credits) notEnoughCreditsTooltip = makeTooltip( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits()))) self.as_setBottomPanelHeaderS({ 'newHeaderText': label, 'buyBtnLabel': _ms(MENU.CUSTOMIZATION_BUTTONS_APPLY, count=len(self.__controller.cart.items)), 'pricePanel': { 'totalPriceCredits': formatPriceCredits(totalCredits), 'totalPriceGold': formatPriceGold(totalGold), 'enoughGold': enoughGold, 'enoughCredits': enoughCredits, 'notEnoughGoldTooltip': notEnoughGoldTooltip, 'notEnoughCreditsTooltip': notEnoughCreditsTooltip } })
def __setCarouselData(self, blData): itemVOs = [] for item in blData['items']: enable = True if item['installedInSlot']: label = text_styles.main(CUSTOMIZATION.CAROUSEL_ITEMLABEL_APPLIED) elif item['isInDossier']: label = text_styles.main(CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED) elif item['object'].getIgrType() != IGR_TYPE.NONE: if item['object'].getIgrType() == getIGRCtrl().getRoomType(): label = text_styles.main(CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED) else: label = icons.premiumIgrSmall() enable = False else: if item['priceIsGold']: priceFormatter = text_styles.gold priceIcon = icons.gold() else: priceFormatter = text_styles.credits priceIcon = icons.credits() label = priceFormatter('{0}{1}'.format(item['price'], priceIcon)) data = {'id': item['id'], 'icon': item['object'].getTexturePath(), 'bonusType': item['object'].qualifier.getIcon16x16(), 'bonusPower': text_styles.stats('+{0}%{1}'.format(item['object'].qualifier.getValue(), '*' if item['object'].qualifier.getDescription() is not None else '')), 'label': label, 'installed': item['appliedToCurrentSlot'], 'btnSelect': self.__getLabelOfSelectBtn(item), 'btnShoot': VEHICLE_CUSTOMIZATION.CUSTOMIZATIONITEMCAROUSEL_RENDERER_SHOOT, 'btnTooltip': item['buttonTooltip'], 'btnSelectEnable': enable, 'doubleclickEnable': enable, 'btnShootEnable': True} cType = g_customizationController.carousel.currentType if isSale(cType, item['duration']) and not item['isInDossier'] and not item['installedInSlot']: isGold = item['priceIsGold'] data['salePrice'] = getSalePriceString(isGold, item['price']) itemVOs.append(data) carouselLength = len(itemVOs) self.as_setCarouselDataS({'rendererList': itemVOs, 'rendererWidth': blData['rendererWidth'], 'filterCounter': '{0}{1}'.format(text_styles.stats(carouselLength) if carouselLength > 0 else text_styles.error(carouselLength), text_styles.main(_ms(VEHICLE_CUSTOMIZATION.CAROUSEL_FILTER_COUNTER, all=blData['unfilteredLength']))), 'messageVisible': carouselLength == 0, 'counterVisible': True, 'goToIndex': blData['goToIndex'], 'selectedIndex': blData['selectedIndex']}) return
def _getDurationTypeVO(): durationTypeVOs = [] for duration, (tooltipText, tooltipLowercaseText) in _DURATION_TOOLTIPS.items(): if duration == DURATION.PERMANENT: icon = icons.gold() else: icon = icons.credits() label = '{0}{1}'.format(_ms(tooltipText), icon) tooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(tooltipText)), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_BODY, time=_ms(tooltipLowercaseText))) tooltipDisabled = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(tooltipText)), VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_DISABLED) durationTypeVOs.append({'label': label, 'tooltip': tooltip, 'tooltipDisabled': tooltipDisabled}) return durationTypeVOs
def __setTotalData(self, *args): priceGold = self.__controller.cart.totalPriceGold priceCredits = self.__controller.cart.totalPriceCredits notEnoughGoldTooltip = notEnoughCreditsTooltip = '' enoughGold = g_itemsCache.items.stats.gold >= priceGold enoughCredits = g_itemsCache.items.stats.credits >= priceCredits canBuy = bool(priceGold or priceCredits) and enoughGold and enoughCredits if not enoughGold: diff = text_styles.gold(priceGold - g_itemsCache.items.stats.gold) notEnoughGoldTooltip = makeTooltip( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold()))) if not enoughCredits: diff = text_styles.credits(priceCredits - g_itemsCache.items.stats.credits) notEnoughCreditsTooltip = makeTooltip( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits()))) self.as_setTotalDataS({ 'credits': formatPriceCredits(priceCredits), 'gold': formatPriceGold(priceGold), 'totalLabel': text_styles.highTitle( _ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST, selected=len(self.__searchDP.selectedItems), total=len(self.__searchDP.items))), 'buyEnabled': canBuy, 'enoughGold': enoughGold, 'enoughCredits': enoughCredits, 'notEnoughGoldTooltip': notEnoughGoldTooltip, 'notEnoughCreditsTooltip': notEnoughCreditsTooltip })
def __getRentButtonLabel(rootNode): btnLabel = '' if NODE_STATE.isRentAvailable(rootNode.getState()): minRentPrice, currency = rootNode.getRentInfo() if currency == Currency.CREDITS: btnLabel = text_styles.concatStylesWithSpace( backport.text( R.strings.menu.research.labels.button.rent()), text_styles.credits( backport.getIntegralFormat(minRentPrice.credits)), icons.credits()) elif currency == Currency.GOLD: btnLabel = text_styles.concatStylesWithSpace( backport.text( R.strings.menu.research.labels.button.rent()), text_styles.gold(backport.getGoldFormat( minRentPrice.gold)), icons.gold()) return btnLabel
def __setTotalData(self): notEnoughGoldTooltip = notEnoughCreditsTooltip = '' enoughGold = g_itemsCache.items.stats.gold >= self.__totalPrice['gold'] enoughCredits = g_itemsCache.items.stats.credits >= self.__totalPrice[ 'credits'] buyEnabled = bool( self.__totalPrice['credits'] + self.__totalPrice['gold']) and enoughGold and enoughCredits if not enoughGold: diff = text_styles.gold(self.__totalPrice['gold'] - g_itemsCache.items.stats.gold) notEnoughGoldTooltip = makeTooltip( _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold()))) if not enoughCredits: diff = text_styles.credits(self.__totalPrice['credits'] - g_itemsCache.items.stats.credits) notEnoughCreditsTooltip = makeTooltip( _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits()))) self.as_setTotalDataS({ 'credits': formatPriceCredits(self.__totalPrice['credits']), 'gold': formatPriceGold(self.__totalPrice['gold']), 'totalLabel': text_styles.highTitle( _ms(CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST, selected=len(self.__searchDP.getSelected()), total=len(self.__searchDP.getTotal()))), 'buyEnabled': buyEnabled, 'enoughGold': enoughGold, 'enoughCredits': enoughCredits, 'notEnoughGoldTooltip': notEnoughGoldTooltip, 'notEnoughCreditsTooltip': notEnoughCreditsTooltip })
def __setBottomPanelData(self): if self.__carouselHidden: label = g_customizationController.carousel.slots.getSummaryString() else: label = g_customizationController.carousel.slots.getCurrentTypeLabel( ) totalGold = g_customizationController.carousel.slots.cart.totalPriceGold totalCredits = g_customizationController.carousel.slots.cart.totalPriceCredits notEnoughGoldTooltip = notEnoughCreditsTooltip = '' enoughGold = g_itemsCache.items.stats.gold >= totalGold enoughCredits = g_itemsCache.items.stats.credits >= totalCredits if not enoughGold: diff = text_styles.gold(totalGold - g_itemsCache.items.stats.gold) notEnoughGoldTooltip = makeTooltip( _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold()))) if not enoughCredits: diff = text_styles.credits(totalCredits - g_itemsCache.items.stats.credits) notEnoughCreditsTooltip = makeTooltip( _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits()))) self.as_setBottomPanelHeaderS({ 'newHeaderText': label, 'buyBtnLabel': _ms(MENU.CUSTOMIZATION_BUTTONS_APPLY, count=len( g_customizationController.carousel.slots.cart.items)), 'pricePanel': { 'totalPriceCredits': formatPriceCredits(totalCredits), 'totalPriceGold': formatPriceGold(totalGold), 'enoughGold': enoughGold, 'enoughCredits': enoughCredits, 'notEnoughGoldTooltip': notEnoughGoldTooltip, 'notEnoughCreditsTooltip': notEnoughCreditsTooltip } })
def __setTotalData(self, *args): priceGold = self.__controller.cart.totalPriceGold priceCredits = self.__controller.cart.totalPriceCredits notEnoughGoldTooltip = notEnoughCreditsTooltip = '' enoughGold = g_itemsCache.items.stats.gold >= priceGold enoughCredits = g_itemsCache.items.stats.credits >= priceCredits canBuy = bool(priceGold or priceCredits) and enoughGold and enoughCredits if not enoughGold: diff = text_styles.gold(priceGold - g_itemsCache.items.stats.gold) notEnoughGoldTooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold()))) if not enoughCredits: diff = text_styles.credits(priceCredits - g_itemsCache.items.stats.credits) notEnoughCreditsTooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits()))) self.as_setTotalDataS({'credits': formatPriceCredits(priceCredits), 'gold': formatPriceGold(priceGold), 'totalLabel': text_styles.highTitle(_ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST, selected=len(self.__searchDP.selectedItems), total=len(self.__searchDP.items))), 'buyEnabled': canBuy, 'enoughGold': enoughGold, 'enoughCredits': enoughCredits, 'notEnoughGoldTooltip': notEnoughGoldTooltip, 'notEnoughCreditsTooltip': notEnoughCreditsTooltip})
def _packWayToBuyBlock(self, item): subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_WAYTOBUY_TITLE)), padding={'bottom': 6})] padding = {'left': 0} for buyItem in item['buyItems']: buyItemDesc = text_styles.main(buyItem['desc']) if buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_FOREVER: if buyItem['isSale']: subBlocks.append(formatters.packSaleTextParameterBlockData(name=buyItemDesc, saleData={'newPrice': (0, buyItem['value'])}, padding=padding)) else: price = text_styles.concatStylesWithSpace(text_styles.gold(BigWorld.wg_getIntegralFormat(long(buyItem['value']))), icons.gold()) subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70)) elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_TEMP: if buyItem['isSale']: subBlocks.append(formatters.packSaleTextParameterBlockData(name=buyItemDesc, saleData={'newPrice': (buyItem['value'], 0)}, padding=padding)) else: price = text_styles.concatStylesWithSpace(text_styles.credits(BigWorld.wg_getIntegralFormat(long(buyItem['value']))), icons.credits()) subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70)) elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_IGR: subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=icons.premiumIgrSmall(), padding=padding)) elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_MISSION: subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=icons.quest(), padding=padding)) return formatters.packBuildUpBlockData(subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {'left': 3})
def _packInventoryBlock(self, showBuyPrice, showSellPrice, showInventoryCount): subBlocks = [] money = self.itemsCache.items.stats.money if showBuyPrice and not self._item.isHidden: for itemPrice in self._item.buyPrices: currency = itemPrice.getCurrency() value = itemPrice.price.getSignValue(currency) defValue = itemPrice.defPrice.getSignValue(currency) needValue = value - money.getSignValue(currency) actionPercent = itemPrice.getActionPrc() if not self._item.isRentable: setting = CURRENCY_SETTINGS.getBuySetting forcedText = '' else: setting = CURRENCY_SETTINGS.getRentSetting forcedText = _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_TOOLTIP_INVENTORY_COST_RENT, battlesNum=self._item.rentCount) if self._item.buyCount > 0: subBlocks.append( makePriceBlock(value, setting(currency), needValue if needValue > 0 else None, defValue if defValue > 0 else None, actionPercent, valueWidth=88, leftPadding=49, forcedText=forcedText)) if showSellPrice and not (self._item.isHidden or self._item.isRentable): for itemPrice in self._item.sellPrices: currency = itemPrice.getCurrency() value = itemPrice.price.getSignValue(currency) defValue = itemPrice.defPrice.getSignValue(currency) actionPercent = itemPrice.getActionPrc() if actionPercent > 0: subBlocks.append( formatters.packTextParameterWithIconBlockData( name=text_styles.main( TOOLTIPS.ACTIONPRICE_SELL_BODY_SIMPLE), value=text_styles.concatStylesToSingleLine( text_styles.credits( backport.getIntegralFormat(value)), ' ', icons.credits()), icon='alertMedium', valueWidth=88, padding=formatters.packPadding(left=-5))) subBlocks.append( makePriceBlock(value, CURRENCY_SETTINGS.SELL_PRICE, oldPrice=defValue if defValue > 0 else None, percent=actionPercent, valueWidth=88, leftPadding=49)) if self.__ctx is not None: inventoryCount = self.__ctx.mode.getItemInventoryCount(self._item) else: inventoryCount = getItemInventoryCount(self._item) info = text_styles.concatStylesWithSpace( text_styles.stats(inventoryCount)) padding = formatters.packPadding(left=83, bottom=0) titlePadding = formatters.packPadding(left=-1) if showInventoryCount and inventoryCount > 0: if self._item.isRentable: textKey = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_INVENTORY_RENT_BATTLESLEFT icon = RES_ICONS.MAPS_ICONS_LIBRARY_CLOCKICON_1 autoRentEnabled = self.__ctx.mode.isAutoRentEnabled( ) if self.__ctx is not None else False if self._item.isRented and autoRentEnabled: textKey = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_INVENTORY_RENT_BATTLESLEFT_AUTOPROLONGATIONON icon = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_ICON_RENT title = text_styles.main( _ms(textKey, tankname=self.__vehicle.shortUserName)) padding = formatters.packPadding(left=83, bottom=-14) titlePadding = formatters.packPadding(left=-8) iconPadding = formatters.packPadding(top=-7, left=-3) else: title = text_styles.main( VEHICLE_CUSTOMIZATION. CUSTOMIZATION_TOOLTIP_INVENTORY_AVAILABLE) icon = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_STORAGE_ICON padding = formatters.packPadding(left=83, bottom=0) titlePadding = formatters.packPadding(left=-1) iconPadding = formatters.packPadding(top=-2, left=-2) subBlocks.append( formatters.packTitleDescParameterWithIconBlockData( title=title, value=info, icon=icon, padding=padding, titlePadding=titlePadding, iconPadding=iconPadding)) boundCount = self._item.boundInventoryCount(self.__vehicle.intCD) commonCount = boundCount + self.installedCount isVehicleBound = self._item.isVehicleBound and not self._item.isProgressionAutoBound if showInventoryCount and commonCount > 0 and isVehicleBound and not self._item.isRentable: subBlocks.append( formatters.packTitleDescParameterWithIconBlockData( title=text_styles.main( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_BOUND_ON_VEHICLE, tankname=self.__vehicle.shortUserName)), value=text_styles.concatStylesWithSpace( text_styles.stats(commonCount)), icon=RES_ICONS.MAPS_ICONS_CUSTOMIZATION_TANK, padding=padding, titlePadding=titlePadding, iconPadding=formatters.packPadding(top=2))) return formatters.packBuildUpBlockData(blocks=subBlocks, gap=-1)
def __setCarouselInitData(self): self.as_setCarouselInitS({ 'icoFilter': RES_ICONS.MAPS_ICONS_BUTTONS_FILTER, 'durationType': [ self.__getDurationTypeVO( '{0}{1}'.format( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_ALWAYS), icons.gold()), makeTooltip( _ms(TOOLTIPS. CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_ALWAYS)), _ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_BODY, time=_ms( VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_LOWERCASE_ALWAYS) )), makeTooltip( _ms(TOOLTIPS. CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_ALWAYS)), VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_DISABLED)), self.__getDurationTypeVO( '{0}{1}'.format( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_MONTH), icons.credits()), makeTooltip( _ms(TOOLTIPS. CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_MONTH)), _ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_BODY, time=_ms( VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_LOWERCASE_MONTH)) ), makeTooltip( _ms(TOOLTIPS. CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_MONTH)), VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_DISABLED)), self.__getDurationTypeVO( '{0}{1}'.format( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_WEEK), icons.credits()), makeTooltip( _ms(TOOLTIPS. CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_WEEK)), _ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_BODY, time=_ms( VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_LOWERCASE_WEEK)) ), makeTooltip( _ms(TOOLTIPS. CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_WEEK)), VEHICLE_CUSTOMIZATION. CUSTOMIZATION_FILTER_DURATION_DISABLED)) ], 'durationSelectIndex': 0, 'onlyPurchased': True, 'icoPurchased': RES_ICONS.MAPS_ICONS_FILTERS_PRESENCE, 'message': '{2}{0}\n{1}'.format( text_styles.neutral( VEHICLE_CUSTOMIZATION.CAROUSEL_MESSAGE_HEADER), text_styles.main( VEHICLE_CUSTOMIZATION.CAROUSEL_MESSAGE_DESCRIPTION), icons.makeImageTag( RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16, -3, 0)), 'fitterTooltip': makeTooltip(TOOLTIPS.CUSTOMIZATION_CAROUSEL_FILTER_HEADER, TOOLTIPS.CUSTOMIZATION_CAROUSEL_FILTER_BODY), 'chbPurchasedTooltip': makeTooltip(TOOLTIPS.CUSTOMIZATION_CAROUSEL_CHBPURCHASED_HEADER, TOOLTIPS.CUSTOMIZATION_CAROUSEL_CHBPURCHASED_BODY) })
def __setCarouselData(self, blData): itemVOs = [] for item in blData['items']: if item['installedInSlot']: label = text_styles.main( CUSTOMIZATION.CAROUSEL_ITEMLABEL_APPLIED) elif item['isInDossier']: label = text_styles.main( CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED) elif item['object'].getIgrType() != IGR_TYPE.NONE: if item['object'].getIgrType() == getIGRCtrl().getRoomType(): label = text_styles.main( CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED) else: label = icons.premiumIgrSmall() elif item['isInQuests']: label = icons.quest() else: if item['priceIsGold']: priceFormatter = text_styles.gold priceIcon = icons.gold() else: priceFormatter = text_styles.credits priceIcon = icons.credits() label = priceFormatter('{0}{1}'.format(item['price'], priceIcon)) data = { 'id': item['id'], 'icon': item['object'].getTexturePath(), 'bonusType': item['object'].qualifier.getIcon16x16(), 'bonusPower': text_styles.stats('+{0}%{1}'.format( item['object'].qualifier.getValue(), '*' if item['object'].qualifier.getDescription() is not None else '')), 'label': label, 'selected': item['appliedToCurrentSlot'], 'goToTaskBtnVisible': item['isInQuests'], 'goToTaskBtnText': _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_ITEMCAROUSEL_RENDERER_GOTOTASK), 'newElementIndicatorVisible': False } cType = g_customizationController.carousel.currentType if item['object'].isSale( item['duration']) and not item['isInDossier'] and not item[ 'installedInSlot'] and not item['isInQuests']: data['salePrice'] = getSalePriceString(cType, item['object'], item['duration']) itemVOs.append(data) carouselLength = len(itemVOs) self.as_setCarouselDataS({ 'rendererList': itemVOs, 'rendererWidth': blData['rendererWidth'], 'filterCounter': '{0}{1}'.format( text_styles.stats(carouselLength) if carouselLength > 0 else text_styles.error(carouselLength), text_styles.main( _ms(VEHICLE_CUSTOMIZATION.CAROUSEL_FILTER_COUNTER, all=blData['unfilteredLength']))), 'messageVisible': carouselLength == 0, 'counterVisible': True, 'goToIndex': blData['goToIndex'], 'selectedIndex': blData['selectedIndex'] }) return
def _getVehicleDescription(vehicle): return ' '.join( (_ms(STORAGE.CARD_VEHICLE_HOVER_MAXADDITIONALPRICELABEL), backport.getIntegralFormat( _calculateVehicleMaxAdditionalPrice(vehicle)), icons.credits()))
def __setCarouselInitData(self): self.as_setCarouselInitS({'icoFilter': RES_ICONS.MAPS_ICONS_BUTTONS_FILTER, 'durationType': [self.__getDurationTypeVO('{0}{1}'.format(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_ALWAYS), icons.gold()), makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_ALWAYS)), _ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_BODY, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_LOWERCASE_ALWAYS))), makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_ALWAYS)), VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_DISABLED)), self.__getDurationTypeVO('{0}{1}'.format(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_MONTH), icons.credits()), makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_MONTH)), _ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_BODY, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_LOWERCASE_MONTH))), makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_MONTH)), VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_DISABLED)), self.__getDurationTypeVO('{0}{1}'.format(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_WEEK), icons.credits()), makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_WEEK)), _ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_BODY, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_LOWERCASE_WEEK))), makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_WEEK)), VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_DISABLED))], 'durationSelectIndex': 0, 'onlyPurchased': True, 'icoPurchased': RES_ICONS.MAPS_ICONS_FILTERS_PRESENCE, 'message': '{2}{0}\n{1}'.format(text_styles.neutral(VEHICLE_CUSTOMIZATION.CAROUSEL_MESSAGE_HEADER), text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_MESSAGE_DESCRIPTION), icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16, -3, 0)), 'fitterTooltip': makeTooltip(TOOLTIPS.CUSTOMIZATION_CAROUSEL_FILTER_HEADER, TOOLTIPS.CUSTOMIZATION_CAROUSEL_FILTER_BODY), 'chbPurchasedTooltip': makeTooltip(TOOLTIPS.CUSTOMIZATION_CAROUSEL_CHBPURCHASED_HEADER, TOOLTIPS.CUSTOMIZATION_CAROUSEL_CHBPURCHASED_BODY)})
def _packInventoryBlock(self): container = self.app.containerManager.getContainer(ViewTypes.LOBBY_SUB) view = container.getView() if view.alias == VIEW_ALIAS.LOBBY_CUSTOMIZATION: getInventoryCount = view.getItemInventoryCount else: getInventoryCount = getItemInventoryCount subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_INVENTORY_TITLE), padding={'bottom': 4})] money = self.itemsCache.items.stats.money if not self._item.isHidden: for itemPrice in self._item.buyPrices: currency = itemPrice.getCurrency() value = itemPrice.price.getSignValue(currency) defValue = itemPrice.defPrice.getSignValue(currency) needValue = value - money.getSignValue(currency) actionPercent = itemPrice.getActionPrc() if not self._item.isRentable: setting = CURRENCY_SETTINGS.getBuySetting forcedText = '' else: setting = CURRENCY_SETTINGS.getRentSetting forcedText = _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_INVENTORY_COST_RENT, battlesNum=self._item.rentCount) subBlocks.append(makePriceBlock(value, setting(currency), needValue if needValue > 0 else None, defValue if defValue > 0 else None, actionPercent, valueWidth=88, leftPadding=49, forcedText=forcedText)) if not self._item.isRentable: for itemPrice in self._item.sellPrices: currency = itemPrice.getCurrency() value = itemPrice.price.getSignValue(currency) defValue = itemPrice.defPrice.getSignValue(currency) actionPercent = itemPrice.getActionPrc() if actionPercent > 0: subBlocks.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(TOOLTIPS.ACTIONPRICE_SELL_BODY_SIMPLE), value=text_styles.concatStylesToSingleLine(text_styles.credits(BigWorld.wg_getIntegralFormat(value)), ' ', icons.credits()), icon='alertMedium', valueWidth=88, padding=formatters.packPadding(left=-5))) subBlocks.append(makePriceBlock(value, CURRENCY_SETTINGS.SELL_PRICE, oldPrice=defValue if defValue > 0 else None, percent=actionPercent, valueWidth=88, leftPadding=49)) inventoryCount = getInventoryCount(self._item) info = text_styles.concatStylesWithSpace(text_styles.stats(inventoryCount)) if self._item.isRentable and inventoryCount > 0 or not self._item.isRentable: title = text_styles.main(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_INVENTORY_RENT_BATTLESLEFT if self._item.isRentable else VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_INVENTORY_AVAILABLE) icon = RES_ICONS.MAPS_ICONS_LIBRARY_CLOCKICON_1 if self._item.isRentable else RES_ICONS.MAPS_ICONS_CUSTOMIZATION_STORAGE_ICON padding = formatters.packPadding(left=83, bottom=-14 if self._item.isRentable else 0) titlePadding = formatters.packPadding(left=-8 if self._item.isRentable else -1) iconPadding = formatters.packPadding(top=-7 if self._item.isRentable else -2, left=-3 if self._item.isRentable else -2) subBlocks.append(formatters.packTitleDescParameterWithIconBlockData(title=title, value=info, icon=icon, padding=padding, titlePadding=titlePadding, iconPadding=iconPadding)) return formatters.packBuildUpBlockData(blocks=subBlocks, gap=-1)
def _packWayToBuyBlock(self, data): subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(_ms('#vehicle_customization:customization/tooltip/wayToBuy/title')), padding={'bottom': 6})] for buyItem in data['buyItems']: buyItemDesc = text_styles.main(buyItem['desc']) if buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_MISSION: subBlocks.append(formatters.packImageTextBlockData(desc=buyItemDesc, img=RES_ICONS.MAPS_ICONS_LIBRARY_QUEST_ICON, imgPadding={'left': 53, 'top': 3}, txtGap=-4, txtOffset=73)) elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_FOREVER: if buyItem['isSale']: subBlocks.append(formatters.packSaleTextParameterBlockData(name=buyItemDesc, saleData={'newPrice': (0, buyItem['value'])}, padding={'left': 0})) else: price = text_styles.concatStylesWithSpace(text_styles.gold(BigWorld.wg_getIntegralFormat(long(buyItem['value']))), icons.gold()) subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70)) elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_TEMP: if buyItem['isSale']: subBlocks.append(formatters.packSaleTextParameterBlockData(name=buyItemDesc, saleData={'newPrice': (buyItem['value'], 0)}, padding={'left': 0})) else: price = text_styles.concatStylesWithSpace(text_styles.credits(BigWorld.wg_getIntegralFormat(long(buyItem['value']))), icons.credits()) subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70)) elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_IGR: subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=icons.premiumIgrSmall(), padding={'left': 0})) return formatters.packBuildUpBlockData(subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {'left': 3})
def _getCurrencyIconStr(self): """ Gets html credits icon :return: <str> """ return icons.credits()
def _packWayToBuyBlock(self, data): subBlocks = [ formatters.packTextBlockData(text=text_styles.middleTitle( _ms('#vehicle_customization:customization/tooltip/wayToBuy/title' )), padding={'bottom': 6}) ] for buyItem in data['buyItems']: buyItemDesc = text_styles.main(buyItem['desc']) if buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_MISSION: subBlocks.append( formatters.packImageTextBlockData( desc=buyItemDesc, img=RES_ICONS.MAPS_ICONS_LIBRARY_QUEST_ICON, imgPadding={ 'left': 53, 'top': 3 }, txtGap=-4, txtOffset=73)) elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_FOREVER: if buyItem['isSale']: subBlocks.append( formatters.packSaleTextParameterBlockData( name=buyItemDesc, saleData={'newPrice': (0, buyItem['value'])}, padding={'left': 0})) else: price = text_styles.concatStylesWithSpace( text_styles.gold( BigWorld.wg_getIntegralFormat( long(buyItem['value']))), icons.gold()) subBlocks.append( formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70)) elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_TEMP: if buyItem['isSale']: subBlocks.append( formatters.packSaleTextParameterBlockData( name=buyItemDesc, saleData={'newPrice': (buyItem['value'], 0)}, padding={'left': 0})) else: price = text_styles.concatStylesWithSpace( text_styles.credits( BigWorld.wg_getIntegralFormat( long(buyItem['value']))), icons.credits()) subBlocks.append( formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70)) elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_IGR: subBlocks.append( formatters.packTextParameterBlockData( name=buyItemDesc, value=icons.premiumIgrSmall(), padding={'left': 0})) return formatters.packBuildUpBlockData( subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {'left': 3})
def __setTotalData(self): notEnoughGoldTooltip = notEnoughCreditsTooltip = '' enoughGold = g_itemsCache.items.stats.gold >= self.__totalPrice['gold'] enoughCredits = g_itemsCache.items.stats.credits >= self.__totalPrice['credits'] buyEnabled = bool(self.__totalPrice['credits'] + self.__totalPrice['gold']) and enoughGold and enoughCredits if not enoughGold: diff = text_styles.gold(self.__totalPrice['gold'] - g_itemsCache.items.stats.gold) notEnoughGoldTooltip = makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold()))) if not enoughCredits: diff = text_styles.credits(self.__totalPrice['credits'] - g_itemsCache.items.stats.credits) notEnoughCreditsTooltip = makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits()))) self.as_setTotalDataS({'credits': formatPriceCredits(self.__totalPrice['credits']), 'gold': formatPriceGold(self.__totalPrice['gold']), 'totalLabel': text_styles.highTitle(_ms(CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST, selected=len(self.__searchDP.getSelected()), total=len(self.__searchDP.getTotal()))), 'buyEnabled': buyEnabled, 'enoughGold': enoughGold, 'enoughCredits': enoughCredits, 'notEnoughGoldTooltip': notEnoughGoldTooltip, 'notEnoughCreditsTooltip': notEnoughCreditsTooltip})
def __setBottomPanelData(self, *args): if self.__isCarouselHidden: occupiedSlotsNum, totalSlotsNum = self.__controller.slots.getSummary() label = text_styles.highTitle(_ms(VEHICLE_CUSTOMIZATION.TYPESWITCHSCREEN_SLOTSUMMARY, occupiedSlotsNum=occupiedSlotsNum, totalSlotsNum=totalSlotsNum)) else: label = text_styles.middleTitle(_ms('#vehicle_customization:typeSwitchScreen/typeName/plural/{0}'.format(self.__controller.slots.currentType))) totalGold = self.__controller.cart.totalPriceGold totalCredits = self.__controller.cart.totalPriceCredits notEnoughGoldTooltip = notEnoughCreditsTooltip = '' enoughGold = g_itemsCache.items.stats.gold >= totalGold enoughCredits = g_itemsCache.items.stats.credits >= totalCredits if not enoughGold: diff = text_styles.gold(totalGold - g_itemsCache.items.stats.gold) notEnoughGoldTooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold()))) if not enoughCredits: diff = text_styles.credits(totalCredits - g_itemsCache.items.stats.credits) notEnoughCreditsTooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits()))) self.as_setBottomPanelHeaderS({'newHeaderText': label, 'buyBtnLabel': _ms(MENU.CUSTOMIZATION_BUTTONS_APPLY, count=len(self.__controller.cart.items)), 'pricePanel': {'totalPriceCredits': formatPriceCredits(totalCredits), 'totalPriceGold': formatPriceGold(totalGold), 'enoughGold': enoughGold, 'enoughCredits': enoughCredits, 'notEnoughGoldTooltip': notEnoughGoldTooltip, 'notEnoughCreditsTooltip': notEnoughCreditsTooltip}})
def _getCurrencyIconStr(self): return icons.credits()
def __setBuyingPanelData(self): totalGold = g_customizationController.carousel.slots.cart.totalPriceGold totalCredits = g_customizationController.carousel.slots.cart.totalPriceCredits notEnoughGoldTooltip = notEnoughCreditsTooltip = '' enoughGold = g_itemsCache.items.stats.gold >= totalGold enoughCredits = g_itemsCache.items.stats.credits >= totalCredits if not enoughGold: diff = text_styles.gold(totalGold - g_itemsCache.items.stats.gold) notEnoughGoldTooltip = makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold()))) if not enoughCredits: diff = text_styles.credits(totalCredits - g_itemsCache.items.stats.credits) notEnoughCreditsTooltip = makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits()))) self.as_setBuyingPanelDataS({'totalPriceCredits': formatPriceCredits(totalCredits), 'totalPriceGold': formatPriceGold(totalGold), 'enoughGold': enoughGold, 'enoughCredits': enoughCredits, 'notEnoughGoldTooltip': notEnoughGoldTooltip, 'notEnoughCreditsTooltip': notEnoughCreditsTooltip})
def __setBottomPanelData(self): if self.__carouselHidden: label = g_customizationController.carousel.slots.getSummaryString() else: label = g_customizationController.carousel.slots.getCurrentTypeLabel() totalGold = g_customizationController.carousel.slots.cart.totalPriceGold totalCredits = g_customizationController.carousel.slots.cart.totalPriceCredits notEnoughGoldTooltip = notEnoughCreditsTooltip = '' enoughGold = g_itemsCache.items.stats.gold >= totalGold enoughCredits = g_itemsCache.items.stats.credits >= totalCredits if not enoughGold: diff = text_styles.gold(totalGold - g_itemsCache.items.stats.gold) notEnoughGoldTooltip = makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold()))) if not enoughCredits: diff = text_styles.credits(totalCredits - g_itemsCache.items.stats.credits) notEnoughCreditsTooltip = makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits()))) self.as_setBottomPanelHeaderS({'newHeaderText': label, 'buyBtnLabel': _ms(MENU.CUSTOMIZATION_BUTTONS_APPLY, count=len(g_customizationController.carousel.slots.cart.items)), 'pricePanel': {'totalPriceCredits': formatPriceCredits(totalCredits), 'totalPriceGold': formatPriceGold(totalGold), 'enoughGold': enoughGold, 'enoughCredits': enoughCredits, 'notEnoughGoldTooltip': notEnoughGoldTooltip, 'notEnoughCreditsTooltip': notEnoughCreditsTooltip}})
def _getCurrencyIconStr(self): return icons.credits()
def _getCurrencyIconStr(self): """ Gets html credits icon :return: <str> """ return icons.credits()