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

@ -31,7 +31,7 @@ namespace Server
Console.WriteLine( "Client: {0}: Past IP limit threshold", ip );
using ( StreamWriter op = new StreamWriter( "ipLimits.log", true ) )
op.WriteLine( "{0}\tPast IP limit threshold\t{1}", ip, DateTime.Now );
op.WriteLine( "{0}\tPast IP limit threshold\t{1}", ip, DateTime.UtcNow );
e.AllowConnection = false;
return;

View file

@ -177,7 +177,7 @@ namespace Server.Accounting
if ( GetBanTags( out banTime, out banDuration ) )
{
if ( banDuration != TimeSpan.MaxValue && DateTime.Now >= ( banTime + banDuration ) )
if ( banDuration != TimeSpan.MaxValue && DateTime.UtcNow >= ( banTime + banDuration ) )
{
SetUnspecifiedBan( null ); // clear
Banned = false;
@ -235,7 +235,7 @@ namespace Server.Accounting
if( this.AccessLevel != AccessLevel.Player )
return false;
TimeSpan inactiveLength = DateTime.Now - m_LastLogin;
TimeSpan inactiveLength = DateTime.UtcNow - m_LastLogin;
return (inactiveLength > ((this.Count == 0) ? EmptyInactiveDuration : InactiveDuration));
}
@ -254,7 +254,7 @@ namespace Server.Accounting
PlayerMobile m = m_Mobiles[i] as PlayerMobile;
if ( m != null && m.NetState != null )
return m_TotalGameTime + ( DateTime.Now - m.SessionStart );
return m_TotalGameTime + ( DateTime.UtcNow - m.SessionStart );
}
return m_TotalGameTime;
@ -528,7 +528,7 @@ namespace Server.Accounting
if ( m == null )
return;
acc.m_TotalGameTime += DateTime.Now - m.SessionStart;
acc.m_TotalGameTime += DateTime.UtcNow - m.SessionStart;
}
private static void EventSink_Login( LoginEventArgs e )
@ -607,7 +607,7 @@ namespace Server.Accounting
m_AccessLevel = AccessLevel.Player;
m_Created = m_LastLogin = DateTime.Now;
m_Created = m_LastLogin = DateTime.UtcNow;
m_TotalGameTime = TimeSpan.Zero;
m_Mobiles = new Mobile[7];
@ -674,8 +674,8 @@ namespace Server.Accounting
m_AccessLevel = (AccessLevel)Enum.Parse( typeof( AccessLevel ), Utility.GetText( node["accessLevel"], "Player" ), true );
#endif
m_Flags = Utility.GetXMLInt32( Utility.GetText( node["flags"], "0" ), 0 );
m_Created = Utility.GetXMLDateTime( Utility.GetText( node["created"], null ), DateTime.Now );
m_LastLogin = Utility.GetXMLDateTime( Utility.GetText( node["lastLogin"], null ), DateTime.Now );
m_Created = Utility.GetXMLDateTime( Utility.GetText( node["created"], null ), DateTime.UtcNow );
m_LastLogin = Utility.GetXMLDateTime( Utility.GetText( node["lastLogin"], null ), DateTime.UtcNow );
m_Mobiles = LoadMobiles( node );
m_Comments = LoadComments( node );

View file

@ -30,7 +30,7 @@ namespace Server.Accounting
if ( accessLog == null )
return true;
return ( DateTime.Now >= (accessLog.LastAccessTime + ComputeThrottle( accessLog.Counts )) );
return ( DateTime.UtcNow >= (accessLog.LastAccessTime + ComputeThrottle( accessLog.Counts )) );
}
private static List<InvalidAccountAccessLog> m_List = new List<InvalidAccountAccessLog>();
@ -73,7 +73,7 @@ namespace Server.Accounting
using ( StreamWriter op = new StreamWriter( "throttle.log", true ) ) {
op.WriteLine(
"{0}\t{1}\t{2}",
DateTime.Now,
DateTime.UtcNow,
ns,
accessLog.Counts
);
@ -125,7 +125,7 @@ namespace Server.Accounting
public bool HasExpired
{
get{ return ( DateTime.Now >= ( m_LastAccessTime + TimeSpan.FromHours( 1.0 ) ) ); }
get{ return ( DateTime.UtcNow >= ( m_LastAccessTime + TimeSpan.FromHours( 1.0 ) ) ); }
}
public int Counts
@ -136,7 +136,7 @@ namespace Server.Accounting
public void RefreshAccessTime()
{
m_LastAccessTime = DateTime.Now;
m_LastAccessTime = DateTime.UtcNow;
}
public InvalidAccountAccessLog( IPAddress address )

View file

@ -23,7 +23,7 @@ namespace Server.Accounting
public string Content
{
get{ return m_Content; }
set{ m_Content = value; m_LastModified = DateTime.Now; }
set{ m_Content = value; m_LastModified = DateTime.UtcNow; }
}
/// <summary>
@ -43,7 +43,7 @@ namespace Server.Accounting
{
m_AddedBy = addedBy;
m_Content = content;
m_LastModified = DateTime.Now;
m_LastModified = DateTime.UtcNow;
}
/// <summary>
@ -53,7 +53,7 @@ namespace Server.Accounting
public AccountComment( XmlElement node )
{
m_AddedBy = Utility.GetAttribute( node, "addedBy", "empty" );
m_LastModified = Utility.GetXMLDateTime( Utility.GetAttribute( node, "lastModified" ), DateTime.Now );
m_LastModified = Utility.GetXMLDateTime( Utility.GetAttribute( node, "lastModified" ), DateTime.UtcNow );
m_Content = Utility.GetText( node, "" );
}

View file

@ -197,7 +197,7 @@ namespace Server.Misc
state.Send( new DeleteResult( DeleteResultType.CharBeingPlayed ) );
state.Send( new CharacterListUpdate( acct ) );
}
else if ( RestrictDeletion && DateTime.Now < (m.CreationTime + DeleteDelay) )
else if ( RestrictDeletion && DateTime.UtcNow < (m.CreationTime + DeleteDelay) )
{
state.Send( new DeleteResult( DeleteResultType.CharTooYoung ) );
state.Send( new CharacterListUpdate( acct ) );
@ -306,7 +306,7 @@ namespace Server.Misc
Console.WriteLine( "Login: {0}: Past IP limit threshold", e.State );
using ( StreamWriter op = new StreamWriter( "ipLimits.log", true ) )
op.WriteLine( "{0}\tPast IP limit threshold\t{1}", e.State, DateTime.Now );
op.WriteLine( "{0}\tPast IP limit threshold\t{1}", e.State, DateTime.UtcNow );
return;
}
@ -370,7 +370,7 @@ namespace Server.Misc
Console.WriteLine( "Login: {0}: Past IP limit threshold", e.State );
using ( StreamWriter op = new StreamWriter( "ipLimits.log", true ) )
op.WriteLine( "{0}\tPast IP limit threshold\t{1}", e.State, DateTime.Now );
op.WriteLine( "{0}\tPast IP limit threshold\t{1}", e.State, DateTime.UtcNow );
return;
}

View file

@ -93,12 +93,12 @@ namespace Server.Commands
return;
}
DateTime time = DateTime.Now;
DateTime time = DateTime.UtcNow;
int built = BuildObjects( from, type, start, end, args, props, packs, outline, mapAvg );
if ( built > 0 )
from.SendMessage( "{0} object{1} generated in {2:F1} seconds.", built, built != 1 ? "s" : "", (DateTime.Now - time).TotalSeconds );
from.SendMessage( "{0} object{1} generated in {2:F1} seconds.", built, built != 1 ? "s" : "", (DateTime.UtcNow - time).TotalSeconds );
else
SendUsage( type, from );
}

View file

@ -28,11 +28,11 @@ namespace Server.Commands
Network.NetState.FlushAll();
Network.NetState.Pause();
DateTime startTime = DateTime.Now;
DateTime startTime = DateTime.UtcNow;
bool generated = Document();
DateTime endTime = DateTime.Now;
DateTime endTime = DateTime.UtcNow;
Network.NetState.Resume();

View file

