Esempio n. 1
0
 def _makeLockBlock(self):
     clanLockTime = self.vehicle.clanLock
     if clanLockTime and clanLockTime <= time_utils.getCurrentTimestamp():
         LOG_DEBUG("clan lock time is less than current time: %s" % clanLockTime)
         clanLockTime = None
     isDisabledInRoaming = self.vehicle.isDisabledInRoaming
     if clanLockTime or isDisabledInRoaming:
         headerLock = text_styles.concatStylesToMultiLine(text_styles.warning(_ms(TOOLTIPS.TANKCARUSEL_LOCK_HEADER)))
         if isDisabledInRoaming:
             textLock = text_styles.main(_ms(TOOLTIPS.TANKCARUSEL_LOCK_ROAMING))
         else:
             time = time_utils.getDateTimeFormat(clanLockTime)
             timeStr = text_styles.main(text_styles.concatStylesWithSpace(_ms(TOOLTIPS.TANKCARUSEL_LOCK_TO), time))
             textLock = text_styles.concatStylesToMultiLine(
                 timeStr, text_styles.main(_ms(TOOLTIPS.TANKCARUSEL_LOCK_CLAN))
             )
         lockHeaderBlock = formatters.packTextBlockData(
             headerLock, padding=formatters.packPadding(left=77 + self.leftPadding, top=5)
         )
         lockTextBlock = formatters.packTextBlockData(
             textLock, padding=formatters.packPadding(left=77 + self.leftPadding)
         )
         return formatters.packBuildUpBlockData(
             [lockHeaderBlock, lockTextBlock],
             stretchBg=False,
             linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LOCK_BG_LINKAGE,
             padding=formatters.packPadding(left=-17, top=20, bottom=0),
         )
     else:
         return
         return
Esempio n. 2
0
 def construct(self):
     isClanLock = self.vehicle.clanLock or None
     isDisabledInRoaming = self.vehicle.isDisabledInRoaming
     if isClanLock or isDisabledInRoaming:
         return
     else:
         if self.configuration.node is not None:
             result = self.__getTechTreeVehicleStatus(self.configuration, self.vehicle)
         else:
             result = self.__getVehicleStatus(self.configuration.showCustomStates, self.vehicle)
         if result is not None:
             statusLevel = result['level']
             if statusLevel == Vehicle.VEHICLE_STATE_LEVEL.INFO:
                 headerFormatter = text_styles.statInfo
             elif statusLevel == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL:
                 headerFormatter = text_styles.critical
             elif statusLevel == Vehicle.VEHICLE_STATE_LEVEL.WARNING:
                 headerFormatter = text_styles.warning
             elif statusLevel == Vehicle.VEHICLE_STATE_LEVEL.RENTED:
                 headerFormatter = text_styles.warning
             else:
                 LOG_ERROR('Unknown status type "' + statusLevel + '"!')
                 headerFormatter = text_styles.statInfo
             header = headerFormatter(result['header'])
             text = result['text']
             if text is not None:
                 text = text_styles.standard(text)
                 padding = formatters.packPadding(left=self.leftPadding, right=self.leftPadding)
             else:
                 header = makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center',
                  'message': header})
                 padding = formatters.packPadding(left=0, right=0)
             return [formatters.packTextBlockData(header, padding=padding), formatters.packTextBlockData(text, padding=padding)]
         return
         return
Esempio n. 3
0
 def _packBlocks(self, *args, **kwargs):
     self.item = self.context.buildItem(*args, **kwargs)
     items = super(ShellBlockToolTipData, self)._packBlocks()
     shell = self.item
     statsConfig = self.context.getStatsConfiguration(shell)
     paramsConfig = self.context.getParamsConfiguration(shell)
     statusConfig = self.context.getStatusConfiguration(shell)
     leftPadding = 20
     rightPadding = 20
     topPadding = 20
     lrPaddings = formatters.packPadding(left=leftPadding, right=rightPadding)
     blockTopPadding = -4
     blockPadding = formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding)
     textGap = -2
     items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(shell, statsConfig, leftPadding, rightPadding).construct(), padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=topPadding)))
     priceBlock, invalidWidth = PriceBlockConstructor(shell, statsConfig, 80, leftPadding, rightPadding).construct()
     if len(priceBlock) > 0:
         self._setWidth(_TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH)
         items.append(formatters.packBuildUpBlockData(priceBlock, padding=blockPadding, gap=textGap))
     statsBlock = CommonStatsBlockConstructor(shell, paramsConfig, 80, leftPadding, rightPadding).construct()
     if len(statsBlock) > 0:
         items.append(formatters.packBuildUpBlockData(statsBlock, padding=blockPadding, gap=textGap))
     statusBlock = StatusBlockConstructor(shell, statusConfig, leftPadding, rightPadding).construct()
     if len(statusBlock) > 0:
         items.append(formatters.packBuildUpBlockData(statusBlock, padding=lrPaddings))
     return items
Esempio n. 4
0
 def construct(self):
     block = []
     if self.configuration.crew:
         totalCrewSize = len(self.vehicle.descriptor.type.crewRoles)
         if self.configuration.externalCrewParam and self._roleLevel is not None:
             block.append(
                 formatters.packTextParameterBlockData(
                     name=text_styles.main(_ms(TOOLTIPS.VEHICLE_CREW_AWARD, self._roleLevel)),
                     value=text_styles.stats(str(totalCrewSize)),
                     valueWidth=self._valueWidth,
                     padding=formatters.packPadding(left=-2),
                 )
             )
         elif self.vehicle.isInInventory and not self.configuration.externalCrewParam:
             currentCrewSize = len([x for _, x in self.vehicle.crew if x is not None])
             currentCrewSizeStr = str(currentCrewSize)
             if currentCrewSize < totalCrewSize:
                 currentCrewSizeStr = text_styles.error(currentCrewSizeStr)
             block.append(self._makeStatBlock(currentCrewSizeStr, totalCrewSize, TOOLTIPS.VEHICLE_CREW))
         else:
             block.append(
                 formatters.packTextParameterBlockData(
                     name=text_styles.main(_ms(TOOLTIPS.VEHICLE_CREW)),
                     value=text_styles.stats(str(totalCrewSize)),
                     valueWidth=self._valueWidth,
                     padding=formatters.packPadding(left=-2),
                 )
             )
     lockBlock = self._makeLockBlock()
     if lockBlock is not None:
         block.append(lockBlock)
     return block
Esempio n. 5
0
 def _getFooterBlock(self):
     return formatters.packBuildUpBlockData(
         [
             formatters.packTextBlockData(
                 text_styles.middleTitle(
                     TOOLTIPS.PERSONALMISSIONS_FREESHEET_HOWTOUSE_TITLE),
                 padding=formatters.packPadding(bottom=-2)),
             formatters.packTextBlockData(
                 text_styles.main(
                     TOOLTIPS.PERSONALMISSIONS_FREESHEET_HOWTOUSE_DESCR))
         ],
         padding=formatters.packPadding(top=16))
 def _getInfoBlock(self):
     return formatters.packBuildUpBlockData(
         [
             formatters.packTextParameterWithIconBlockData(
                 text_styles.alert(
                     TOOLTIPS.PERSONALMISSIONS_FREESHEET_NOTENOUGH),
                 '',
                 ICON_TEXT_FRAMES.ALERT,
                 padding=formatters.packPadding(left=-60, bottom=-2))
         ],
         linkage=BLOCKS_TOOLTIP_TYPES.
         TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
         padding=formatters.packPadding(top=-7, bottom=-3))
 def __packPersistentCount(self, persistentCount):
     persistenName = backport.text(R.strings.tooltips.battleTypes.ranked.
                                   bonusBattle.persistent.title())
     return formatters.packBuildUpBlockData(
         [
             formatters.packTitleDescParameterWithIconBlockData(
                 title=text_styles.middleTitle(persistenName),
                 value=text_styles.promoSubTitle(persistentCount),
                 padding=formatters.packPadding(top=-8, left=48, bottom=-3),
                 titlePadding=formatters.packPadding(top=9, left=34))
         ],
         linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE
     )
Esempio n. 8
0
 def __getFooter():
     return [
         formatters.packAlignedTextBlockData(
             text=text_styles.main(
                 backport.text(
                     R.strings.tooltips.tradeInInfo.actionTime())),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=formatters.packPadding(left=34)),
         formatters.packAlignedTextBlockData(
             text=text_styles.neutral(_withTradeInUntil()),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=formatters.packPadding(left=34))
     ]
 def _packHeaderBlock(self):
     return formatters.packImageTextBlockData(
         title=text_styles.highTitle(
             backport.text(R.strings.ranked_battles.tooltip.step.header())),
         desc=text_styles.standard(
             backport.text(
                 R.strings.ranked_battles.tooltip.step.description())),
         img=backport.image(R.images.gui.maps.icons.rankedBattles.ranks.
                            stage.c_140x120.stage_grey()),
         imgPadding=formatters.packPadding(left=-18, top=-28),
         txtGap=-4,
         txtOffset=70,
         padding=formatters.packPadding(bottom=-60))
