using System;
using System.Collections;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Mobiles;
using Server.Targeting;

namespace Server.Items
{
	public class HousePlacementTool : Item
	{
		[Constructable]
		public HousePlacementTool() : base( 0x14F0 )
		{
			Weight = 1.0;
			Name = "construction contract";
		}

		public override void OnDoubleClick( Mobile from )
		{
			if ( IsChildOf( from.Backpack ) )
				from.SendGump( new HousePlacementListGump( from, HousePlacementEntry.ClassicHouses ) );
			else
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
		}

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

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			if ( Weight == 0.0 )
				Weight = 3.0;
		}
	}

	public class HousePlacementListGump : Gump
	{
		private Mobile m_From;
		private HousePlacementEntry[] m_Entries;

		private const int LabelColor = 0x7FFF;
		private const int LabelHue = 0x480;

		public HousePlacementListGump( Mobile from, HousePlacementEntry[] entries ) : base( 50, 50 )
		{
			m_From = from;
			m_Entries = entries;

			from.CloseGump( typeof( HousePlacementListGump ) );

			AddPage( 0 );

			AddBackground( 0, 0, 520, 420, 5054 );

			AddImageTiled( 10, 10, 500, 20, 2624 );
			AddAlphaRegion( 10, 10, 500, 20 );

			AddHtmlLocalized( 10, 10, 500, 20, 1060239, LabelColor, false, false ); // <CENTER>CONSTRUCTION CONTRACT</CENTER>

			AddImageTiled( 10, 40, 500, 20, 2624 );
			AddAlphaRegion( 10, 40, 500, 20 );

			AddHtmlLocalized( 50, 40, 225, 20, 1060235, LabelColor, false, false ); // House Description
			AddHtmlLocalized( 275, 40, 75, 20, 1060236, LabelColor, false, false ); // Storage
			AddHtmlLocalized( 350, 40, 75, 20, 1060237, LabelColor, false, false ); // Lockdowns
			AddHtmlLocalized( 425, 40, 75, 20, 1060034, LabelColor, false, false ); // Cost

			AddImageTiled( 10, 70, 500, 280, 2624 );
			AddAlphaRegion( 10, 70, 500, 280 );

			AddImageTiled( 10, 360, 500, 20, 2624 );
			AddAlphaRegion( 10, 360, 500, 20 );

			AddHtmlLocalized( 10, 360, 250, 20, 1060645, LabelColor, false, false ); // Inn Balance:
			AddLabel( 250, 360, LabelHue, Innkeeper.GetBalance( from ).ToString() );

			AddImageTiled( 10, 390, 500, 20, 2624 );
			AddAlphaRegion( 10, 390, 500, 20 );

			AddButton( 10, 390, 4017, 4019, 0, GumpButtonType.Reply, 0 );
			AddHtmlLocalized( 50, 390, 100, 20, 3000363, LabelColor, false, false ); // Close

			for ( int i = 0; i < entries.Length; ++i )
			{
				int page = 1 + (i / 14);
				int index = i % 14;

				if ( index == 0 )
				{
					if ( page > 1 )
					{
						AddButton( 450, 390, 4005, 4007, 0, GumpButtonType.Page, page );
						AddHtmlLocalized( 400, 390, 100, 20, 3000406, LabelColor, false, false ); // Next
					}

					AddPage( page );

					if ( page > 1 )
					{
						AddButton( 200, 390, 4014, 4016, 0, GumpButtonType.Page, page - 1 );
						AddHtmlLocalized( 250, 390, 100, 20, 3000405, LabelColor, false, false ); // Previous
					}
				}

				HousePlacementEntry entry = entries[i];

				int y = 70 + (index * 20);

				AddButton( 10, y, 4005, 4007, 1 + i, GumpButtonType.Reply, 0 );
				AddHtmlLocalized( 50, y, 225, 20, entry.Description, LabelColor, false, false );
				AddLabel( 275, y, LabelHue, entry.Storage.ToString() );
				AddLabel( 350, y, LabelHue, entry.Lockdowns.ToString() );
				AddLabel( 425, y, LabelHue, entry.Cost.ToString() );
			}
		}

		public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
		{
			if ( !m_From.CheckAlive() || m_From.Backpack == null || m_From.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null  )
				return;

			int index = info.ButtonID - 1;

			if ( index >= 0 && index < m_Entries.Length )
			{
				if ( m_From.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse( m_From ) )
					m_From.SendLocalizedMessage( 501271 ); // You already own a house, you may not place another!
				else
					m_From.Target = new NewHousePlacementTarget( m_Entries, m_Entries[index] );
			}
		}
	}

	public class NewHousePlacementTarget : MultiTarget
	{
		private HousePlacementEntry m_Entry;
		private HousePlacementEntry[] m_Entries;

		private bool m_Placed;

		public NewHousePlacementTarget( HousePlacementEntry[] entries, HousePlacementEntry entry ) : base( entry.MultiID, entry.Offset )
		{
			Range = 14;

			m_Entries = entries;
			m_Entry = entry;
		}

		protected override void OnTarget( Mobile from, object o )
		{
			if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null  )
				return;

			IPoint3D ip = o as IPoint3D;

			if ( ip != null )
			{
				if ( ip is Item )
					ip = ((Item)ip).GetWorldTop();

				Point3D p = new Point3D( ip );

				Region reg = Region.Find( new Point3D( p ), from.Map );

				if ( from.AccessLevel >= AccessLevel.GameMaster || reg.AllowHousing( from, p ) )
					m_Placed = m_Entry.OnPlacement( from, p );
				else if ( reg.IsPartOf( typeof( TreasureRegion ) ) || reg.IsPartOf( typeof( UnderworldEntrance ) ) )
					from.SendLocalizedMessage( 1043287 ); // The house could not be created here.  Either something is blocking the house, or the house would not be on valid terrain.
				else
					from.SendLocalizedMessage( 501265 ); // Housing can not be created in this area.
			}
		}

		protected override void OnTargetFinish( Mobile from )
		{
			if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null  )
				return;

			if ( !m_Placed )
				from.SendGump( new HousePlacementListGump( from, m_Entries ) );
		}
	}

	public class HousePlacementEntry
	{
		private Type m_Type;
		private int m_Description;
		private int m_Storage;
		private int m_Lockdowns;
		private int m_NewStorage;
		private int m_NewLockdowns;
		private int m_Vendors;
		private int m_Cost;
		private int m_MultiID;
		private Point3D m_Offset;

		public Type Type{ get{ return m_Type; } }

		public int Description{ get{ return m_Description; } }
		public int Storage{ get{ return BaseHouse.NewVendorSystem ? m_NewStorage : m_Storage; } }
		public int Lockdowns{ get{ return BaseHouse.NewVendorSystem ? m_NewLockdowns : m_Lockdowns; } }
		public int Vendors{ get{ return m_Vendors; } }
		public int Cost{ get{ return m_Cost; } }

		public int MultiID{ get{ return m_MultiID; } }
		public Point3D Offset{ get{ return m_Offset; } }

		public HousePlacementEntry( Type type, int description, int storage, int lockdowns, int newStorage, int newLockdowns, int vendors, int cost, int xOffset, int yOffset, int zOffset, int multiID )
		{
			m_Type = type;
			m_Description = description;
			m_Storage = storage;
			m_Lockdowns = lockdowns;
			m_NewStorage = newStorage;
			m_NewLockdowns = newLockdowns;
			m_Vendors = vendors;
			m_Cost = cost;

			m_Offset = new Point3D( xOffset, yOffset, zOffset );

			m_MultiID = multiID;
		}

		public BaseHouse ConstructHouse( Mobile from )
		{
			try
			{
				object[] args;

				if ( m_Type == typeof( HouseFoundation ) )
					args = new object[4]{ from, m_MultiID, m_Storage, m_Lockdowns };
				else if ( m_Type == typeof( SmallOldHouse ) || m_Type == typeof( SmallShop ) || m_Type == typeof( TwoStoryHouse ) )
					args = new object[2]{ from, m_MultiID };
				else
					args = new object[1]{ from };

				return Activator.CreateInstance( m_Type, args ) as BaseHouse;
			}
			catch
			{
			}

			return null;
		}

		public void PlacementWarning_Callback( Mobile from, bool okay, object state )
		{
			if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null  )
				return;

			PreviewHouse prevHouse = (PreviewHouse)state;

			if ( !okay )
			{
				prevHouse.Delete();
				return;
			}

			if ( prevHouse.Deleted )
			{
				/* Too much time has passed and the test house you created has been deleted.
				 * Please try again!
				 */
				from.SendGump( new NoticeGump( 1060637, 30720, 1060647, 32512, 320, 180, null, null ) );

				return;
			}

			Point3D center = prevHouse.Location;
			Map map = prevHouse.Map;

			prevHouse.Delete();

			ArrayList toMove;
			//Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
			HousePlacementResult res = HousePlacement.Check( from, m_MultiID, center, out toMove );

			switch ( res )
			{
				case HousePlacementResult.Valid:
				{
					if ( from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse( from ) )
					{
						from.SendLocalizedMessage( 501271 ); // You already own a house, you may not place another!
					}
					else
					{
						BaseHouse house = ConstructHouse( from );

						if ( house == null )
							return;

						house.Price = m_Cost;

						if ( from.AccessLevel >= AccessLevel.GameMaster )
						{
							from.SendMessage( "{0} gold would have been withdrawn from your inn chest if you were not a GM.", m_Cost.ToString() );
						}
						else
						{
							if ( Innkeeper.Withdraw( from, m_Cost ) )
							{
								from.SendLocalizedMessage( 1060398, m_Cost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your inn chest.
							}
							else
							{
								house.RemoveKeys( from );
								house.Delete();
								from.SendLocalizedMessage( 1060646 ); // You do not have the funds available in your inn chest to purchase this house.  Try placing a smaller house, or adding gold or gold deeds to your inn chest.
								return;
							}
						}

						house.MoveToWorld( center, from.Map );

						for ( int i = 0; i < toMove.Count; ++i )
						{
							object o = toMove[ i ];

							if ( o is Mobile )
								( (Mobile) o ).Location = house.BanLocation;
							else if ( o is Item )
								( (Item) o ).Location = house.BanLocation;
						}
					}

					break;
				}
				case HousePlacementResult.BadItem:
				case HousePlacementResult.BadLand:
				case HousePlacementResult.BadStatic:
				case HousePlacementResult.BadRegionHidden:
				case HousePlacementResult.NoSurface:
				{
					from.SendLocalizedMessage( 1043287 ); // The house could not be created here.  Either something is blocking the house, or the house would not be on valid terrain.
					break;
				}
				case HousePlacementResult.BadRegion:
				{
					from.SendLocalizedMessage( 501265 ); // Housing cannot be created in this area.
					break;
				}
				case HousePlacementResult.BadRegionTemp:
				{
					from.SendLocalizedMessage( 501270 ); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
					break;
				}
			}
		}

		public bool OnPlacement( Mobile from, Point3D p )
		{
			if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null  )
				return false;

			ArrayList toMove;
			Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
			HousePlacementResult res = HousePlacement.Check( from, m_MultiID, center, out toMove );

			switch ( res )
			{
				case HousePlacementResult.Valid:
				{
					if ( from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse( from ) )
					{
						from.SendLocalizedMessage( 501271 ); // You already own a house, you may not place another!
					}
					else
					{
						from.SendLocalizedMessage( 1011576 ); // This is a valid location.

						PreviewHouse prev = new PreviewHouse( m_MultiID );

						MultiComponentList mcl = prev.Components;

						Point3D banLoc = new Point3D( center.X + mcl.Min.X, center.Y + mcl.Max.Y + 1, center.Z );

						for ( int i = 0; i < mcl.List.Length; ++i )
						{
							MultiTileEntry entry = mcl.List[i];

							int itemID = entry.m_ItemID;

							if ( itemID >= 0xBA3 && itemID <= 0xC0E )
							{
								banLoc = new Point3D( center.X + entry.m_OffsetX, center.Y + entry.m_OffsetY, center.Z );
								break;
							}
						}

						for ( int i = 0; i < toMove.Count; ++i )
						{
							object o = toMove[i];

							if ( o is Mobile )
								((Mobile)o).Location = banLoc;
							else if ( o is Item )
								((Item)o).Location = banLoc;
						}

						prev.MoveToWorld( center, from.Map );

						/* You are about to place a new house.
						 * Placing this house will condemn any and all of your other houses that you may have.
						 * All of your houses on all shards will be affected.
						 * 
						 * In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.
						 * 
						 * Once you accept these terms, these effects cannot be reversed.
						 * Re-deeding or transferring your new house will not uncondemn your other house(s) nor will the one week timer be removed.
						 * 
						 * If you are absolutely certain you wish to proceed, click the button next to OKAY below.
						 * If you do not wish to trade for this house, click CANCEL.
						 */
						from.SendGump( new WarningGump( 1060635, 30720, 1049583, 32512, 420, 280, new WarningGumpCallback( PlacementWarning_Callback ), prev ) );

						return true;
					}

					break;
				}
				case HousePlacementResult.BadItem:
				case HousePlacementResult.BadLand:
				case HousePlacementResult.BadStatic:
				case HousePlacementResult.BadRegionHidden:
				case HousePlacementResult.NoSurface:
				{
					from.SendLocalizedMessage( 1043287 ); // The house could not be created here.  Either something is blocking the house, or the house would not be on valid terrain.
					break;
				}
				case HousePlacementResult.BadRegion:
				{
					from.SendLocalizedMessage( 501265 ); // Housing cannot be created in this area.
					break;
				}
				case HousePlacementResult.BadRegionTemp:
				{
					from.SendLocalizedMessage( 501270 ); //Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
					break;
				}
			}

			return false;
		}

		private static Hashtable m_Table;

		static HousePlacementEntry()
		{
			m_Table = new Hashtable();

			FillTable( m_ClassicHouses );
		}

		public static HousePlacementEntry Find( BaseHouse house )
		{
			object obj = m_Table[house.GetType()];

			if ( obj is HousePlacementEntry )
			{
				return ((HousePlacementEntry)obj);
			}
			else if ( obj is ArrayList )
			{
				ArrayList list = (ArrayList)obj;

				for ( int i = 0; i < list.Count; ++i )
				{
					HousePlacementEntry e = (HousePlacementEntry)list[i];

					if ( e.m_MultiID == house.ItemID )
						return e;
				}
			}
			else if ( obj is Hashtable )
			{
				Hashtable table = (Hashtable)obj;

				obj = table[house.ItemID];

				if ( obj is HousePlacementEntry )
					return (HousePlacementEntry)obj;
			}

			return null;
		}

		private static void FillTable( HousePlacementEntry[] entries )
		{
			for ( int i = 0; i < entries.Length; ++i )
			{
				HousePlacementEntry e = entries[i];

				object obj = m_Table[e.m_Type];

				if ( obj == null )
				{
					m_Table[e.m_Type] = e;
				}
				else if ( obj is HousePlacementEntry )
				{
					ArrayList list = new ArrayList();

					list.Add( obj );
					list.Add( e );

					m_Table[e.m_Type] = list;
				}
				else if ( obj is ArrayList )
				{
					ArrayList list = (ArrayList)obj;

					if ( list.Count == 8 )
					{
						Hashtable table = new Hashtable();

						for ( int j = 0; j < list.Count; ++j )
							table[((HousePlacementEntry)list[j]).m_MultiID] = list[j];

						table[e.m_MultiID] = e;

						m_Table[e.m_Type] = table;
					}
					else
					{
						list.Add( e );
					}
				}
				else if ( obj is Hashtable )
				{
					((Hashtable)obj)[e.m_MultiID] = e;
				}
			}
		}

		private static HousePlacementEntry[] m_ClassicHouses = new HousePlacementEntry[]
			{
				new HousePlacementEntry( typeof( BlueTent ), 							1017341, 	351, 	81, 	351, 	81, 	1, 	15000, 		0, 	4, 	0, 	0x70),
				new HousePlacementEntry( typeof( GreenTent ), 							1017342, 	351, 	81, 	351, 	81, 	1, 	15000, 		0, 	4, 	0, 	0x72),
				new HousePlacementEntry( typeof( SmallLogCabinSouth ), 					1030871, 	382, 	112, 	382, 	112, 	2, 	30000, 		0, 	4, 	0, 	0x5A),
				new HousePlacementEntry( typeof( SmallLogCabinEast ), 					1030871, 	382, 	112, 	382, 	112, 	2, 	30000, 		0, 	4, 	0, 	0x59),
				new HousePlacementEntry( typeof( NewSmallStoneHomeEast ), 				1030845, 	382, 	112, 	382, 	112, 	2, 	30000, 		4,	-2,	0, 	0x38),
				new HousePlacementEntry( typeof( NewSmallStoneHouseEast ), 				1030848, 	382, 	112, 	382, 	112, 	2, 	30000, 		4,	-2,	0, 	0x3B),
				new HousePlacementEntry( typeof( SmallOldHouse ), 						1011303, 	382, 	112, 	382, 	112, 	2, 	30000, 		0, 	4, 	0, 	0x64),
				new HousePlacementEntry( typeof( SmallOldHouse ), 						1011304, 	382, 	112, 	382, 	112, 	2, 	30000, 		0, 	4, 	0, 	0x66),
				new HousePlacementEntry( typeof( SmallOldHouse ), 						1011305, 	382, 	112, 	382, 	112, 	2, 	30000, 		0, 	4, 	0, 	0x68),
				new HousePlacementEntry( typeof( SmallOldHouse ), 						1011306, 	382, 	112, 	382, 	112, 	2, 	30000, 		0, 	4, 	0, 	0x6A),
				new HousePlacementEntry( typeof( SmallOldHouse ), 						1011307, 	382, 	112, 	382, 	112, 	2, 	30000, 		0, 	4, 	0, 	0x6C),
				new HousePlacementEntry( typeof( SmallOldHouse ), 						1011308, 	382, 	112, 	382, 	112, 	2, 	30000, 		0, 	4, 	0, 	0x6E),
				new HousePlacementEntry( typeof( NewSmallStoneStoreFront ), 			1030844, 	410, 	140, 	410, 	140, 	3, 	45000, 		0, 	4, 	0, 	0x37),
				new HousePlacementEntry( typeof( NewSmallWoodenShackPorch ), 			1030849, 	410, 	140, 	410, 	140, 	3, 	45000, 		-3, 4, 	0, 	0x46),
				new HousePlacementEntry( typeof( SmallShop ), 							1011321, 	444, 	174, 	444, 	174, 	4, 	60000, 		-1, 4, 	0, 	0xA0),
				new HousePlacementEntry( typeof( SmallShop ), 							1011322, 	444, 	174, 	444, 	174, 	4, 	60000, 		0, 	4, 	0, 	0xA2),
				new HousePlacementEntry( typeof( NewPlainStoneHouse ), 					1030851, 	456, 	186, 	456, 	186, 	5, 	65000, 		-5,	6,	0, 	0x48),
				new HousePlacementEntry( typeof( NewSmallLogCabinWithDeck ), 			1030860, 	449, 	179, 	449, 	179, 	4, 	65000, 		1,	4,	0,	0x51),
				new HousePlacementEntry( typeof( NewPlainPlasterHouse ), 				1030850, 	463, 	193, 	463, 	193, 	5, 	70000, 		-5,	4,	0, 	0x47),
				new HousePlacementEntry( typeof( NewSmallSandstoneWorkshop ), 			1030857, 	458, 	188, 	458, 	188, 	5, 	70000, 		4, 	4, 	0, 	0x4E),
				new HousePlacementEntry( typeof( NewTwoStorySmallPlasterDwelling ), 	1030855, 	470, 	200, 	470, 	200, 	5, 	75000, 		3, 	3, 	0, 	0x4C),
				new HousePlacementEntry( typeof( Wagon ), 								1030870, 	470, 	200, 	470, 	200, 	5, 	75000, 		0, 	0, 	0, 	0x57),
				new HousePlacementEntry( typeof( NewTwoStorySmallStoneDwelling ), 		1030841, 	470, 	200, 	470, 	200, 	5, 	75000, 		3, 	3, 	0, 	0x44),
				new HousePlacementEntry( typeof( NewTwoStorySmallStoneHome ), 			1030839, 	470, 	200, 	470, 	200, 	5, 	75000, 		3, 	3, 	0, 	0x42),
				new HousePlacementEntry( typeof( NewTwoStorySmallStoneHouse ), 			1030840, 	470, 	200, 	470, 	200, 	5, 	75000, 		3, 	3, 	0, 	0x43),
				new HousePlacementEntry( typeof( NewTwoStorySmallWoodenDwelling ), 		1030842, 	470, 	200, 	470, 	200, 	5, 	75000, 		3, 	3, 	0, 	0x45),
				new HousePlacementEntry( typeof( LogCabin ), 							1011318, 	478, 	208, 	478, 	208, 	5, 	80000, 		1, 	6, 	0, 	0x9A),
				new HousePlacementEntry( typeof( NewLogCabin ), 						1030859, 	488, 	218, 	488, 	218, 	6, 	80000, 		2, 	5, 	0, 	0x50),
				new HousePlacementEntry( typeof( NewSmallStoneShoppe ), 				1030835, 	478, 	208, 	478, 	208, 	5, 	80000, 		-5, 6, 	0, 	0x3E),
				new HousePlacementEntry( typeof( NewWoodenHomePorch ), 					1030836, 	487, 	217, 	487, 	217, 	6, 	80000, 		2, 	5, 	0, 	0x3F),
				new HousePlacementEntry( typeof( SmallTower ), 							1011317, 	500, 	230, 	500, 	230, 	6, 	85000, 		3, 	4, 	0, 	0x98),
				new HousePlacementEntry( typeof( NewSmallStoneTemple ), 				1030856, 	504, 	234, 	504, 	234, 	6, 	90000, 		4, 	-3, 0, 	0x4D),
				new HousePlacementEntry( typeof( NewBrickHomeWithFrontDeck ), 			1030867, 	518, 	248, 	518, 	248, 	7, 	95000, 		0, 	7, 	0, 	0x54),
				new HousePlacementEntry( typeof( NewPlasterHousePictureWindow ), 		1030832, 	515, 	245, 	515, 	245, 	7, 	95000, 		7, 	-6, 0, 	0x35),
				new HousePlacementEntry( typeof( NewStoneHomeWithEnclosedPatio ), 		1030858, 	516, 	246, 	516, 	246, 	7, 	95000, 		7, 	0, 	0, 	0x4F),
				new HousePlacementEntry( typeof( SandStonePatio ), 						1011320, 	520, 	250, 	520, 	250, 	7, 	95000, 		-1, 4, 	0, 	0x9C),
				new HousePlacementEntry( typeof( NewOldStoneHomeShoppe ), 				1030864, 	526, 	256, 	526, 	256, 	7, 	100000, 	8, 	-5, 0, 	0x5F),
				new HousePlacementEntry( typeof( NewBrickHomeWithLargePorch ), 			1030869, 	533, 	263, 	533, 	263, 	7, 	105000, 	-6, 6, 	0, 	0x56),
				new HousePlacementEntry( typeof( GuildHouse ), 							1011309, 	544, 	274, 	544, 	274, 	7, 	110000, 	-1, 7, 	0, 	0x74),
				new HousePlacementEntry( typeof( LargePatioHouse ), 					1011315, 	546, 	276, 	546, 	276, 	8, 	110000, 	-4, 7, 	0, 	0x8C),
				new HousePlacementEntry( typeof( NewTwoStoryWoodenHomeWithPorch ), 		1030834, 	562, 	292, 	562, 	292, 	8, 	115000, 	6, 	4, 	0, 	0x3D),
				new HousePlacementEntry( typeof( TwoStoryVilla ), 						1011319, 	560, 	290, 	560, 	290, 	8, 	115000, 	3, 	6, 	0, 	0x9E),
				new HousePlacementEntry( typeof( NewTwoStoryBrickHouse ), 				1030831, 	568, 	298, 	568, 	298, 	8, 	120000, 	-4, 5, 	0, 	0x34),
				new HousePlacementEntry( typeof( NewFancyStoneWoodHome ), 				1030846, 	580, 	310, 	580, 	310, 	9, 	125000, 	-4, 5, 	0, 	0x39),
				new HousePlacementEntry( typeof( NewTwoStoryStoneVilla ), 				1030854, 	589, 	319, 	589, 	319, 	9, 	130000, 	4, 	8, 	0, 	0x4B),
				new HousePlacementEntry( typeof( NewWoodenHomeUpperDeck ), 				1030853, 	590, 	320, 	590, 	320, 	9, 	130000, 	-4, 5, 	0, 	0x4A),
				new HousePlacementEntry( typeof( NewBrickArena ), 						1030862, 	608, 	338, 	608, 	338, 	10, 140000, 	-8, 11, 0, 	0x5D),
				new HousePlacementEntry( typeof( NewMarbleShoppe ), 					1030868, 	608, 	338, 	608, 	338, 	10, 140000, 	-5, 6, 	0, 	0x55),
				new HousePlacementEntry( typeof( NewPlasterHomeDirtDeck ), 				1030852, 	622, 	352, 	622, 	352, 	10, 145000, 	-2, 7, 	0, 	0x49),
				new HousePlacementEntry( typeof( NewTwoStoryBrickHome ), 				1030833, 	625, 	355, 	625, 	355, 	10, 150000, 	-3, 7, 	0, 	0x3C),
				new HousePlacementEntry( typeof( NewBrickHouseWithSteeple ), 			1030830, 	654, 	384, 	654, 	384, 	11, 160000, 	0, 	6, 	0, 	0x33),
				new HousePlacementEntry( typeof( NewFancyWoodenStoneHouse ), 			1030847, 	653, 	383, 	653, 	383, 	11, 160000, 	6, 	-4, 0, 	0x3A),
				new HousePlacementEntry( typeof( TwoStoryHouse ), 						1011310, 	694, 	424, 	694, 	424, 	12, 180000, 	-3, 7, 	0, 	0x76),
				new HousePlacementEntry( typeof( TwoStoryHouse ), 						1011311, 	694, 	424, 	694, 	424, 	12, 180000, 	-3, 7, 	0, 	0x78),
				new HousePlacementEntry( typeof( LargeMarbleHouse ), 					1011316, 	700, 	430, 	700, 	430, 	13, 185000, 	-4, 7, 	0, 	0x96),
				new HousePlacementEntry( typeof( NewTwoStorySandstoneHouse ), 			1030829, 	725, 	455, 	725, 	455, 	14, 195000, 	7, 	-4, 0, 	0x32),
				new HousePlacementEntry( typeof( NewSmallStoneTower ), 					1030837, 	731, 	461, 	731, 	461, 	14, 200000, 	-2, 6, 	0, 	0x40),
				new HousePlacementEntry( typeof( NewSmallBrickCastle ), 				1030865, 	743, 	473, 	743, 	473, 	14, 205000, 	-5, 6, 	0, 	0x60),
				new HousePlacementEntry( typeof( NewStoneFort ), 						1030863, 	750, 	480, 	750, 	480, 	14, 210000, 	-5, 7, 	0, 	0x5E),
				new HousePlacementEntry( typeof( CastleTower ), 						1024781, 	839, 	569, 	839, 	569, 	17, 250000, 	5, 	7, 	0, 	0x30),
				new HousePlacementEntry( typeof( NewRaisedBrickHome ), 					1030861, 	866, 	596, 	866, 	596, 	18, 265000, 	3, 	7, 	0, 	0x52),
				new HousePlacementEntry( typeof( NewSmallWizardTower ), 				1030866, 	869, 	599, 	869, 	599, 	18, 270000, 	-2, 6, 	0, 	0x53),
				new HousePlacementEntry( typeof( NewWoodenMansion ), 					1030843, 	920, 	650, 	920, 	650, 	20, 290000, 	6, 	7, 	0, 	0x36),
				new HousePlacementEntry( typeof( NewThreeStoryStoneVilla ), 			1030838, 	965, 	695, 	965, 	695, 	22, 310000, 	-6, 7, 	0, 	0x41),
				new HousePlacementEntry( typeof( Tower ), 								1011312, 	1476, 	1206, 	1476, 	1206, 	24, 560000, 	0, 	7, 	0, 	0x7A),
				new HousePlacementEntry( typeof( LargeTent ), 							1024851, 	1572, 	1302, 	1572, 	1302, 	28, 610000, 	1, 	13, 0, 	0x5C),
				new HousePlacementEntry( typeof( Keep ), 								1011313, 	1847, 	1577, 	1847, 	1577, 	30, 740000, 	0, 	11, 0, 	0x7C),
				new HousePlacementEntry( typeof( Pyramid ), 							1024788, 	1856, 	1586, 	1856, 	1586, 	32, 750000, 	3, 	16, 0, 	0x5B),
				new HousePlacementEntry( typeof( LogMansion ), 							1024875, 	2777, 	2507, 	2777, 	2507, 	34, 800000, 	13, 13, 0, 	0x58),
				new HousePlacementEntry( typeof( Castle ), 								1011314, 	2777, 	2507, 	2777, 	2507, 	34, 800000, 	0, 	16, 0, 	0x7E),
				new HousePlacementEntry( typeof( Fortress ), 							1024869, 	4448, 	4178, 	4448, 	4178, 	36, 900000, 	4, 	16, 0, 	0x31)
			};

		public static HousePlacementEntry[] ClassicHouses{ get{ return m_ClassicHouses; } }
	}
}