/**********************************************************
RunUO AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Red Squirrel on Mar-27-2011 07:44:41pm
Filepath: scripts\Items\Resources\Masonry\Granite.cs
Lines of code: 293

Description: 

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


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

namespace Server.Items
{
	public abstract class BaseGranite : Item, ICommodity
	{
		private CraftResource m_Resource;

		[CommandProperty( AccessLevel.GameMaster )]
		public CraftResource Resource
		{
			get{ return m_Resource; }
			set{ m_Resource = value; InvalidateProperties(); }
		}
		
		string ICommodity.Description
		{
			get
			{
				return String.Format( "{0} {1} high quality granite", Amount, CraftResources.GetName( m_Resource ).ToLower() );
			}
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version

			writer.Write( (int) m_Resource );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 0:
				{
					m_Resource = (CraftResource)reader.ReadInt();
					break;
				}
			}
		}

		public override double DefaultWeight
		{
			get { return 10.0; }
		}

		public BaseGranite( CraftResource resource ) : base( 0x1779 )
		{
			Hue = CraftResources.GetHue( resource );
			Stackable=true;
			m_Resource = resource;
		}

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

		public override int LabelNumber{ get{ return 1044607; } } // high quality granite

		public override void GetProperties( ObjectPropertyList list )
		{
			base.GetProperties( list );

			if ( !CraftResources.IsStandard( m_Resource ) )
			{
				int num = CraftResources.GetLocalizationNumber( m_Resource );

				if ( num > 0 )
					list.Add( num );
				else
					list.Add( CraftResources.GetName( m_Resource ) );
			}
		}
		
		/*
		public override void OnDoubleClick(Mobile from)
		{
			if (!from.InRange( GetWorldLocation(), 1 ) )
			{
			from.SendMessage("This is too far away");
			return;
			}
	
			int totake = 30;  //Try at 30 and work our way down (30 = 300 stones)

			while(this.Amount<=totake)totake-=5;
			
			if(totake<=1)
			{
			from.SendMessage("This pile is already divided");
			return;
			}
		
		   Item pile=null;
			//check what type of resource
			switch(Resource)
			{
			default:
			pile = new Granite();
			break;
			
			case CraftResource.DullCopper:
			pile = new DullCopperGranite();
			break;
			
			case CraftResource.ShadowIron:
			pile = new ShadowIronGranite();
			break;			
			
			case CraftResource.Copper:
			pile = new CopperGranite();
			break;			

			case CraftResource.Bronze:
			pile = new BronzeGranite();
			break;			

			case CraftResource.Gold:
			pile = new GoldGranite();
			break;			

			case CraftResource.Agapite:
			pile = new AgapiteGranite();
			break;						
			
			case CraftResource.Verite:
			pile = new VeriteGranite();
			break;						
			
			case CraftResource.Valorite:
			pile = new ValoriteGranite();
			break;	
			}
		
		    if(pile==null)return;
			
			bool placed=false;
			
			for(;totake>1;totake-=5)
			{
			pile.Amount=totake;
				if(from.PlaceInBackpack( pile ))
				{
				placed=true;
				break;
				}
			}
		
			if(!placed)
			{
			from.SendMessage("There is not enough room in your backpack for this");
			pile.Delete();
			}
			else
			{
			this.Amount-=totake;			
			from.SendMessage("{0} Granite has been taken from the pile",totake);
			}
			
			
		}		
		*/
		
		
		
		
	}

	public class Granite : BaseGranite
	{
		[Constructable]
		public Granite() : this(1)
		{
		}
		
		[Constructable]
		public Granite(int amt) : base( CraftResource.Iron )
		{
		Amount=amt;
		}		

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

	public class DullCopperGranite : BaseGranite
	{
		[Constructable]
		public DullCopperGranite() : this(1)
		{
		}
		
		[Constructable]
		public DullCopperGranite(int amt) : base( CraftResource.DullCopper )
		{
		Amount=amt;
		}	
		
		public DullCopperGranite( 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();
		}
	}

	public class ShadowIronGranite : BaseGranite
	{
		[Constructable]
		public ShadowIronGranite() : this(1)
		{
		}
		
		[Constructable]
		public ShadowIronGranite(int amt) : base( CraftResource.ShadowIron )
		{
		Amount=amt;
		}
		
		public ShadowIronGranite( 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();
		}
	}

	public class CopperGranite : BaseGranite
	{
		[Constructable]
		public CopperGranite() : this(1)
		{
		}
		
		[Constructable]
		public CopperGranite(int amt) : base( CraftResource.Copper )
		{
		Amount=amt;
		}

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

	public class BronzeGranite : BaseGranite
	{
		[Constructable]
		public BronzeGranite() : this(1)
		{
		}
		
		[Constructable]
		public BronzeGranite(int amt) : base( CraftResource.Bronze )
		{
		Amount=amt;
		}

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

	public class GoldGranite : BaseGranite
	{
		[Constructable]
		public GoldGranite() : this(1)
		{
		}
		
		[Constructable]
		public GoldGranite(int amt) : base( CraftResource.Gold )
		{
		Amount=amt;
		}

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

	public class AgapiteGranite : BaseGranite
	{
		[Constructable]
		public AgapiteGranite() : this(1)
		{
		}
		
		[Constructable]
		public AgapiteGranite(int amt) : base( CraftResource.Agapite )
		{
		Amount=amt;
		}

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

	public class VeriteGranite : BaseGranite
	{
		[Constructable]
		public VeriteGranite() : this(1)
		{
		}
		
		[Constructable]
		public VeriteGranite(int amt) : base( CraftResource.Verite )
		{
		Amount=amt;
		}

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

	public class ValoriteGranite : BaseGranite
	{
		[Constructable]
		public ValoriteGranite() : this(1)
		{
		}
		
		[Constructable]
		public ValoriteGranite(int amt) : base( CraftResource.Valorite )
		{
		Amount=amt;
		}

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