@ -28,12 +28,12 @@ namespace Server.Commands
try
{
m_Output = new StreamWriter( Path.Combine( directory, String.Format( "{0}.log", DateTime.Now.ToLongDateString() ) ), true );
m_Output = new StreamWriter( Path.Combine( directory, String.Format( "{0}.log", DateTime.UtcNow.ToLongDateString() ) ), true );
m_Output.AutoFlush = true;
m_Output.WriteLine( "##############################" );
m_Output.WriteLine( "Log started on {0}", DateTime.Now );
m_Output.WriteLine( "Log started on {0}", DateTime.UtcNow );
m_Output.WriteLine();
}
catch
@ -77,7 +77,7 @@ namespace Server.Commands
try
{
m_Output.WriteLine( "{0}: {1}: {2}", DateTime.Now, from.NetState, text );
m_Output.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, from.NetState, text );
string path = Core.BaseDirectory;
@ -91,7 +91,7 @@ namespace Server.Commands
path = Path.Combine( path, String.Format( "{0}.log", name ) );
using ( StreamWriter sw = new StreamWriter( path, true ) )
sw.WriteLine( "{0}: {1}: {2}", DateTime.Now, from.NetState, text );
sw.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, from.NetState, text );
}
catch
{

View file

@ -29,7 +29,7 @@ namespace Server.Commands
{
using ( StreamWriter sw = new StreamWriter( "profiles.log", true ) )
{
sw.WriteLine( "# Dump on {0:f}", DateTime.Now );
sw.WriteLine( "# Dump on {0:f}", DateTime.UtcNow );
sw.WriteLine( "# Core profiling for " + Core.ProfileTime );
sw.WriteLine( "# Packet send" );
@ -169,7 +169,7 @@ namespace Server.Commands
items.Sort( new CountSorter() );
mobiles.Sort( new CountSorter() );
op.WriteLine( "# Object count table generated on {0}", DateTime.Now );
op.WriteLine( "# Object count table generated on {0}", DateTime.UtcNow );
op.WriteLine();
op.WriteLine();
@ -388,7 +388,7 @@ namespace Server.Commands
using ( StreamWriter op = new StreamWriter( opFile ) )
{
op.WriteLine( "# Profile of world {0}", type );
op.WriteLine( "# Generated on {0}", DateTime.Now );
op.WriteLine( "# Generated on {0}", DateTime.UtcNow );
op.WriteLine();
op.WriteLine();

View file

@ -13,7 +13,7 @@ namespace Server.Commands
[Description( "Returns the server's local time." )]
private static void Time_OnCommand( CommandEventArgs e )
{
e.Mobile.SendMessage( DateTime.Now.ToString() );
e.Mobile.SendMessage( DateTime.UtcNow.ToString() );
}
}
}

View file

@ -381,7 +381,7 @@ namespace Server.Engines.CannedEvil
if( m_RestartTimer != null )
m_RestartTimer.Stop();
m_RestartTime = DateTime.Now + ts;
m_RestartTime = DateTime.UtcNow + ts;
m_RestartTimer = new RestartTimer( this, ts );
m_RestartTimer.Start();
@ -611,7 +611,7 @@ namespace Server.Engines.CannedEvil
else if( p > 0 )
SetWhiteSkullCount( p / 20 );
if( DateTime.Now >= m_ExpireTime )
if( DateTime.UtcNow >= m_ExpireTime )
Expire();
Respawn();
@ -620,7 +620,7 @@ namespace Server.Engines.CannedEvil
public void AdvanceLevel()
{
m_ExpireTime = DateTime.Now + m_ExpireDelay;
m_ExpireTime = DateTime.UtcNow + m_ExpireDelay;
if( Level < 16 )
{
@ -822,7 +822,7 @@ namespace Server.Engines.CannedEvil
SetWhiteSkullCount( 0 );
}
m_ExpireTime = DateTime.Now + m_ExpireDelay;
m_ExpireTime = DateTime.UtcNow + m_ExpireDelay;
}
public Point3D GetRedSkullLocation( int index )
@ -1234,7 +1234,7 @@ namespace Server.Engines.CannedEvil
if( reader.ReadBool() )
{
m_RestartTime = reader.ReadDeltaTime();
BeginRestart( m_RestartTime - DateTime.Now );
BeginRestart( m_RestartTime - DateTime.UtcNow );
}
if( version < 4 )

View file

@ -32,7 +32,7 @@ namespace Server.Items
if ( decays )
{
m_Decays = true;
m_DecayTime = DateTime.Now + TimeSpan.FromMinutes( 2.0 );
m_DecayTime = DateTime.UtcNow + TimeSpan.FromMinutes( 2.0 );
m_Timer = new InternalTimer( this, m_DecayTime );
m_Timer.Start();
@ -92,7 +92,7 @@ namespace Server.Items
{
private Item m_Item;
public InternalTimer( Item item, DateTime end ) : base( end - DateTime.Now )
public InternalTimer( Item item, DateTime end ) : base( end - DateTime.UtcNow )
{
m_Item = item;
}

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;

View file

@ -79,7 +79,7 @@ namespace Server.Ethics
if ( m_Shield == DateTime.MinValue )
return false;
if ( DateTime.Now < ( m_Shield + TimeSpan.FromHours( 1.0 ) ) )
if ( DateTime.UtcNow < ( m_Shield + TimeSpan.FromHours( 1.0 ) ) )
return true;
FinishShield();
@ -89,7 +89,7 @@ namespace Server.Ethics
public void BeginShield()
{
m_Shield = DateTime.Now;
m_Shield = DateTime.UtcNow;
}
public void FinishShield()

View file

@ -26,7 +26,7 @@ namespace Server.Factions
public List<Candidate> Candidates { get { return m_Candidates; } }
public ElectionState State{ get{ return m_State; } set{ m_State = value; m_LastStateTime = DateTime.Now; } }
public ElectionState State{ get{ return m_State; } set{ m_State = value; m_LastStateTime = DateTime.UtcNow; } }
public DateTime LastStateTime{ get{ return m_LastStateTime; } }
[CommandProperty( AccessLevel.GameMaster )]
@ -47,7 +47,7 @@ namespace Server.Factions
case ElectionState.Campaign: period = CampaignPeriod; break;
}
TimeSpan until = (m_LastStateTime + period) - DateTime.Now;
TimeSpan until = (m_LastStateTime + period) - DateTime.UtcNow;
if ( until < TimeSpan.Zero )
until = TimeSpan.Zero;
@ -66,7 +66,7 @@ namespace Server.Factions
case ElectionState.Campaign: period = CampaignPeriod; break;
}
m_LastStateTime = DateTime.Now - period + value;
m_LastStateTime = DateTime.UtcNow - period + value;
}
}
@ -280,7 +280,7 @@ namespace Server.Factions
{
case ElectionState.Pending:
{
if ( (m_LastStateTime + PendingPeriod) > DateTime.Now )
if ( (m_LastStateTime + PendingPeriod) > DateTime.UtcNow )
break;
m_Faction.Broadcast( 1038023 ); // Campaigning for the Faction Commander election has begun.
@ -292,7 +292,7 @@ namespace Server.Factions
}
case ElectionState.Campaign:
{
if ( (m_LastStateTime + CampaignPeriod) > DateTime.Now )
if ( (m_LastStateTime + CampaignPeriod) > DateTime.UtcNow )
break;
if ( m_Candidates.Count == 0 )
@ -332,7 +332,7 @@ namespace Server.Factions
}
case ElectionState.Election:
{
if ( (m_LastStateTime + VotingPeriod) > DateTime.Now )
if ( (m_LastStateTime + VotingPeriod) > DateTime.UtcNow )
break;
m_Faction.Broadcast( 1038024 ); // The results for the Faction Commander election are in
@ -445,7 +445,7 @@ namespace Server.Factions
else
m_Address = IPAddress.None;
m_Time = DateTime.Now;
m_Time = DateTime.UtcNow;
}
public Voter( GenericReader reader, Mobile candidate )

View file

@ -218,7 +218,7 @@ namespace Server.Factions
}
else
{
recvState.LastHonorTime = DateTime.Now;
recvState.LastHonorTime = DateTime.UtcNow;
giveState.KillPoints -= 5;
recvState.KillPoints += 4;
@ -552,7 +552,7 @@ namespace Server.Factions
if ( pl == null || !pl.IsLeaving )
return false;
if ( (pl.Leaving + LeavePeriod) >= DateTime.Now )
if ( (pl.Leaving + LeavePeriod) >= DateTime.UtcNow )
return false;
mob.SendLocalizedMessage( 1005163 ); // You have now quit your faction
@ -833,12 +833,12 @@ namespace Server.Factions
{
Sigil sigil = sigils[i];
if ( !sigil.IsBeingCorrupted && sigil.GraceStart != DateTime.MinValue && (sigil.GraceStart + Sigil.CorruptionGrace) < DateTime.Now )
if ( !sigil.IsBeingCorrupted && sigil.GraceStart != DateTime.MinValue && (sigil.GraceStart + Sigil.CorruptionGrace) < DateTime.UtcNow )
{
if ( sigil.LastMonolith is StrongholdMonolith && ( sigil.Corrupted == null || sigil.LastMonolith.Faction != sigil.Corrupted ))
{
sigil.Corrupting = sigil.LastMonolith.Faction;
sigil.CorruptionStart = DateTime.Now;
sigil.CorruptionStart = DateTime.UtcNow;
}
else
{
@ -851,19 +851,19 @@ namespace Server.Factions
if ( sigil.LastMonolith == null || sigil.LastMonolith.Sigil == null )
{
if ( (sigil.LastStolen + Sigil.ReturnPeriod) < DateTime.Now )
if ( (sigil.LastStolen + Sigil.ReturnPeriod) < DateTime.UtcNow )
sigil.ReturnHome();
}
else
{
if ( sigil.IsBeingCorrupted && (sigil.CorruptionStart + Sigil.CorruptionPeriod) < DateTime.Now )
if ( sigil.IsBeingCorrupted && (sigil.CorruptionStart + Sigil.CorruptionPeriod) < DateTime.UtcNow )
{
sigil.Corrupted = sigil.Corrupting;
sigil.Corrupting = null;
sigil.CorruptionStart = DateTime.MinValue;
sigil.GraceStart = DateTime.MinValue;
}
else if ( sigil.IsPurifying && (sigil.PurificationStart + Sigil.PurificationPeriod) < DateTime.Now )
else if ( sigil.IsPurifying && (sigil.PurificationStart + Sigil.PurificationPeriod) < DateTime.UtcNow )
{
sigil.PurificationStart = DateTime.MinValue;
sigil.Corrupted = null;

View file

@ -26,13 +26,13 @@ namespace Server.Factions
if ( m_Item == null || m_Item.Deleted )
return true;
return ( m_Expiration != DateTime.MinValue && DateTime.Now >= m_Expiration );
return ( m_Expiration != DateTime.MinValue && DateTime.UtcNow >= m_Expiration );
}
}
public void StartExpiration()
{
m_Expiration = DateTime.Now + ExpirationPeriod;
m_Expiration = DateTime.UtcNow + ExpirationPeriod;
}
public void CheckAttach()

View file

@ -28,7 +28,7 @@ namespace Server.Factions
{
for ( int i = 0; i < m_LastBroadcasts.Length; ++i )
{
if ( DateTime.Now >= (m_LastBroadcasts[i] + BroadcastPeriod) )
if ( DateTime.UtcNow >= (m_LastBroadcasts[i] + BroadcastPeriod) )
return true;
}
@ -36,15 +36,15 @@ namespace Server.Factions
}
}
public bool IsAtrophyReady{ get{ return DateTime.Now >= (m_LastAtrophy + TimeSpan.FromHours( 47.0 )); } }
public bool IsAtrophyReady{ get{ return DateTime.UtcNow >= (m_LastAtrophy + TimeSpan.FromHours( 47.0 )); } }
public int CheckAtrophy()
{
if ( DateTime.Now < (m_LastAtrophy + TimeSpan.FromHours( 47.0 )) )
if ( DateTime.UtcNow < (m_LastAtrophy + TimeSpan.FromHours( 47.0 )) )
return 0;
int distrib = 0;
m_LastAtrophy = DateTime.Now;
m_LastAtrophy = DateTime.UtcNow;
List<PlayerState> members = new List<PlayerState>( m_Members );
@ -72,9 +72,9 @@ namespace Server.Factions
{
for ( int i = 0; i < m_LastBroadcasts.Length; ++i )
{
if ( DateTime.Now >= (m_LastBroadcasts[i] + BroadcastPeriod) )
if ( DateTime.UtcNow >= (m_LastBroadcasts[i] + BroadcastPeriod) )
{
m_LastBroadcasts[i] = DateTime.Now;
m_LastBroadcasts[i] = DateTime.UtcNow;
break;
}
}
@ -193,7 +193,7 @@ namespace Server.Factions
m_Commander = reader.ReadMobile();
if ( version < 5 )
m_LastAtrophy = DateTime.Now;
m_LastAtrophy = DateTime.UtcNow;
if ( version < 4 )
{

View file

@ -104,7 +104,7 @@ namespace Server.Factions
if ( Faction.CheckLeaveTimer( from ) )
break;
TimeSpan remaining = ( pl.Leaving + Faction.LeavePeriod ) - DateTime.Now;
TimeSpan remaining = ( pl.Leaving + Faction.LeavePeriod ) - DateTime.UtcNow;
if( remaining.TotalDays >= 1 )
from.SendLocalizedMessage( 1042743, remaining.TotalDays.ToString( "N0" ) ) ;// Your term of service will come to an end in ~1_DAYS~ days.

View file

@ -12,12 +12,12 @@ namespace Server.Factions
public Mobile GivenTo{ get{ return m_GivenTo; } }
public DateTime TimeOfGift{ get{ return m_TimeOfGift; } }
public bool IsExpired{ get{ return ( m_TimeOfGift + ExpirePeriod ) < DateTime.Now; } }
public bool IsExpired{ get{ return ( m_TimeOfGift + ExpirePeriod ) < DateTime.UtcNow; } }
public SilverGivenEntry( Mobile givenTo )
{
m_GivenTo = givenTo;
m_TimeOfGift = DateTime.Now;
m_TimeOfGift = DateTime.UtcNow;
}
}
}

View file

@ -67,7 +67,7 @@ namespace Server.Factions
public bool TaxChangeReady
{
get{ return ( m_State.LastTaxChange + TaxChangePeriod ) < DateTime.Now; }
get{ return ( m_State.LastTaxChange + TaxChangePeriod ) < DateTime.UtcNow; }
}
public static Town FromRegion( Region reg )
@ -224,7 +224,7 @@ namespace Server.Factions
public void CheckIncome()
{
if ( (LastIncome + IncomePeriod) > DateTime.Now || Owner == null )
if ( (LastIncome + IncomePeriod) > DateTime.UtcNow || Owner == null )
return;
ProcessIncome();
@ -232,7 +232,7 @@ namespace Server.Factions
public void ProcessIncome()
{
LastIncome = DateTime.Now;
LastIncome = DateTime.UtcNow;
int flow = NetCashFlow;
@ -447,7 +447,7 @@ namespace Server.Factions
if ( m_State.Owner == null ) // going from unowned to owned
{
LastIncome = DateTime.Now;
LastIncome = DateTime.UtcNow;
f.Silver += SilverCaptureBonus;
}
else if ( f == null ) // going from owned to unowned

View file

@ -55,7 +55,7 @@ namespace Server.Factions
{
case ElectionState.Pending:
{
TimeSpan toGo = ( election.LastStateTime + Election.PendingPeriod ) - DateTime.Now;
TimeSpan toGo = ( election.LastStateTime + Election.PendingPeriod ) - DateTime.UtcNow;
int days = (int) (toGo.TotalDays + 0.5);
AddHtmlLocalized( 20, 40, 380, 20, 1038034, false, false ); // A new election campaign is pending
@ -74,7 +74,7 @@ namespace Server.Factions
}
case ElectionState.Campaign:
{
TimeSpan toGo = ( election.LastStateTime + Election.CampaignPeriod ) - DateTime.Now;
TimeSpan toGo = ( election.LastStateTime + Election.CampaignPeriod ) - DateTime.UtcNow;
int days = (int) (toGo.TotalDays + 0.5);
AddHtmlLocalized( 20, 40, 380, 20, 1018058, false, false ); // There is an election campaign in progress.
@ -106,7 +106,7 @@ namespace Server.Factions
}
case ElectionState.Election:
{
TimeSpan toGo = ( election.LastStateTime + Election.VotingPeriod ) - DateTime.Now;
TimeSpan toGo = ( election.LastStateTime + Election.VotingPeriod ) - DateTime.UtcNow;
int days = (int) Math.Ceiling( toGo.TotalDays );
AddHtmlLocalized( 20, 40, 380, 20, 1018060, false, false ); // There is an election vote in progress.

View file

@ -211,7 +211,7 @@ namespace Server.Factions
if ( m_From.AccessLevel == AccessLevel.Player && !m_Town.TaxChangeReady )
{
TimeSpan remaining = DateTime.Now - ( m_Town.LastTaxChange + Town.TaxChangePeriod );
TimeSpan remaining = DateTime.UtcNow - ( m_Town.LastTaxChange + Town.TaxChangePeriod );
if ( remaining.TotalMinutes < 4 )
m_From.SendLocalizedMessage( 1042165 ); // You must wait a short while before changing prices again.
@ -229,7 +229,7 @@ namespace Server.Factions
m_Town.Tax = newTax;
if ( m_From.AccessLevel == AccessLevel.Player )
m_Town.LastTaxChange = DateTime.Now;
m_Town.LastTaxChange = DateTime.UtcNow;
}
break;

View file

@ -46,7 +46,7 @@ namespace Server.Factions
if ( pl != null )
{
pl.Leaving = DateTime.Now;
pl.Leaving = DateTime.UtcNow;
if ( Faction.LeavePeriod == TimeSpan.FromDays( 3.0 ) )
m_From.SendLocalizedMessage( 1005065 ); // You will be removed from the faction in 3 days
@ -69,7 +69,7 @@ namespace Server.Factions
if ( pl != null )
{
pl.Leaving = DateTime.Now;
pl.Leaving = DateTime.UtcNow;
if ( Faction.LeavePeriod == TimeSpan.FromDays( 3.0 ) )
mob.SendLocalizedMessage( 1005060 ); // Your guild will quit the faction in 3 days

View file

@ -233,7 +233,7 @@ namespace Server.Factions
private void BeginCorrupting( Faction faction )
{
m_Corrupting = faction;
m_CorruptionStart = DateTime.Now;
m_CorruptionStart = DateTime.UtcNow;
}
private void ClearCorrupting()
@ -250,7 +250,7 @@ namespace Server.Factions
if ( !IsBeingCorrupted )
return TimeSpan.Zero;
TimeSpan ts = ( m_CorruptionStart + CorruptionPeriod ) - DateTime.Now;
TimeSpan ts = ( m_CorruptionStart + CorruptionPeriod ) - DateTime.UtcNow;
if ( ts < TimeSpan.Zero )
ts = TimeSpan.Zero;
@ -319,7 +319,7 @@ namespace Server.Factions
if ( m_Corrupted != newController )
BeginCorrupting( newController );
}
else if ( m_GraceStart > DateTime.MinValue && (m_GraceStart + CorruptionGrace) < DateTime.Now )
else if ( m_GraceStart > DateTime.MinValue && (m_GraceStart + CorruptionGrace) < DateTime.UtcNow )
{
if ( m_Corrupted != newController )
BeginCorrupting( newController ); // grace time over, reset period
@ -334,7 +334,7 @@ namespace Server.Factions
}
else if ( m_GraceStart == DateTime.MinValue )
{
m_GraceStart = DateTime.Now;
m_GraceStart = DateTime.UtcNow;
}
m_PurificationStart = DateTime.MinValue;
@ -356,7 +356,7 @@ namespace Server.Factions
m.Sigil = this;
m_Corrupting = null;
m_PurificationStart = DateTime.Now;
m_PurificationStart = DateTime.UtcNow;
m_CorruptionStart = DateTime.MinValue;
m_Town.Capture( m_Corrupted );

View file

@ -191,7 +191,7 @@ namespace Server.Factions
Visible = false;
m_Faction = f;
m_TimeOfPlacement = DateTime.Now;
m_TimeOfPlacement = DateTime.UtcNow;
m_Placer = m;
}
@ -206,7 +206,7 @@ namespace Server.Factions
if ( decayPeriod == TimeSpan.MaxValue )
return false;
if ( (m_TimeOfPlacement + decayPeriod) < DateTime.Now )
if ( (m_TimeOfPlacement + decayPeriod) < DateTime.UtcNow )
{
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Delete ) );
return true;

View file

@ -185,14 +185,14 @@ namespace Server.Factions
else if ( Town.FromRegion( this.Region ) == m_Town )
{
this.Say( 1042180 ); // Your orders, sire?
m_OrdersEnd = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
m_OrdersEnd = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 );
}
}
else if ( DateTime.Now < m_OrdersEnd )
else if ( DateTime.UtcNow < m_OrdersEnd )
{
if ( m_Town != null && m_Town.IsSheriff( from ) && Town.FromRegion( this.Region ) == m_Town )
{
m_OrdersEnd = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
m_OrdersEnd = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 );
bool understood = true;
ReactionType newType = 0;

View file

@ -94,7 +94,7 @@ namespace Server.Factions
if ( entry.Chance > Utility.Random( 100 ) )
{
releaseTime = DateTime.Now + entry.Hold;
releaseTime = DateTime.UtcNow + entry.Hold;
return (Spell) Activator.CreateInstance( entry.Spell, new object[]{ mob, null } );
}
}
@ -143,7 +143,7 @@ namespace Server.Factions
if ( m_Bandage == null )
return TimeSpan.MaxValue;
TimeSpan ts = ( m_BandageStart + m_Bandage.Timer.Delay ) - DateTime.Now;
TimeSpan ts = ( m_BandageStart + m_Bandage.Timer.Delay ) - DateTime.UtcNow;
if ( ts < TimeSpan.FromSeconds( -1.0 ) )
{
@ -206,7 +206,7 @@ namespace Server.Factions
return false;
m_Bandage = BandageContext.BeginHeal( m_Guard, m_Guard );
m_BandageStart = DateTime.Now;
m_BandageStart = DateTime.UtcNow;
return ( m_Bandage != null );
}
@ -486,9 +486,9 @@ namespace Server.Factions
Mobile dispelTarget = FindDispelTarget( true );
if ( m_Guard.Target != null && m_ReleaseTarget == DateTime.MinValue )
m_ReleaseTarget = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
m_ReleaseTarget = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 );
if ( m_Guard.Target != null && DateTime.Now > m_ReleaseTarget )
if ( m_Guard.Target != null && DateTime.UtcNow > m_ReleaseTarget )
{
Target targ = m_Guard.Target;
@ -584,7 +584,7 @@ namespace Server.Factions
StartBandage();
}
if ( m_Mobile.Spell == null && DateTime.Now >= m_Mobile.NextSpellTime )
if ( m_Mobile.Spell == null && Core.TickCount - m_Mobile.NextSpellTime >= 0 )
{
Spell spell = null;
@ -614,7 +614,7 @@ namespace Server.Factions
{
if ( m_Guard.Mana >= 11 && (m_Guard.Hits + 30) < m_Guard.HitsMax )
spell = new GreaterHealSpell( m_Guard, null );
else if ( (m_Guard.Hits + 10) < m_Guard.HitsMax && (m_Guard.Mana < 11 || (m_Guard.NextCombatTime - DateTime.Now) > TimeSpan.FromSeconds( 2.0 )) )
else if ( (m_Guard.Hits + 10) < m_Guard.HitsMax && (m_Guard.Mana < 11 || (m_Guard.NextCombatTime - Core.TickCount) > 2000) )
spell = new HealSpell( m_Guard, null );
}
else if ( m_Guard.CanBeginAction( typeof( BaseHealPotion ) ) )

View file

@ -49,7 +49,7 @@ namespace Server.Engines.Harvest
public void CheckRespawn()
{
if ( m_Current == m_Maximum || m_NextRespawn > DateTime.Now )
if ( m_Current == m_Maximum || m_NextRespawn > DateTime.UtcNow )
return;
m_Current = m_Maximum;
@ -78,7 +78,7 @@ namespace Server.Engines.Harvest
if ( m_Definition.RaceBonus && from.Race == Race.Elf ) //def.RaceBonus = Core.ML
minutes *= .75; //25% off the time.
m_NextRespawn = DateTime.Now + TimeSpan.FromMinutes( minutes );
m_NextRespawn = DateTime.UtcNow + TimeSpan.FromMinutes( minutes );
}
else
{

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;
}

View file

@ -269,7 +269,7 @@ namespace Server.Items
}
else
{
m_Guesses[m] = new PuzzleChestSolutionAndTime( DateTime.Now, solution );
m_Guesses[m] = new PuzzleChestSolutionAndTime( DateTime.UtcNow, solution );
m.SendGump( new StatusGump( correctCylinders, correctColors ) );
@ -672,7 +672,7 @@ namespace Server.Items
List<Mobile> toDelete = new List<Mobile>();
foreach ( KeyValuePair<Mobile, PuzzleChestSolutionAndTime> kvp in m_Guesses ) {
if ( DateTime.Now - kvp.Value.When > CleanupTime )
if ( DateTime.UtcNow - kvp.Value.When > CleanupTime )
toDelete.Add( kvp.Key );
}

View file

@ -82,7 +82,7 @@ namespace Server.Items
public RaiseTimer( RaisableItem item ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 0.5 ) )
{
m_Item = item;
m_CloseTime = DateTime.Now + item.CloseDelay;
m_CloseTime = DateTime.UtcNow + item.CloseDelay;
m_Up = true;
Priority = TimerPriority.TenMS;
@ -112,7 +112,7 @@ namespace Server.Items
m_Up = false;
m_Step = 0;
TimeSpan delay = m_CloseTime - DateTime.Now;
TimeSpan delay = m_CloseTime - DateTime.UtcNow;
Timer.DelayCall( delay > TimeSpan.Zero ? delay : TimeSpan.Zero, new TimerCallback( Start ) );
return;

View file

@ -237,7 +237,7 @@ namespace Server.Engines.MLQuests
return false;
}
else if ( nextAvailable > DateTime.Now )
else if ( nextAvailable > DateTime.UtcNow )
{
if ( message )
MLQuestSystem.Tell( quester, pm, 1075575 ); // I'm sorry, but I don't have anything else for you right now. Could you check back with me in a few minutes?

View file

@ -41,7 +41,7 @@ namespace Server.Engines.MLQuests
m_QuesterType = ( quester == null ) ? null : quester.GetType();
m_Player = player;
m_Accepted = DateTime.Now;
m_Accepted = DateTime.UtcNow;
m_Flags = MLQuestInstanceFlags.None;
m_ObjectiveInstances = new BaseObjectiveInstance[quest.Objectives.Count];
@ -217,7 +217,7 @@ namespace Server.Engines.MLQuests
{
if ( !obj.Expired )
{
if ( obj.IsTimed && obj.EndTime <= DateTime.Now )
if ( obj.IsTimed && obj.EndTime <= DateTime.UtcNow )
{
m_Player.SendLocalizedMessage( 1072258 ); // You failed to complete an objective in time!
@ -337,7 +337,7 @@ namespace Server.Engines.MLQuests
ClaimReward = true;
if ( m_Quest.HasRestartDelay )
PlayerContext.SetDoneQuest( m_Quest, DateTime.Now + m_Quest.GetRestartDelay() );
PlayerContext.SetDoneQuest( m_Quest, DateTime.UtcNow + m_Quest.GetRestartDelay() );
// This is correct for ObjectiveType.Any as well
foreach ( BaseObjectiveInstance objective in m_ObjectiveInstances )

View file

@ -89,7 +89,7 @@ namespace Server.Engines.MLQuests.Mobiles
{
base.OnThink();
if ( m_NextShout <= DateTime.Now )
if ( m_NextShout <= DateTime.UtcNow )
{
Packet shoutPacket = null;
@ -108,7 +108,7 @@ namespace Server.Engines.MLQuests.Mobiles
Packet.Release( shoutPacket );
m_NextShout = DateTime.Now + m_ShoutDelay;
m_NextShout = DateTime.UtcNow + m_ShoutDelay;
}
}

View file

@ -62,13 +62,13 @@ namespace Server.Engines.MLQuests.Objectives
m_Instance = instance;
if ( obj.IsTimed )
m_EndTime = DateTime.Now + obj.Duration;
m_EndTime = DateTime.UtcNow + obj.Duration;
}
public virtual void WriteToGump( Gump g, ref int y )
{
if ( IsTimed )
WriteTimeRemaining( g, ref y, ( m_EndTime > DateTime.Now ) ? ( m_EndTime - DateTime.Now ) : TimeSpan.Zero );
WriteTimeRemaining( g, ref y, ( m_EndTime > DateTime.UtcNow ) ? ( m_EndTime - DateTime.UtcNow ) : TimeSpan.Zero );
}
public static void WriteTimeRemaining( Gump g, ref int y, TimeSpan timeRemaining )

View file

@ -52,11 +52,11 @@ namespace Server.Engines.MLQuests.Objectives
DateTime nextEscort = pm.LastEscortTime + BaseEscortable.EscortDelay;
if ( nextEscort > DateTime.Now )
if ( nextEscort > DateTime.UtcNow )
{
if ( message )
{
int minutes = (int)Math.Ceiling( ( nextEscort - DateTime.Now ).TotalMinutes );
int minutes = (int)Math.Ceiling( ( nextEscort - DateTime.UtcNow ).TotalMinutes );
if ( minutes == 1 )
MLQuestSystem.Tell( quester, pm, "You must rest 1 minute before we set out on this journey." );
@ -111,7 +111,7 @@ namespace Server.Engines.MLQuests.Objectives
m_Objective = objective;
m_HasCompleted = false;
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 5 ), TimeSpan.FromSeconds( 5 ), new TimerCallback( CheckDestination ) );
m_LastSeenEscorter = DateTime.Now;
m_LastSeenEscorter = DateTime.UtcNow;
m_Escort = instance.Quester as BaseCreature;
if ( MLQuestSystem.Debug && m_Escort == null && instance.Quester != null )
@ -158,12 +158,12 @@ namespace Server.Engines.MLQuests.Objectives
}
else if ( pm.Map != m_Escort.Map || !pm.InRange( m_Escort, 30 ) ) // TODO: verify range
{
if ( m_LastSeenEscorter + BaseEscortable.AbandonDelay <= DateTime.Now )
if ( m_LastSeenEscorter + BaseEscortable.AbandonDelay <= DateTime.UtcNow )
Abandon();
}
else
{
m_LastSeenEscorter = DateTime.Now;
m_LastSeenEscorter = DateTime.UtcNow;
}
}
@ -212,7 +212,7 @@ namespace Server.Engines.MLQuests.Objectives
MLQuestInstance instance = Instance;
PlayerMobile pm = instance.Player;
pm.LastEscortTime = DateTime.Now;
pm.LastEscortTime = DateTime.UtcNow;
if ( m_Escort != null )
BeginFollow( m_Escort, pm );

View file

@ -155,7 +155,7 @@ namespace Server.Engines.MLQuests.Objectives
PlayerMobile pm = Instance.Player;
pm.AcceleratedSkill = m_Objective.Skill;
pm.AcceleratedStart = DateTime.Now + TimeSpan.FromMinutes( 15 ); // TODO: Is there a max duration?
pm.AcceleratedStart = DateTime.UtcNow + TimeSpan.FromMinutes( 15 ); // TODO: Is there a max duration?
}
public override void OnQuestCancelled()
@ -165,7 +165,7 @@ namespace Server.Engines.MLQuests.Objectives
PlayerMobile pm = Instance.Player;
pm.AcceleratedStart = DateTime.Now;
pm.AcceleratedStart = DateTime.UtcNow;
pm.PlaySound( 0x100 );
}

View file

@ -67,7 +67,7 @@ namespace Server.Engines.MyRunUO
OdbcCommand command = null;
OdbcTransaction transact = null;
DateTime start = DateTime.Now;
DateTime start = DateTime.UtcNow;
bool shouldWriteException = true;
@ -118,7 +118,7 @@ namespace Server.Engines.MyRunUO
try{ m_Sync.Close(); }
catch{}
Console.WriteLine( m_CompletionString, (DateTime.Now - start).TotalSeconds );
Console.WriteLine( m_CompletionString, (DateTime.UtcNow - start).TotalSeconds );
m_HasCompleted = true;
return;

View file

@ -125,7 +125,7 @@ namespace Server.Engines.MyRunUO
m_List = new ArrayList();
m_Collecting = new List<IAccount>();
m_StartTime = DateTime.Now;
m_StartTime = DateTime.UtcNow;
Console.WriteLine( "MyRunUO: Updating character database" );
}
@ -135,10 +135,10 @@ namespace Server.Engines.MyRunUO
try
{
shouldExit = Process( DateTime.Now + TimeSpan.FromSeconds( CpuInterval * CpuPercent ) );
shouldExit = Process( DateTime.UtcNow + TimeSpan.FromSeconds( CpuInterval * CpuPercent ) );
if ( shouldExit )
Console.WriteLine( "MyRunUO: Database statements compiled in {0:F2} seconds", (DateTime.Now - m_StartTime).TotalSeconds );
Console.WriteLine( "MyRunUO: Database statements compiled in {0:F2} seconds", (DateTime.UtcNow - m_StartTime).TotalSeconds );
}
catch ( Exception e )
{
@ -209,7 +209,7 @@ namespace Server.Engines.MyRunUO
++m_Index;
if ( DateTime.Now >= endTime )
if ( DateTime.UtcNow >= endTime )
break;
}
@ -549,7 +549,7 @@ namespace Server.Engines.MyRunUO
++m_Index;
if ( DateTime.Now >= endTime )
if ( DateTime.UtcNow >= endTime )
break;
}
@ -625,7 +625,7 @@ namespace Server.Engines.MyRunUO
++m_Index;
if ( DateTime.Now >= endTime )
if ( DateTime.UtcNow >= endTime )
break;
}

