示例#1
0
 def construct(self):
     block = []
     if self.configuration.crew:
         totalCrewSize = len(self.vehicle.descriptor.type.crewRoles)
         if self.configuration.externalCrewParam and self._roleLevel is not None:
             block.append(
                 formatters.packTextParameterBlockData(
                     name=text_styles.main(_ms(TOOLTIPS.VEHICLE_CREW_AWARD, self._roleLevel)),
                     value=text_styles.stats(str(totalCrewSize)),
                     valueWidth=self._valueWidth,
                     padding=formatters.packPadding(left=-2),
                 )
             )
         elif self.vehicle.isInInventory and not self.configuration.externalCrewParam:
             currentCrewSize = len([x for _, x in self.vehicle.crew if x is not None])
             currentCrewSizeStr = str(currentCrewSize)
             if currentCrewSize < totalCrewSize:
                 currentCrewSizeStr = text_styles.error(currentCrewSizeStr)
             block.append(self._makeStatBlock(currentCrewSizeStr, totalCrewSize, TOOLTIPS.VEHICLE_CREW))
         else:
             block.append(
                 formatters.packTextParameterBlockData(
                     name=text_styles.main(_ms(TOOLTIPS.VEHICLE_CREW)),
                     value=text_styles.stats(str(totalCrewSize)),
                     valueWidth=self._valueWidth,
                     padding=formatters.packPadding(left=-2),
                 )
             )
     lockBlock = self._makeLockBlock()
     if lockBlock is not None:
         block.append(lockBlock)
     return block
示例#2
0
    def _packAlreadyHaveBlock(self, item):
        subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_ALREADYHAVE_TITLE)), padding={'bottom': 6})]
        padding = {'left': 10}
        for buyItem in item['buyItems']:
            buyItemDesc = text_styles.main(buyItem['desc'])
            if buyItem['type'] == BUY_ITEM_TYPE.ALREADY_HAVE_IGR:
                subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=icons.premiumIgrSmall(), padding=padding))
            else:
                subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value='', padding=padding))

        return formatters.packBuildUpBlockData(subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {'left': 3})
示例#3
0
    def _packAlreadyHaveBlock(self, data):
        subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(_ms('#vehicle_customization:customization/tooltip/alreadyHave/title')), padding={'bottom': 6})]
        padding = {'left': 10}
        for buyItem in data['buyItems']:
            buyItemDesc = text_styles.main(buyItem['desc'])
            if buyItem['type'] == BUY_ITEM_TYPE.ALREADY_HAVE_IGR:
                subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=icons.premiumIgrSmall(), padding=padding))
            else:
                subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value='', padding=padding))

        return formatters.packBuildUpBlockData(subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {'left': 3})
示例#4
0
    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}
        )
示例#5
0
 def construct(self):
     block = []
     shell = self.shell
     configuration = self.configuration
     buyPrice = configuration.buyPrice
     sellPrice = configuration.sellPrice
     if buyPrice and sellPrice:
         LOG_ERROR('You are not allowed to use buyPrice and sellPrice at the same time')
         return
     else:
         creditsNeeded, goldNeeded = (0, 0)
         if buyPrice:
             credits, gold = g_itemsCache.items.stats.money
             price = shell.altPrice
             creditsNeeded = price[0] - credits if price[0] else 0
             goldNeeded = price[1] - gold if price[1] else 0
             need = (max(0, creditsNeeded), max(0, goldNeeded))
             defPrice = shell.defaultAltPrice or shell.defaultPrice
             block.append(self._makePriceBlock(price[0], 'buyCreditsPrice', need[0] if need[0] > 0 else None, defPrice[0] if defPrice[0] > 0 else None, percent=shell.actionPrc))
             if price[1] > 0:
                 block.append(formatters.packTextBlockData(text=text_styles.standard(TOOLTIPS.VEHICLE_TEXTDELIMITER_OR), padding=formatters.packPadding(left=81 + self.leftPadding)))
                 block.append(self._makePriceBlock(price[1], 'buyGoldPrice', need[1] if need[1] > 0 else None, defPrice[1] if defPrice[1] > 0 else None, percent=shell.actionPrc))
         if sellPrice:
             block.append(self._makePriceBlock(shell.sellPrice[0], 'sellPrice', oldPrice=shell.defaultSellPrice[0], percent=shell.sellActionPrc))
         inventoryCount = shell.inventoryCount
         if inventoryCount:
             block.append(formatters.packTextParameterBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_INVENTORYCOUNT), value=text_styles.stats(inventoryCount), valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5)))
         notEnoughMoney = creditsNeeded > 0 or goldNeeded > 0
         hasAction = shell.actionPrc > 0 or shell.sellActionPrc > 0
         return (block, notEnoughMoney or hasAction)
示例#6
0
 def construct(self):
     block = []
     shell = self.shell
     configuration = self.configuration
     buyPrice = configuration.buyPrice
     sellPrice = configuration.sellPrice
     if buyPrice and sellPrice:
         LOG_ERROR('You are not allowed to use buyPrice and sellPrice at the same time')
         return
     else:
         need = ZERO_MONEY
         if buyPrice:
             money = g_itemsCache.items.stats.money
             price = shell.altPrice
             need = price - money
             need = need.toNonNegative()
             defPrice = shell.defaultAltPrice or shell.defaultPrice
             block.append(makePriceBlock(price.credits, CURRENCY_SETTINGS.BUY_CREDITS_PRICE, need.credits if need.credits > 0 else None, defPrice.credits if defPrice.credits > 0 else None, percent=shell.actionPrc, valueWidth=self._valueWidth))
             if price.gold > 0:
                 block.append(formatters.packTextBlockData(text=text_styles.standard(TOOLTIPS.VEHICLE_TEXTDELIMITER_OR), padding=formatters.packPadding(left=81 + self.leftPadding)))
                 block.append(makePriceBlock(price.gold, CURRENCY_SETTINGS.BUY_GOLD_PRICE, need.gold if need.gold > 0 else None, defPrice.gold if defPrice.gold > 0 else None, percent=shell.actionPrc, valueWidth=self._valueWidth))
         if sellPrice:
             block.append(makePriceBlock(shell.sellPrice.credits, CURRENCY_SETTINGS.SELL_PRICE, oldPrice=shell.defaultSellPrice.credits, percent=shell.sellActionPrc, valueWidth=self._valueWidth))
         inventoryCount = shell.inventoryCount
         if inventoryCount:
             block.append(formatters.packTextParameterBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_INVENTORYCOUNT), value=text_styles.stats(inventoryCount), valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5)))
         notEnoughMoney = need > ZERO_MONEY
         hasAction = shell.actionPrc > 0 or shell.sellActionPrc > 0
         return (block, notEnoughMoney or hasAction)
示例#7
0
    def _packBonusBlock(self, customizationTypeData, title):
        subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(_ms(title)), padding={'bottom': 2})]
        for bonus in customizationTypeData:
            bonusPartDescription = text_styles.main(bonus['title'])
            if bonus['isTemporarily']:
                bonusPartDescription += '\n' + text_styles.standard('*' + bonus['description'])
            subBlocks.append(formatters.packTextParameterBlockData(name=bonusPartDescription, value=bonus['power'], padding={'bottom': 8}, valueWidth=45))

        return formatters.packBuildUpBlockData(subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {'left': 3})
示例#8
0
 def pack(self, data):
     items = super(LinerItemPacker, self).pack(data)
     values = data.get('values', None)
     discript = data.get('discript', None)
     if values is not None and discript is not None:
         blocks = [formatters.packTextParameterBlockData(discript, values)]
         blockToInsert = formatters.packBuildUpBlockData(blocks)
         items.append(blockToInsert)
     return items
