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:
parent
f99eefb288
commit
d2c670f5c3
241 changed files with 842 additions and 831 deletions
|
|
@ -42,7 +42,7 @@ namespace Server.Misc
|
|||
{
|
||||
AggressorInfo info = list[i];
|
||||
|
||||
if ( info.Attacker == m2 && DateTime.Now < (info.LastCombatTime + Delay) )
|
||||
if ( info.Attacker == m2 && DateTime.UtcNow < (info.LastCombatTime + Delay) )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ namespace Server.Misc
|
|||
{
|
||||
AggressorInfo info = list[i];
|
||||
|
||||
if ( info.Attacker == m1 && DateTime.Now < (info.LastCombatTime + Delay) )
|
||||
if ( info.Attacker == m1 && DateTime.UtcNow < (info.LastCombatTime + Delay) )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Server.Misc
|
|||
{
|
||||
e.Mobile.SendMessage( "You have initiated server shutdown." );
|
||||
Enabled = true;
|
||||
m_RestartTime = DateTime.Now;
|
||||
m_RestartTime = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -48,9 +48,9 @@ namespace Server.Misc
|
|||
{
|
||||
Priority = TimerPriority.FiveSeconds;
|
||||
|
||||
m_RestartTime = DateTime.Now.Date + RestartTime;
|
||||
m_RestartTime = DateTime.UtcNow.Date + RestartTime;
|
||||
|
||||
if ( m_RestartTime < DateTime.Now )
|
||||
if ( m_RestartTime < DateTime.UtcNow )
|
||||
m_RestartTime += TimeSpan.FromDays( 1.0 );
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ namespace Server.Misc
|
|||
if ( m_Restarting || !Enabled )
|
||||
return;
|
||||
|
||||
if ( DateTime.Now < m_RestartTime )
|
||||
if ( DateTime.UtcNow < m_RestartTime )
|
||||
return;
|
||||
|
||||
if ( WarningDelay > TimeSpan.Zero )
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ namespace Server.Misc
|
|||
|
||||
private static string GetTimeStamp()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime now = DateTime.UtcNow;
|
||||
|
||||
return String.Format( "{0}-{1}-{2} {3}-{4:D2}-{5:D2}",
|
||||
now.Day,
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace Server
|
|||
: this( iconID, titleCliloc, secondaryCliloc )
|
||||
{
|
||||
m_TimeLength = length;
|
||||
m_TimeStart = DateTime.Now;
|
||||
m_TimeStart = DateTime.UtcNow;
|
||||
|
||||
m_Timer = Timer.DelayCall( length, new TimerCallback(
|
||||
delegate
|
||||
|
|
@ -228,7 +228,7 @@ namespace Server
|
|||
public sealed class AddBuffPacket : Packet
|
||||
{
|
||||
public AddBuffPacket( Mobile m, BuffInfo info )
|
||||
: this( m, info.ID, info.TitleCliloc, info.SecondaryCliloc, info.Args, (info.TimeStart != DateTime.MinValue) ? ((info.TimeStart + info.TimeLength) - DateTime.Now) : TimeSpan.Zero )
|
||||
: this( m, info.ID, info.TitleCliloc, info.SecondaryCliloc, info.Args, (info.TimeStart != DateTime.MinValue) ? ((info.TimeStart + info.TimeLength) - DateTime.UtcNow) : TimeSpan.Zero )
|
||||
{
|
||||
}
|
||||
public AddBuffPacket( Mobile mob, BuffIcon iconID, int titleCliloc, int secondaryCliloc, TextDefinition args, TimeSpan length )
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ namespace Server.Misc
|
|||
if ( state.Mobile == null || state.Mobile.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
|
||||
if( Required != null && version < Required && ( m_OldClientResponse == OldClientResponse.Kick ||( m_OldClientResponse == OldClientResponse.LenientKick && (DateTime.Now - state.Mobile.CreationTime) > m_AgeLeniency && state.Mobile is PlayerMobile && ((PlayerMobile)state.Mobile).GameTime > m_GameTimeLeniency )))
|
||||
if( Required != null && version < Required && ( m_OldClientResponse == OldClientResponse.Kick ||( m_OldClientResponse == OldClientResponse.LenientKick && (DateTime.UtcNow - state.Mobile.CreationTime) > m_AgeLeniency && state.Mobile is PlayerMobile && ((PlayerMobile)state.Mobile).GameTime > m_GameTimeLeniency )))
|
||||
{
|
||||
kickMessage = String.Format( "This server requires your client version be at least {0}.", Required );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ namespace Server.Misc
|
|||
op.WriteLine( "RunUO Version {0}.{1}, Build {2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision );
|
||||
op.WriteLine( "Operating System: {0}", Environment.OSVersion );
|
||||
op.WriteLine( ".NET Framework: {0}", Environment.Version );
|
||||
op.WriteLine( "Time: {0}", DateTime.Now );
|
||||
op.WriteLine( "Time: {0}", DateTime.UtcNow );
|
||||
|
||||
try { op.WriteLine( "Mobiles: {0}", World.Mobiles.Count ); }
|
||||
catch {}
|
||||
|
|
@ -248,7 +248,7 @@ namespace Server.Misc
|
|||
|
||||
private static string GetTimeStamp()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime now = DateTime.UtcNow;
|
||||
|
||||
return String.Format( "{0}-{1}-{2}-{3}-{4}-{5}",
|
||||
now.Day,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Server
|
|||
if ( ObjectPropertyList.Enabled )
|
||||
PacketHandlers.SingleClickProps = true; // single click for everything is overriden to check object property list
|
||||
|
||||
Mobile.ActionDelay = TimeSpan.FromSeconds( 1.0 );
|
||||
Mobile.ActionDelay = 1000;
|
||||
Mobile.AOSStatusHandler = new AOSStatusHandler( AOS.GetStatus );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ namespace Server.Guilds
|
|||
if( w == null )
|
||||
return WarStatus.Win;
|
||||
|
||||
if( m_WarLength != TimeSpan.Zero && (m_WarBeginning + m_WarLength) < DateTime.Now )
|
||||
if( m_WarLength != TimeSpan.Zero && (m_WarBeginning + m_WarLength) < DateTime.UtcNow )
|
||||
{
|
||||
if( m_Kills > w.m_Kills )
|
||||
return WarStatus.Win;
|
||||
|
|
@ -1000,7 +1000,7 @@ namespace Server.Guilds
|
|||
m_Candidates = new List<Mobile>();
|
||||
m_Accepted = new List<Mobile>();
|
||||
|
||||
m_LastFealty = DateTime.Now;
|
||||
m_LastFealty = DateTime.UtcNow;
|
||||
|
||||
m_Name = name;
|
||||
m_Abbreviation = abbreviation;
|
||||
|
|
@ -1196,7 +1196,7 @@ namespace Server.Guilds
|
|||
#region Serialization
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
if ( this.LastFealty+TimeSpan.FromDays( 1.0 ) < DateTime.Now )
|
||||
if ( this.LastFealty+TimeSpan.FromDays( 1.0 ) < DateTime.UtcNow )
|
||||
this.CalculateGuildmaster();
|
||||
|
||||
CheckExpiredWars();
|
||||
|
|
@ -1598,7 +1598,7 @@ namespace Server.Guilds
|
|||
if( NewGuildSystem )
|
||||
{
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
if( pm == null || pm.LastOnline + InactiveTime < DateTime.Now )
|
||||
if( pm == null || pm.LastOnline + InactiveTime < DateTime.UtcNow )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1663,7 +1663,7 @@ namespace Server.Guilds
|
|||
GuildMessage( 1018015, true, winner.Name ); // Guild Message: Guildmaster changed to:
|
||||
|
||||
Leader = winner;
|
||||
m_LastFealty = DateTime.Now;
|
||||
m_LastFealty = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -1769,7 +1769,7 @@ namespace Server.Guilds
|
|||
if ( m_Type != value )
|
||||
{
|
||||
m_Type = value;
|
||||
m_TypeLastChange = DateTime.Now;
|
||||
m_TypeLastChange = DateTime.UtcNow;
|
||||
|
||||
InvalidateMemberProperties();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ namespace Server
|
|||
info.m_Language = pvSrc.ReadUnicodeStringLESafe( 4 );
|
||||
info.m_Unknown = pvSrc.ReadStringSafe( 64 );
|
||||
|
||||
info.m_TimeReceived = DateTime.Now;
|
||||
info.m_TimeReceived = DateTime.UtcNow;
|
||||
|
||||
Account acct = state.Account as Account;
|
||||
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ namespace Server.Misc
|
|||
if( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead)) )
|
||||
actual = Notoriety.Murderer;
|
||||
|
||||
if( DateTime.Now >= (target.TimeOfDeath + Corpse.MonsterLootRightSacrifice) )
|
||||
if( DateTime.UtcNow >= (target.TimeOfDeath + Corpse.MonsterLootRightSacrifice) )
|
||||
return actual;
|
||||
|
||||
Party sourceParty = Party.Get( source );
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace Server.Misc
|
|||
if ( a == null )
|
||||
return "";
|
||||
|
||||
TimeSpan ts = DateTime.Now - a.Created;
|
||||
TimeSpan ts = DateTime.UtcNow - a.Created;
|
||||
|
||||
string v;
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Server.Misc
|
|||
|
||||
try
|
||||
{
|
||||
TimeSpan ts = (m_StartTime + m_Duration) - DateTime.Now;
|
||||
TimeSpan ts = (m_StartTime + m_Duration) - DateTime.UtcNow;
|
||||
|
||||
if ( ts < TimeSpan.Zero )
|
||||
return TimeSpan.Zero;
|
||||
|
|
@ -92,7 +92,7 @@ namespace Server.Misc
|
|||
|
||||
if ( m_Active )
|
||||
{
|
||||
m_StartTime = DateTime.Now;
|
||||
m_StartTime = DateTime.UtcNow;
|
||||
m_ActivePollers.Add( this );
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ namespace Server.Misc
|
|||
#region Scroll of Alacrity
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm != null && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.Now )
|
||||
if ( pm != null && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.UtcNow )
|
||||
toGain *= Utility.RandomMinMax(2, 5);
|
||||
#endregion
|
||||
|
||||
|
|
@ -345,38 +345,38 @@ namespace Server.Misc
|
|||
case Stat.Str:
|
||||
{
|
||||
if ( from is BaseCreature && ((BaseCreature)from).Controlled ) {
|
||||
if ( (from.LastStrGain + m_PetStatGainDelay) >= DateTime.Now )
|
||||
if ( (from.LastStrGain + m_PetStatGainDelay) >= DateTime.UtcNow )
|
||||
return;
|
||||
}
|
||||
else if( (from.LastStrGain + m_StatGainDelay) >= DateTime.Now )
|
||||
else if( (from.LastStrGain + m_StatGainDelay) >= DateTime.UtcNow )
|
||||
return;
|
||||
|
||||
from.LastStrGain = DateTime.Now;
|
||||
from.LastStrGain = DateTime.UtcNow;
|
||||
break;
|
||||
}
|
||||
case Stat.Dex:
|
||||
{
|
||||
if ( from is BaseCreature && ((BaseCreature)from).Controlled ) {
|
||||
if ( (from.LastDexGain + m_PetStatGainDelay) >= DateTime.Now )
|
||||
if ( (from.LastDexGain + m_PetStatGainDelay) >= DateTime.UtcNow )
|
||||
return;
|
||||
}
|
||||
else if( (from.LastDexGain + m_StatGainDelay) >= DateTime.Now )
|
||||
else if( (from.LastDexGain + m_StatGainDelay) >= DateTime.UtcNow )
|
||||
return;
|
||||
|
||||
from.LastDexGain = DateTime.Now;
|
||||
from.LastDexGain = DateTime.UtcNow;
|
||||
break;
|
||||
}
|
||||
case Stat.Int:
|
||||
{
|
||||
if ( from is BaseCreature && ((BaseCreature)from).Controlled ) {
|
||||
if ( (from.LastIntGain + m_PetStatGainDelay) >= DateTime.Now )
|
||||
if ( (from.LastIntGain + m_PetStatGainDelay) >= DateTime.UtcNow )
|
||||
return;
|
||||
}
|
||||
|
||||
else if( (from.LastIntGain + m_StatGainDelay) >= DateTime.Now )
|
||||
else if( (from.LastIntGain + m_StatGainDelay) >= DateTime.UtcNow )
|
||||
return;
|
||||
|
||||
from.LastIntGain = DateTime.Now;
|
||||
from.LastIntGain = DateTime.UtcNow;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue