/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: http://www.uovalor.com
Last modified by Death on Jan-25-2011 08:34:26pm
Filepath: scripts\_custom\events and scenarios\Slime Event 2011\Villagers\Decoys\SlimeEventDecoyZentoVillager.cs
Lines of code: 197
***********************************************************/


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 poor villager" )]
	public class SlimeEventDecoyZentoVillager : 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 SlimeEventDecoyZentoVillager() : base( AIType.AI_Animal, FightMode.None, 10, 1, 0.2, 0.4 )
		{
			InitBody();
			InitOutfit();	
			Title = "the villager";	
			Fame = 0;
			Karma = 11000;			
		}
		
		public SlimeEventDecoyZentoVillager( Serial serial ) : base( serial )
		{
		}
		
		public virtual void InitBody()
		{
			InitStats( 125, 125, 125 );

			SpeechHue = Utility.RandomDyedHue();
			Hue = Utility.RandomSkinHue();

			if ( Female = GetGender() )
			{
				Body = 0x191;
				Name = NameList.RandomName( "tokuno female" );
			}
			else
			{
				Body = 0x190;
				Name = NameList.RandomName( "tokuno male" );
			}
		}
		
		public virtual bool GetGender()
		{
			return Utility.RandomBool();
		}
		
		public virtual VendorShoeType ShoeType
		{
			get{ return VendorShoeType.Shoes; }
		}
		
		public virtual int GetHairHue()
		{
			return Utility.RandomHairHue();
		}
		
		public virtual int GetRandomHue()
		{
			switch ( Utility.Random( 5 ) )
			{
				default:
				case 0: return Utility.RandomBlueHue();
				case 1: return Utility.RandomGreenHue();
				case 2: return Utility.RandomRedHue();
				case 3: return Utility.RandomYellowHue();
				case 4: return Utility.RandomNeutralHue();
			}
		}

		public virtual int GetShoeHue()
		{
			if ( 0.1 > Utility.RandomDouble() )
				return 0;

			return Utility.RandomNeutralHue();
		}

		public virtual void InitOutfit()
		{
		
			AddItem( new Kasa() );
		
			switch (  Utility.Random( 5 ) )
			{
				case 0: AddItem( new FurBoots( ) ); break;
				case 1: AddItem( new SamuraiTabi( ) ); break;
				case 2: AddItem( new Sandals( ) ); break;
				case 3: AddItem( new NinjaTabi( ) ); break;
				case 4: AddItem( new Waraji( ) ); break;
			}

			int hairHue = GetHairHue();

			Utility.AssignRandomHair( this, hairHue );
			Utility.AssignRandomFacialHair( this, hairHue );

			if ( Female )
			{
				switch ( Utility.Random( 3 ) )
				{
					case 0: AddItem( new FemaleKimono() ); AddItem( new Obi() ); break;
					case 1: AddItem( new Kamishimo( GetRandomHue() ) ); break;
					case 2: AddItem( new HakamaShita( GetRandomHue() ) ); break;
				}
				
				AddItem( new TattsukeHakama()); 
			}
			else
			{
				switch ( Utility.Random( 3 ) )
				{
					case 0: AddItem( new MaleKimono() ); AddItem( new Obi() ); break;
					case 1: AddItem( new Kamishimo( GetRandomHue() ) ); break;
					case 2: AddItem( new HakamaShita( GetRandomHue() ) ); break;
				}
				
				AddItem( new TattsukeHakama()); 
			}
		}
		
		public virtual void SmallTalk()
		{
			switch (Utility.RandomMinMax( 0, 6 ))
			{
				case 0: 
				Say("I hope to visit Lydia in Jhelom later but for now I'm far too busy!"); break;
				case 1: 
				Say("Oh how the cranes chant merrily today!"); break;
				case 2: 
				Say("Sorry, can't stop to talk now, I'm off to harvest tea leaves"); break;
				case 3: 
				Say("I hope the fishing's good, I'll be out there all day!"); break;
				case 4: 
				Say("It's good to see Lydia back in Jhelom. I hear she's been researching slimes since she's been back"); break;
				case 5: 
				Say("It's my first time venturing out to Jhelom. I hear the researcher, Lydia, has a quest to offer"); break;
				case 6: 
				Say("The hiryu are particularly aggressive today, be careful if you venture out!"); break;
			}
		}
		
		public virtual void GiveHint()
		{
			switch (Utility.RandomMinMax( 0, 6 ))
			{
				case 0: 
				Say("I'm not all that interested in acid slimes, but somebody else may be"); break;
				case 1: 
				Say("I wish I could tell you where to find acid slimes but I haven't the faintest idea."); break;
				case 2: 
				Say("I haven't seen any acid slimes, sorry."); break;
				case 3: 
				Say("Acid slimes? Only slime I've been seeing lately has come from run-ins with a group of kappa."); break;
				case 4: 
				Say("Acid slimes? I don't think I would have even noticed a difference!"); break;
				case 5: 
				Say("I've never seen an acid slime, but that might explain the holes in my laundry!"); break;
				case 6: 
				Say("Ask the other villagers about these 'acid slimes'. I'm sure they'll know more about them than I do."); break;
			}
		}
		
		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 ( Utility.Random( 100 ) < 50 ) {
						if ( m.Alive && m is PlayerMobile ) {
							PlayerMobile mobile = (PlayerMobile)m;
							
							Item basin = mobile.Backpack.FindItemByType(typeof(EmptySlimeBasin));
							if (basin == null)
							{
								SmallTalk();
							}
							else
							{
								GiveHint();
							}
						}	
					}
					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();
		}
	}	
}