示例#9
0
    def construct(self):
        params = self.configuration.params
        vehicleCommonParams = dict(ItemsParameters.g_instance.getParameters(self.vehicle.descriptor))
        vehicleRawParams = dict(ParametersCache.g_instance.getParameters(self.vehicle.descriptor))
        block = [formatters.packTitleDescBlock(text_styles.middleTitle(_ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)), padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding, bottom=8))]
        if params:
            for paramName in self.PARAMS.get(self.vehicle.type, 'default'):
                if paramName in vehicleCommonParams or paramName in vehicleRawParams:
                    param = self._getParameterValue(paramName, vehicleCommonParams, vehicleRawParams)
                    block.append(formatters.packTextParameterBlockData(name=text_styles.main(param[0]), value=text_styles.stats(param[1]), valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding)))

        return block
示例#10
0
    def construct(self):
        module = self.module
        vehicle = self.configuration.vehicle
        params = self.configuration.params
        block = []
        vDescr = vehicle.descriptor if vehicle is not None else None
        moduleParams = dict(params_helper.getParameters(module, vDescr))
        paramsKeyName = module.itemTypeID
        if params:
            reloadingType = None
            if module.itemTypeID == GUI_ITEM_TYPE.GUN:
                reloadingType = module.getReloadingType(vehicle.descriptor if vehicle is not None else None)
            if reloadingType == GUN_CLIP:
                paramsKeyName = self.CLIP_GUN_MODULE_PARAM
            paramsList = self.MODULE_PARAMS.get(paramsKeyName, [])
            if vehicle is not None:
                if module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE:
                    currModule = module
                else:
                    currModuleDescr, _ = vehicle.descriptor.getComponentsByType(module.itemTypeName)
                    currModule = g_itemsCache.items.getItemByCD(currModuleDescr['compactDescr'])
                comparator = params_helper.itemsComparator(module, currModule, vehicle.descriptor)
                for paramName in paramsList:
                    if paramName in moduleParams:
                        paramInfo = comparator.getExtendedData(paramName)
                        fmtValue = params_formatters.colorizedFormatParameter(paramInfo, params_formatters.BASE_FORMATTERS)
                        if fmtValue is not None:
                            block.append(formatters.packTextParameterBlockData(name=params_formatters.formatModuleParamName(paramName), value=fmtValue, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5)))

            else:
                formattedModuleParameters = params_formatters.getFormattedParamsList(module.descriptor, moduleParams)
                for paramName, paramValue in formattedModuleParameters:
                    if paramName in paramsList and paramValue is not None:
                        block.append(formatters.packTextParameterBlockData(name=params_formatters.formatModuleParamName(paramName), value=paramValue, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5)))

        if len(block) > 0:
            block.insert(0, formatters.packTextBlockData(text_styles.middleTitle(_ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)), padding=formatters.packPadding(bottom=8)))
        return block
示例#11
0
    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})
示例#12
0
    def _packBonusBlock(self, customizationTypeData, title):
        subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(_ms(title)), padding={"bottom": 2})]
        for bonus in customizationTypeData:
            bonusPartDescription = text_styles.main(bonus["title"])
            if bonus["isTemporarily"]:
                bonusPartDescription += "\n" + text_styles.standard("*" + bonus["description"])
            subBlocks.append(
                formatters.packTextParameterBlockData(
                    name=bonusPartDescription, value=bonus["power"], padding={"bottom": 8}, valueWidth=45
                )
            )

        return formatters.packBuildUpBlockData(
            subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {"left": 3}
        )
示例#13
0
    def construct(self):
        paramsDict = dict(params_helper.getParameters(self.vehicle))
        block = []
        comparator = params_helper.idealCrewComparator(self.vehicle)
        if self.configuration.params:
            for paramName in self.PARAMS.get(self.vehicle.type, 'default'):
                if paramName in paramsDict:
                    paramInfo = comparator.getExtendedData(paramName)
                    fmtValue = param_formatter.colorizedFormatParameter(paramInfo, param_formatter.BASE_FORMATTERS)
                    if fmtValue is not None:
                        block.append(formatters.packTextParameterBlockData(name=param_formatter.formatVehicleParamName(paramName), value=fmtValue, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-1)))

        if len(block) > 0:
            title = text_styles.middleTitle(TOOLTIPS.VEHICLEPARAMS_COMMON_TITLE)
            block.insert(0, formatters.packTextBlockData(title, padding=formatters.packPadding(bottom=8)))
        return block
示例#14
0
 def construct(self):
     crew = self.configuration.crew
     eqs = self.configuration.eqs
     devices = self.configuration.devices
     isInInventory = self.vehicle.isInInventory
     block = []
     if crew:
         totalCrewSize = len(self.vehicle.descriptor.type.crewRoles)
         if isInInventory:
             currentCrewSize = len([ x for _, x in self.vehicle.crew if x is not None ])
             block.append(self._makeStatBlock(currentCrewSize, totalCrewSize, TOOLTIPS.VEHICLE_CREW))
         else:
             block.append(formatters.packTextParameterBlockData(name=text_styles.main(_ms(TOOLTIPS.VEHICLE_CREW)), value=text_styles.stats(str(totalCrewSize)), valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding)))
     if eqs:
         block.append(self._makeStatBlock(len([ x for x in self.vehicle.eqs if x ]), len(self.vehicle.eqs), TOOLTIPS.VEHICLE_EQUIPMENTS))
     if devices:
         block.append(self._makeStatBlock(len([ x for x in self.vehicle.descriptor.optionalDevices if x ]), len(self.vehicle.descriptor.optionalDevices), TOOLTIPS.VEHICLE_DEVICES))
     lockBlock = self._makeLockBlock()
     if lockBlock is not None:
         block.append(lockBlock)
     return block
示例#15
0
    def construct(self):
        module = self.module
        vehicle = self.configuration.vehicle
        params = self.configuration.params
        block = []
        vDescr = vehicle.descriptor if vehicle is not None else None
        moduleParams = params_helper.getParameters(module, vDescr)
        paramsKeyName = module.itemTypeID
        if params:
            reloadingType = None
            if module.itemTypeID == GUI_ITEM_TYPE.GUN:
                reloadingType = module.getReloadingType(
                    vehicle.descriptor if vehicle is not None else None)
            if reloadingType == GUN_CLIP:
                paramsKeyName = self.CLIP_GUN_MODULE_PARAM
            paramsList = self.MODULE_PARAMS.get(paramsKeyName, [])
            if vehicle is not None:
                if module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE:
                    currModule = module
                else:
                    currModuleDescr, _ = vehicle.descriptor.getComponentsByType(
                        module.itemTypeName)
                    currModule = self.itemsCache.items.getItemByCD(
                        currModuleDescr.compactDescr)
                comparator = params_helper.itemsComparator(
                    module, currModule, vehicle.descriptor)
                for paramName in paramsList:
                    if paramName in moduleParams:
                        paramInfo = comparator.getExtendedData(paramName)
                        fmtValue = params_formatters.colorizedFormatParameter(
                            paramInfo, self.__colorScheme)
                        if fmtValue is not None:
                            block.append(
                                formatters.packTextParameterBlockData(
                                    name=params_formatters.
                                    formatModuleParamName(paramName),
                                    value=fmtValue,
                                    valueWidth=self._valueWidth,
                                    padding=formatters.packPadding(left=-5)))

            else:
                formattedModuleParameters = params_formatters.getFormattedParamsList(
                    module.descriptor, moduleParams)
                for paramName, paramValue in formattedModuleParameters:
                    if paramName in paramsList and paramValue is not None:
                        block.append(
                            formatters.packTextParameterBlockData(
                                name=params_formatters.formatModuleParamName(
                                    paramName),
                                value=paramValue,
                                valueWidth=self._valueWidth,
                                padding=formatters.packPadding(left=-5)))

        if len(block) > 0:
            block.insert(
                0,
                formatters.packTextBlockData(
                    text_styles.middleTitle(
                        _ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)),
                    padding=formatters.packPadding(bottom=8)))
        return block
