def _packBlocks(self, *args, **kwargs): self.item = self.context.buildItem(*args, **kwargs) items = super(BattleBoosterBlockTooltipData, self)._packBlocks() module = self.item statsConfig = self.context.getStatsConfiguration(module) statusConfig = self.context.getStatusConfiguration(module) paramsConfig = self.context.getParamsConfiguration(module) leftPadding = 20 rightPadding = 20 topPadding = 20 bottomPadding = -20 blockTopPadding = -4 blockPadding = formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding) textGap = -2 valueWidth = 110 items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(module, statsConfig, leftPadding, rightPadding).construct(), padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=topPadding, bottom=bottomPadding))) effectsBlock = EffectsBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct() if effectsBlock: items.append(formatters.packBuildUpBlockData(effectsBlock, padding=blockPadding, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)) if statsConfig.vehicle is not None and not module.isInstalled(statsConfig.vehicle): stockVehicle = self.itemsCache.items.getStockVehicle(statsConfig.vehicle.intCD) stockParams = params_helper.getParameters(stockVehicle) comparator = params_helper.artifactComparator(statsConfig.vehicle, module, statsConfig.slotIdx, True) simplifiedBlock = SimplifiedStatsBlockConstructor(module, paramsConfig, leftPadding, rightPadding, stockParams, comparator).construct() if len(simplifiedBlock) > 0: items.append(formatters.packBuildUpBlockData(simplifiedBlock, gap=textGap, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=-14, bottom=1), stretchBg=True)) if statsConfig.vehicle.equipment.battleBoosterConsumables[0] is not None: comparator = params_helper.artifactRemovedComparator(statsConfig.vehicle, module, statsConfig.slotIdx) simplifiedBlock = SimplifiedStatsBlockConstructor(module, paramsConfig, leftPadding, rightPadding, stockParams, comparator).construct() if len(simplifiedBlock) > 0: replaceBlock = BattleBoosterReplaceBlockConstructor(module, statsConfig, valueWidth, leftPadding).construct() if replaceBlock: items.append(formatters.packBuildUpBlockData(replaceBlock)) items.append(formatters.packBuildUpBlockData(simplifiedBlock, gap=textGap, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=-14, bottom=1), stretchBg=True)) priceBlock, invalidWidth = BattleBoosterPriceBlockConstructor(module, statsConfig, valueWidth, leftPadding, rightPadding).construct() if priceBlock: self._setWidth(_TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH) items.append(formatters.packBuildUpBlockData(priceBlock, padding=blockPadding, gap=textGap)) statusBlock = StatusBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct() if statusBlock: items.append(formatters.packBuildUpBlockData(statusBlock, padding=blockPadding)) boosterIsUseless = BoosterHasNoEffectBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct() if boosterIsUseless: items.append(formatters.packBuildUpBlockData(boosterIsUseless, gap=-4, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding, bottom=2), stretchBg=False)) return items
def _packBlocks(self, *args, **kwargs): self.item = self.context.buildItem(*args, **kwargs) items = super(ModuleBlockTooltipData, self)._packBlocks() module = self.item statsConfig = self.context.getStatsConfiguration(module) paramsConfig = self.context.getParamsConfiguration(module) statusConfig = self.context.getStatusConfiguration(module) leftPadding = 20 rightPadding = 20 topPadding = 20 blockTopPadding = -4 blockPadding = formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding) textGap = -2 valueWidth = 110 items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(module, statsConfig, leftPadding, rightPadding).construct(), padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=topPadding))) if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS: effectsBlock = EffectsBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct() if len(effectsBlock) > 0: items.append(formatters.packBuildUpBlockData(effectsBlock, padding=blockPadding, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)) priceBlock, invalidWidth = PriceBlockConstructor(module, statsConfig, valueWidth, leftPadding, rightPadding).construct() if len(priceBlock) > 0: self._setWidth(_TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH) items.append(formatters.packBuildUpBlockData(priceBlock, padding=blockPadding, gap=textGap)) if statsConfig.vehicle is not None and not module.isInstalled(statsConfig.vehicle): if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS: comparator = params_helper.artifactComparator(statsConfig.vehicle, module, statsConfig.slotIdx) else: comparator = params_helper.itemOnVehicleComparator(statsConfig.vehicle, module) stockParams = params_helper.getParameters(g_itemsCache.items.getStockVehicle(statsConfig.vehicle.intCD)) simplifiedBlock = SimplifiedStatsBlockConstructor(module, paramsConfig, leftPadding, rightPadding, stockParams, comparator).construct() if len(simplifiedBlock) > 0: items.append(formatters.packBuildUpBlockData(simplifiedBlock, gap=-4, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=-14, bottom=1), stretchBg=True)) statsModules = GUI_ITEM_TYPE.VEHICLE_MODULES + (GUI_ITEM_TYPE.OPTIONALDEVICE,) if module.itemTypeID in statsModules: commonStatsBlock = CommonStatsBlockConstructor(module, paramsConfig, statsConfig.slotIdx, valueWidth, leftPadding, rightPadding).construct() if len(commonStatsBlock) > 0: items.append(formatters.packBuildUpBlockData(commonStatsBlock, padding=blockPadding, gap=textGap)) if not module.isRemovable: items.append(formatters.packBuildUpBlockData(ArtefactBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct(), gap=-4, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_COMPLEX_BG_LINKAGE, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding, bottom=2), stretchBg=False)) statusBlock = StatusBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct() if len(statusBlock) > 0: items.append(formatters.packBuildUpBlockData(statusBlock, padding=blockPadding)) return items
def _packBlocks(self, *args, **kwargs): self.item = self.context.buildItem(*args, **kwargs) items = super(ModuleBlockTooltipData, self)._packBlocks() module = self.item statsConfig = self.context.getStatsConfiguration(module) paramsConfig = self.context.getParamsConfiguration(module) statusConfig = self.context.getStatusConfiguration(module) leftPadding = 20 rightPadding = 20 topPadding = 20 blockTopPadding = -4 blockPadding = formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding) textGap = -2 valueWidth = 110 items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(module, statsConfig, leftPadding, rightPadding).construct(), padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=topPadding))) if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS: effectsBlock = EffectsBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct() if len(effectsBlock) > 0: items.append(formatters.packBuildUpBlockData(effectsBlock, padding=blockPadding, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)) priceBlock, invalidWidth = PriceBlockConstructor(module, statsConfig, valueWidth, leftPadding, rightPadding).construct() if len(priceBlock) > 0: self._setWidth(_TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH) items.append(formatters.packBuildUpBlockData(priceBlock, padding=blockPadding, gap=textGap)) if statsConfig.vehicle is not None and not module.isInstalled(statsConfig.vehicle): if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS: comparator = params_helper.artifactComparator(statsConfig.vehicle, module, statsConfig.slotIdx) else: comparator = params_helper.itemOnVehicleComparator(statsConfig.vehicle, module) stockParams = params_helper.getParameters(g_itemsCache.items.getStockVehicle(statsConfig.vehicle.intCD)) simplifiedBlock = SimplifiedStatsBlockConstructor(module, paramsConfig, leftPadding, rightPadding, stockParams, comparator).construct() if len(simplifiedBlock) > 0: items.append(formatters.packBuildUpBlockData(simplifiedBlock, gap=-4, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=-14, bottom=1), stretchBg=True)) statsModules = GUI_ITEM_TYPE.VEHICLE_MODULES + (GUI_ITEM_TYPE.OPTIONALDEVICE,) if module.itemTypeID in statsModules: commonStatsBlock = CommonStatsBlockConstructor(module, paramsConfig, statsConfig.slotIdx, valueWidth, leftPadding, rightPadding).construct() if len(commonStatsBlock) > 0: items.append(formatters.packBuildUpBlockData(commonStatsBlock, padding=blockPadding, gap=textGap)) if not module.isRemovable: items.append(formatters.packBuildUpBlockData(ArtefactBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct(), gap=-4, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_COMPLEX_BG_LINKAGE, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding, bottom=2), stretchBg=False)) statusBlock = StatusBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct() if len(statusBlock) > 0: items.append(formatters.packBuildUpBlockData(statusBlock, padding=blockPadding)) return items
def _packBlocks(self, *args, **kwargs): self.item = self.context.buildItem(*args, **kwargs) items = super(ModuleBlockTooltipData, self)._packBlocks() module = self.item statsConfig = self.context.getStatsConfiguration(module) paramsConfig = self.context.getParamsConfiguration(module) statusConfig = self.context.getStatusConfiguration(module) leftPadding = 20 rightPadding = 20 topPadding = 20 blockTopPadding = -4 blockPadding = formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding) textGap = -2 valueWidth = 110 items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(module, statsConfig, leftPadding, rightPadding).construct(), padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=topPadding))) effectsItems = [] replaceItems = [] if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS: if module.itemTypeID == GUI_ITEM_TYPE.EQUIPMENT: cooldownSeconds = module.descriptor.cooldownSeconds if cooldownSeconds > 0: items.append(formatters.packTextParameterBlockData(name=params_formatters.formatModuleParamName('cooldownSeconds'), value=text_styles.stats(int(cooldownSeconds)), valueWidth=valueWidth, padding=formatters.packPadding(left=leftPadding))) effectsBlock = EffectsBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct() if effectsBlock: effectsItems.append(formatters.packBuildUpBlockData(effectsBlock)) if statsConfig.vehicle is not None and not module.isInstalled(statsConfig.vehicle): if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS: comparator = params_helper.artifactComparator(statsConfig.vehicle, module, statsConfig.slotIdx, True) else: comparator = params_helper.itemOnVehicleComparator(statsConfig.vehicle, module) stockParams = params_helper.getParameters(self.itemsCache.items.getStockVehicle(statsConfig.vehicle.intCD)) currentOptDev = None if module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE: if statsConfig.vehicle.descriptor.optionalDevices[statsConfig.slotIdx] is not None: compactDescr = statsConfig.vehicle.descriptor.optionalDevices[statsConfig.slotIdx].compactDescr currentOptDev = self.itemsFactory.createOptionalDevice(compactDescr) if currentOptDev is not None and not module.isSimilarDevice(currentOptDev) or currentOptDev is None and module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE or module.itemTypeID == GUI_ITEM_TYPE.EQUIPMENT: simplifiedBlock = SimplifiedStatsBlockConstructor(module, paramsConfig, leftPadding, rightPadding, stockParams, comparator).construct() if simplifiedBlock: effectsItems.append(formatters.packBuildUpBlockData(simplifiedBlock, gap=-4, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=-3, bottom=1))) if statsConfig.vehicle.optDevices[statsConfig.slotIdx]: if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS: if currentOptDev is not None and module.isSimilarDevice(currentOptDev): comparator = params_helper.artifactComparator(statsConfig.vehicle, module, statsConfig.slotIdx, False) else: comparator = params_helper.artifactRemovedComparator(statsConfig.vehicle, self.item, statsConfig.slotIdx) simplifiedBlock = SimplifiedStatsBlockConstructor(module, paramsConfig, leftPadding, rightPadding, stockParams, comparator).construct() if simplifiedBlock: replaceBlock = ModuleReplaceBlockConstructor(module, statsConfig, valueWidth, leftPadding).construct() if replaceBlock: replaceItems.append(formatters.packBuildUpBlockData(replaceBlock)) replaceItems.append(formatters.packBuildUpBlockData(simplifiedBlock, gap=-4, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=2, bottom=1))) if effectsItems: items.append(formatters.packBuildUpBlockData(effectsItems, padding=blockPadding, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, stretchBg=True)) if replaceItems: items.append(formatters.packBuildUpBlockData(replaceItems, gap=-4, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=blockPadding, stretchBg=True)) priceBlock, invalidWidth = PriceBlockConstructor(module, statsConfig, valueWidth, leftPadding, rightPadding).construct() if priceBlock: self._setWidth(_TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH) items.append(formatters.packBuildUpBlockData(priceBlock, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=-1, bottom=-3), gap=textGap)) statsModules = GUI_ITEM_TYPE.VEHICLE_MODULES + (GUI_ITEM_TYPE.OPTIONALDEVICE,) if module.itemTypeID in statsModules: commonStatsBlock = CommonStatsBlockConstructor(module, paramsConfig, statsConfig.slotIdx, valueWidth, leftPadding, rightPadding, params_formatters.BASE_SCHEME).construct() if commonStatsBlock: items.append(formatters.packBuildUpBlockData(commonStatsBlock, padding=blockPadding, gap=textGap)) statusBlock = StatusBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct() if statusBlock: items.append(formatters.packBuildUpBlockData(statusBlock, padding=blockPadding)) if bonus_helper.isSituationalBonus(module.name): items.append(formatters.packImageTextBlockData(title='', desc=text_styles.standard(TOOLTIPS.VEHICLEPARAMS_BONUS_SITUATIONAL), img=RES_ICONS.MAPS_ICONS_TOOLTIP_ASTERISK_OPTIONAL, imgPadding=formatters.packPadding(left=4, top=3), txtGap=-4, txtOffset=20, padding=formatters.packPadding(left=59, right=20))) if module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE and statsConfig.vehicle is not None and not module.isInstalled(statsConfig.vehicle) and module.hasSimilarDevicesInstalled(statsConfig.vehicle): items.append(formatters.packBuildUpBlockData(SimilarOptionalDeviceBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct(), gap=-4, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding, bottom=2), stretchBg=False)) return items