Skip to content

Commit c97d9fa

Browse files
committed
Show check mark on completed quests and hide their forward unlocks
1 parent bd8f845 commit c97d9fa

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

Mythril.Blazor/Components/QuestCard.razor

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
@(QuestData!.Type == QuestType.Single ? "flag" : "repeat")
2121
</span>
2222
@QuestData.Name
23+
@if (ResourceManager.IsCompleted(QuestData.Name))
24+
{
25+
<span class="ms-1 text-success material-icons" style="font-size: 1rem;" title="Completed at least once">check_circle</span>
26+
}
2327
@if (inProgress)
2428
{
2529
<span class="ms-auto badge bg-warning text-dark small">In Progress</span>
@@ -34,15 +38,19 @@
3438
<div class="card-side">
3539
@{
3640
var forwardUnlocks = ResourceManager.GetForwardUnlocks(QuestData.Quest);
41+
bool isCompleted = ResourceManager.IsCompleted(QuestData.Name);
3742
}
38-
@if (QuestData.Requirements.Length > 0 || (QuestData.RequiredStats != null && QuestData.RequiredStats.Count > 0) || forwardUnlocks.Count > 0)
43+
@if (QuestData.Requirements.Length > 0 || (QuestData.RequiredStats != null && QuestData.RequiredStats.Count > 0) || (forwardUnlocks.Count > 0 && !isCompleted))
3944
{
4045
<ul>
41-
@foreach (var unlock in forwardUnlocks)
46+
@if (!isCompleted)
4247
{
43-
<li @key="unlock" class="text-warning">
44-
<span title="Unlocks">✨</span> @unlock
45-
</li>
48+
@foreach (var unlock in forwardUnlocks)
49+
{
50+
<li @key="unlock" class="text-warning">
51+
<span title="Unlocks">✨</span> @unlock
52+
</li>
53+
}
4654
}
4755
@foreach (var requirement in QuestData.Requirements)
4856
{

Mythril.Data/ResourceManager_State.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ public void Tick(double deltaSeconds)
186186
}
187187

188188
public IEnumerable<Quest> GetCompletedQuests() => _gameStore.State.CompletedQuests.Select(name => _quests.All.FirstOrDefault(q => q.Name == name) is var q && q.Name != null ? q : new Quest(name, ""));
189+
public bool IsCompleted(string questName) => _gameStore.State.CompletedQuests.Contains(questName);
190+
189191
public void ClearCompletedQuests()
190192
{
191193
foreach(var q in _gameStore.State.CompletedQuests)

0 commit comments

Comments
 (0)