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


using System;
using Server.Items;
using Server.Network;
using Server.Targeting;
using Server.Engines.Craft;

namespace Server.Items
{
	public abstract class BaseLog : 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} Log", 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();

			m_Resource = (CraftResource)reader.ReadInt();		
		}

		public BaseLog( CraftResource resource ) : this( resource, 1 )
		{
		}

		public BaseLog( CraftResource resource, int amount ) : base( 0x1BE0 )
		{
			Stackable = true;
			Weight = 2.0;
			Amount = amount;
			Hue = CraftResources.GetHue( resource );

			m_Resource = resource;
		}

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

		public override void AddNameProperty( ObjectPropertyList list )
		{
			if ( Amount > 1 )
				list.Add( 1050039, "{0}\t#{1}", Amount, 1044466 ); // ~1_NUMBER~ ~2_ITEMNAME~
			else
				list.Add( 1027133 ); // Log
		}

		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 int LabelNumber
		{
			get
			{
				switch ( m_Resource)
				{
				case CraftResource.Oakwood: return 1075063;
				case CraftResource.Ashwood: return 1075064;
				case CraftResource.Yewwood: return 1075065;
				case CraftResource.Heartwood: return 1075066; 
				case CraftResource.Bloodwood: return 1075067; 				
				case CraftResource.Frostwood: return 1075068; 				
				}
				return 1027127;
			}
		}

	}

	[FlipableAttribute( 0x1bdd, 0x1be0 )]
	public class Log : BaseLog
	{
		[Constructable]
		public Log() : this( 1 )
		{
		}

		[Constructable]
		public Log( int amount ) : base( CraftResource.Wood, amount )
		{
		}

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

	[FlipableAttribute( 0x1bdd, 0x1be0 )]
	public class OakLog : BaseLog
	{
		[Constructable]
		public OakLog() : this( 1 )
		{
		}

		[Constructable]
		public OakLog( int amount ) : base( CraftResource.Oakwood, amount )
		{
		}

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

	}
	
	
	[FlipableAttribute( 0x1bdd, 0x1be0 )]
	public class AshLog : BaseLog
	{
		[Constructable]
		public AshLog() : this( 1 )
		{
		}

		[Constructable]
		public AshLog( int amount ) : base( CraftResource.Ashwood, amount )
		{
		}

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

	}

	[FlipableAttribute( 0x1bdd, 0x1be0 )]
	public class YewLog : BaseLog
	{
		[Constructable]
		public YewLog() : this( 1 )
		{
		}

		[Constructable]
		public YewLog( int amount ) : base( CraftResource.Yewwood, amount )
		{
		}

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


	}

	[FlipableAttribute( 0x1bdd, 0x1be0 )]
	public class BloodwoodLog : BaseLog
	{
		[Constructable]
		public BloodwoodLog() : this( 1 )
		{
		}

		[Constructable]
		public BloodwoodLog( int amount ) : base( CraftResource.Bloodwood, amount )
		{
		}

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

	}

	[FlipableAttribute( 0x1bdd, 0x1be0 )]
	public class HeartwoodLog : BaseLog
	{
		[Constructable]
		public HeartwoodLog() : this( 1 )
		{
		}

		[Constructable]
		public HeartwoodLog( int amount ) : base( CraftResource.Heartwood, amount )
		{
		}

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


	}

	[FlipableAttribute( 0x1bdd, 0x1be0 )]
	public class FrostwoodLog : BaseLog
	{
		[Constructable]
		public FrostwoodLog() : this( 1 )
		{
		}

		[Constructable]
		public FrostwoodLog( int amount ) : base( CraftResource.Frostwood, amount )
		{
		}

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

	}

}