Пример #1
0
    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
Пример #2
0
def getVehicleParameters(vehicle):
    vehicleParams = _VehicleParams(
        vehicle).getParamsDict() if GUI_SETTINGS.technicalInfo else {}
    params = []
    paramsList = getTreeVehicleParams()
    for paramGroup in _PARAMS_GROUPS:
        group = []
        for paramName in paramGroup:
            if paramName in paramsList:
                fmtValue = params_formatters.formatParameter(
                    paramName, vehicleParams.get(paramName))
                if fmtValue is not None:
                    group.append({
                        'value':
                        str(fmtValue),
                        'description':
                        params_formatters.formatVehicleParamName(paramName),
                        'isLastInGroup':
                        False
                    })
                else:
                    _logger.warning("Couldn't format value for %s", paramName)

        if group:
            group[-1]['isLastInGroup'] = True
            params.extend(group)

    return params
def getExtendedParameters(currModule, module, vehicle):
    params = []
    if currModule is None:
        moduleDescr = _getModuleDescr(module, vehicle)
        currModule = _getCurrentModule(moduleDescr)
    typeCDCurrentModule = getTypeOfCompactDescr(currModule.intCD)
    typeCDNewModule = getTypeOfCompactDescr(module.intCD)
    difference = 0
    if typeCDCurrentModule == GUI_ITEM_TYPE.CHASSIS and typeCDNewModule == GUI_ITEM_TYPE.CHASSIS:
        defaultHull = vehicle.typeDescr.hulls[0]
        newNull = [
            hull for hull in vehicle.typeDescr.hulls
            if module.innationID in hull.variantMatch
        ]
        newNull = newNull[0] if newNull else None
        if newNull:
            difference = newNull.maxHealth - defaultHull.maxHealth
    elif typeCDCurrentModule == GUI_ITEM_TYPE.TURRET and typeCDNewModule == GUI_ITEM_TYPE.TURRET:
        difference = module.descriptor.maxHealth - currModule.descriptor.maxHealth
    if difference:
        fmtValue = params_formatters.formatParameter('maxHealth', difference,
                                                     'better', _DELTA_SCHEME,
                                                     _CMP_FORMAT_SETTINGS)
        params.append({
            'value':
            str(fmtValue),
            'description':
            params_formatters.formatVehicleParamName('increaseHealth')
        })
    return params
Пример #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 __makeAdvancedParamVO(self, param):
     return {'state': HANGAR_ALIASES.VEH_PARAM_RENDERER_STATE_ADVANCED,
      'titleText': formatters.formatVehicleParamName(param.name, False),
      'valueText': formatters.colorizedFormatParameter(param, self._getBaseFormatters()),
      'iconSource': formatters.getParameterIconPath(param.name),
      'paramID': param.name,
      'isEnabled': False,
      'tooltip': self._tooltipType}
def getAllParametersTitles():
    result = []
    for groupIdx, groupName in enumerate(RELATIVE_PARAMS):
        data = getCommonParam(HANGAR_ALIASES.VEH_PARAM_RENDERER_STATE_SIMPLE_TOP, groupName)
        data['titleText'] = formatters.formatVehicleParamName(groupName)
        data['isEnabled'] = True
        data['tooltip'] = TOOLTIPS_CONSTANTS.BASE_VEHICLE_PARAMETERS
        result.append(data)
        for paramName in PARAMS_GROUPS[groupName]:
            data = getCommonParam(HANGAR_ALIASES.VEH_PARAM_RENDERER_STATE_ADVANCED, paramName)
            data['iconSource'] = formatters.getParameterIconPath(paramName)
            data['titleText'] = formatters.formatVehicleParamName(paramName)
            data['isEnabled'] = False
            data['tooltip'] = TOOLTIPS_CONSTANTS.BASE_VEHICLE_PARAMETERS
            result.append(data)

    return result
Пример #7
0
 def __makeAdvancedParamVO(self, param):
     return {'state': HANGAR_ALIASES.VEH_PARAM_RENDERER_STATE_ADVANCED,
      'titleText': formatters.formatVehicleParamName(param.name, False),
      'valueText': formatters.colorizedFormatParameter(param, self._getBaseFormatters()),
      'iconSource': formatters.getParameterIconPath(param.name),
      'paramID': param.name,
      'isEnabled': False,
      'tooltip': self._tooltipType}