示例#16
0
 def __packParameterBloc(self, name, value, measureUnits):
     return formatters.packTextParameterBlockData(
         name=text_styles.main(name) + text_styles.standard(measureUnits),
         value=text_styles.stats(value),
         valueWidth=self._valueWidth,
         padding=formatters.packPadding(left=-5))
示例#17
0
 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 len(effectsBlock) > 0:
             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))
         if module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE and not module.hasSimilarDevicesInstalled(
                 statsConfig.vehicle
         ) or module.itemTypeID == GUI_ITEM_TYPE.EQUIPMENT:
             simplifiedBlock = SimplifiedStatsBlockConstructor(
                 module, paramsConfig, leftPadding, rightPadding,
                 stockParams, comparator).construct()
             if len(simplifiedBlock) > 0:
                 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:
                 comparator = params_helper.artifactRemovedComparator(
                     statsConfig.vehicle, module, statsConfig.slotIdx)
             simplifiedBlock = SimplifiedStatsBlockConstructor(
                 module, paramsConfig, leftPadding, rightPadding,
                 stockParams, comparator).construct()
             if len(simplifiedBlock) > 0:
                 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 len(effectsItems) > 0:
         items.append(
             formatters.packBuildUpBlockData(
                 effectsItems,
                 padding=blockPadding,
                 linkage=BLOCKS_TOOLTIP_TYPES.
                 TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
                 stretchBg=True))
     if len(replaceItems) > 0:
         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 len(priceBlock) > 0:
         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 len(commonStatsBlock) > 0:
             items.append(
                 formatters.packBuildUpBlockData(commonStatsBlock,
                                                 padding=blockPadding,
                                                 gap=textGap))
     statusBlock = StatusBlockConstructor(module, statusConfig, leftPadding,
                                          rightPadding).construct()
     if len(statusBlock) > 0:
         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
示例#18
0
 def _getInventoryBlock(self, count):
     return formatters.packTextParameterBlockData(
         name=text_styles.main(TOOLTIPS.VEHICLE_INVENTORYCOUNT),
         value=text_styles.stats(count),
         valueWidth=self._valueWidth,
         padding=formatters.packPadding(left=-5))
示例#19
0
 def extendBlocks(cls, blocks, curEq, compareEq, eqsRange, param, title, higherIsBetter=True):
     values, deltas, _ = cls._getDisplayParams(curEq, compareEq, eqsRange, param)
     blocks.append(formatters.packTextParameterBlockData(name=text_styles.middleTitle(title), value=cls._formatDeltaString(deltas, [ value + delta for value, delta in zip(values, deltas) ], higherIsBetter), padding=formatters.packPadding(left=0, top=0), valueWidth=85))
示例#20
0
    def construct(self):
        block = []
        module = self.module
        slotIdx = self.configuration.slotIdx
        vehicle = self.configuration.vehicle
        sellPrice = self.configuration.sellPrice
        buyPrice = self.configuration.buyPrice
        unlockPrice = self.configuration.unlockPrice
        inventoryCount = self.configuration.inventoryCount
        vehiclesCount = self.configuration.vehiclesCount
        researchNode = self.configuration.node
        if buyPrice and sellPrice:
            LOG_ERROR(
                'You are not allowed to use buyPrice and sellPrice at the same time'
            )
            return
        else:

            def checkState(state):
                if researchNode is not None:
                    return bool(int(researchNode.state) & state)
                else:
                    return False

            isEqOrDev = module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS
            isNextToUnlock = checkState(NODE_STATE_FLAGS.NEXT_2_UNLOCK)
            isInstalled = checkState(NODE_STATE_FLAGS.INSTALLED)
            isInInventory = checkState(NODE_STATE_FLAGS.IN_INVENTORY)
            isUnlocked = checkState(NODE_STATE_FLAGS.UNLOCKED)
            isAutoUnlock = checkState(NODE_STATE_FLAGS.AUTO_UNLOCKED)
            items = self.itemsCache.items
            money = items.stats.money
            itemPrice = MONEY_UNDEFINED
            if module is not None:
                itemPrice = module.buyPrices.itemPrice.price
            isMoneyEnough = money >= itemPrice
            leftPadding = 92
            if unlockPrice and not isEqOrDev:
                parentCD = vehicle.intCD if vehicle is not None else None
                isAvailable, cost, need = getUnlockPrice(
                    module.intCD, parentCD)
                neededValue = None
                if not isUnlocked and isNextToUnlock and need > 0:
                    neededValue = need
                if cost > 0:
                    block.append(
                        makePriceBlock(cost,
                                       CURRENCY_SETTINGS.UNLOCK_PRICE,
                                       neededValue,
                                       leftPadding=leftPadding,
                                       valueWidth=self._valueWidth))
            notEnoughMoney = False
            hasAction = False
            if buyPrice and not isAutoUnlock:
                shop = self.itemsCache.items.shop
                money = self.itemsCache.items.stats.money
                rootInInv = vehicle is not None and vehicle.isInInventory
                if researchNode:
                    showNeeded = rootInInv and not isMoneyEnough and (
                        isNextToUnlock
                        or isUnlocked) and not (isInstalled or isInInventory)
                else:
                    isModuleUnlocked = module.isUnlocked
                    isModuleInInventory = module.isInInventory
                    showNeeded = not isModuleInInventory and isModuleUnlocked
                showDelimiter = False
                leftPadding = 92
                for itemPrice in module.buyPrices.iteritems(directOrder=False):
                    if not isItemBuyPriceAvailable(module, itemPrice, shop):
                        continue
                    currency = itemPrice.getCurrency()
                    value = itemPrice.price.getSignValue(currency)
                    defValue = itemPrice.defPrice.getSignValue(currency)
                    actionPercent = itemPrice.getActionPrc()
                    if isEqOrDev or showNeeded:
                        needValue = value - money.getSignValue(currency)
                        if needValue > 0:
                            notEnoughMoney = True
                        else:
                            needValue = None
                    else:
                        needValue = None
                    if currency == Currency.GOLD and actionPercent > 0:
                        leftActionPadding = 101 + self.leftPadding
                    else:
                        leftActionPadding = 81 + self.leftPadding
                    if actionPercent > 0:
                        hasAction = True
                    if showDelimiter:
                        block.append(
                            formatters.packTextBlockData(
                                text=text_styles.standard(
                                    TOOLTIPS.VEHICLE_TEXTDELIMITER_OR),
                                padding=formatters.packPadding(
                                    left=leftActionPadding)))
                    block.append(
                        makePriceBlock(
                            value,
                            CURRENCY_SETTINGS.getBuySetting(currency),
                            needValue,
                            defValue if defValue > 0 else None,
                            actionPercent,
                            valueWidth=self._valueWidth,
                            leftPadding=leftPadding))
                    showDelimiter = True

            if sellPrice and module.sellPrices:
                block.append(
                    makePriceBlock(
                        module.sellPrices.itemPrice.price.credits,
                        CURRENCY_SETTINGS.SELL_PRICE,
                        oldPrice=module.sellPrices.itemPrice.defPrice.credits,
                        percent=module.sellPrices.itemPrice.getActionPrc(),
                        valueWidth=self._valueWidth,
                        leftPadding=leftPadding))
            if inventoryCount:
                count = module.inventoryCount
                if count > 0:
                    block.append(self._getInventoryBlock(count))
            if vehiclesCount:
                inventoryVehicles = items.getVehicles(REQ_CRITERIA.INVENTORY)
                count = len(
                    module.getInstalledVehicles(
                        inventoryVehicles.itervalues()))
                if count > 0:
                    block.append(
                        formatters.packTextParameterBlockData(
                            name=text_styles.main(
                                TOOLTIPS.VEHICLE_VEHICLECOUNT),
                            value=text_styles.stats(count),
                            valueWidth=self._valueWidth,
                            padding=formatters.packPadding(left=-5)))
            isOptionalDevice = module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE
            if isOptionalDevice and not module.isRemovable and not self.configuration.isAwardWindow:
                removalPrice = module.getRemovalPrice(self.itemsCache.items)
                removalPriceCurrency = removalPrice.getCurrency()
                currencyTextFormatter = getattr(text_styles,
                                                removalPriceCurrency,
                                                text_styles.gold)
                block.append(
                    formatters.packTextParameterWithIconBlockData(
                        name=text_styles.main(
                            TOOLTIPS.MODULEFITS_NOT_REMOVABLE_DISMANTLING_PRICE
                        ),
                        value=currencyTextFormatter(
                            removalPrice.price.get(removalPriceCurrency)),
                        icon=removalPriceCurrency,
                        valueWidth=self._valueWidth,
                        padding=formatters.packPadding(left=-5)))
            hasAction |= module.sellPrices.itemPrice.isActionPrice()
            return (block, notEnoughMoney or hasAction)
