def _packSuitableBlock(self): customizationTypes = (GUI_ITEM_TYPE.PAINT, GUI_ITEM_TYPE.CAMOUFLAGE, GUI_ITEM_TYPE.MODIFICATION) isItemInStyle = self._item.isStyleOnly or self._item.intCD in getBaseStyleItems( ) isItemHidden = self._item.isHidden mustNotHave = self._item.itemTypeID in customizationTypes mayHave = self._item.itemTypeID in GUI_ITEM_TYPE.CUSTOMIZATIONS and self._item.itemTypeID not in customizationTypes if mustNotHave and (isItemHidden or isItemInStyle ) or mayHave and isItemHidden and isItemInStyle: return None elif self._item.isProgressive and self._item.isProgressionAutoBound or ItemTags.NATIONAL_EMBLEM in self._item.tags: return formatters.packTitleDescBlock( title=text_styles.middleTitle( VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_SUITABLE_TITLE ), desc=text_styles.main(self.__vehicle.shortUserName), padding=formatters.packPadding(top=-2)) elif self._item.isVehicleBound and not self._item.mayApply: return formatters.packTitleDescBlock( title=text_styles.middleTitle( VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_SUITABLE_TITLE ), desc=text_styles.main( makeVehiclesShortNamesString( self.boundVehs | self.installedVehs, self.__vehicle)), padding=formatters.packPadding(top=-2)) elif not self._item.descriptor.filter or not self._item.descriptor.filter.include: return formatters.packTitleDescBlock( title=text_styles.middleTitle( VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_SUITABLE_TITLE ), desc=text_styles.main( backport.text( R.strings.vehicle_customization.customization.tooltip. suitable.text.allVehicle())), padding=formatters.packPadding(top=-2)) else: blocks = [] icn = getSuitableText(self._item, self.__vehicle) blocks.append( formatters.packTextBlockData( text=icn, padding=formatters.packPadding(top=-2))) blocks.insert( 0, formatters.packTitleDescBlock(title=text_styles.middleTitle( VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_SUITABLE_TITLE) )) return formatters.packBuildUpBlockData( blocks=blocks, padding=formatters.packPadding(top=-3))
def refresh(self): if not g_currentVehicle.isPresent(): return super(CustomizationCarouselDataProvider, self).refresh() self.__baseStyleItems = getBaseStyleItems()
def _packItemBlocks(self, statsConfig): vehIntCD = self.__vehicle.intCD if self.__vehicle is not None else 0 self.bonusDescription = VEHICLE_CUSTOMIZATION.BONUS_CONDITION_SEASON topBlocks = [ self._packTitleBlock(), self._packIconBlock(self._item.isHistorical(), self._item.isDim()) ] items = [formatters.packBuildUpBlockData(blocks=topBlocks, gap=10)] self.boundVehs = self._item.getBoundVehicles() self.installedVehs = self._item.getInstalledVehicles() self.installedCount = self._item.installedCount( vehIntCD) if vehIntCD else 0 isItemInStyle = self._item.isStyleOnly or self._item.intCD in getBaseStyleItems( ) if self._item.isProgressive: progressBlock = self._packProgressBlock() if progressBlock is not None: items.append(progressBlock) if self._showOnlyProgressBlock and self._progressionLevel > 0: block = self._packCharacteristicsBlock() if block: items.append(block) suitableBlock = self._packSuitableBlock() if suitableBlock is not None: items.append(suitableBlock) block = self._packUnsupportedBlock() if block is not None: items.append(block) progressStateBlock = self._packProgressStateBlock() if progressStateBlock is not None: items.append(progressStateBlock) return items camo = None self._appliedCount = 0 bonusEnabled = False bonus = None if self._item.itemTypeID != GUI_ITEM_TYPE.STYLE: bonus = self._item.bonus if self.__ctx is not None: self._appliedCount = self.__ctx.mode.getItemAppliedCount( self._item) hullContainer = self.__ctx.mode.currentOutfit.hull bonusEnabled = hullContainer.slotFor( GUI_ITEM_TYPE.CAMOUFLAGE).getItemCD() == self._item.intCD elif self.__vehicle is not None: self.bonusDescription = VEHICLE_CUSTOMIZATION.BONUS_STYLE vehicleCD = self.__vehicle.descriptor.makeCompactDescr() for season in SeasonType.COMMON_SEASONS: hullContainer = self._item.getOutfit(season, vehicleCD=vehicleCD).hull intCD = hullContainer.slotFor( GUI_ITEM_TYPE.CAMOUFLAGE).getItemCD() if intCD: camo = self.service.getItemByCD(intCD) if camo.bonus: bonus = camo.bonus break if self.__ctx is not None: currentStyleDesc = self.__ctx.mode.currentOutfit.style isApplied = currentStyleDesc is not None and self._item.id == currentStyleDesc.id bonusEnabled = bonus is not None and isApplied self._appliedCount = int(isApplied) if bonus and statsConfig.showBonus: camo = camo or self._item items.append(self._packBonusBlock(bonus, camo, bonusEnabled)) if not self._item.isHistorical() or self._item.fullDescription: block = self._packDescriptionBlock() if block: items.append(block) block = self._packCharacteristicsBlock() if block: items.append(block) if statsConfig.buyPrice or statsConfig.sellPrice or statsConfig.inventoryCount: inventoryBlocks = self._packInventoryBlock( statsConfig.buyPrice, statsConfig.sellPrice, statsConfig.inventoryCount) if inventoryBlocks['data']['blocksData']: items.append(inventoryBlocks) if not self._item.isUnlocked: items.append(self._packLockedBlock()) block = self._packSuitableBlock() if block: items.append(block) if not self._item.isVehicleBound and ( self._item.isHidden or self._item.isLimited) and not isItemInStyle: block = self._packAppliedBlock() if block: items.append(block) if self._item.isVehicleBound or self._item.isLimited and not isItemInStyle: block = self._packSpecialBlock() if block is not None: items.append(block) block = self._packUnsupportedBlock() if block is not None: items.append(block) return items
def __getBaseStyleItems(self): return getBaseStyleItems()