/**********************************************************
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\SurpriseStocking.cs
Lines of code: 157

Description: 

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


using System;
using System.Collections;
using Server.Multis;
using Server.Mobiles;
using Server.Network;
using System.Collections.Generic;
using Server.ContextMenus;

namespace Server.Items
{
	[Flipable( 11225, 11226 )]
	public class SurpriseStocking : BaseContainer
	{
		public override int DefaultGumpID{ get{ return 0x103; } }	
		
		[Constructable]
		public SurpriseStocking(int intensity) : base( Utility.RandomBool() ? 11225 : 11227 )
		{
		
			//ML stuff
			for(int i=0;i<intensity*2;i++)
			{
				if(0.002>Utility.RandomDouble())
				{
					switch(Utility.Random(18))
					{
					case 0:DropItem(new Blight());  break;
					case 1:DropItem(new LuminescentFungi());  break;
					case 2:DropItem(new Corruption());  break;
					case 3:DropItem(new ParasiticPlant());  break;
					case 4:DropItem(new Muculent());  break;
					case 5:DropItem(new DiseasedBark());  break;
					case 6:DropItem(new BarkFragment());  break;
					case 7:DropItem(new PerfectEmerald());  break;
					case 8:DropItem(new DarkSapphire());  break;
					case 9:DropItem(new Turquoise());  break;
					case 10:DropItem(new EcruCitrine());  break;
					case 11:DropItem(new WhitePearl());  break;
					case 12:DropItem(new FireRuby());  break;
					case 13:DropItem(new BlueDiamond());  break;
					case 14:DropItem(new BrilliantAmber());  break;
					case 15:DropItem(new Scourge());  break;
					case 16:DropItem(new Putrefaction());  break;
					case 17:DropItem(new Taint());  break;			
					}			
				}		
			}
			
			//runics
			for(int i=0;i<intensity/5;i++)
			{
				if(0.003>Utility.RandomDouble())DropItem(RandomRunicItem());			
			}
		
		
			//other stuff
			for(int i=0;i<intensity*2;i++)
			{
				if(0.14>Utility.RandomDouble())
				{
					switch(Utility.Random(11))
					{
					case 0:DropItem(new skilldeed(20+(20*Utility.Random(5))));  break;
					case 1:DropItem(new PetBondingDeed());  break;
					case 2:DropItem(new BagOfSending());  break;
					case 3:DropItem(new BankCheck(1000));  break;
					case 4:DropItem(new BankCheck(1000+(1000*Utility.Random(5))));  break;
					case 5:DropItem(new BankCheck(1000+(100*Utility.Random(100))));  break;
					case 6:DropItem(new AshBoard(10+(5*Utility.Random(5))));break;
					case 7:DropItem(new YewBoard(10+(5*Utility.Random(5))));break;
					case 8:DropItem(new BloodwoodBoard(10+(5*Utility.Random(5))));break;
					case 9:DropItem(new HeartwoodBoard(10+(5*Utility.Random(5))));break;
					case 10:DropItem(new FrostwoodBoard(10+(5*Utility.Random(5))));break;
					}			
				}		
			}		
		
		
			//common stuff
	
			for(int i=Utility.Random(intensity*5);i>0;i--)
			{
				Item item = Loot.RandomArmorOrShieldOrJewelry(0);
				
				int attributeCount=3+Utility.Random(4);
				int min=Utility.Random(80);
				int max=90+Utility.Random(9);
			
				if ( item is BaseWeapon )
				{
					BaseWeapon weapon = (BaseWeapon)item;

					BaseRunicTool.ApplyAttributesTo( weapon,true,0, attributeCount, min, max );
				}
				else if ( item is BaseArmor )
				{
					BaseArmor armor = (BaseArmor)item;

					BaseRunicTool.ApplyAttributesTo( armor,true,0, attributeCount, min, max );
				}
				else if ( item is BaseJewel )
				{
					BaseRunicTool.ApplyAttributesTo( (BaseJewel)item,true,0, attributeCount, min, max );
				}
				
			DropItem( item );
			}
			
			
			//decoration:
			for(int i=intensity/5;i>0;i--) DropItem(RandomDecoration());
		
		}
		
		
		[Constructable]
		public SurpriseStocking() : this(5)
		{
		}		
		
		
	
		public static Item RandomRunicItem()
		{
			Item item=null;
			
			switch(Utility.Random(17))
			{
				case 0: item=new RunicSewingKit( CraftResource.SpinedLeather,Utility.Random(10));break;
				case 1: item=new RunicSewingKit( CraftResource.HornedLeather,Utility.Random(10));break;
				case 2: item=new RunicSewingKit( CraftResource.BarbedLeather,Utility.Random(10));break;
				case 3: item=new RunicSaw( CraftResource.Oakwood,Utility.Random(10));break;
				case 4: item=new RunicSaw( CraftResource.Ashwood,Utility.Random(10));break;
				case 5: item=new RunicSaw( CraftResource.Yewwood,Utility.Random(10));break;
				case 6: item=new RunicSaw( CraftResource.Bloodwood,Utility.Random(10));break;
				case 7: item=new RunicSaw( CraftResource.Heartwood,Utility.Random(10));break;
				case 8: item=new RunicSaw( CraftResource.Frostwood,Utility.Random(10));break;
				case 9: item=new RunicTinkerKit(CraftResource.DullCopper, Utility.Random(10) );break;
				case 10: item=new RunicTinkerKit(CraftResource.ShadowIron, Utility.Random(10) );break;
				case 11: item=new RunicTinkerKit(CraftResource.Copper, Utility.Random(10) );break;
				case 12: item=new RunicTinkerKit(CraftResource.Bronze, Utility.Random(10) );break;
				case 13: item=new RunicTinkerKit(CraftResource.Gold, Utility.Random(10) );break;
				case 14: item=new RunicTinkerKit(CraftResource.Agapite, Utility.Random(10) );break;
				case 15: item=new RunicTinkerKit(CraftResource.Verite, Utility.Random(10) );break;
				case 16: item=new RunicTinkerKit(CraftResource.Valorite, Utility.Random(10) );break;	
			}
			
			return item;
		}
		
		
		
		public static Item RandomDecoration()
		{
			Item item=null;
			
			switch(Utility.Random(14))
			{
					
				case 0: item=new Snowman();break;
				case 1: item=new Wreath();break;
				case 2: item=new SnowFlake();break;
				case 3: item=new RedPoinsettia();break;
				case 4: item=new WhitePoinsettia();break;
				case 5: item=new ChristmasCandle();break;
				case 6: item=new MistleToe();break;
				case 7: item=new FestiveCactus();break;
				case 8: item=new SnowyTree();break;
				case 9: item=new DecorativeTopiary();break;
				case 10: item=new NutCracker();break;
				case 11: item=new BigNutCracker();break;
				case 12: item=new RedCandyCane();break;
				case 13: item=new GreenCandyCane();break;
	
			}
			
			return item;
		}
		
				

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