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
|
|
@ -94,7 +94,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
SayTo(pm, 501046); // Thou must resign from thy other guild first.
|
||||
}
|
||||
else if (pm.GameTime < JoinGameAge || pm.CreationTime + JoinAge > DateTime.UtcNow)
|
||||
else if (pm.GameTime < JoinGameAge || pm.CreationTime + JoinAge > Core.Now)
|
||||
{
|
||||
SayTo(pm, 501048); // You are too young to join my guild...
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
SayTo(pm, 501052); // Thou dost not belong to my guild!
|
||||
}
|
||||
else if (pm.NpcGuildJoinTime + QuitAge > DateTime.UtcNow ||
|
||||
else if (pm.NpcGuildJoinTime + QuitAge > Core.Now ||
|
||||
pm.NpcGuildGameTime + QuitGameAge > pm.GameTime)
|
||||
{
|
||||
SayTo(pm, 501053); // You just joined my guild! You must wait a week to resign.
|
||||
|
|
@ -141,7 +141,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
SayTo(pm, 501046); // Thou must resign from thy other guild first.
|
||||
}
|
||||
else if (pm.GameTime < JoinGameAge || pm.CreationTime + JoinAge > DateTime.UtcNow)
|
||||
else if (pm.GameTime < JoinGameAge || pm.CreationTime + JoinAge > Core.Now)
|
||||
{
|
||||
SayTo(pm, 501048); // You are too young to join my guild...
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ namespace Server.Mobiles
|
|||
SayWelcomeTo(pm);
|
||||
|
||||
pm.NpcGuild = NpcGuild;
|
||||
pm.NpcGuildJoinTime = DateTime.UtcNow;
|
||||
pm.NpcGuildJoinTime = Core.Now;
|
||||
pm.NpcGuildGameTime = pm.GameTime;
|
||||
|
||||
dropped.Delete();
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnMovement(Mobile m, Point3D oldLocation)
|
||||
{
|
||||
if (DateTime.UtcNow > m_NextCheckPack && InRange(m, 4) && !InRange(oldLocation, 4) && m.Player)
|
||||
if (Core.Now > m_NextCheckPack && InRange(m, 4) && !InRange(oldLocation, 4) && m.Player)
|
||||
{
|
||||
var pack = m.Backpack;
|
||||
|
||||
if (pack != null)
|
||||
{
|
||||
m_NextCheckPack = DateTime.UtcNow + TimeSpan.FromSeconds(2.0);
|
||||
m_NextCheckPack = Core.Now + TimeSpan.FromSeconds(2.0);
|
||||
|
||||
if (pack.FindItemByType<HouseDeed>(false) != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,14 +47,14 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.OnSpeech(e);
|
||||
|
||||
if (!e.Handled && m_NextShush <= DateTime.UtcNow && InLOS(e.Mobile))
|
||||
if (!e.Handled && m_NextShush <= Core.Now && InLOS(e.Mobile))
|
||||
{
|
||||
Direction = GetDirectionTo(e.Mobile);
|
||||
|
||||
PlaySound(Female ? 0x32F : 0x441);
|
||||
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1073990); // Shhhh!
|
||||
|
||||
m_NextShush = DateTime.UtcNow + ShushDelay;
|
||||
m_NextShush = Core.Now + ShushDelay;
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue