def _prepareData(self, serverList, serverName, serverTimeLeft):
     if len(serverList) == 1:
         serversDDEnabled = False
     else:
         serversDDEnabled = True
     applyButtonLabel = _ms(RANKED_BATTLES.PRIMETIME_APPLYBTN)
     title = text_styles.epicTitle(RANKED_BATTLES.PRIMETIME_TITLE)
     if self._isEnabled:
         timeLeftStr = time_utils.getTillTimeString(
             serverTimeLeft,
             MENU.HEADERBUTTONS_BATTLE_TYPES_RANKED_AVAILABILITY)
         status = text_styles.main(
             _ms(RANKED_BATTLES.PRIMETIME_STATUS_THISENABLE,
                 server=serverName,
                 time=text_styles.warning(timeLeftStr)))
         mainBackground = RES_ICONS.MAPS_ICONS_RANKEDBATTLES_PRIMETIME_PRIME_TIME_BACK_DEFAULT
         title = text_styles.epicTitle(
             RANKED_BATTLES.PRIMETIME_TITLEWELCOME)
     else:
         applyButtonLabel = _ms(RANKED_BATTLES.PRIMETIME_CONTINUEBTN)
         status = '{} {}\n{}'.format(
             icons.alert(-3),
             text_styles.alert(
                 RANKED_BATTLES.PRIMETIME_STATUS_DISABLEFIRST),
             text_styles.main(RANKED_BATTLES.PRIMETIME_STATUS_DISABLE))
         mainBackground = RES_ICONS.MAPS_ICONS_RANKEDBATTLES_PRIMETIME_PRIME_TIME_BACK_BW
     return {
         'title': title,
         'apply': applyButtonLabel,
         'mainBackground': mainBackground,
         'status': status,
         'serversDDEnabled': serversDDEnabled,
         'serverDDVisible': True
     }
 def _populate(self):
     super(EpicBattlesAfterBattleView, self)._populate()
     extInfo = self.__ctx['reusableInfo'].personal.avatar.extensionInfo
     epicMetaGame = extInfo['epicMetaGame']
     pPrestigeLevel, pMetaLevel, pFamePts = epicMetaGame.get(
         'metaLevel', (None, None, None))
     _, prevPMetaLevel, prevPFamePts = epicMetaGame.get(
         'prevMetaLevel', (None, None, None))
     mlSettings = dependency.instance(
         ILobbyContext).getServerSettings().epicMetaGame.metaLevel
     maxMetaLevel = mlSettings.get('maxLevel', 0)
     famePtsToProgress = mlSettings.get('famePtsToProgress', None)
     famePointsReceived = sum(
         famePtsToProgress[prevPMetaLevel - 1:pMetaLevel -
                           1]) + pFamePts - prevPFamePts
     achievedRank = extInfo['playerRank'].get('rank', -1)
     rankName = getattr(EPIC_BATTLE, 'RANK_RANK{}'.format(achievedRank))
     achievedRank += 1
     questsProgressData = self.__ctx[
         'reusableInfo'].personal.getQuestsProgress()
     bonuses = sum([
         self.eventsCache.getAllQuests().get(q).getBonuses()
         for q in questsProgressData
     ], [])
     bonuses = _AccumulateBonuses(bonuses)
     awardsVO = self._awardsFormatter.getFormattedBonuses(
         bonuses, size=AWARDS_SIZES.BIG)
     lvlReachedText = EPIC_BATTLE.EPIC_BATTLES_AFTER_BATTLE_LEVEL_UP_MAX_TITLE if pMetaLevel == maxMetaLevel else EPIC_BATTLE.EPIC_BATTLES_AFTER_BATTLE_LEVEL_UP_TITLE
     data = EpicBattlesAfterBattleViewVO(
         awards=awardsVO,
         progress=self.__getProgress(pMetaLevel, pFamePts, prevPMetaLevel,
                                     prevPFamePts, maxMetaLevel),
         barText='+' + str(famePointsReceived),
         currentPrestigeLevel=pPrestigeLevel,
         epicMetaLevelIconData=getEpicMetaIconVODict(
             pPrestigeLevel, pMetaLevel),
         rank=achievedRank,
         rankText=toUpper(text_styles.heroTitle(rankName)),
         rankTextBig=toUpper(text_styles.epicTitle(rankName)),
         rankSubText=text_styles.highTitle(
             EPIC_BATTLE.EPIC_BATTLES_AFTER_BATTLE_ACHIEVED_RANK),
         levelUpText=toUpper(text_styles.heroTitle(lvlReachedText)),
         levelUpTextBig=toUpper(text_styles.epicTitle(lvlReachedText)),
         backgroundImageSrc=RES_ICONS.
         MAPS_ICONS_EPICBATTLES_BACKGROUNDS_META_BG,
         maxLevel=maxMetaLevel)
     self.as_setDataS(data._asdict())
     return
