42 lines
1.0 KiB
C#
42 lines
1.0 KiB
C#
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;
|
|
}
|
|
}
|
|
} |