/**********************************************************
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\Specific Hints\SlimeEventSkaraBraeVillager.cs
Lines of code: 187
***********************************************************/


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 SlimeEventSkaraBraeVillager : 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 SlimeEventSkaraBraeVillager() : base( AIType.AI_Animal, FightMode.None, 10, 1, 0.2, 0.4 )
		{
			InitBody();
			InitOutfit();	
			Title = "the villager";	
			Body = 0x191;
			Name = NameList.RandomName( "female" );		
			Fame = 0;
			Karma = 11000;					
		}
		
		public SlimeEventSkaraBraeVillager( 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( "female" );
			}
			else
			{
				Body = 0x190;
				Name = NameList.RandomName( "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()
		{
			switch ( Utility.Random( 3 ) )
			{
				case 0: AddItem( new FancyShirt( GetRandomHue() ) ); break;
				case 1: AddItem( new Doublet( GetRandomHue() ) ); break;
				case 2: AddItem( new Shirt( GetRandomHue() ) ); break;
			}

			switch ( ShoeType )
			{
				case VendorShoeType.Shoes: AddItem( new Shoes( GetShoeHue() ) ); break;
				case VendorShoeType.Boots: AddItem( new Boots( GetShoeHue() ) ); break;
				case VendorShoeType.Sandals: AddItem( new Sandals( GetShoeHue() ) ); break;
				case VendorShoeType.ThighBoots: AddItem( new ThighBoots( GetShoeHue() ) ); break;
			}

			int hairHue = GetHairHue();

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

			if ( Female )
			{
				switch ( Utility.Random( 6 ) )
				{
					case 0: AddItem( new ShortPants( GetRandomHue() ) ); break;
					case 1:
					case 2: AddItem( new Kilt( GetRandomHue() ) ); break;
					case 3:
					case 4:
					case 5: AddItem( new Skirt( GetRandomHue() ) ); break;
				}
			}
			else
			{
				switch ( Utility.Random( 2 ) )
				{
					case 0: AddItem( new LongPants( GetRandomHue() ) ); break;
					case 1: AddItem( new ShortPants( GetRandomHue() ) ); break;
				}
			}
		}
		
		public virtual void SmallTalk()
		{
			switch (Utility.RandomMinMax( 0, 6 ))
			{
				case 0: 
				Say("I'm off to Jhelom to welcome back Lydia"); break;
				case 1: 
				Say("Lovely day today, isn't it?"); break;
				case 2: 
				Say("Sorry, can't stop to talk now, I'm off to the shop!"); break;
				case 3: 
				Say("So hard to find good reagent dealers these days!"); break;
				case 4: 
				Say("It's good to see Lydia back in Jhelom. She has done so much for the flora and fauna researching community"); break;
				case 5: 
				Say("Lydia the researcher has returned to Jhelom! Be sure to say hello to her!"); break;
				case 6: 
				Say("The banks are always so crowded this time of day!"); break;
			}
		}
		
		public virtual void GiveHint()
		{
			Say("You should find an acid slime in the passages between the levels of the Covetous dungeon in Felucca");
		}
		
		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();
		}
	}	
}

