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

@ -75,7 +75,7 @@ namespace Server.Mobiles
SayTo( from, 501047 ); // Thou art already a member of our guild.
else if ( pm.NpcGuild != NpcGuild.None )
SayTo( from, 501046 ); // Thou must resign from thy other guild first.
else if ( pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.Now )
else if ( pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.UtcNow )
SayTo( from, 501048 ); // You are too young to join my guild...
else if ( CheckCustomReqs( pm ) )
SayPriceTo( from );
@ -88,7 +88,7 @@ namespace Server.Mobiles
{
SayTo( from, 501052 ); // Thou dost not belong to my guild!
}
else if ( (pm.NpcGuildJoinTime + QuitAge) > DateTime.Now || (pm.NpcGuildGameTime + QuitGameAge) > pm.GameTime )
else if ( (pm.NpcGuildJoinTime + QuitAge) > DateTime.UtcNow || (pm.NpcGuildGameTime + QuitGameAge) > pm.GameTime )
{
SayTo( from, 501053 ); // You just joined my guild! You must wait a week to resign.
}
@ -119,7 +119,7 @@ namespace Server.Mobiles
{
SayTo( from, 501046 ); // Thou must resign from thy other guild first.
}
else if ( pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.Now )
else if ( pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.UtcNow )
{
SayTo( from, 501048 ); // You are too young to join my guild...
}
@ -128,7 +128,7 @@ namespace Server.Mobiles
SayWelcomeTo( from );
pm.NpcGuild = this.NpcGuild;
pm.NpcGuildJoinTime = DateTime.Now;
pm.NpcGuildJoinTime = DateTime.UtcNow;
pm.NpcGuildGameTime = pm.GameTime;
dropped.Delete();

View file

@ -31,13 +31,13 @@ namespace Server.Mobiles
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if ( DateTime.Now > m_NextCheckPack && InRange( m, 4 ) && !InRange( oldLocation, 4 ) && m.Player )
if ( DateTime.UtcNow > m_NextCheckPack && InRange( m, 4 ) && !InRange( oldLocation, 4 ) && m.Player )
{
Container pack = m.Backpack;
if ( pack != null )
{
m_NextCheckPack = DateTime.Now + TimeSpan.FromSeconds( 2.0 );
m_NextCheckPack = DateTime.UtcNow + TimeSpan.FromSeconds( 2.0 );
Item deed = pack.FindItemByType( typeof( HouseDeed ), false );

View file

@ -47,14 +47,14 @@ namespace Server.Mobiles
{
base.OnSpeech( e );
if ( !e.Handled && m_NextShush <= DateTime.Now && InLOS( e.Mobile ) )
if ( !e.Handled && m_NextShush <= DateTime.UtcNow && InLOS( e.Mobile ) )
{
Direction = GetDirectionTo( e.Mobile );
PlaySound( Female ? 0x32F : 0x441 );
PublicOverheadMessage( Network.MessageType.Regular, 0x3B2, 1073990 ); // Shhhh!
m_NextShush = DateTime.Now + ShushDelay;
m_NextShush = DateTime.UtcNow + ShushDelay;
e.Handled = true;
}
}