def _packQuest(self, questName, bonuses, isAvailable): blocks = [] bonusesLength = len(bonuses) if bonusesLength > _MAX_BONUSES_PER_QUEST: bonuses = bonuses[:_MAX_BONUSES_PER_QUEST] formater = '{{}} {}'.format( text_styles.stats( _ms(TOOLTIPS.HANGAR_HEADER_QUESTS_REWARD_REST, count=bonusesLength - _MAX_BONUSES_PER_QUEST))) else: formater = '{}' strBonus = ', '.join(bonuses) title = questName if isAvailable else '{} {}'.format( icons.notAvailableRed(), questName) blocks.append( formatters.packImageTextBlockData( title=text_styles.middleTitle(title), desc=text_styles.neutral( _ms(TOOLTIPS.HANGAR_HEADER_QUESTS_REWARD, rewards=text_styles.main(formater.format(strBonus)))), imgPadding=formatters.packPadding(top=-13, left=-2), txtPadding=formatters.packPadding(top=-2), txtGap=6, padding=formatters.packPadding(bottom=15), txtOffset=20)) return formatters.packBuildUpBlockData( blocks, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE )
def _packBlocks(self, perfType, *args, **kwargs): items = super(PerfAttentionSimpleTooltip, self)._packBlocks(*args, **kwargs) message = backport.text(R.strings.tooltips.battle_royale.hangar.perf.dyn(perfType).header()) problemIcon = None if perfType == BattleRoyalePerfProblems.HIGH_RISK: problemIcon = icons.notAvailableRed() formattedMessage = text_styles.critical(message) elif perfType == BattleRoyalePerfProblems.MEDIUM_RISK: problemIcon = icons.alert() formattedMessage = text_styles.alert(message) else: formattedMessage = '' title = text_styles.concatStylesWithSpace(problemIcon, formattedMessage) description = text_styles.main(backport.text(R.strings.tooltips.battle_royale.hangar.perf.dyn(perfType).description())) items.append(formatters.packTitleDescBlock(title=title, desc=description)) return items
def __packQuestInfo(self, quest, isGlobalAvailable): titleIcon = '' isCompleted = quest.isCompleted() isAvailable = quest.isAvailable().isValid padding = formatters.packPadding(left=23, right=20) descPadding = formatters.packPadding(top=-2, left=-1, right=20) if isCompleted: titleIcon = icons.check() padding['left'] = 18 descPadding['left'] = 4 descPadding['top'] = -5 elif not isAvailable and not isGlobalAvailable: titleIcon = icons.notAvailableRed() + ' ' return formatters.packTitleDescBlock( title=text_styles.concatStylesToSingleLine( titleIcon, text_styles.middleTitle(quest.getUserName())), desc=text_styles.main(quest.getDescription()), padding=padding, descPadding=descPadding)
def __makeQuestDetailsInfo(self, questID): quest = events_helpers.getPotapovQuestsCache().getQuests()[questID] questInfoData = events_helpers.getEventInfoData(quest) self._navInfo.selectPotapovQuest(self.__tile.getID(), questID) vehMinLevel, vehClasses = quest.getVehMinLevel( ), quest.getVehicleClasses() if vehMinLevel > 1: reqsHeader = text_styles.middleTitle( _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS)) if quest.getQuestBranch() == PQ_BRANCH.REGULAR: reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_TEXT, level=int2roman(vehMinLevel), vehType=', '.join([ Vehicle.getTypeShortUserName(vc) for vc in vehClasses ])) elif vehMinLevel < 10: reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_MORE8LVL) else: reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_ONLY10LVL) else: reqsHeader = reqs = '' condition = makeHtmlString( 'html_templates:lobby/quests/potapov', 'questDetails', ctx={ 'mainCondHeader': text_styles.middleTitle( _ms(QUESTS.QUESTTASKDETAILSVIEW_MAINCONDITIONS)), 'mainCond': quest.getUserMainCondition(), 'addCondHeader': text_styles.middleTitle( _ms(QUESTS.QUESTTASKDETAILSVIEW_ADDITIONALCONDITIONS)), 'addCond': quest.getUserAddCondition(), 'requirementsHeader': reqsHeader, 'requirements': reqs, 'adviseHeader': text_styles.middleTitle( _ms(QUESTS.QUESTTASKDETAILSVIEW_DESCRIPTION)), 'advise': quest.getUserAdvice(), 'descr': quest.getUserDescription() }) if not quest.isUnlocked(): btnInfo = _makeSelectBtn( QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN, enabled=False, descr=text_styles.error(icons.notAvailableRed() + ' ' + _ms(self._lockedMessageStrKey))) elif quest.needToGetReward(): btnInfo = _makeSelectBtn( QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_TAKEAWARD, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_RECEIVETHEAWARD, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_TAKEAWARD)) elif quest.isInProgress(): btnInfo = _makeRefuseBtn( QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_CANCEL, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_ABORT, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_INPROGRESS)) elif quest.isFullCompleted(): btnInfo = _makeNoBtn( text_styles.success(icons.checkmark() + _ms( QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_EXCELLENTDONE)) ) elif quest.isMainCompleted(): btnInfo = _makeSelectBtn( QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_REPEAT, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_REPEAT, text_styles.success( icons.checkmark() + _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_DONE))) else: btnInfo = _makeSelectBtn( QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_PERFORM, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_AVAILABLE)) mainAwards, addAwards = questInfoData._getBonuses( events_helpers.getPotapovQuestsCache().getQuests().values()) result = { 'taskID': questID, 'headerText': text_styles.highTitle(quest.getUserName()), 'conditionsText': condition, 'mainAwards': mainAwards, 'addAwards': addAwards } result.update(btnInfo._asdict()) return result
def __makeQuestDetailsInfo(self, questID): _getText = self.app.utilsManager.textManager.getText quest = g_eventsCache.potapov.getQuests()[questID] questInfoData = events_helpers.getEventInfoData(quest) self._navInfo.selectPotapovQuest(self.__tile.getID(), questID) vehMinLevel, vehClasses = quest.getVehMinLevel(), quest.getVehicleClasses() if vehMinLevel > 1: reqsHeader = _getText(TEXT_MANAGER_STYLES.MIDDLE_TITLE, _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS)) reqs = _ms('#quests:QuestTaskDetailsView/requirements/text', level=int2roman(vehMinLevel), vehType=', '.join([ Vehicle.getTypeShortUserName(vc) for vc in vehClasses ])) else: reqsHeader = reqs = '' condition = makeHtmlString('html_templates:lobby/quests/potapov', 'questDetails', ctx={'mainCondHeader': _getText(TEXT_MANAGER_STYLES.MIDDLE_TITLE, _ms(QUESTS.QUESTTASKDETAILSVIEW_MAINCONDITIONS)), 'mainCond': quest.getUserMainCondition(), 'addCondHeader': _getText(TEXT_MANAGER_STYLES.MIDDLE_TITLE, _ms(QUESTS.QUESTTASKDETAILSVIEW_ADDITIONALCONDITIONS)), 'addCond': quest.getUserAddCondition(), 'requirementsHeader': reqsHeader, 'requirements': reqs, 'adviseHeader': _getText(TEXT_MANAGER_STYLES.MIDDLE_TITLE, _ms(QUESTS.QUESTTASKDETAILSVIEW_DESCRIPTION)), 'advise': quest.getUserAdvice(), 'descr': quest.getUserDescription()}) if not quest.isUnlocked(): btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN, enabled=False, descr=text_styles.error(icons.notAvailableRed() + ' ' + _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_DOPREVTASKS))) elif quest.needToGetReward(): btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_TAKEAWARD, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_RECEIVETHEAWARD, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_TAKEAWARD)) elif quest.isInProgress(): btnInfo = _makeRefuseBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_CANCEL, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_ABORT, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_INPROGRESS)) elif quest.isFullCompleted(): btnInfo = _makeNoBtn(text_styles.success(icons.checkmark() + _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_EXCELLENTDONE))) elif quest.isMainCompleted(): btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_REPEAT, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_REPEAT, text_styles.success(icons.checkmark() + _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_DONE))) else: btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_PERFORM, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_AVAILABLE)) mainAwards, addAwards = questInfoData._getBonuses(g_eventsCache.potapov.getQuests().values()) result = {'taskID': questID, 'headerText': _getText(TEXT_MANAGER_STYLES.HIGH_TITLE, quest.getUserName()), 'conditionsText': condition, 'mainAwards': mainAwards, 'addAwards': addAwards} result.update(btnInfo._asdict()) return result