Core.TickCount for some AI actions
Correction in NewAsyncSockets
This commit is contained in:
parent
92aeef0297
commit
be920e0c31
5 changed files with 19 additions and 17 deletions
|
|
@ -49,7 +49,7 @@ namespace Server.Items
|
||||||
{
|
{
|
||||||
BaseWeapon.InDoubleStrike = true;
|
BaseWeapon.InDoubleStrike = true;
|
||||||
attacker.RevealingAction();
|
attacker.RevealingAction();
|
||||||
attacker.NextCombatTime = Core.TickCount + weapon.OnSwing(attacker, defender).TotalMilliseconds;
|
attacker.NextCombatTime = Core.TickCount + (int)weapon.OnSwing(attacker, defender).TotalMilliseconds;
|
||||||
BaseWeapon.InDoubleStrike = false;
|
BaseWeapon.InDoubleStrike = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1999,9 +1999,9 @@ namespace Server.Mobiles
|
||||||
return delay;
|
return delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateTime m_NextMove;
|
private int m_NextMove;
|
||||||
|
|
||||||
public DateTime NextMove
|
public int NextMove
|
||||||
{
|
{
|
||||||
get { return m_NextMove; }
|
get { return m_NextMove; }
|
||||||
set { m_NextMove = value; }
|
set { m_NextMove = value; }
|
||||||
|
|
@ -2009,7 +2009,7 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
public virtual bool CheckMove()
|
public virtual bool CheckMove()
|
||||||
{
|
{
|
||||||
return (DateTime.UtcNow >= m_NextMove);
|
return (Core.TickCount - m_NextMove >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool DoMove(Direction d)
|
public virtual bool DoMove(Direction d)
|
||||||
|
|
@ -2036,12 +2036,12 @@ namespace Server.Mobiles
|
||||||
// This makes them always move one step, never any direction changes
|
// This makes them always move one step, never any direction changes
|
||||||
m_Mobile.Direction = d;
|
m_Mobile.Direction = d;
|
||||||
|
|
||||||
TimeSpan delay = TimeSpan.FromSeconds(TransformMoveDelay(m_Mobile.CurrentSpeed));
|
int delay = (int)(TransformMoveDelay(m_Mobile.CurrentSpeed) * 1000);
|
||||||
|
|
||||||
m_NextMove += delay;
|
m_NextMove += delay;
|
||||||
|
|
||||||
if (m_NextMove < DateTime.UtcNow)
|
if (Core.TickCount - m_NextMove > 0)
|
||||||
m_NextMove = DateTime.UtcNow;
|
m_NextMove = Core.TickCount;
|
||||||
|
|
||||||
m_Mobile.Pushing = false;
|
m_Mobile.Pushing = false;
|
||||||
|
|
||||||
|
|
@ -2470,13 +2470,13 @@ namespace Server.Mobiles
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Mobile.NextReacquireTime > DateTime.UtcNow)
|
if (Core.TickCount - m_Mobile.NextReacquireTime < 0)
|
||||||
{
|
{
|
||||||
m_Mobile.FocusMob = null;
|
m_Mobile.FocusMob = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Mobile.NextReacquireTime = DateTime.UtcNow + m_Mobile.ReacquireDelay;
|
m_Mobile.NextReacquireTime = Core.TickCount + (int)m_Mobile.ReacquireDelay.TotalMilliseconds;
|
||||||
|
|
||||||
m_Mobile.DebugSay("Acquiring...");
|
m_Mobile.DebugSay("Acquiring...");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -679,7 +679,7 @@ namespace Server.Mobiles
|
||||||
public virtual void BreathStallMovement()
|
public virtual void BreathStallMovement()
|
||||||
{
|
{
|
||||||
if ( m_AI != null )
|
if ( m_AI != null )
|
||||||
m_AI.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds( BreathStallTime );
|
m_AI.NextMove = Core.TickCount + (int)(BreathStallTime * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void BreathPlayAngerSound()
|
public virtual void BreathPlayAngerSound()
|
||||||
|
|
@ -1712,7 +1712,7 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
m_Owners = new List<Mobile>();
|
m_Owners = new List<Mobile>();
|
||||||
|
|
||||||
m_NextReacquireTime = DateTime.UtcNow + ReacquireDelay;
|
m_NextReacquireTime = Core.TickCount + (int)ReacquireDelay.TotalMilliseconds;
|
||||||
|
|
||||||
ChangeAIType(AI);
|
ChangeAIType(AI);
|
||||||
|
|
||||||
|
|
@ -2871,7 +2871,7 @@ namespace Server.Mobiles
|
||||||
if ( m_bSummoned == value )
|
if ( m_bSummoned == value )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_NextReacquireTime = DateTime.UtcNow;
|
m_NextReacquireTime = Core.TickCount;
|
||||||
|
|
||||||
m_bSummoned = value;
|
m_bSummoned = value;
|
||||||
Delta( MobileDelta.Noto );
|
Delta( MobileDelta.Noto );
|
||||||
|
|
@ -3607,7 +3607,7 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
public virtual void ForceReacquire()
|
public virtual void ForceReacquire()
|
||||||
{
|
{
|
||||||
m_NextReacquireTime = DateTime.MinValue;
|
m_NextReacquireTime = Core.TickCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||||
|
|
@ -4962,9 +4962,9 @@ namespace Server.Mobiles
|
||||||
* This functionality appears to be implemented on OSI as well
|
* This functionality appears to be implemented on OSI as well
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private DateTime m_NextReacquireTime;
|
private int m_NextReacquireTime;
|
||||||
|
|
||||||
public DateTime NextReacquireTime{ get{ return m_NextReacquireTime; } set{ m_NextReacquireTime = value; } }
|
public int NextReacquireTime{ get{ return m_NextReacquireTime; } set{ m_NextReacquireTime = value; } }
|
||||||
|
|
||||||
public virtual TimeSpan ReacquireDelay{ get{ return TimeSpan.FromSeconds( 10.0 ); } }
|
public virtual TimeSpan ReacquireDelay{ get{ return TimeSpan.FromSeconds( 10.0 ); } }
|
||||||
public virtual bool ReacquireOnMovement{ get{ return false; } }
|
public virtual bool ReacquireOnMovement{ get{ return false; } }
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ namespace Server.Mobiles
|
||||||
Animate( 111, 5, 1, true, false, 0 ); // Do a little dance...
|
Animate( 111, 5, 1, true, false, 0 ); // Do a little dance...
|
||||||
|
|
||||||
if ( AIObject != null )
|
if ( AIObject != null )
|
||||||
AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds( 1.0 );
|
AIObject.NextMove = Core.TickCount + 1000;
|
||||||
|
|
||||||
if ( list.Count >= 3 )
|
if ( list.Count >= 3 )
|
||||||
{
|
{
|
||||||
|
|
@ -140,7 +140,7 @@ namespace Server.Mobiles
|
||||||
dancer.Animate( 111, 5, 1, true, false, 0 ); // Get down tonight...
|
dancer.Animate( 111, 5, 1, true, false, 0 ); // Get down tonight...
|
||||||
|
|
||||||
if ( dancer.AIObject != null )
|
if ( dancer.AIObject != null )
|
||||||
dancer.AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds( 1.0 );
|
dancer.AIObject.NextMove = Core.TickCount + 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( EndSavageDance ) );
|
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( EndSavageDance ) );
|
||||||
|
|
|
||||||
|
|
@ -709,6 +709,8 @@ namespace Server.Network {
|
||||||
if ( e.SocketError != SocketError.Success || byteCount <= 0 ) {
|
if ( e.SocketError != SocketError.Success || byteCount <= 0 ) {
|
||||||
Dispose( false );
|
Dispose( false );
|
||||||
return;
|
return;
|
||||||
|
} else if ( m_Disposing ) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_NextCheckActivity = Core.TickCount + 90000;
|
m_NextCheckActivity = Core.TickCount + 90000;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue