/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\events and scenarios\Picking up the Pieces\ChunkStone.cs
Lines of code: 61
***********************************************************/


using System;
using Server;
using Server.Items;

namespace Server.Items
{

	public class ChunkStone : Item
	{
	
		[Constructable]
		public ChunkStone() : base(0xED4)
		{
		Movable=false;
		}
		
		public override void OnDoubleClick( Mobile from )
		{
		if(!from.InRange(this,1))return;
		
		int amt=0;
		
		amt = from.Backpack.GetAmount(typeof(RockChunks));
		if(amt<=0)return;
		

		//if we made it here, we have all the components, so we can consume them		
		
		from.Backpack.ConsumeTotal(typeof(RockChunks),amt );

		
		//and finally, give deed
		
		from.AddToBackpack(new ChunkStoneDeed(from,amt));
		from.SendMessage("You are given a deed which you can show to a staff member for your reward");
		}		
		
		
		public ChunkStone( 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();
		}
	}
	
	
	
	public class ChunkStoneDeed : Item
	{

		[Constructable]
		public ChunkStoneDeed(Mobile from, int amount ) : base( 0x14F0 )
		{
			Stackable = false;
			Hue=1157;
			
			Name= String.Format("{0} found {1} Rock Chunks",from.Name,amount);
		}

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

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

}