Пример #1
0
    def construct(self):
        block = []
        if self.configuration.params:
            bottom = 8
            bottomPadding = formatters.packPadding(bottom=bottom)
            shell = self.shell
            comparator = params_helper.shellOnVehicleComparator(
                shell, self.configuration.vehicle)
            isDistanceDependent = self._params.pop(
                'piercingPowerTable') is not None
            formattedParameters = params_formatters.getFormattedParamsList(
                shell.descriptor, self._params)
            block.append(
                formatters.packTitleDescBlock(title=text_styles.middleTitle(
                    _ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)),
                                              padding=bottomPadding))
            for paramName, paramValue in formattedParameters:
                if paramName == ModuleTooltipBlockConstructor.CALIBER:
                    continue
                if comparator is not None:
                    paramValue = params_formatters.colorizedFormatParameter(
                        comparator.getExtendedData(paramName),
                        params_formatters.BASE_SCHEME)
                if paramValue is not None:
                    paramUnits = _ms(
                        params_formatters.measureUnitsForParameter(paramName))
                    isPiercingPower = paramName == 'avgPiercingPower'
                    paramUnits += _ASTERISK if isPiercingPower and not isDistanceDependent else ''
                    block.append(
                        self._packParameterBlock(
                            backport.text(
                                R.strings.menu.moduleInfo.params.dyn(paramName)
                                ()), paramValue, paramUnits))

        return block
Пример #2
0
    def construct(self):
        block = []
        if self.configuration.params:
            top = 8
            bottom = 8
            topPadding = formatters.packPadding(top=top)
            bottomPadding = formatters.packPadding(bottom=bottom)
            shell = self.shell
            comparator = params_helper.shellComparator(
                shell, self.configuration.vehicle)
            piercingPowerTable = self._params.pop('piercingPowerTable')
            isDistanceDependent = piercingPowerTable is not None
            colorScheme = params_formatters.COLORLESS_SCHEME if self.configuration.colorless else params_formatters.BASE_SCHEME
            tableData = []
            if isinstance(piercingPowerTable, list):
                for distance, value in self.__iteratePiercingPowerTable(
                        piercingPowerTable, comparator, colorScheme):
                    tableData.append((value, distance))

            formattedParameters = params_formatters.getFormattedParamsList(
                shell.descriptor, self._params)
            block.append(
                formatters.packTitleDescBlock(title=text_styles.middleTitle(
                    _ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)),
                                              padding=bottomPadding))
            for paramName, paramValue in formattedParameters:
                if paramName == ModuleTooltipBlockConstructor.CALIBER:
                    continue
                if comparator is not None:
                    paramValue = params_formatters.colorizedFormatParameter(
                        comparator.getExtendedData(paramName), colorScheme)
                if paramValue is not None:
                    paramUnits = _ms(
                        params_formatters.measureUnitsForParameter(paramName))
                    isPiercingPower = paramName == 'avgPiercingPower'
                    if isPiercingPower:
                        if piercingPowerTable != NO_DATA:
                            paramUnits += _ASTERISK
                        if tableData and isDistanceDependent:
                            paramValue = '%s-%s' % (tableData[0][0],
                                                    tableData[-1][0])
                    block.append(
                        self._packParameterBlock(
                            backport.text(
                                R.strings.menu.moduleInfo.params.dyn(paramName)
                                ()), paramValue, paramUnits))

            if piercingPowerTable != NO_DATA:
                title = _ms(MENU.MODULEINFO_PARAMS_NOPIERCINGDISTANCE_FOOTNOTE)
                if isDistanceDependent and tableData:
                    title = _ms(
                        MENU.MODULEINFO_PARAMS_PIERCINGDISTANCE_FOOTNOTE,
                        minDist=tableData[0][1],
                        maxDist=tableData[-1][1])
                block.append(
                    formatters.packTitleDescBlock(
                        title=text_styles.standard(title), padding=topPadding))
        return block
