コード例 #1
0
def _extendByModuleData(targetData, vehicleModule, vehDescr, extenders):
    moduleType = vehicleModule.itemTypeID
    values, names = [], []
    paramsData = params_helper.getParameters(vehicleModule, vehDescr)
    paramsList = _PARAMS_LISTS[moduleType]
    serverSettings = dependency.instance(ISettingsCore).serverSettings
    for ext in extenders:
        if ext.check(vehicleModule, vehDescr):
            paramsList, indexes = ext.extendParamList(paramsList)
            if ext.highlightCheck(serverSettings) and indexes:
                targetData['highlightedParameterIdx'] = indexes[0]
                ext.updatedHighlightSettings(serverSettings)

    for paramName in paramsList:
        value = paramsData.get(paramName)
        if value is not None:
            values.append(_formatValuesString(formatParameter(paramName, value)))
            names.append(formatModuleParamName(paramName, vehDescr))

    targetData['level'] = vehicleModule.level
    targetData['paramValues'] = '\n'.join(values)
    targetData['paramNames'] = '\n'.join(names)
    targetData['name'] = text_styles.middleTitle(vehicleModule.userName)
    targetData[EXTRA_MODULE_INFO] = vehicleModule.getExtraIconInfo(vehDescr)
    return
コード例 #2
0
 def _packBonusBlock(self, bonus, camo, isApplied):
     blocks = []
     vehicle = g_currentVehicle.item
     bonusPercent = bonus.getFormattedValue(vehicle)
     blocks.append(
         formatters.packImageTextBlockData(
             title=text_styles.bonusLocalInfoTipText(
                 text_styles.concatStylesToSingleLine('+', bonusPercent)),
             img=RES_ICONS.MAPS_ICONS_LIBRARY_QUALIFIERS_48X48_CAMOUFLAGE,
             imgPadding=formatters.packPadding(top=-8, left=12),
             txtPadding=formatters.packPadding(top=-4),
             txtOffset=69))
     blocks.append(
         formatters.packTextBlockData(
             text=text_styles.main(self.bonusDescription),
             padding=formatters.packPadding(top=-46, left=110)))
     stockVehicle = self.itemsCache.items.getStockVehicle(vehicle.intCD)
     comparator = params_helper.camouflageComparator(stockVehicle, camo)
     stockParams = params_helper.getParameters(stockVehicle)
     padding = formatters.packPadding(left=105, top=2, bottom=-6)
     simplifiedBlocks = SimplifiedStatsBlockConstructor(
         stockParams, comparator, padding).construct()
     if simplifiedBlocks and not isApplied:
         blocks.extend(simplifiedBlocks)
     return formatters.packBuildUpBlockData(
         blocks,
         linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE
     )
コード例 #3
0
 def __packBonusBlock(self):
     blocks = []
     vehicle = cmp_helpers.getCmpConfiguratorMainView().getCurrentVehicle()
     camo = cmp_helpers.getSuitableCamouflage(vehicle)
     bonusTitleLocal = makeHtmlString(
         'html_templates:lobby/textStyle', 'bonusLocalText',
         {'message': '+{}'.format(camo.bonus.getFormattedValue(vehicle))})
     blocks.append(
         formatters.packImageTextBlockData(
             title=text_styles.concatStylesWithSpace(bonusTitleLocal),
             desc=text_styles.main(camo.bonus.description),
             img=camo.bonus.icon,
             imgPadding={
                 'left': 11,
                 'top': 3
             },
             txtGap=-4,
             txtOffset=65,
             padding={
                 'top': -1,
                 'left': 7
             }))
     if not self._showTTC and vehicle is not None:
         stockVehicle = self.itemsCache.items.getStockVehicle(vehicle.intCD)
         comparator = params_helper.camouflageComparator(vehicle, camo)
         stockParams = params_helper.getParameters(stockVehicle)
         simplifiedBlocks = SimplifiedStatsBlockConstructor(
             stockParams, comparator).construct()
         if simplifiedBlocks:
             blocks.extend(simplifiedBlocks)
     return formatters.packBuildUpBlockData(
         blocks,
         linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE
     )
コード例 #4
0
    def __getCommonStatsBlock(self, vehicle):
        _params = {VEHICLE_CLASS_NAME.LIGHT_TANK: ('enginePowerPerTon',
                                         'speedLimits',
                                         WHEELED_SPEED_MODE_SPEED,
                                         'chassisRotationSpeed',
                                         'circularVisionRadius',
                                         MAX_STEERING_LOCK_ANGLE,
                                         WHEELED_SWITCH_ON_TIME,
                                         WHEELED_SWITCH_OFF_TIME),
         VEHICLE_CLASS_NAME.MEDIUM_TANK: ('avgDamagePerMinute',
                                          'enginePowerPerTon',
                                          'speedLimits',
                                          'chassisRotationSpeed',
                                          TURBOSHAFT_SPEED_MODE_SPEED,
                                          TURBOSHAFT_ENGINE_POWER),
         VEHICLE_CLASS_NAME.HEAVY_TANK: ('avgDamage',
                                         'avgPiercingPower',
                                         'hullArmor',
                                         'turretArmor',
                                         DUAL_GUN_CHARGE_TIME),
         VEHICLE_CLASS_NAME.SPG: ('avgDamage', 'stunMinDuration', 'stunMaxDuration', 'reloadTimeSecs', 'aimingTime', 'explosionRadius'),
         VEHICLE_CLASS_NAME.AT_SPG: ('avgPiercingPower', 'shotDispersionAngle', 'avgDamagePerMinute', 'speedLimits', 'chassisRotationSpeed', 'switchOnTime', 'switchOffTime'),
         'default': ('speedLimits', 'enginePower', 'chassisRotationSpeed')}
        block = []
        paramsDict = params_helper.getParameters(vehicle)
        comparator = params_helper.idealCrewComparator(vehicle)
        for paramName in _params.get(vehicle.type, 'default'):
            if paramName in paramsDict:
                paramInfo = comparator.getExtendedData(paramName)
                fmtValue = param_formatter.colorizedFormatParameter(paramInfo, None)
                if fmtValue is not None:
                    block.append(formatters.packTextParameterBlockData(name=param_formatter.formatVehicleParamName(paramName), value=fmtValue, valueWidth=80, padding=formatters.packPadding(left=-1)))

        return block
