ModernUO/Projects/UOContent/Engines/Quests/Core/QuestRestartInfo.cs
Kamron Batman 6c4308bce6
fix(core): Caches DateTime.NowUtc (#548)
- [X] Caches DateTime.NowUtc on the game loop (not other threads)
- [X] Replaces all locations where it makes sense
- [X] Adds Min/Max for `IComparable` (TimeSpan, DateTimes, etc)

Closes #261
2021-03-13 01:32:04 -08:00

35 lines
814 B
C#

using System;
namespace Server.Engines.Quests
{
public class QuestRestartInfo
{
public QuestRestartInfo(Type questType, TimeSpan restartDelay)
{
QuestType = questType;
Reset(restartDelay);
}
public QuestRestartInfo(Type questType, DateTime restartTime)
{
QuestType = questType;
RestartTime = restartTime;
}
public Type QuestType { get; set; }
public DateTime RestartTime { get; set; }
public void Reset(TimeSpan restartDelay)
{
if (restartDelay < TimeSpan.MaxValue)
{
RestartTime = Core.Now + restartDelay;
}
else
{
RestartTime = DateTime.MaxValue;
}
}
}
}