示例#21
0
    def construct(self):
        block = []
        module = self.module
        slotIdx = self.configuration.slotIdx
        vehicle = self.configuration.vehicle
        sellPrice = self.configuration.sellPrice
        buyPrice = self.configuration.buyPrice
        unlockPrice = self.configuration.unlockPrice
        inventoryCount = self.configuration.inventoryCount
        vehiclesCount = self.configuration.vehiclesCount
        researchNode = self.configuration.node
        if buyPrice and sellPrice:
            LOG_ERROR('You are not allowed to use buyPrice and sellPrice at the same time')
            return
        else:

            def checkState(state):
                if researchNode is not None:
                    return bool(int(researchNode.state) & state)
                else:
                    return False

            isEqOrDev = module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS
            isNextToUnlock = checkState(NODE_STATE_FLAGS.NEXT_2_UNLOCK)
            isInstalled = checkState(NODE_STATE_FLAGS.INSTALLED)
            isInInventory = checkState(NODE_STATE_FLAGS.IN_INVENTORY)
            isUnlocked = checkState(NODE_STATE_FLAGS.UNLOCKED)
            isAutoUnlock = checkState(NODE_STATE_FLAGS.AUTO_UNLOCKED)
            items = g_itemsCache.items
            money = items.stats.money
            itemPrice = ZERO_MONEY
            if module is not None:
                itemPrice = module.buyPrice
            isMoneyEnough = money >= itemPrice
            leftPadding = 92
            if unlockPrice and not isEqOrDev:
                parentCD = vehicle.intCD if vehicle is not None else None
                isAvailable, cost, need = getUnlockPrice(module.intCD, parentCD)
                neededValue = None
                if not isUnlocked and isNextToUnlock and need > 0:
                    neededValue = need
                if cost > 0:
                    block.append(makePriceBlock(cost, CURRENCY_SETTINGS.UNLOCK_PRICE, neededValue, leftPadding=leftPadding, valueWidth=self._valueWidth))
            creditsActionPercent, goldActionPercent = (0, 0)
            need = ZERO_MONEY
            if buyPrice and not isAutoUnlock:
                price = module.altPrice or module.buyPrice
                defPrice = module.defaultAltPrice or module.defaultPrice
                rootInInv = vehicle is not None and vehicle.isInInventory
                if researchNode:
                    showNeeded = rootInInv and not isMoneyEnough and (isNextToUnlock or isUnlocked) and not (isInstalled or isInInventory)
                else:
                    isModuleUnlocked = module.isUnlocked
                    isModuleInInventory = module.isInInventory
                    showNeeded = not isModuleInInventory and isModuleUnlocked
                if isEqOrDev or showNeeded:
                    need = price - money
                    need = need.toNonNegative()
                if price.credits > 0:
                    creditsActionPercent = getActionPrc(price.credits, defPrice.credits)
                    block.append(makePriceBlock(price.credits, CURRENCY_SETTINGS.BUY_CREDITS_PRICE, need.credits if need.credits > 0 else None, defPrice.credits if defPrice.credits > 0 else None, creditsActionPercent, self._valueWidth, leftPadding))
                if price.gold > 0:
                    goldActionPercent = getActionPrc(price.gold, defPrice.gold)
                    block.append(formatters.packTextBlockData(text=text_styles.standard(TOOLTIPS.VEHICLE_TEXTDELIMITER_OR), padding=formatters.packPadding(left=(101 if goldActionPercent > 0 else 81) + self.leftPadding)))
                    block.append(makePriceBlock(price.gold, CURRENCY_SETTINGS.BUY_GOLD_PRICE, need.gold if need.gold > 0 else None, defPrice.gold if defPrice.gold > 0 else None, goldActionPercent, self._valueWidth, leftPadding))
            if sellPrice:
                block.append(makePriceBlock(module.sellPrice.credits, CURRENCY_SETTINGS.SELL_PRICE, oldPrice=module.defaultSellPrice.credits, percent=module.sellActionPrc, valueWidth=self._valueWidth, leftPadding=leftPadding))
            if inventoryCount:
                count = module.inventoryCount
                if count > 0:
                    block.append(formatters.packTextParameterBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_INVENTORYCOUNT), value=text_styles.stats(count), valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5)))
            if vehiclesCount:
                inventoryVehicles = items.getVehicles(REQ_CRITERIA.INVENTORY)
                count = len(module.getInstalledVehicles(inventoryVehicles.itervalues()))
                if count > 0:
                    block.append(formatters.packTextParameterBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_VEHICLECOUNT), value=text_styles.stats(count), valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5)))
            notEnoughMoney = need > ZERO_MONEY
            hasAction = creditsActionPercent > 0 or goldActionPercent > 0 or module.sellActionPrc > 0
            return (block, notEnoughMoney or hasAction)
示例#22
0
    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})
示例#23
0
 def _packBlocks(self, *args, **kwargs):
     items = super(CrewSkinTooltipDataBlock, self)._packBlocks()
     item = self.context.buildItem(*args, **kwargs)
     topBlock = []
     topBlock.append(
         formatters.packTextBlockData(
             text=text_styles.highTitle(localizedFullName(item))))
     topBlock.append(
         formatters.packTextBlockData(text=text_styles.main(
             backport.text(
                 R.strings.item_types.crewSkins.itemType.dyn(Rarity.STRINGS[
                     item.getRarity()])()))))
     topBlock.append(
         formatters.packImageTextBlockData(
             img=RES_ICONS.MAPS_ICONS_TOOLTIP_TOOLTIP_TANKMAN_BACK,
             padding=formatters.packPadding(18)))
     if self.lobbyContext.getServerSettings().isCrewSkinsEnabled():
         topBlock.append(
             formatters.packImageTextBlockData(
                 img=getCrewSkinIconBig(item.getIconID()),
                 imgPadding=formatters.packPadding(left=60),
                 padding=formatters.packPadding(-142)))
     topBlock.append(
         formatters.packTextBlockData(text=text_styles.main(
             item.getDescription()),
                                      padding=formatters.packPadding(14)))
     items.append(formatters.packBuildUpBlockData(topBlock))
     block = []
     soundSetID = item.getSoundSetID()
     soundSetName = soundSetID if soundSetID != NO_CREW_SKIN_SOUND_SET else backport.text(
         R.strings.crew_skins.feature.sound.noSound())
     block.append(
         formatters.packTextParameterBlockData(
             name=text_styles.stats(soundSetName),
             value=text_styles.main(
                 backport.text(R.strings.tooltips.crewSkins.sound())),
             valueWidth=115))
     block.append(
         formatters.packTextParameterBlockData(
             name=text_styles.stats(str(len(item.getTankmenIDs()))),
             value=text_styles.main(
                 backport.text(R.strings.crew_skins.feature.inUse())),
             valueWidth=115))
     block.append(
         formatters.packTextParameterBlockData(
             name=text_styles.stats('{free}({max})'.format(
                 free=item.getFreeCount(), max=item.getMaxCount())),
             value=text_styles.main(
                 backport.text(R.strings.crew_skins.feature.inStorage())),
             valueWidth=115))
     restrictions = []
     if item.getRoleID() is not None:
         restrictions.append(
             backport.text(
                 R.strings.item_types.tankman.roles.dyn(
                     item.getRoleID())()))
     if item.getSex() == TANKMAN_SEX.MALE:
         restrictions.append(
             backport.text(R.strings.item_types.tankman.gender.man()))
     elif item.getSex() == TANKMAN_SEX.FEMALE:
         restrictions.append(
             backport.text(R.strings.item_types.tankman.gender.woman()))
     if item.getNation() is not None:
         restrictions.append(
             backport.text(R.strings.nations.dyn(item.getNation())()))
     if restrictions:
         restrictionText = ', '.join(restrictions)
     else:
         restrictionText = backport.text(
             R.strings.tooltips.crewSkins.noRestrictions())
     block.append(
         formatters.packTextParameterBlockData(
             name=text_styles.stats(restrictionText),
             value=text_styles.main(
                 backport.text(
                     R.strings.tooltips.crewSkins.restrictions())),
             valueWidth=115))
     items.append(formatters.packBuildUpBlockData(block))
     skinUsersRoleAndVehicle = _skinUsersRoleAndVehicleText(
         '{role} ({vehicle})', item)
     if skinUsersRoleAndVehicle:
         usedBlock = []
         usedBlock.append(
             formatters.packTextBlockData(text=text_styles.middleTitle(
                 backport.text(R.strings.tooltips.crewSkins.inUse()))))
         usedBlock.append(
             formatters.packTextBlockData(text=text_styles.main(
                 _longStringListEllipsisCutoff(
                     ', ', skinUsersRoleAndVehicle, _MAX_USERS_DISPLAYED))))
         items.append(formatters.packBuildUpBlockData(usedBlock))
     return items
示例#24
0
    def construct(self):
        block = []
        module = self.module
        slotIdx = self.configuration.slotIdx
        vehicle = self.configuration.vehicle
        sellPrice = self.configuration.sellPrice
        buyPrice = self.configuration.buyPrice
        unlockPrice = self.configuration.unlockPrice
        inventoryCount = self.configuration.inventoryCount
        vehiclesCount = self.configuration.vehiclesCount
        researchNode = self.configuration.node
        if buyPrice and sellPrice:
            LOG_ERROR('You are not allowed to use buyPrice and sellPrice at the same time')
            return
        else:

            def checkState(state):
                if researchNode is not None:
                    return bool(int(researchNode.state) & state)
                else:
                    return False

            isEqOrDev = module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS
            isNextToUnlock = checkState(NODE_STATE.NEXT_2_UNLOCK)
            isInstalled = checkState(NODE_STATE.INSTALLED)
            isInInventory = checkState(NODE_STATE.IN_INVENTORY)
            isUnlocked = checkState(NODE_STATE.UNLOCKED)
            isAutoUnlock = checkState(NODE_STATE.AUTO_UNLOCKED)
            items = g_itemsCache.items
            credits, gold = items.stats.money
            itemPrice = (0, 0)
            if module is not None:
                itemPrice = module.buyPrice
            isMoneyEnough = credits >= itemPrice[0] and gold >= itemPrice[1]
            if unlockPrice and not isEqOrDev:
                parentCD = vehicle.intCD if vehicle is not None else None
                isAvailable, cost, need = getUnlockPrice(module.intCD, parentCD)
                neededValue = None
                if not isUnlocked and isNextToUnlock and need > 0:
                    neededValue = need
                if cost > 0:
                    block.append(self._makePriceBlock(cost, 'unlockPrice', neededValue))
            creditsActionPercent, goldActionPercent = (0, 0)
            needCredits, needGold = (0, 0)
            if buyPrice and not isAutoUnlock:
                creditsPrice, goldPrice = module.altPrice or module.buyPrice
                defCreditsPrice, defGoldPrice = module.defaultAltPrice or module.defaultPrice
                rootInInv = vehicle is not None and vehicle.isInInventory
                if researchNode:
                    showNeeded = rootInInv and not isMoneyEnough and (isNextToUnlock or isUnlocked) and not (isInstalled or isInInventory)
                else:
                    isModuleUnlocked = module.isUnlocked
                    isModuleInInventory = module.isInInventory
                    showNeeded = not isModuleInInventory and isModuleUnlocked
                if isEqOrDev or showNeeded:
                    creditsNeeded = creditsPrice - credits if creditsPrice else 0
                    goldNeeded = goldPrice - gold if goldPrice else 0
                    needCredits, needGold = max(0, creditsNeeded), max(0, goldNeeded)
                if creditsPrice > 0:
                    creditsActionPercent = getActionPrc(creditsPrice, defCreditsPrice)
                    block.append(self._makePriceBlock(creditsPrice, 'buyCreditsPrice', needCredits if needCredits > 0 else None, defCreditsPrice if defCreditsPrice > 0 else None, creditsActionPercent))
                if goldPrice > 0:
                    goldActionPercent = getActionPrc(goldPrice, defGoldPrice)
                    block.append(formatters.packTextBlockData(text=text_styles.standard(TOOLTIPS.VEHICLE_TEXTDELIMITER_OR), padding=formatters.packPadding(left=(101 if goldActionPercent > 0 else 81) + self.leftPadding)))
                    block.append(self._makePriceBlock(goldPrice, 'buyGoldPrice', needGold if needGold > 0 else None, defGoldPrice if defGoldPrice > 0 else None, goldActionPercent))
            if sellPrice:
                block.append(self._makePriceBlock(module.sellPrice[0], 'sellPrice', oldPrice=module.defaultSellPrice[0], percent=module.sellActionPrc))
            if inventoryCount:
                count = module.inventoryCount
                if count > 0:
                    block.append(formatters.packTextParameterBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_INVENTORYCOUNT), value=text_styles.stats(count), valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5)))
            if vehiclesCount:
                inventoryVehicles = items.getVehicles(REQ_CRITERIA.INVENTORY)
                count = len(module.getInstalledVehicles(inventoryVehicles.itervalues()))
                if count > 0:
                    block.append(formatters.packTextParameterBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_VEHICLECOUNT), value=text_styles.stats(count), valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5)))
                    isInstalled = False
                    if vehicle is not None:
                        isFit, reason = module.mayInstall(vehicle, slotIdx)
                        if not isFit:
                            reason = reason.replace(' ', '_')
                        isInstalled = reason == 'already_installed'
                    if count > self.MAX_INSTALLED_LIST_LEN and (isInstalled or isMoneyEnough):
                        hiddenVehicleCount = count - self.MAX_INSTALLED_LIST_LEN
                        block.append(formatters.packTextParameterBlockData(name=text_styles.main(TOOLTIPS.SUITABLEVEHICLE_HIDDENVEHICLECOUNT), value=text_styles.stats(hiddenVehicleCount), valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5)))
            notEnoughMoney = needCredits > 0 or needGold > 0
            hasAction = creditsActionPercent > 0 or goldActionPercent > 0 or module.sellActionPrc > 0
            return (block, notEnoughMoney or hasAction)