View file

@ -41,7 +41,7 @@ namespace Server.Engines.MyRunUO
if ( m_Command != null && !m_Command.HasCompleted )
return;
DateTime start = DateTime.Now;
DateTime start = DateTime.UtcNow;
Console.WriteLine( "MyRunUO: Updating status database" );
try

View file

@ -37,9 +37,9 @@ namespace Server
{
m_OverrideAlgorithm = alg;
long start = DateTime.Now.Ticks;
long start = DateTime.UtcNow.Ticks;
MovementPath path = new MovementPath( from, new Point3D( p ) );
long end = DateTime.Now.Ticks;
long end = DateTime.UtcNow.Ticks;
double len = Math.Round( (end-start) / 10000.0, 2 );
if ( !path.Success )

View file

@ -87,7 +87,7 @@ namespace Server
if ( m_Path == null )
repath = true;
else if ( (!m_Path.Success || goal != m_LastGoalLoc) && (m_LastPathTime + RepathDelay) <= DateTime.Now )
else if ( (!m_Path.Success || goal != m_LastGoalLoc) && (m_LastPathTime + RepathDelay) <= DateTime.UtcNow )
repath = true;
else if ( m_Path.Success && Check( m_From.Location, m_LastGoalLoc, 0 ) )
repath = true;
@ -95,7 +95,7 @@ namespace Server
if ( !repath )
return false;
m_LastPathTime = DateTime.Now;
m_LastPathTime = DateTime.UtcNow;
m_LastGoalLoc = goal;
m_Path = new MovementPath( m_From, goal );

View file

@ -319,7 +319,7 @@ namespace Server.Engines.Plants
m_Plant = plant;
m_FertileDirt = fertileDirt;
m_NextGrowth = DateTime.Now + CheckDelay;
m_NextGrowth = DateTime.UtcNow + CheckDelay;
m_GrowthIndicator = PlantGrowthIndicator.None;
m_Hits = MaxHits;
m_LeftSeeds = 8;
@ -328,7 +328,7 @@ namespace Server.Engines.Plants
public void Reset( bool potions )
{
m_NextGrowth = DateTime.Now + CheckDelay;
m_NextGrowth = DateTime.UtcNow + CheckDelay;
m_GrowthIndicator = PlantGrowthIndicator.None;
Hits = MaxHits;
@ -418,7 +418,7 @@ namespace Server.Engines.Plants
public static void GrowAll()
{
ArrayList plants = PlantItem.Plants;
DateTime now = DateTime.Now;
DateTime now = DateTime.UtcNow;
for ( int i = plants.Count - 1; i >= 0; --i )
{
@ -444,13 +444,13 @@ namespace Server.Engines.Plants
if ( !m_Plant.IsGrowable )
return;
if ( DateTime.Now < m_NextGrowth )
if ( DateTime.UtcNow < m_NextGrowth )
{
m_GrowthIndicator = PlantGrowthIndicator.Delay;
return;
}
m_NextGrowth = DateTime.Now + CheckDelay;
m_NextGrowth = DateTime.UtcNow + CheckDelay;
if ( !m_Plant.ValidGrowthLocation )
{

View file

@ -119,9 +119,9 @@ namespace Server.Engines.Quests.Collector
{
if ( m_Begin == DateTime.MaxValue )
{
m_Begin = DateTime.Now;
m_Begin = DateTime.UtcNow;
}
else if ( DateTime.Now - m_Begin > TimeSpan.FromSeconds( 30.0 ) )
else if ( DateTime.UtcNow - m_Begin > TimeSpan.FromSeconds( 30.0 ) )
{
Complete();
}

View file

@ -22,7 +22,7 @@ namespace Server.Engines.Quests
public void Reset( TimeSpan restartDelay )
{
if ( restartDelay < TimeSpan.MaxValue )
m_RestartTime = DateTime.Now + restartDelay;
m_RestartTime = DateTime.UtcNow + restartDelay;
else
m_RestartTime = DateTime.MaxValue;
}

View file

@ -435,7 +435,7 @@ namespace Server.Engines.Quests
{
DateTime endTime = restartInfo.RestartTime;
if ( DateTime.Now < endTime )
if ( DateTime.UtcNow < endTime )
{
inRestartPeriod = true;
return false;

View file

@ -57,7 +57,7 @@ namespace Server.Engines.Quests.Naturalist
{
if ( m_StudyState != StudyState.Inactive )
{
TimeSpan time = DateTime.Now - m_StudyBegin;
TimeSpan time = DateTime.UtcNow - m_StudyBegin;
if ( time > TimeSpan.FromSeconds( 30.0 ) )
{
@ -99,7 +99,7 @@ namespace Server.Engines.Quests.Naturalist
if ( nest != null )
{
m_CurrentNest = nest;
m_StudyBegin = DateTime.Now;
m_StudyBegin = DateTime.UtcNow;
if ( m_StudiedNests.Contains( nest ) )
{

View file

@ -32,7 +32,7 @@ namespace Server.RemoteAdmin
string outStr;
if ( m_NewLine )
{
outStr = String.Format( "[{0}]: {1}", DateTime.Now.ToString( DateFormat ), str );
outStr = String.Format( "[{0}]: {1}", DateTime.UtcNow.ToString( DateFormat ), str );
m_NewLine = false;
}
else
@ -51,7 +51,7 @@ namespace Server.RemoteAdmin
if ( m_NewLine )
{
string outStr;
outStr = String.Format( "[{0}]: {1}", DateTime.Now.ToString( DateFormat ), ch );
outStr = String.Format( "[{0}]: {1}", DateTime.UtcNow.ToString( DateFormat ), ch );
m_ConsoleData.Append( outStr );
SendToAll( outStr );
@ -71,7 +71,7 @@ namespace Server.RemoteAdmin
{
string outStr;
if ( m_NewLine )
outStr = String.Format( "[{0}]: {1}{2}", DateTime.Now.ToString( DateFormat ), line, Console.Out.NewLine );
outStr = String.Format( "[{0}]: {1}{2}", DateTime.UtcNow.ToString( DateFormat ), line, Console.Out.NewLine );
else
outStr = String.Format( "{0}{1}", line, Console.Out.NewLine );
@ -127,7 +127,7 @@ namespace Server.RemoteAdmin
}
else if ( cmd == 0xFF )
{
string statStr = String.Format( ", Name={0}, Age={1}, Clients={2}, Items={3}, Chars={4}, Mem={5}K, Ver={6}", Server.Misc.ServerList.ServerName, (int)(DateTime.Now - Server.Items.Clock.ServerStart).TotalHours, NetState.Instances.Count, World.Items.Count, World.Mobiles.Count, (int)(System.GC.GetTotalMemory( false ) / 1024), ProtocolVersion );
string statStr = String.Format( ", Name={0}, Age={1}, Clients={2}, Items={3}, Chars={4}, Mem={5}K, Ver={6}", Server.Misc.ServerList.ServerName, (int)(DateTime.UtcNow - Server.Items.Clock.ServerStart).TotalHours, NetState.Instances.Count, World.Items.Count, World.Mobiles.Count, (int)(System.GC.GetTotalMemory( false ) / 1024), ProtocolVersion );
state.Send( new UOGInfo( statStr ) );
state.Dispose();
}
@ -189,7 +189,7 @@ namespace Server.RemoteAdmin
Console.WriteLine( "ADMIN: Access granted to '{0}' from {1}", user, state );
state.Account = a;
a.LogAccess( state );
a.LastLogin = DateTime.Now;
a.LastLogin = DateTime.UtcNow;
state.Send( new Login( LoginResponse.OK ) );
TightTrimConsoleData();

View file

@ -83,7 +83,7 @@ namespace Server.RemoteAdmin
m_Stream.Write( (int) World.Items.Count );
m_Stream.Write( (int) Core.ScriptItems );
m_Stream.Write( (uint)(DateTime.Now - Clock.ServerStart).TotalSeconds );
m_Stream.Write( (uint)(DateTime.UtcNow - Clock.ServerStart).TotalSeconds );
m_Stream.Write( (uint) GC.GetTotalMemory( false ) ); // TODO: uint not sufficient for TotalMemory (long). Fix protocol.
m_Stream.WriteAsciiNull( netVer );
m_Stream.WriteAsciiNull( os );
@ -132,7 +132,7 @@ namespace Server.RemoteAdmin
m_Stream.Write( (int)NetState.Instances.Count - 1 ); // Clients
m_Stream.Write( (int)World.Items.Count ); // Items
m_Stream.Write( (int)World.Mobiles.Count ); // Mobiles
m_Stream.Write( (uint)(DateTime.Now - Clock.ServerStart).TotalSeconds ); // Age (seconds)
m_Stream.Write( (uint)(DateTime.UtcNow - Clock.ServerStart).TotalSeconds ); // Age (seconds)
long memory = GC.GetTotalMemory( false );
m_Stream.Write( (uint)(memory >> 32) ); // Memory high bytes

View file

@ -34,12 +34,12 @@ namespace Server.RemoteAdmin
try
{
m_Output = new StreamWriter( Path.Combine( directory, String.Format( LogSubDirectory + "{0}.log", DateTime.Now.ToString( "yyyyMMdd" ) ) ), true );
m_Output = new StreamWriter( Path.Combine( directory, String.Format( LogSubDirectory + "{0}.log", DateTime.UtcNow.ToString( "yyyyMMdd" ) ) ), true );
m_Output.AutoFlush = true;
m_Output.WriteLine( "##############################" );
m_Output.WriteLine( "Log started on {0}", DateTime.Now );
m_Output.WriteLine( "Log started on {0}", DateTime.UtcNow );
m_Output.WriteLine();
}
catch
@ -81,7 +81,7 @@ namespace Server.RemoteAdmin
string accesslevel = acct == null ? "NoAccount" : acct.AccessLevel.ToString();
string statestr = state == null ? "NULLSTATE" : state.ToString();
m_Output.WriteLine( "{0}: {1}: {2}: {3}", DateTime.Now, statestr, name, text );
m_Output.WriteLine( "{0}: {1}: {2}: {3}", DateTime.UtcNow, statestr, name, text );
string path = Core.BaseDirectory;
@ -91,7 +91,7 @@ namespace Server.RemoteAdmin
path = Path.Combine( path, String.Format( "{0}.log", name ) );
using ( StreamWriter sw = new StreamWriter( path, true ) )
sw.WriteLine( "{0}: {1}: {2}", DateTime.Now, statestr, text );
sw.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, statestr, text );
}
catch
{

View file

@ -77,8 +77,8 @@ namespace Server.Engines.Reports
{
BaseInfo cmp = obj as BaseInfo;
int v = cmp.GetPageCount( cmp is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.Now - m_SortRange, DateTime.Now )
- this.GetPageCount( this is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.Now - m_SortRange, DateTime.Now );
int v = cmp.GetPageCount( cmp is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - m_SortRange, DateTime.UtcNow )
- this.GetPageCount( this is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - m_SortRange, DateTime.UtcNow );
if ( v == 0 )
v = String.Compare( this.Display, cmp.Display );

View file

@ -31,7 +31,7 @@ namespace Server.Engines.Reports
public QueueStatus( int count )
{
m_TimeStamp = DateTime.Now;
m_TimeStamp = DateTime.UtcNow;
m_Count = count;
}

View file

@ -35,7 +35,7 @@ namespace Server.Engines.Reports
public ResponseInfo( string sentBy, string message )
{
m_TimeStamp = DateTime.Now;
m_TimeStamp = DateTime.UtcNow;
m_SentBy = sentBy;
m_Message = message;
}

View file

@ -117,7 +117,7 @@ namespace Server.Engines.Reports
public override void DeserializeChildren( PersistanceReader ip )
{
DateTime min = DateTime.Now - TimeSpan.FromDays( 8.0 );
DateTime min = DateTime.UtcNow - TimeSpan.FromDays( 8.0 );
while ( ip.HasChild )
{
@ -229,7 +229,7 @@ namespace Server.Engines.Reports
int[] totals = new int[24];
int[] counts = new int[24];
DateTime max = DateTime.Now;
DateTime max = DateTime.UtcNow;
DateTime min = max - TimeSpan.FromDays( 7.0 );
for ( int i = 0; i < m_QueueStats.Count; ++i )
@ -289,7 +289,7 @@ namespace Server.Engines.Reports
DateTime[] dates = new DateTime[24];
DateTime max = DateTime.Now;
DateTime max = DateTime.UtcNow;
DateTime min = max - TimeSpan.FromDays( 7.0 );
bool sentStamp = ( res == PageResolution.None );
@ -349,7 +349,7 @@ namespace Server.Engines.Reports
private Report ReportTotalPages( StaffInfo[] staff, TimeSpan ts, string title )
{
DateTime max = DateTime.Now;
DateTime max = DateTime.UtcNow;
DateTime min = max - ts;
Report report = new Report( title + " Staff Report", "400" );
@ -365,7 +365,7 @@ namespace Server.Engines.Reports
private PieChart[] ChartTotalPages( StaffInfo[] staff, TimeSpan ts, string title, string fname )
{
DateTime max = DateTime.Now;
DateTime max = DateTime.UtcNow;
DateTime min = max - ts;
PieChart staffChart = new PieChart( title + " Staff Chart", fname + "_staff", true );

View file

@ -55,7 +55,7 @@ namespace Server.Engines.Reports
public HtmlRenderer( string outputDirectory, StaffHistory history ) : this( outputDirectory )
{
m_TimeStamp = DateTime.Now;
m_TimeStamp = DateTime.UtcNow;
m_Objects = new ObjectCollection();

View file

@ -27,7 +27,7 @@ namespace Server.Engines.Reports
m_StaffHistory = new StaffHistory();
m_StaffHistory.Load();
DateTime now = DateTime.Now;
DateTime now = DateTime.UtcNow;
DateTime date = now.Date;
TimeSpan timeOfDay = now.TimeOfDay;
@ -41,7 +41,7 @@ namespace Server.Engines.Reports
public static void CheckRegenerate()
{
if ( DateTime.Now < m_GenerateTime )
if ( DateTime.UtcNow < m_GenerateTime )
return;
Generate();
@ -57,7 +57,7 @@ namespace Server.Engines.Reports
{
Snapshot ss = new Snapshot();
ss.TimeStamp = DateTime.Now;
ss.TimeStamp = DateTime.UtcNow;
FillSnapshot( ss );

View file

@ -80,14 +80,14 @@ namespace Server.Mobiles
if ( !Running )
return;
End = DateTime.Now + delay;
End = DateTime.UtcNow + delay;
}
public override void Respawn()
{
RemoveSpawned();
End = DateTime.Now;
End = DateTime.UtcNow;
}
public override void Spawn()
@ -128,7 +128,7 @@ namespace Server.Mobiles
if ( !Running )
return;
if ( IsEmpty && End <= DateTime.Now && m.InRange( GetWorldLocation(), m_TriggerRange ) && m.Location != oldLocation && ValidTrigger( m ) )
if ( IsEmpty && End <= DateTime.UtcNow && m.InRange( GetWorldLocation(), m_TriggerRange ) && m.Location != oldLocation && ValidTrigger( m ) )
{
TextDefinition.SendMessageTo( m, m_SpawnMessage );

View file

@ -220,7 +220,7 @@ namespace Server.Mobiles
get
{
if ( m_Running )
return m_End - DateTime.Now;
return m_End - DateTime.UtcNow;
else
return TimeSpan.FromSeconds( 0 );
}
@ -763,7 +763,7 @@ namespace Server.Mobiles
if ( !m_Running )
return;
m_End = DateTime.Now + delay;
m_End = DateTime.UtcNow + delay;
if ( m_Timer != null )
m_Timer.Stop();
@ -998,7 +998,7 @@ namespace Server.Mobiles
TimeSpan ts = TimeSpan.Zero;
if ( m_Running )
ts = reader.ReadDeltaTime() - DateTime.Now;
ts = reader.ReadDeltaTime() - DateTime.UtcNow;
int size = reader.ReadInt();
@ -1083,7 +1083,7 @@ namespace Server.Mobiles
using ( StreamWriter op = new StreamWriter( "badspawn.log", true ) )
{
op.WriteLine( "# Bad spawns : {0}", DateTime.Now );
op.WriteLine( "# Bad spawns : {0}", DateTime.UtcNow );
op.WriteLine( "# Format: X Y Z F Name" );
op.WriteLine();

View file

@ -241,7 +241,7 @@ namespace Server.Mobiles
public void Sculpt( Mobile by )
{
m_SculptedBy = by;
m_SculptedOn = DateTime.Now;
m_SculptedOn = DateTime.UtcNow;
InvalidateProperties();
}
@ -502,7 +502,7 @@ namespace Server.Mobiles
if ( acct != null && from.AccessLevel == AccessLevel.Player )
{
TimeSpan time = TimeSpan.FromDays( RewardSystem.RewardInterval.TotalDays * 6 ) - ( DateTime.Now - acct.Created );
TimeSpan time = TimeSpan.FromDays( RewardSystem.RewardInterval.TotalDays * 6 ) - ( DateTime.UtcNow - acct.Created );
if ( time > TimeSpan.Zero )
{

View file

@ -81,7 +81,7 @@ namespace Server.Engines.VeteranRewards
return false;
}
TimeSpan totalTime = (DateTime.Now - acct.Created);
TimeSpan totalTime = (DateTime.UtcNow - acct.Created);
ts = ( list.Age - totalTime );
@ -103,7 +103,7 @@ namespace Server.Engines.VeteranRewards
public static int GetRewardLevel( Account acct )
{
TimeSpan totalTime = (DateTime.Now - acct.Created);
TimeSpan totalTime = (DateTime.UtcNow - acct.Created);
int level = (int)(totalTime.TotalDays / RewardInterval.TotalDays);
@ -125,7 +125,7 @@ namespace Server.Engines.VeteranRewards
public static bool HasHalfLevel( Account acct )
{
TimeSpan totalTime = (DateTime.Now - acct.Created);
TimeSpan totalTime = (DateTime.UtcNow - acct.Created);
Double level = (totalTime.TotalDays / RewardInterval.TotalDays);

View file

@ -32,11 +32,11 @@ namespace Server
try
{
if ( (pm.LastCompassionLoss + LossDelay) < DateTime.Now )
if ( (pm.LastCompassionLoss + LossDelay) < DateTime.UtcNow )
{
VirtueHelper.Atrophy( from, VirtueName.Compassion, LossAmount );
//OSI has no cliloc message for losing compassion. Weird.
pm.LastCompassionLoss = DateTime.Now;
pm.LastCompassionLoss = DateTime.UtcNow;
}
}
catch

View file

@ -79,7 +79,7 @@ namespace Server
return;
}
TimeSpan waitTime = DateTime.Now - pm.LastHonorUse;
TimeSpan waitTime = DateTime.UtcNow - pm.LastHonorUse;
if ( waitTime < UseDelay )
{
TimeSpan remainingTime = UseDelay - waitTime;
@ -113,7 +113,7 @@ namespace Server
Timer.DelayCall( TimeSpan.FromSeconds( duration ),
delegate() {
pm.HonorActive = false;
pm.LastHonorUse = DateTime.Now;
pm.LastHonorUse = DateTime.UtcNow;
pm.SendLocalizedMessage( 1063236 ); // You no longer embrace your honor
} );
}
@ -231,11 +231,11 @@ namespace Server
m_Timer = new InternalTimer( this );
m_Timer.Start();
source.m_hontime = (DateTime.Now + TimeSpan.FromMinutes( 40 ));
source.m_hontime = (DateTime.UtcNow + TimeSpan.FromMinutes( 40 ));
Timer.DelayCall( TimeSpan.FromMinutes( 40 ),
delegate() {
if (source.m_hontime < DateTime.Now && source.SentHonorContext != null)
if (source.m_hontime < DateTime.UtcNow && source.SentHonorContext != null)
{
Cancel();
}

View file

@ -174,12 +174,12 @@ namespace Server
try
{
if ( (pm.LastJusticeLoss + LossDelay) < DateTime.Now )
if ( (pm.LastJusticeLoss + LossDelay) < DateTime.UtcNow )
{
if ( VirtueHelper.Atrophy( from, VirtueName.Justice, LossAmount ) )
from.SendLocalizedMessage( 1049373 ); // You have lost some Justice.
pm.LastJusticeLoss = DateTime.Now;
pm.LastJusticeLoss = DateTime.UtcNow;
}
}
catch

View file

@ -40,7 +40,7 @@ namespace Server
try
{
if ( (pm.LastSacrificeLoss + LossDelay) < DateTime.Now )
if ( (pm.LastSacrificeLoss + LossDelay) < DateTime.UtcNow )
{
if ( VirtueHelper.Atrophy( from, VirtueName.Sacrifice, LossAmount ) )
from.SendLocalizedMessage( 1052041 ); // You have lost some Sacrifice.
@ -48,7 +48,7 @@ namespace Server
VirtueLevel level = VirtueHelper.GetLevel( from, VirtueName.Sacrifice );
pm.AvailableResurrects = (int)level;
pm.LastSacrificeLoss = DateTime.Now;
pm.LastSacrificeLoss = DateTime.UtcNow;
}
}
catch
@ -124,7 +124,7 @@ namespace Server
{
from.SendLocalizedMessage( 1052017 ); // You do not have enough fame to sacrifice.
}
else if ( DateTime.Now < (pm.LastSacrificeGain + GainDelay) )
else if ( DateTime.UtcNow < (pm.LastSacrificeGain + GainDelay) )
{
from.SendLocalizedMessage( 1052016 ); // You must wait approximately one day before sacrificing again.
}
@ -148,7 +148,7 @@ namespace Server
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( targ.Delete ) );
pm.LastSacrificeGain = DateTime.Now;
pm.LastSacrificeGain = DateTime.UtcNow;
bool gainedPath = false;

View file

@ -37,12 +37,12 @@ namespace Server
try
{
if( (pm.LastValorLoss + LossDelay) < DateTime.Now )
if( (pm.LastValorLoss + LossDelay) < DateTime.UtcNow )
{
if( VirtueHelper.Atrophy( from, VirtueName.Valor, LossAmount ) )
from.SendLocalizedMessage( 1054040 ); // You have lost some Valor.
pm.LastValorLoss = DateTime.Now;
pm.LastValorLoss = DateTime.UtcNow;
}
}
catch

View file

@ -119,7 +119,7 @@ namespace Server
{
if ( virtue == VirtueName.Compassion )
{
if ( pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay )
if ( pm.CompassionGains > 0 && DateTime.UtcNow > pm.NextCompassionDay )
{
pm.NextCompassionDay = DateTime.MinValue;
pm.CompassionGains = 0;
@ -145,7 +145,7 @@ namespace Server
if ( virtue == VirtueName.Compassion )
{
pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays( 1.0 );
pm.NextCompassionDay = DateTime.UtcNow + TimeSpan.FromDays( 1.0 );
++pm.CompassionGains;
if ( pm.CompassionGains >= 5 )

View file

@ -251,7 +251,7 @@ namespace Server.Gumps
AddLabel( 150, 270, LabelHue, Core.ScriptItems.ToString() );
AddLabel( 20, 290, LabelHue, "Uptime:" );
AddLabel( 150, 290, LabelHue, FormatTimeSpan( DateTime.Now - Clock.ServerStart ) );
AddLabel( 150, 290, LabelHue, FormatTimeSpan( DateTime.UtcNow - Clock.ServerStart ) );
AddLabel( 20, 310, LabelHue, "Memory:" );
AddLabel( 150, 310, LabelHue, FormatByteAmount( GC.GetTotalMemory( false ) ) );
@ -907,7 +907,7 @@ namespace Server.Gumps
}
else
{
TimeSpan remaining = (DateTime.Now - banTime);
TimeSpan remaining = (DateTime.UtcNow - banTime);
if ( remaining < TimeSpan.Zero )
remaining = TimeSpan.Zero;

View file

@ -239,7 +239,7 @@ namespace Server.Gumps
{
Account a = (Account)m_List[i];
a.SetBanTags( from, DateTime.Now, duration );
a.SetBanTags( from, DateTime.UtcNow, duration );
if ( comment != null )
a.Comments.Add( new AccountComment( from.RawName, String.Format( "Duration: {0}, Comment: {1}", (( duration == TimeSpan.MaxValue )? "Infinite" : duration.ToString()), comment ) ) );

View file

@ -66,7 +66,7 @@ namespace Server.Gumps
{
m_Mobile.SendLocalizedMessage( 1010405 ); // You cannot change guild types while in a Faction!
}
else if ( m_Guild.TypeLastChange.AddDays( 7 ) > DateTime.Now )
else if ( m_Guild.TypeLastChange.AddDays( 7 ) > DateTime.UtcNow )
{
m_Mobile.SendLocalizedMessage( 1011142 ); // You have already changed your guild type recently.
// TODO: Clilocs 1011142-1011145 suggest a timer for pending changes

View file

@ -83,8 +83,8 @@ namespace Server.Guilds
TimeSpan timeRemaining = TimeSpan.Zero;
if( activeWar.WarLength != TimeSpan.Zero && (activeWar.WarBeginning + activeWar.WarLength) > DateTime.Now )
timeRemaining = (activeWar.WarBeginning + activeWar.WarLength) - DateTime.Now;
if( activeWar.WarLength != TimeSpan.Zero && (activeWar.WarBeginning + activeWar.WarLength) > DateTime.UtcNow )
timeRemaining = (activeWar.WarBeginning + activeWar.WarLength) - DateTime.UtcNow;
//time = String.Format( "{0:D2}:{1:D2}", timeRemaining.Hours.ToString(), timeRemaining.Subtract( TimeSpan.FromHours( timeRemaining.Hours ) ).Minutes ); //Is there a formatter for htis? it's 2AM and I'm tired and can't find it
time = String.Format( "{0:D2}:{1:mm}", timeRemaining.Hours, DateTime.MinValue + timeRemaining );
@ -234,7 +234,7 @@ namespace Server.Guilds
{
//Accept the war
guild.PendingWars.Remove( war );
war.WarBeginning = DateTime.Now;
war.WarBeginning = DateTime.UtcNow;
guild.AcceptedWars.Add( war );
if( alliance != null && alliance.IsMember( guild ) )
@ -250,7 +250,7 @@ namespace Server.Guilds
//Technically SHOULD say Your guild is now at war w/out any info, intentional diff.
otherGuild.PendingWars.Remove( otherWar );
otherWar.WarBeginning = DateTime.Now;
otherWar.WarBeginning = DateTime.UtcNow;
otherGuild.AcceptedWars.Add( otherWar );
if( otherAlliance != null && m_Other.Alliance.IsMember( m_Other ) )

View file

@ -1232,7 +1232,7 @@ namespace Server.Gumps
{
from.SendLocalizedMessage( 501389 ); // You cannot redeed a house with a guildstone inside.
}
else if ( Core.ML && from.AccessLevel < AccessLevel.GameMaster && DateTime.Now <= m_House.BuiltOn.AddHours ( 1 ) )
else if ( Core.ML && from.AccessLevel < AccessLevel.GameMaster && DateTime.UtcNow <= m_House.BuiltOn.AddHours ( 1 ) )
{
from.SendLocalizedMessage( 1080178 ); // You must wait one hour between each house demolition.
}

View file

@ -36,13 +36,13 @@ namespace Server.Gumps
}
}
if ( ai.Attacker.Player && (DateTime.Now - ai.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( ai.Attacker ) )
if ( ai.Attacker.Player && (DateTime.UtcNow - ai.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( ai.Attacker ) )
toGive.Add( ai.Attacker );
}
foreach ( AggressorInfo ai in m.Aggressed )
{
if ( ai.Defender.Player && (DateTime.Now - ai.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( ai.Defender ) )
if ( ai.Defender.Player && (DateTime.UtcNow - ai.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( ai.Defender ) )
toGive.Add( ai.Defender );
}

View file

@ -36,7 +36,7 @@ namespace Server.Gumps
AddLabel( 45, y, 0x481, String.Format( "{0} ({1})", inventory.ShopName, inventory.VendorName ) );
TimeSpan expire = inventory.ExpireTime - DateTime.Now;
TimeSpan expire = inventory.ExpireTime - DateTime.UtcNow;
int hours = (int) expire.TotalHours;
AddLabel( 320, y, 0x481, hours.ToString() );

View file

@ -13,9 +13,9 @@ namespace Server.Engines.Events
public static void Initialize()
{
DateTime now = DateTime.Now;
DateTime now = DateTime.UtcNow;
if( DateTime.Now >= HolidaySettings.StartHalloween && DateTime.Now <= HolidaySettings.FinishHalloween )
if( DateTime.UtcNow >= HolidaySettings.StartHalloween && DateTime.UtcNow <= HolidaySettings.FinishHalloween )
{
EventSink.Speech += new SpeechEventHandler( EventSink_Speech );
}
@ -54,7 +54,7 @@ namespace Server.Engines.Events
return;
}
DateTime now = DateTime.Now;
DateTime now = DateTime.UtcNow;
BaseVendor m_Begged = targ as BaseVendor;

View file

@ -22,9 +22,9 @@ namespace Server.Engines.Events
public static void Initialize()
{
DateTime now = DateTime.Now;
DateTime now = DateTime.UtcNow;
if( DateTime.Now >= HolidaySettings.StartHalloween && DateTime.Now <= HolidaySettings.FinishHalloween )
if( DateTime.UtcNow >= HolidaySettings.StartHalloween && DateTime.UtcNow <= HolidaySettings.FinishHalloween )
{
m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromMinutes( .50 ), 0, new TimerCallback( PumpkinPatchSpawnerCallback ));
}

View file

@ -50,7 +50,7 @@ namespace Server.Engines.Events
m_QueueDelaySeconds = 120;
m_QueueClearIntervalSeconds = 1800;
DateTime today = DateTime.Now;
DateTime today = DateTime.UtcNow;
TimeSpan tick = TimeSpan.FromSeconds( m_QueueDelaySeconds );
TimeSpan clear = TimeSpan.FromSeconds( m_QueueClearIntervalSeconds );
@ -89,7 +89,7 @@ namespace Server.Engines.Events
m_DeathQueue.Clear();
if( DateTime.Now <= HolidaySettings.FinishHalloween )
if( DateTime.UtcNow <= HolidaySettings.FinishHalloween )
{
m_ClearTimer.Stop();
}
@ -99,7 +99,7 @@ namespace Server.Engines.Events
{
PlayerMobile player = null;
if( DateTime.Now <= HolidaySettings.FinishHalloween )
if( DateTime.UtcNow <= HolidaySettings.FinishHalloween )
{
for( int index = 0; m_DeathQueue.Count > 0 && index < m_DeathQueue.Count; index++ )
{

View file

@ -67,7 +67,7 @@ namespace Server.Items
public bool CanSign
{
get { return ( !IsSigned || DateTime.Now <= m_EditLimit ); }
get { return ( !IsSigned || DateTime.UtcNow <= m_EditLimit ); }
}
public StValentinesBear( int itemid, string name )
@ -210,7 +210,7 @@ namespace Server.Items
}
if ( !m_Bear.IsSigned )
m_Bear.EditLimit = DateTime.Now + TimeSpan.FromMinutes( 10 );
m_Bear.EditLimit = DateTime.UtcNow + TimeSpan.FromMinutes( 10 );
m_Bear.Line1 = Utility.FixHtml( line1 );
m_Bear.Line2 = Utility.FixHtml( line2 );

View file

@ -49,7 +49,7 @@ namespace Server.Items
public static bool CheckSeason( Mobile from )
{
if ( DateTime.Now.Month == 2 )
if ( DateTime.UtcNow.Month == 2 )
return true;
from.SendLocalizedMessage( 1152318 ); // You may not use this item out of season.

View file

@ -142,7 +142,7 @@ namespace Server.Items
return;
}
if ( DateTime.Now < (m_LastUse + UseDelay) )
if ( DateTime.UtcNow < (m_LastUse + UseDelay) )
return;
Point3D worldLoc = GetWorldLocation();
@ -189,7 +189,7 @@ namespace Server.Items
return;
}
m_LastUse = DateTime.Now;
m_LastUse = DateTime.UtcNow;
from.Direction = from.GetDirectionTo( GetWorldLocation() );
bow.PlaySwingAnimation( from );

View file

@ -93,12 +93,12 @@ namespace Server.Items
if ( m.Player && Utility.InRange( Location, m.Location, 3 ) && !Utility.InRange( Location, oldLocation, 3 ) )
{
if ( DateTime.Now >= m_NextMessage )
if ( DateTime.UtcNow >= m_NextMessage )
{
if ( Components.Count > 0 )
((AddonComponent)Components[0]).SendLocalizedMessageTo( m, 1010061 ); // An overwhelming sense of peace fills you.
m_NextMessage = DateTime.Now + TimeSpan.FromSeconds( 25.0 );
m_NextMessage = DateTime.UtcNow + TimeSpan.FromSeconds( 25.0 );
}
}
}

View file

@ -143,11 +143,11 @@ namespace Server.Items
{
World.Broadcast( 0x35, true, "Solen hives teleporters are being generated, please wait." );
DateTime startTime = DateTime.Now;
DateTime startTime = DateTime.UtcNow;
int count = new SHTeleporterCreator().CreateSHTeleporters();
DateTime endTime = DateTime.Now;
DateTime endTime = DateTime.UtcNow;
World.Broadcast( 0x35, true, "{0} solen hives teleporters have been created. The entire process took {1:F1} seconds.", count, (endTime - startTime).TotalSeconds );
}

View file

@ -396,7 +396,7 @@ namespace Server.Items
if ( m_Timer != null )
writer.Write( m_Timer.Next );
else
writer.Write( DateTime.Now + EvaluationInterval );
writer.Write( DateTime.UtcNow + EvaluationInterval );
// version 0
writer.Write( (int) m_LiveCreatures );
@ -427,10 +427,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, EvaluationInterval, new TimerCallback( Evaluate ) );
m_Timer = Timer.DelayCall( next - DateTime.UtcNow, EvaluationInterval, new TimerCallback( Evaluate ) );
goto case 0;
}

View file

@ -134,7 +134,7 @@ namespace Server.Items
if ( m_DecayTimer != null )
m_DecayTimer.Stop();
m_DecayTime = DateTime.Now + delay;
m_DecayTime = DateTime.UtcNow + delay;
m_DecayTimer = new InternalTimer( this, delay );
m_DecayTimer.Start();
@ -214,7 +214,7 @@ namespace Server.Items
if( reader.ReadBool() )
{
m_DecayTime = reader.ReadDeltaTime();
BeginDecay( m_DecayTime - DateTime.Now );
BeginDecay( m_DecayTime - DateTime.UtcNow );
}
break;
}

View file

@ -118,7 +118,7 @@ namespace Server.Items
int mins = Utility.RandomMinMax( this.MinRespawnMinutes, this.MaxRespawnMinutes );
TimeSpan delay = TimeSpan.FromMinutes( mins );
m_NextRespawnTime = DateTime.Now + delay;
m_NextRespawnTime = DateTime.UtcNow + delay;
m_RespawnTimer = Timer.DelayCall( delay, new TimerCallback( Respawn ) );
}
}
@ -257,7 +257,7 @@ namespace Server.Items
{
m_NextRespawnTime = reader.ReadDeltaTime();
TimeSpan delay = m_NextRespawnTime - DateTime.Now;
TimeSpan delay = m_NextRespawnTime - DateTime.UtcNow;
m_RespawnTimer = Timer.DelayCall( delay > TimeSpan.Zero ? delay : TimeSpan.Zero, new TimerCallback( Respawn ) );
}
else

View file

@ -176,7 +176,7 @@ namespace Server.Items
public InternalTimer( MarkContainer container, TimeSpan delay ) : base( delay )
{
m_Container = container;
m_RelockTime = DateTime.Now + delay;
m_RelockTime = DateTime.UtcNow + delay;
Start();
}
@ -257,7 +257,7 @@ namespace Server.Items
m_AutoLock = reader.ReadBool();
if ( !Locked && m_AutoLock )
m_RelockTimer = new InternalTimer( this, reader.ReadDeltaTime() - DateTime.Now );
m_RelockTimer = new InternalTimer( this, reader.ReadDeltaTime() - DateTime.UtcNow );
m_TargetMap = reader.ReadMap();
m_Target = reader.ReadPoint3D();

View file

@ -57,7 +57,7 @@ namespace Server.Items
{
m_Owner = owner;
m_Level = level;
m_DeleteTime = DateTime.Now + TimeSpan.FromHours( 3.0 );
m_DeleteTime = DateTime.UtcNow + TimeSpan.FromHours( 3.0 );
m_Temporary = temporary;
m_Guardians = new List<Mobile>();
@ -560,7 +560,7 @@ namespace Server.Items
{
private Item m_Item;
public DeleteTimer( Item item, DateTime time ) : base( time - DateTime.Now )
public DeleteTimer( Item item, DateTime time ) : base( time - DateTime.UtcNow )
{
m_Item = item;
Priority = TimerPriority.OneMinute;

View file

@ -265,7 +265,7 @@ namespace Server.Items
if ( m_Item != null && value == null )
{
int delay = Utility.RandomMinMax( this.Entry.MinDelay, this.Entry.MaxDelay );
this.NextRespawn = DateTime.Now + TimeSpan.FromMinutes( delay );
this.NextRespawn = DateTime.UtcNow + TimeSpan.FromMinutes( delay );
}
if ( Instance != null )
@ -287,7 +287,7 @@ namespace Server.Items
set{ m_NextRespawn = value; }
}
public StealableInstance( StealableEntry entry ) : this( entry, null, DateTime.Now )
public StealableInstance( StealableEntry entry ) : this( entry, null, DateTime.UtcNow )
{
}
@ -303,7 +303,7 @@ namespace Server.Items
if ( this.Item != null && ( this.Item.Deleted || this.Item.Movable || this.Item.Parent != null ) )
this.Item = null;
if ( this.Item == null && DateTime.Now >= this.NextRespawn )
if ( this.Item == null && DateTime.UtcNow >= this.NextRespawn )
{
this.Item = this.Entry.CreateInstance();
}

View file

@ -51,7 +51,7 @@ namespace Server.Items
return false;
}
if ( DateTime.Now.Month != 12 )
if ( DateTime.UtcNow.Month != 12 )
{
from.SendLocalizedMessage( 1005700 ); // You will have to wait till next December to put your tree back up for display.
return false;

View file

@ -89,7 +89,7 @@ namespace Server.Engines.Mahjong
m_WallBreakIndicator = new MahjongWallBreakIndicator( this, new Point2D( 335, 335 ) );
m_Dices = new MahjongDices( this );
m_Players = new MahjongPlayers( this, MaxPlayers, BaseScore );
m_LastReset = DateTime.Now;
m_LastReset = DateTime.UtcNow;
m_Level = SecureLevel.CoOwners;
}
@ -189,10 +189,10 @@ namespace Server.Engines.Mahjong
public void ResetGame( Mobile from )
{
if ( DateTime.Now - m_LastReset < TimeSpan.FromSeconds( 5.0 ) )
if ( DateTime.UtcNow - m_LastReset < TimeSpan.FromSeconds( 5.0 ) )
return;
m_LastReset = DateTime.Now;
m_LastReset = DateTime.UtcNow;
if ( from != null )
m_Players.SendLocalizedMessage( 1062771, from.Name ); // ~1_name~ has reset the game.
@ -207,10 +207,10 @@ namespace Server.Engines.Mahjong
public void ResetWalls( Mobile from )
{
if ( DateTime.Now - m_LastReset < TimeSpan.FromSeconds( 5.0 ) )
if ( DateTime.UtcNow - m_LastReset < TimeSpan.FromSeconds( 5.0 ) )
return;
m_LastReset = DateTime.Now;
m_LastReset = DateTime.UtcNow;
BuildWalls();
@ -292,7 +292,7 @@ namespace Server.Engines.Mahjong
m_ShowScores = reader.ReadBool();
m_SpectatorVision = reader.ReadBool();
m_LastReset = DateTime.Now;
m_LastReset = DateTime.UtcNow;
break;
}

View file

@ -58,7 +58,7 @@ namespace Server.Items
{
if ( m_Duration != TimeSpan.Zero && m_Burning )
{
return m_End - DateTime.Now;
return m_End - DateTime.UtcNow;
}
else
return m_Duration;
@ -124,7 +124,7 @@ namespace Server.Items
if ( m_BurntOut )
m_Duration = TimeSpan.Zero;
else if ( m_Duration != TimeSpan.Zero )
m_Duration = m_End - DateTime.Now;
m_Duration = m_End - DateTime.UtcNow;
if ( m_Timer != null )
m_Timer.Stop();
@ -148,7 +148,7 @@ namespace Server.Items
if ( delay == TimeSpan.Zero )
return;
m_End = DateTime.Now + delay;
m_End = DateTime.UtcNow + delay;
m_Timer = new InternalTimer( this, delay );
m_Timer.Start();
@ -206,7 +206,7 @@ namespace Server.Items
m_Protected = reader.ReadBool();
if ( m_Burning && m_Duration != TimeSpan.Zero )
DoTimer( reader.ReadDeltaTime() - DateTime.Now );
DoTimer( reader.ReadDeltaTime() - DateTime.UtcNow );
break;
}

View file

@ -444,10 +444,10 @@ namespace Server.Items
private int m_Count;
private DateTime m_NextSkillTime;
private DateTime m_NextSpellTime;
private DateTime m_NextActionTime;
private DateTime m_LastMoveTime;
private int m_NextSkillTime;
private int m_NextSpellTime;
private int m_NextActionTime;
private int m_LastMoveTime;
public DigTimer( Mobile from, TreasureMap treasureMap, Point3D location, Map map ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 1.0 ) )
{

View file

@ -31,7 +31,7 @@ namespace Server.Items
Movable = false;
m_MinDamage = minDamage;
m_MaxDamage = maxDamage;
m_Created = DateTime.Now;
m_Created = DateTime.UtcNow;
m_Duration = duration;
m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), new TimerCallback( OnTick ) );
}
@ -44,7 +44,7 @@ namespace Server.Items
private void OnTick()
{
DateTime now = DateTime.Now;
DateTime now = DateTime.UtcNow;
TimeSpan age = now - m_Created;
if( age > m_Duration ) {

View file

@ -62,7 +62,7 @@ namespace Server.Items
public static bool CheckTime( DateTime time, TimeSpan range )
{
return (time + range) < DateTime.Now;
return (time + range) < DateTime.UtcNow;
}
public static string FormatTS( TimeSpan ts )
@ -183,7 +183,7 @@ namespace Server.Items
public void PostMessage( Mobile from, BulletinMessage thread, string subject, string[] lines )
{
if ( thread != null )
thread.LastPostTime = DateTime.Now;
thread.LastPostTime = DateTime.UtcNow;
AddItem( new BulletinMessage( from, thread, subject, lines ) );
}
@ -363,7 +363,7 @@ namespace Server.Items
m_Poster = poster;
m_Subject = subject;
m_Time = DateTime.Now;
m_Time = DateTime.UtcNow;
m_LastPostTime = m_Time;
m_Thread = thread;
m_PostedName = m_Poster.Name;

Some files were not shown because too many files have changed in this diff Show more