Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions ElectronicObserver/Data/Quest/ProgressData.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ElectronicObserver.Core.Types.Data;
using ElectronicObserver.Core.Types.Quests;
using ElectronicObserver.Core.Types.Serialization.Quests;

namespace ElectronicObserver.Data.Quest;

Expand Down Expand Up @@ -198,13 +200,31 @@ public virtual void ApplyTemporaryProgress(QuestData q)
}
}

public QuestResetType GetProgressResetType() => TryGetQuest()?.GetProgressResetType() ?? QuestResetType.Unknown;

private QuestData? TryGetQuest()
public QuestResetType GetProgressResetType()
{
if (!KCDatabase.Instance.Quest.Quests.ContainsKey(QuestID)) return null;
Dictionary<int, QuestMetadata> questsMetadata = KCDatabase.Instance.Translation.QuestsMetadata.QuestsMetadataList;

if (questsMetadata.TryGetValue(QuestID, out QuestMetadata? metadata) && metadata.QuestProgressResetType is { } resetType)
{
return resetType;
}

return KCDatabase.Instance.Quest[QuestID];
return QuestID switch
{
// Quests that are not daily but only appear on some days :
211 or 212 => QuestResetType.Daily, // 空母3 or 輸送5

// Some PVP quests
311 or
330 or
337 or
339 or
341 or
342 or
348 => QuestResetType.Daily,

_ => QuestResetType,
};
}

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions ElectronicObserver/Data/QuestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using ElectronicObserver.Core;
using ElectronicObserver.Core.Types.Data;
using ElectronicObserver.Core.Types.Extensions;
using ElectronicObserver.Core.Types.Quests;

namespace ElectronicObserver.Data;
Expand Down Expand Up @@ -53,7 +52,6 @@ public override void LoadFromResponse(string apiname, dynamic data)

var progress = KCDatabase.Instance.QuestProgress;


//周期任務削除
if (DateTimeHelper.IsCrossedDay(progress.LastUpdateTime, 5, 0, 0))
{
Expand Down