/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\items\Quest Rewards\LargeBagOfTreasure.cs
Lines of code: 54
***********************************************************/


using System;
using Server;
using Server.Items;

namespace Server.Items
{
	public class LargeBagOfTreasure : Bag
	{
	
		public override int LabelNumber{ get{ return 1072583; } } //A bag of treasure
		
		[Constructable]
		public LargeBagOfTreasure()
		{
		
			Hue = 2213;
			
			for(int i=0;i < Utility.RandomMinMax(8, 18); i++)
			{		
				Item item = Loot.RandomArmorOrShieldOrJewelry(0);
			
				int attributeCount=1+Utility.RandomMinMax(3, 5);
				if(attributeCount<1)attributeCount=1;
				if(attributeCount>5)attributeCount=5;
			
				int min=50+Utility.Random((int)Utility.RandomMinMax(3, 6) * 5);
				int max=50+min+Utility.Random(50+((int)Utility.RandomMinMax(3, 6) * 5));
				if(max>100)max=100;
			
				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 );
			}
			
			DropItem( new Gold( 1000, 2000 ) );
		}

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