Exemplo n.º 1
0
 def _packInfoBlocks(self):
     sessionStats = self.itemsCache.items.sessionStats.getAccountStats(ARENA_BONUS_TYPE.REGULAR)
     items = []
     if self._propId in _TOTAL_BLOCK_PARAMS:
         data = packTotalPropData(sessionStats, self._propId)
     else:
         accountWtr = self.itemsCache.items.sessionStats.getAccountWtr()
         randomStats = self.itemsCache.items.getAccountDossier().getRandomStats()
         data = packEfficiencyPropData(randomStats, sessionStats, accountWtr, self._propId)
     items.append(formatters.packBlockDataItem(linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_SESSION_STATS_EFFICIENCY_PARAM_BLOCK, data=data, padding=formatters.packPadding(top=0, bottom=42)))
     return items
 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
Exemplo n.º 3
0
 def getCycleStatusTooltipPack(self):
     items = []
     season = self.__currentController.getCurrentSeason(
     ) or self.__currentController.getNextSeason()
     levelInfo = self.getPlayerLevelInfo()
     cycleNumber = self.getCurrentOrNextActiveCycleNumber(season)
     seasonStr = backport.text(self.__progressionNameCycleTxtId,
                               season=int2roman(cycleNumber))
     seasonDescr = text_styles.middleTitle(seasonStr)
     items.append(
         formatters.packTextBlockData(text=seasonDescr,
                                      useHtml=True,
                                      padding=formatters.packPadding(
                                          left=20, right=20)))
     currentCycle = season.getCycleInfo()
     tDiff = currentCycle.endDate - time_utils.getCurrentLocalServerTimestamp(
     ) if currentCycle is not None else 0
     timeLeft = text_styles.main(getTimeToLeftStr(tDiff))
     items.append(
         formatters.packTextBlockData(text=timeLeft,
                                      useHtml=True,
                                      padding=formatters.packPadding(
                                          left=20, right=20)))
     linkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BATTLE_ROYALE_META_LEVEL_BLOCK_LINKAGE if self.isSteelHunter else BLOCKS_TOOLTIP_TYPES.TOOLTIP_EPIC_BATTLE_META_LEVEL_BLOCK_LINKAGE
     items.append(
         formatters.packBuildUpBlockData(
             blocks=[
                 formatters.packBlockDataItem(
                     linkage=linkage,
                     data=getProgressionIconVODict(
                         cycleNumber=cycleNumber,
                         playerLevel=levelInfo.currentLevel))
             ],
             layout=BLOCKS_TOOLTIP_TYPES.LAYOUT_HORIZONTAL,
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
     items.append(getLevelData(levelInfo.currentLevel))
     if levelInfo.currentLevel < self.getMaxPlayerLevel():
         items.append(
             self.__getCurrentMaxProgress(
                 playerLevel=levelInfo.currentLevel,
                 playerFamePts=levelInfo.levelProgress))
         items.append(
             self.__getPlayerProgressToLevelBlock(
                 playerLevel=levelInfo.currentLevel,
                 playerFamePts=levelInfo.levelProgress))
     else:
         unlockedStr = backport.text(
             R.strings.tooltips.eventProgression.unlockedDailyMissions())
         items.append(
             formatters.packTextBlockData(
                 text=text_styles.main(unlockedStr),
                 useHtml=True,
                 padding=formatters.packPadding(left=20, right=20, top=-7)))
     return formatters.packBuildUpBlockData(items)
Exemplo n.º 4
0
 def __getPlayerProgressToLevelBlock(self, playerLevel, playerFamePts):
     famePtsToProgress = self.getPointsProgressForLevel(playerLevel)
     data = EpicBattlesWidgetTooltipVO(progressBarData={
         'value': playerFamePts,
         'maxValue': famePtsToProgress
     })._asdict()
     res = formatters.packBlockDataItem(
         linkage=BLOCKS_TOOLTIP_TYPES.
         TOOLTIP_META_LEVEL_PROGRESS_BLOCK_LINKAGE,
         data=data,
         padding=formatters.packPadding(left=20))
     return res
Exemplo n.º 5
0
 def __getPlayerProgressToLevelBlock(playerFamePts, famePtsToProgress):
     res = formatters.packBlockDataItem(
         linkage=BLOCKS_TOOLTIP_TYPES.
         TOOLTIP_META_LEVEL_PROGRESS_BLOCK_LINKAGE,
         data={
             'progressBarData': {
                 'value': playerFamePts,
                 'maxValue': famePtsToProgress
             }
         },
         padding=formatters.packPadding(left=20),
         blockWidth=280)
     return res
Exemplo n.º 6
0
 def __packWeakZonesBlockData(
         img,
         title=None,
         desc=None,
         padding=None,
         linkage=BLOCKS_TOOLTIP_TYPES.BATTLE_ROYALE_WEAK_ZONES_UI):
     data = {}
     if title is not None:
         data['title'] = title
     if desc is not None:
         data['description'] = desc
     if img is not None:
         data['imagePath'] = img
     data['engineLabel'] = backport.text(
         R.strings.battle_royale.tooltips.weakZones.engine())
     data['ammunitionLabel'] = backport.text(
         R.strings.battle_royale.tooltips.weakZones.ammunition())
     return formatters.packBlockDataItem(linkage, data, padding)
 def __getCycleStatusTooltipPack(self, season):
     items = []
     currentLevel, levelProgress = self.__epicController.getPlayerLevelInfo()
     cycleNumber = self.__epicController.getCurrentOrNextActiveCycleNumber(season)
     items.append(formatters.packTextBlockData(text=text_styles.middleTitle(backport.text(R.strings.epic_battle.tooltips.common.title())), padding=formatters.packPadding(left=20, right=20)))
     currentCycle = season.getCycleInfo()
     tDiff = currentCycle.endDate - time_utils.getCurrentLocalServerTimestamp() if currentCycle is not None else 0
     timeLeft = text_styles.main(getTimeToEndStr(tDiff))
     items.append(formatters.packTextBlockData(text=timeLeft, padding=formatters.packPadding(left=20, right=20)))
     items.append(formatters.packBuildUpBlockData(blocks=[formatters.packBlockDataItem(linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_EPIC_BATTLE_META_LEVEL_BLOCK_LINKAGE, data=getProgressionIconVODict(cycleNumber=cycleNumber, playerLevel=currentLevel), padding=formatters.packPadding(left=-20))], layout=BLOCKS_TOOLTIP_TYPES.LAYOUT_HORIZONTAL, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
     items.append(self.__packLevelBlock(currentLevel))
     if currentLevel < self.__epicController.getMaxPlayerLevel():
         famePtsToProgress = self.__epicController.getPointsProgressForLevel(currentLevel)
         items.append(self.__getCurrentMaxProgressBlock(levelProgress, famePtsToProgress))
         items.append(self.__getPlayerProgressToLevelBlock(levelProgress, famePtsToProgress))
     else:
         unlockedStr = backport.text(R.strings.epic_battle.tooltips.widget.reachedMaxLevel())
         items.append(formatters.packTextBlockData(text=text_styles.main(unlockedStr), padding=formatters.packPadding(left=20, right=20, top=-7)))
     return formatters.packBuildUpBlockData(items, padding=formatters.packPadding(top=20, bottom=10))
Exemplo n.º 8
0
 def _packBlocks(self):
     serverSettings = dependency.instance(ILobbyContext).getServerSettings()
     pPrestigeLevel, pMetaLevel, pFamePts = self.epicMetaGameCtrl.getPlayerLevelInfo(
     )
     maxMetaLevel = self.epicMetaGameCtrl.getMaxPlayerLevel()
     maxPrestigeLevel = serverSettings.epicMetaGame.metaLevel.get(
         'maxPrestigeLevel', None)
     famePtsToProgress = self.epicMetaGameCtrl.getPointsProgessForLevel(
         pMetaLevel)
     percentage = float(pFamePts) / float(
         famePtsToProgress) * 100 if famePtsToProgress > 0 else 100
     block = super(EpicBattlesWidgetTooltip, self)._packBlocks()
     title = TOOLTIPS.EPICBATTLEWIDGET_HEADER
     desc = i18n.makeString(TOOLTIPS.EPICBATTLEWIDGET_DESC,
                            level=pMetaLevel)
     block.append(
         formatters.packTitleDescBlock(title=text_styles.highTitle(title),
                                       desc=text_styles.standard(desc)))
     if pMetaLevel == maxMetaLevel:
         if pPrestigeLevel == maxPrestigeLevel:
             block.append(
                 formatters.packTextBlockData(
                     TOOLTIPS.EPICBATTLEWIDGET_BODY_MAXMETALEVEL_MAXPRESTIGE
                 ))
         else:
             block.append(
                 formatters.packTextBlockData(
                     TOOLTIPS.EPICBATTLEWIDGET_BODY_MAXMETALEVEL_PRESTIGE))
     else:
         data = EpicBattlesWidgetTooltipVO(
             headline=EPIC_BATTLE.EPICBATTLESWIDGETTOOLTIP_FAMEPOINTS,
             description=EPIC_BATTLE.
             EPICBATTLESWIDGETTOOLTIP_FAMEPOINTSDESCRIPTION,
             progressText='{}{}'.format(
                 text_styles.stats(str(pFamePts) + ' / '),
                 str(famePtsToProgress)),
             barPercentage=percentage)._asdict()
         block.append(
             formatters.packBlockDataItem(
                 BLOCKS_TOOLTIP_TYPES.
                 TOOLTIP_META_LEVEL_PROGRESS_BLOCK_LINKAGE, data))
     return block
Exemplo n.º 9
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))
        ]
Exemplo n.º 10
0
 def _packBattleEfficiencyBlock(self):
     data = self._getBattleEfficiencyData()._asdict()
     return formatters.packBlockDataItem(linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_SESSION_STATS_TANK_INFO_BATTLE_EFFICIENCY_BLOCK, data=data, padding=formatters.packPadding(bottom=35))
Exemplo n.º 11
0
 def _packBattleResultsBlock(self):
     data = self._getBattleResultsData()._asdict()
     return formatters.packBlockDataItem(linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_SESSION_STATS_TANK_INFO_BATTLE_RESULTS_BLOCK, data=data, padding=formatters.packPadding(top=-16, bottom=-10))
Exemplo n.º 12
0
 def _packStatusBlock(self):
     data = self._getStatusData()._asdict()
     return formatters.packBlockDataItem(linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_SESSION_STATS_TANK_INFO_STATUS_BLOCK, data=data, padding=formatters.packPadding(top=-2, bottom=16))
Exemplo n.º 13
0
 def _packHeaderBlock(self):
     data = self._getHeaderBlockData()._asdict()
     return formatters.packBlockDataItem(linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_SESSION_STATS_TANK_INFO_HEADER_BLOCK, data=data, padding=formatters.packPadding(bottom=-125 + self._headerPadding))