Пример #3
0
 def _prepareData(self, serverList, serverName, serverTimeLeft):
     enableTitle, enableWelcomeTitle, enableBtnTitle, disableTitle, disableStatusTitle, disableStatusDescr, disableBtnTitle = self._getLocaleData()
     enableBackground, disableBackground = self._getImgsData()
     if self._isEnabled:
         timeLeftStr = time_utils.getTillTimeString(serverTimeLeft, MENU.HEADERBUTTONS_BATTLE_TYPES_RANKED_AVAILABILITY)
         status = text_styles.main(_ms(enableTitle, server=serverName, time=text_styles.warning(timeLeftStr)))
         mainBackground = enableBackground
         title = text_styles.epicTitle(enableWelcomeTitle)
         applyButtonLabel = _ms(enableBtnTitle)
     else:
         status = '{} {}\n{}'.format(icons.alert(-3), text_styles.alert(disableStatusTitle), text_styles.main(disableStatusDescr))
         mainBackground = disableBackground
         title = text_styles.epicTitle(disableTitle)
         applyButtonLabel = _ms(disableBtnTitle)
     return {'title': title,
      'apply': applyButtonLabel,
      'mainBackground': mainBackground,
      'status': status,
      'serversDDEnabled': len(serverList) > 1,
      'serverDDVisible': True}
 def _packInfoViewVO(self):
     pPrestigeLevel, pMetaLevel, _ = self.epicMetaGameCtrl.getPlayerLevelInfo(
     )
     _, maxRewardClaimed, _ = self.epicMetaGameCtrl.getSeasonData()
     maxRewardTokens = self.lobbyCtx.getServerSettings(
     ).epicMetaGame.metaLevel.get('maxRewardTokens', 0)
     maxMetaLevel = self.lobbyCtx.getServerSettings(
     ).epicMetaGame.metaLevel.get('maxLevel', 0)
     prestigeAllowed = (maxRewardTokens < 0 or pPrestigeLevel !=
                        maxRewardTokens) and pMetaLevel == maxMetaLevel
     currentSeason = self.epicMetaGameCtrl.getCurrentSeason()
     cycleTimes = getActiveCycleTimeFrameStrings(currentSeason)
     if cycleTimes.startDay is not None:
         cycleDescText = '%s %s - %s' % (
             cycleTimes.startMonth, cycleTimes.startDay, cycleTimes.endDay)
     else:
         cycleDescText = ''
     return {
         'backgroundImageSrc':
         RES_ICONS.MAPS_ICONS_EPICBATTLES_BACKGROUNDS_META_BG,
         'smallPageTitleHtmlText':
         text_styles.heroTitle(
             i18n.makeString(
                 EPIC_BATTLE.EPICBATTLESINFOVIEW_BATTLEMODETITLE)),
         'bigPageTitleHtmlText':
         text_styles.epicTitle(
             i18n.makeString(
                 EPIC_BATTLE.EPICBATTLESINFOVIEW_BATTLEMODETITLE)),
         'pageDescriptionHtmlText':
         text_styles.promoSubTitle(cycleDescText),
         'aboutButtonLabel':
         i18n.makeString(
             EPIC_BATTLE.INFOVIEW_ABOUTBUTTON_ABOUTFRONTLINE).upper(),
         'canClaimFinalReward':
         self.__canClaimFinalReward(),
         'epicMetaLevelIconData':
         getProgressionIconVODict(pPrestigeLevel, pMetaLevel),
         'epicRewardRibbonData':
         self._packRewardRibbonData(pPrestigeLevel + 1,
                                    self.eventsCache.getAllQuests(),
                                    maxRewardTokens),
         'epicCombatReservesData':
         self._packCombatReservesVO(self.epicMetaGameCtrl.getSkillPoints()),
         'epicMetaProgressData':
         self._packMetaProgressVO(prestigeAllowed, maxRewardClaimed),
         'epicPrestigeProgressData':
         getPrestigeProgressVO(
             self.eventsCache.getAllQuests(),
             self.lobbyCtx.getServerSettings().epicMetaGame.metaLevel,
             pPrestigeLevel, prestigeAllowed)
     }
