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

@ -124,13 +124,13 @@ namespace Server.Engines.ConPVP
public DateTime m_Expire;
public Mobile Ignored{ get{ return m_Ignored; } }
public bool Expired{ get{ return ( DateTime.Now >= m_Expire ); } }
public bool Expired{ get{ return ( DateTime.UtcNow >= m_Expire ); } }
private static TimeSpan ExpireDelay = TimeSpan.FromMinutes( 15.0 );
public void Refresh()
{
m_Expire = DateTime.Now + ExpireDelay;
m_Expire = DateTime.UtcNow + ExpireDelay;
}
public IgnoreEntry( Mobile ignored )

View file

@ -1156,7 +1156,7 @@ namespace Server.Engines.ConPVP
{
AggressorInfo info = m.Aggressed[i];
if ( info.Defender.Player && (DateTime.Now - info.LastCombatTime) < CombatDelay )
if ( info.Defender.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatDelay )
return true;
}
@ -1164,7 +1164,7 @@ namespace Server.Engines.ConPVP
{
AggressorInfo info = m.Aggressors[i];
if ( info.Attacker.Player && (DateTime.Now - info.LastCombatTime) < CombatDelay )
if ( info.Attacker.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatDelay )
return true;
}
@ -2050,14 +2050,14 @@ namespace Server.Engines.ConPVP
m_Mobile = mob;
m_Location = loc;
m_Facet = facet;
m_Expire = DateTime.Now + TimeSpan.FromMinutes( 30.0 );
m_Expire = DateTime.UtcNow + TimeSpan.FromMinutes( 30.0 );
}
public bool Expired{ get{ return ( DateTime.Now >= m_Expire ); } }
public bool Expired{ get{ return ( DateTime.UtcNow >= m_Expire ); } }
public void Update()
{
m_Expire = DateTime.Now + TimeSpan.FromMinutes( 30.0 );
m_Expire = DateTime.UtcNow + TimeSpan.FromMinutes( 30.0 );
if ( m_Mobile.Map == Map.Internal )
{

View file

@ -689,7 +689,7 @@ namespace Server.Engines.ConPVP
fmt = "As you wish m'{0}. The tournament will begin {1}, but first you must name your team.";
string timeUntil;
int minutesUntil = (int)Math.Round( ( (tourny.SignupStart + tourny.SignupPeriod) - DateTime.Now ).TotalMinutes );
int minutesUntil = (int)Math.Round( ( (tourny.SignupStart + tourny.SignupPeriod) - DateTime.UtcNow ).TotalMinutes );
if ( minutesUntil == 0 )
timeUntil = "momentarily";
@ -1263,7 +1263,7 @@ namespace Server.Engines.ConPVP
{
if ( m_Tournament.Stage == TournamentStage.Inactive )
{
m_Tournament.SignupStart = DateTime.Now;
m_Tournament.SignupStart = DateTime.UtcNow;
m_Tournament.Stage = TournamentStage.Signup;
m_Tournament.Participants.Clear();
m_Tournament.Pyramid.Levels.Clear();
@ -1940,7 +1940,7 @@ namespace Server.Engines.ConPVP
{
if ( m_Stage == TournamentStage.Signup )
{
TimeSpan until = ( m_SignupStart + m_SignupPeriod ) - DateTime.Now;
TimeSpan until = ( m_SignupStart + m_SignupPeriod ) - DateTime.UtcNow;
if ( until <= TimeSpan.Zero )
{
@ -1995,7 +1995,7 @@ namespace Server.Engines.ConPVP
else
{
Alert( "Is this all?", "Pitiful. Signup extended." );
m_SignupStart = DateTime.Now;
m_SignupStart = DateTime.UtcNow;
}
}
else if ( Math.Abs( until.TotalSeconds - TimeSpan.FromMinutes( 1.0 ).TotalSeconds ) < (SliceInterval.TotalSeconds/2) )
@ -2722,7 +2722,7 @@ namespace Server.Engines.ConPVP
if ( m_Tournament.Stage == TournamentStage.Signup )
{
TimeSpan until = ( m_Tournament.SignupStart + m_Tournament.SignupPeriod ) - DateTime.Now;
TimeSpan until = ( m_Tournament.SignupStart + m_Tournament.SignupPeriod ) - DateTime.UtcNow;
string text;
int secs = (int) until.TotalSeconds;

View file

@ -37,7 +37,7 @@ namespace Server.Items
{
m_Title = title;
m_Rank = rank;
m_Date = DateTime.Now;
m_Date = DateTime.UtcNow;
LootType = LootType.Blessed;