/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by 
Filepath: scripts\_custom\engines\PlagueBeastLordQuest\Items\Organo_Heart.cs
Lines of code: 56
***********************************************************/


using System;
using Server;
using Server.Network;
using Server.Mobiles;

namespace Server.Items
{
	public class Organo_Heart : BaseOrgano
	{
		private Timer m_BleedingTimer; 
	
		public Organo_Heart( BrainTypes cerebro ) : base( 4967, PlagueHelper.Line[39], 32, cerebro )
		{
			Weight = 0;
			m_BleedingTimer = Timer.DelayCall( TimeSpan.FromSeconds( 1 ), TimeSpan.FromSeconds( 1 ), new TimerCallback( OnBleedTimerTick ) );
		}

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

		public override void CreateTissue()
		{
		    MyBrain = new PlagueBrain( HeldBrainType );
		    PutGuts( MyBrain , 20,30);
			PlagueBrain Cere = MyBrain as PlagueBrain;
			Cere.CreateTissue( -4, -5 );
		}

		public override void OpenOrganTo(Mobile from)
		{
		}

		public override void OnDoubleClick( Mobile from )
		{
			/*PlagueBeastLord plaguebl = RootParent as PlagueBeastLord;
			if ( plaguebl == null )
				return;

			from.RevealingAction();
			from.Direction = from.GetDirectionTo( plaguebl );
			if ( IsOpened )
			{
				from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, PlagueHelper.Line[21] );
			}
			else
			{
				ItemID = 4682;
				PutGuts( new Plague_deco( 7441, PlagueHelper.Line[23], 0, false, true) , 25, 30 );
				PutGuts( new Plague_deco( 7437, PlagueHelper.Line[23], 0, false, true) , 25, 10 );
				base.OpenOrganTo( from );
				from.LocalOverheadMessage( MessageType.Emote, 0x66B, false, PlagueHelper.Line[22] );
				from.PlaySound( 0x2AC );
			}*/
		}
		
		public void OnBleedTimerTick()
		{
			PlagueBeastLord plaguebl = RootParent as PlagueBeastLord;
			if ( Deleted || !Visible || plaguebl == null || !plaguebl.Alive )
			{
				m_BleedingTimer.Stop();
				return;
			}
			switch ( ItemID )
			{
				case 4963: ItemID = 4967; break;
				case 4967: ItemID = 4963; break;
				/*default:
				{
					m_BleedingTimer.Stop();
					plaguebl.Kill();
					break;
				}*/
			}
		}

		/*public override void OnSnoop( Mobile from )
		{
			OnDoubleClick( from );
		}*/

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