/**********************************************************
RunUO AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Red Squirrel on Jan-01-2012 10:09:12pm
Filepath: scripts\events and scenarios\Christmas\items\WrappedChristmasGift.cs
Lines of code: 61

Description: 

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


using System;
using Server.Items;
using Server.Network;

namespace Server.Items
{
	[Furniture]
	public class WrappedChristmasGift : Item
	{
		public virtual string DefaultName	{ get { return "Wrapped Christmas Gift Box"; }	}
		
		[Constructable]
		public WrappedChristmasGift() : this( Utility.RandomDyedHue() )
		{
		}

		[Constructable]
		public WrappedChristmasGift( int hue ) : base( Utility.Random( 0x46a2, 5 ) )
		{
			Weight = 0.1;
			Hue = hue;
		}
		
		public override void OnDoubleClick( Mobile from )
		{
			if (!( IsChildOf( from.Backpack ) || Parent == from ))
			{
				from.SendMessage("This must be in your backpack to unwrap it!");
				return;
			}
			
			from.SendMessage("The content is magically removed from it's lightweight packaging.");
		
			
			//generate random items into a small crate and replace this with it:
			
			SmallCrate crate = new SmallCrate();
			
			for(int i=1+Utility.Random(5);i>0;i--)
			{
				Item item = null;
				switch(Utility.Random(5))
				{
					case 0:	item = new CoalOre(2,6);break;
					case 1: item = SurpriseStocking.RandomRunicItem();break;
					case 2: item = new SurpriseStocking();break;
					case 3: item = RandomWand.CreateRandomWand();break;
					case 4: item = BasePotion.RandomPotion();break;					
				}
				
				crate.DropItem(item);
			}
			
			
			from.Backpack.DropItem(crate);
			crate.X=this.X;
			crate.Y=this.Y;
			this.Delete();
		}
		
	
		

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