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
This commit is contained in:
parent
5de6edbeb8
commit
6c4308bce6
208 changed files with 660 additions and 793 deletions
|
|
@ -268,7 +268,7 @@ namespace Server.SkillHandlers
|
|||
}
|
||||
else
|
||||
{
|
||||
creature.BardEndTime = DateTime.UtcNow;
|
||||
creature.BardEndTime = Core.Now;
|
||||
}
|
||||
|
||||
creature.BardPacified = false;
|
||||
|
|
@ -324,7 +324,7 @@ namespace Server.SkillHandlers
|
|||
m_Creature = creature;
|
||||
m_MaxCount = count;
|
||||
m_Paralyzed = creature.Paralyzed;
|
||||
m_StartTime = DateTime.UtcNow;
|
||||
m_StartTime = Core.Now;
|
||||
Priority = TimerPriority.TwoFiftyMS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Server.SkillHandlers
|
|||
}
|
||||
}
|
||||
|
||||
if (ends && info.m_Ending && info.m_EndTime < DateTime.UtcNow)
|
||||
if (ends && info.m_Ending && info.m_EndTime < Core.Now)
|
||||
{
|
||||
info.m_Timer?.Stop();
|
||||
|
||||
|
|
@ -78,12 +78,12 @@ namespace Server.SkillHandlers
|
|||
if (ends && !info.m_Ending)
|
||||
{
|
||||
info.m_Ending = true;
|
||||
info.m_EndTime = DateTime.UtcNow + TimeSpan.FromSeconds(15);
|
||||
info.m_EndTime = Core.Now + TimeSpan.FromSeconds(15);
|
||||
}
|
||||
else if (!ends)
|
||||
{
|
||||
info.m_Ending = false;
|
||||
info.m_EndTime = DateTime.UtcNow;
|
||||
info.m_EndTime = Core.Now;
|
||||
}
|
||||
|
||||
targ.FixedEffect(0x376A, 1, 32);
|
||||
|
|
@ -104,7 +104,7 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
m_From = from;
|
||||
m_Creature = creature;
|
||||
m_EndTime = DateTime.UtcNow;
|
||||
m_EndTime = Core.Now;
|
||||
m_Ending = false;
|
||||
m_Effect = effect;
|
||||
m_Mods = mods;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace Server.SkillHandlers
|
|||
Target target = new InternalTargetSrc();
|
||||
m.Target = target;
|
||||
m.SendLocalizedMessage(1046295); // Target the book you wish to copy.
|
||||
target.BeginTimeout(m, TimeSpan.FromMinutes(1.0));
|
||||
target.BeginTimeout(m, 60000); // 1 minute
|
||||
|
||||
return TimeSpan.FromSeconds(1.0);
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ namespace Server.SkillHandlers
|
|||
Target target = new InternalTargetDst(book);
|
||||
from.Target = target;
|
||||
from.SendLocalizedMessage(501612); // Select a book to copy this to.
|
||||
target.BeginTimeout(from, TimeSpan.FromMinutes(1.0));
|
||||
target.BeginTimeout(from, 60000); // 1 minute
|
||||
SetUser(book, from);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ namespace Server.SkillHandlers
|
|||
|
||||
if (bc?.BardPacified == false)
|
||||
{
|
||||
bc.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(1.0));
|
||||
bc.Pacify(from, Core.Now + TimeSpan.FromSeconds(1.0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ namespace Server.SkillHandlers
|
|||
seconds = 10;
|
||||
}
|
||||
|
||||
bc.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(seconds));
|
||||
bc.Pacify(from, Core.Now + TimeSpan.FromSeconds(seconds));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
if (sig.IsBeingCorrupted)
|
||||
{
|
||||
sig.GraceStart = DateTime.UtcNow; // begin grace period
|
||||
sig.GraceStart = Core.Now; // begin grace period
|
||||
}
|
||||
|
||||
m_Thief.SendLocalizedMessage(1010586); // YOU STOLE THE SIGIL!!! (woah, calm down now)
|
||||
|
|
@ -193,7 +193,7 @@ namespace Server.SkillHandlers
|
|||
if (sig.LastMonolith?.Sigil != null)
|
||||
{
|
||||
sig.LastMonolith.Sigil = null;
|
||||
sig.LastStolen = DateTime.UtcNow;
|
||||
sig.LastStolen = Core.Now;
|
||||
}
|
||||
|
||||
return sig;
|
||||
|
|
@ -429,7 +429,7 @@ namespace Server.SkillHandlers
|
|||
Thief = thief;
|
||||
Victim = victim;
|
||||
|
||||
Expires = DateTime.UtcNow + StealTime;
|
||||
Expires = Core.Now + StealTime;
|
||||
}
|
||||
|
||||
public Item Stolen { get; }
|
||||
|
|
@ -440,7 +440,7 @@ namespace Server.SkillHandlers
|
|||
|
||||
public DateTime Expires { get; private set; }
|
||||
|
||||
public bool IsExpired => DateTime.UtcNow >= Expires;
|
||||
public bool IsExpired => Core.Now >= Expires;
|
||||
|
||||
public static void Add(Item item, Mobile thief, Mobile victim)
|
||||
{
|
||||
|
|
@ -489,7 +489,7 @@ namespace Server.SkillHandlers
|
|||
si.Victim.SendLocalizedMessage(1010463); // the item that was stolen from you falls to the ground.
|
||||
}
|
||||
|
||||
si.Expires = DateTime.UtcNow; // such a hack
|
||||
si.Expires = Core.Now; // such a hack
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue