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
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 ) ) )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue