using System;
using System.Collections;
using Server.Items;
using Server.ContextMenus;
using Server.Misc;
using Server.Network;

namespace Server.Mobiles
{
	public class Citizen : BaseCreature
	{
		public override bool ClickTitle{ get{ return false; } }
		public override bool ShowFameTitle { get { return false; } }
		public override bool DeleteCorpseOnDeath{ get{ return true; } }

		public DateTime m_NextTalk;
		public DateTime NextTalk{ get{ return m_NextTalk; } set{ m_NextTalk = value; } }

		public override void OnMovement( Mobile m, Point3D oldLocation )
		{
			if ( DateTime.Now >= m_NextTalk && InRange( m, 30 ) )
			{
				if ( Utility.RandomBool() ){ Server.Misc.CitizenTalking.CitizenTalk( this ); }
				m_NextTalk = (DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 15, 45 ) ));

				if ( this is CitizenNorth || this is CitizenSouth || this is CitizenEast || this is CitizenWest )
					Server.Misc.CitizenDressing.RemoveMyGear( this );
			}
		}

		[Constructable]
		public Citizen() : base( AIType.AI_Citizen, FightMode.None, 10, 1, 0.2, 0.4 )
		{
			SpeechHue = Utility.RandomSpeechHue();
			Title = Server.Misc.CitizenTitles.CitizenTitle( this );
			Hue = Utility.RandomSkinHue();
			CantWalk = true;
			NameHue = Utility.RandomOrangeHue();
			Invulnerable = true;
			Clan = Clan.Citizen;

			SetStr( 300 );
			SetDex( 300 );
			SetInt( 300 );

			SetDamage( 30, 50 );

			int hair = Utility.RandomHairHue();

			if ( this.Female = Utility.RandomBool() )
			{
				Body = 0x191;
				Name = NameList.RandomName( "female" );
			}
			else
			{
				Body = 0x190;
				Name = NameList.RandomName( "male" );
				if ( Utility.RandomBool() ){ Utility.AssignRandomFacialHair( this, hair ); }
			}

			Utility.AssignRandomHair( this, hair );

			Server.Misc.CitizenDressing.CitizenDress( this, 0 );
		}

		public override void OnThink()
		{
		}

		public override bool IsEnemy( Mobile m )
		{
			return false;
		}

		public Citizen( Serial serial ) : base( serial )
		{
		}

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

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
	public class AdventurerEast : Citizen
	{
		[Constructable]
		public AdventurerEast() : base( )
		{
			Direction = Direction.East;
		}

		public AdventurerEast( Serial serial ) : base( serial )
		{
		}

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

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
	public class AdventurerWest : Citizen
	{
		[Constructable]
		public AdventurerWest() : base( )
		{
			Direction = Direction.West;
		}

		public AdventurerWest( Serial serial ) : base( serial )
		{
		}

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

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
	public class AdventurerSouth : Citizen
	{
		[Constructable]
		public AdventurerSouth() : base( )
		{
			Direction = Direction.South;
		}

		public AdventurerSouth( Serial serial ) : base( serial )
		{
		}

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

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
	public class AdventurerNorth : Citizen
	{
		[Constructable]
		public AdventurerNorth() : base( )
		{
			Direction = Direction.North;
		}

		public AdventurerNorth( Serial serial ) : base( serial )
		{
		}

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

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
	public class CitizenEast : Citizen
	{
		[Constructable]
		public CitizenEast() : base( )
		{
			Direction = Direction.East;
		}

		public CitizenEast( Serial serial ) : base( serial )
		{
		}

		public override void OnAfterSpawn()
		{
			base.OnAfterSpawn();
			Server.Misc.CitizenDressing.RemoveMyGear( this );
		}

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

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
	public class CitizenWest : Citizen
	{
		[Constructable]
		public CitizenWest() : base( )
		{
			Direction = Direction.West;
		}

		public CitizenWest( Serial serial ) : base( serial )
		{
		}

		public override void OnAfterSpawn()
		{
			base.OnAfterSpawn();
			Server.Misc.CitizenDressing.RemoveMyGear( this );
		}

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

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
	public class CitizenSouth : Citizen
	{
		[Constructable]
		public CitizenSouth() : base( )
		{
			Direction = Direction.South;
		}

		public CitizenSouth( Serial serial ) : base( serial )
		{
		}

		public override void OnAfterSpawn()
		{
			base.OnAfterSpawn();
			Server.Misc.CitizenDressing.RemoveMyGear( this );
		}

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

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
	public class CitizenNorth : Citizen
	{
		[Constructable]
		public CitizenNorth() : base( )
		{
			Direction = Direction.North;
		}

		public CitizenNorth( Serial serial ) : base( serial )
		{
		}

		public override void OnThink()
		{
			Server.Misc.CitizenDressing.RemoveMyGear( this );
		}

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

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