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


using System;
using Server;
using Server.Multis;
using Server.Items;
using Server.Mobiles;
using System.Collections;
using Server.Network;
using Server.Spells;


//using System.Collections;
//using System.Collections.Generic;
//using Server.Targeting;
//using Server.ContextMenus;
//using Server.Network;
//using Server.Regions;

namespace Server.Items
{

	[FlipableAttribute( 2420, 2421 )] 
	public class PiratePotOfStew : Item
	{
	
		public bool UseDelay = false;  
		 
		[Constructable]
		public PiratePotOfStew() : base( 2420 )
		{		
			Name = "Pirate's Pot of Stew"; 
			Weight = 8.0;
		}
		
		public bool IsOwner( Mobile mob )
		{
			BaseHouse house = BaseHouse.FindHouseAt( this );

			return ( house != null && house.IsOwner( mob ) );
		}

		public override void OnDoubleClick( Mobile from )
		{
			if ( !this.IsLockedDown )
				from.SendLocalizedMessage( 502693 ); // Remember, this only works when locked down.
			else if ( Server.Spells.SpellHelper.CheckCombat( from ) )
			{
				from.SendMessage("You are too busy at the moment to eat the stew");
			} 
			else if (UseDelay)
			{
				from.SendMessage( "The stew is not yet ready" );
			}
			else if (!from.InRange( this, 1 ))
			{
				from.SendMessage( "You are too far away" );
			}
			else if (!UseDelay && from.InRange( this, 1 ))
			{
				UseDelay= true;
			
				from.LocalOverheadMessage( MessageType.Regular, 0x3F, true, "* You help yourself to a bowl of pirate's stew *" );
			
				from.Hits = from.HitsMax;
				from.Stam = from.StamMax;
				from.Mana = from.ManaMax; 
			
				from.PlaySound( Utility.Random( 0x3A, 3 ) );
				from.PlaySound( Utility.Random( 0x30, 2 ) );
			
				Timer.DelayCall( TimeSpan.FromMinutes( 2.0 ), new TimerCallback( ResetDelay ) );
			}
		}
		
		public void ResetDelay( )
		{
			UseDelay = false; 
		}

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