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


using System;
using System.Reflection;
using Server.Items;
using Server.Targeting;
using Server.Mobiles;
using System.Collections;
using System.Text;
using System.IO;


namespace Server.Commands
{
	public class genuoamspawnfile
	{
		public static void Initialize()
		{
			CommandSystem.Register( "genuoamspawnfile", AccessLevel.GameMaster, new CommandEventHandler( genuoamspawnfile_OnCommand ) );
		}

		[Usage( "genuoamspawnfile" )]
		[Description( "Generates UOAM spawner file" )]
		private static void genuoamspawnfile_OnCommand( CommandEventArgs e )
		{		
		PlayerMobile pm = e.Mobile as PlayerMobile;
		
					int count=0;
					
					char map;
					
					
					ArrayList items = new ArrayList();
					
					foreach ( Item i in World.Items.Values )
					{
						//delete if all properties match
						if(i is Spawner)
						{
						items.Add(i);
						count++;
						}
					}
					
					
					using ( StreamWriter op = new StreamWriter( "output\\aovspawners-output.map" ) )
					{					
					op.WriteLine( "3");
							
							map='1';
							for(int i=0;i<items.Count;i++)
							{
								if(items[i] is Spawner)
								{
								Spawner spn = (Spawner)items[i] as Spawner;
								
									//set map #
									
									if(spn.Map==Map.Felucca) map='1'; 
									if(spn.Map==Map.Trammel) map='2';
									if(spn.Map==Map.Ilshenar) map='3';
									if(spn.Map==Map.Malas) map='4';
									if(spn.Map==Map.Tokuno) map='5';
									
								if(spn.FelandTram)
								{
								op.WriteLine( "-point of interest: {0} {1} 1 Spawner [ {3} {4} {5} ] (R {8} C {9})",spn.X,spn.Y,map,spn.Spawn1,spn.Spawn2,spn.Spawn3,spn.Spawn4,spn.Spawn5,spn.HomeRange,spn.Count);
								op.WriteLine( "-point of interest: {0} {1} 2 Spawner [ {3} {4} {5} ] (R {8} C {9})",spn.X,spn.Y,map,spn.Spawn1,spn.Spawn2,spn.Spawn3,spn.Spawn4,spn.Spawn5,spn.HomeRange,spn.Count);
								}
								else op.WriteLine( "-point of interest: {0} {1} {2} Spawner [ {3} {4} {5} ] (R {8} C {9})",spn.X,spn.Y,map,spn.Spawn1,spn.Spawn2,spn.Spawn3,spn.Spawn4,spn.Spawn5,spn.HomeRange,spn.Count);
								}

						   }	
				 	}					
				pm.SendMessage("aovspawners-output.map generation complete",count);
		}
		

		
	}
}
