/**********************************************************
RunUO 2.0 AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Red Squirrel on Jan-02-2010 02:32:38pm
Filepath: scripts\_custom\items\misc\staff\ServerRestartStone.cs
Lines of code: 61
***********************************************************/


using System;
using Server.Items;
using System.Collections;
using Server.Mobiles;
using Server.Misc;

namespace Server.Items
{
	public class ServerRestartStone : Item
	{
		private int range=100;

		private bool m_hardshutdown;
		
		[CommandProperty( AccessLevel.GameMaster )] 
		public bool HardShutDown
		{
			get { return m_hardshutdown; }
			set 
			{ 
				m_hardshutdown = value;	Modify();			
			}
		}
		
	
		public override string DefaultName
		{
			get { return HardShutDown ? "Hard Restart Stone" : "Restart Stone"; }
		}

		[Constructable]
		public ServerRestartStone() : base( 0xED4 )
		{
			Movable = false;
			Hue = 37;
		}	
		

		public override void OnDoubleClick( Mobile from )
		{
			if(!Core.Testcenter)
			{
				from.SendMessage("This only works on test center!");
			}
			
			if(Core.FileLoad)
			{
				from.SendMessage("File->MySQL conversion not yet complete.  Cannot restart at this moment.");
				return;
			}
			
			if(HardShutDown)AutoRestart.RestartNow();
			else AutoRestart.CleanRestart();
			
			
			
		}

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

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( (int) 0 ); // version

			writer.Write((bool)m_hardshutdown);
			
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();						
			m_hardshutdown = reader.ReadBool();
		}
	}
}