Example #1
0
    def __createPenaltiesStr(self, penalties):
        result = []
        for tankmanType, value, isOtherVehicle in penalties:
            if not param_formatter.isRelativeParameter(self.__paramName):
                valueStr = str(
                    param_formatter.baseFormatParameter(
                        self.__paramName, value))
                if value > 0:
                    valueStr = '+' + valueStr
                valueStr = text_styles.error(
                    _ms(TOOLTIPS.VEHICLEPARAMS_PENALTY_TANKMANLEVEL_VALUE,
                        value=valueStr))
            else:
                valueStr = ''
            if isOtherVehicle:
                locKey = TOOLTIPS.VEHICLEPARAMS_PENALTY_TANKMANDIFFERENTVEHICLE_TEMPLATE
            else:
                locKey = TOOLTIPS.VEHICLEPARAMS_PENALTY_TANKMANLEVEL_TEMPLATE
            result.append(
                text_styles.main(
                    _ms(locKey,
                        tankmanType=_ms(ITEM_TYPES.tankman_roles(tankmanType)),
                        value=valueStr)))

        return '\n'.join(result)
    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))
Example #3
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))
Example #4
0
    def __createPenaltiesStr(self, penalties):
        result = []
        for tankmanType, value, isOtherVehicle in penalties:
            if not param_formatter.isRelativeParameter(self.__paramName):
                valueStr = str(param_formatter.baseFormatParameter(self.__paramName, value))
                if value > 0:
                    valueStr = '+' + valueStr
                valueStr = text_styles.error(_ms(TOOLTIPS.VEHICLEPARAMS_PENALTY_TANKMANLEVEL_VALUE, value=valueStr))
            else:
                valueStr = ''
            if isOtherVehicle:
                locKey = TOOLTIPS.VEHICLEPARAMS_PENALTY_TANKMANDIFFERENTVEHICLE_TEMPLATE
            else:
                locKey = TOOLTIPS.VEHICLEPARAMS_PENALTY_TANKMANLEVEL_TEMPLATE
            result.append(text_styles.main(_ms(locKey, tankmanType=_ms(ITEM_TYPES.tankman_roles(tankmanType)), value=valueStr)))

        return '\n'.join(result)
Example #5
0
    def construct(self):
        block = []
        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
Example #6
0
    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