Пример #5
0
 def _populate(self):
     super(EpicBattlesAfterBattleView, self)._populate()
     epicMetaGame = self.__ctx['reusableInfo'].personal.avatar.extensionInfo
     pMetaLevel, pFamePts = epicMetaGame.get('metaLevel', (None, None))
     prevPMetaLevel, prevPFamePts = epicMetaGame.get(
         'prevMetaLevel', (None, None))
     boosterFLXP = epicMetaGame.get('boosterFlXP', 0)
     originalFlXP = epicMetaGame.get('originalFlXP', 0)
     maxMetaLevel = self.__epicController.getMaxPlayerLevel()
     famePtsToProgress = self.__epicController.getLevelProgress()
     season = self.__epicController.getCurrentSeason() or None
     cycleNumber = 0
     if season is not None:
         cycleNumber = self.__epicController.getCurrentOrNextActiveCycleNumber(
             season)
     famePointsReceived = sum(famePtsToProgress[prevPMetaLevel:pMetaLevel]
                              ) + pFamePts - prevPFamePts
     achievedRank = max(epicMetaGame.get('playerRank', 0), 1)
     rankNameId = R.strings.epic_battle.rank.dyn('rank' + str(achievedRank))
     rankName = toUpper(backport.text(
         rankNameId())) if rankNameId.exists() else ''
     awardsVO = self._awardsFormatter.getFormattedBonuses(
         self.__getBonuses(prevPMetaLevel, pMetaLevel),
         size=AWARDS_SIZES.BIG)
     fameBarVisible = True
     dailyQuestAvailable = False
     if prevPMetaLevel >= maxMetaLevel or pMetaLevel >= maxMetaLevel:
         boosterFLXP = famePointsReceived - originalFlXP if famePointsReceived > originalFlXP else 0
         if prevPMetaLevel >= maxMetaLevel:
             fameBarVisible = False
         else:
             self.__maxLvlReached = True
     lvlReachedText = toUpper(
         backport.text(R.strings.epic_battle.epic_battles_after_battle.
                       Level_Up_Title(),
                       level=pMetaLevel))
     data = {
         'awards':
         awardsVO,
         'progress':
         self.__getProgress(pMetaLevel, pFamePts, prevPMetaLevel,
                            prevPFamePts, maxMetaLevel, boosterFLXP),
         'barText':
         '+' + str(min(originalFlXP, famePointsReceived)),
         'barBoostText':
         '+' + str(boosterFLXP),
         'epicMetaLevelIconData':
         getProgressionIconVODict(cycleNumber, pMetaLevel),
         'rank':
         achievedRank,
         'rankText':
         text_styles.epicTitle(rankName),
         'rankSubText':
         text_styles.promoTitle(
             backport.text(R.strings.epic_battle.epic_battles_after_battle.
                           Achieved_Rank())),
         'levelUpText':
         text_styles.heroTitle(lvlReachedText),
         'backgroundImageSrc':
         backport.image(R.images.gui.maps.icons.epicBattles.backgrounds.
                        back_congrats()),
         'fameBarVisible':
         fameBarVisible,
         'maxLevel':
         maxMetaLevel,
         'maxLvlReached':
         self.__maxLvlReached,
         'questPanelVisible':
         dailyQuestAvailable
     }
     self.as_setDataS(data)
     return