hermes-socket-library/Quests/Quest.cs

42 lines
1.0 KiB
C#
Raw Permalink Normal View History

2024-06-24 18:31:45 -04:00
namespace HermesSocketLibrary.Quests
{
public abstract class Quest
{
public short Id { get; }
public IQuestTask Task { get; }
public DateTime StartTime { get; }
public DateTime EndTime { get; }
public QuestType Type { get; protected set; }
public int Rewards { get; }
public Quest(short id, IQuestTask task, int rewards, DateTime start, DateTime end)
{
Id = id;
Task = task;
Rewards = rewards;
StartTime = start;
EndTime = end;
}
public bool IsDaily()
{
return Type.HasFlag(QuestType.Daily);
}
public bool IsWeekly()
{
return Type.HasFlag(QuestType.Weekly);
}
public bool IsMonthly()
{
return Type.HasFlag(QuestType.Monthly);
}
public bool IsOngoing()
{
var now = DateTime.UtcNow;
return now >= StartTime && now <= EndTime;
}
}
}