Final Deceit Brazier for OSI Clone accurate...

This commit is contained in:
ravenal 2009-11-13 06:36:28 +00:00
parent 0b389e4fa2
commit 14efdef34c

View file

@ -127,58 +127,25 @@ namespace Server.Items
public virtual void HeedWarning() public virtual void HeedWarning()
{ {
if( m_IsWarning ) PublicOverheadMessage( MessageType.Regular, 0x3B2, 500761 );// Heed this warning well, and use this brazier at your own peril.
PublicOverheadMessage( MessageType.Regular, 0x3B2, 500761 );// Heed this warning well, and use this brazier at your own peril.
} }
public override bool HandlesOnMovement { get { return true; } } public override bool HandlesOnMovement { get { return true; } }
private bool m_IsWarning;
private List<Serial> m_Players = new List<Serial>();
public override void OnMovement( Mobile m, Point3D oldLocation ) public override void OnMovement( Mobile m, Point3D oldLocation )
{ {
if( m_NextSpawn < DateTime.Now ) // means we haven't spawned anything if the next spawn is below if( m_NextSpawn < DateTime.Now ) // means we haven't spawned anything if the next spawn is below
{ {
if( !m_IsWarning && Utility.InRange( m.Location, Location, 1 ) && !Utility.InRange( oldLocation, Location, 1 ) && m.Player && !(m.AccessLevel > AccessLevel.Player || m.Hidden) ) if( Utility.InRange( m.Location, Location, 1 ) && !Utility.InRange( oldLocation, Location, 1 ) && m.Player && !(m.AccessLevel > AccessLevel.Player || m.Hidden) )
{ {
m_IsWarning = true; if( m_Timer == null || !m_Timer.Running )
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 2 ), new TimerCallback( HeedWarning ) );
m_Players.Add( m.Serial );
HeedWarning();
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1 ), TimeSpan.FromSeconds( 1 ), new TimerCallback( HeedWarning ) );
}
else
{
if( m_Players.Contains( m.Serial ) )
m_Players.Remove( m.Serial );
if( m_IsWarning && !Utility.InRange( m.Location, Location, 1 ) && Utility.InRange( oldLocation, Location, 1 ) && m.Player && !(m.AccessLevel > AccessLevel.Player || m.Hidden) && m_Players.Count == 0 )
{
if( m_Timer != null )
{
m_IsWarning = false;
m_Timer.Stop();
m_Timer = null;
}
}
} }
} }
base.OnMovement( m, oldLocation ); base.OnMovement( m, oldLocation );
} }
public override void OnAfterDelete()
{
if( m_Timer != null )
{
m_IsWarning = false;
m_Timer.Stop();
m_Timer = null;
}
base.OnAfterDelete();
}
public Point3D GetSpawnPosition() public Point3D GetSpawnPosition()
{ {
Map map = Map; Map map = Map;
@ -223,23 +190,19 @@ namespace Server.Items
{ {
Point3D spawnLoc = GetSpawnPosition(); Point3D spawnLoc = GetSpawnPosition();
DoEffect( Location, Map ); DoEffect( spawnLoc, map );
Timer.DelayCall( TimeSpan.FromSeconds( 1 ), delegate() Timer.DelayCall( TimeSpan.FromSeconds( 1 ), delegate()
{ {
bc.Home = Location; bc.Home = Location;
bc.RangeHome = m_SpawnRange; bc.RangeHome = m_SpawnRange;
bc.FightMode = FightMode.Closest;
bc.MoveToWorld( spawnLoc, map ); bc.MoveToWorld( spawnLoc, map );
DoEffect( bc.Location, bc.Map ); DoEffect( spawnLoc, map );
if( m_Timer != null ) bc.ForceReacquire();
{
m_IsWarning = false;
m_Timer.Stop();
m_Timer = null;
}
} ); } );
m_NextSpawn = DateTime.Now + m_NextSpawnDelay; m_NextSpawn = DateTime.Now + m_NextSpawnDelay;