コード例 #5
0
    def construct(self):
        block = []
        if self.configuration.params:
            comparator = params_helper.shellOnVehicleComparator(
                self.shell, self.configuration.vehicle)
            stockParams = params_helper.getParameters(
                self.itemsCache.items.getStockVehicle(
                    self.configuration.vehicle.intCD))
            for parameter in params_formatters.getRelativeDiffParams(
                    comparator):
                delta = parameter.state[1]
                value = parameter.value
                if delta > 0:
                    value -= delta
                block.append(
                    formatters.packStatusDeltaBlockData(
                        title=text_styles.middleTitle(
                            MENU.tank_params(parameter.name)),
                        valueStr=params_formatters.simplifiedDeltaParameter(
                            parameter),
                        statusBarData={
                            'value': value,
                            'delta': delta,
                            'minValue': 0,
                            'markerValue':
                            stockParams.get(parameter.name, value),
                            'maxValue': max(MAX_RELATIVE_VALUE, value + delta),
                            'useAnim': False
                        },
                        padding=formatters.packPadding(left=75)))

        return block
コード例 #6
0
    def __buildReserveParams(self, reserve):
        if not reserve.isUsingInBattle():
            return [{'paramValue': '+{}%'.format(reserve.getBonusPercent()),
              'paramName': reserve.getDescription()}]
        else:
            paramsData = []
            item = self.__itemsCache.items.getItemByCD(int(reserve.intCD))
            if item is None:
                _logger.warning('There is not a reserve with intCD=%s', reserve.intCD)
                return paramsData
            paramsFilter = RESERVE_PARAMS_LIST.get(reserve.getType())
            if paramsFilter is None:
                _logger.warning('RESERVE_PARAMS_LIST does not know a reserve with type=%s', reserve.getType())
                return paramsData
            params = params_helper.getParameters(item)
            paramsResult = formatters.getFormattedParamsList(item.descriptor, params)
            for paramName, paramValue in paramsResult:
                if paramName in paramsFilter:
                    paramsStrR = R.strings.menu.moduleInfo.params.short.dyn(paramName)
                    if not paramsStrR.isValid():
                        paramsStrR = R.strings.menu.moduleInfo.params.dyn(paramName)
                    paramsData.append({'paramValue': paramValue,
                     'paramName': text_styles.concatStylesWithNBSP(text_styles.main(backport.text(paramsStrR())), text_styles.standard(formatters.measureUnitsForParameter(paramName)))})

            return paramsData
コード例 #7
0
ファイル: tooltipsvehicle.py プロジェクト: Difrex/wotsdk
    def construct(self):
        paramsDict = dict(params_helper.getParameters(self.vehicle))
        block = []
        comparator = params_helper.idealCrewComparator(self.vehicle)
        if self.configuration.params and not self.configuration.simplifiedOnly:
            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
コード例 #8
0
    def _onLoading(self, vehicle, isInstalled=True):
        super(ShellsInfo, self)._onLoading()
        with self.viewModel.transaction() as tx:
            tx.setMaxCount(vehicle.ammoMaxSize)
            tx.setIsAutoRenewalEnabled(vehicle.isAutoLoad)
            shellsParams = []
            totalCount = 0
            shellsLayout = vehicle.shells.installed if isInstalled else vehicle.shells.layout
            for shell in shellsLayout:
                if shell is None:
                    continue
                shellModel = ShellInfoModel()
                shellModel.setName(shell.userName)
                shellModel.setType(shell.type)
                shellModel.setCount(shell.count)
                shellModel.setImageSource(R.images.gui.maps.icons.shell.medium.dyn(shell.type)())
                shellsParams.append(params_helper.getParameters(shell, vehicle.descriptor))
                tx.getShells().addViewModel(shellModel)
                totalCount += shell.count

            tx.setInstalledCount(totalCount)
            for paramName in _SHELLS_INFO_PARAMS:
                specificationModel = ShellsSpecificationModel()
                specificationModel.setParamName(paramName)
                specificationModel.setMetricValue(i18n.makeString(MEASURE_UNITS.get(paramName, '')))
                for shellParam in shellsParams:
                    value = formatParameter(paramName, shellParam.get(paramName))
                    specificationModel.getValues().addString('' if value is None else value)

                tx.getSpecifications().addViewModel(specificationModel)

        return
コード例 #9
0
ファイル: module.py プロジェクト: kusaku/wot_scripts
 def construct(self):
     module = self.module
     block = []
     title = module.userName
     imgPaddingLeft = 27
     imgPaddingTop = 0
     txtOffset = 130 - self.leftPadding
     desc = ''
     if module.itemTypeName in VEHICLE_COMPONENT_TYPE_NAMES:
         desc = text_styles.concatStylesWithSpace(text_styles.stats(_ms(TOOLTIPS.level(str(module.level)))), text_styles.standard(_ms(TOOLTIPS.VEHICLE_LEVEL)))
         imgPaddingLeft = 22
     elif module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS:
         imgPaddingLeft = 7
         imgPaddingTop = 5
         txtOffset = 90 - self.leftPadding
         moduleParams = params_helper.getParameters(module)
         weightUnits = text_styles.standard(TOOLTIPS.PARAMETER_WEIGHTUNITS)
         paramName = ModuleTooltipBlockConstructor.WEIGHT_MODULE_PARAM
         paramValue = params_formatters.formatParameter(paramName, moduleParams[paramName]) if paramName in moduleParams else None
         if paramValue is not None:
             desc = text_styles.main(TOOLTIPS.PARAMETER_WEIGHT) + text_styles.credits(paramValue) + weightUnits
     else:
         desc = text_styles.standard(desc)
     overlayPath, overlayPadding, blockPadding = self.__getOverlayData()
     block.append(formatters.packItemTitleDescBlockData(title=text_styles.highTitle(title), desc=desc, img=module.icon, imgPadding=formatters.packPadding(left=imgPaddingLeft, top=imgPaddingTop), txtGap=-3, txtOffset=txtOffset, padding=blockPadding, overlayPath=overlayPath, overlayPadding=overlayPadding))
     if module.itemTypeID == GUI_ITEM_TYPE.GUN:
         vehicle = self.configuration.vehicle
         vDescr = vehicle.descriptor if vehicle is not None else None
         if module.isClipGun(vDescr):
             block.append(formatters.packImageTextBlockData(title=text_styles.standard(MENU.MODULEINFO_CLIPGUNLABEL), desc='', img=RES_ICONS.MAPS_ICONS_MODULES_MAGAZINEGUNICON, imgPadding=formatters.packPadding(top=3), padding=formatters.packPadding(left=108, top=9)))
     elif module.itemTypeID == GUI_ITEM_TYPE.CHASSIS:
         if module.isHydraulicChassis():
             block.append(formatters.packImageTextBlockData(title=text_styles.standard(MENU.MODULEINFO_HYDRAULICCHASSISLABEL), desc='', img=RES_ICONS.MAPS_ICONS_MODULES_HYDRAULICCHASSISICON, imgPadding=formatters.packPadding(top=3), padding=formatters.packPadding(left=108, top=9)))
     return block
コード例 #10
0
ファイル: fitting_item.py プロジェクト: kusaku/wot_scripts
    def _getShortInfo(self, vehicle=None, expanded=False):
        """
        Returns string with item's parameters.
        
        :param vehicle: vehicle: vehicle which descriptor will be passed to the params_helper.getParameters
        :param expanded: indicates if it should be expanded.
        :return: formatted user-string
        """
        try:
            description = i18n.makeString('#menu:descriptions/' +
                                          self.itemTypeName +
                                          ('Full' if expanded else ''))
            vehicleDescr = vehicle.descriptor if vehicle is not None else None
            params = params_helper.getParameters(self, vehicleDescr)
            formattedParametersDict = dict(
                formatters.getFormattedParamsList(self.descriptor, params))
            if self.itemTypeName == vehicles._VEHICLE:
                formattedParametersDict[
                    'caliber'] = BigWorld.wg_getIntegralFormat(
                        self.descriptor.gun.shots[0].shell.caliber)
            result = description % formattedParametersDict
            return result
        except Exception:
            LOG_CURRENT_EXCEPTION()
            return ''

        return
コード例 #11
0
    def construct(self):
        block = []
        block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(_ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)), padding=formatters.packPadding(bottom=8)))
        params = params_helper.getParameters(self.item)
        paramsResult = params_formatters.getFormattedParamsList(self.item.descriptor, params)
        for paramName, paramValue in paramsResult:
            block.append(self.__packParameterBloc(_ms('#menu:moduleInfo/params/' + paramName), paramValue, params_formatters.measureUnitsForParameter(paramName)))

        return block
コード例 #12
0
    def construct(self):
        block = []
        block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(_ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)), padding=formatters.packPadding(bottom=8)))
        params = params_helper.getParameters(self.item)
        paramsResult = params_formatters.getFormattedParamsList(self.item.descriptor, params)
        for paramName, paramValue in paramsResult:
            block.append(self.__packParameterBloc(_ms('#menu:moduleInfo/params/' + paramName), paramValue, params_formatters.measureUnitsForParameter(paramName)))

        return block
コード例 #13
0
    def __buildParams(self, module):
        values, names = [], []
        paramsData = params_helper.getParameters(module)
        for paramName in _PARAMS_LISTS[self._slotType]:
            value = paramsData.get(paramName)
            values.append(_formatValuesString(baseFormatParameter(paramName, value)))
            names.append(formatModuleParamName(paramName))

        return ('\n'.join(values), '\n'.join(names))
コード例 #14
0
ファイル: FortOrder.py プロジェクト: webiumsk/WOT-0.9.17-CT
 def getParams(self):
     result = []
     if self.isConsumable:
         from ClientFortifiedRegion import getBattleEquipmentByOrderID
         eqDescr = getBattleEquipmentByOrderID(self.orderID, self.level)
         if eqDescr is not None:
             eqItem = g_itemsCache.items.getItemByCD(eqDescr['compactDescr'])
             params = params_helper.getParameters(eqItem)
             result = formatters.getFormattedParamsList(eqDescr, params)
     return result
コード例 #15
0
    def __buildParams(self, module):
        values, names = [], []
        paramsData = params_helper.getParameters(module)
        for paramName in _PARAMS_LISTS[self._slotType]:
            value = paramsData.get(paramName)
            if value is not None:
                values.append(_formatValuesString(formatParameter(paramName, value)))
                names.append(formatModuleParamName(paramName))

        return ('\n'.join(values), '\n'.join(names))
コード例 #16
0
ファイル: fortorder.py プロジェクト: webiumsk/WOT-0.9.15.1
 def getParams(self):
     result = []
     if self.isConsumable:
         from ClientFortifiedRegion import getBattleEquipmentByOrderID
         eqDescr = getBattleEquipmentByOrderID(self.orderID, self.level)
         if eqDescr is not None:
             eqItem = g_itemsCache.items.getItemByCD(eqDescr['compactDescr'])
             params = params_helper.getParameters(eqItem)
             result = formatters.getFormattedParamsList(eqDescr, params)
     return result
コード例 #17
0
    def __buildBaseList(self):
        parameters = params_helper.getParameters(self._cache.item)
        if parameters is not None:
            formattedParameters = formatters.getFormattedParamsList(self._cache.item.descriptor, parameters)
            for paramName, value in formattedParameters:
                if not formatters.isRelativeParameter(paramName):
                    self._list.append({'titleText': formatters.formatVehicleParamName(paramName),
                     'valueText': text_styles.stats(value),
                     'isEnabled': False})

        return
コード例 #18
0
 def _makeSimpleParamBottomVO(self, param, vehIntCD = None):
     stockParams = getParameters(g_itemsCache.items.getStockVehicle(vehIntCD))
     data = getCommonParam(HANGAR_ALIASES.VEH_PARAM_RENDERER_STATE_SIMPLE_BOTTOM, param.name)
     data.update({'isEnabled': True,
      'tooltip': self._tooltipType,
      'indicatorVO': {'value': param.value,
                      'maxValue': MAX_RELATIVE_VALUE,
                      'markerValue': stockParams[param.name],
                      'minValue': 0,
                      'useAnim': self.useAnim}})
     return data
コード例 #19
0
    def getReserveParams(self, cmd):
        result = {}
        for intCD in cmd.reserve_intCDs:
            item = self.__itemsCache.items.getItemByCD(int(intCD))
            if item is None:
                _logger.warning('There is not a reserve with intCD=(%s)', intCD)
                continue
            rawParams = params_helper.getParameters(item)
            result[intCD] = {pName:pValue for pName, pValue in formatters.getFormattedParamsList(item.descriptor, rawParams)}

        return result
コード例 #20
0
    def __buildBaseList(self):
        parameters = params_helper.getParameters(self._cache.item)
        if parameters is not None:
            formattedParameters = formatters.getFormattedParamsList(self._cache.item.descriptor, parameters)
            for paramName, value in formattedParameters:
                if not formatters.isRelativeParameter(paramName):
                    self._list.append({'titleText': formatters.formatVehicleParamName(paramName),
                     'valueText': text_styles.stats(value),
                     'isEnabled': False})

        return
コード例 #21
0
ファイル: __init__.py プロジェクト: webiumsk/WOT-0.9.15-CT
    def _getShortInfo(self, vehicle = None, expanded = False):
        try:
            description = i18n.makeString('#menu:descriptions/' + self.itemTypeName + ('Full' if expanded else ''))
            vehicleDescr = vehicle.descriptor if vehicle is not None else None
            params = params_helper.getParameters(self, vehicleDescr)
            formattedParametersDict = dict(formatters.getFormattedParamsList(self.descriptor, params))
            if self.itemTypeName == vehicles._VEHICLE:
                formattedParametersDict['caliber'] = BigWorld.wg_getIntegralFormat(self.descriptor.gun['shots'][0]['shell']['caliber'])
            result = description % formattedParametersDict
            return result
        except Exception:
            LOG_CURRENT_EXCEPTION()
            return ''

        return
コード例 #22
0
    def _getShortInfo(self, vehicle=None, expanded=False):
        try:
            description = i18n.makeString('#menu:descriptions/' + self.itemTypeName + ('Full' if expanded else ''))
            vehicleDescr = vehicle.descriptor if vehicle is not None else None
            params = params_helper.getParameters(self, vehicleDescr)
            formattedParametersDict = dict(formatters.getFormattedParamsList(self.descriptor, params))
            if self.itemTypeName == vehicles._VEHICLE:
                formattedParametersDict['caliber'] = BigWorld.wg_getIntegralFormat(self.descriptor.gun.shots[0].shell.caliber)
            result = description % formattedParametersDict
            return result
        except Exception:
            LOG_CURRENT_EXCEPTION()
            return ''

        return
コード例 #23
0
    def _getShortInfo(self, vehicle=None, expanded=False):
        try:
            description = i18n.makeString(self._getShortInfoKey() +
                                          ('Full' if expanded else ''))
            vehicleDescr = vehicle.descriptor if vehicle is not None else None
            params = params_helper.getParameters(self, vehicleDescr)
            formattedParametersDict = dict(
                formatters.getFormattedParamsList(self.descriptor, params))
            result = description % formattedParametersDict
            return result
        except Exception:
            LOG_CURRENT_EXCEPTION()
            return ''

        return
コード例 #24
0
    def _fillSpecification(self, model, item):
        specifications = model.getSpecifications()
        specifications.clear()
        for paramName in _SHELLS_INFO_PARAMS:
            specificationModel = ShellSpecificationModel()
            specificationModel.setParamName(paramName)
            specificationModel.setMetricValue(
                i18n.makeString(MEASURE_UNITS.get(paramName, '')))
            shellParam = params_helper.getParameters(
                item,
                self._getVehicle().descriptor)
            specificationModel.setValue(
                formatParameter(paramName, shellParam.get(paramName)) or '')
            specifications.addViewModel(specificationModel)

        specifications.invalidate()
コード例 #25
0
ファイル: tooltipselement.py プロジェクト: aevitas/wotsdk
 def _packBonusBlock(self, data):
     vehicle = g_currentVehicle.item
     blocks = []
     conditionBonus = data['condition'] is not None and data['type'] != CUSTOMIZATION_TYPE.CAMOUFLAGE
     bonusTitleLocal = makeHtmlString('html_templates:lobby/textStyle', 'bonusLocalText', {'message': '{0}{1}'.format(data['bonus_title_local'], '*' if conditionBonus else '')})
     blocks.append(formatters.packImageTextBlockData(title=text_styles.concatStylesWithSpace(bonusTitleLocal), desc=text_styles.main(data['bonus_desc']), img=data['bonus_icon'], imgPadding={'left': 11,
      'top': 3}, txtGap=-4, txtOffset=70, padding={'top': -1,
      'left': 7}))
     if data['showTTC'] and vehicle is not None and self._cType == CUSTOMIZATION_TYPE.CAMOUFLAGE:
         stockVehicle = g_itemsCache.items.getStockVehicle(vehicle.intCD)
         comparator = params_helper.camouflageComparator(vehicle, self._item)
         stockParams = params_helper.getParameters(stockVehicle)
         simplifiedBlocks = SimplifiedStatsBlockConstructor(stockParams, comparator).construct()
         if len(simplifiedBlocks) > 0:
             blocks.extend(simplifiedBlocks)
     return formatters.packBuildUpBlockData(blocks, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)
コード例 #26
0
ファイル: vehicle.py プロジェクト: webiumsk/WOT-0.9.15.1
    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
コード例 #27
0
ファイル: vehicle.py プロジェクト: kusaku/wot_scripts
    def construct(self):
        block = []
        if self.configuration.params:
            comparator = params_helper.idealCrewComparator(self.vehicle)
            stockParams = params_helper.getParameters(self.itemsCache.items.getStockVehicle(self.vehicle.intCD))
            for paramName in RELATIVE_PARAMS:
                paramInfo = comparator.getExtendedData(paramName)
                fmtValue = param_formatter.colorizedFormatParameter(paramInfo, param_formatter.NO_BONUS_SIMPLIFIED_SCHEME)
                if fmtValue is not None:
                    buffIconSrc = ''
                    if self.vehicle.isInInventory:
                        buffIconSrc = param_formatter.getGroupPenaltyIcon(paramInfo, comparator)
                    block.append(formatters.packStatusDeltaBlockData(title=param_formatter.formatVehicleParamName(paramName), valueStr=fmtValue, statusBarData=SimplifiedBarVO(value=paramInfo.value, markerValue=stockParams[paramName]), buffIconSrc=buffIconSrc, padding=formatters.packPadding(left=74, top=8)))

        if block:
            block.insert(0, formatters.packTextBlockData(text_styles.middleTitle(_ms(TOOLTIPS.VEHICLEPARAMS_SIMPLIFIED_TITLE)), padding=formatters.packPadding(top=-4)))
        return block
コード例 #28
0
 def _makeSimpleParamBottomVO(self, param, vehIntCD=None):
     stockParams = getParameters(
         g_itemsCache.items.getStockVehicle(vehIntCD))
     data = getCommonParam(
         HANGAR_ALIASES.VEH_PARAM_RENDERER_STATE_SIMPLE_BOTTOM, param.name)
     data.update({
         'isEnabled': True,
         'tooltip': self._tooltipType,
         'indicatorVO': {
             'value': param.value,
             'maxValue': MAX_RELATIVE_VALUE,
             'markerValue': stockParams[param.name],
             'minValue': 0,
             'useAnim': self.useAnim
         }
     })
     return data
コード例 #29
0
 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
コード例 #30
0
    def _buildSimplifiedList(self):
        comparator = self._getComparator()
        stockParams = params_helper.getParameters(g_itemsCache.items.getStockVehicle(self._cache.item.intCD))
        for groupIdx, groupName in enumerate(RELATIVE_PARAMS):
            hasParams = False
            relativeParam = comparator.getExtendedData(groupName)
            self._list.extend([self._makeSimpleParamHeaderVO(relativeParam, self._expandedGroups[groupName]), self._makeSimpleParamBottomVO(relativeParam, stockParams[groupName])])
            if self._expandedGroups[groupName]:
                for paramName in PARAMS_GROUPS[groupName]:
                    param = comparator.getExtendedData(paramName)
                    if param.value is not None:
                        self._list.append(self.__makeAdvancedParamVO(param))
                        hasParams = True

            if hasParams and groupIdx < len(RELATIVE_PARAMS) - 1:
                self._list.append(self.__makeSeparator())

        return
コード例 #31
0
ファイル: vehicle.py プロジェクト: webiumsk/WOT-0.9.15.1
    def construct(self):
        block = []
        comparator = params_helper.idealCrewComparator(self.vehicle)
        stockParams = params_helper.getParameters(g_itemsCache.items.getStockVehicle(self.vehicle.intCD))
        for paramName in RELATIVE_PARAMS:
            paramInfo = comparator.getExtendedData(paramName)
            fmtValue = param_formatter.simlifiedVehicleParameter(paramInfo)
            if fmtValue is not None:
                block.append(formatters.packStatusDeltaBlockData(title=param_formatter.formatVehicleParamName(paramName), valueStr=fmtValue, statusBarData={'value': paramInfo.value,
                 'delta': 0,
                 'minValue': 0,
                 'markerValue': stockParams[paramName],
                 'maxValue': MAX_RELATIVE_VALUE,
                 'useAnim': False}, showDecreaseArrow=any((penalty[1] != 0 for penalty in paramInfo.penalties)), padding=formatters.packPadding(left=74, top=8)))

        if len(block) > 0:
            block.insert(0, formatters.packTextBlockData(text_styles.middleTitle(_ms(TOOLTIPS.VEHICLEPARAMS_SIMPLIFIED_TITLE)), padding=formatters.packPadding(top=-4)))
        return block
