/**********************************************************
RunUO AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Red Squirrel on Jan-01-2012 10:09:14pm
Filepath: scripts\events and scenarios\Halloween2011\Quests\Quest Items\ShrinkingStaffGiver.cs
Lines of code: 48

Description: 

***********************************************************/


using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using System.Collections;
using Server.Targeting;

namespace Server.Items
{
	public class ShrinkingStaffGiver : Item
	{
		[Constructable]
		public ShrinkingStaffGiver() : base(3568)
		{ 
			Name = "a shrinking staff";
			Hue = 2071;
			Movable = false;
		}

		public ShrinkingStaffGiver( Serial serial ) : base( serial )
		{
		}
		
		public override void OnDoubleClick( Mobile from )
		{
			if (from.InRange( this, 1 ) && from.Alive && !from.Blessed)  {			
				Container pack = from.Backpack;
				Item staff = from.Backpack.FindItemByType(typeof(ShrinkingStaff));
				
				if (staff != null)
				{
					from.SendMessage("You have already taken a shrinking staff and do not need another one");	
				}
				else
				{
					from.GiveItem(new ShrinkingStaff());
				}
				
			
				/*if (staff != null)
				{
					from.SendMessage("You have already taken a shrinking staff and do not need another one");	
				}
				else if ( pack != null || !pack.TryDropItem( from, new ShrinkingStaff(), false ) ) {
					from.SendMessage("Your pack is too full.");						
				}
				else {
					from.SendMessage("You take a shrinking staff off the table" );
					from.Backpack.DropItem( new ShrinkingStaff() );
				}*/
			}
		}

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