Пример #3
0
    def construct(self):
        block = []
        if self.configuration.params:
            top = 8
            bottom = 8
            topPadding = formatters.packPadding(top=top)
            bottomPadding = formatters.packPadding(bottom=bottom)
            tbPadding = formatters.packPadding(top=top, bottom=bottom)
            shell = self.shell
            comparator = params_helper.shellComparator(shell, self.configuration.vehicle)
            piercingPowerTable = self._params.pop('piercingPowerTable')
            isDistanceDependent = piercingPowerTable is not None
            maxShotDistance = self._params.pop('maxShotDistance', None)
            formattedParameters = params_formatters.getFormattedParamsList(shell.descriptor, self._params)
            block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(_ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)), padding=bottomPadding))
            for paramName, paramValue in formattedParameters:
                if comparator is not None:
                    paramValue = params_formatters.colorizedFormatParameter(comparator.getExtendedData(paramName), params_formatters.BASE_SCHEME)
                if paramValue is not None:
                    paramUnits = _ms(params_formatters.measureUnitsForParameter(paramName))
                    isPiercingPower = paramName == 'avgPiercingPower'
                    paramUnits += _ASTERISK if isPiercingPower and not isDistanceDependent else ''
                    if not (isPiercingPower and isDistanceDependent):
                        block.append(self._packParameterBlock(_ms('#menu:moduleInfo/params/' + paramName), paramValue, paramUnits))

            if isinstance(piercingPowerTable, list):
                piercingUnits = _ms(params_formatters.measureUnitsForParameter('piercingPower'))
                block.append(formatters.packTitleDescBlock(title=text_styles.standard(_ms(MENU.MODULEINFO_PARAMS_PIERCINGDISTANCEHEADER)), padding=tbPadding))
                for distance, value in self.__iteratePiercingPowerTable(piercingPowerTable, comparator):
                    if maxShotDistance is not None and distance == _AUTOCANNON_SHOT_DISTANCE:
                        piercingUnits += _ASTERISK
                    block.append(self._packParameterBlock(_ms(MENU.MODULEINFO_PARAMS_PIERCINGDISTANCE, dist=distance), value, piercingUnits))

                if maxShotDistance is not None:
                    block.append(formatters.packTitleDescBlock(title=text_styles.standard(_ms(MENU.MODULEINFO_PARAMS_MAXSHOTDISTANCE_FOOTNOTE)), padding=topPadding))
            elif 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=topPadding))
        return block
Пример #4
0
    def construct(self):
        block = []
        item = self.item
        block.append(
            formatters.packTitleDescBlock(
                title=text_styles.middleTitle(
                    _ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)),
                padding=formatters.packPadding(bottom=8)))
        params = item.getParams()
        for paramName, paramValue in params:
            block.append(
                self.__packParameterBloc(
                    _ms('#menu:moduleInfo/params/' + paramName), paramValue,
                    params_formatters.measureUnitsForParameter(paramName)))

        return block
    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(
                    backport.text(
                        R.strings.menu.moduleInfo.params.dyn(paramName)()),
                    paramValue,
                    params_formatters.measureUnitsForParameter(paramName)))

        return block
Пример #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
    def __getMainParamsBlock(self, name, item):
        block = [
            formatters.packTitleDescBlock(
                title=text_styles.middleTitle(
                    backport.text(R.strings.fortifications.reserves.tooltip.
                                  mainApplyEffect())),
                desc=text_styles.standard(
                    backport.text(
                        R.strings.fortifications.reserves.tooltip.
                        applyDescription.dyn(name)())),
                descPadding=formatters.packPadding(top=4))
        ]
        params = params_helper.getParameters(item)
        paramsResult = paramsFormatters.getFormattedParamsList(
            item.descriptor, params)
        for paramName, paramValue in paramsResult:
            block.append(
                self.__packParameterBlock(
                    backport.text(
                        R.strings.menu.moduleInfo.params.dyn(paramName)()),
                    paramValue,
                    paramsFormatters.measureUnitsForParameter(paramName)))

        return block
Пример #8
0
def getParameterValue(paramName):
    return text_styles.main(i18n.makeString(
        MENU.tank_params(paramName))) + text_styles.standard(
            measureUnitsForParameter(paramName))
Пример #9
0
    def construct(self):
        block = []
        item = self.item
        block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(_ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)), padding=formatters.packPadding(bottom=8)))
        params = item.getParams()
        for paramName, paramValue in params:
            block.append(self.__packParameterBloc(_ms('#menu:moduleInfo/params/' + paramName), paramValue, params_formatters.measureUnitsForParameter(paramName)))

        return block
Пример #10
0
def getParameterValue(paramName):
    return text_styles.main(i18n.makeString(MENU.tank_params(paramName))) + text_styles.standard(measureUnitsForParameter(paramName))
Пример #11
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