示例#25
0
 def extendBlocks(cls, blocks, curEq, compareEq, eqsRange, param, title, higherIsBetter=True):
     blocks.append(formatters.packTextParameterBlockData(name=text_styles.middleTitle(title), value=NEUTRAL_STYLE(i18n.makeString(param)), padding=formatters.packPadding(left=0, top=0), valueWidth=85))
示例#26
0
    def construct(self):
        block = []
        module = self.module
        slotIdx = self.configuration.slotIdx
        vehicle = self.configuration.vehicle
        sellPrice = self.configuration.sellPrice
        buyPrice = self.configuration.buyPrice
        unlockPrice = self.configuration.unlockPrice
        inventoryCount = self.configuration.inventoryCount
        vehiclesCount = self.configuration.vehiclesCount
        researchNode = self.configuration.node
        if buyPrice and sellPrice:
            LOG_ERROR(
                'You are not allowed to use buyPrice and sellPrice at the same time'
            )
            return
        else:

            def checkState(state):
                if researchNode is not None:
                    return bool(int(researchNode.state) & state)
                else:
                    return False

            isEqOrDev = module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS
            isNextToUnlock = checkState(NODE_STATE_FLAGS.NEXT_2_UNLOCK)
            isInstalled = checkState(NODE_STATE_FLAGS.INSTALLED)
            isInInventory = checkState(NODE_STATE_FLAGS.IN_INVENTORY)
            isUnlocked = checkState(NODE_STATE_FLAGS.UNLOCKED)
            isAutoUnlock = checkState(NODE_STATE_FLAGS.AUTO_UNLOCKED)
            items = g_itemsCache.items
            money = items.stats.money
            itemPrice = ZERO_MONEY
            if module is not None:
                itemPrice = module.buyPrice
            isMoneyEnough = money >= itemPrice
            leftPadding = 92
            if unlockPrice and not isEqOrDev:
                parentCD = vehicle.intCD if vehicle is not None else None
                isAvailable, cost, need = getUnlockPrice(
                    module.intCD, parentCD)
                neededValue = None
                if not isUnlocked and isNextToUnlock and need > 0:
                    neededValue = need
                if cost > 0:
                    block.append(
                        makePriceBlock(cost,
                                       CURRENCY_SETTINGS.UNLOCK_PRICE,
                                       neededValue,
                                       leftPadding=leftPadding,
                                       valueWidth=self._valueWidth))
            creditsActionPercent, goldActionPercent = (0, 0)
            need = ZERO_MONEY
            if buyPrice and not isAutoUnlock:
                price = module.altPrice or module.buyPrice
                defPrice = module.defaultAltPrice or module.defaultPrice
                rootInInv = vehicle is not None and vehicle.isInInventory
                if researchNode:
                    showNeeded = rootInInv and not isMoneyEnough and (
                        isNextToUnlock
                        or isUnlocked) and not (isInstalled or isInInventory)
                else:
                    isModuleUnlocked = module.isUnlocked
                    isModuleInInventory = module.isInInventory
                    showNeeded = not isModuleInInventory and isModuleUnlocked
                if isEqOrDev or showNeeded:
                    need = price - money
                    need = need.toNonNegative()
                if price.credits > 0:
                    creditsActionPercent = getActionPrc(
                        price.credits, defPrice.credits)
                    block.append(
                        makePriceBlock(
                            price.credits, CURRENCY_SETTINGS.BUY_CREDITS_PRICE,
                            need.credits if need.credits > 0 else None,
                            defPrice.credits if defPrice.credits > 0 else None,
                            creditsActionPercent, self._valueWidth,
                            leftPadding))
                if price.gold > 0:
                    goldActionPercent = getActionPrc(price.gold, defPrice.gold)
                    block.append(
                        formatters.packTextBlockData(
                            text=text_styles.standard(
                                TOOLTIPS.VEHICLE_TEXTDELIMITER_OR),
                            padding=formatters.packPadding(
                                left=(101 if goldActionPercent > 0 else 81) +
                                self.leftPadding)))
                    block.append(
                        makePriceBlock(
                            price.gold, CURRENCY_SETTINGS.BUY_GOLD_PRICE,
                            need.gold if need.gold > 0 else None,
                            defPrice.gold if defPrice.gold > 0 else None,
                            goldActionPercent, self._valueWidth, leftPadding))
            if sellPrice:
                block.append(
                    makePriceBlock(module.sellPrice.credits,
                                   CURRENCY_SETTINGS.SELL_PRICE,
                                   oldPrice=module.defaultSellPrice.credits,
                                   percent=module.sellActionPrc,
                                   valueWidth=self._valueWidth,
                                   leftPadding=leftPadding))
            if inventoryCount:
                count = module.inventoryCount
                if count > 0:
                    block.append(
                        formatters.packTextParameterBlockData(
                            name=text_styles.main(
                                TOOLTIPS.VEHICLE_INVENTORYCOUNT),
                            value=text_styles.stats(count),
                            valueWidth=self._valueWidth,
                            padding=formatters.packPadding(left=-5)))
            if vehiclesCount:
                inventoryVehicles = items.getVehicles(REQ_CRITERIA.INVENTORY)
                count = len(
                    module.getInstalledVehicles(
                        inventoryVehicles.itervalues()))
                if count > 0:
                    block.append(
                        formatters.packTextParameterBlockData(
                            name=text_styles.main(
                                TOOLTIPS.VEHICLE_VEHICLECOUNT),
                            value=text_styles.stats(count),
                            valueWidth=self._valueWidth,
                            padding=formatters.packPadding(left=-5)))
            notEnoughMoney = need > ZERO_MONEY
            hasAction = creditsActionPercent > 0 or goldActionPercent > 0 or module.sellActionPrc > 0
            return (block, notEnoughMoney or hasAction)
示例#27
0
    def __getList(self, items):
        blocks = []
        for item in items:
            blocks.append(formatters.packTextParameterBlockData(name=text_styles.main(item.get('text')), value=text_styles.main(item.get('bullet', '')), valueWidth=16))

        return blocks
 def _packTimeBlock(self, message, timeStr):
     return formatters.packTextParameterBlockData(value=timeStr,
                                                  name=message,
                                                  valueWidth=97)
示例#29
0
 def construct(self):
     block = []
     shell = self.shell
     configuration = self.configuration
     buyPrice = configuration.buyPrice
     sellPrice = configuration.sellPrice
     if buyPrice and sellPrice:
         LOG_ERROR(
             'You are not allowed to use buyPrice and sellPrice at the same time'
         )
         return
     else:
         need = ZERO_MONEY
         if buyPrice:
             money = g_itemsCache.items.stats.money
             price = shell.altPrice or shell.buyPrice
             need = price - money
             need = need.toNonNegative()
             defPrice = shell.defaultAltPrice or shell.defaultPrice
             addCreditPrice = price.credits > 0
             if price.isAllSet(
             ) and not g_itemsCache.items.shop.isEnabledBuyingGoldShellsForCredits:
                 addCreditPrice = False
             addGoldPrice = price.gold > 0
             addDelimeter = addCreditPrice and addGoldPrice
             if addCreditPrice:
                 block.append(
                     makePriceBlock(
                         price.credits,
                         CURRENCY_SETTINGS.BUY_CREDITS_PRICE,
                         need.credits if need.credits > 0 else None,
                         defPrice.credits if defPrice.credits > 0 else None,
                         percent=shell.actionPrc,
                         valueWidth=self._valueWidth))
             if addDelimeter:
                 block.append(
                     formatters.packTextBlockData(
                         text=text_styles.standard(
                             TOOLTIPS.VEHICLE_TEXTDELIMITER_OR),
                         padding=formatters.packPadding(left=81 +
                                                        self.leftPadding)))
             if addGoldPrice:
                 block.append(
                     makePriceBlock(
                         price.gold,
                         CURRENCY_SETTINGS.BUY_GOLD_PRICE,
                         need.gold if need.gold > 0 else None,
                         defPrice.gold if defPrice.gold > 0 else None,
                         percent=shell.actionPrc,
                         valueWidth=self._valueWidth))
         if sellPrice:
             block.append(
                 makePriceBlock(shell.sellPrice.credits,
                                CURRENCY_SETTINGS.SELL_PRICE,
                                oldPrice=shell.defaultSellPrice.credits,
                                percent=shell.sellActionPrc,
                                valueWidth=self._valueWidth))
         inventoryCount = shell.inventoryCount
         if inventoryCount:
             block.append(
                 formatters.packTextParameterBlockData(
                     name=text_styles.main(TOOLTIPS.VEHICLE_INVENTORYCOUNT),
                     value=text_styles.stats(inventoryCount),
                     valueWidth=self._valueWidth,
                     padding=formatters.packPadding(left=-5)))
         notEnoughMoney = need > ZERO_MONEY
         hasAction = shell.actionPrc > 0 or shell.sellActionPrc > 0
         return (block, notEnoughMoney or hasAction)
示例#30
0
def tooltip_add_param(self, result, param0, param1):
    result.append(formatters.packTextParameterBlockData(name=text_styles.main(param0), value=text_styles.stats(param1), valueWidth=107, padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding)))
示例#31
0
 def _makeStatBlock(self, current, total, text):
     return formatters.packTextParameterBlockData(name=text_styles.main(_ms(text)), value=text_styles.stats(str(current) + '/' + str(total)), valueWidth=self._valueWidth)