Esempio n. 10
0
    def _getPrimeTimes(self, primeTimes):
        def getPrimeTimeBlock(pt):
            periphery = int(pt.getServer())
            name = str(self._lobbyContext.getPeripheryName(periphery, False))
            name += ':'
            return '{0} {1}'.format(
                text_styles.main(name),
                text_styles.standard('{} - {}'.format(pt.getStartLocalTime(),
                                                      pt.getEndLocalTime())))

        def getSortedPrimeTimes(primeTimes):
            primeTimes = sorted(primeTimes, key=lambda p: int(p.getServer()))
            times = [getPrimeTimeBlock(pt) for pt in primeTimes]
            return times

        primeTimesData = primeTimes.getPrimeTimes()
        validTimes = set((pt for pt in primeTimesData if pt.isActive()))
        invalidTimes = set(primeTimesData) - validTimes
        blocks = []
        if validTimes:
            result = ''
            bottomPadding = 20 if invalidTimes else 18
            for primeTime in getSortedPrimeTimes(validTimes):
                result += primeTime + '\n'

            blocks.append(
                formatters.packImageTextBlockData(
                    title=text_styles.middleTitle(
                        TOOLTIPS.HANGAR_ELEN_PRIMETIME_VALID),
                    desc=result,
                    padding=formatters.packPadding(left=20,
                                                   top=3,
                                                   bottom=bottomPadding)))
        if invalidTimes:
            topPadding = -8 if validTimes else 3
            result = ''
            for primeTime in getSortedPrimeTimes(invalidTimes):
                result += primeTime + '\n'

            blocks.append(
                formatters.packImageTextBlockData(
                    title=text_styles.middleTitle(
                        TOOLTIPS.HANGAR_ELEN_PRIMETIME_INVALID),
                    desc=result,
                    padding=formatters.packPadding(left=20,
                                                   top=topPadding,
                                                   bottom=18)))
        return formatters.packBuildUpBlockData(
            blocks,
            linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE
        )
Esempio n. 11
0
 def _packProgressBlock(self):
     blocks = []
     unlockedLevel = self._item.getLatestOpenedProgressionLevel(
         self.__vehicle)
     if self._showOnlyProgressBlock:
         level = self._progressionLevel
     else:
         level = unlockedLevel + 1
     if level > self._item.getMaxProgressionLevel():
         return None
     else:
         if level == 1:
             titleDesc = backport.text(
                 R.strings.vehicle_customization.customization.infotype.
                 progression.achievementConditionFirstItem())
         else:
             titleDesc = backport.text(
                 R.strings.vehicle_customization.customization.infotype.
                 progression.achievementCondition(),
                 level=int2roman(level))
         blocks.append(
             formatters.packTextBlockData(
                 text=text_styles.middleTitle(titleDesc)))
         conditions = self._item.progressionConditions.get(level, [])
         if not conditions:
             return None
         if unlockedLevel > 0:
             showCurrentProgress = level == unlockedLevel + 1
         else:
             showCurrentProgress = level == 1
         desc = text_styles.concatStylesToMultiLine(
             '',
             self.__packProgressDescriptionText(
                 conditions[0], showCurrentProgress=showCurrentProgress))
         if not self._showOnlyProgressBlock:
             blocks.append(
                 formatters.packImageTextBlockData(
                     padding=formatters.packPadding(top=10, bottom=-10),
                     img=self._item.iconByProgressionLevel(level),
                     desc=desc,
                     descPadding=formatters.packPadding(left=15),
                     linkage=BLOCKS_TOOLTIP_TYPES.
                     TOOLTIP_IMAGE_TEXT_BLOCK_PROGRESSIVE_LINKAGE))
         else:
             blocks.append(
                 formatters.packTextBlockData(
                     padding=formatters.packPadding(top=-19), text=desc))
         return formatters.packBuildUpBlockData(
             blocks,
             linkage=BLOCKS_TOOLTIP_TYPES.
             TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)
Esempio n. 12
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))
Esempio n. 13
0
 def _packBlocks(self, *args, **kwargs):
     module = vehicles.g_cache.equipments()[args[0]]
     if module is None:
         return
     else:
         items = super(EquipmentsTooltipData, self)._packBlocks()
         leftPadding = 20
         rightPadding = 20
         topPadding = 20
         verticalPadding = 2
         innerBlockLeftPadding = 100
         headerBlockItem = [
             formatters.packBuildUpBlockData(
                 self.__constructHeaderBlock(module, leftPadding,
                                             innerBlockLeftPadding),
                 padding=formatters.packPadding(left=leftPadding,
                                                right=rightPadding,
                                                top=topPadding,
                                                bottom=verticalPadding))
         ]
         cooldownBlock = self.__constructCooldownBlock(
             module, verticalPadding, innerBlockLeftPadding)
         if cooldownBlock is not None:
             headerBlockItem.append(cooldownBlock)
         items.append(formatters.packBuildUpBlockData(headerBlockItem))
         items.append(
             formatters.packBuildUpBlockData(
                 self.__constructDescriptionBlock(module, leftPadding),
                 linkage=BLOCKS_TOOLTIP_TYPES.
                 TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
                 padding=formatters.packPadding(left=leftPadding,
                                                right=rightPadding,
                                                top=verticalPadding,
                                                bottom=verticalPadding)))
         items.append(
             formatters.packTextBlockData(text=text_styles.standard(
                 backport.text(
                     R.strings.tooltips.battle_royale.artefact.source())),
                                          padding=formatters.packPadding(
                                              left=innerBlockLeftPadding,
                                              top=verticalPadding)))
         if hasattr(module, 'tooltipMovie') and module.tooltipMovie:
             block = formatters.packImageBlockData(
                 module.tooltipMovie,
                 BLOCKS_TOOLTIP_TYPES.ALIGN_LEFT,
                 padding=5,
                 linkage=BLOCKS_TOOLTIP_TYPES.
                 TOOLTIP_ADVANCED_CLIP_BLOCK_LINKAGE)
             items.append(block)
         return items
Esempio n. 14
0
 def construct(self):
     block = list()
     paddingTop = 8
     block.append(
         formatters.packImageTextBlockData(
             title=text_styles.error(TOOLTIPS.MODULEFITS_DUPLICATED_HEADER),
             img=RES_ICONS.MAPS_ICONS_TOOLTIP_DUPLICATED_OPTIONAL,
             imgPadding=formatters.packPadding(left=2, top=3),
             txtOffset=20))
     block.append(
         formatters.packTextBlockData(
             text=text_styles.main(TOOLTIPS.MODULEFITS_DUPLICATED_NOTE),
             padding=formatters.packPadding(top=paddingTop)))
     return block
 def __makeImageBlock(self,
                      icon,
                      text,
                      imgPaddingLeft=15,
                      imgPaddingRight=30,
                      imgPaddingTop=0):
     return formatters.packImageTextBlockData(
         title=text_styles.main(text),
         desc='',
         img=icon,
         imgPadding=formatters.packPadding(left=imgPaddingLeft,
                                           right=imgPaddingRight,
                                           top=imgPaddingTop),
         padding=formatters.packPadding(bottom=20))
Esempio n. 16
0
    def _packBlocks(self, chainID):
        personalMissions = dependency.instance(
            IEventsCache).getPersonalMissions()
        operation = first(
            personalMissions.getOperationsForBranch(
                PM_BRANCH.PERSONAL_MISSION_2).values())
        blocks = [
            formatters.packImageTextBlockData(
                title=text_styles.highTitle(operation.getChainName(chainID)),
                desc=text_styles.standard(
                    operation.getChainDescription(chainID)),
                img=RES_ICONS.getAlliance54x54Icon(chainID),
                imgPadding=formatters.packPadding(top=3, left=-5),
                txtOffset=78)
        ]
        nations = getNationsForChain(operation, chainID)
        nationBlocks = []
        separator = '   '
        for nation in GUI_NATIONS:
            if nation in nations:
                icon = icons.makeImageTag(getNationsFilterAssetPath(nation),
                                          26, 16, -4)
                nationName = text_styles.main(NATIONS.all(nation))
                nationBlocks.append(
                    formatters.packTextBlockData(
                        text_styles.concatStylesToSingleLine(
                            icon, separator, nationName)))

        blocks.append(
            formatters.packBuildUpBlockData(
                nationBlocks,
                linkage=BLOCKS_TOOLTIP_TYPES.
                TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
                padding=formatters.packPadding(left=40)))
        allianceID = operation.getAllianceID(chainID)
        blocks.append(
            formatters.packBuildUpBlockData([
                formatters.packTextBlockData(
                    text_styles.middleTitle(
                        PERSONAL_MISSIONS.CHAINTOOLTIPDATA_DESCRIPTION_TITLE),
                    padding=formatters.packPadding(bottom=4)),
                formatters.packTextBlockData(
                    text_styles.main(
                        PERSONAL_MISSIONS.getAllianceChainTooltipDescr(
                            allianceID)),
                    padding=formatters.packPadding(bottom=7))
            ],
                                            padding=formatters.packPadding(
                                                top=-7, bottom=-3)))
        return blocks
