/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\quests\_core\BaseContinuationToken.cs
Lines of code: 109
***********************************************************/


using System;
using Server;
using Server.Mobiles;

namespace Server.Items
{

	public class BaseContinuationToken : baseexpirekey
	{
	
		public virtual bool DisableTravel { get {return true;}} //cannot travel if you have this token
		public virtual bool DisableTrade { get {return true;}} //cannot trade token
		public virtual bool DisableStore { get {return true;}} //cannot move to other container or ground
		public virtual string DoubleClickMessage { get {return "";}} //message to show when double clicked

		
		[Constructable]
		public BaseContinuationToken(string name, int itemid,int hue,TimeSpan expire) : base( name,itemid,hue,expire )
		{			
		}
		
		public override bool OnTravelWith(Mobile from)
		{
			if(DisableTravel)
			{
				from.SendMessage("You cannot travel while holding {0}",Name);
				return false;
			}
			return true;
		}

		public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );
				
			
			if(DisableTrade)list.Add(1004038);//You may not trade this item.
			if(DisableStore)list.Add( 1075269 );//Destroyed when dropped
        }
        
        public override bool OnDroppedToWorld( Mobile from, Point3D p )
		{
            if(DisableStore)
			{
				Delete();
	            return false;
			}
			return base.OnDroppedToWorld(  from,  p );
		}
		
        public override bool OnDroppedToMobile( Mobile from, Mobile target )
        {
            if(from==target)return base.OnDroppedToMobile( from, target );
			
			if( target is PlayerMobile)
			{
				if(DisableTrade)
				{
					from.SendMessage("{0} cannot be traded",Name);
					return false;
				}
				else return base.OnDroppedToMobile( from, target );
			}

            if(DisableStore)return false;
			return base.OnDroppedToMobile(  from,  target );
        }
		
		
		

        public override bool OnDroppedInto( Mobile from, Container target, Point3D p )
        {
            if( target == from.Backpack)
                return base.OnDroppedInto( from, target, p );

            if(DisableStore)
			{
				from.SendMessage("This item cannot be stored");
	            return false;
			}
			return base.OnDroppedInto(  from,  target,  p );
        }

        public override bool OnDroppedOnto( Mobile from, Item target )
        {
            if( target == from.Backpack)
                return base.OnDroppedOnto( from, target );

            if(DisableStore)
			{
				from.SendMessage("This item cannot be stored");
	            return false;
			}
			return base.OnDroppedOnto(  from,  target );
        }	
		
		
		public override bool AllowSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted )
		{
			if(DisableTrade)
			{
				from.SendMessage("{0} cannot be traded",Name);
				to.SendMessage("{0} cannot be traded",Name);				
				return false;
			}
			return base.AllowSecureTrade(  from,  to,  newOwner,  accepted );
		}	

		
		public override void OnDoubleClick( Mobile from )
		{
			if(DoubleClickMessage!="")
			{
				from.SendMessage(DoubleClickMessage);
			}
			base.OnDoubleClick( from );
		}		

		
		public BaseContinuationToken( Serial serial ) : base( serial )
		{
		}
		
		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( (int) 0 );			
		
		}
		
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
			
		}
		
	}

}


