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
|
|
@ -176,7 +176,7 @@ namespace Server.Mobiles
|
|||
pack.Visible = false;
|
||||
AddItem( pack );
|
||||
|
||||
m_LastRestock = DateTime.Now;
|
||||
m_LastRestock = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public BaseVendor( Serial serial )
|
||||
|
|
@ -228,7 +228,7 @@ namespace Server.Mobiles
|
|||
|
||||
protected void LoadSBInfo()
|
||||
{
|
||||
m_LastRestock = DateTime.Now;
|
||||
m_LastRestock = DateTime.UtcNow;
|
||||
|
||||
for ( int i = 0; i < m_ArmorBuyInfo.Count; ++i )
|
||||
{
|
||||
|
|
@ -510,7 +510,7 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual void Restock()
|
||||
{
|
||||
m_LastRestock = DateTime.Now;
|
||||
m_LastRestock = DateTime.UtcNow;
|
||||
|
||||
IBuyItemInfo[] buyInfo = this.GetBuyInfo();
|
||||
|
||||
|
|
@ -534,7 +534,7 @@ namespace Server.Mobiles
|
|||
return;
|
||||
}
|
||||
|
||||
if ( DateTime.Now - m_LastRestock > RestockDelay )
|
||||
if ( DateTime.UtcNow - m_LastRestock > RestockDelay )
|
||||
Restock();
|
||||
|
||||
UpdateBuyInfo();
|
||||
|
|
@ -583,7 +583,7 @@ namespace Server.Mobiles
|
|||
|
||||
Item item = playerItems[i];
|
||||
|
||||
if ( ( item.LastMoved + InventoryDecayTime ) <= DateTime.Now )
|
||||
if ( ( item.LastMoved + InventoryDecayTime ) <= DateTime.UtcNow )
|
||||
item.Delete();
|
||||
}
|
||||
|
||||
|
|
@ -747,7 +747,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( Core.ML && pm != null && pm.NextBODTurnInTime > DateTime.Now )
|
||||
if ( Core.ML && pm != null && pm.NextBODTurnInTime > DateTime.UtcNow )
|
||||
{
|
||||
SayTo( from, 1079976 ); // You'll have to wait a few seconds while I inspect the last order.
|
||||
return false;
|
||||
|
|
@ -788,7 +788,7 @@ namespace Server.Mobiles
|
|||
OnSuccessfulBulkOrderReceive( from );
|
||||
|
||||
if ( Core.ML && pm != null )
|
||||
pm.NextBODTurnInTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
|
||||
pm.NextBODTurnInTime = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 );
|
||||
|
||||
dropped.Delete();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ namespace Server.Mobiles
|
|||
m_PayTimer = new PayTimer( this, delay );
|
||||
m_PayTimer.Start();
|
||||
|
||||
m_NextPayTime = DateTime.Now + delay;
|
||||
m_NextPayTime = DateTime.UtcNow + delay;
|
||||
}
|
||||
|
||||
public PlayerVendor( Serial serial ) : base( serial )
|
||||
|
|
@ -397,7 +397,7 @@ namespace Server.Mobiles
|
|||
|
||||
string description = reader.ReadString();
|
||||
|
||||
DateTime created = version < 1 ? DateTime.Now : reader.ReadDateTime();
|
||||
DateTime created = version < 1 ? DateTime.UtcNow : reader.ReadDateTime();
|
||||
|
||||
if ( item != null )
|
||||
{
|
||||
|
|
@ -423,7 +423,7 @@ namespace Server.Mobiles
|
|||
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( FixDresswear ) );
|
||||
}
|
||||
|
||||
m_NextPayTime = DateTime.Now + PayTimer.GetInterval();
|
||||
m_NextPayTime = DateTime.UtcNow + PayTimer.GetInterval();
|
||||
|
||||
if ( newVendorSystemActivated )
|
||||
{
|
||||
|
|
@ -435,7 +435,7 @@ namespace Server.Mobiles
|
|||
if ( version < 2 && RawStr == 75 && RawDex == 75 && RawInt == 75 )
|
||||
InitStats( 100, 100, 25 );
|
||||
|
||||
TimeSpan delay = m_NextPayTime - DateTime.Now;
|
||||
TimeSpan delay = m_NextPayTime - DateTime.UtcNow;
|
||||
|
||||
m_PayTimer = new PayTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero );
|
||||
m_PayTimer.Start();
|
||||
|
|
@ -784,7 +784,7 @@ namespace Server.Mobiles
|
|||
|
||||
private VendorItem SetVendorItem( Item item, int price, string description )
|
||||
{
|
||||
return SetVendorItem( item, price, description, DateTime.Now );
|
||||
return SetVendorItem( item, price, description, DateTime.UtcNow );
|
||||
}
|
||||
|
||||
private VendorItem SetVendorItem( Item item, int price, string description, DateTime created )
|
||||
|
|
@ -1109,7 +1109,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
vendor.SayTo( from, 503202 ); // This item is not for sale.
|
||||
}
|
||||
else if ( vi.Created + TimeSpan.FromMinutes( 1.0 ) > DateTime.Now )
|
||||
else if ( vi.Created + TimeSpan.FromMinutes( 1.0 ) > DateTime.UtcNow )
|
||||
{
|
||||
from.SendMessage( "You cannot buy this item right now. Please wait one minute and try again." );
|
||||
}
|
||||
|
|
@ -1388,7 +1388,7 @@ namespace Server.Mobiles
|
|||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Vendor.m_NextPayTime = DateTime.Now + this.Interval;
|
||||
m_Vendor.m_NextPayTime = DateTime.UtcNow + this.Interval;
|
||||
|
||||
int pay;
|
||||
int totalGold;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace Server.Mobiles
|
|||
|
||||
m_RentalGold = rentalGold;
|
||||
|
||||
m_RentalExpireTime = DateTime.Now + duration.Duration;
|
||||
m_RentalExpireTime = DateTime.UtcNow + duration.Duration;
|
||||
m_RentalExpireTimer = new RentalExpireTimer( this, duration.Duration );
|
||||
m_RentalExpireTimer.Start();
|
||||
}
|
||||
|
|
@ -154,7 +154,7 @@ namespace Server.Mobiles
|
|||
|
||||
public void ComputeRentalExpireDelay( out int days, out int hours )
|
||||
{
|
||||
TimeSpan delay = RentalExpireTime - DateTime.Now;
|
||||
TimeSpan delay = RentalExpireTime - DateTime.UtcNow;
|
||||
|
||||
if ( delay <= TimeSpan.Zero )
|
||||
{
|
||||
|
|
@ -388,7 +388,7 @@ namespace Server.Mobiles
|
|||
|
||||
m_RentalExpireTime = reader.ReadDeltaTime();
|
||||
|
||||
TimeSpan delay = m_RentalExpireTime - DateTime.Now;
|
||||
TimeSpan delay = m_RentalExpireTime - DateTime.UtcNow;
|
||||
m_RentalExpireTimer = new RentalExpireTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero );
|
||||
m_RentalExpireTimer.Start();
|
||||
}
|
||||
|
|
@ -415,7 +415,7 @@ namespace Server.Mobiles
|
|||
|
||||
m_Vendor.RentalPrice = renewalPrice;
|
||||
|
||||
m_Vendor.m_RentalExpireTime = DateTime.Now + m_Vendor.RentalDuration.Duration;
|
||||
m_Vendor.m_RentalExpireTime = DateTime.UtcNow + m_Vendor.RentalDuration.Duration;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace Server.Mobiles
|
|||
|
||||
m_Items = new List<Item>();
|
||||
|
||||
m_ExpireTime = DateTime.Now + GracePeriod;
|
||||
m_ExpireTime = DateTime.UtcNow + GracePeriod;
|
||||
m_ExpireTimer = new ExpireTimer( this, GracePeriod );
|
||||
m_ExpireTimer.Start();
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
else
|
||||
{
|
||||
TimeSpan delay = m_ExpireTime - DateTime.Now;
|
||||
TimeSpan delay = m_ExpireTime - DateTime.UtcNow;
|
||||
m_ExpireTimer = new ExpireTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero );
|
||||
m_ExpireTimer.Start();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue