def getInfo(self, svrEvents, pCur=None, pPrev=None, noProgressInfo=False): res = super(_LinkedSetQuestInfo, self).getInfo(svrEvents, pCur, pPrev, noProgressInfo) missionName = getLocalizedMissionNameForLinkedSetQuest(self.event) questName = getLocalizedQuestNameForLinkedSetQuest(self.event) res['description'] = _ms(LINKEDSET.QUEST_CARD_TITLE, mission_name=missionName, quest_name=questName) return res
def getPostBattleInfo(self, svrEvents, pCur, pPrev, isProgressReset, isCompleted, progressData): bonuses = self.event.getBonuses() if not bonuses: return None else: res = super(_LinkedSetQuestInfo, self).getPostBattleInfo(svrEvents, pCur, pPrev, isProgressReset, isCompleted, progressData) res['title'] = getLocalizedQuestNameForLinkedSetQuest(self.event) progresses = res.get('progressList', []) if progresses and len(progresses) == 1: curProgress = progresses[0] curProgress['description'] = getLocalizedQuestDescForLinkedSetQuest(self.event) return res
def _getBodyData(self): missions = [] for quests in self._questMissions: status = None checkStates = [] groupIsCompleted = isAllQuestsCompleted(quests) groupIsAvailable = groupIsCompleted or hasAtLeastOneAvailableQuest(quests) if not groupIsAvailable: status = formatErrorTextWithIcon(_ms(LINKEDSET.NOT_AVAILABLE)) else: isSingleQuest = len(quests) == 1 if not groupIsCompleted and isSingleQuest: status = _ms(LINKEDSET.MISSION_NOT_COMPLETE) else: checkStates = [ quest.isCompleted() for quest in quests ] missionID = getLinkedSetMissionIDFromQuest(quests[0]) if groupIsAvailable: uiDecoration = RES_ICONS.getLinkedSetMissionItemActive(missionID) else: uiDecoration = RES_ICONS.getLinkedSetMissionItemDisable(missionID) advisable = self.eventsCache.getAdvisableQuests() advisableQuests = [ quest for quest in quests if quest.getID() in advisable ] isCornerEnable = bool(len(settings.getNewCommonEvents(advisableQuests))) missions.append({'eventID': str(missionID), 'title': _ms(LINKEDSET.getMissionName(missionID)), 'status': status, 'isAvailable': True, 'isCornerEnable': isCornerEnable, 'uiPicture': RES_ICONS.getLinkedSetMissionIconItem(missionID), 'uiDecoration': uiDecoration, 'checkStates': checkStates}) result = {'title': _ms(getLocalizedQuestNameForLinkedSetQuest(self.mainQuest)), 'description': _ms(getLocalizedQuestDescForLinkedSetQuest(self.mainQuest)), 'isButtonUseTokenEnabled': self.linkedSet.hasLinkedSetFinishToken(), 'buttonUseTokenLabel': _ms(LINKEDSET.USE_THE_TOKEN), 'uiDecoration': RES_ICONS.MAPS_ICONS_LINKEDSET_LINKEDSET_BGR_LANDING, 'missions': missions} return result
def getTitle(self): return _ms(getLocalizedQuestNameForLinkedSetQuest(self.mainQuest))
def _getViewDataForAvailableMission(self): selectedQuest = self._quests[self._selectedQuestID] isCompleted = selectedQuest.isCompleted() isAvailable = isCompleted or selectedQuest.isAvailable().isValid if isCompleted: cardStatus = formatOkTextWithIcon(_ms(LINKEDSET.COMPLETED)) elif isAvailable: cardStatus = _ms(LINKEDSET.AVAILABLE) else: cardStatus = formatErrorTextWithIcon(_ms(LINKEDSET.NOT_AVAILABLE)) if len(self._quests) > 1: cardTitle = _ms(LINKEDSET.QUEST_CARD_TITLE, mission_name=_ms( LINKEDSET.getMissionName(self._missionID)), quest_name=getLocalizedQuestNameForLinkedSetQuest( selectedQuest)) else: cardTitle = getLocalizedQuestNameForLinkedSetQuest(selectedQuest) if isCompleted: return self._getViewData( title=cardTitle, status=cardStatus, info=_ms(LINKEDSET.COMPLETED), task=_ms(LINKEDSET.REWARD_FOR_COMPLETED_QUEST, quest_name=cardTitle), isBackOverlay=isCompleted, isMovie=False, back=self.getMissionCompleteBackground(self._missionID), awards=self.getAwardsFromQuest(selectedQuest)) elif isAvailable: isMovie = self.isQuestBackgroundIsMovie(selectedQuest) if isMovie: self._setupFlashAnimTexts() back = _getQuestItemActiveAnimBackground( self._missionID, self._selectedQuestID + 1) else: back = self.getQuestActiveBackground(self._missionID, self._selectedQuestID + 1) if self.isPlayBootcampMission(): questName = getLocalizedQuestNameForLinkedSetQuest( selectedQuest) if self.bootcamp.runCount(): btnStartLabel = LINKEDSET.CONTINUE_QUEST_BTN else: btnStartLabel = LINKEDSET.START_QUEST_BTN btnStartLabel = _ms(btnStartLabel, quest_name=questName) else: btnStartLabel = None progressValue = None curProgress, maxProgress = getProgressFromQuestWithSingleAccumulative( selectedQuest) if curProgress is not None and maxProgress: cardStatus = makeHtmlString( 'html_templates:lobby/quests/linkedSet', 'questProgressTemplate', { 'curValue': curProgress, 'maxValue': maxProgress }) progressValue = curProgress * 100 // maxProgress return self._getViewData( title=cardTitle, status=cardStatus, description=getLocalizedQuestDescForLinkedSetQuest( selectedQuest), isBackOverlay=isCompleted, isMovie=isMovie, back=back, awards=self.getAwardsFromQuest(selectedQuest), btnStartLabel=btnStartLabel, progressValue=progressValue) else: questBeforeID = self._quests[self._selectedQuestID - 1] questBeforeName = _ms( LINKEDSET.QUEST_CARD_TITLE, mission_name=_ms(LINKEDSET.getMissionName(self._missionID)), quest_name=getLocalizedQuestNameForLinkedSetQuest( questBeforeID)) return self._getViewData( title=cardTitle, status=cardStatus, info=_ms(LINKEDSET.NOT_AVAILABLE), task=_ms(LINKEDSET.COMPLETE_QUEST_BEFORE, quest_name=questBeforeName), isBackOverlay=isCompleted, isMovie=False, back=self.getMissionCompleteBackground(self._missionID), awards=self.getAwardsFromQuest(selectedQuest, alpha=0.5)) return