コード例 #32
0
    def _buildSimplifiedList(self):
        comparator = self._getComparator()
        stockParams = params_helper.getParameters(g_itemsCache.items.getStockVehicle(self._cache.item.intCD))
        for groupIdx, groupName in enumerate(RELATIVE_PARAMS):
            hasParams = False
            relativeParam = comparator.getExtendedData(groupName)
            self._list.extend([self.__makeSimpleParamHeaderVO(relativeParam, self._expandedGroups[groupName]), self._makeSimpleParamBottomVO(relativeParam, stockParams[groupName])])
            if self._expandedGroups[groupName]:
                for paramName in PARAMS_GROUPS[groupName]:
                    param = comparator.getExtendedData(paramName)
                    if param.value is not None:
                        self._list.append(self.__makeAdvancedParamVO(param))
                        hasParams = True

            if hasParams and groupIdx < len(RELATIVE_PARAMS) - 1:
                self._list.append(self.__makeSeparator())

        return
コード例 #33
0
ファイル: module.py プロジェクト: webiumsk/WOT-0.9.15-CT
 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
コード例 #34
0
ファイル: module.py プロジェクト: webiumsk/WOT-0.9.15.1
 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
コード例 #35
0
ファイル: veh_cmp.py プロジェクト: mahmoudimus/WOT-0.9.20.0
 def __packBonusBlock(self):
     blocks = []
     vehicle = cmp_helpers.getCmpConfiguratorMainView().getCurrentVehicle()
     itemID, camo = cmp_helpers.getSuitableCamouflage(vehicle)
     if camo:
         camo['itemID'] = itemID
     cmpItem = self.__getItem(camo, VEHICLE_CAMOUFLAGE_BONUS[vehicle.type])
     bonusTitleLocal = makeHtmlString('html_templates:lobby/textStyle', 'bonusLocalText', {'message': '{0}{1}'.format(cmpItem.qualifier.getFormattedValue(), '')})
     blocks.append(formatters.packImageTextBlockData(title=text_styles.concatStylesWithSpace(bonusTitleLocal), desc=text_styles.main(cmpItem.qualifier.getExtendedName()), img=cmpItem.qualifier.getIcon42x42(), imgPadding={'left': 11,
      'top': 3}, txtGap=-4, txtOffset=65, padding={'top': -1,
      'left': 7}))
     if not self._showTTC and vehicle is not None:
         stockVehicle = self.itemsCache.items.getStockVehicle(vehicle.intCD)
         comparator = params_helper.camouflageComparator(vehicle, cmpItem)
         stockParams = params_helper.getParameters(stockVehicle)
         simplifiedBlocks = SimplifiedStatsBlockConstructor(stockParams, comparator).construct()
         if len(simplifiedBlocks) > 0:
             blocks.extend(simplifiedBlocks)
     return formatters.packBuildUpBlockData(blocks, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)
コード例 #36
0
 def _makeSimpleParamBottomVO(self, param, vehIntCD=None):
     stockParams = getParameters(
         self.itemsCache.items.getStockVehicle(vehIntCD))
     data = getCommonParam(
         HANGAR_ALIASES.VEH_PARAM_RENDERER_STATE_SIMPLE_BOTTOM, param.name)
     delta = 0
     state, diff = param.state
     if state == PARAM_STATE.WORSE:
         delta = -abs(diff)
     data.update({
         'isEnabled':
         True,
         'tooltip':
         self._tooltipType,
         'indicatorVO':
         SimplifiedBarVO(value=param.value,
                         delta=delta,
                         markerValue=stockParams[param.name],
                         useAnim=self.useAnim)
     })
     return data
コード例 #37
0
ファイル: shell.py プロジェクト: kusaku/wot_scripts
 def _packBlocks(self, *args, **kwargs):
     self.item = self.context.buildItem(*args, **kwargs)
     items = super(ShellBlockToolTipData, self)._packBlocks()
     shell = self.item
     statsConfig = self.context.getStatsConfiguration(shell)
     paramsConfig = self.context.getParamsConfiguration(shell)
     statusConfig = self.context.getStatusConfiguration(shell)
     leftPadding = 20
     rightPadding = 20
     topPadding = 20
     lrPaddings = formatters.packPadding(left=leftPadding, right=rightPadding)
     blockTopPadding = -4
     blockPadding = formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding)
     textGap = -2
     vDescr = paramsConfig.vehicle.descriptor if paramsConfig.vehicle is not None else None
     params = params_helper.getParameters(shell, vDescr)
     showBasicData = self.__basicDataAllowed and params['isBasic']
     items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(shell, statsConfig, leftPadding, rightPadding, params).construct(), padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=topPadding)))
     priceBlock, invalidWidth = PriceBlockConstructor(shell, statsConfig, 80).construct()
     if priceBlock:
         self._setWidth(_TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH)
         items.append(formatters.packBuildUpBlockData(priceBlock, padding=blockPadding, gap=textGap))
     if vDescr is not None and not showBasicData:
         simplifiedStatsBlock = SimplifiedStatsBlockConstructor(shell, paramsConfig, params).construct()
         if simplifiedStatsBlock:
             items.append(formatters.packBuildUpBlockData(simplifiedStatsBlock, padding=blockPadding, gap=textGap))
     statusBlock = StatusBlockConstructor(shell, statusConfig).construct()
     if self.__basicDataAllowed:
         statsBlock = CommonStatsBlockConstructor(shell, paramsConfig, 80, params).construct()
     else:
         statsBlock = _AdvancedCommonStatsBlockConstructior(shell, paramsConfig, 80, params).construct()
     bottomPadding = 4 if statusBlock or showBasicData else 0
     if statsBlock:
         items.append(formatters.packBuildUpBlockData(statsBlock, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding, bottom=bottomPadding), gap=textGap))
     if statusBlock:
         items.append(formatters.packBuildUpBlockData(statusBlock, padding=lrPaddings))
     if showBasicData:
         boldText = text_styles.neutral(TOOLTIPS.SHELL_BASIC_DESCRIPTION_BOLD)
         items.append(formatters.packBuildUpBlockData([formatters.packTextBlockData(text_styles.standard(_ms(TOOLTIPS.SHELL_BASIC_DESCRIPTION, bold=boldText)), padding=lrPaddings)], padding=formatters.packPadding(right=rightPadding)))
     return items
