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

@ -93,14 +93,14 @@ namespace Server.Mobiles
from.SendLocalizedMessage( 1080400 ); // You can not milk the cow from this location.
if ( Controlled && ControlMaster != from )
from.SendLocalizedMessage( 1071182 ); // The cow nimbly escapes your attempts to milk it.
if ( m_Milk == 0 && m_MilkedOn + TimeSpan.FromDays( 1 ) > DateTime.Now )
if ( m_Milk == 0 && m_MilkedOn + TimeSpan.FromDays( 1 ) > DateTime.UtcNow )
from.SendLocalizedMessage( 1080198 ); // This cow can not be milked now. Please wait for some time.
else
{
if ( m_Milk == 0 )
m_Milk = 4;
m_MilkedOn = DateTime.Now;
m_MilkedOn = DateTime.UtcNow;
m_Milk--;
return true;

View file

@ -15,12 +15,12 @@ namespace Server.Mobiles
public DateTime NextWoolTime
{
get{ return m_NextWoolTime; }
set{ m_NextWoolTime = value; Body = ( DateTime.Now >= m_NextWoolTime ) ? 0xCF : 0xDF; }
set{ m_NextWoolTime = value; Body = ( DateTime.UtcNow >= m_NextWoolTime ) ? 0xCF : 0xDF; }
}
public void Carve( Mobile from, Item item )
{
if ( DateTime.Now < m_NextWoolTime )
if ( DateTime.UtcNow < m_NextWoolTime )
{
// This sheep is not yet ready to be shorn.
PrivateOverheadMessage( MessageType.Regular, 0x3B2, 500449, from.NetState );
@ -30,13 +30,13 @@ namespace Server.Mobiles
from.SendLocalizedMessage( 500452 ); // You place the gathered wool into your backpack.
from.AddToBackpack( new Wool( Map == Map.Felucca ? 2 : 1 ) );
NextWoolTime = DateTime.Now + TimeSpan.FromHours( 3.0 ); // TODO: Proper time delay
NextWoolTime = DateTime.UtcNow + TimeSpan.FromHours( 3.0 ); // TODO: Proper time delay
}
public override void OnThink()
{
base.OnThink();
Body = ( DateTime.Now >= m_NextWoolTime ) ? 0xCF : 0xDF;
Body = ( DateTime.UtcNow >= m_NextWoolTime ) ? 0xCF : 0xDF;
}
[Constructable]

View file

@ -299,10 +299,10 @@ namespace Server.Mobiles
if( attacker == null )
attacker = m_Rider.FindMostRecentDamager( true );
if( !(attacker == this || attacker == m_Rider || willKill || DateTime.Now < m_NextMountAbility) )
if( !(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < m_NextMountAbility) )
{
if( DoMountAbility( amount, from ) )
m_NextMountAbility = DateTime.Now + MountAbilityDelay;
m_NextMountAbility = DateTime.UtcNow + MountAbilityDelay;
}
}