Ejemplo n.º 1
0
    def construct(self):
        module = self.module
        block = []

        def checkLocalization(key):
            localization = _ms('#artefacts:%s' % key)
            return (key != localization, localization)

        if self.lobbyContext.getServerSettings().spgRedesignFeatures.isStunEnabled():
            isRemovingStun = module.isRemovingStun
        else:
            isRemovingStun = False
        onUseStr = '%s/removingStun/onUse' if isRemovingStun else '%s/onUse'
        onUse = checkLocalization(onUseStr % module.descriptor.name)
        always = checkLocalization('%s/always' % module.descriptor.name)
        restriction = checkLocalization('%s/restriction' % module.descriptor.name)
        if bonus_helper.isSituationalBonus(module.name):
            effectDesc = text_styles.bonusPreviewText(_ms(module.shortDescription))
            icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_TOOLTIP_ASTERISK_OPTIONAL, 16, 16, 0, 4)
            desc = params_formatters.packSituationalIcon(effectDesc, icon)
        else:
            desc = text_styles.bonusAppliedText(_ms(module.shortDescription))
        if module.itemTypeID == ITEM_TYPES.optionalDevice:
            block.append(formatters.packTitleDescBlock(title='', desc=desc, padding=formatters.packPadding(top=-8)))
        else:
            topPadding = 0
            if always[0] and always[1]:
                block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(TOOLTIPS.EQUIPMENT_ALWAYS), desc=text_styles.bonusAppliedText(always[1])))
                topPadding = 5
            if onUse[0] and onUse[1]:
                block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(TOOLTIPS.EQUIPMENT_ONUSE), desc=text_styles.main(onUse[1]), padding=formatters.packPadding(top=topPadding)))
                topPadding = 5
            if restriction[0] and restriction[1]:
                block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(TOOLTIPS.EQUIPMENT_RESTRICTION), desc=text_styles.main(restriction[1]), padding=formatters.packPadding(top=topPadding)))
        return block
Ejemplo n.º 2
0
def CommonStatsBlockConstructor_construct(base, self):
    block = base(self)
    if self.configuration.params:
        topPadding = formatters.packPadding(top=5)
        block.append(
            formatters.packTitleDescBlock(
                title=text_styles.middleTitle(
                    makeString('#tooltips:quests/vehicles/header')),
                padding=formatters.packPadding(top=8)))
        n_shell = shells.get(self.shell.nationName, None)
        select_shell = n_shell.get(self.shell.name, set())
        if myVehicles:
            vehicles = select_shell & myVehicles
            block.append(
                formatters.packTitleDescBlock(title=text_styles.stats(
                    ', '.join(vehicles)),
                                              padding=topPadding))
            vehicles = select_shell - vehicles
            block.append(
                formatters.packTitleDescBlock(title=text_styles.standard(
                    ', '.join(vehicles)),
                                              padding=topPadding))
        else:
            block.append(
                formatters.packTitleDescBlock(title=text_styles.standard(
                    ', '.join(select_shell)),
                                              padding=topPadding))
    return block
Ejemplo n.º 3
0
 def _packBlocks(self, paramName):
     extendedData = self.context.getComparator().getExtendedData(paramName)
     self.__paramName = extendedData.name
     title = text_styles.highTitle(MENU.tank_params(paramName))
     if param_formatter.isRelativeParameter(paramName):
         value = param_formatter.colorizedFormatParameter(extendedData, self.context.formatters)
         title += ' ' + text_styles.warning(_ms(TOOLTIPS.VEHICLEPARAMS_TITLE_VALUETEMPLATE, value=value))
     else:
         title += ' ' + text_styles.middleTitle(MEASURE_UNITS.get(paramName, ''))
     desc = _ms(TOOLTIPS.tank_params_desc(paramName))
     possibleBonuses = sorted(extendedData.possibleBonuses, _bonusCmp)
     if possibleBonuses is not None and len(possibleBonuses) > 0:
         desc += ' ' + _ms(TOOLTIPS.VEHICLEPARAMS_POSSIBLEBONUSES_DESC)
         desc += '\n' + self.__createBonusesStr(possibleBonuses)
     blocks = [formatters.packTitleDescBlock(title, text_styles.main(desc))]
     bonuses = sorted(extendedData.bonuses, _bonusCmp)
     if bonuses is not None and len(bonuses) > 0:
         blocks.append(formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.VEHICLEPARAMS_BONUSES_TITLE), text_styles.main(self.__createBonusesStr(bonuses))))
     penalties = extendedData.penalties
     actualPenalties, nullPenaltyTypes = self.__getNumNotNullPenaltyTankman(penalties)
     penaltiesLen = len(penalties)
     numNotNullPenaltyTankman = len(actualPenalties)
     if numNotNullPenaltyTankman > 0:
         blocks.append(formatters.packTitleDescBlock(text_styles.critical(TOOLTIPS.VEHICLEPARAMS_PENALTIES_TITLE), text_styles.main(self.__createPenaltiesStr(actualPenalties))))
     if penaltiesLen > numNotNullPenaltyTankman:
         blocks.append(formatters.packImageTextBlockData(self.__createTankmanIsOutStr(nullPenaltyTypes), img=RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, imgPadding=formatters.packPadding(top=2, left=3, right=6)))
     return blocks
Ejemplo n.º 4
0
 def _packBlocks(self, *args, **kwargs):
     items = super(PersonalCaseAdditionalPacker, self)._packBlocks(*args, **kwargs)
     blocksGap = 10
     items.append(formatters.packBuildUpBlockData([formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_RECORDTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_RECORDDESCRIPTION)),
      formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_TRAININGTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_TRAININGDESCRIPTION)),
      formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_PERKSTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_PERKSDESCRIPTION)),
      formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_DOCUMENTSTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_DOCUMENTSDESCRIPTION))], blocksGap))
     return items
Ejemplo n.º 5
0
 def _packBlocks(self, *args, **kwargs):
     items = super(PersonalCaseAdditionalPacker, self)._packBlocks(*args, **kwargs)
     blocksGap = 10
     items.append(formatters.packBuildUpBlockData([formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_RECORDTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_RECORDDESCRIPTION)),
      formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_TRAININGTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_TRAININGDESCRIPTION)),
      formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_PERKSTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_PERKSDESCRIPTION)),
      formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_DOCUMENTSTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_ADDITIONAL_DOCUMENTSDESCRIPTION))], blocksGap))
     return items
Ejemplo n.º 6
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
Ejemplo n.º 7
0
 def _packSuitableBlock(self):
     customizationTypes = (GUI_ITEM_TYPE.PAINT, GUI_ITEM_TYPE.CAMOUFLAGE,
                           GUI_ITEM_TYPE.MODIFICATION)
     isItemInStyle = self._item.isStyleOnly or self._item.intCD in getBaseStyleItems(
     )
     isItemHidden = self._item.isHidden
     mustNotHave = self._item.itemTypeID in customizationTypes
     mayHave = self._item.itemTypeID in GUI_ITEM_TYPE.CUSTOMIZATIONS and self._item.itemTypeID not in customizationTypes
     if mustNotHave and (isItemHidden or isItemInStyle
                         ) or mayHave and isItemHidden and isItemInStyle:
         return None
     elif self._item.isProgressive and self._item.isProgressionAutoBound or ItemTags.NATIONAL_EMBLEM in self._item.tags:
         return formatters.packTitleDescBlock(
             title=text_styles.middleTitle(
                 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_SUITABLE_TITLE
             ),
             desc=text_styles.main(self.__vehicle.shortUserName),
             padding=formatters.packPadding(top=-2))
     elif self._item.isVehicleBound and not self._item.mayApply:
         return formatters.packTitleDescBlock(
             title=text_styles.middleTitle(
                 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_SUITABLE_TITLE
             ),
             desc=text_styles.main(
                 makeVehiclesShortNamesString(
                     self.boundVehs | self.installedVehs, self.__vehicle)),
             padding=formatters.packPadding(top=-2))
     elif not self._item.descriptor.filter or not self._item.descriptor.filter.include:
         return formatters.packTitleDescBlock(
             title=text_styles.middleTitle(
                 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_SUITABLE_TITLE
             ),
             desc=text_styles.main(
                 backport.text(
                     R.strings.vehicle_customization.customization.tooltip.
                     suitable.text.allVehicle())),
             padding=formatters.packPadding(top=-2))
     else:
         blocks = []
         icn = getSuitableText(self._item, self.__vehicle)
         blocks.append(
             formatters.packTextBlockData(
                 text=icn, padding=formatters.packPadding(top=-2)))
         blocks.insert(
             0,
             formatters.packTitleDescBlock(title=text_styles.middleTitle(
                 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_SUITABLE_TITLE)
                                           ))
         return formatters.packBuildUpBlockData(
             blocks=blocks, padding=formatters.packPadding(top=-3))
Ejemplo n.º 8
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
Ejemplo n.º 9
0
 def _packBlocks(self, uid, level):
     description = _ms(FORTIFICATIONS.buildingsprocess_longdescr(uid))
     self._description = _ms(CLANS.SECTION_FORT_BUILDING_TOOLTIP_BODY, level=text_styles.stats(int2roman(level)), description=description)
     self._title = _ms(FORTIFICATIONS.buildings_buildingname(uid))
     items = super(ClanProfileFortBuildingTooltipData, self)._packBlocks()
     items.append(formatters.packTitleDescBlock(text_styles.highTitle(self._title), desc=text_styles.main(self._description) if self._description else None))
     return items
Ejemplo n.º 10
0
 def _packTitleBlock(self):
     if self._item.isAllSeason():
         mapType = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_STYLE_ANY
     elif self._item.isSummer():
         mapType = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_STYLE_SUMMER
     elif self._item.isWinter():
         mapType = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_STYLE_WINTER
     elif self._item.isDesert():
         mapType = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_STYLE_DESERT
     else:
         mapType = VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_EMPTYSLOT
     desc = _ms(
         VEHICLE_CUSTOMIZATION.CUSTOMIZATION_INFOTYPE_DESCRIPTION_MAP,
         mapType=text_styles.stats(mapType))
     if self._item.groupUserName:
         desc = text_styles.concatStylesToSingleLine(
             desc,
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_INFOTYPE_DESCRIPTION_TYPE,
                 elementType=text_styles.stats(self._item.groupUserName)))
     return formatters.packItemTitleDescBlockData(
         title=text_styles.highTitle(self._item.userName),
         desc=text_styles.main(desc),
         highlightPath=RES_ICONS.MAPS_ICONS_CUSTOMIZATION_CORNER_RARE,
         img=RES_ICONS.MAPS_ICONS_CUSTOMIZATION_BRUSH_RARE,
         imgPadding=formatters.packPadding(top=15, left=8),
         padding=formatters.packPadding(top=-20, left=-19, bottom=-7),
         txtPadding=formatters.packPadding(top=20, left=-8),
         descPadding=formatters.packPadding(top=-25, left=17)
     ) if self._item.isRare() else formatters.packTitleDescBlock(
         title=text_styles.highTitle(self._item.userName),
         desc=text_styles.main(desc),
         descPadding=formatters.packPadding(top=-5))
Ejemplo n.º 11
0
 def _packBlocks(self, *args, **kwargs):
     items = super(PersonalCaseSkillsPacker,
                   self)._packBlocks(*args, **kwargs)
     blocksGap = 2
     items.append(
         formatters.
         packBuildUpBlockData([
             formatters.packTitleDescBlock(
                 text_styles.middleTitle(
                     TOOLTIPS.
                     HANGARTUTORIAL_PERSONALCASE_SKILLS_SPECIALTYTITLE),
                 text_styles.main(
                     TOOLTIPS.
                     HANGARTUTORIAL_PERSONALCASE_SKILLS_SPECIALTYDESCRIPTION
                 ))
         ], blocksGap, BLOCKS_TOOLTIP_TYPES.
                              TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
     items.append(
         formatters.packBuildUpBlockData([
             formatters.packImageTextBlockData(
                 title=text_styles.main(
                     TOOLTIPS.
                     HANGARTUTORIAL_PERSONALCASE_SKILLS_SPECIALTYWARNING),
                 img=RES_ICONS.MAPS_ICONS_LIBRARY_ALERTICON1)
         ], blocksGap))
     return items
Ejemplo n.º 12
0
 def _packBlocks(self, *args, **kwargs):
     self._items = super(BattlePassPointsTooltipData,
                         self)._packBlocks(*args, **kwargs)
     titleBlock = formatters.packTitleDescBlock(title=text_styles.highTitle(
         backport.text(
             R.strings.battle_pass.tooltips.battlePassPoints.title())))
     imageBlock = formatters.packImageBlockData(img=backport.image(
         R.images.gui.maps.icons.battlePass.tooltips.battlePassPoints()),
                                                align=BLOCKS_TOOLTIP_TYPES.
                                                ALIGN_CENTER)
     titleImageBlock = formatters.packBuildUpBlockData(
         [titleBlock, imageBlock])
     self._items.append(titleImageBlock)
     descriptionBlock = text_styles.main(
         backport.text(
             R.strings.battle_pass.tooltips.battlePassPoints.description()))
     self._items.append(formatters.packTextBlockData(descriptionBlock))
     state = self.__battlePassController.getState()
     if state == BattlePassState.COMPLETED:
         self._items.append(
             formatters.packBuildUpBlockData(
                 [
                     formatters.packImageTextBlockData(
                         title=text_styles.success(
                             backport.text(R.strings.battle_pass.tooltips.
                                           battlePassPoints.completed())),
                         img=backport.image(
                             R.images.gui.maps.icons.library.check()),
                         imgPadding=formatters.packPadding(top=-2))
                 ],
                 linkage=BLOCKS_TOOLTIP_TYPES.
                 TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
                 padding=formatters.packPadding(bottom=-10)))
     return self._items
Ejemplo n.º 13
0
    def __packItemBlock(self, items):
        blocks = []
        for itemData in items:
            count = itemData.get('count', 0)
            itemId = itemData.get('id', 0)
            itemType = itemData.get('type', '')
            icon, title = self.__getItemData(itemType, itemId)
            if not icon:
                continue
            awardCount = backport.text(self.__resPath.awardCount(),
                                       count=count) if count > 1 else ' '
            textBlock = formatters.packTitleDescBlock(
                title=text_styles.main(title),
                desc=text_styles.stats(awardCount),
                padding=formatters.packPadding(top=-35, left=58),
                descPadding=formatters.packPadding(top=0, left=-24))
            imageBlock = formatters.packImageBlockData(img=icon,
                                                       width=48,
                                                       height=48)
            blocks.append(imageBlock)
            blocks.append(textBlock)

        return formatters.packBuildUpBlockData(
            blocks,
            layout=BLOCKS_TOOLTIP_TYPES.LAYOUT_VERTICAL,
            padding=formatters.packPadding(top=10, bottom=-20),
            align=BLOCKS_TOOLTIP_TYPES.ALIGN_LEFT,
            stretchBg=False)
Ejemplo n.º 14
0
 def __packHeader(self):
     name = backport.text(self.__resPath.header())
     description = backport.text(self.__resPath.description())
     return formatters.packTitleDescBlock(
         title=text_styles.highTitle(name),
         desc=text_styles.main(description),
         padding=formatters.packPadding(left=0, right=0))
Ejemplo n.º 15
0
def packEpicBattleInfoBlock(epicController=None):
    descLvl = text_styles.stats(
        backport.text(
            R.strings.epic_battle.selectorTooltip.epicBattle.bodyVehicleLevel(
            ),
            level=toRomanRangeString(epicController.getValidVehicleLevels())))
    season = epicController.getCurrentSeason()
    cycle = None
    cycleNumber = None
    if season is not None and not season.isSingleCycleSeason():
        hasActiveCycle = season.hasActiveCycle(
            time_utils.getCurrentLocalServerTimestamp())
        if epicController.isEnabled() and hasActiveCycle:
            cycle = season.getCycleInfo()
        else:
            cycle = season.getNextByTimeCycle(
                time_utils.getCurrentLocalServerTimestamp())
    if cycle is not None:
        cycleNumber = cycle.getEpicCycleNumber()
    if cycleNumber:
        titleStr = R.strings.epic_battle.tooltips.common.titleWithCycle()
    else:
        titleStr = R.strings.epic_battle.tooltips.common.title()
    return formatters.packTitleDescBlock(
        title=text_styles.middleTitle(
            backport.text(titleStr, season=int2roman(cycleNumber))),
        desc=text_styles.main(
            backport.text(
                R.strings.epic_battle.selectorTooltip.epicBattle.body(),
                bodyVehicleLevel=descLvl)),
        padding=formatters.packPadding(top=20, left=20, right=20),
        descPadding=formatters.packPadding(right=30))
 def construct(self):
     block = list()
     if self.configuration.isAwardWindow:
         return block
     module = self.module
     inventoryVehicles = self.itemsCache.items.getVehicles(
         REQ_CRITERIA.INVENTORY).itervalues()
     totalInstalledVehicles = [
         x.shortUserName
         for x in module.getInstalledVehicles(inventoryVehicles)
     ]
     installedVehicles = totalInstalledVehicles[:_MAX_INSTALLED_LIST_LEN]
     if installedVehicles:
         tooltipText = ', '.join(installedVehicles)
         if len(totalInstalledVehicles) > _MAX_INSTALLED_LIST_LEN:
             hiddenVehicleCount = len(
                 totalInstalledVehicles) - _MAX_INSTALLED_LIST_LEN
             hiddenTxt = '%s %s' % (backport.text(
                 R.strings.tooltips.suitableVehicle.hiddenVehicleCount()),
                                    text_styles.stats(hiddenVehicleCount))
             tooltipText = '%s %s' % (tooltipText, hiddenTxt)
         block.append(
             formatters.packTitleDescBlock(
                 title=text_styles.middleTitle(
                     backport.text(R.strings.tooltips.deviceFits.
                                   already_installed.header())),
                 desc=text_styles.standard(tooltipText)))
     return block
Ejemplo n.º 17
0
 def _packBlocks(self, *args, **kwargs):
     items = super(HeaderPacker, self)._packBlocks(*args, **kwargs)
     items.append(
         formatters.packTitleDescBlock(
             text_styles.highTitle(self._title),
             desc=text_styles.main(self._descr) if self._descr else None))
     return items
 def __packTitleBlock(self):
     return formatters.packTitleDescBlock(
         title=text_styles.highTitle(
             TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_HEADER),
         desc=self._getVehicleDescrStr(self.__vehicle),
         gap=0,
         descPadding=formatters.packPadding(top=-4, left=1))
Ejemplo n.º 19
0
 def _packAppliedBlock(self):
     vehicles = set(self.installedToVehs)
     if self.appliedCount > 0:
         vehicles.add(self.currentVehicle.intCD)
     elif not self.installedToVehs:
         return None
     if self._item.mayApply or self.currentVehicle.intCD in self.installedToVehs:
         return formatters.packTitleDescBlock(
             title=text_styles.middleTitle(
                 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_LIMITED_ON_VEHICLE),
             desc=text_styles.main(
                 self.__makeVehiclesShortNamesString(vehicles)),
             padding=formatters.packPadding(top=-2))
     else:
         blocks = [
             formatters.packImageTextBlockData(
                 title=text_styles.critical(
                     VEHICLE_CUSTOMIZATION.
                     CUSTOMIZATION_LIMITED_ON_OTHER_VEHICLE),
                 img=RES_ICONS.MAPS_ICONS_LIBRARY_MARKER_BLOCKED,
                 imgPadding=formatters.packPadding(left=-3, top=2)),
             formatters.packTextBlockData(text=text_styles.main(
                 _ms(self.__makeVehiclesShortNamesString(vehicles))))
         ]
         return formatters.packBuildUpBlockData(
             blocks, gap=3, padding=formatters.packPadding(bottom=-5))
 def __packInfoBlocks(self, booster, stats):
     blocks = []
     if stats.effectTime:
         effectTime = formatters.packTitleDescBlock(_ts.middleTitle(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_EFFECTTIME_TITLE), _ts.main(_ms(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_EFFECTTIME_DESCRIPTION, time=booster.getEffectTimeStr(hoursOnly=True))))
         blocks.append(effectTime)
     if stats.activateInfo:
         activateInfo = formatters.packTitleDescBlock(_ts.middleTitle(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_ACTIVATEINFO_TITLE), _ts.main(_ms(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_ACTIVATEINFO_DESCRIPTION)))
         blocks.append(activateInfo)
     if stats.dueDate:
         if booster.expiryTime:
             text = _ms(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_DUEDATE_VALUE, date=booster.getExpiryDate())
         else:
             text = _ms(MENU.BOOSTERSWINDOW_BOOSTERSTABLERENDERER_UNDEFINETIME)
         dueDate = formatters.packTitleDescBlock(_ts.middleTitle(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_DUEDATE_TITLE), _ts.main(text))
         blocks.append(dueDate)
     return formatters.packBuildUpBlockData(blocks, padding=formatters.packPadding(bottom=-16))
Ejemplo n.º 21
0
 def construct(self):
     block = list()
     module = self.module
     inventoryVehicles = self.itemsCache.items.getVehicles(
         REQ_CRITERIA.INVENTORY).itervalues()
     totalInstalledVehicles = [
         x.shortUserName
         for x in module.getInstalledVehicles(inventoryVehicles)
     ]
     installedVehicles = totalInstalledVehicles[:_MAX_INSTALLED_LIST_LEN]
     if installedVehicles:
         tooltipText = ', '.join(installedVehicles)
         if len(totalInstalledVehicles) > _MAX_INSTALLED_LIST_LEN:
             hiddenVehicleCount = len(
                 totalInstalledVehicles) - _MAX_INSTALLED_LIST_LEN
             hiddenTxt = '%s %s' % (text_styles.main(
                 TOOLTIPS.SUITABLEVEHICLE_HIDDENVEHICLECOUNT),
                                    text_styles.stats(hiddenVehicleCount))
             tooltipText = '%s\n%s' % (tooltipText, hiddenTxt)
         block.append(
             formatters.packTitleDescBlock(
                 title=text_styles.middleTitle(
                     TOOLTIPS.DEVICEFITS_ALREADY_INSTALLED_HEADER),
                 desc=text_styles.standard(tooltipText)))
     return block
Ejemplo n.º 22
0
 def _packHeaderBlock(self):
     return formatters.packTitleDescBlock(
         title=text_styles.highTitle(
             TANK_CAROUSEL_FILTER.INFOTIP_HEADER_TITLE),
         padding=formatters.packPadding(top=-5),
         desc=text_styles.main(
             TANK_CAROUSEL_FILTER.INFOTIP_HEADER_DESCRIPTION))
def getScheduleBlock(modeCtrl, modeName, actualSeason, seasonIsStarted,
                     timeStringGetter):
    block = []
    if actualSeason.hasActiveCycle(
            time_utils.getCurrentLocalServerTimestamp()):
        currentCycle = actualSeason.getCycleInfo()
        block.append(getTimeTableBlock(modeCtrl, modeName))
        block.append(
            _getTimeBlock(seasonIsStarted, True,
                          time_utils.makeLocalServerTime(currentCycle.endDate),
                          modeName, timeStringGetter))
    elif actualSeason is not None:
        nextCycle = actualSeason.getNextByTimeCycle(
            time_utils.getCurrentLocalServerTimestamp())
        if nextCycle:
            block.append(
                _getTimeBlock(
                    seasonIsStarted, False,
                    time_utils.makeLocalServerTime(nextCycle.startDate),
                    modeName, timeStringGetter))
        else:
            wait = backport.text(
                R.strings.menu.headerButtons.battle.types.dyn(
                    modeName).extra.finished())
            block.append(
                formatters.packTitleDescBlock(title=text_styles.main(wait)))
    return block
Ejemplo n.º 24
0
    def _packBlocks(self, role):
        blocks = []
        bodyStr = '%s/%s' % (TOOLTIPS.VEHICLEPREVIEW_CREW, role)
        crewParams = [
            text_styles.neutral(param) for param in _CREW_TOOLTIP_PARAMS[role]
        ]
        blocks.append(
            formatters.packTitleDescBlock(
                text_styles.highTitle(ITEM_TYPES.tankman_roles(role)),
                text_styles.main(_ms(bodyStr, *crewParams))))
        vehicle = self.context.getVehicle()
        for idx, tankman in vehicle.crew:
            if tankman.role == role:
                otherRoles = list(vehicle.descriptor.type.crewRoles[idx])
                otherRoles.remove(tankman.role)
                if otherRoles:
                    rolesStr = ', '.join([
                        text_styles.stats(_ms(ITEM_TYPES.tankman_roles(r)))
                        for r in otherRoles
                    ])
                    blocks.append(
                        formatters.packTextBlockData(
                            text_styles.main(
                                _ms(TOOLTIPS.
                                    VEHICLEPREVIEW_CREW_ADDITIONALROLES,
                                    roles=rolesStr))))

        return blocks
Ejemplo n.º 25
0
 def _packBlocks(self, boosterID, *args, **kwargs):
     items = super(BoosterTooltipData, self)._packBlocks(*args, **kwargs)
     booster = self.context.buildItem(boosterID)
     statsFields = self.context.getStatsConfiguration(booster)
     items.append(
         formatters.packBuildUpBlockData([
             formatters.packTitleDescBlock(
                 text_styles.highTitle(booster.fullUserName),
                 desc=text_styles.main(booster.description)),
             formatters.packImageBlockData(
                 img=booster.bigTooltipIcon,
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 width=180,
                 height=180,
                 padding={
                     'top': -14,
                     'bottom': -14
                 })
         ]))
     items.append(self.__packDueDate(booster))
     if statsFields.quests:
         questsResult = self.__getBoosterQuestNames(boosterID)
         if len(questsResult):
             items.append(self.__packAccessCondition(questsResult))
     if statsFields.buyPrice and booster.buyPrice:
         priceBlock = self.__getBoosterPrice(booster)
         items.append(formatters.packBuildUpBlockData(priceBlock))
     if statsFields.activeState and booster.inCooldown:
         items.append(self.__packActiveState(booster.getUsageLeftTimeStr()))
     return items
Ejemplo n.º 26
0
 def __packMainBlock(self):
     header = backport.text(
         R.strings.tooltips.battleTypes.battleRoyale.header())
     body = '{}\n\n{}'.format(
         backport.text(R.strings.tooltips.battleTypes.battleRoyale.body()),
         backport.text(R.strings.tooltips.battleTypes.battleRoyale.body2()))
     return formatters.packTitleDescBlock(
         title=text_styles.middleTitle(header), desc=text_styles.main(body))
Ejemplo n.º 27
0
 def _packBlocks(self, paramName):
     extendedData = self.context.getComparator().getExtendedData(paramName)
     self.__paramName = extendedData.name
     title = text_styles.highTitle(MENU.tank_params(paramName))
     if param_formatter.isRelativeParameter(paramName):
         value = ''
         if self.context.showTitleValue:
             value = param_formatter.colorizedFormatParameter(
                 extendedData, self.context.formatters)
         title += ' ' + text_styles.warning(
             _ms(TOOLTIPS.VEHICLEPARAMS_TITLE_VALUETEMPLATE, value=value))
     else:
         title += ' ' + text_styles.middleTitle(
             MEASURE_UNITS.get(paramName, ''))
     desc = _ms(TOOLTIPS.tank_params_desc(paramName))
     possibleBonuses = sorted(extendedData.possibleBonuses, _bonusCmp)
     if possibleBonuses is not None and len(possibleBonuses) > 0:
         desc += ' ' + _ms(TOOLTIPS.VEHICLEPARAMS_POSSIBLEBONUSES_DESC)
         desc += '\n' + self.__createBonusesStr(possibleBonuses)
     blocks = [formatters.packTitleDescBlock(title, text_styles.main(desc))]
     bonuses = sorted(extendedData.bonuses, _bonusCmp)
     if bonuses is not None and len(bonuses) > 0:
         blocks.append(
             formatters.packTitleDescBlock(
                 text_styles.middleTitle(
                     TOOLTIPS.VEHICLEPARAMS_BONUSES_TITLE),
                 text_styles.main(self.__createBonusesStr(bonuses))))
     penalties = extendedData.penalties
     actualPenalties, nullPenaltyTypes = self.__getNumNotNullPenaltyTankman(
         penalties)
     penaltiesLen = len(penalties)
     numNotNullPenaltyTankman = len(actualPenalties)
     if numNotNullPenaltyTankman > 0:
         blocks.append(
             formatters.packTitleDescBlock(
                 text_styles.critical(
                     TOOLTIPS.VEHICLEPARAMS_PENALTIES_TITLE),
                 text_styles.main(
                     self.__createPenaltiesStr(actualPenalties))))
     if penaltiesLen > numNotNullPenaltyTankman:
         blocks.append(
             formatters.packImageTextBlockData(
                 self.__createTankmanIsOutStr(nullPenaltyTypes),
                 img=RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED,
                 imgPadding=formatters.packPadding(top=2, left=3, right=6)))
     return blocks
 def _packHeaderBlock(self):
     return formatters.packTitleDescBlock(
         title=text_styles.highTitle(
             backport.text(
                 R.strings.ranked_battles.selectorTooltip.title())),
         desc=text_styles.main(
             backport.text(
                 R.strings.ranked_battles.selectorTooltip.desc())))
Ejemplo n.º 29
0
 def _packDescription(self):
     return formatters.packTitleDescBlock(
         title=text_styles.middleTitle(
             backport.text(R.strings.tooltips.equipment.effect())),
         desc=text_styles.main(
             backport.text(R.strings.recertification_form.base.
                           recertificationForm.description())),
         blocksLinkage=BLOCKS_TOOLTIP_TYPES.
         TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)
Ejemplo n.º 30
0
 def _packBlocks(self, *args, **kwargs):
     items = super(PositionTooltipData, self)._packBlocks()
     title = text_styles.highTitle(backport.text(R.strings.tooltips.ranked.widget.position.title()))
     updateTime = self.__rankedController.getWebSeasonProvider().lastUpdateTime
     updateTime = updateTime or self.__rankedController.getClientSeasonInfoUpdateTime()
     items.append(formatters.packTitleDescBlock(title=title, desc=text_styles.main(backport.text(R.strings.tooltips.ranked.widget.position.description()).format(date=text_styles.neutral(ranked_formatters.getTimeLongStr(updateTime))))))
     posComment = R.strings.tooltips.ranked.widget.position
     items.append(formatters.packTextBlockData(text_styles.standard(backport.text(posComment.updateLabel() if updateTime is not None else posComment.unavailableLabel()))))
     return items
Ejemplo n.º 31
0
 def _packStatusBlock(self,
                      tooltipHeader,
                      tooltipText,
                      titleFormatter,
                      padding=None):
     return formatters.packTitleDescBlock(
         title=titleFormatter(tooltipHeader),
         desc=text_styles.standard(tooltipText),
         padding=padding)
Ejemplo n.º 32
0
 def status(title=None, desc=None):
     if title is not None or desc is not None:
         block.append(
             formatters.packTitleDescBlock(
                 title=text_styles.middleTitle(title)
                 if title is not None else '',
                 desc=text_styles.main(desc)
                 if desc is not None else ''))
     return block
Ejemplo n.º 33
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(_ms('#menu:moduleInfo/params/' + paramName), paramValue, params_formatters.measureUnitsForParameter(paramName)))

        return block
Ejemplo n.º 35
0
 def _packBlocks(self, compensationValue):
     title = TOOLTIPS.FORTIFICATION_POPOVER_DEFRESPROGRESS_HEADER
     items = super(FortPopoverDefResTooltipData, self)._packBlocks()
     items.append(formatters.packTitleDescBlock(text_styles.highTitle(title), desc=text_styles.main(self._descr)))
     if compensationValue is not None:
         blocksGap = 12
         compensationHeader = text_styles.main(TOOLTIPS.FORTIFICATION_POPOVER_DEFRESPROGRESS_COMPENSATION_HEADER) + text_styles.alert('+' + compensationValue) + icons.nut()
         compensationBody = text_styles.standard(TOOLTIPS.FORTIFICATION_POPOVER_DEFRESPROGRESS_COMPENSATION_BODY)
         items.append(formatters.packBuildUpBlockData([formatters.packTextBlockData(text_styles.concatStylesToMultiLine(compensationHeader, compensationBody))], blocksGap, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
     return items
Ejemplo n.º 36
0
    def construct(self):
        params = self.configuration.params
        vehicleCommonParams = dict(ItemsParameters.g_instance.getParameters(self.vehicle.descriptor))
        vehicleRawParams = dict(ParametersCache.g_instance.getParameters(self.vehicle.descriptor))
        block = [formatters.packTitleDescBlock(text_styles.middleTitle(_ms(TOOLTIPS.TANKCARUSEL_MAINPROPERTY)), padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding, bottom=8))]
        if params:
            for paramName in self.PARAMS.get(self.vehicle.type, 'default'):
                if paramName in vehicleCommonParams or paramName in vehicleRawParams:
                    param = self._getParameterValue(paramName, vehicleCommonParams, vehicleRawParams)
                    block.append(formatters.packTextParameterBlockData(name=text_styles.main(param[0]), value=text_styles.stats(param[1]), valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding)))

        return block
Ejemplo n.º 37
0
 def _packBlocks(self, boosterID, *args, **kwargs):
     items = super(BoosterTooltipData, self)._packBlocks(*args, **kwargs)
     booster = g_goodiesCache.getBooster(boosterID)
     questsResult = self.__getBoosterQuestNames(boosterID)
     items.append(formatters.packBuildUpBlockData([formatters.packTitleDescBlock(text_styles.highTitle(booster.fullUserName), desc=text_styles.main(booster.description)), formatters.packImageBlockData(img=booster.bigTooltipIcon, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, width=180, height=180, padding={'top': -14,
       'bottom': -14})]))
     items.append(self.__packDueDate(booster))
     if len(questsResult):
         qNames = '"%s"' % ', '.join(questsResult)
         items.append(self.__packAccessCondition(qNames))
     if booster.inCooldown:
         items.append(self.__packActiveState(booster.getUsageLeftTimeStr()))
     return items
Ejemplo n.º 38
0
 def _packBlocks(self, isCurfewEnabled, timeLimits, serverName = None):
     title = TOOLTIPS.FORTIFICATION_SORTIE_LISTROOM_REGULATION_HEADER_CURFEW if isCurfewEnabled else TOOLTIPS.FORTIFICATION_SORTIE_LISTROOM_REGULATION_HEADER_INFO
     items = super(FortListViewTooltipData, self)._packBlocks()
     items.append(formatters.packTitleDescBlock(text_styles.highTitle(title), desc=text_styles.main(self._descr) if self._descr else None))
     blocksGap = 2
     mainBlock = self._packMainBlock(serverName, timeLimits)
     limits = timeLimits
     timeBlock = []
     _packTimeLimitsBlock(timeBlock, limits)
     if len(timeBlock) > 0:
         mainBlock.append(formatters.packBuildUpBlockData(timeBlock, 0))
     items.append(formatters.packBuildUpBlockData(mainBlock, blocksGap, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
     items.append(formatters.packBuildUpBlockData([formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.FORTIFICATION_SORTIE_LISTROOM_REGULATION_FOOTER))], blocksGap))
     return items
Ejemplo n.º 39
0
 def construct(self):
     shell = self.shell
     configuration = self.configuration
     block = []
     status = None
     checkBuying = configuration.checkBuying
     if checkBuying:
         couldBeBought, reason = shell.mayPurchase(g_itemsCache.items.stats.money)
         if not couldBeBought:
             status = '#tooltips:shellFits/%s' % reason
     statusHeader, statusText = getComplexStatus(status)
     if statusHeader is not None or statusText is not None:
         block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(statusHeader if statusHeader is not None else ''), desc=text_styles.main(statusText if statusText is not None else '')))
     return block
