def __getNextMetaLevelAwards(self, pMetaLevel, size=AWARDS_SIZES.SMALL): currentPrestigeQuest = self.eventsCache.getAllQuests().get( _META_LEVEL_TOKEN_TEMPLATE % pMetaLevel, None) if not currentPrestigeQuest: return [] else: bonuses = currentPrestigeQuest.getBonuses() awardsFormatter = CurtailingAwardsComposer( _MAX_DISPLAYED_META_REWARDS) return awardsFormatter.getFormattedBonuses(bonuses, size)
def __init__( self, event, bonusFormatter=CurtailingAwardsComposer(DEFAULT_AWARDS_COUNT)): super(BattleQuestUIDataPacker, self).__init__(event) self.__tooltipData = {} self._bonusFormatter = bonusFormatter
class EpicBattlesAfterBattleView(EpicBattlesAfterBattleViewMeta): epicMetaGameCtrl = dependency.descriptor(IEpicBattleMetaGameController) eventsCache = dependency.descriptor(IEventsCache) _MAX_VISIBLE_AWARDS = 6 _awardsFormatter = CurtailingAwardsComposer(_MAX_VISIBLE_AWARDS) def __init__(self, ctx=None): super(EpicBattlesAfterBattleView, self).__init__() self.__ctx = ctx def onIntroStartsPlaying(self): SoundGroups.g_instance.playSound2D( EPIC_METAGAME_WWISE_SOUND_EVENTS.EB_ACHIEVED_RANK) def onRibbonStartsPlaying(self): SoundGroups.g_instance.playSound2D( EPIC_METAGAME_WWISE_SOUND_EVENTS.EB_LEVEL_REACHED) def onEscapePress(self): self.__close() def onCloseBtnClick(self): self.__close() def onWindowClose(self): self.destroy() 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 def _dispose(self): super(EpicBattlesAfterBattleView, self)._dispose() def __close(self): self.destroy() def __getProgress(self, curLevel, curFamePoints, prevLevel, prevFamePoints, maxLevel): pLevel = prevLevel + float(prevFamePoints) / float( self.epicMetaGameCtrl.getPointsProgessForLevel( prevLevel)) if prevLevel != maxLevel else maxLevel cLevel = curLevel + float(curFamePoints) / float( self.epicMetaGameCtrl.getPointsProgessForLevel( curLevel)) if curLevel != maxLevel else maxLevel return (pLevel, cLevel)
def preformatEventBonuses( event, bonusFormatter=CurtailingAwardsComposer(DEFAULT_AWARDS_COUNT)): bonuses = getMissionInfoData(event).getSubstituteBonuses() return bonusFormatter.getFormattedBonuses(bonuses, size=AWARDS_SIZES.BIG)
def _getAwardComposer(self): return CurtailingAwardsComposer(_ADDITIONAL_AWARDS_COUNT, getDefaultAwardFormatter())
from helpers import dependency, int2roman from helpers.i18n import makeString as _ms from quest_xml_source import MAX_BONUS_LIMIT from shared_utils import first from skeletons.gui.server_events import IEventsCache CARD_AWARDS_COUNT = 6 LINKED_SET_CARD_AWARDS_COUNT = 8 DETAILED_CARD_AWARDS_COUNT = 10 _preBattleConditionFormatter = MissionsPreBattleConditionsFormatter() _accountReqsFormatter = AccountRequirementsFormatter() _tqAccountReqsFormatter = TQAccountRequirementsFormatter() _cardCondFormatter = cards_formatters.CardBattleConditionsFormatters() _detailedCardCondFormatter = cards_formatters.DetailedCardBattleConditionsFormatters() _cardTokenConditionFormatter = cards_formatters.CardTokenConditionFormatter() _detailedCardTokenConditionFormatter = cards_formatters.DetailedCardTokenConditionFormatter() _cardAwardsFormatter = CurtailingAwardsComposer(CARD_AWARDS_COUNT) _detailedCardAwardsFormatter = DetailedCardAwardComposer(DETAILED_CARD_AWARDS_COUNT) _awardsWindowBonusFormatter = CurtailingAwardsComposer(sys.maxint) _personalMissionsConditionsFormatter = PMCardConditionsFormatter() _personalMissionsAwardsFormatter = PersonalMissionsAwardComposer(DETAILED_CARD_AWARDS_COUNT) _linkedSetAwardsComposer = LinkedSetAwardsComposer(LINKED_SET_CARD_AWARDS_COUNT) HIDE_DONE = 'hideDone' HIDE_UNAVAILABLE = 'hideUnavailable' AWARD_SHEET_ICON = icons.makeImageTag(RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_SHEET_RECEIVED_SMALL, 16, 16, -2, 0) class BG_STATES(object): COMPLETED = 'completed' MARATHON = 'marathon' DISABLED = 'disabled' DEFAULT = 'default'
# Python bytecode 2.7 (decompiled from Python 2.7) # Embedded file name: scripts/client/gui/ranked_battles/awards_formatters.py from gui.Scaleform.daapi.view.lobby.missions.awards_formatters import CurtailingAwardsComposer from gui.server_events.awards_formatters import AWARDS_SIZES from gui.shared.money import Currency _AWARDS_ORDER = [ 'items', Currency.CREDITS, 'premium', Currency.GOLD, Currency.CRYSTAL, 'oneof' ] _MAX_VISIBLE_AWARDS = 6 _awardsFormatter = CurtailingAwardsComposer(_MAX_VISIBLE_AWARDS) def getRankedQuestsOrderedAwards(quests, size=AWARDS_SIZES.SMALL): bonuses = [] for quest in quests: questBonuses = quest.getBonuses() formattedBonuses = sorted(questBonuses, cmp=_sortBonusesFunc, reverse=True) bonuses.extend(formattedBonuses) awards = _awardsFormatter.getFormattedBonuses(bonuses, size=size) return awards def _getOrderByBonusType(bonusName): return _AWARDS_ORDER.index(bonusName) if bonusName in _AWARDS_ORDER else -1