/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\quests\kill quests\Tokuno Quest\Part 2 Alchemy Woes\AlchemyWoesKillQuestGiver.cs
Lines of code: 73
***********************************************************/


using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using Server.ContextMenus;
using Server.Engines.Quests;
using Server.Engines.Quests.Necro;

namespace Server.Engines.Quests.AlchemyWoesKillQuest
{
	public class AlchemyWoesKillQuestGiver : BaseQuester
	{
		public override bool ClickTitle{ get{ return true; } }
		public override bool IsActiveVendor{ get{ return false; } }
		public override bool RandomName{ get{ return false; } }

		public override void InitSBInfo()
		{
			//m_SBInfos.Add( new SBMage() );
		}

		[Constructable]
		public AlchemyWoesKillQuestGiver() : base( "the Zento alchemist" )
		{
			Name = "Juro";
		}

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

		public override void InitBody()
		{
			InitStats( 100, 100, 25 );
			Hue = 33802;
			Body = 400;
			Female = false;
		}



		public override void InitOutfit()
		{
			AddItem( new MaleKimono() );
			AddItem( new FurBoots( Utility.RandomNeutralHue() ) );

			Utility.AssignRandomHair( this );

			PackGold( 200, 250 );
		}

		

		public override bool CanTalkTo( PlayerMobile to )
		{
			return (( to.Quest == null || to.Quest is AlchemyWoesKillQuest) && QuestSystem.CanOfferQuest( to, typeof( AlchemyWoesKillQuest ) ) );
		}

		public override void OnTalk( PlayerMobile player, bool contextMenu )
		{
			if(!CanTalkTo(player))return;
			
			QuestSystem qs = player.Quest;

			if ( qs == null && QuestSystem.CanOfferQuest( player, typeof( AlchemyWoesKillQuest ) ))
			{
				Direction = GetDirectionTo( player );
				new AlchemyWoesKillQuest(player,this ).SendOffer();
			}
			else if(qs!=null && qs is AlchemyWoesKillQuest)
			{
				AlchemyWoesKillQuest rqs = qs as AlchemyWoesKillQuest;
				
				QuestObjective obj = rqs.FindObjective( typeof(KillObjective) );
				
				if(obj!=null && obj.Completed)rqs.AddConversation( new EndConversation() );			
			}
		}

		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();
		}
	}
}