Example #7
0
def CommonStatsBlockConstructor_construct(base, self):
    try:
        self.leftPadding = -15
        vehicle = self.vehicle
        cache_result = carousel_tooltips_cache.get(vehicle.intCD)
        if cache_result:
            return cache_result
        result = []
        if not config.get('tooltips/hideSimplifiedVehParams'):
            result.append(
                formatters.packTitleDescBlock(text_styles.middleTitle(
                    i18n.makeString(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)),
                                              padding=formatters.packPadding(
                                                  left=0,
                                                  right=self.rightPadding,
                                                  bottom=8)))
        params = self.configuration.params
        veh_descr = vehicle.descriptor
        gun = vehicle.gun.descriptor
        turret = vehicle.turret.descriptor
        comparator = idealCrewComparator_helper(vehicle)
        vehicleCommonParams = dict(getParameters_helper(vehicle))
        veh_type_inconfig = vehicle.type.replace('AT-SPG', 'TD')
        clipGunInfoShown = False
        premium_shells = {}

        for shell in vehicle.shells:
            premium_shells[shell.intCompactDescr] = shell.isPremium
        if params:
            values = config.get('tooltips/%s' % veh_type_inconfig)
            if values and len(values):
                params_list = values  # overriding parameters
            else:
                params_list = self.PARAMS.get(vehicle.type,
                                              'default')  # original parameters
            for paramName in params_list:
                if paramName in vehicleCommonParams:
                    paramInfo = comparator.getExtendedData(paramName)
                if paramName == 'turretArmor' and not vehicle.hasTurrets:
                    continue
                #maxHealth
                elif paramName == 'maxHealth':
                    tooltip_add_param(
                        self, result,
                        i18n.makeString('#menu:vehicleInfo/params/maxHealth'),
                        formatNumber(veh_descr.maxHealth))
                #battle tiers
                elif paramName == 'battleTiers':
                    (minTier, maxTier) = getTiers(vehicle.level, vehicle.type,
                                                  vehicle.name)
                    tooltip_add_param(self, result, l10n('Battle tiers'),
                                      '%s..%s' % (minTier, maxTier))
                #explosionRadius
                elif paramName == 'explosionRadius':
                    explosionRadiusMin = 999
                    explosionRadiusMax = 0
                    for shot in gun['shots']:
                        if 'explosionRadius' in shot['shell']:
                            if shot['shell'][
                                    'explosionRadius'] < explosionRadiusMin:
                                explosionRadiusMin = shot['shell'][
                                    'explosionRadius']
                            if shot['shell'][
                                    'explosionRadius'] > explosionRadiusMax:
                                explosionRadiusMax = shot['shell'][
                                    'explosionRadius']
                    if explosionRadiusMax == 0:  # no HE
                        continue
                    explosionRadius_str = formatNumber(explosionRadiusMin)
                    if explosionRadiusMin != explosionRadiusMax:
                        explosionRadius_str += '/%s' % gold_pad(
                            formatNumber(explosionRadiusMax))
                    tooltip_add_param(self, result,
                                      getParameterValue(paramName),
                                      explosionRadius_str)
                #shellSpeedSummary
                elif paramName == 'shellSpeedSummary':
                    shellSpeedSummary_arr = []
                    for shot in gun['shots']:
                        shellSpeed_str = '%g' % round(shot['speed'] * 1.25)
                        if premium_shells[shot['shell']['compactDescr']]:
                            shellSpeed_str = gold_pad(shellSpeed_str)
                        shellSpeedSummary_arr.append(shellSpeed_str)
                    shellSpeedSummary_str = '/'.join(shellSpeedSummary_arr)
                    tooltip_add_param(
                        self, result,
                        tooltip_with_units(l10n('shellSpeed'),
                                           l10n('(m/sec)')),
                        shellSpeedSummary_str)
                #piercingPowerAvg
                elif paramName == 'piercingPowerAvg':
                    piercingPowerAvg = formatNumber(
                        veh_descr.shot['piercingPower'][0])
                    tooltip_add_param(
                        self, result,
                        replace_p(
                            i18n.makeString(
                                '#menu:moduleInfo/params/avgPiercingPower')),
                        piercingPowerAvg)
                #piercingPowerAvgSummary
                elif paramName == 'piercingPowerAvgSummary':
                    piercingPowerAvgSummary_arr = []
                    for shot in gun['shots']:
                        piercingPower_str = formatNumber(
                            shot['piercingPower'][0])
                        if premium_shells[shot['shell']['compactDescr']]:
                            piercingPower_str = gold_pad(piercingPower_str)
                        piercingPowerAvgSummary_arr.append(piercingPower_str)
                    piercingPowerAvgSummary_str = '/'.join(
                        piercingPowerAvgSummary_arr)
                    tooltip_add_param(
                        self, result,
                        replace_p(
                            i18n.makeString(
                                '#menu:moduleInfo/params/avgPiercingPower')),
                        piercingPowerAvgSummary_str)
                #damageAvgSummary
                elif paramName == 'damageAvgSummary':
                    damageAvgSummary_arr = []
                    for shot in gun['shots']:
                        damageAvg_str = formatNumber(
                            shot['shell']['damage'][0])
                        if premium_shells[shot['shell']['compactDescr']]:
                            damageAvg_str = gold_pad(damageAvg_str)
                        damageAvgSummary_arr.append(damageAvg_str)
                    damageAvgSummary_str = '/'.join(damageAvgSummary_arr)
                    tooltip_add_param(
                        self, result,
                        replace_p(
                            i18n.makeString(
                                '#menu:moduleInfo/params/avgDamage')),
                        damageAvgSummary_str)
                #magazine loading
                elif (paramName == 'reloadTimeSecs' or paramName
                      == 'rateOfFire') and vehicle.gun.isClipGun():
                    if clipGunInfoShown:
                        continue
                    (shellsCount, shellReloadingTime) = gun['clip']
                    reloadMagazineTime = gun['reloadTime']
                    shellReloadingTime_str = formatNumber(shellReloadingTime)
                    reloadMagazineTime_str = formatNumber(reloadMagazineTime)
                    tooltip_add_param(
                        self, result,
                        replace_p(
                            i18n.makeString(
                                '#menu:moduleInfo/params/shellsCount')),
                        shellsCount)
                    tooltip_add_param(
                        self, result,
                        replace_p(
                            i18n.makeString(
                                '#menu:moduleInfo/params/shellReloadingTime')),
                        shellReloadingTime_str)
                    tooltip_add_param(
                        self, result,
                        replace_p(
                            i18n.makeString(
                                '#menu:moduleInfo/params/reloadMagazineTime')),
                        reloadMagazineTime_str)
                    clipGunInfoShown = True
                #rate of fire
                elif paramName == 'rateOfFire' and not vehicle.gun.isClipGun():
                    rateOfFire_str = formatNumber(60 / gun['reloadTime'])
                    tooltip_add_param(
                        self, result,
                        replace_p(
                            i18n.makeString(
                                '#menu:moduleInfo/params/reloadTime')),
                        rateOfFire_str)
                # gun traverse limits
                elif paramName == 'traverseLimits' and gun['turretYawLimits']:
                    (traverseMin, traverseMax) = gun['turretYawLimits']
                    traverseLimits_str = '%g..+%g' % (round(
                        degrees(traverseMin)), round(degrees(traverseMax)))
                    tooltip_add_param(self, result, l10n('traverseLimits'),
                                      traverseLimits_str)
                # elevation limits (front)
                elif paramName == 'pitchLimits':
                    (pitchMax, pitchMin) = calcPitchLimitsFromDesc(
                        0, gun['pitchLimits'])
                    pitchLimits_str = '%g..+%g' % (round(
                        degrees(-pitchMin)), round(degrees(-pitchMax)))
                    tooltip_add_param(self, result, l10n('pitchLimits'),
                                      pitchLimits_str)
                # elevation limits (side)
                elif paramName == 'pitchLimitsSide':
                    if gun['turretYawLimits'] and abs(
                            degrees(gun['turretYawLimits'][0])) < 89:
                        continue  # can't look aside 90 degrees
                    (pitchMax, pitchMin) = calcPitchLimitsFromDesc(
                        pi / 2, gun['pitchLimits'])
                    pitchLimits_str = '%g..+%g' % (round(
                        degrees(-pitchMin)), round(degrees(-pitchMax)))
                    tooltip_add_param(self, result, l10n('pitchLimitsSide'),
                                      pitchLimits_str)
                # elevation limits (rear)
                elif paramName == 'pitchLimitsRear':
                    if gun['turretYawLimits']: continue  # can't look back
                    (pitchMax, pitchMin) = calcPitchLimitsFromDesc(
                        pi, gun['pitchLimits'])
                    pitchLimits_str = '%g..+%g' % (round(
                        degrees(-pitchMin)), round(degrees(-pitchMax)))
                    tooltip_add_param(self, result, l10n('pitchLimitsRear'),
                                      pitchLimits_str)
                # shooting range
                elif paramName == 'shootingRadius':
                    viewRange, shellRadius, artiRadius = _getRanges(
                        turret, gun, vehicle.nationName, vehicle.type)
                    if vehicle.type == 'SPG':
                        tooltip_add_param(
                            self, result,
                            tooltip_with_units(l10n('shootingRadius'),
                                               l10n('(m)')), artiRadius)
                    elif shellRadius < 707:
                        tooltip_add_param(
                            self, result,
                            tooltip_with_units(l10n('shootingRadius'),
                                               l10n('(m)')), shellRadius)
                #reverse max speed
                elif paramName == 'speedLimits':
                    (speedLimitForward,
                     speedLimitReverse) = veh_descr.physics['speedLimits']
                    speedLimits_str = str(int(
                        speedLimitForward * 3.6)) + '/' + str(
                            int(speedLimitReverse * 3.6))
                    tooltip_add_param(self, result,
                                      getParameterValue(paramName),
                                      speedLimits_str)
                #turret rotation speed
                elif paramName == 'turretRotationSpeed' or paramName == 'gunRotationSpeed':
                    if not vehicle.hasTurrets:
                        paramName = 'gunRotationSpeed'
                    turretRotationSpeed_str = str(
                        int(degrees(veh_descr.turret['rotationSpeed'])))
                    tooltip_add_param(
                        self, result,
                        tooltip_with_units(
                            i18n.makeString('#menu:tank_params/%s' %
                                            paramName).rstrip(),
                            i18n.makeString('#menu:tank_params/gps')),
                        turretRotationSpeed_str)
                #terrain resistance
                elif paramName == 'terrainResistance':
                    resistances_arr = []
                    for key in veh_descr.chassis['terrainResistance']:
                        resistances_arr.append(formatNumber(key))
                    terrainResistance_str = '/'.join(resistances_arr)
                    tooltip_add_param(self, result, l10n('terrainResistance'),
                                      terrainResistance_str)
                #radioRange
                elif paramName == 'radioRange':
                    radioRange_str = '%s' % int(
                        vehicle.radio.descriptor['distance'])
                    tooltip_add_param(
                        self, result,
                        replace_p(
                            i18n.makeString(
                                '#menu:moduleInfo/params/radioDistance')),
                        radioRange_str)
                #gravity
                elif paramName == 'gravity':
                    gravity_str = formatNumber(veh_descr.shot['gravity'])
                    tooltip_add_param(self, result, l10n('gravity'),
                                      gravity_str)
                #inner name, for example - ussr:R100_SU122A
                elif paramName == 'innerName':
                    tooltip_add_param(self, result, vehicle.name, '')
                #custom text
                elif paramName.startswith('TEXT:'):
                    customtext = paramName[5:]
                    tooltip_add_param(self, result, l10n(customtext), '')
                elif paramName in paramInfo.name:
                    valueStr = str(
                        param_formatter.baseFormatParameter(
                            paramName, paramInfo.value))
                    tooltip_add_param(self, result,
                                      getParameterValue(paramName), valueStr)
        if vehicle.isInInventory:
            # optional devices icons, must be in the end
            if 'optDevicesIcons' in params_list:
                optDevicesIcons_arr = []
                for key in vehicle.optDevices:
                    if key:
                        imgPath = 'img://gui' + key.icon.lstrip('.')
                    else:
                        imgPath = 'img://gui/maps/icons/artefact/empty.png'
                    optDevicesIcons_arr.append(
                        '<img src="%s" height="16" width="16">' % imgPath)
                optDevicesIcons_str = ' '.join(optDevicesIcons_arr)
                tooltip_add_param(self, result, optDevicesIcons_str, '')

            # equipment icons, must be in the end
            if 'equipmentIcons' in params_list:
                equipmentIcons_arr = []
                for key in vehicle.eqs:
                    if key:
                        imgPath = 'img://gui' + key.icon.lstrip('.')
                    else:
                        imgPath = 'img://gui/maps/icons/artefact/empty.png'
                    equipmentIcons_arr.append(
                        '<img src="%s" height="16" width="16">' % imgPath)
                equipmentIcons_str = ' '.join(equipmentIcons_arr)
                if config.get('tooltips/combineIcons') and optDevicesIcons_str:
                    tmp_list = []
                    tooltip_add_param(self, tmp_list, equipmentIcons_str, '')
                    result[-1]['data'][
                        'name'] += ' ' + tmp_list[0]['data']['name']
                else:
                    tooltip_add_param(self, result, equipmentIcons_str, '')

        # crew roles icons, must be in the end
        if 'crewRolesIcons' in params_list:
            imgPath = 'img://../mods/shared_resources/xvm/res/icons/tooltips/roles'
            crewRolesIcons_arr = []
            for tankman_role in vehicle.descriptor.type.crewRoles:
                crewRolesIcons_arr.append(
                    '<img src="%s/%s.png" height="16" width="16">' %
                    (imgPath, tankman_role[0]))
            crewRolesIcons_str = ''.join(crewRolesIcons_arr)
            tooltip_add_param(self, result, crewRolesIcons_str, '')
        if len(result) > 31:  # limitation
            result = result[:31]
        carousel_tooltips_cache[vehicle.intCD] = result
        return result
    except Exception as ex:
        err(traceback.format_exc())
        return base(self)
Example #8
0
def CommonStatsBlockConstructor_construct(base, self):
    try:
        self.leftPadding = -15
        vehicle = self.vehicle
        cache_result = carousel_tooltips_cache.get(vehicle.intCD)
        if cache_result:
            return cache_result
        result = []
        if not config.get('tooltips/hideSimplifiedVehParams'):
            result.append(formatters.packTitleDescBlock(text_styles.middleTitle(i18n.makeString(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)), padding=formatters.packPadding(left=0, right=self.rightPadding, bottom=8)))
        params = self.configuration.params
        veh_descr = vehicle.descriptor
        gun = vehicle.gun.descriptor
        turret = vehicle.turret.descriptor
        comparator = idealCrewComparator_helper(vehicle)
        vehicleCommonParams = dict(getParameters_helper(vehicle))
        veh_type_inconfig = vehicle.type.replace('AT-SPG', 'TD')
        clipGunInfoShown = False
        premium_shells = {}

        for shell in vehicle.shells:
            premium_shells[shell.intCompactDescr] = shell.isPremium
        if params:
            values = config.get('tooltips/%s' % veh_type_inconfig)
            if values and len(values):
                params_list = values # overriding parameters
            else:
                params_list = self.PARAMS.get(vehicle.type, 'default') # original parameters
            for paramName in params_list:
                if paramName in vehicleCommonParams:
                    paramInfo = comparator.getExtendedData(paramName)
                if paramName == 'turretArmor' and not vehicle.hasTurrets:
                    continue
                #maxHealth
                elif paramName == 'maxHealth':
                    tooltip_add_param(self, result, i18n.makeString('#menu:vehicleInfo/params/maxHealth'), formatNumber(veh_descr.maxHealth))
                #battle tiers
                elif paramName == 'battleTiers':
                    (minTier, maxTier) = getTiers(vehicle.level, vehicle.type, vehicle.name)
                    tooltip_add_param(self, result, l10n('Battle tiers'), '%s..%s' % (minTier, maxTier))
                #explosionRadius
                elif paramName == 'explosionRadius':
                    explosionRadiusMin = 999
                    explosionRadiusMax = 0
                    for shot in gun['shots']:
                        if 'explosionRadius' in shot['shell']:
                            if shot['shell']['explosionRadius'] < explosionRadiusMin:
                                explosionRadiusMin = shot['shell']['explosionRadius']
                            if shot['shell']['explosionRadius'] > explosionRadiusMax:
                                explosionRadiusMax = shot['shell']['explosionRadius']
                    if explosionRadiusMax == 0: # no HE
                        continue
                    explosionRadius_str = formatNumber(explosionRadiusMin)
                    if explosionRadiusMin != explosionRadiusMax:
                        explosionRadius_str += '/%s' % gold_pad(formatNumber(explosionRadiusMax))
                    tooltip_add_param(self, result, getParameterValue(paramName), explosionRadius_str)
                #shellSpeedSummary
                elif paramName == 'shellSpeedSummary':
                    shellSpeedSummary_arr = []
                    for shot in gun['shots']:
                        shellSpeed_str = '%g' % round(shot['speed'] * 1.25)
                        if premium_shells[shot['shell']['compactDescr']]:
                            shellSpeed_str = gold_pad(shellSpeed_str)
                        shellSpeedSummary_arr.append(shellSpeed_str)
                    shellSpeedSummary_str = '/'.join(shellSpeedSummary_arr)
                    tooltip_add_param(self, result, tooltip_with_units(l10n('shellSpeed'), l10n('(m/sec)')), shellSpeedSummary_str)
                #piercingPowerAvg
                elif paramName == 'piercingPowerAvg':
                    piercingPowerAvg = formatNumber(veh_descr.shot['piercingPower'][0])
                    tooltip_add_param(self, result, replace_p(i18n.makeString('#menu:moduleInfo/params/avgPiercingPower')), piercingPowerAvg)
                #piercingPowerAvgSummary
                elif paramName == 'piercingPowerAvgSummary':
                    piercingPowerAvgSummary_arr = []
                    for shot in gun['shots']:
                        piercingPower_str = formatNumber(shot['piercingPower'][0])
                        if premium_shells[shot['shell']['compactDescr']]:
                            piercingPower_str = gold_pad(piercingPower_str)
                        piercingPowerAvgSummary_arr.append(piercingPower_str)
                    piercingPowerAvgSummary_str = '/'.join(piercingPowerAvgSummary_arr)
                    tooltip_add_param(self, result, replace_p(i18n.makeString('#menu:moduleInfo/params/avgPiercingPower')), piercingPowerAvgSummary_str)
                #damageAvgSummary
                elif paramName == 'damageAvgSummary':
                    damageAvgSummary_arr = []
                    for shot in gun['shots']:
                        damageAvg_str = formatNumber(shot['shell']['damage'][0])
                        if premium_shells[shot['shell']['compactDescr']]:
                            damageAvg_str = gold_pad(damageAvg_str)
                        damageAvgSummary_arr.append(damageAvg_str)
                    damageAvgSummary_str = '/'.join(damageAvgSummary_arr)
                    tooltip_add_param(self, result, replace_p(i18n.makeString('#menu:moduleInfo/params/avgDamage')), damageAvgSummary_str)
                #magazine loading
                elif (paramName == 'reloadTimeSecs' or paramName == 'rateOfFire') and vehicle.gun.isClipGun():
                    if clipGunInfoShown:
                        continue
                    (shellsCount, shellReloadingTime) = gun['clip']
                    reloadMagazineTime = gun['reloadTime']
                    shellReloadingTime_str = formatNumber(shellReloadingTime)
                    reloadMagazineTime_str = formatNumber(reloadMagazineTime)
                    tooltip_add_param(self, result, replace_p(i18n.makeString('#menu:moduleInfo/params/shellsCount')), shellsCount)
                    tooltip_add_param(self, result, replace_p(i18n.makeString('#menu:moduleInfo/params/shellReloadingTime')), shellReloadingTime_str)
                    tooltip_add_param(self, result, replace_p(i18n.makeString('#menu:moduleInfo/params/reloadMagazineTime')), reloadMagazineTime_str)
                    clipGunInfoShown = True
                #rate of fire
                elif paramName == 'rateOfFire' and not vehicle.gun.isClipGun():
                    rateOfFire_str = formatNumber(60 / gun['reloadTime'])
                    tooltip_add_param(self, result, replace_p(i18n.makeString('#menu:moduleInfo/params/reloadTime')), rateOfFire_str)
                # gun traverse limits
                elif paramName == 'traverseLimits' and gun['turretYawLimits']:
                    (traverseMin, traverseMax) = gun['turretYawLimits']
                    traverseLimits_str = '%g..+%g' % (round(degrees(traverseMin)), round(degrees(traverseMax)))
                    tooltip_add_param(self, result, l10n('traverseLimits'), traverseLimits_str)
                # elevation limits (front)
                elif paramName == 'pitchLimits':
                    (pitchMax, pitchMin) = calcPitchLimitsFromDesc(0, gun['pitchLimits'])
                    pitchLimits_str = '%g..+%g' % (round(degrees(-pitchMin)), round(degrees(-pitchMax)))
                    tooltip_add_param(self, result, l10n('pitchLimits'), pitchLimits_str)
                # elevation limits (side)
                elif paramName == 'pitchLimitsSide':
                    if gun['turretYawLimits'] and abs(degrees(gun['turretYawLimits'][0])) < 89: continue # can't look aside 90 degrees
                    (pitchMax, pitchMin) = calcPitchLimitsFromDesc(pi / 2, gun['pitchLimits'])
                    pitchLimits_str = '%g..+%g' % (round(degrees(-pitchMin)), round(degrees(-pitchMax)))
                    tooltip_add_param(self, result, l10n('pitchLimitsSide'), pitchLimits_str)
                # elevation limits (rear)
                elif paramName == 'pitchLimitsRear':
                    if gun['turretYawLimits']: continue # can't look back
                    (pitchMax, pitchMin) = calcPitchLimitsFromDesc(pi, gun['pitchLimits'])
                    pitchLimits_str = '%g..+%g' % (round(degrees(-pitchMin)), round(degrees(-pitchMax)))
                    tooltip_add_param(self, result, l10n('pitchLimitsRear'), pitchLimits_str)
                # shooting range
                elif paramName == 'shootingRadius':
                    viewRange, shellRadius, artiRadius = _getRanges(turret, gun, vehicle.nationName, vehicle.type)
                    if vehicle.type == 'SPG':
                        tooltip_add_param(self, result, tooltip_with_units(l10n('shootingRadius'), l10n('(m)')), artiRadius)
                    elif shellRadius < 707:
                        tooltip_add_param(self, result, tooltip_with_units(l10n('shootingRadius'), l10n('(m)')), shellRadius)
                #reverse max speed
                elif paramName == 'speedLimits':
                    (speedLimitForward, speedLimitReverse) = veh_descr.physics['speedLimits']
                    speedLimits_str = str(int(speedLimitForward * 3.6)) + '/' + str(int(speedLimitReverse * 3.6))
                    tooltip_add_param(self, result, getParameterValue(paramName), speedLimits_str)
                #turret rotation speed
                elif paramName == 'turretRotationSpeed' or paramName == 'gunRotationSpeed':
                    if not vehicle.hasTurrets:
                        paramName = 'gunRotationSpeed'
                    turretRotationSpeed_str = str(int(degrees(veh_descr.turret['rotationSpeed'])))
                    tooltip_add_param(self, result, tooltip_with_units(i18n.makeString('#menu:tank_params/%s' % paramName).rstrip(), i18n.makeString('#menu:tank_params/gps')), turretRotationSpeed_str)
                #terrain resistance
                elif paramName == 'terrainResistance':
                    resistances_arr = []
                    for key in veh_descr.chassis['terrainResistance']:
                        resistances_arr.append(formatNumber(key))
                    terrainResistance_str = '/'.join(resistances_arr)
                    tooltip_add_param(self, result, l10n('terrainResistance'), terrainResistance_str)
                #radioRange
                elif paramName == 'radioRange':
                    radioRange_str = '%s' % int(vehicle.radio.descriptor['distance'])
                    tooltip_add_param(self, result, replace_p(i18n.makeString('#menu:moduleInfo/params/radioDistance')), radioRange_str)
                #gravity
                elif paramName == 'gravity':
                    gravity_str = formatNumber(veh_descr.shot['gravity'])
                    tooltip_add_param(self, result, l10n('gravity'), gravity_str)
                #inner name, for example - ussr:R100_SU122A
                elif paramName == 'innerName':
                    tooltip_add_param(self, result, vehicle.name, '')
                #custom text
                elif paramName.startswith('TEXT:'):
                    customtext = paramName[5:]
                    tooltip_add_param(self, result, l10n(customtext), '')
                elif paramName in paramInfo.name:
                    valueStr = str(param_formatter.baseFormatParameter(paramName, paramInfo.value))
                    tooltip_add_param(self, result, getParameterValue(paramName), valueStr)
        if vehicle.isInInventory:
            # optional devices icons, must be in the end
            if 'optDevicesIcons' in params_list:
                optDevicesIcons_arr = []
                for key in vehicle.optDevices:
                    if key:
                        imgPath = 'img://gui' + key.icon.lstrip('.')
                    else:
                        imgPath = 'img://gui/maps/icons/artefact/empty.png'
                    optDevicesIcons_arr.append('<img src="%s" height="16" width="16">' % imgPath)
                optDevicesIcons_str = ' '.join(optDevicesIcons_arr)
                tooltip_add_param(self, result, optDevicesIcons_str, '')

            # equipment icons, must be in the end
            if 'equipmentIcons' in params_list:
                equipmentIcons_arr = []
                for key in vehicle.eqs:
                    if key:
                        imgPath = 'img://gui' + key.icon.lstrip('.')
                    else:
                        imgPath = 'img://gui/maps/icons/artefact/empty.png'
                    equipmentIcons_arr.append('<img src="%s" height="16" width="16">' % imgPath)
                equipmentIcons_str = ' '.join(equipmentIcons_arr)
                if config.get('tooltips/combineIcons') and optDevicesIcons_str:
                    tmp_list = []
                    tooltip_add_param(self, tmp_list, equipmentIcons_str, '')
                    result[-1]['data']['name'] += ' ' + tmp_list[0]['data']['name']
                else:
                    tooltip_add_param(self, result, equipmentIcons_str, '')

        # crew roles icons, must be in the end
        if 'crewRolesIcons' in params_list:
            imgPath = 'img://../mods/shared_resources/xvm/res/icons/tooltips/roles'
            crewRolesIcons_arr = []
            for tankman_role in vehicle.descriptor.type.crewRoles:
                crewRolesIcons_arr.append('<img src="%s/%s.png" height="16" width="16">' % (imgPath, tankman_role[0]))
            crewRolesIcons_str = ''.join(crewRolesIcons_arr)
            tooltip_add_param(self, result, crewRolesIcons_str, '')
        if len(result) > 31: # limitation
            result = result[:31]
        carousel_tooltips_cache[vehicle.intCD] = result
        return result
    except Exception as ex:
        err(traceback.format_exc())
        return base(self)