Implement Core.TickCount

Convert movement, actions (lift/use), combat, and spells to use Core.TickCount and avoid DateTime caveats (performance, system time dependency, etc)
Refactor DateTime.Now to DateTime.UtcNow
Add LOS check for Iron Maiden addon
This commit is contained in:
Mark Sturgill 2013-10-06 03:21:18 -07:00
parent f99eefb288
commit d2c670f5c3
241 changed files with 842 additions and 831 deletions

View file

@ -86,7 +86,7 @@ namespace Server.Engines.Help
{
AggressorInfo info = m.Aggressed[i];
if ( DateTime.Now - info.LastCombatTime < TimeSpan.FromSeconds( 30.0 ) )
if ( DateTime.UtcNow - info.LastCombatTime < TimeSpan.FromSeconds( 30.0 ) )
return true;
}

View file

@ -143,7 +143,7 @@ namespace Server.Engines.Help
public PageEntry( Mobile sender, string message, PageType type )
{
m_Sender = sender;
m_Sent = DateTime.Now;
m_Sent = DateTime.UtcNow;
m_Message = Utility.FixHtml( message );
m_Type = type;
m_PageLocation = sender.Location;
@ -338,7 +338,7 @@ namespace Server.Engines.Help
if ( m != null && m.AccessLevel >= AccessLevel.Counselor && m.AutoPageNotify && !IsHandling( m ) )
m.SendMessage( "A new page has been placed in the queue." );
if ( m != null && m.AccessLevel >= AccessLevel.Counselor && m.AutoPageNotify && m.LastMoveTime >= (DateTime.Now - TimeSpan.FromMinutes( 10.0 )) )
if (m != null && m.AccessLevel >= AccessLevel.Counselor && m.AutoPageNotify && Core.TickCount - m.LastMoveTime < 600000)
isStaffOnline = true;
}
@ -352,7 +352,7 @@ namespace Server.Engines.Help
private static void SendEmail( PageEntry entry )
{
Mobile sender = entry.Sender;
DateTime time = DateTime.Now;
DateTime time = DateTime.UtcNow;
MailMessage mail = new MailMessage( Email.FromAddress, Email.SpeechLogPageAddresses );

View file

@ -97,7 +97,7 @@ namespace Server.Engines.Help
{
SpeechLogEntry entry = (SpeechLogEntry) m_Queue.Peek();
if ( DateTime.Now - entry.Created > EntryDuration )
if ( DateTime.UtcNow - entry.Created > EntryDuration )
m_Queue.Dequeue();
else
break;
@ -142,7 +142,7 @@ namespace Server.Engines.Help
{
m_From = from;
m_Speech = speech;
m_Created = DateTime.Now;
m_Created = DateTime.UtcNow;
}
}
}

View file

@ -219,12 +219,12 @@ namespace Server.Menus.Questions
public CloseTimer( Mobile m ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 1.0 ) )
{
m_Mobile = m;
m_End = DateTime.Now + TimeSpan.FromMinutes( 3.0 );
m_End = DateTime.UtcNow + TimeSpan.FromMinutes( 3.0 );
}
protected override void OnTick()
{
if ( m_Mobile.NetState == null || DateTime.Now > m_End )
if ( m_Mobile.NetState == null || DateTime.UtcNow > m_End )
{
m_Mobile.Frozen = false;
m_Mobile.CloseGump( typeof( StuckMenu ) );
@ -250,12 +250,12 @@ namespace Server.Menus.Questions
m_Mobile = mobile;
m_Destination = destination;
m_End = DateTime.Now + delay;
m_End = DateTime.UtcNow + delay;
}
protected override void OnTick()
{
if ( DateTime.Now < m_End )
if ( DateTime.UtcNow < m_End )
{
m_Mobile.Frozen = true;
}