def _extendByModuleData(targetData, vehicleModule, vehDescr):
    moduleType = vehicleModule.itemTypeID
    values, names = [], []
    paramsData = params_helper.getParameters(vehicleModule, vehDescr)
    paramsList = _PARAMS_LISTS[moduleType]
    if vehicleModule.itemTypeID == GUI_ITEM_TYPE.GUN and vehicleModule.isAutoReloadable(vehDescr):
        paramsList = paramsList[:-1] + ('autoReloadTime',)
        serverSettings = dependency.instance(ISettingsCore).serverSettings
        if serverSettings.checkAutoReloadHighlights():
            targetData['highlightedParameterIdx'] = 2
    for paramName in paramsList:
        value = paramsData.get(paramName)
        if value is not None:
            values.append(_formatValuesString(formatParameter(paramName, value)))
            names.append(formatModuleParamName(paramName))

    targetData['level'] = vehicleModule.level
    targetData['paramValues'] = '\n'.join(values)
    targetData['paramNames'] = '\n'.join(names)
    targetData['name'] = text_styles.middleTitle(vehicleModule.userName)
    targetData[EXTRA_MODULE_INFO] = vehicleModule.getExtraIconInfo(vehDescr)
    return
コード例 #39
0
ファイル: element.py プロジェクト: webiumsk/WOT-0.9.15.1
 def _packBonusBlock(self, data):
     vehicle = g_currentVehicle.item
     blocks = []
     conditionBonus = data['condition'] is not None and data[
         'type'] != CUSTOMIZATION_TYPE.CAMOUFLAGE
     bonusTitleLocal = makeHtmlString(
         'html_templates:lobby/textStyle', 'bonusLocalText', {
             'message':
             '{0}{1}'.format(data['bonus_title_local'],
                             '*' if conditionBonus else '')
         })
     blocks.append(
         formatters.packImageTextBlockData(
             title=text_styles.concatStylesWithSpace(bonusTitleLocal),
             desc=text_styles.main(data['bonus_desc']),
             img=data['bonus_icon'],
             imgPadding={
                 'left': 11,
                 'top': 3
             },
             txtGap=-4,
             txtOffset=70,
             padding={
                 'top': -1,
                 'left': 7
             }))
     if vehicle is not None and self._cType == CUSTOMIZATION_TYPE.CAMOUFLAGE:
         stockVehicle = g_itemsCache.items.getStockVehicle(vehicle.intCD)
         comparator = params_helper.camouflageComparator(
             vehicle, self._item)
         stockParams = params_helper.getParameters(stockVehicle)
         simplifiedBlocks = SimplifiedStatsBlockConstructor(
             stockParams, comparator).construct()
         if len(simplifiedBlocks) > 0:
             blocks.extend(simplifiedBlocks)
     return formatters.packBuildUpBlockData(
         blocks,
         linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE
     )
コード例 #40
0
ファイル: tooltipsvehicle.py プロジェクト: Difrex/wotsdk
    def construct(self):
        block = []
        if self.configuration.params:
            comparator = params_helper.idealCrewComparator(self.vehicle)
            stockParams = params_helper.getParameters(
                g_itemsCache.items.getStockVehicle(self.vehicle.intCD))
            for paramName in RELATIVE_PARAMS:
                paramInfo = comparator.getExtendedData(paramName)
                fmtValue = param_formatter.simplifiedVehicleParameter(
                    paramInfo)
                if fmtValue is not None:
                    buffIconSrc = ''
                    if self.vehicle.isInInventory:
                        buffIconSrc = params_helper.getBuffIcon(
                            paramInfo, comparator)
                    block.append(
                        formatters.packStatusDeltaBlockData(
                            title=param_formatter.formatVehicleParamName(
                                paramName),
                            valueStr=fmtValue,
                            statusBarData={
                                'value': paramInfo.value,
                                'delta': 0,
                                'minValue': 0,
                                'markerValue': stockParams[paramName],
                                'maxValue': MAX_RELATIVE_VALUE,
                                'useAnim': False
                            },
                            buffIconSrc=buffIconSrc,
                            padding=formatters.packPadding(left=74, top=8)))

        if len(block) > 0:
            block.insert(
                0,
                formatters.packTextBlockData(
                    text_styles.middleTitle(
                        _ms(TOOLTIPS.VEHICLEPARAMS_SIMPLIFIED_TITLE)),
                    padding=formatters.packPadding(top=-4)))
        return block
