---
description: v4.0
---

# GameQuestList Get() Methods

#### Get `GameQuest` objects by status & `uid`

```csharp
// If there are multiple, will return the first found
public GameQuest GetInProgress(string uid) 
public GameQuest GetSucceeded(string uid) 
public GameQuest GetFailed(string uid) 
public GameQuest GetCompleted(string uid) 

// returns true or false, with the found GameQuest in the out value
public bool TryGetInProgress(string uid, out GameQuest found)
public bool TryGetSucceeded(string uid, out GameQuest found)
public bool TryGetFailed(string uid, out GameQuest found)
public bool TryGetCompleted(string uid, out GameQuest found)
```

#### Get IEnumerable\<GameQuest> results

```csharp
// These can be turned into a List<GameQuest> or GameQuest[], or further queried using
// LINQ.
public IEnumerable<GameQuest> QuestsModifyingStats
public IEnumerable<GameQuest> QuestsInProgress
public IEnumerable<GameQuest> QuestsSucceeded
public IEnumerable<GameQuest> QuestsFailed
public IEnumerable<GameQuest> QuestsCompleted

// Example
foreach(var gameQuest in gameQuestList.QuestsModifyingStats)
    Debug.Log($"{gameQuest.ObjectName()} is modifying {gameQuest.DirectlyAffectsList().Count} stats");
    
List<GameQuest> completedQuests = gameQuestList.QuestsCompleted.ToList();
GameQuest[] questsInProgress = gameQuestList.QuestsInProgress.ToArray();
```

### Additional Get Methods

```csharp
// Get all GameQuests that are affecting Stats. Returns IEnumberable<GameQuest>
List<GameStat> StatAffectingQuests => gameQuestList.QuestsModifyingStats.ToList();

// Get GameQuests that are affecting stats and no longer in progress, using LINQ
List<GameStat> CompletedQuestsAffectingStats => gameQuestList.QuestsModifyingStats
    .Where(x => x.status != QuestStep.QuestStepStatus.InProgress).ToList();
```

#### Examples

You can `Get` and `TryGet` quests based on their status.

```csharp
// These will return a single GameQuest, or null
GameQuest InProgress(string uid) => gameQuestList.GetInProgress(uid);
GameQuest Succeeded(string uid) => gameQuestList.GetInProgress(uid);
GameQuest Failed(string uid) => gameQuestList.GetInProgress(uid);
GameQuest Completed(string uid) => gameQuestList.GetCompleted(uid);

if (TryGetInProgress(uid, out var gameQuest))
    Debug.Log($"{gameQuest.ObjectName()} is in progress");
    
if (TryGetSucceeded(uid, out var gameQuest))
    Debug.Log($"{gameQuest.ObjectName()} has succeeded");
    
if (TryGetFailed(uid, out var gameQuest))
    Debug.Log($"{gameQuest.ObjectName()} has failed");
    
if (TryGetCompleted(uid, out var gameQuest))
    Debug.Log($"{gameQuest.ObjectName()} has been completed, no longer in progress");
```

You can also get an `IEnumerable<GameQuest>` based on the status of the quests. This can be turned into a `List`, `Array`, or have further logic applied prior to being used as a `List` or `Array`.

```csharp
List<GameQuest> QuestsInProgress => gameQuestList.QuestsInProgress.ToList();
List<GameQuest> QuestsSucceeded => gameQuestList.QuestsSucceeded.ToList();
GameQuest[] QuestsFailed => gameQuestList.QuestsFailed.ToArray();
GameQuest[] QuestsCompleted => gameQuestList.QuestsCompleted.ToArray();
```