Esempio n. 17
0
 def _packBlocks(self, *args, **kwargs):
     self.item = self.context.buildItem(*args, **kwargs)
     items = super(VehicleInfoTooltipData, self)._packBlocks()
     vehicle = self.item
     statsConfig = self.context.getStatsConfiguration(vehicle)
     paramsConfig = self.context.getParamsConfiguration(vehicle)
     statusConfig = self.context.getStatusConfiguration(vehicle)
     leftPadding = 20
     rightPadding = 20
     bottomPadding = 20
     blockTopPadding = -4
     leftRightPadding = formatters.packPadding(left=leftPadding, right=rightPadding)
     blockPadding = formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding)
     valueWidth = 75
     textGap = -2
     items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(vehicle, statsConfig, leftPadding, rightPadding).construct(), padding=leftRightPadding))
     telecomBlock = TelecomBlockConstructor(vehicle, valueWidth, leftPadding, rightPadding).construct()
     if telecomBlock:
         items.append(formatters.packBuildUpBlockData(telecomBlock, padding=leftRightPadding))
     priceBlock, invalidWidth = PriceBlockConstructor(vehicle, statsConfig, self.context.getParams(), valueWidth, leftPadding, rightPadding).construct()
     if priceBlock:
         self._setWidth(_TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH)
         items.append(formatters.packBuildUpBlockData(priceBlock, gap=textGap, padding=blockPadding))
     simplifiedStatsBlock = SimplifiedStatsBlockConstructor(vehicle, paramsConfig, leftPadding, rightPadding).construct()
     if simplifiedStatsBlock:
         items.append(formatters.packBuildUpBlockData(simplifiedStatsBlock, gap=-4, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=leftRightPadding))
     if not vehicle.isRotationGroupLocked:
         commonStatsBlock = CommonStatsBlockConstructor(vehicle, paramsConfig, valueWidth, leftPadding, rightPadding).construct()
         if commonStatsBlock:
             items.append(formatters.packBuildUpBlockData(commonStatsBlock, gap=textGap, padding=blockPadding))
     footnoteBlock = FootnoteBlockConstructor(vehicle, paramsConfig, leftPadding, rightPadding).construct()
     if footnoteBlock:
         items.append(formatters.packBuildUpBlockData(footnoteBlock, gap=textGap, padding=blockPadding))
     if vehicle.isRotationGroupLocked:
         statsBlockConstructor = RotationLockAdditionalStatsBlockConstructor
     elif vehicle.isDisabledInRoaming:
         statsBlockConstructor = RoamingLockAdditionalStatsBlockConstructor
     elif vehicle.clanLock and vehicle.clanLock > time_utils.getCurrentTimestamp():
         statsBlockConstructor = ClanLockAdditionalStatsBlockConstructor
     else:
         statsBlockConstructor = AdditionalStatsBlockConstructor
     items.append(formatters.packBuildUpBlockData(statsBlockConstructor(vehicle, paramsConfig, self.context.getParams(), valueWidth, leftPadding, rightPadding).construct(), gap=textGap, padding=blockPadding))
     if not vehicle.isRotationGroupLocked:
         statusBlock = StatusBlockConstructor(vehicle, statusConfig).construct()
         if statusBlock:
             items.append(formatters.packBuildUpBlockData(statusBlock, padding=blockPadding))
         else:
             self._setContentMargin(bottom=bottomPadding)
     return items
Esempio n. 18
0
 def construct(self):
     block = []
     module = self.module
     vehicle = self.configuration.vehicle
     if module.isCrewBooster():
         skillLearnt = module.isAffectedSkillLearnt(vehicle)
         skillName = _ms(
             ITEM_TYPES.tankman_skills(module.getAffectedSkillName()))
         replaceText = module.getCrewBoosterAction(True)
         boostText = module.getCrewBoosterAction(False)
         skillNotLearntText = text_styles.standard(
             TOOLTIPS.BATTLEBOOSTER_SKILL_NOT_LEARNT)
         skillLearntText = text_styles.standard(
             TOOLTIPS.BATTLEBOOSTER_SKILL_LEARNT)
         applyStyles = vehicle is not None
         replaceText, boostText = self.__getSkillTexts(
             skillLearnt, replaceText, boostText, applyStyles)
         block.append(
             formatters.packImageTextBlockData(
                 title=replaceText,
                 img=RES_ICONS.MAPS_ICONS_BUTTONS_CHECKMARK
                 if not skillLearnt and applyStyles else None,
                 imgPadding=formatters.packPadding(left=2, top=3),
                 txtOffset=20))
         block.append(
             formatters.packImageTextBlockData(title=skillNotLearntText %
                                               skillName,
                                               txtOffset=20))
         block.append(
             formatters.packImageTextBlockData(
                 title=boostText,
                 img=RES_ICONS.MAPS_ICONS_BUTTONS_CHECKMARK
                 if skillLearnt and applyStyles else None,
                 imgPadding=formatters.packPadding(left=2, top=3),
                 txtOffset=20,
                 padding=formatters.packPadding(top=15)))
         block.append(
             formatters.packImageTextBlockData(title=skillLearntText %
                                               skillName,
                                               txtOffset=20))
     else:
         desc = text_styles.bonusAppliedText(
             module.getOptDeviceBoosterDescription(vehicle))
         block.append(
             formatters.packTitleDescBlock(
                 title='',
                 desc=desc,
                 padding=formatters.packPadding(top=-8)))
     return block
 def __packBlueprintDescrBlock():
     fragmentInfo = formatters.packImageTextBlockData(
         desc=text_styles.main(
             TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_DESCRIPTIONFIRST),
         img=RES_ICONS.MAPS_ICONS_BLUEPRINTS_FRAGMENT_MEDIUM_VEHICLE,
         txtPadding=formatters.packPadding(top=2, left=21))
     discountInfo = formatters.packImageTextBlockData(
         desc=text_styles.main(
             TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_DESCRIPTIONSECOND),
         img=RES_ICONS.MAPS_ICONS_BLUEPRINTS_TOOLTIP_DISCOUNT,
         txtPadding=formatters.packPadding(top=4, left=21))
     return formatters.packBuildUpBlockData(
         blocks=[fragmentInfo, discountInfo],
         gap=5,
         padding=formatters.packPadding(top=8))
    def _getAndConditionsBlock(cls, conditions, padding):
        items = []
        for c in conditions:
            items.append(
                formatters.packImageTextBlockData(
                    title=c.title,
                    img=c.icon,
                    txtPadding=formatters.packPadding(left=-21),
                    imgPadding=formatters.packPadding(top=-34),
                    padding=formatters.packPadding(top=10, left=30),
                    ignoreImageSize=True))

        return formatters.packBuildUpBlockData(blocks=items,
                                               padding=padding,
                                               gap=13)
Esempio n. 21
0
 def __constructModule(cls, module):
     block = []
     moduleDescr = module.descriptor
     icon = getTreeModuleIcon(module)
     if icon:
         block.append(
             formatters.packAtlasIconTextBlockData(
                 title=text_styles.highTitle(getTreeModuleHeader(module)),
                 desc=text_styles.standard(moduleDescr.userString),
                 atlas=ATLAS_CONSTANTS.COMMON_BATTLE_LOBBY,
                 icon=icon,
                 iconPadding=formatters.packPadding(right=12),
                 txtGap=1,
                 txtPadding=formatters.packPadding(top=7)))
     return block
def packEpicBattleInfoBlock(epicController=None):
    descLvl = text_styles.stats(
        backport.text(
            R.strings.epic_battle.selectorTooltip.epicBattle.bodyVehicleLevel(
            ),
            level=toRomanRangeString(epicController.getValidVehicleLevels())))
    return formatters.packTitleDescBlock(
        title=text_styles.middleTitle(
            backport.text(R.strings.epic_battle.tooltips.common.title())),
        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 __packQuestInfo(self, quest):
     title = text_styles.middleTitle(quest.getUserName())
     if self._isQuestCompleted(quest):
         name = text_styles.concatStylesToSingleLine(icons.check(), title)
         selfPadding = formatters.packPadding(top=-3, left=14, right=20)
         descPadding = formatters.packPadding(left=6, top=-6)
     else:
         name = title
         selfPadding = formatters.packPadding(left=20, right=20)
         descPadding = formatters.packPadding(top=-2)
     return formatters.packTitleDescBlock(title=name,
                                          desc=text_styles.main(
                                              quest.getDescription()),
                                          padding=selfPadding,
                                          descPadding=descPadding)
Esempio n. 24
0
 def _packBlocks(self, *args, **kwargs):
     self.item = self.context.buildItem(*args, **kwargs)
     items = super(ShellBlockToolTipData, self)._packBlocks()
     shell = self.item
     statsConfig = self.context.getStatsConfiguration(shell)
     paramsConfig = self.context.getParamsConfiguration(shell)
     statusConfig = self.context.getStatusConfiguration(shell)
     leftPadding = 20
     rightPadding = 20
     topPadding = 20
     lrPaddings = formatters.packPadding(left=leftPadding,
                                         right=rightPadding)
     blockTopPadding = -4
     blockPadding = formatters.packPadding(left=leftPadding,
                                           right=rightPadding,
                                           top=blockTopPadding)
     textGap = -2
     items.append(
         formatters.packBuildUpBlockData(
             HeaderBlockConstructor(shell, statsConfig, leftPadding,
                                    rightPadding).construct(),
             padding=formatters.packPadding(left=leftPadding,
                                            right=rightPadding,
                                            top=topPadding)))
     priceBlock, invalidWidth = PriceBlockConstructor(
         shell, statsConfig, 80, leftPadding, rightPadding).construct()
     if len(priceBlock) > 0:
         self._setWidth(
             _TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH)
         items.append(
             formatters.packBuildUpBlockData(priceBlock,
                                             padding=blockPadding,
                                             gap=textGap))
     statsBlock = CommonStatsBlockConstructor(shell, paramsConfig, 80,
                                              leftPadding,
                                              rightPadding).construct()
     if len(statsBlock) > 0:
         items.append(
             formatters.packBuildUpBlockData(statsBlock,
                                             padding=blockPadding,
                                             gap=textGap))
     statusBlock = StatusBlockConstructor(shell, statusConfig, leftPadding,
                                          rightPadding).construct()
     if len(statusBlock) > 0:
         items.append(
             formatters.packBuildUpBlockData(statusBlock,
                                             padding=lrPaddings))
     return items
Esempio n. 25
0
 def _packVehicleBlock(self, vehicleIntCD):
     vehicle = self.itemsCache.items.getItemByCD(int(vehicleIntCD))
     statsConfig = self.context.getStatsConfiguration(vehicle)
     paramsConfig = self.context.getParamsConfiguration(vehicle)
     leftPadding = 20
     rightPadding = 20
     blockTopPadding = -4
     leftRightPadding = formatters.packPadding(left=leftPadding,
                                               right=rightPadding)
     blockPadding = formatters.packPadding(left=leftPadding,
                                           right=rightPadding,
                                           top=blockTopPadding)
     valueWidth = 75
     textGap = -2
     vehicleBlock = list()
     vehicleBlock.append(
         formatters.packBuildUpBlockData(HeaderBlockConstructor(
             vehicle, statsConfig, leftPadding, rightPadding).construct(),
                                         padding=leftRightPadding))
     telecomBlock = TelecomBlockConstructor(vehicle, valueWidth,
                                            leftPadding,
                                            rightPadding).construct()
     if telecomBlock:
         vehicleBlock.append(formatters.packBuildUpBlockData(telecomBlock))
     if not vehicle.isRotationGroupLocked:
         commonStatsBlock = CommonStatsBlockConstructor(
             vehicle, paramsConfig, valueWidth, leftPadding,
             rightPadding).construct()
         if commonStatsBlock:
             vehicleBlock.append(
                 formatters.packBuildUpBlockData(commonStatsBlock,
                                                 gap=textGap,
                                                 padding=blockPadding))
     footnoteBlock = FootnoteBlockConstructor(vehicle, paramsConfig,
                                              leftPadding,
                                              rightPadding).construct()
     if footnoteBlock:
         vehicleBlock.append(
             formatters.packBuildUpBlockData(footnoteBlock,
                                             gap=textGap,
                                             padding=blockPadding))
     vehicleBlock.append(
         formatters.packBuildUpBlockData(AdditionalStatsBlockConstructor(
             vehicle, paramsConfig, self.context.getParams(), valueWidth,
             leftPadding, rightPadding).construct(),
                                         gap=textGap,
                                         padding=blockPadding))
     return vehicleBlock
 def __packVehicleFragmentBlocks(self):
     vehicle, blueprintData, _ = self.context.getVehicleBlueprintData(
         self._fragmentCD)
     if blueprintData is None:
         return
     else:
         items = self._items
         self._setNationFlagCornerBg(vehicle.nationName)
         items.append(
             formatters.packImageTextBlockData(
                 title=text_styles.highTitle(
                     TOOLTIPS.
                     BLUEPRINT_BLUEPRINTFRAGMENTTOOLTIP_FRAGMENTHEADER),
                 desc=self._getVehicleDescrStr(vehicle),
                 img=RES_ICONS.getBlueprintFragment('medium', 'vehicle'),
                 imgPadding=formatters.packPadding(top=3),
                 txtPadding=formatters.packPadding(left=21)))
         self._items = [formatters.packBuildUpBlockData(blocks=items)]
         items = self._items
         percentDiscount, xpDiscount = self.context.getFragmentDiscounts(
             vehicle)
         items.append(
             formatters.packBuildUpBlockData(
                 blocks=[
                     self._getUnlockDiscountBlock(
                         percentDiscount, xpDiscount, TOOLTIPS.
                         BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_RESEARCHDISCOUNT,
                         True)
                 ],
                 linkage=BLOCKS_TOOLTIP_TYPES.
                 TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
                 padding=formatters.packPadding(left=67)))
         gatheredInfoStr = text_styles.concatStylesWithSpace(
             text_styles.stats(int(blueprintData.filledCount)),
             text_styles.main(' '.join(
                 ('/', str(blueprintData.totalCount)))),
             text_styles.main(
                 TOOLTIPS.
                 BLUEPRINT_BLUEPRINTFRAGMENTTOOLTIP_FRAGMENTGATHERED))
         items.append(
             formatters.packTextBlockData(
                 text=gatheredInfoStr,
                 padding=formatters.packPadding(left=67)))
         items.append(
             formatters.packTextBlockData(text=text_styles.main(
                 TOOLTIPS.
                 BLUEPRINT_BLUEPRINTFRAGMENTTOOLTIP_FRAGMENTDESCRIPTION)))
         return
Esempio n. 27
0
 def _makePriceBlock(self, price, currencySetting, neededValue = None, oldPrice = None, percent = 0):
     needFormatted = ''
     oldPriceText = ''
     hasAction = percent != 0
     settings = getCurrencySetting(currencySetting)
     if settings is None:
         return
     else:
         valueFormatted = settings.textStyle(_int(price))
         icon = settings.icon
         if neededValue is not None:
             needFormatted = settings.textStyle(_int(neededValue))
         if hasAction:
             oldPriceText = text_styles.concatStylesToSingleLine(icon, settings.textStyle(_int(oldPrice)))
         neededText = ''
         if neededValue is not None:
             neededText = text_styles.concatStylesToSingleLine(text_styles.main('('), text_styles.error(TOOLTIPS.VEHICLE_GRAPH_BODY_NOTENOUGH), ' ', needFormatted, ' ', icon, text_styles.main(')'))
         text = text_styles.concatStylesWithSpace(text_styles.main(settings.text), neededText)
         if hasAction:
             actionText = text_styles.main(_ms(TOOLTIPS.VEHICLE_ACTION_PRC, actionPrc=text_styles.stats(str(percent) + '%'), oldPrice=oldPriceText))
             text = text_styles.concatStylesToMultiLine(text, actionText)
             if settings.frame == ICON_TEXT_FRAMES.GOLD:
                 newPrice = (0, price)
             else:
                 newPrice = (price, 0)
             return formatters.packSaleTextParameterBlockData(name=text, saleData={'newPrice': newPrice,
              'valuePadding': -8}, actionStyle='alignTop', padding=formatters.packPadding(left=92))
         return formatters.packTextParameterWithIconBlockData(name=text, value=valueFormatted, icon=settings.frame, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5))
         return
Esempio n. 28
0
 def _getDescriptionBlock(self, division, isLocked, isCompleted):
     descTitle = text_styles.middleTitle(
         backport.text(
             R.strings.ranked_battles.division.tooltip.desc.title()))
     descKey = 'current'
     if isLocked:
         descKey = 'locked'
     elif isCompleted:
         descKey = 'completed'
     if division.isQualification():
         descKey += 'Qual'
     elif division.isFinal():
         descKey += 'Final'
     qualBattles = sorted(
         self.rankedController.getQualificationQuests().keys())
     qualBattles.append(
         self.rankedController.getTotalQualificationBattles())
     descText = text_styles.standard(
         backport.text(R.strings.ranked_battles.division.tooltip.desc.dyn(
             descKey).text(),
                       battles=', '.join([str(x) for x in qualBattles])))
     return formatters.packImageTextBlockData(
         title=descTitle,
         desc=descText,
         txtPadding=formatters.packPadding(left=10))
Esempio n. 29
0
 def construct(self):
     if self.configuration.params and not self.configuration.simplifiedOnly:
         currentCrewSize = len([x for _, x in self.vehicle.crew if x is not None])
         if currentCrewSize < len(self.vehicle.descriptor.type.crewRoles):
             return [
                 formatters.packImageTextBlockData(
                     title="",
                     desc=text_styles.standard(TOOLTIPS.VEHICLE_STATS_FOOTNOTE),
                     img=RES_ICONS.MAPS_ICONS_LIBRARY_STORE_CONDITION_OFF,
                     imgPadding=formatters.packPadding(top=4),
                     txtGap=-4,
                     txtOffset=20,
                     padding=formatters.packPadding(left=59, right=20),
                 )
             ]
     return []
Esempio n. 30
0
 def _getStatusBlock(division, isLocked, isCompleted):
     statusTitle = text_styles.warning(
         backport.text(
             R.strings.ranked_battles.division.tooltip.status.current()))
     statusText = None
     if division.isQualification():
         statusTitle = text_styles.warning(
             backport.text(R.strings.ranked_battles.division.tooltip.status.
                           currentQual()))
     if isLocked:
         statusTitle = text_styles.critical(
             backport.text(
                 R.strings.ranked_battles.division.tooltip.status.locked()))
         statusText = text_styles.standard(
             backport.text(R.strings.ranked_battles.division.tooltip.status.
                           locked.desc()))
         if division.isPostQualification():
             statusText = text_styles.standard(
                 backport.text(R.strings.ranked_battles.division.tooltip.
                               status.locked.descQual()))
     if isCompleted:
         statusTitle = text_styles.statInfo(
             backport.text(R.strings.ranked_battles.division.tooltip.status.
                           completed()))
         if division.isQualification():
             statusTitle = text_styles.statInfo(
                 backport.text(R.strings.ranked_battles.division.tooltip.
                               status.completedQual()))
     return formatters.packImageTextBlockData(
         title=statusTitle,
         desc=statusText,
         txtPadding=formatters.packPadding(left=10))
Esempio n. 31
0
 def _packBlocks(self, *args, **kwargs):
     items = super(VehCompareModuleBlockTooltipData, self)._packBlocks()
     module = self.context.buildItem(*args, **kwargs)
     statsConfig = self.context.getStatsConfiguration(module)
     paramsConfig = self.context.getParamsConfiguration(module)
     statusConfig = self.context.getStatusConfiguration(module)
     leftPadding = 20
     rightPadding = 20
     topPadding = 20
     blockTopPadding = -4
     blockPadding = formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding)
     textGap = -2
     valueWidth = 110
     items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(module, statsConfig, leftPadding, rightPadding).construct(), padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=topPadding)))
     if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS:
         effectsBlock = EffectsBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct()
         if len(effectsBlock) > 0:
             items.append(formatters.packBuildUpBlockData(effectsBlock, padding=blockPadding, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
     priceBlock, invalidWidth = PriceBlockConstructor(module, statsConfig, valueWidth, leftPadding, rightPadding).construct()
     if priceBlock:
         self._setWidth(_TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH)
         items.append(formatters.packBuildUpBlockData(priceBlock, padding=blockPadding, gap=textGap))
     statsModules = GUI_ITEM_TYPE.VEHICLE_MODULES + (GUI_ITEM_TYPE.OPTIONALDEVICE,)
     if module.itemTypeID in statsModules:
         commonStatsBlock = CommonStatsBlockConstructor(module, paramsConfig, statsConfig.slotIdx, valueWidth, leftPadding, rightPadding, False).construct()
         if commonStatsBlock:
             items.append(formatters.packBuildUpBlockData(commonStatsBlock, padding=blockPadding, gap=textGap))
     return items
Esempio n. 32
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
Esempio n. 33
0
 def _packBodyBlock(self):
     subBlocks = []
     if self._nations:
         subBlocks.append(
             self.__getParagraphNameBlock(
                 TANK_CAROUSEL_FILTER.INFOTIP_NATIONS))
         subBlocks.append(self.__packNationsListBlock())
     if self._vehicleTypes:
         subBlocks.append(
             self.__getParagraphNameBlock(
                 TANK_CAROUSEL_FILTER.INFOTIP_VEHICLETYPES))
         subBlocks.append(self.__packTypesListBlock())
     if self._levels and len(self._levels) < len(VEHICLE_LEVELS):
         subBlocks.append(
             self.__getParagraphNameBlock(
                 TANK_CAROUSEL_FILTER.INFOTIP_LEVELS))
         subBlocks.append(self.__packLevelBlock())
     if any(self._specials.values()):
         subBlocks.append(
             self.__getParagraphNameBlock(
                 TANK_CAROUSEL_FILTER.INFOTIP_ONLY))
         subBlocks.append(self.__packSpecialTypeBlock())
     return formatters.packBuildUpBlockData(
         subBlocks,
         linkage=BLOCKS_TOOLTIP_TYPES.
         TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
         padding=formatters.packPadding(top=-5, bottom=-5))
 def __packInfoBlock(self, bonuses):
     return [
         formatters.packTextBlockData(
             text=text_styles.titleFont(
                 backport.text(_R_TOOLTIPS_TEXT.bonuses())),
             padding=formatters.packPadding(bottom=20))
     ] + [self.__getBonus(_BONUS_PRESETS[bonusId]) for bonusId in bonuses]
Esempio n. 35
0
 def _packIconBlock(self, isHistorical=False, isDim=False):
     width = self._countImageWidth()
     formfactor = ''
     if self._item.itemTypeID == GUI_ITEM_TYPE.PROJECTION_DECAL:
         formfactor = self._item.formfactor
     if self._item.isProgressive:
         if self._progressionLevel > 0:
             progressionLevel = self._progressionLevel
         else:
             progressionLevel = self._item.getLatestOpenedProgressionLevel(
                 self.__vehicle)
             if progressionLevel <= 0:
                 return
         img = self._item.iconByProgressionLevel(progressionLevel)
     else:
         component = None
         img = self._item.getIconApplied(component)
     return formatters.packCustomizationImageBlockData(
         img=img,
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         width=width,
         height=self.CUSTOMIZATION_TOOLTIP_ICON_HEIGHT,
         padding=formatters.packPadding(bottom=2),
         formfactor=formfactor,
         isDim=isDim)
Esempio n. 36
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))
Esempio n. 37
0
 def _packBlocks(self, *args, **kwargs):
     items = super(VehCompareModuleBlockTooltipData, self)._packBlocks()
     module = self.context.buildItem(*args, **kwargs)
     statsConfig = self.context.getStatsConfiguration(module)
     paramsConfig = self.context.getParamsConfiguration(module)
     statusConfig = self.context.getStatusConfiguration(module)
     leftPadding = 20
     rightPadding = 20
     topPadding = 20
     blockTopPadding = -4
     blockPadding = formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding)
     textGap = -2
     valueWidth = 110
     items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(module, statsConfig, leftPadding, rightPadding).construct(), padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=topPadding)))
     if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS:
         effectsBlock = EffectsBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct()
         if effectsBlock:
             items.append(formatters.packBuildUpBlockData(effectsBlock, padding=blockPadding, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
     priceBlock, invalidWidth = PriceBlockConstructor(module, statsConfig, valueWidth, leftPadding, rightPadding).construct()
     if priceBlock:
         self._setWidth(_TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH)
         items.append(formatters.packBuildUpBlockData(priceBlock, padding=blockPadding, gap=textGap))
     statsModules = GUI_ITEM_TYPE.VEHICLE_MODULES + (GUI_ITEM_TYPE.OPTIONALDEVICE,)
     if module.itemTypeID in statsModules:
         commonStatsBlock = CommonStatsBlockConstructor(module, paramsConfig, statsConfig.slotIdx, valueWidth, leftPadding, rightPadding, False).construct()
         if commonStatsBlock:
             items.append(formatters.packBuildUpBlockData(commonStatsBlock, padding=blockPadding, gap=textGap))
     return items
Esempio n. 38
0
    def _getStatus(self):
        block = []
        module = self.module
        configuration = self.configuration
        vehicle = configuration.vehicle
        slotIdx = configuration.slotIdx
        eqs = configuration.eqs
        checkBuying = configuration.checkBuying
        isEqOrDev = module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS
        isFit = True
        reason = ''
        titleFormatter = text_styles.middleTitle
        if vehicle is not None and vehicle.isInInventory:
            currentVehicleEqs = list()
            if vehicle is not None and vehicle.isInInventory:
                currentVehicleEqs = list(vehicle.eqs)
                vehicle.eqs = [None, None, None]
                if eqs:
                    for i, e in enumerate(eqs):
                        if e is not None:
                            intCD = int(e)
                            eq = g_itemsCache.items.getItemByCD(intCD)
                            vehicle.eqs[i] = eq

            isFit, reason = module.mayInstall(vehicle, slotIdx)
            vehicle.eqs = list(currentVehicleEqs)
        inventoryVehicles = g_itemsCache.items.getVehicles(REQ_CRITERIA.INVENTORY).itervalues()
        installedVehicles = map(lambda x: x.shortUserName, module.getInstalledVehicles(inventoryVehicles))[:self.MAX_INSTALLED_LIST_LEN]
        tooltipHeader = None
        tooltipText = None
        if not isFit:
            reason = reason.replace(' ', '_')
            tooltipHeader, tooltipText = getComplexStatus('#tooltips:moduleFits/%s' % reason)
            if reason == 'not_with_installed_equipment':
                if vehicle is not None:
                    conflictEqs = module.getConflictedEquipments(vehicle)
                    tooltipText %= {'eqs': ', '.join([ _ms(e.userName) for e in conflictEqs ])}
            elif reason == 'already_installed' and isEqOrDev and len(installedVehicles):
                tooltipHeader, _ = getComplexStatus('#tooltips:deviceFits/already_installed' if module.itemTypeName == GUI_ITEM_TYPE.OPTIONALDEVICE else '#tooltips:moduleFits/already_installed')
                tooltipText = ', '.join(installedVehicles)
        elif len(installedVehicles):
            tooltipHeader, _ = getComplexStatus('#tooltips:deviceFits/already_installed' if module.itemTypeName == GUI_ITEM_TYPE.OPTIONALDEVICE else '#tooltips:moduleFits/already_installed')
            tooltipText = ', '.join(installedVehicles)
        if tooltipHeader is not None or tooltipText is not None:
            block.append(self._packStatusBlock(tooltipHeader, tooltipText, titleFormatter))
        if checkBuying:
            isFit, reason = module.mayPurchase(g_itemsCache.items.stats.money)
            if not isFit:
                reason = reason.replace(' ', '_')
                if reason in ('gold_error', 'credit_error'):
                    titleFormatter = text_styles.critical
                tooltipHeader, tooltipText = getComplexStatus('#tooltips:moduleFits/%s' % reason)
                if tooltipHeader is not None or tooltipText is not None:
                    if len(block):
                        padding = formatters.packPadding(bottom=15)
                        block.insert(0, self._packStatusBlock(tooltipHeader, tooltipText, titleFormatter, padding))
                    else:
                        block.append(self._packStatusBlock(tooltipHeader, tooltipText, titleFormatter))
        return block
Esempio n. 39
0
 def __init__(self):
     _ms = i18n.makeString
     super(FemaleTankmanAwardTooltipData, self).__init__(
         contexts.PotapovQuestsTileContext(),
         text_styles.highTitle(
             _ms(TOOLTIPS.QUESTS_SEASONAWARD_TITLE, name=_ms(QUESTS.SEASONAWARDSWINDOW_FEMALETANKMANAWARD_TITLE))
         ),
         RES_ICONS.MAPS_ICONS_QUESTS_TANKMANFEMALEGRAY,
         formatters.packPadding(top=22, bottom=13),
     )
Esempio n. 40
0
 def __init__(self):
     _ms = i18n.makeString
     super(TokensAwardTooltipData, self).__init__(
         contexts.PotapovQuestsTileContext(),
         text_styles.highTitle(
             _ms(TOOLTIPS.QUESTS_SEASONAWARD_TITLE, name=_ms(QUESTS.SEASONAWARDSWINDOW_COMMENDATIONLISTSAWARD_TITLE))
         ),
         RES_ICONS.MAPS_ICONS_QUESTS_TOKEN256TOOLTIP,
         formatters.packPadding(top=-46, bottom=7),
     )
Esempio n. 41
0
    def construct(self):
        block = []
        if self.configuration.params:
            comparator = params_helper.idealCrewComparator(self.vehicle)
            stockParams = params_helper.getParameters(g_itemsCache.items.getStockVehicle(self.vehicle.intCD))
            for paramName in RELATIVE_PARAMS:
                paramInfo = comparator.getExtendedData(paramName)
                fmtValue = param_formatter.simplifiedVehicleParameter(paramInfo)
                if fmtValue is not None:
                    buffIconSrc = ""
                    if self.vehicle.isInInventory:
                        buffIconSrc = params_helper.getBuffIcon(paramInfo, comparator)
                    block.append(
                        formatters.packStatusDeltaBlockData(
                            title=param_formatter.formatVehicleParamName(paramName),
                            valueStr=fmtValue,
                            statusBarData={
                                "value": paramInfo.value,
                                "delta": 0,
                                "minValue": 0,
                                "markerValue": stockParams[paramName],
                                "maxValue": MAX_RELATIVE_VALUE,
                                "useAnim": False,
                            },
                            buffIconSrc=buffIconSrc,
                            padding=formatters.packPadding(left=74, top=8),
                        )
                    )

        if len(block) > 0:
            block.insert(
                0,
                formatters.packTextBlockData(
                    text_styles.middleTitle(_ms(TOOLTIPS.VEHICLEPARAMS_SIMPLIFIED_TITLE)),
                    padding=formatters.packPadding(top=-4),
                ),
            )
        return block
Esempio n. 42
0
    def construct(self):
        paramsDict = dict(params_helper.getParameters(self.vehicle))
        block = []
        comparator = params_helper.idealCrewComparator(self.vehicle)
        if self.configuration.params and not self.configuration.simplifiedOnly:
            for paramName in self.PARAMS.get(self.vehicle.type, "default"):
                if paramName in paramsDict:
                    paramInfo = comparator.getExtendedData(paramName)
                    fmtValue = param_formatter.colorizedFormatParameter(paramInfo, param_formatter.BASE_FORMATTERS)
                    if fmtValue is not None:
                        block.append(
                            formatters.packTextParameterBlockData(
                                name=param_formatter.formatVehicleParamName(paramName),
                                value=fmtValue,
                                valueWidth=self._valueWidth,
                                padding=formatters.packPadding(left=-1),
                            )
                        )

        if len(block) > 0:
            title = text_styles.middleTitle(TOOLTIPS.VEHICLEPARAMS_COMMON_TITLE)
            block.insert(0, formatters.packTextBlockData(title, padding=formatters.packPadding(bottom=8)))
        return block
Esempio n. 43
0
 def _packBlocks(self, *args, **kwargs):
     self.item = self.context.buildItem(*args, **kwargs)
     items = super(VehicleInfoTooltipData, self)._packBlocks()
     vehicle = self.item
     statsConfig = self.context.getStatsConfiguration(vehicle)
     paramsConfig = self.context.getParamsConfiguration(vehicle)
     statusConfig = self.context.getStatusConfiguration(vehicle)
     leftPadding = 20
     rightPadding = 20
     bottomPadding = 20
     blockTopPadding = -4
     leftRightPadding = formatters.packPadding(left=leftPadding, right=rightPadding)
     blockPadding = formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding)
     valueWidth = 75
     textGap = -2
     items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(vehicle, statsConfig, leftPadding, rightPadding).construct(), padding=leftRightPadding))
     telecomBlock = TelecomBlockConstructor(vehicle, valueWidth, leftPadding, rightPadding).construct()
     if len(telecomBlock) > 0:
         items.append(formatters.packBuildUpBlockData(telecomBlock, padding=leftRightPadding))
     priceBlock, invalidWidth = PriceBlockConstructor(vehicle, statsConfig, valueWidth, leftPadding, rightPadding).construct()
     if len(priceBlock) > 0:
         self._setWidth(_TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH)
         items.append(formatters.packBuildUpBlockData(priceBlock, gap=textGap, padding=blockPadding))
     items.append(formatters.packBuildUpBlockData(SimplifiedStatsBlockConstructor(vehicle, paramsConfig, leftPadding, rightPadding).construct(), gap=-4, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=leftRightPadding))
     commonStatsBlock = CommonStatsBlockConstructor(vehicle, paramsConfig, valueWidth, leftPadding, rightPadding).construct()
     if len(commonStatsBlock) > 0:
         items.append(formatters.packBuildUpBlockData(commonStatsBlock, gap=textGap, padding=blockPadding))
     footnoteBlock = FootnoteBlockConstructor(vehicle, paramsConfig, leftPadding, rightPadding).construct()
     if len(footnoteBlock):
         items.append(formatters.packBuildUpBlockData(footnoteBlock, gap=textGap, padding=blockPadding))
     items.append(formatters.packBuildUpBlockData(AdditionalStatsBlockConstructor(vehicle, paramsConfig, valueWidth, leftPadding, rightPadding).construct(), gap=textGap, padding=blockPadding))
     statusBlock = StatusBlockConstructor(vehicle, statusConfig).construct()
     if len(statusBlock) > 0:
         items.append(formatters.packBuildUpBlockData(statusBlock, padding=blockPadding))
     else:
         self._setContentMargin(bottom=bottomPadding)
     return items
