/**********************************************************
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\EasterBunnyNPC.cs
Lines of code: 100
***********************************************************/


using System;
using Server;
using Server.ContextMenus;
using Server.Accounting;
using Server.Gumps;
using Server.Items;
using Server.Menus;
using Server.Menus.Questions;
using Server.Mobiles;
using Server.Network;
using Server.Prompts;
using Server.Regions;
using Server.Misc;
using System.Collections;
using System.Collections.Generic;

namespace Server.Mobiles
{
	[CorpseName( "The corpse of the poor Easter Bunny" )]
	public class EasterBunnyNPC : BaseCreature
	{
		public override bool ClickTitle{ get { return false; } }
		
		public virtual int AutoTalkRange{ get{ return -1; } }
		public virtual int AutoSpeakRange{ get{ return 3; } }		
		public virtual TimeSpan SpeakDelay{ get{ return TimeSpan.FromSeconds( 10 ); } }
		
		private DateTime m_Spoken;	
                
		[Constructable]
		public EasterBunnyNPC() : base( AIType.AI_Animal, FightMode.None, 10, 1, 0.2, 0.4 )
		{
			InitBody();
			Blessed = true;
			Name = "The Easter Bunny";	
			Fame = 110000;
			Karma = 110000;				
		}
		
		public EasterBunnyNPC( Serial serial ) : base( serial )
		{
		}
		
		public virtual void InitBody()
		{
			InitStats( 125, 125, 125 );

			SpeechHue = 1153;

			Body=205;
		}
		
		public override void OnThink()
		{
			if (0.015 >= Utility.RandomDouble())
				this.Hue = Utility.RandomDyedHue();	
				
		base.OnThink();	
		}
		
		public virtual void SmallTalk()
		{
			switch (Utility.RandomMinMax( 0, 6 ))
			{
				case 0: 
				Say("One of my bratty bunny helpers caused a feud between Santa and I by stealing his presents!"); break;
				case 1: 
				Say("If you find any of my white or gold eggs, bring them to this statue and you'll get points"); break;
				case 2: 
				Say("If you get 10 points from bringing eggs in to the statue, I'll give you your Easter basket"); break;
				case 3: 
				Say("Gather my eggs to collect points. White eggs are only worth 1 point, but golden eggs are worth 5"); break;
				case 4: 
				Say("Santa's Christmas gifts are in the basket too! I'm doing him a favor and distributing the stolen Christmas gifts"); break;
				case 5: 
				Say("I'm upset about my bunny workers taking Santa's Christmas gifts like that. I hope things will be resolved between us soon"); break;
				case 6: 
				Say("Every 25 points I'll give you a prize for helping me get my Easter eggs back"); break;
			}
		}
		
		public override void OnMovement( Mobile m, Point3D oldLocation )
		{
			if ( m.Alive && !m.Hidden && m is PlayerMobile )
			{
				PlayerMobile pm = (PlayerMobile)m;

				int range = AutoTalkRange;
					
				range = AutoSpeakRange;
				
				if ( range >= 0 && InRange( m, range ) && !InRange( oldLocation, range ) && DateTime.Now >= m_Spoken + SpeakDelay )
				{
					if ( Utility.Random( 100 ) < 50 ) {
						if ( m.Alive && m is PlayerMobile ) {
							PlayerMobile mobile = (PlayerMobile)m;
							SmallTalk();
						}	
					}
					m_Spoken = DateTime.Now;
				}
			}
		}

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