Ejemplo n.º 40
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
Ejemplo n.º 41
0
    def _packBlocks(self, role):
        blocks = []
        bodyStr = '%s/%s' % (TOOLTIPS.VEHICLEPREVIEW_CREW, role)
        crewParams = [ text_styles.neutral(param) for param in _CREW_TOOLTIP_PARAMS[role] ]
        blocks.append(formatters.packTitleDescBlock(text_styles.highTitle(ITEM_TYPES.tankman_roles(role)), text_styles.main(_ms(bodyStr, *crewParams))))
        vehicle = self.context.getVehicle()
        for idx, tankman in vehicle.crew:
            if tankman.role == role:
                otherRoles = list(vehicle.descriptor.type.crewRoles[idx])
                otherRoles.remove(tankman.role)
                if otherRoles:
                    rolesStr = ', '.join([ text_styles.stats(_ms(ITEM_TYPES.tankman_roles(r))) for r in otherRoles ])
                    blocks.append(formatters.packTextBlockData(text_styles.main(_ms(TOOLTIPS.VEHICLEPREVIEW_CREW_ADDITIONALROLES, roles=rolesStr))))

        return blocks
Ejemplo n.º 42
0
    def construct(self):
        module = self.module
        block = []

        def checkLocalization(key):
            localization = _ms('#artefacts:%s' % key)
            return (key != localization, localization)

        onUse = checkLocalization('%s/onUse' % module.descriptor['name'])
        always = checkLocalization('%s/always' % module.descriptor['name'])
        restriction = checkLocalization('%s/restriction' % module.descriptor['name'])
        if module.itemTypeID == ITEM_TYPES.optionalDevice:
            block.append(formatters.packTitleDescBlock(title='', desc=text_styles.bonusAppliedText(module.shortDescription), padding=formatters.packPadding(top=-8)))
        else:
            topPadding = 0
            if always[0] and len(always[1]) > 0:
                block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(TOOLTIPS.EQUIPMENT_ALWAYS), desc=text_styles.bonusAppliedText(always[1])))
                topPadding = 5
            if onUse[0] and len(onUse[1]) > 0:
                block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(TOOLTIPS.EQUIPMENT_ONUSE), desc=text_styles.main(onUse[1]), padding=formatters.packPadding(top=topPadding)))
                topPadding = 5
            if restriction[0] and len(restriction[1]) > 0:
                block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(TOOLTIPS.EQUIPMENT_RESTRICTION), desc=text_styles.main(restriction[1]), padding=formatters.packPadding(top=topPadding)))
        return block
Ejemplo n.º 43
0
 def _packBlocks(self, boosterID, *args, **kwargs):
     items = super(BoosterTooltipData, self)._packBlocks(*args, **kwargs)
     booster = self.context.buildItem(boosterID)
     statsFields = self.context.getStatsConfiguration(booster)
     items.append(formatters.packBuildUpBlockData([formatters.packTitleDescBlock(text_styles.highTitle(booster.fullUserName), desc=text_styles.main(booster.description)), formatters.packImageBlockData(img=booster.bigTooltipIcon, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, width=180, height=180, padding={'top': -14,
       'bottom': -14})]))
     items.append(self.__packDueDate(booster))
     if statsFields.quests:
         questsResult = self.__getBoosterQuestNames(boosterID)
         if len(questsResult):
             items.append(self.__packAccessCondition(questsResult))
     if statsFields.buyPrice and booster.buyPrice:
         priceBlock = self.__getBoosterPrice(booster)
         items.append(formatters.packBuildUpBlockData(priceBlock))
     if statsFields.activeState and booster.inCooldown:
         items.append(self.__packActiveState(booster.getUsageLeftTimeStr()))
     return items
Ejemplo n.º 44
0
 def _packTitleBlock(self, item):
     title = item['title']
     itemsCount = self.__cItem.numberOfItems
     if itemsCount is not None:
         title += _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_ALREADYHAVE_COUNT, count=itemsCount)
     return formatters.packTitleDescBlock(title=text_styles.highTitle(title), padding={'top': -5})