コード例 #41
0
def _extendByModuleData(targetData, module, vehDescr):
    moduleType = module.itemTypeID
    if not moduleType in GUI_ITEM_TYPE.VEHICLE_MODULES:
        raise AssertionError
        values, names = [], []
        paramsData = params_helper.getParameters(module)
        for paramName in _PARAMS_LISTS[moduleType]:
            value = paramsData.get(paramName)
            if value is not None:
                values.append(_formatValuesString(formatParameter(paramName, value)))
                names.append(formatModuleParamName(paramName))

        targetData['level'] = module.level
        targetData['paramValues'] = '\n'.join(values)
        targetData['paramNames'] = '\n'.join(names)
        targetData['name'] = text_styles.middleTitle(module.userName)
        if moduleType == GUI_ITEM_TYPE.GUN:
            targetData[EXTRA_MODULE_INFO] = module.isClipGun(vehDescr) and CLIP_ICON_PATH
    elif moduleType == GUI_ITEM_TYPE.CHASSIS:
        if module.isHydraulicChassis():
            targetData[EXTRA_MODULE_INFO] = HYDRAULIC_ICON_PATH
    return
コード例 #42
0
ファイル: module.py プロジェクト: webiumsk/WOT-0.9.15-CT
    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
コード例 #43
0
ファイル: tooltipsvehicle.py プロジェクト: aevitas/wotsdk
    def construct(self):
        block = []
        if self.configuration.params:
            comparator = params_helper.idealCrewComparator(self.vehicle)
            stockParams = params_helper.getParameters(g_itemsCache.items.getStockVehicle(self.vehicle.intCD))
            for paramName in RELATIVE_PARAMS:
                paramInfo = comparator.getExtendedData(paramName)
                fmtValue = param_formatter.simplifiedVehicleParameter(paramInfo)
                if fmtValue is not None:
                    buffIconSrc = ""
                    if self.vehicle.isInInventory:
                        buffIconSrc = params_helper.getBuffIcon(paramInfo, comparator)
                    block.append(
                        formatters.packStatusDeltaBlockData(
                            title=param_formatter.formatVehicleParamName(paramName),
                            valueStr=fmtValue,
                            statusBarData={
                                "value": paramInfo.value,
                                "delta": 0,
                                "minValue": 0,
                                "markerValue": stockParams[paramName],
                                "maxValue": MAX_RELATIVE_VALUE,
                                "useAnim": False,
                            },
                            buffIconSrc=buffIconSrc,
                            padding=formatters.packPadding(left=74, top=8),
                        )
                    )

        if len(block) > 0:
            block.insert(
                0,
                formatters.packTextBlockData(
                    text_styles.middleTitle(_ms(TOOLTIPS.VEHICLEPARAMS_SIMPLIFIED_TITLE)),
                    padding=formatters.packPadding(top=-4),
                ),
            )
        return block
コード例 #44
0
ファイル: tooltipsshell.py プロジェクト: aevitas/wotsdk
    def construct(self):
        block = []
        if self.configuration.params:
            shell = self.shell
            vehicle = self.configuration.vehicle
            vDescr = vehicle.descriptor if vehicle is not None else None
            params = params_helper.getParameters(shell, vDescr)
            piercingPower = params.pop('piercingPower')
            piercingPowerTable = params.pop('piercingPowerTable')
            maxShotDistance = params.pop('maxShotDistance') if 'maxShotDistance' in params else None
            formattedParameters = params_formatters.getFormattedParamsList(shell.descriptor, params)
            block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(_ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)), padding=formatters.packPadding(bottom=8)))
            for paramName, paramValue in formattedParameters:
                block.append(self.__packParameterBlock(_ms('#menu:moduleInfo/params/' + paramName), paramValue, params_formatters.measureUnitsForParameter(paramName)))

            piercingUnits = _ms(params_formatters.measureUnitsForParameter('piercingPower'))
            if isinstance(piercingPowerTable, list):
                block.append(formatters.packTitleDescBlock(title=text_styles.standard(_ms(MENU.MODULEINFO_PARAMS_PIERCINGDISTANCEHEADER)), padding=formatters.packPadding(bottom=8, top=8)))
                for distance, value in piercingPowerTable:
                    if maxShotDistance is not None and distance == _AUTOCANNON_SHOT_DISTANCE:
                        piercingUnits += '*'
                    block.append(self.__packParameterBlock(_ms(MENU.MODULEINFO_PARAMS_PIERCINGDISTANCE, dist=distance), params_formatters.baseFormatParameter('piercingPower', value), piercingUnits))

                if maxShotDistance is not None:
                    block.append(formatters.packTitleDescBlock(title=text_styles.standard(_ms(MENU.MODULEINFO_PARAMS_MAXSHOTDISTANCE_FOOTNOTE)), padding=formatters.packPadding(top=8)))
            else:
                if piercingPowerTable != NO_DATA:
                    piercingUnits += '*'
                block.append(self.__packParameterBlock(_ms(MENU.MODULEINFO_PARAMS_PIERCINGPOWER), params_formatters.baseFormatParameter('piercingPower', piercingPower), piercingUnits))
                if piercingPowerTable != NO_DATA:
                    title = _ms(MENU.MODULEINFO_PARAMS_NOPIERCINGDISTANCE_FOOTNOTE)
                    distanceNote = ''
                    if maxShotDistance is not None:
                        distanceNote = _ms(MENU.MODULEINFO_PARAMS_NOPIERCINGDISTANCE_FOOTNOTE_MAXDISTANCE)
                    title = title % distanceNote
                    block.append(formatters.packTitleDescBlock(title=text_styles.standard(title), padding=formatters.packPadding(top=8)))
        return block