/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Death on Apr-18-2011 09:34:34pm
Filepath: scripts\_custom\events and scenarios\Easter 2011\SpringGrass.cs
Lines of code: 76
***********************************************************/


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

namespace Server.Items
{
	public class SpringGrass : Item
	{
	
		public bool UseDelay = false;  
		 
		[Constructable]
		public SpringGrass() : base( Utility.RandomList(0x0CAE, 0x0CB0, 0x0CB4, 0x0CB6) )
		{		
			Name = "a fresh sprig of springtime grass"; 
			LootType=LootType.Blessed;
			Hue = Utility.RandomList(1167, 1162, 1155, 67);
			Weight = 1.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 must wait awhile after combat before using this item");
			} 
			else if (UseDelay)
			{
				from.SendMessage( "This item has been used recently, try again later" );
			}
			else if (!from.InRange( this, 1 ))
			{
				from.SendMessage( "You are too far away" );
			}
			else if (!UseDelay && from.InRange( this, 1 ) && from.Alive && from != null)
			{
				UseDelay= true;
			
				from.LocalOverheadMessage( MessageType.Regular, 0x3F, true, "* The fresh grass revitalizes you *" );
			
				from.Hits += 15;
				from.Stam += 15;
				from.Mana += 15; 
			
				Timer.DelayCall( TimeSpan.FromMinutes( 2.0 ), new TimerCallback( ResetDelay ) );
			}
		}
		
		public void ResetDelay( )
		{
			UseDelay = false; 
		}
		
		public override void GetProperties( ObjectPropertyList list)
		{
			base.GetProperties( list );
			list.Add( 1060658,"Easter \t" + "2011");
		}

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