Пример #8
0
 def _makeSimpleParamHeaderVO(self, param, isOpen, comparator):
     data = super(_VehParamsGenerator, self)._makeSimpleParamHeaderVO(param, isOpen, comparator)
     data.update({'titleText': formatters.formatVehicleParamName(param.name),
      'valueText': self._getSimplifiedValue(param),
      'isEnabled': True,
      'tooltip': self._tooltipType,
      'isOpen': isOpen,
      'buffIconSrc': params_helper.getBuffIcon(param, comparator)})
     return data
Пример #9
0
 def __makeSimpleParamHeaderVO(self, param, isOpen):
     return {'state': HANGAR_ALIASES.VEH_PARAM_RENDERER_STATE_SIMPLE_TOP,
      'titleText': formatters.formatVehicleParamName(param.name),
      'valueText': formatters.colorizedFormatParameter(param, self._getSimplifiedFormatters()),
      'paramID': param.name,
      'isEnabled': True,
      'tooltip': self._tooltipType,
      'isOpen': isOpen,
      'showDecreaseArrow': param.state[0] == PARAM_STATE.WORSE}
Пример #10
0
 def _makeSimpleParamHeaderVO(self, param, isOpen):
     return {'state': HANGAR_ALIASES.VEH_PARAM_RENDERER_STATE_SIMPLE_TOP,
      'titleText': formatters.formatVehicleParamName(param.name),
      'valueText': self._getSimplifiedValue(param),
      'paramID': param.name,
      'isEnabled': True,
      'tooltip': self._tooltipType,
      'isOpen': isOpen,
      'showDecreaseArrow': self._showDecreaseArrow(param)}
Пример #11
0
def getAllParametersTitles():
    result = []
    for groupIdx, groupName in enumerate(RELATIVE_PARAMS):
        data = getCommonParam(
            HANGAR_ALIASES.VEH_PARAM_RENDERER_STATE_SIMPLE_TOP, groupName)
        data['titleText'] = formatters.formatVehicleParamName(groupName)
        data['isEnabled'] = True
        data['tooltip'] = TOOLTIPS_CONSTANTS.BASE_VEHICLE_PARAMETERS
        result.append(data)
        for paramName in PARAMS_GROUPS[groupName]:
            data = getCommonParam(
                HANGAR_ALIASES.VEH_PARAM_RENDERER_STATE_ADVANCED, paramName)
            data['iconSource'] = formatters.getParameterIconPath(paramName)
            data['titleText'] = formatters.formatVehicleParamName(paramName)
            data['isEnabled'] = False
            data['tooltip'] = TOOLTIPS_CONSTANTS.BASE_VEHICLE_PARAMETERS
            result.append(data)

    return result
Пример #12
0
 def _makeAdvancedParamVO(self, param):
     if param.value is not None:
         data = super(_VehParamsGenerator, self)._makeAdvancedParamVO(param)
         data.update({'titleText': formatters.formatVehicleParamName(param.name, False),
          'valueText': formatters.colorizedFormatParameter(param, self._getBaseFormatters()),
          'iconSource': formatters.getParameterIconPath(param.name),
          'isEnabled': False,
          'tooltip': self._tooltipType})
         return data
     else:
         return
Пример #13
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
Пример #14
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
Пример #15
0
 def _makeSimpleParamHeaderVO(self, param, isOpen, comparator):
     data = super(_VehParamsGenerator,
                  self)._makeSimpleParamHeaderVO(param, isOpen, comparator)
     data.update({
         'titleText': formatters.formatVehicleParamName(param.name),
         'valueText': self._getSimplifiedValue(param),
         'isEnabled': True,
         'tooltip': self._tooltipType,
         'isOpen': isOpen,
         'buffIconSrc': params_helper.getBuffIcon(param, comparator)
     })
     return data
Пример #16
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
Пример #17
0
    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
Пример #18
0
    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
Пример #19
0
 def _makeAdvancedParamVO(self, param):
     if param.value:
         data = super(_VehParamsGenerator, self)._makeAdvancedParamVO(param)
         data.update({
             'titleText':
             formatters.formatVehicleParamName(param.name, False),
             'valueText':
             formatters.colorizedFullFormatParameter(
                 param, self._getBaseFormatters()),
             'iconSource':
             formatters.getParameterSmallIconPath(param.name),
             'isEnabled':
             False,
             'tooltip':
             self._getAdvancedParamTooltip(param)
         })
         return data
     else:
         return None
Пример #20
0
    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
Пример #21
0
    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