Ejemplo n.º 45
0
 def _packBlocks(self, *args, **kwargs):
     items = super(HeaderPacker, self)._packBlocks(*args, **kwargs)
     items.append(formatters.packTitleDescBlock(text_styles.highTitle(self._title), desc=text_styles.main(self._descr) if self._descr else None))
     return items
Ejemplo n.º 46
0
 def _packStatusBlock(self, tooltipHeader, tooltipText, titleFormatter, padding = None):
     return formatters.packTitleDescBlock(title=titleFormatter(tooltipHeader), desc=text_styles.standard(tooltipText), padding=padding)
Ejemplo n.º 47
0
 def __packAccessCondition(self, questName):
     return formatters.packBuildUpBlockData([formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_GETCONDITION_TITLE), text_styles.standard(makeString(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_GETCONDITION_VALUE, questName=text_styles.neutral(questName))))])
Ejemplo n.º 48
0
 def status(title = None, desc = None):
     if title is not None or desc is not None:
         block.append(formatters.packTitleDescBlock(title=text_styles.middleTitle(title) if title is not None else '', desc=text_styles.main(desc) if desc is not None else ''))
     return block
Ejemplo n.º 49
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 = 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
            paramInfo = None
            for paramName in params_list:
                if paramName is None:
                    continue
                if paramName == 'rateOfFire':
                    paramName = 'reloadTime'
                elif paramName == 'traverseLimits':
                    paramName = 'gunYawLimits' if 'gunYawLimits' in vehicleCommonParams else 'turretYawLimits'
                elif paramName == 'radioRange':
                    paramName = 'radioDistance'
                elif paramName == 'reloadTimeSecs' and vehicle.gun.isClipGun():
                    paramName = 'clipFireRate'
                elif paramName == 'turretRotationSpeed' and not vehicle.hasTurrets:
                    paramName = 'gunRotationSpeed'
                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 paramInfo is not None and paramName in paramInfo.name:
                    valueStr = str(param_formatter.formatParameter(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) > 30) and config.get('tooltips/hideBottomText'): # limitation
            result = result[:30]
        elif (len(result) > 29) and not config.get('tooltips/hideBottomText'): # limitation
            result = result[:29]
        carousel_tooltips_cache[vehicle.intCD] = result
        return result
    except Exception as ex:
        err(traceback.format_exc())
        return base(self)
Ejemplo n.º 50
0
 def __packDueDate(self, booster):
     if booster.expiryTime:
         text = makeString(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_DUEDATE_VALUE, date=booster.getExpiryDate())
     else:
         text = makeString(MENU.BOOSTERSWINDOW_BOOSTERSTABLERENDERER_UNDEFINETIME)
     return formatters.packBuildUpBlockData([formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_DUEDATE_TITLE), text_styles.standard(text))])
Ejemplo n.º 51
0
 def _packTitleBlock(self, title):
     return formatters.packTitleDescBlock(title=text_styles.highTitle(title), padding={'top': -5})
Ejemplo n.º 52
0
 def _packBlocks(self, *args, **kwargs):
     items = super(PersonalCaseSkillsPacker, self)._packBlocks(*args, **kwargs)
     blocksGap = 2
     items.append(formatters.packBuildUpBlockData([formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_SKILLS_SPECIALTYTITLE), text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_SKILLS_SPECIALTYDESCRIPTION))], blocksGap, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
     items.append(formatters.packBuildUpBlockData([formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_PERSONALCASE_SKILLS_SPECIALTYWARNING), img=RES_ICONS.MAPS_ICONS_LIBRARY_ALERTICON1)], blocksGap))
     return items