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

@ -59,9 +59,9 @@ namespace Server.Items
{
m.SendLocalizedMessage( 1060197 ); // You are not dead, and thus cannot be resurrected!
}
else if ( m.AnkhNextUse > DateTime.Now )
else if ( m.AnkhNextUse > DateTime.UtcNow )
{
TimeSpan delay = m.AnkhNextUse - DateTime.Now;
TimeSpan delay = m.AnkhNextUse - DateTime.UtcNow;
if ( delay.TotalMinutes > 0 )
m.SendLocalizedMessage( 1079265, Math.Round( delay.TotalMinutes ).ToString() ); // You must wait ~1_minutes~ minutes before you can use this item.
@ -142,7 +142,7 @@ namespace Server.Items
if ( from is PlayerMobile )
{
((PlayerMobile) from).AnkhNextUse = DateTime.Now + TimeSpan.FromHours( 1 );
((PlayerMobile) from).AnkhNextUse = DateTime.UtcNow + TimeSpan.FromHours( 1 );
}
base.OnResponse( state, info );

View file

@ -273,7 +273,7 @@ namespace Server.Items
if ( m_Timer != null )
writer.Write( (DateTime) m_Timer.Next );
else
writer.Write( (DateTime) DateTime.Now + TimeSpan.FromDays( 1 ) );
writer.Write( (DateTime) DateTime.UtcNow + TimeSpan.FromDays( 1 ) );
}
public override void Deserialize( GenericReader reader )
@ -294,10 +294,10 @@ namespace Server.Items
DateTime next = reader.ReadDateTime();
if ( next < DateTime.Now )
next = DateTime.Now;
if ( next < DateTime.UtcNow )
next = DateTime.UtcNow;
m_Timer = Timer.DelayCall( next - DateTime.Now, TimeSpan.FromDays( 1 ), new TimerCallback( GiveResources ) );
m_Timer = Timer.DelayCall( next - DateTime.UtcNow, TimeSpan.FromDays( 1 ), new TimerCallback( GiveResources ) );
break;
}
}

View file

@ -134,7 +134,7 @@ namespace Server.Items
if ( m_Timer != null )
writer.Write( (DateTime) m_Timer.Next );
else
writer.Write( (DateTime) DateTime.Now + TimeSpan.FromDays( 1 ) );
writer.Write( (DateTime) DateTime.UtcNow + TimeSpan.FromDays( 1 ) );
}
public override void Deserialize( GenericReader reader )
@ -148,10 +148,10 @@ namespace Server.Items
DateTime next = reader.ReadDateTime();
if ( next < DateTime.Now )
next = DateTime.Now;
if ( next < DateTime.UtcNow )
next = DateTime.UtcNow;
m_Timer = Timer.DelayCall( next - DateTime.Now, TimeSpan.FromDays( 1 ), new TimerCallback( GiveLogs ) );
m_Timer = Timer.DelayCall( next - DateTime.UtcNow, TimeSpan.FromDays( 1 ), new TimerCallback( GiveLogs ) );
}
}