Esempio n. 44
0
    def construct(self):
        block = []
        for parameter in params_formatters.getRelativeDiffParams(self.__comparator):
            delta = parameter.state[1]
            value = parameter.value
            if delta > 0:
                value -= delta
            block.append(formatters.packStatusDeltaBlockData(title=text_styles.middleTitle(MENU.tank_params(parameter.name)), valueStr=params_formatters.simlifiedModuleParameter(parameter), statusBarData={'value': value,
             'delta': delta,
             'minValue': 0,
             'markerValue': self.__stockParams[parameter.name],
             'maxValue': MAX_RELATIVE_VALUE,
             'useAnim': False}, padding=formatters.packPadding(left=105, top=8)))

        return block
Esempio n. 45
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
Esempio n. 46
0
 def _packBlocks(self, *args, **kwargs):
     self.item = self.context.buildItem(*args, **kwargs)
     items = super(ModuleBlockTooltipData, self)._packBlocks()
     module = self.item
     statsConfig = self.context.getStatsConfiguration(module)
     paramsConfig = self.context.getParamsConfiguration(module)
     statusConfig = self.context.getStatusConfiguration(module)
     leftPadding = 20
     rightPadding = 20
     topPadding = 20
     blockTopPadding = -4
     blockPadding = formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding)
     textGap = -2
     valueWidth = 110
     items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(module, statsConfig, leftPadding, rightPadding).construct(), padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=topPadding)))
     if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS:
         effectsBlock = EffectsBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct()
         if len(effectsBlock) > 0:
             items.append(formatters.packBuildUpBlockData(effectsBlock, padding=blockPadding, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
     priceBlock, invalidWidth = PriceBlockConstructor(module, statsConfig, valueWidth, leftPadding, rightPadding).construct()
     if len(priceBlock) > 0:
         self._setWidth(_TOOLTIP_MAX_WIDTH if invalidWidth else _TOOLTIP_MIN_WIDTH)
         items.append(formatters.packBuildUpBlockData(priceBlock, padding=blockPadding, gap=textGap))
     if statsConfig.vehicle is not None and not module.isInstalled(statsConfig.vehicle):
         if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS:
             comparator = params_helper.artifactComparator(statsConfig.vehicle, module, statsConfig.slotIdx)
         else:
             comparator = params_helper.itemOnVehicleComparator(statsConfig.vehicle, module)
         stockParams = params_helper.getParameters(g_itemsCache.items.getStockVehicle(statsConfig.vehicle.intCD))
         simplifiedBlock = SimplifiedStatsBlockConstructor(module, paramsConfig, leftPadding, rightPadding, stockParams, comparator).construct()
         if len(simplifiedBlock) > 0:
             items.append(formatters.packBuildUpBlockData(simplifiedBlock, gap=-4, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=-14, bottom=1), stretchBg=True))
     statsModules = GUI_ITEM_TYPE.VEHICLE_MODULES + (GUI_ITEM_TYPE.OPTIONALDEVICE,)
     if module.itemTypeID in statsModules:
         commonStatsBlock = CommonStatsBlockConstructor(module, paramsConfig, statsConfig.slotIdx, valueWidth, leftPadding, rightPadding).construct()
         if len(commonStatsBlock) > 0:
             items.append(formatters.packBuildUpBlockData(commonStatsBlock, padding=blockPadding, gap=textGap))
     if not module.isRemovable:
         items.append(formatters.packBuildUpBlockData(ArtefactBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct(), gap=-4, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_COMPLEX_BG_LINKAGE, padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=blockTopPadding, bottom=2), stretchBg=False))
     statusBlock = StatusBlockConstructor(module, statusConfig, leftPadding, rightPadding).construct()
     if len(statusBlock) > 0:
         items.append(formatters.packBuildUpBlockData(statusBlock, padding=blockPadding))
     return items
