/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Death on Nov-01-2011 07:27:00pm
Filepath: scripts\_custom\events and scenarios\Halloween2011\Mobiles\Spirits\HintGhostB.cs
Lines of code: 96
***********************************************************/


using System;
using Server;
using Server.ContextMenus;
using Server.Accounting;
using Server.Gumps;
using Server.Items;
using Server.Menus;
using Server.Menus.Questions;
using Server.Mobiles;
using Server.Network;
using Server.Prompts;
using Server.Regions;
using Server.Misc;
using System.Collections;
using System.Collections.Generic;

namespace Server.Mobiles
{
	[CorpseName( "The corpse of a spirit" )]
	public class HintGhostF : BaseCreature
	{
		public override bool ClickTitle{ get { return false; } }
		
		public virtual int AutoTalkRange{ get{ return -1; } }
		public virtual int AutoSpeakRange{ get{ return 3; } }		
		public virtual TimeSpan SpeakDelay{ get{ return TimeSpan.FromSeconds( 10 ); } }
		
		private DateTime m_Spoken;	
                
		[Constructable]
		public HintGhostF() : base( AIType.AI_Animal, FightMode.None, 10, 1, 0.2, 0.4 )
		{	
			Name = "a wandering spirit";
			Body = 401;
			Hue = 0;
			BaseSoundID = 263;
			Blessed = true;

			SetStr( 26, 40 );
			SetDex( 26, 40 );
			SetInt( 26, 40 );

			SetHits( 16, 24 );

			SetDamage( 0 );

			SetDamageType( ResistanceType.Physical, 100 );

			SetResistance( ResistanceType.Physical, 200 );
			SetResistance( ResistanceType.Fire, 200 );
			SetResistance( ResistanceType.Cold, 200 );
			SetResistance( ResistanceType.Poison, 200 );
			SetResistance( ResistanceType.Energy, 200 );

			SetSkill( SkillName.MagicResist, 20.1, 30.0 );
			SetSkill( SkillName.Swords, 20.1, 30.0 );
			SetSkill( SkillName.Tactics, 20.1, 30.0 );
			SetSkill( SkillName.Wrestling, 200.1, 300.0 );
			
			Item shroud = new HoodedShroudOfShadows();

			shroud.Movable = false;
			shroud.Hue = 1001;
			
			AddItem( shroud );
		}
		
		public HintGhostF( Serial serial ) : base( serial )
		{
		}
		
		public override void OnMovement( Mobile m, Point3D oldLocation )
		{
			if ( m.Alive && !m.Hidden && m is PlayerMobile )
			{
				PlayerMobile pm = (PlayerMobile)m;

				int range = AutoTalkRange;
					
				range = AutoSpeakRange;
				
				if ( range >= 0 && InRange( m, range ) && !InRange( oldLocation, range ) && DateTime.Now >= m_Spoken + SpeakDelay )
				{
					if ( m.Alive && m is PlayerMobile ) {
						PlayerMobile mobile = (PlayerMobile)m;
						Container pack = mobile.Backpack;
						if ( pack != null ) {
							Item spiritspeaker = mobile.Backpack.FindItemByType(typeof(SoundOfSpirits));
							if (spiritspeaker == null)
							{
								mobile.SendMessage("The spirit speaks, but you cannot hear it");
							}
							else
							{
								mobile.SendMessage("The spirit speaks: Gladis the Recluse always mutters 'brats' at that teleporter of hers.");
							}
						}
					}	
					m_Spoken = DateTime.Now;
				}
			}
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( (int) 0 );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}	
}

