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


using System;
using System.Reflection;
using Server.Items;
using Server.Targeting;
using Server.Multis;

namespace Server.Commands
{
	public class forceidoc
	{
		public static void Initialize()
		{
			CommandSystem.Register( "forceidoc", AccessLevel.Administrator, new CommandEventHandler( forceidoc_OnCommand ) );
		}

		[Usage( "forceidoc" )]
		[Description( "Makes targeted house go idoc." )]
		private static void forceidoc_OnCommand( CommandEventArgs e )
		{
			e.Mobile.Target = new InternalTarget();
		}
		
		
		
		private class InternalTarget : Target
		{

			public InternalTarget(  ) : base( 12, false, TargetFlags.Harmful )
			{
			}

			protected override void OnTarget( Mobile from, object o )
			{
			if(from.AccessLevel<AccessLevel.Administrator){from.SendMessage("Only admins can do this!");return;}
			
				if ( o is HouseSign )
				{
				HouseSign hs = o as HouseSign;
				
					if(hs.RestrictDecay)
					{
					from.SendMessage("Decay is restricted for this house.");
					return;
					}
					
					if(hs.m_Owner==null)
					{
					from.SendMessage("FATAL: No house attached to sign!");
					return;					
					}
					
					BaseHouse bh = hs.m_Owner as BaseHouse;
					
					bh.ForceIdoc();		
					
					from.SendMessage("The idoc process has now been started");					
				}
				else from.SendMessage("You must target the house sign for this to work!");
			}

			protected override void OnTargetFinish( Mobile from )
			{
			}
		}
		

		
	}
}