示例#32
0
 def construct(self):
     if self.vehicle.isTelecom:
         return [formatters.packTextParameterBlockData(name=text_styles.main(_ms(TOOLTIPS.VEHICLE_DEAL_TELECOM_MAIN)), value='', valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding))]
     else:
         return []
    def _packBlocks(self, *args, **kwargs):
        items = super(TankmanTooltipDataBlock, self)._packBlocks()
        item = self.context.buildItem(*args, **kwargs)
        self.item = item
        vehicle = None
        nativeVehicle = self._itemsCache.items.getItemByCD(
            item.vehicleNativeDescr.type.compactDescr)
        if item.isInTank:
            vehicle = self._itemsCache.items.getVehicle(item.vehicleInvID)
        fullUserName = self._getFullUserName(item)
        items.append(
            formatters.packImageTextBlockData(
                title=text_styles.highTitle(fullUserName),
                desc=text_styles.main(self._getTankmanDescription(item))))
        innerBlock = []
        if vehicle:
            self._createLabel(innerBlock)
            self._createVehicleBlock(innerBlock, vehicle)
        if innerBlock:
            items.append(
                formatters.packBuildUpBlockData(
                    innerBlock,
                    padding=formatters.packPadding(left=0,
                                                   right=50,
                                                   top=-5,
                                                   bottom=0),
                    linkage=BLOCKS_TOOLTIP_TYPES.
                    TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
        commonStatsBlock = [
            formatters.packTextBlockData(text=makeHtmlString(
                'html_templates:lobby/textStyle', 'grayTitle',
                {'message': makeString(TOOLTIPS.HANGAR_CREW_SPECIALTY_SKILLS)})
                                         )
        ]
        penalty = self._getBonusValue(
            item, [TankmanRoleBonusesField.BONUSES.PENALTY])
        addition = self._getBonusValue(item, [
            TankmanRoleBonusesField.BONUSES.COMMANDER,
            TankmanRoleBonusesField.BONUSES.EQUIPMENTS,
            TankmanRoleBonusesField.BONUSES.DEVICES,
            TankmanRoleBonusesField.BONUSES.BROTHERHOOD
        ])
        addition_ = '' if addition == 0 else self._getSign(addition) + str(
            addition)
        penalty_ = '' if penalty == 0 else self._getSign(penalty) + str(
            penalty)
        if penalty != 0 or addition != 0:
            addRoleLevels = ' (' + str(
                item.roleLevel) + addition_ + penalty_ + ')'
        else:
            addRoleLevels = ''
        vehicleName = self._getVehicleName(vehicle, nativeVehicle)
        commonStatsBlock.append(
            formatters.packTextParameterBlockData(
                text_styles.main(item.roleUserName + ' ') + vehicleName,
                text_styles.stats(
                    str(item.roleLevel + penalty + addition) + '%' +
                    addRoleLevels),
                valueWidth=90,
                padding=formatters.packPadding(left=0,
                                               right=0,
                                               top=5,
                                               bottom=0)))
        field = self._getSkillList()
        _, value = field.buildData()
        skills = value or []
        maxPopUpBlocks = 14
        for skill in skills[:maxPopUpBlocks]:
            commonStatsBlock.append(
                formatters.packTextParameterBlockData(
                    text_styles.main(skill['label']),
                    text_styles.stats(str(skill['level']) + '%'),
                    valueWidth=90))

        if len(skills) > maxPopUpBlocks:
            diff = str(len(skills) - maxPopUpBlocks)
            commonStatsBlock.append(
                formatters.packAlignedTextBlockData(
                    text=text_styles.middleTitle(
                        makeString(TOOLTIPS.HANGAR_CREW_MORESKILLS,
                                   skill_cnt=diff)),
                    align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
        items.append(formatters.packBuildUpBlockData(commonStatsBlock, gap=5))
        self._createBlockForNewSkills(items)
        self._createMoreInfoBlock(items)
        return items
示例#34
0
 def __packParameterBlock(self, name, value, measureUnits):
     return formatters.packTextParameterBlockData(name=text_styles.main(name) + text_styles.standard(measureUnits), value=text_styles.stats(value), valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5))
 def _packServerTimeBlock(self, serverStr, timeStr):
     return formatters.packTextParameterBlockData(
         value=serverStr,
         name=timeStr,
         valueWidth=55,
         padding=formatters.packPadding(left=10))
示例#36
0
    def construct(self):
        block = []
        shell = self.shell
        configuration = self.configuration
        buyPrice = configuration.buyPrice
        sellPrice = configuration.sellPrice
        if buyPrice and sellPrice:
            LOG_ERROR(
                'You are not allowed to use buyPrice and sellPrice at the same time'
            )
            return
        else:
            notEnoughMoney = False
            showDelimiter = False
            shop = self.itemsCache.items.shop
            money = self.itemsCache.items.stats.money
            if buyPrice and shell.buyPrices:
                for itemPrice in shell.buyPrices.iteritems(directOrder=False):
                    if not isItemBuyPriceAvailable(
                            shell, itemPrice, shop) or not itemPrice.price:
                        continue
                    currency = itemPrice.getCurrency()
                    value = itemPrice.price.getSignValue(currency)
                    defValue = itemPrice.defPrice.getSignValue(currency)
                    actionPercent = itemPrice.getActionPrc()
                    needValue = value - money.getSignValue(currency)
                    if needValue > 0:
                        notEnoughMoney = True
                    else:
                        needValue = None
                    if showDelimiter:
                        block.append(
                            formatters.packTextBlockData(
                                text=text_styles.standard(
                                    TOOLTIPS.VEHICLE_TEXTDELIMITER_OR),
                                padding=formatters.packPadding(
                                    left=81 + self.leftPadding)))
                    block.append(
                        makePriceBlock(
                            value,
                            CURRENCY_SETTINGS.getBuySetting(currency),
                            needValue,
                            defValue if defValue > 0 else None,
                            actionPercent,
                            valueWidth=self._valueWidth))
                    showDelimiter = True

            if sellPrice and shell.sellPrices:
                block.append(
                    makePriceBlock(
                        shell.sellPrices.itemPrice.price.credits,
                        CURRENCY_SETTINGS.SELL_PRICE,
                        oldPrice=shell.sellPrices.itemPrice.defPrice.credits,
                        percent=shell.sellPrices.itemPrice.getActionPrc(),
                        valueWidth=self._valueWidth))
            inventoryCount = shell.inventoryCount
            if inventoryCount:
                block.append(
                    formatters.packTextParameterBlockData(
                        name=text_styles.main(TOOLTIPS.VEHICLE_INVENTORYCOUNT),
                        value=text_styles.stats(inventoryCount),
                        valueWidth=self._valueWidth,
                        padding=formatters.packPadding(left=-5)))
            hasAction = shell.buyPrices.itemPrice.isActionPrice(
            ) or shell.sellPrices.itemPrice.isActionPrice()
            return (block, notEnoughMoney or hasAction)
    def _packBlocks(self, *args, **kwargs):
        items = super(TankmanTooltipDataBlock, self)._packBlocks()
        item = self.context.buildItem(*args, **kwargs)
        self.item = item
        vehicle = None
        nativeVehicle = self.itemsCache.items.getItemByCD(
            item.vehicleNativeDescr.type.compactDescr)
        if item.isInTank:
            vehicle = self.itemsCache.items.getVehicle(item.vehicleInvID)
        items.append(
            formatters.packImageTextBlockData(
                title=text_styles.highTitle(item.fullUserName),
                desc=text_styles.main(item.rankUserName)))
        innerBlock = []
        if vehicle:
            innerBlock.append(
                formatters.packTextBlockData(text=makeHtmlString(
                    'html_templates:lobby/textStyle', 'grayTitle',
                    {'message': makeString(TOOLTIPS.HANGAR_CREW_ASSIGNEDTO)})))
            innerBlock.append(
                formatters.packImageTextBlockData(
                    img=vehicle.iconContour,
                    txtGap=-4,
                    padding=formatters.packPadding(bottom=0, top=10, left=0),
                    title=text_styles.stats(vehicle.shortUserName),
                    desc=text_styles.stats('#menu:header/vehicleType/%s' %
                                           vehicle.type),
                    flipHorizontal=True))
        if innerBlock:
            items.append(
                formatters.packBuildUpBlockData(
                    innerBlock,
                    padding=formatters.packPadding(left=0,
                                                   right=50,
                                                   top=-5,
                                                   bottom=0),
                    linkage=BLOCKS_TOOLTIP_TYPES.
                    TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
        commonStatsBlock = [
            formatters.packTextBlockData(text=makeHtmlString(
                'html_templates:lobby/textStyle', 'grayTitle',
                {'message': makeString(TOOLTIPS.HANGAR_CREW_SPECIALTY_SKILLS)})
                                         )
        ]
        penalty = self._getBonusValue(
            item, [TankmanRoleBonusesField.BONUSES.PENALTY])
        addition = self._getBonusValue(item, [
            TankmanRoleBonusesField.BONUSES.COMMANDER,
            TankmanRoleBonusesField.BONUSES.EQUIPMENTS,
            TankmanRoleBonusesField.BONUSES.DEVICES,
            TankmanRoleBonusesField.BONUSES.BROTHERHOOD
        ])
        addition_ = '' if addition == 0 else self._getSign(addition) + str(
            addition)
        penalty_ = '' if penalty == 0 else self._getSign(penalty) + str(
            penalty)
        if penalty != 0 or addition != 0:
            addRoleLevels = ' (' + str(
                item.roleLevel) + addition_ + penalty_ + ')'
        else:
            addRoleLevels = ''
        if not vehicle or nativeVehicle.shortUserName == vehicle.shortUserName:
            vehicleName = text_styles.main(nativeVehicle.shortUserName)
        else:
            vehicleName = text_styles.critical(nativeVehicle.shortUserName)
        commonStatsBlock.append(
            formatters.packTextParameterBlockData(
                text_styles.main(item.roleUserName + ' ') + vehicleName,
                text_styles.stats(
                    str(item.roleLevel + penalty + addition) + '%' +
                    addRoleLevels),
                valueWidth=90,
                padding=formatters.packPadding(left=0,
                                               right=0,
                                               top=5,
                                               bottom=0)))
        field = TankmanSkillListField(self, 'skills')
        _, value = field.buildData()
        skills = value
        maxPopUpBlocks = 14
        for skill in skills[:maxPopUpBlocks]:
            commonStatsBlock.append(
                formatters.packTextParameterBlockData(
                    text_styles.main(skill['label']),
                    text_styles.stats(str(skill['level']) + '%'),
                    valueWidth=90))

        if len(skills) > maxPopUpBlocks:
            diff = str(len(skills) - maxPopUpBlocks)
            commonStatsBlock.append(
                formatters.packAlignedTextBlockData(
                    text=text_styles.middleTitle(
                        makeString(TOOLTIPS.HANGAR_CREW_MORESKILLS,
                                   skill_cnt=diff)),
                    align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
        items.append(formatters.packBuildUpBlockData(commonStatsBlock, gap=5))
        field = TankmanNewSkillCountField(self, '')
        _, newSkillCount = field.buildData()
        if newSkillCount > 0:
            items.append(
                formatters.packImageTextBlockData(
                    img='../maps/icons/tankmen/skills/small/new_skill.png',
                    txtOffset=20,
                    padding=formatters.packPadding(bottom=0, top=5, left=0),
                    imgPadding=formatters.packPadding(left=0, top=3),
                    title=makeHtmlString(
                        'html_templates:lobby/textStyle', 'goldTextTitle', {
                            'message':
                            makeString(TOOLTIPS.
                                       HANGAR_CREW_NEW_SKILL_AVAILABLE_HEADER)
                        }),
                    desc=makeHtmlString(
                        'html_templates:lobby/textStyle', 'goldTextField', {
                            'message':
                            makeString(
                                TOOLTIPS.HANGAR_CREW_NEW_SKILL_AVAILABLE_TEXT)
                        })))
        field = TankmanStatusField(self, '')
        _, status = field.buildData()
        if status['header'] != '':
            items.append(
                formatters.packImageTextBlockData(
                    title=text_styles.warning(status['header']),
                    desc=makeHtmlString('html_templates:lobby/textStyle',
                                        'statusWarningField',
                                        {'message': status['text']})))
        return items
示例#38
0
 def _makeStatBlock(self, current, total, text):
     return formatters.packTextParameterBlockData(name=text_styles.main(_ms(text)), value=text_styles.stats(str(current) + '/' + str(total)), valueWidth=self._valueWidth)
def tooltip_add_param(self, result, param0, param1):
    result.append(formatters.packTextParameterBlockData(name=text_styles.main(param0), value=text_styles.stats(param1), valueWidth=107, padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding)))