Esempio n. 47
0
 def __packSpecialTypeBlock(self):
     string = ''
     addComma = lambda str: ('{0}, '.format(str) if str else str)
     if self._specials['premium']:
         string += _ms(TANK_CAROUSEL_FILTER.INFOTIP_ONLY_PREMIUM)
     if self._specials['elite']:
         string = addComma(string)
         string += _ms(TANK_CAROUSEL_FILTER.INFOTIP_ONLY_ELITE)
     if self._specials['favorite']:
         string = addComma(string)
         string += _ms(TANK_CAROUSEL_FILTER.INFOTIP_ONLY_FAVORITE)
     if self._specials['bonus']:
         icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_MULTYXP)
         xpRate = text_styles.stats('x{0}'.format(g_itemsCache.items.shop.dailyXPFactor))
         string = addComma(string)
         string += '{0}{1}'.format(icon, xpRate)
     if self._specials['igr']:
         string = addComma(string)
         string += icons.premiumIgrSmall()
     return formatters.packTextBlockData(text=text_styles.main(string), padding=formatters.packPadding(top=-5, bottom=5, left=15))
Esempio n. 48
0
 def construct(self):
     block = []
     if self.vehicle.isElite:
         vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(self.vehicle.type)
         bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_ELITE_VEHICLE_FAVORITE_BG_LINKAGE if self.vehicle.isFavorite else BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_ELITE_VEHICLE_BG_LINKAGE
     else:
         vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_normal(self.vehicle.type)
         bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_NORMAL_VEHICLE_FAVORITE_BG_LINKAGE if self.vehicle.isFavorite else BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_NORMAL_VEHICLE_BG_LINKAGE
     nameStr = text_styles.highTitle(self.vehicle.userName)
     typeStr = text_styles.main(vehicleType)
     levelStr = text_styles.concatStylesWithSpace(text_styles.stats(int2roman(self.vehicle.level)), text_styles.standard(_ms(TOOLTIPS.VEHICLE_LEVEL)))
     icon = '../maps/icons/vehicleTypes/big/' + self.vehicle.type + ('_elite.png' if self.vehicle.isElite else '.png')
     imgOffset = 4
     textOffset = 82
     if self.vehicle.type == 'heavyTank':
         imgOffset = 11
         textOffset = 99
     iconBlock = formatters.packImageTextBlockData(title=nameStr, desc=text_styles.concatStylesToMultiLine(typeStr, levelStr), img=icon, imgPadding={'left': imgOffset,
      'top': -15}, txtGap=-2, txtOffset=textOffset, padding=formatters.packPadding(top=15, bottom=-15))
     block.append(formatters.packBuildUpBlockData([iconBlock], stretchBg=False, linkage=bgLinkage, padding=formatters.packPadding(left=-19 + self.leftPadding, top=-1)))
     return block
Esempio n. 49
0
 def construct(self):
     block = []
     headerBlocks = []
     if self.vehicle.isElite:
         vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(self.vehicle.type)
         bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_ELITE_VEHICLE_BG_LINKAGE
     else:
         vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_normal(self.vehicle.type)
         bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_NORMAL_VEHICLE_BG_LINKAGE
     nameStr = text_styles.highTitle(self.vehicle.userName)
     typeStr = text_styles.main(vehicleType)
     levelStr = text_styles.concatStylesWithSpace(
         text_styles.stats(int2roman(self.vehicle.level)), text_styles.standard(_ms(TOOLTIPS.VEHICLE_LEVEL))
     )
     icon = getTypeBigIconPath(self.vehicle.type, self.vehicle.isElite)
     headerBlocks.append(
         formatters.packImageTextBlockData(
             title=nameStr,
             desc=text_styles.concatStylesToMultiLine(levelStr + " " + typeStr, ""),
             img=icon,
             imgPadding=formatters.packPadding(left=10, top=-15),
             txtGap=-2,
             txtOffset=99,
             padding=formatters.packPadding(top=15, bottom=-15 if self.vehicle.isFavorite else -21),
         )
     )
     if self.vehicle.isFavorite:
         headerBlocks.append(
             formatters.packImageTextBlockData(
                 title=text_styles.neutral(TOOLTIPS.VEHICLE_FAVORITE),
                 img=RES_ICONS.MAPS_ICONS_TOOLTIP_MAIN_TYPE,
                 imgPadding=formatters.packPadding(top=-15),
                 imgAtLeft=False,
                 txtPadding=formatters.packPadding(left=10),
                 txtAlign=BLOCKS_TOOLTIP_TYPES.ALIGN_RIGHT,
                 padding=formatters.packPadding(top=-28, bottom=-27),
             )
         )
     block.append(
         formatters.packBuildUpBlockData(
             headerBlocks, stretchBg=False, linkage=bgLinkage, padding=formatters.packPadding(left=-self.leftPadding)
         )
     )
     return block
Esempio n. 50
0
 def construct(self):
     xp = self.configuration.xp
     dailyXP = self.configuration.dailyXP
     buyPrice = self.configuration.buyPrice
     sellPrice = self.configuration.sellPrice
     unlockPrice = self.configuration.unlockPrice
     techTreeNode = self.configuration.node
     minRentPrice = self.configuration.minRentPrice
     rentals = self.configuration.rentals
     paddings = formatters.packPadding(left=-4)
     neededValue = 0
     actionPrc = 0
     if buyPrice and sellPrice:
         LOG_ERROR('You are not allowed to use buyPrice and sellPrice at the same time')
         return
     else:
         block = []
         isUnlocked = self.vehicle.isUnlocked
         isInInventory = self.vehicle.isInInventory
         isNextToUnlock = False
         parentCD = None
         if techTreeNode is not None:
             isNextToUnlock = bool(int(techTreeNode.state) & NODE_STATE.NEXT_2_UNLOCK)
             parentCD = techTreeNode.unlockProps.parentID
         if xp:
             xpValue = self.vehicle.xp
             if xpValue:
                 xPText = text_styles.expText(_int(xpValue))
                 icon = ICON_TEXT_FRAMES.FREE_XP if self.vehicle.isPremium else ICON_TEXT_FRAMES.XP
                 block.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_XP), value=xPText, icon=icon, valueWidth=self._valueWidth, padding=paddings))
         if dailyXP:
             attrs = g_itemsCache.items.stats.attributes
             if attrs & constants.ACCOUNT_ATTR.DAILY_MULTIPLIED_XP and self.vehicle.dailyXPFactor > 0:
                 dailyXPText = text_styles.main(text_styles.expText('x' + _int(self.vehicle.dailyXPFactor)))
                 block.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_DAILYXPFACTOR), value=dailyXPText, icon=ICON_TEXT_FRAMES.DOUBLE_XP_FACTOR, valueWidth=self._valueWidth, padding=paddings))
         if unlockPrice:
             isAvailable, cost, need = getUnlockPrice(self.vehicle.intCD, parentCD)
             if cost > 0:
                 neededValue = None
                 if isAvailable and not isUnlocked and need > 0 and techTreeNode is not None:
                     neededValue = need
                 block.append(makePriceBlock(cost, CURRENCY_SETTINGS.UNLOCK_PRICE, neededValue, valueWidth=self._valueWidth))
         if buyPrice and not (self.vehicle.isDisabledForBuy or self.vehicle.isPremiumIGR or self.vehicle.isTelecom):
             price = self.vehicle.buyPrice
             money = g_itemsCache.items.stats.money
             actionPrc = self.vehicle.actionPrc
             defaultPrice = self.vehicle.defaultPrice
             currency = price.getCurrency()
             buyPriceText = price.get(currency)
             oldPrice = defaultPrice.get(currency)
             neededValue = price.get(currency) - money.get(currency)
             neededValue = neededValue if neededValue > 0 else None
             if isInInventory or not isInInventory and not isUnlocked and not isNextToUnlock:
                 neededValue = None
             block.append(makePriceBlock(buyPriceText, CURRENCY_SETTINGS.getBuySetting(currency), neededValue, oldPrice, actionPrc, valueWidth=self._valueWidth))
         if sellPrice and not self.vehicle.isTelecom:
             sellPrice = self.vehicle.sellPrice
             if sellPrice.isSet(Currency.GOLD):
                 sellPriceText = text_styles.gold(_int(sellPrice.gold))
                 sellPriceIcon = ICON_TEXT_FRAMES.GOLD
             else:
                 sellPriceText = text_styles.credits(_int(sellPrice.credits))
                 sellPriceIcon = ICON_TEXT_FRAMES.CREDITS
             block.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_SELL_PRICE), value=sellPriceText, icon=sellPriceIcon, valueWidth=self._valueWidth, padding=paddings))
         if minRentPrice and not self.vehicle.isPremiumIGR:
             minRentPricePackage = self.vehicle.getRentPackage()
             if minRentPricePackage:
                 minRentPriceValue = Money(*minRentPricePackage['rentPrice'])
                 minDefaultRentPriceValue = Money(*minRentPricePackage['defaultRentPrice'])
                 actionPrc = self.vehicle.getRentPackageActionPrc(minRentPricePackage['days'])
                 money = g_itemsCache.items.stats.money
                 currency = minRentPriceValue.getCurrency()
                 price = minRentPriceValue.get(currency)
                 oldPrice = minDefaultRentPriceValue.get(currency)
                 neededValue = minRentPriceValue.get(currency) - money.get(currency)
                 neededValue = neededValue if neededValue > 0 else None
                 block.append(makePriceBlock(price, CURRENCY_SETTINGS.getRentSetting(currency), neededValue, oldPrice, actionPrc, valueWidth=self._valueWidth))
         if rentals and not self.vehicle.isPremiumIGR:
             rentFormatter = RentLeftFormatter(self.vehicle.rentInfo)
             rentLeftInfo = rentFormatter.getRentLeftStr('#tooltips:vehicle/rentLeft/%s', formatter=lambda key, countType, count, _ = None: {'left': count,
              'descr': i18n.makeString(key % countType)})
             if rentLeftInfo:
                 block.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(rentLeftInfo['descr']), value=text_styles.main(rentLeftInfo['left']), icon=ICON_TEXT_FRAMES.RENTALS, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-4, bottom=-16)))
         notEnoughMoney = neededValue > 0
         hasAction = actionPrc > 0
         return (block, notEnoughMoney or hasAction)
Esempio n. 51
0
 def _packBlocks(self, *args, **kwargs):
     self.item = self.context.buildItem(*args, **kwargs)
     items = super(FortConsumableOrderTooltipData, self)._packBlocks()
     item = self.item
     statsConfig = self.context.getStatsConfiguration(item)
     paramsConfig = self.context.getParamsConfiguration(item)
     leftPadding = 20
     rightPadding = 20
     topPadding = 20
     textGap = -2
     items.append(formatters.packBuildUpBlockData(HeaderBlockConstructor(item, statsConfig, leftPadding, rightPadding).construct(), padding=formatters.packPadding(left=leftPadding, right=rightPadding, top=topPadding)))
     items.append(formatters.packBuildUpBlockData(CommonStatsBlockConstructor(item, paramsConfig, 80, leftPadding, rightPadding).construct(), padding=formatters.packPadding(left=leftPadding, right=rightPadding), gap=textGap))
     return items
Esempio n. 52
0
 def construct(self):
     block = []
     shell = self.shell
     configuration = self.configuration
     buyPrice = configuration.buyPrice
     sellPrice = configuration.sellPrice
     if buyPrice and sellPrice:
         LOG_ERROR('You are not allowed to use buyPrice and sellPrice at the same time')
         return
     else:
         need = ZERO_MONEY
         if buyPrice:
             money = g_itemsCache.items.stats.money
             price = shell.altPrice
             need = price - money
             need = need.toNonNegative()
             defPrice = shell.defaultAltPrice or shell.defaultPrice
             block.append(makePriceBlock(price.credits, CURRENCY_SETTINGS.BUY_CREDITS_PRICE, need.credits if need.credits > 0 else None, defPrice.credits if defPrice.credits > 0 else None, percent=shell.actionPrc, valueWidth=self._valueWidth))
             if price.gold > 0:
                 block.append(formatters.packTextBlockData(text=text_styles.standard(TOOLTIPS.VEHICLE_TEXTDELIMITER_OR), padding=formatters.packPadding(left=81 + self.leftPadding)))
                 block.append(makePriceBlock(price.gold, CURRENCY_SETTINGS.BUY_GOLD_PRICE, need.gold if need.gold > 0 else None, defPrice.gold if defPrice.gold > 0 else None, percent=shell.actionPrc, valueWidth=self._valueWidth))
         if sellPrice:
             block.append(makePriceBlock(shell.sellPrice.credits, CURRENCY_SETTINGS.SELL_PRICE, oldPrice=shell.defaultSellPrice.credits, percent=shell.sellActionPrc, valueWidth=self._valueWidth))
         inventoryCount = shell.inventoryCount
         if inventoryCount:
             block.append(formatters.packTextParameterBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_INVENTORYCOUNT), value=text_styles.stats(inventoryCount), valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5)))
         notEnoughMoney = need > ZERO_MONEY
         hasAction = shell.actionPrc > 0 or shell.sellActionPrc > 0
         return (block, notEnoughMoney or hasAction)
Esempio n. 53
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)
Esempio n. 54
0
 def construct(self):
     shell = self.shell
     block = []
     title = shell.userName
     desc = '#item_types:shell/kinds/' + shell.type
     block.append(formatters.packImageTextBlockData(title=text_styles.highTitle(title), desc=text_styles.standard(desc), img=shell.icon, imgPadding=formatters.packPadding(left=7), txtGap=-4, txtOffset=100 - self.leftPadding))
     return block
Esempio n. 55
0
 def __packParameterBlock(self, name, value, measureUnits):
     return formatters.packTextParameterBlockData(name=text_styles.main(name) + text_styles.standard(measureUnits), value=text_styles.stats(value), valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5))
Esempio n. 56
0
 def construct(self):
     item = self.item
     block = []
     title = item.userName
     desc = item.getUserType()
     block.append(formatters.packImageTextBlockData(title=text_styles.highTitle(title), desc=text_styles.main(desc), img=item.icon, imgPadding=formatters.packPadding(left=12), txtGap=-4, txtOffset=100 - self.leftPadding))
     return block
Esempio n. 57
0
    def construct(self):
        block = []
        comparator = params_helper.idealCrewComparator(self.vehicle)
        stockParams = params_helper.getParameters(g_itemsCache.items.getStockVehicle(self.vehicle.intCD))
        for paramName in RELATIVE_PARAMS:
            paramInfo = comparator.getExtendedData(paramName)
            fmtValue = param_formatter.simlifiedVehicleParameter(paramInfo)
            if fmtValue is not None:
                block.append(formatters.packStatusDeltaBlockData(title=param_formatter.formatVehicleParamName(paramName), valueStr=fmtValue, statusBarData={'value': paramInfo.value,
                 'delta': 0,
                 'minValue': 0,
                 'markerValue': stockParams[paramName],
                 'maxValue': MAX_RELATIVE_VALUE,
                 'useAnim': False}, showDecreaseArrow=any((penalty[1] != 0 for penalty in paramInfo.penalties)), padding=formatters.packPadding(left=74, top=8)))

        if len(block) > 0:
            block.insert(0, formatters.packTextBlockData(text_styles.middleTitle(_ms(TOOLTIPS.VEHICLEPARAMS_SIMPLIFIED_TITLE)), padding=formatters.packPadding(top=-4)))
        return block
Esempio n. 58
0
def tooltip_add_param(self, result, param0, param1):
    result.append(formatters.packTextParameterBlockData(name=text_styles.main(param0), value=text_styles.stats(param1), valueWidth=107, padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding)))
Esempio n. 59
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
Esempio n. 60
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