using System;
using System.Collections;
using Server;
using Server.Network;
using System.Collections.Generic;

namespace Server.Items
{
	public class LadderSouthAddon : BaseAddon
	{
        private static int[,] m_AddOnSimpleComponents = new int[,] {
			  {8250, 0, 0, 0}, {1110, 0, 0, 22}	
		};

		public override BaseAddonDeed Deed
		{
			get
			{
				return new LadderSouthAddonDeed();
			}
		}

		[ Constructable ]
		public LadderSouthAddon()
		{
            for (int i = 0; i < m_AddOnSimpleComponents.Length / 4; i++)
                AddComponent( new AddonComponent( m_AddOnSimpleComponents[i,0] ), m_AddOnSimpleComponents[i,1], m_AddOnSimpleComponents[i,2], m_AddOnSimpleComponents[i,3] );
		}

		public override void OnComponentUsed( AddonComponent c, Mobile from )
		{
			if ( !from.InRange( GetWorldLocation(), 4 ) || !from.InLOS( this ) )
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
			else if ( c.ItemID == 1110 )
			{
				from.Z = c.Z-22;
				from.X = c.X;
				from.Y = c.Y;
				from.PlaySound( 234 );
			}
			else
			{
				from.Z = c.Z+22;
				from.X = c.X;
				from.Y = c.Y;
				from.PlaySound( 234 );
			}
		}

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

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( 0 ); // Version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}

	public class LadderSouthAddonDeed : BaseAddonDeed
	{
		public override BaseAddon Addon
		{
			get
			{
				return new LadderSouthAddon();
			}
		}

		[Constructable]
		public LadderSouthAddonDeed()
		{
			Name = "ladder deed (south)";
		}

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

			list.Add( 1070722, "Used to Access Upper Floor");
			list.Add( 1049644, "To Be Placed In Your Home");
        } 

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

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( 0 ); // Version
		}

		public override void	Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
}