/**********************************************************
RunUO AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Red Squirrel on Aug-08-2011 09:29:13pm
Filepath: scripts\Items\artifacts\Artifacts of Assimilation\greater\braceoftravel.cs
Lines of code: 71

Description: 

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


using System;
using System.Collections;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;
using Server.Commands;
using Server.Spells;
using Server.Regions;
using Server.Spells.Fourth;

namespace Server.Items
{
	public class braceoftravel : GoldBracelet
	{
		public override bool ForceShowProperties{ get{ return ObjectPropertyList.Enabled; } }
		
		[Constructable]
		public braceoftravel() : base()
		{
		    Name = "Bracelet of Travel";
			Movable = true;
			Layer = Layer.Bracelet;
			LootType=LootType.Blessed;
			Hue=1154;
		}

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

		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.Player )return;

			if ( from.InRange( GetWorldLocation(), 1 ) )
			{
			UseGate( from );
			}
			else
				from.SendLocalizedMessage( 500446 ); // That is too far away.
		}


		

		public override bool OnMoveOver( Mobile m )
		{
			// Changed so criminals are not blocked by it.
			if ( m.Player )
				UseGate( m );

			return true;
		}


		public bool UseGate( Mobile m )
		{
			if(RecallSpell.CheckTravel(null,m.Location,m.Map, m,false))
			{
				m.CloseGump( typeof( MoongateGump ) );
				m.SendGump( new MoongateGump( m, this,true ) );

				if ( !m.Hidden || m.AccessLevel == AccessLevel.Player )
					Effects.PlaySound( m.Location, m.Map, 0x20E );

				return true;
			}
			return false;
		}
		
		
		
		

		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 override void OnAfterLoad()
		{		
			Misc.ObjectConverter.ConvertItem(this,new OrbOfTheMoons());
		}

	}
}