/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\engines\ML Peerless + misc areas\Interred Grizzle\Questgiver\Cohenn.cs
Lines of code: 88
***********************************************************/


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.Engines.Quests.Grizzle
{

	public class Cohenn : BaseQuester
	{
                
                
		[Constructable]
		public Cohenn()
		{
			Name = "Master Cohenn";
		    Title = "the Librarian";
            Body = 401;
            Hue = 33770;
            VirtualArmor = 50;
			CantWalk = true;

           Item hair = new Item( Utility.RandomList( 0x203B, 0x203C, 0x203D, 0x2044, 0x2045, 0x2047, 0x2049, 0x204A ) );
            hair.Hue = Utility.RandomHairHue();
		    hair.Layer = Layer.Hair;
            hair.Movable = false;
            AddItem( hair );

            AddItem(new Server.Items.Skirt( Utility.RandomNeutralHue() ));
			AddItem(new Server.Items.Doublet( Utility.RandomNeutralHue() ));
            AddItem(new Server.Items.Sandals(0));

            GoldNecklace goldnecklace = new GoldNecklace();
            goldnecklace.Hue = 0;
            goldnecklace.Movable = false;
            AddItem(goldnecklace);

            GoldRing goldring = new GoldRing();
            goldring.Hue = 0;
            goldring.Movable = false;
            AddItem(goldring);	
		}
		
		
		public override void OnTalk( PlayerMobile from, bool contextMenu )
		{
			this.Direction = GetDirectionTo( from );

			GrizzleQuest qs = from.Quest as GrizzleQuest;

			if ( qs != null)
			{
			//check pack for items
			
			int amt=0;
		
			amt += from.Backpack.GetAmount(typeof(CohennNote1))>0 ? 1 : 0;
			amt += from.Backpack.GetAmount(typeof(CohennNote2))>0 ? 1 : 0;
			amt += from.Backpack.GetAmount(typeof(CohennNote3))>0 ? 1 : 0;
			amt += from.Backpack.GetAmount(typeof(CohennNote4))>0 ? 1 : 0;
			amt += from.Backpack.GetAmount(typeof(CohennNote5))>0 ? 1 : 0;
			
			if(amt<5)qs.AddConversation( new NotDoneConversation() );
			else qs.AddConversation(new EndConversation());
			
			}
			else
			{
				QuestSystem newQuest = new GrizzleQuest( from);

				if ( from.Quest == null && QuestSystem.CanOfferQuest( from, typeof( GrizzleQuest ) ) )
				{
					newQuest.SendOffer();
				}
				else
				{
					newQuest.AddConversation( new DontOfferConversation() );
				}
			}
		}		
		
		public Cohenn( Serial serial ) : base( serial )
		{
		}

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