def __getQuestForVehicle(self, vehicle, sortByPriority=False, questIDs=None): if questIDs is None: questFilter = lambda quest: isDailyEpic(quest.getGroupID()) else: questFilter = lambda quest: quest.getID() in questIDs quests = [ q for q in self.__questController.getQuestForVehicle(vehicle) if questFilter(q) ] if sortByPriority: quests.sort(key=lambda _q: _q.getPriority(), reverse=True) return quests
def getCurrentModeQuestsForVehicle(self, vehicle, notCompleted=False): if self.__battleRoyaleController.isBattleRoyaleMode(): if vehicle.isOnlyForBattleRoyaleBattles: return list(self.__battleRoyaleController.getQuests().values()) if notCompleted: quests = [ q for q in self.getQuestForVehicle(vehicle) if not isDailyEpic(q.getGroupID()) and not isDailyQuest(q.getID()) and not isPremium(q.getID()) and not isRankedQuestID(q.getID()) and not isBattleRoyale(q.getGroupID()) and q.shouldBeShown() and not q.isCompleted() ] return quests return [ q for q in self.getQuestForVehicle(vehicle) if not isDailyEpic(q.getGroupID()) and not isDailyQuest(q.getID()) and not isPremium(q.getID()) and not isRankedQuestID(q.getID()) and not isBattleRoyale(q.getGroupID()) and q.shouldBeShown() ]
def userFilterFunc(q): if q.getType() == EVENT_TYPE.MOTIVE_QUEST and not q.isAvailable().isValid: return False if q.getType() == EVENT_TYPE.TOKEN_QUEST and isMarathon(q.getID()): return False if isLinkedSet(q.getGroupID()) and not q.isAvailable().isValid: return False if isPremium(q.getGroupID()) and not q.isAvailable().isValid: return False if self.__eventProgression.isActive() and isDailyEpic(q.getGroupID()): activeQuests = self.__eventProgression.getActiveQuestIDs() if q.getID() not in activeQuests: return False return False if isRankedSeasonOff and (isRankedDaily(q.getGroupID()) or isRankedPlatform(q.getGroupID())) else filterFunc(q)
def __getEpicBattleQuestsVO(self): if not self.__epicController.isEnabled(): return None else: quests = [ q for q in self._questController.getQuestForVehicle( g_currentVehicle.item) if isDailyEpic(q.getGroupID()) ] totalCount = len(quests) completedQuests = len([q for q in quests if q.isCompleted()]) libraryIcons = R.images.gui.maps.icons.library commonQuestsIcon = libraryIcons.outline.quests_available() if not totalCount: commonQuestsIcon = libraryIcons.outline.quests_disabled() label = '' elif not self.__epicController.isDailyQuestsUnlocked(): label = icons.makeImageTag( backport.image(libraryIcons.CancelIcon_1())) elif completedQuests != totalCount: label = backport.text( R.strings.menu.hangar_header.battle_quests_label.dyn( LABEL_STATE.ACTIVE)(), total=totalCount - completedQuests) else: currentCycleEndTime, _ = self.__epicController.getCurrentCycleInfo( ) cycleTimeLeft = currentCycleEndTime - time_utils.getCurrentLocalServerTimestamp( ) if cycleTimeLeft < ONE_DAY or not self.__epicController.isDailyQuestsRefreshAvailable( ): label = icons.makeImageTag( backport.image(libraryIcons.ConfirmIcon_1())) else: label = icons.makeImageTag( backport.image(libraryIcons.time_icon())) quests = [ self._headerQuestFormaterVo( totalCount > 0, backport.image(commonQuestsIcon), label, HANGAR_HEADER_QUESTS.QUEST_TYPE_COMMON, flag=backport.image(R.images.gui.maps.icons.library. hangarFlag.flag_epic()), tooltip=TOOLTIPS_CONSTANTS.EPIC_QUESTS_PREVIEW, isTooltipSpecial=True) ] return self._wrapQuestGroup( HANGAR_HEADER_QUESTS.QUEST_GROUP_COMMON, '', quests)
def userFilterFunc(q): qGroup = q.getGroupID() qIsValid = q.isAvailable().isValid qID = q.getID() if q.getType() == EVENT_TYPE.MOTIVE_QUEST and not qIsValid: return False if q.getType() == EVENT_TYPE.TOKEN_QUEST and isMarathon(qID): return False if isLinkedSet(qGroup) or isPremium(qGroup) and not qIsValid: return False if not isEpicBattleEnabled and isDailyEpic(qGroup): return False if isBattleRoyale(qGroup): quests = self.__battleRoyaleController.getQuests() if qID not in quests: return False if isMapsTraining(qGroup): return q.shouldBeShown() return False if isRankedSeasonOff and ( isRankedDaily(qGroup) or isRankedPlatform(qGroup)) else filterFunc(q)
def _isAvailableForMode(q): return not isDailyEpic(q.getGroupID()) and not isDailyQuest( q.getID()) and not isPremium(q.getID()) and not isRankedQuestID( q.getID()) and not isBattleRoyale( q.getGroupID()) and not isFunRandomQuest(q.getID())
def __getBattleQuestsVO(self, vehicle): quests = [ q for q in self._questController.getQuestForVehicle(vehicle) if not isDailyEpic(q.getGroupID()) and not isDailyQuest(q.getID()) and not isPremium(q.getID()) and not isRankedQuestID(q.getID()) ] totalCount = len(quests) completedQuests = len([ q for q in quests if q.isCompleted() ]) festivityFlagData = self._festivityController.getHangarQuestsFlagData() if totalCount > 0: if completedQuests != totalCount: label = _ms(MENU.hangarHeaderBattleQuestsLabel(LABEL_STATE.ACTIVE), total=totalCount - completedQuests) else: label = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_OUTLINE_QUESTS_ALL_DONE) commonQuestsIcon = festivityFlagData.icon or RES_ICONS.MAPS_ICONS_LIBRARY_OUTLINE_QUESTS_AVAILABLE else: commonQuestsIcon = festivityFlagData.iconDisabled or RES_ICONS.MAPS_ICONS_LIBRARY_OUTLINE_QUESTS_DISABLED label = '' quests = [self._headerQuestFormaterVo(totalCount > 0, commonQuestsIcon, label, HANGAR_HEADER_QUESTS.QUEST_TYPE_COMMON, flag=festivityFlagData.flagBackground, tooltip=TOOLTIPS_CONSTANTS.QUESTS_PREVIEW, isTooltipSpecial=True)] return self._wrapQuestGroup(HANGAR_HEADER_QUESTS.QUEST_GROUP_COMMON, '', quests)