/**********************************************************
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\Dreadhorn\Keys\statueofthefey.cs
Lines of code: 58
***********************************************************/


using System;
using Server;
using Server.Items;

namespace Server.Items
{

	public class statueofthefey : Item
	{
	
		[Constructable]
		public statueofthefey() : base(9654)
		{
		Hue=233;
		Name="Statue of the Faie";
		Movable=false;
		}
		
		public override void OnDoubleClick( Mobile from )
		{
		if(!from.InRange(this,1))return;
		
		int amt=0;
		
		amt = from.Backpack.GetAmount(typeof(BlightedCotton));
		if(amt<1){MissingItemMsg(from,"Blighted Cotton");	return;		}

		amt = from.Backpack.GetAmount(typeof(ThornyBriar));
		if(amt<1){MissingItemMsg(from,"Thorny Briar");	return;		}

		amt = from.Backpack.GetAmount(typeof(IrkBrain));
		if(amt<1){MissingItemMsg(from,"Irk's Brain");	return;		}

		amt = from.Backpack.GetAmount(typeof(LissithSilk));
		if(amt<1){MissingItemMsg(from,"Lissith's Silk");	return;		}		

		amt = from.Backpack.GetAmount(typeof(SabrixEye));
		if(amt<1){MissingItemMsg(from,"Sabrix's Eye");	return;		}			
		
		amt = from.Backpack.GetAmount(typeof(GnawFang));
		if(amt<1){MissingItemMsg(from,"Gnaw's Fang");	return;		}		
		

		//if we made it here, we have all the components, so we can consume them		
		
		from.Backpack.ConsumeTotal(typeof(BlightedCotton),1 );
		from.Backpack.ConsumeTotal(typeof(ThornyBriar),1 );
		from.Backpack.ConsumeTotal(typeof(IrkBrain),1 );		
		from.Backpack.ConsumeTotal(typeof(LissithSilk),1 );
		from.Backpack.ConsumeTotal(typeof(SabrixEye),1 );
		from.Backpack.ConsumeTotal(typeof(GnawFang),1 );
		
		
		
		//and finally, give key bag
		from.AddToBackpack(new peerlesskeybag(new DreadhornKey(), 2,0,1));
		from.SendMessage("You are given a bag of keys which will summon the beast");
		}		
		
		void MissingItemMsg(Mobile from,string type)
		{
		from.SendMessage("You are missing {0}",type);
		}
		
		
		public statueofthefey( 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();
		}
	}
	
	

}