/**********************************************************
RunUO AoV C# script file
Official Age of Valor Script :: www.uovalor.com
Last modified by Red Squirrel on Aug-08-2011 09:29:10pm
Filepath: scripts\Commands\SqlStorageCommands.cs
Lines of code: 44

Description: 

***********************************************************/


using System;
using Server;
using Server.Commands;
using System.Diagnostics;


namespace Server.DataStorage
{
	public class Commands
	{

		

		public static void Initialize()
		{		
			
			CommandSystem.Register( "savequeue", AccessLevel.Counselor, new CommandEventHandler( savequeue_OnCommand ),true );

			CommandSystem.Register( "buffersavelimit", AccessLevel.Administrator, new CommandEventHandler( buffersavelimit_OnCommand ) );
		}

		//Start commands
		//--------------
		
		

		[Usage( "savequeue" )]
		[Description( "displays save queue values" )]
		public static void savequeue_OnCommand( CommandEventArgs e )
		{
			
			e.Mobile.SendMessage( "Save queue: {0} objects    ({1})",SqlStorageSystem.ActionObjectCountStr,SqlStorageSystem.ActionObjectCount);
			e.Mobile.SendMessage( "Frequent Save queue: {0} objects    ({1})",SqlStorageSystem.ActionObjectCountStr_Frequent,SqlStorageSystem.ActionObjectCount_Frequent);
			e.Mobile.SendMessage( "Last snapshot {1} ago",SqlStorageSystem.LastSnapShot,SqlStorageSystem.LastSnapShotElapsed);
			
			if(SqlStorageSystem.Connector!=null)
			{			
				e.Mobile.SendMessage( "SQL Connection: {0}",SqlStorageSystem.LostCon ? "Lost" : "Active");
			}
		}			

		
			
		[Usage( "buffersavelimit <int>" )]
		[Description( "Sets amount of lines to submit at once to SDE" )]
		public static void buffersavelimit_OnCommand( CommandEventArgs e )
		{
			
			if ( e.Length == 1 )
			{
				int lines = e.GetInt32( 0 );
				if(lines<1)lines=1;				
				
				SqlStorageSystem.BufferSaveLimit=lines;				
				e.Mobile.SendMessage( "Lines set to {0}.",lines);
				
			}
			else
			{
				e.Mobile.SendMessage( "Format: buffersavelimit <int>" );
				e.Mobile.SendMessage( "Max lines is currently {0}",SqlStorageSystem.BufferSaveLimit );
			}
		}
				
		
		//end commands
		//---------------------
		
		
		
		
	}
}