using System;
using Server;
using System.Collections;
using System.Collections.Generic;
using Server.Misc;
using Server.Items;
using Server.Network;
using Server.Commands;
using Server.Commands.Generic;
using Server.Mobiles;
using Server.Accounting;
using Server.Regions;
using System.IO;
using Server.Targeting;

namespace Server.Scripts.Commands 
{
    public class GetLevel
    {
        public static void Initialize()
        {
            CommandSystem.Register("GetLevel", AccessLevel.Counselor, new CommandEventHandler( GetLevels ));
        }

        [Usage("GetLevel")]
        [Description("Gets the level of the creature.")]
        public static void GetLevels( CommandEventArgs e )
        {
			e.Mobile.SendMessage( "What target do you want to inspect?" );
			e.Mobile.Target = new InternalTarget();
		}

		private class InternalTarget : Target
		{
			public InternalTarget() :  base ( 8, false, TargetFlags.None )
			{
			}

			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( targeted is Mobile )
				{
					Mobile m = (Mobile)targeted;

					from.SendMessage( "" + BaseCreature.MyLevel( m ) + "" );
				}
				else
				{
					from.SendMessage( "Not a valid creature!" );
				}
			}
        }
    }
}