Esempio n. 1
0
 def __packStatusBlock(self, status):
     statusBlock = []
     statusDyn = R.strings.ranked_battles.yearRewards.tooltip.status.dyn(
         status)
     statusStr = backport.text(statusDyn.title())
     if status in (_RBC.YEAR_REWARD_STATUS_PASSED,
                   _RBC.YEAR_REWARD_STATUS_PASSED_FINAL):
         statusStr = text_styles.warning(statusStr)
     elif status in (_RBC.YEAR_REWARD_STATUS_CURRENT,
                     _RBC.YEAR_REWARD_STATUS_CURRENT_FINAL):
         statusStr = text_styles.statInfo(statusStr)
     else:
         statusStr = text_styles.critical(statusStr)
     statusBlock.append(
         formatters.packAlignedTextBlockData(
             statusStr,
             BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=formatters.packPadding(top=-4)))
     statusBlock.append(
         formatters.packAlignedTextBlockData(
             text_styles.main(backport.text(statusDyn.description())),
             BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=formatters.packPadding(top=2, bottom=-2)))
     return formatters.packBuildUpBlockData(
         statusBlock,
         linkage=BLOCKS_TOOLTIP_TYPES.
         TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
Esempio n. 2
0
 def __packActiveState(self, time):
     state = text_styles.main(
         makeString(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_ACTIVE_VALUE,
                    time=text_styles.stats(time)))
     return formatters.packBuildUpBlockData([
         formatters.packAlignedTextBlockData(
             text_styles.statInfo(
                 TOOLTIPS.BOOSTERSWINDOW_BOOSTER_ACTIVE_TITLE),
             BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding={'bottom': 4}),
         formatters.packAlignedTextBlockData(
             state, BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
     ])
Esempio n. 3
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))
     ]
Esempio n. 4
0
 def construct(self):
     block = []
     isClanLock = self.vehicle.clanLock or None
     isDisabledInRoaming = self.vehicle.isDisabledInRoaming
     if isClanLock or isDisabledInRoaming:
         return block
     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 and len(text) > 0:
                 block.append(formatters.packTextBlockData(text=header))
                 block.append(formatters.packTextBlockData(text=text_styles.standard(text)))
             else:
                 block.append(formatters.packAlignedTextBlockData(header, BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
         return block
Esempio n. 5
0
 def construct(self):
     shell = self.shell
     block = list()
     block.append(formatters.packImageTextBlockData(title=text_styles.highTitle(shell.userName), desc=text_styles.standard('#item_types:shell/kinds/' + shell.type), img=shell.icon, imgPadding=formatters.packPadding(left=7), txtGap=-4, txtOffset=100 - self.leftPadding))
     if self._params['isBasic']:
         block.append(formatters.packAlignedTextBlockData(text=text_styles.neutral(TOOLTIPS.SHELL_BASIC), align=BLOCKS_TOOLTIP_TYPES.ALIGN_RIGHT, padding=formatters.packPadding(right=self.rightPadding, top=-25, bottom=4)))
     return block
Esempio n. 6
0
 def _packProgressStateBlock(self):
     currentLevel = self._item.getLatestOpenedProgressionLevel(
         self.__vehicle)
     if currentLevel == -1 and self._progressionLevel == 1:
         currentLevel = 0
     if self._progressionLevel < 1:
         return None
     else:
         if currentLevel >= self._progressionLevel:
             desc = text_styles.concatStylesToSingleLine(
                 icons.checkmark(),
                 text_styles.bonusAppliedText(
                     getProgressionItemStatusText(self._progressionLevel)))
         elif currentLevel + 1 == self._progressionLevel:
             desc = text_styles.concatStylesToSingleLine(
                 icons.inProgress(),
                 text_styles.neutral(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.inProgressState())))
         else:
             desc = text_styles.concatStylesToSingleLine(
                 icons.markerBlocked(),
                 text_styles.error(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.notAvailableState.title())))
             desc = text_styles.concatStylesToMultiLine(
                 desc,
                 text_styles.main(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.notAvailableState.desc())))
         return formatters.packAlignedTextBlockData(
             text=desc, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
Esempio n. 7
0
 def _packBlocks(self, *args, **kwargs):
     self.__isReceived = bool(args[1])
     items = super(NyDecorationWithStatusTooltipData,
                   self)._packBlocks(*args, **kwargs)
     if self.__isReceived:
         statusText = text_styles.concatStylesWithSpace(
             icons.makeImageTag(RES_ICONS.MAPS_ICONS_NY_ICONS_CHECK,
                                width=24,
                                height=24,
                                vSpace=-6,
                                hSpace=-2),
             text_styles.statInfo(
                 NY.COLLECTIONS_TOOLTIP_DECORATION_OBTAINED))
         statusPadding = formatters.packPadding(left=4, top=-12, bottom=-14)
     else:
         statusText = text_styles.concatStylesWithSpace(
             text_styles.critical(
                 NY.COLLECTIONS_TOOLTIP_DECORATION_NOTOBTAINED))
         statusPadding = formatters.packPadding(left=16, top=-8, bottom=-10)
     bottomBuildUpBlock = [
         formatters.packAlignedTextBlockData(
             text=statusText,
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=statusPadding)
     ]
     items.append(formatters.packBuildUpBlockData(bottomBuildUpBlock))
     return items
Esempio n. 8
0
 def _getStatusBlock(self, operation):
     _, postpone = missions_helper.getPostponedOperationState(
         operation.getID())
     return formatters.packBuildUpBlockData([
         formatters.packAlignedTextBlockData(
             text=text_styles.concatStylesWithSpace(
                 icons.markerBlocked(-2),
                 text_styles.error(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE)),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=formatters.packPadding(top=-5)),
         formatters.
         packAlignedTextBlockData(text=text_styles.concatStylesToSingleLine(
             text_styles.main(
                 TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_POSTPONED
             ),
             icons.makeImageTag(RES_ICONS.getPersonalMissionOperationState(
                 PERSONAL_MISSIONS_ALIASES.OPERATION_POSTPONED_STATE),
                                width=24,
                                height=24,
                                vSpace=-9),
             text_styles.vehicleStatusCriticalText(postpone)),
                                  align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                                  padding=formatters.packPadding(bottom=14))
     ])
 def _packBlocks(self, operationID, vehicleType):
     pmController = dependency.instance(IEventsCache).personalMissions
     operation = pmController.getOperations()[operationID]
     chainID, _ = operation.getChainByVehicleType(vehicleType)
     finalQuest = operation.getFinalQuests()[chainID]
     bonus = findFirst(lambda q: q.getName() == 'completionTokens',
                       finalQuest.getBonuses('tokens'))
     formattedBonus = first(CompletionTokensBonusFormatter().format(bonus))
     operationTitle = str(operation.getVehicleBonus().userName).replace(
         ' ', '&nbsp;')
     if finalQuest.isCompleted():
         statusText = self.__getObtainedStatus()
     elif pmController.mayPawnQuest(finalQuest):
         statusText = self.__getAvailableStatus(finalQuest.getPawnCost())
     else:
         statusText = self.__getNotObtainedStatus()
     vehIcon = RES_ICONS.vehicleTypeInactiveOutline(vehicleType)
     blocks = [
         formatters.packImageTextBlockData(
             title=text_styles.highTitle(formattedBonus.userName),
             desc=text_styles.standard(
                 _ms(PERSONAL_MISSIONS.OPERATIONTITLE_TITLE,
                     title=operationTitle)),
             img=formattedBonus.getImage(AWARDS_SIZES.BIG),
             imgPadding=formatters.packPadding(right=20),
             txtPadding=formatters.packPadding(top=10)),
         formatters.packBuildUpBlockData(
             [
                 formatters.packImageTextBlockData(
                     title=text_styles.main(
                         _ms(PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_INFO,
                             vehName=text_styles.neutral(operationTitle))),
                     img=RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED,
                     imgPadding=formatters.packPadding(
                         left=8, right=10, top=2))
             ],
             linkage=BLOCKS_TOOLTIP_TYPES.
             TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
             padding=formatters.packPadding(top=-7, bottom=-3))
     ]
     if not finalQuest.isCompleted():
         blocks.append(
             formatters.packBuildUpBlockData([
                 formatters.packTextBlockData(text_styles.middleTitle(
                     PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_HELP_TITLE),
                                              padding=formatters.
                                              packPadding(bottom=4)),
                 formatters.packImageTextBlockData(title=text_styles.main(
                     _ms(PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_HELP_BODY,
                         vehType=_ms(
                             PERSONAL_MISSIONS.chainNameByVehicleType(
                                 vehicleType)))),
                                                   img=vehIcon,
                                                   imgPadding=formatters.
                                                   packPadding(right=2))
             ]))
     blocks.append(
         formatters.packAlignedTextBlockData(
             text=statusText, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
     return blocks
Esempio n. 10
0
 def __getCurrentMaxProgress(self, playerLevel, playerFamePts):
     items = []
     famePtsToProgress = self.getPointsProgressForLevel(playerLevel)
     currentPoint = text_styles.stats(str(playerFamePts))
     fameTo = text_styles.main(str(famePtsToProgress))
     currentPointMaxPoint = text_styles.concatStylesWithSpace(
         currentPoint, text_styles.main('/'), fameTo)
     text = text_styles.main(currentPointMaxPoint)
     marginTop = 7
     icon = None
     if self.isFrontLine:
         marginTop = 0
         iconSrc = backport.image(
             R.images.gui.maps.icons.epicBattles.fame_point_tiny())
         icon = icons.makeImageTag(source=iconSrc, width=24, height=24)
     elif self.isSteelHunter:
         marginTop = 6
         iconSrc = backport.image(
             R.images.gui.maps.icons.battleRoyale.progression_point())
         icon = icons.makeImageTag(source=iconSrc, width=16, height=16)
     if icon is not None:
         text = text_styles.concatStylesWithSpace(text, icon)
     items.append(
         formatters.packAlignedTextBlockData(
             text=text,
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_RIGHT,
             padding=formatters.packPadding(left=20, right=20, top=-35)))
     return formatters.packBuildUpBlockData(
         items, padding=formatters.packPadding(top=marginTop))
Esempio n. 11
0
 def construct(self):
     block = []
     isClanLock = self.vehicle.clanLock or None
     isDisabledInRoaming = self.vehicle.isDisabledInRoaming
     if isClanLock or isDisabledInRoaming:
         return block
     else:
         if self.configuration.node is not None:
             result = self.__getTechTreeVehicleStatus(self.configuration, self.vehicle)
         elif self.configuration.isAwardWindow:
             result = None
         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:
                 block.append(formatters.packTextBlockData(text=header))
                 block.append(formatters.packTextBlockData(text=text_styles.standard(text)))
             else:
                 block.append(formatters.packAlignedTextBlockData(header, BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
         return block
Esempio n. 12
0
 def __buildStatusBlock(self):
     if self.__isForVehicleRank():
         maxRank = self.rankedController.getMaxRank(
             vehicle=self.item.getVehicle())
         achievedCount = '0'
         if maxRank is not None and maxRank.getType() == RANK_TYPES.VEHICLE:
             achievedCount = maxRank.getSerialID()
         vehicleName = self.item.getVehicle().userName
         achievedStr = text_styles.middleTitle(achievedCount)
         descr = text_styles.main(
             _ms(TOOLTIPS.BATTLETYPES_RANKED_VEHRANK_ACHIEVEDCOUNT,
                 vehName=vehicleName))
         descr = descr + achievedStr
         return formatters.packCounterTextBlockData(
             achievedCount,
             descr,
             padding=formatters.packPadding(left=3, bottom=-5))
     else:
         if self.item.isAcquired():
             status = text_styles.statInfo(
                 TOOLTIPS.BATTLETYPES_RANKED_RANK_STATUS_RECEIVED)
         elif self.item.isLost():
             status = text_styles.statusAlert(
                 TOOLTIPS.BATTLETYPES_RANKED_RANK_STATUS_LOST)
         else:
             status = text_styles.warning(
                 TOOLTIPS.BATTLETYPES_RANKED_RANK_STATUS_NOTEARNED)
         return formatters.packAlignedTextBlockData(
             status,
             BLOCKS_TOOLTIP_TYPES.ALIGN_LEFT,
             padding=formatters.packPadding(top=-4))
 def _packBlocks(self, *args):
     tooltipBlocks = super(ReserveTooltipData, self)._packBlocks()
     reserves = self._getData().getReserve()
     isPlayerLegionary = self._getEntity().getPlayerInfo().isLegionary()
     reserveId = args[0]
     reserve = reserves.getReserveById(reserveId)
     reserveName = getReserveNameVO(reserve.getType())
     reserveLevel = reserve.getLevel()
     selected = reserve in reserves.getSelectedReserves()
     reserveCount = reserves.getReserveCount(reserve.getType(),
                                             reserve.getLevel())
     if selected:
         reserveCount -= 1
     if reserve.intCD is None:
         _logger.error('%s intCD is None! Check wgsh version on staging.',
                       reserveName)
         return tooltipBlocks
     else:
         item = self.context.buildItem(reserve.intCD)
         tooltipBlocks.append(
             self.__getHeaderBlock(item, reserveName, reserveLevel,
                                   reserveCount, isPlayerLegionary))
         tooltipBlocks.append(
             formatters.packBuildUpBlockData(
                 self.__getMainParamsBlock(reserveName, item),
                 padding=formatters.packPadding(left=10,
                                                right=10,
                                                top=-4,
                                                bottom=-2),
                 linkage=BLOCKS_TOOLTIP_TYPES.
                 TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
                 gap=-2,
                 blockWidth=450))
         tooltipBlocks.append(
             formatters.packBuildUpBlockData(
                 self.__getAdditionalParamsBlock(reserve),
                 padding=formatters.packPadding(left=10,
                                                right=10,
                                                top=-4,
                                                bottom=-2),
                 gap=-2))
         if selected:
             status = R.strings.fortifications.reserves.tooltip.selected()
         else:
             status = R.strings.fortifications.reserves.tooltip.readyToSelect(
             )
         tooltipBlocks.append(
             formatters.packAlignedTextBlockData(
                 text_styles.statInfo(backport.text(status)),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 blockWidth=430,
                 padding=formatters.packPadding(left=10,
                                                right=10,
                                                top=-7,
                                                bottom=-7)))
         return tooltipBlocks
Esempio n. 14
0
 def __packQuestReward(self, bonus):
     if bonus.label.startswith('x'):
         align = BLOCKS_TOOLTIP_TYPES.ALIGN_RIGHT
         padding = formatters.packPadding(top=-16, right=12)
     else:
         align = BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER
         padding = formatters.packPadding(top=-16)
     iconBlock = formatters.packImageBlockData(img=bonus.getImage(AWARDS_SIZES.SMALL), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
     textBlock = formatters.packAlignedTextBlockData(text=bonus.getFormattedLabel(), align=align, padding=padding)
     return formatters.packBuildUpBlockData(blocks=[iconBlock, textBlock], blockWidth=72, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(top=-8, bottom=-6))
 def __getCurrentMaxProgressBlock(playerFamePts, famePtsToProgress):
     items = []
     currentPoint = text_styles.stats(str(playerFamePts))
     fameTo = text_styles.main(str(famePtsToProgress))
     currentPointMaxPoint = text_styles.concatStylesWithSpace(currentPoint, text_styles.main('/'), fameTo)
     marginTop = 0
     iconSrc = backport.image(R.images.gui.maps.icons.epicBattles.fame_point_tiny())
     text = text_styles.concatStylesWithSpace(text_styles.main(currentPointMaxPoint), icons.makeImageTag(source=iconSrc, width=24, height=24))
     items.append(formatters.packAlignedTextBlockData(text=text, align=BLOCKS_TOOLTIP_TYPES.ALIGN_RIGHT, padding=formatters.packPadding(left=20, right=20, top=-35)))
     return formatters.packBuildUpBlockData(items, padding=formatters.packPadding(top=marginTop, right=20))
Esempio n. 16
0
 def _getStatusBlock(cls, quest):
     isAvailable, reason = quest.isAvailable()
     if not isAvailable:
         if reason == 'noVehicle':
             key = TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_NOVEHICLE
         else:
             key = TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_NOTAVAILABLE
         text = text_styles.concatStylesWithSpace(icons.markerBlocked(-2),
                                                  text_styles.error(key))
     elif quest.isInProgress():
         if quest.isOnPause:
             text = text_styles.concatStylesWithSpace(
                 icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ONPAUSE,
                                    16, 16, -3, 8),
                 text_styles.playerOnline(
                     TOOLTIPS.
                     PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_ONPAUSE))
         elif quest.areTokensPawned():
             label = _ms(
                 TOOLTIPS.
                 PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_SHEETRECOVERYINPROGRESS,
                 icon=missions_helper.getHtmlAwardSheetIcon(
                     quest.getQuestBranch()),
                 count=quest.getPawnCost())
             text = text_styles.concatStylesWithSpace(
                 icons.inProgress(-1), text_styles.neutral(label))
         else:
             text = text_styles.concatStylesWithSpace(
                 icons.inProgress(-1),
                 text_styles.neutral(
                     TOOLTIPS.
                     PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_INPROGRESS))
     elif quest.isCompleted():
         if quest.areTokensPawned():
             text = text_styles.concatStylesWithSpace(
                 icons.checkmark(-2),
                 text_styles.bonusAppliedText(
                     TOOLTIPS.
                     PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_DONEFREESHEET),
                 missions_helper.getHtmlAwardSheetIcon(
                     quest.getQuestBranch()),
                 text_styles.stats('x%s' % quest.getPawnCost()))
         else:
             text = text_styles.concatStylesWithSpace(
                 icons.checkmark(-2),
                 text_styles.bonusAppliedText(
                     TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_DONE))
     else:
         text = text_styles.main(
             TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_AVAILABLE)
     return formatters.packAlignedTextBlockData(
         text=text,
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         padding=formatters.packPadding(top=-5, bottom=-5))
 def __packTotalProgressionBlock(self, progressionData):
     progress = progressionData.totalBattles
     total = max(progressionData.rewards)
     items = []
     progressStyle = text_styles.bonusAppliedText if progress >= total else text_styles.bonusPreviewText
     progressionCounter = []
     progressionCounter.append(
         formatters.packTextBlockData(
             text_styles.stats(
                 backport.text(R.strings.mapbox.questFlag.progressTitle())),
             blockWidth=250,
             padding=formatters.packPadding(left=18)))
     progressionCounter.append(
         formatters.packAlignedTextBlockData(
             backport.text(R.strings.mapbox.questFlag.counter(),
                           progress=progressStyle(min(progress, total)),
                           total=text_styles.main(total)),
             blockWidth=85,
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_RIGHT))
     items.append(
         formatters.packBuildUpBlockData(
             progressionCounter,
             layout=BLOCKS_TOOLTIP_TYPES.LAYOUT_HORIZONTAL))
     items.append(
         formatters.packBlockDataItem(linkage=BLOCKS_TOOLTIP_TYPES.
                                      TOOLTIP_EPIC_PROGRESS_BLOCK_LINKAGE,
                                      data={
                                          'value': min(progress, total),
                                          'maxValue': total,
                                          'isGreen': progress >= total
                                      },
                                      blockWidth=330,
                                      padding=formatters.packPadding(
                                          top=-11, bottom=8, left=20)))
     if progress < total:
         items.append(
             formatters.packTextBlockData(text_styles.main(
                 backport.text(
                     R.strings.mapbox.questFlag.incomplete(),
                     count=text_styles.stats(
                         min([
                             battles
                             for battles in progressionData.rewards.keys()
                             if battles > progress
                         ]) - progress))),
                                          padding=formatters.packPadding(
                                              left=18)))
     else:
         items.append(
             formatters.packTextBlockData(
                 text_styles.main(
                     backport.text(R.strings.mapbox.questFlag.complete())),
                 padding=formatters.packPadding(left=18)))
     return items
Esempio n. 18
0
 def __getEventProgressionOverrides(self):
     _, level, _ = self.__eventProgressionController.getPlayerLevelInfo()
     maxLevel = self.__eventProgressionController.getMaxPlayerLevel()
     if level < maxLevel:
         msg = backport.text(R.strings.event_progression.questsTooltip.
                             frontLine.notReachLevel(),
                             level=maxLevel)
         return formatters.packAlignedTextBlockData(
             text=text_styles.main(msg),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=formatters.packPadding(top=5))
     else:
         return None
 def _getImageWithBottomTitleBlock(imagePath,
                                   imageTitle,
                                   blockPadding=None):
     titleBlock = formatters.packAlignedTextBlockData(
         text=text_styles.stats(imageTitle),
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         padding=formatters.packPadding(top=-5))
     imageBlock = formatters.packImageBlockData(
         img=imagePath, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
     return formatters.packBuildUpBlockData(
         blocks=[imageBlock, titleBlock],
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         blockWidth=140,
         padding=blockPadding)
 def __getDisabledStatusBlock(self):
     nationID = nations.INDICES.get(self.__nationName)
     align = BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER
     if helper.isAllCollectionPurchased(nationID):
         block = formatters.packAlignedTextBlockData(
             text=text_styles.middleTitle(
                 backport.text(R.strings.tooltips.collectibleVehicleTooltip.
                               status.purchased())),
             align=align)
     else:
         maxUnlockedLevel = self.__itemsCache.items.stats.getMaxResearchedLevelByNations(
         ).get(nationID, MIN_VEHICLE_LEVEL)
         vehicleLevels = getCache()['collectorVehiclesLevelsByNations'].get(
             nationID, set())
         if not vehicleLevels:
             raise SoftException(
                 'There are not collectible vehicles in the nation tree of {}'
                 .format(self.__nationName))
         if min(vehicleLevels) <= maxUnlockedLevel:
             header = R.strings.tooltips.collectibleVehicleTooltip.status.purchaseAvailable(
             )
             text = R.strings.tooltips.collectibleVehicleTooltip.status.condition(
             )
             styleGetter = text_styles.middleTitle
         else:
             header = R.strings.tooltips.collectibleVehicleTooltip.status.purchaseUnavailable(
             )
             text = R.strings.tooltips.collectibleVehicleTooltip.status.condition(
             )
             styleGetter = text_styles.statusAttention
         block = formatters.packAlignedTextBlockData(
             text=text_styles.concatStylesToMultiLine(
                 styleGetter(backport.text(header)),
                 text_styles.main(backport.text(text))),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
     return formatters.packBuildUpBlockData(
         blocks=[block], padding=formatters.packPadding(top=5))
 def __packStatusBlock(self):
     result = []
     if self.item.isAcquired():
         status = text_styles.statInfo(backport.text(R.strings.tooltips.battleTypes.ranked.rank.status.received()))
     elif self.item.isLost():
         status = text_styles.statusAlert(backport.text(R.strings.tooltips.battleTypes.ranked.rank.status.lost()))
     else:
         status = text_styles.warning(backport.text(R.strings.tooltips.battleTypes.ranked.rank.status.notearned()))
     result.append(formatters.packAlignedTextBlockData(status, BLOCKS_TOOLTIP_TYPES.ALIGN_LEFT, padding=formatters.packPadding(top=-4)))
     division = self.item.getDivision()
     if not division.isCurrent() and not division.isCompleted():
         result.append(formatters.packTextBlockData(text_styles.main(backport.text(R.strings.tooltips.battleTypes.ranked.rank.anotherDivision(), division=division.getUserName()))))
     if not self.item.isAcquired():
         result.append(formatters.packTextBlockData(self.__packStepsBlock()))
     return result
 def _packConvertDescrBlock(self, vehicleName, nationName):
     descriptionBlock = formatters.packTextBlockData(text=text_styles.main(
         TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_FRAGMENTSCONVERT))
     orTextObject = formatters.packAlignedTextBlockData(
         text=text_styles.main(
             TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_OR),
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
     orTextBlock = formatters.packBuildUpBlockData(
         blocks=[orTextObject],
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         blockWidth=140,
         padding=formatters.packPadding(top=43))
     vehicleBlock = self._getImageWithBottomTitleBlock(
         RES_ICONS.MAPS_ICONS_BLUEPRINTS_TOOLTIP_FRAGMENTRIBBON,
         vehicleName)
     internBlock = self._getImageWithBottomTitleBlock(
         RES_ICONS.MAPS_ICONS_BLUEPRINTS_FRAGMENT_MEDIUM_INTELLIGENCE,
         TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_INTERNATIONALS,
         formatters.packPadding(right=-70))
     nationBlock = self._getImageWithBottomTitleBlock(
         RES_ICONS.getBlueprintFragment('medium', nationName),
         TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_NATIONALS,
         formatters.packPadding(left=-70))
     arrowLeft = formatters.packImageBlockData(
         img=RES_ICONS.MAPS_ICONS_BLUEPRINTS_TOOLTIP_ARROW_LEFT,
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         padding=formatters.packPadding(top=20, right=-30))
     arrowRight = formatters.packImageBlockData(
         img=RES_ICONS.MAPS_ICONS_BLUEPRINTS_TOOLTIP_ARROW_RIGHT,
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         padding=formatters.packPadding(top=20, left=-30))
     middleBlock = formatters.packBuildUpBlockData(
         blocks=[arrowLeft, vehicleBlock, arrowRight],
         gap=1,
         layout=BLOCKS_TOOLTIP_TYPES.LAYOUT_HORIZONTAL,
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
     sideBlock = formatters.packBuildUpBlockData(
         blocks=[internBlock, orTextBlock, nationBlock],
         layout=BLOCKS_TOOLTIP_TYPES.LAYOUT_HORIZONTAL,
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         padding=formatters.packPadding(left=10, right=10, top=-35))
     formulaBlock = formatters.packBuildUpBlockData(
         blocks=[middleBlock, sideBlock],
         gap=0,
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
     return formatters.packBuildUpBlockData(
         blocks=[descriptionBlock, formulaBlock],
         padding=formatters.packPadding(bottom=-20))
    def _packBlocks(self, itemCD, itemStatus):
        items = super(BattleOptDeviceTooltipData, self)._packBlocks()
        _, _, deviceID = vehicles.parseIntCompactDescr(itemCD)
        itemInBattle = self.guiSessionProvider.shared.optionalDevices.getOptDeviceInBattle(
            deviceID)
        if not itemInBattle:
            return items
        descriptor = itemInBattle.getDescriptor()
        leftPadding = 20
        rightPadding = 20
        topPadding = 20
        battleDescr = R.strings.artefacts.dyn(
            descriptor.groupName).battle_descr
        if battleDescr:
            desc = backport.text(battleDescr())
        else:
            desc = descriptor.shortDescriptionSpecial.format(colorTagOpen='',
                                                             colorTagClose='')
        items.append(
            formatters.packBuildUpBlockData([
                formatters.packTitleDescBlock(
                    title=text_styles.middleTitle(
                        backport.text(
                            R.strings.artefacts.dyn(
                                descriptor.tierlessName).name())),
                    desc=text_styles.main(desc),
                    padding=formatters.packPadding(bottom=-10))
            ],
                                            padding=formatters.packPadding(
                                                left=leftPadding,
                                                right=rightPadding,
                                                top=topPadding)))
        battleStatuses = itemInBattle.getBattleStatus()
        for ind, statusStr in enumerate(battleStatuses):
            items.append(
                formatters.packBuildUpBlockData([
                    formatters.packAlignedTextBlockData(
                        text=statusStr,
                        align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                        padding=formatters.packPadding(
                            bottom=-26 if ind +
                            1 != len(battleStatuses) else -10))
                ]))

        return items
Esempio n. 24
0
    def _packBlocks(self, *args, **kwargs):
        items = super(TankmanTooltipDataBlock, self)._packBlocks()
        item = self.context.buildItem(*args, **kwargs)
        self.item = item
        vehicle = None
        nativeVehicle = self._itemsCache.items.getItemByCD(item.vehicleNativeDescr.type.compactDescr)
        if item.isInTank:
            vehicle = self._itemsCache.items.getVehicle(item.vehicleInvID)
        fullUserName = self._getFullUserName(item)
        items.append(formatters.packImageTextBlockData(title=text_styles.highTitle(fullUserName), desc=text_styles.main(self._getTankmanDescription(item))))
        innerBlock = []
        if vehicle:
            self._createLabel(innerBlock)
            self._createVehicleBlock(innerBlock, vehicle)
        if innerBlock:
            items.append(formatters.packBuildUpBlockData(innerBlock, padding=formatters.packPadding(left=0, right=50, top=-5, bottom=0), linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
        commonStatsBlock = [formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'grayTitle', {'message': makeString(TOOLTIPS.HANGAR_CREW_SPECIALTY_SKILLS)}))]
        penalty = self._getBonusValue(item, [TankmanRoleBonusesField.BONUSES.PENALTY])
        addition = self._getBonusValue(item, [TankmanRoleBonusesField.BONUSES.COMMANDER,
         TankmanRoleBonusesField.BONUSES.EQUIPMENTS,
         TankmanRoleBonusesField.BONUSES.DEVICES,
         TankmanRoleBonusesField.BONUSES.BROTHERHOOD])
        addition_ = '' if addition == 0 else self._getSign(addition) + str(addition)
        penalty_ = '' if penalty == 0 else self._getSign(penalty) + str(penalty)
        if penalty != 0 or addition != 0:
            addRoleLevels = ' (' + str(item.roleLevel) + addition_ + penalty_ + ')'
        else:
            addRoleLevels = ''
        vehicleName = self._getVehicleName(vehicle, nativeVehicle)
        commonStatsBlock.append(formatters.packTextParameterBlockData(text_styles.main(item.roleUserName + ' ') + vehicleName, text_styles.stats(str(item.roleLevel + penalty + addition) + '%' + addRoleLevels), valueWidth=90, padding=formatters.packPadding(left=0, right=0, top=5, bottom=0)))
        field = self._getSkillList()
        _, value = field.buildData()
        skills = value or []
        maxPopUpBlocks = 14
        for skill in skills[:maxPopUpBlocks]:
            commonStatsBlock.append(formatters.packTextParameterBlockData(text_styles.main(skill['label']), text_styles.stats(str(skill['level']) + '%'), valueWidth=90))

        if len(skills) > maxPopUpBlocks:
            diff = str(len(skills) - maxPopUpBlocks)
            commonStatsBlock.append(formatters.packAlignedTextBlockData(text=text_styles.middleTitle(makeString(TOOLTIPS.HANGAR_CREW_MORESKILLS, skill_cnt=diff)), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
        items.append(formatters.packBuildUpBlockData(commonStatsBlock, gap=5))
        self._createBlockForNewSkills(items)
        self._createMoreInfoBlock(items)
        return items
Esempio n. 25
0
 def _getStatusBlock(self, operation):
     if not operation.isUnlocked():
         block = formatters.packBuildUpBlockData([formatters.packAlignedTextBlockData(text=text_styles.concatStylesWithSpace(icons.markerBlocked(-2), text_styles.error(TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE)), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(top=-5)), formatters.packAlignedTextBlockData(text=text_styles.main(TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_DOPREVOPERATION), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(bottom=14))])
     elif operation.isFullCompleted():
         block = formatters.packAlignedTextBlockData(text=text_styles.concatStylesWithSpace(icons.doubleCheckmark(1), text_styles.bonusAppliedText(TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_TITLE_EXCELLENTDONE)), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(top=-5, bottom=12))
     elif operation.isAwardAchieved():
         data = [formatters.packAlignedTextBlockData(text=text_styles.concatStylesWithSpace(icons.checkmark(-2), text_styles.bonusAppliedText(TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_TITLE_DONE)), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(top=-5))]
         currentCount = operation.getFreeTokensCount()
         totalCount = operation.getFreeTokensTotalCount()
         if currentCount < totalCount:
             data.append(formatters.packAlignedTextBlockData(text=text_styles.concatStylesToSingleLine(text_styles.main(TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_FREESHEETS), missions_helper.AWARD_SHEET_ICON, text_styles.bonusAppliedText(currentCount), text_styles.main(' / %s' % totalCount)), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(bottom=14)))
         else:
             currentCount = len(operation.getFullCompletedQuests(True))
             totalCount = operation.getQuestsCount()
             data.append(formatters.packAlignedTextBlockData(text=text_styles.concatStylesToSingleLine(text_styles.main(TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_QUESTSFULLYDONE), text_styles.bonusAppliedText(currentCount), text_styles.main(' / %s' % totalCount)), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(bottom=14)))
         block = formatters.packBuildUpBlockData(data)
     elif operation.isInProgress():
         currentCount, totalCount = operation.getTokensCount()
         block = formatters.packBuildUpBlockData([formatters.packAlignedTextBlockData(text=text_styles.concatStylesWithSpace(icons.inProgress(-1), text_styles.neutral(TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_TITLE_INPROGRESS)), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(top=-5)), formatters.packAlignedTextBlockData(text=text_styles.concatStylesToSingleLine(text_styles.main(TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_COMPLETIONTOKENS), text_styles.bonusAppliedText(currentCount), text_styles.main(' / %s' % totalCount)), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(bottom=14))])
     elif not operation.hasRequiredVehicles():
         block = formatters.packBuildUpBlockData([formatters.packAlignedTextBlockData(text=text_styles.concatStylesWithSpace(icons.markerBlocked(-2), text_styles.error(TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE)), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(top=-5)), formatters.packAlignedTextBlockData(text=text_styles.main(TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_NOVEHICLE), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(bottom=14))])
     else:
         block = formatters.packBuildUpBlockData([formatters.packAlignedTextBlockData(text=text_styles.stats(TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_TITLE_AVAILABLE), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(top=-5)), formatters.packAlignedTextBlockData(text=text_styles.main(TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_SELECTQUEST), align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(bottom=14))])
     return block
Esempio n. 26
0
 def __buildStatusBlock(self):
     if self.__isForCurrentVehicleRank():
         achievedCount = self.item.getSerialID()
         vehicleName = self.item.getVehicle().userName
         achievedStr = text_styles.middleTitle(achievedCount)
         descr = text_styles.main(
             _ms(TOOLTIPS.BATTLETYPES_RANKED_VEHRANK_ACHIEVEDCOUNT,
                 vehName=vehicleName))
         descr = descr + achievedStr
         return formatters.packCounterTextBlockData(
             achievedCount, descr, padding=formatters.packPadding(left=3))
     if self.item.isAcquired():
         status = text_styles.statInfo(
             TOOLTIPS.BATTLETYPES_RANKED_RANK_STATUS_RECEIVED)
     elif self.item.isLost():
         status = text_styles.statusAlert(
             TOOLTIPS.BATTLETYPES_RANKED_RANK_STATUS_LOST)
     else:
         status = text_styles.warning(
             TOOLTIPS.BATTLETYPES_RANKED_RANK_STATUS_NOTEARNED)
     return formatters.packAlignedTextBlockData(
         status,
         BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         padding=formatters.packPadding(top=-4))
 def __packActiveState(self, time):
     state = _ts.statInfo(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_ACTIVE_TITLE)
     timeLeft = _ts.main(_ms(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_ACTIVE_VALUE, time=_ts.stats(time)))
     return formatters.packBuildUpBlockData([formatters.packTitleDescParameterWithIconBlockData(title=state, icon=RES_ICONS.MAPS_ICONS_TOOLTIP_ACTIVEICON, padding=formatters.packPadding(left=93), titlePadding=formatters.packPadding(), iconPadding=formatters.packPadding(top=2, left=-2)), formatters.packAlignedTextBlockData(text=timeLeft, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)])
Esempio n. 28
0
    def _packBlocks(self, *args, **kwargs):
        items = super(TankmanTooltipDataBlock, self)._packBlocks()
        item = self.context.buildItem(*args, **kwargs)
        self.item = item
        vehicle = None
        nativeVehicle = self.itemsCache.items.getItemByCD(
            item.vehicleNativeDescr.type.compactDescr)
        if item.isInTank:
            vehicle = self.itemsCache.items.getVehicle(item.vehicleInvID)
        items.append(
            formatters.packImageTextBlockData(
                title=text_styles.highTitle(item.fullUserName),
                desc=text_styles.main(item.rankUserName)))
        innerBlock = []
        if vehicle:
            innerBlock.append(
                formatters.packTextBlockData(text=makeHtmlString(
                    'html_templates:lobby/textStyle', 'grayTitle',
                    {'message': makeString(TOOLTIPS.HANGAR_CREW_ASSIGNEDTO)})))
            innerBlock.append(
                formatters.packImageTextBlockData(
                    img=vehicle.iconContour,
                    txtGap=-4,
                    padding=formatters.packPadding(bottom=0, top=10, left=0),
                    title=text_styles.stats(vehicle.shortUserName),
                    desc=text_styles.stats('#menu:header/vehicleType/%s' %
                                           vehicle.type),
                    flipHorizontal=True))
        if innerBlock:
            items.append(
                formatters.packBuildUpBlockData(
                    innerBlock,
                    padding=formatters.packPadding(left=0,
                                                   right=50,
                                                   top=-5,
                                                   bottom=0),
                    linkage=BLOCKS_TOOLTIP_TYPES.
                    TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
        commonStatsBlock = [
            formatters.packTextBlockData(text=makeHtmlString(
                'html_templates:lobby/textStyle', 'grayTitle',
                {'message': makeString(TOOLTIPS.HANGAR_CREW_SPECIALTY_SKILLS)})
                                         )
        ]
        penalty = self._getBonusValue(
            item, [TankmanRoleBonusesField.BONUSES.PENALTY])
        addition = self._getBonusValue(item, [
            TankmanRoleBonusesField.BONUSES.COMMANDER,
            TankmanRoleBonusesField.BONUSES.EQUIPMENTS,
            TankmanRoleBonusesField.BONUSES.DEVICES,
            TankmanRoleBonusesField.BONUSES.BROTHERHOOD
        ])
        addition_ = '' if addition == 0 else self._getSign(addition) + str(
            addition)
        penalty_ = '' if penalty == 0 else self._getSign(penalty) + str(
            penalty)
        if penalty != 0 or addition != 0:
            addRoleLevels = ' (' + str(
                item.roleLevel) + addition_ + penalty_ + ')'
        else:
            addRoleLevels = ''
        if not vehicle or nativeVehicle.shortUserName == vehicle.shortUserName:
            vehicleName = text_styles.main(nativeVehicle.shortUserName)
        else:
            vehicleName = text_styles.critical(nativeVehicle.shortUserName)
        commonStatsBlock.append(
            formatters.packTextParameterBlockData(
                text_styles.main(item.roleUserName + ' ') + vehicleName,
                text_styles.stats(
                    str(item.roleLevel + penalty + addition) + '%' +
                    addRoleLevels),
                valueWidth=90,
                padding=formatters.packPadding(left=0,
                                               right=0,
                                               top=5,
                                               bottom=0)))
        field = TankmanSkillListField(self, 'skills')
        _, value = field.buildData()
        skills = value or []
        maxPopUpBlocks = 14
        for skill in skills[:maxPopUpBlocks]:
            commonStatsBlock.append(
                formatters.packTextParameterBlockData(
                    text_styles.main(skill['label']),
                    text_styles.stats(str(skill['level']) + '%'),
                    valueWidth=90))

        if len(skills) > maxPopUpBlocks:
            diff = str(len(skills) - maxPopUpBlocks)
            commonStatsBlock.append(
                formatters.packAlignedTextBlockData(
                    text=text_styles.middleTitle(
                        makeString(TOOLTIPS.HANGAR_CREW_MORESKILLS,
                                   skill_cnt=diff)),
                    align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
        items.append(formatters.packBuildUpBlockData(commonStatsBlock, gap=5))
        field = TankmanNewSkillCountField(self, '')
        _, newSkillCount = field.buildData()
        if newSkillCount > 0:
            items.append(
                formatters.packImageTextBlockData(
                    img='../maps/icons/tankmen/skills/small/new_skill.png',
                    txtOffset=20,
                    padding=formatters.packPadding(bottom=0, top=5, left=0),
                    imgPadding=formatters.packPadding(left=0, top=3),
                    title=makeHtmlString(
                        'html_templates:lobby/textStyle', 'goldTextTitle', {
                            'message':
                            makeString(TOOLTIPS.
                                       HANGAR_CREW_NEW_SKILL_AVAILABLE_HEADER)
                        }),
                    desc=makeHtmlString(
                        'html_templates:lobby/textStyle', 'goldTextField', {
                            'message':
                            makeString(
                                TOOLTIPS.HANGAR_CREW_NEW_SKILL_AVAILABLE_TEXT)
                        })))
        field = TankmanStatusField(self, '')
        _, value = field.buildData()
        status = value or {}
        if 'header' in status and status['header'] != '':
            items.append(
                formatters.packImageTextBlockData(
                    title=text_styles.warning(status['header']),
                    desc=makeHtmlString('html_templates:lobby/textStyle',
                                        'statusWarningField',
                                        {'message': status['text']})))
        return items
Esempio n. 29
0
    def _buildBlocks(self, setting):
        nyLevel, _, _, _ = self._newYearController.getProgress()
        nationId = NATIONAL_SETTINGS_IDS_BY_NAME[setting]
        collectionLevel = self._newYearController.getCollectionLevelForNation(
            nationId)
        bonus = COLLECTION_BONUSES_BY_LEVEL[collectionLevel - 1].xp
        calculatingLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_NY_COLLECTION_BONUS_CALCULATING_LINKAGE
        calculatingData = {
            'celebrationTitle':
            NY.COLLECTIONS_TOOLTIP_BONUS_CELEBRATION_LEVEL_TITLE,
            'celebrationValue':
            str(nyLevel),
            'bonusTitle':
            NY.COLLECTIONS_TOOLTIP_BONUS_CELEBRATION_TITLE,
            'bonusValue':
            '{}%'.format(BigWorld.wg_getNiceNumberFormat(bonus * 100.0))
        }
        headerBlock = [
            formatters.packTextBlockData(
                text_styles.highTitle(NY.COLLECTIONS_TOOLTIP_BONUSINFO),
                useHtml=True,
                padding=formatters.packPadding(left=8, top=-5, bottom=12)),
            formatters.packBlockDataItem(calculatingLinkage,
                                         calculatingData,
                                         padding=formatters.packPadding(
                                             left=12, bottom=-11))
        ]
        countSign = text_styles.neutral(
            _ms(NY.COLLECTIONS_TOOLTIP_BONUS_INFO_TABLE_TOYS_HEADER_COUNT))
        countSign = text_styles.standard(
            _ms(NY.COLLECTIONS_TOOLTIP_BONUS_INFO_TABLE_VALUE_SIGN,
                value=countSign))
        leftColumnHeader = _ms(
            NY.COLLECTIONS_TOOLTIP_BONUS_INFO_TABLE_TOYS_HEADER,
            sign=countSign)
        rewardSign = text_styles.neutral(
            _ms(NY.COLLECTIONS_TOOLTIP_BONUS_INFO_TABLE_REWARD_VALUE))
        rewardSign = text_styles.standard(
            _ms(NY.COLLECTIONS_TOOLTIP_BONUS_INFO_TABLE_VALUE_SIGN,
                value=rewardSign))
        rightColumnHeader = _ms(
            NY.COLLECTIONS_TOOLTIP_BONUS_INFO_TABLE_REWARD_HEADER,
            sign=rewardSign)
        leftValues = []
        rightValues = []
        for i in range(0, len(BOUND_COLLECTION_RATING_BY_LEVEL) - 1):
            leftValues.append(
                _ms(NY.COLLECTIONS_TOOLTIP_BONUS_INFO_TABLE_TOYS_VALUES,
                    min=BOUND_COLLECTION_RATING_BY_LEVEL[i],
                    max=BOUND_COLLECTION_RATING_BY_LEVEL[i + 1] - 1))

        leftValues.append(
            _ms(NY.COLLECTIONS_TOOLTIP_BONUS_INFO_TABLE_TOYS_MORE,
                count=BOUND_COLLECTION_RATING_BY_LEVEL[
                    len(BOUND_COLLECTION_RATING_BY_LEVEL) - 1]))
        for bonus in COLLECTION_BONUSES_BY_LEVEL:
            rightValues.append(
                BigWorld.wg_getNiceNumberFormat(bonus.xp * 100.0))

        tableData = {
            'leftColumn': {
                'header': leftColumnHeader,
                'values': leftValues
            },
            'rightColumn': {
                'header': rightColumnHeader,
                'values': rightValues
            },
            'selectedIndex': collectionLevel - 1
        }
        receivedCount = 0
        totalCount = 0
        alreadyReceived = self._newYearController.receivedToysCollection
        toys = self._newYearController.toysDescrs
        toysBySetting = []
        for toy in toys.values():
            if toy.setting == setting:
                totalCount += 1
                received = toy.id in alreadyReceived
                if received:
                    receivedCount += 1
                toysBySetting.append(toy)

        progress = text_styles.main(
            _ms(NY.COLLECTIONS_TOOLTIP_BONUS_TOYS,
                value=text_styles.stats(str(receivedCount)),
                max=totalCount))
        middleBlock = [
            formatters.packTextBlockData(text_styles.middleTitle(
                NY.COLLECTIONS_TOOLTIP_BONUS_INFO_HEADER),
                                         useHtml=True,
                                         padding=formatters.packPadding(
                                             top=5, bottom=9, left=25)),
            formatters.packBlockDataItem(
                BLOCKS_TOOLTIP_TYPES.TOOLTIP_NY_COLLECTION_BONUS_TABLE_LINKAGE,
                tableData),
            formatters.packAlignedTextBlockData(
                text=progress,
                align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                padding=formatters.packPadding(top=20))
        ]
        permanentBonus = BigWorld.wg_getNiceNumberFormat(
            _BONUS_FACTOR_BY_ATMOSPHERE_LEVEL[-1])
        description = text_styles.main(
            _ms(NY.COLLECTIONS_TOOLTIP_BONUSINFO_BOTTOM_DESCRIPTION,
                value=text_styles.neutral(permanentBonus)))
        bottomBlock = _makeNationBlock(
            NY.COLLECTIONS_TOOLTIP_AWARDS_NATIONS_HEADER, setting)
        bottomBlock.append(
            formatters.packAlignedTextBlockData(
                text=description,
                align=BLOCKS_TOOLTIP_TYPES.ALIGN_LEFT,
                padding=formatters.packPadding(top=10)))
        return [
            formatters.packBuildUpBlockData(headerBlock,
                                            padding=formatters.packPadding(
                                                left=15, right=15)),
            formatters.packBuildUpBlockData(
                middleBlock,
                linkage=BLOCKS_TOOLTIP_TYPES.
                TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
                padding=formatters.packPadding(left=0)),
            formatters.packBuildUpBlockData(
                bottomBlock,
                linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE,
                padding=formatters.packPadding(left=25))
        ]
Esempio n. 30
0
 def __packActiveState(self, time):
     title = text_styles.statInfo(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_ACTIVE_TITLE)
     state = text_styles.main(makeString(TOOLTIPS.BOOSTERSWINDOW_BOOSTER_ACTIVE_VALUE, time=text_styles.stats(time)))
     return formatters.packBuildUpBlockData([formatters.packAlignedTextBlockData(title, BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding={'bottom': 4}), formatters.packAlignedTextBlockData(state, BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)])