/**********************************************************
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\SlimeEventDecoyIlshenarSage.cs
Lines of code: 174
***********************************************************/


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 sage" )]
	public class SlimeEventDecoyIlshenarSage : 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 SlimeEventDecoyIlshenarSage() : base( AIType.AI_Animal, FightMode.None, 10, 1, 0.2, 0.4 )
		{
			InitBody();
			InitOutfit();	
			Title = "the sage";	
			Fame = 0;
			Karma = 11000;			
		}
		
		public SlimeEventDecoyIlshenarSage( 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 int GetRobeColor()
		{
			return Utility.RandomYellowHue();
		}

		public virtual void InitOutfit()
		{
			AddItem( new Sandals( ) );
			AddItem( new Robe( GetRobeColor() ) );

			int hairHue = GetHairHue();

			Utility.AssignRandomHair( this, hairHue );
			Utility.AssignRandomFacialHair( this, hairHue );
		}
		
		public virtual void SmallTalk()
		{
			switch (Utility.RandomMinMax( 0, 6 ))
			{
				case 0: 
				Say("Have you seen Lydia in Jhelom since she's been back?"); break;
				case 1: 
				Say("Such work researching words of power. I haven't even had a chance to see Lydia in Jhelom yet!"); break;
				case 2: 
				Say("I am in the middle of copying books, I cannot talk right now."); break;
				case 3: 
				Say("Can't talk right now, I need to go get more blank scrolls."); break;
				case 4: 
				Say("This tower of knowledge is our best hope in discovering the secrets of Ilshenar"); break;
				case 5: 
				Say("Some days I wonder if it would be easier to research with Lydia in Jhelom than to unlock the mysteries of Ilshenar"); break;
				case 6: 
				Say("It's a challenge to unlock the mysteries of Ilshenar, there's so little information we know about it!"); break;
			}
		}
		
		public virtual void GiveHint()
		{
			switch (Utility.RandomMinMax( 0, 6 ))
			{
				case 0: 
				Say("Where to find acid slimes? Maybe another sage around here can answer that question."); break;
				case 1: 
				Say("I recall hearing about acid slimes but I have never heard of where to find them."); break;
				case 2: 
				Say("I regret to say that with my infinite knowledge, I have never come across information about acid slimes."); break;
				case 3: 
				Say("I thought acid slimes were extinct. I haven't seen one for years!"); break;
				case 4: 
				Say("Try asking one of the sages over there, they might know where to find acid slimes."); break;
				case 5: 
				Say("I once read about acid slimes in a book, but they never told of a location to find them."); break;
				case 6: 
				Say("Haven't heard about acid slimes. Did you try asking other people in the different facets and towns?"); 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();
		}
	}	
}

