Server.Items.DeceitBrazier.GetSpawnPosition C# (CSharp) Method

GetSpawnPosition() public method

public GetSpawnPosition ( ) : Point3D
return Point3D
		public Point3D GetSpawnPosition()
		{
			Map map = Map;

			if( map == null )
				return Location;

			// Try 10 times to find a Spawnable location.
			for( int i = 0; i < 10; i++ )
			{
				int x = Location.X + (Utility.Random( (m_SpawnRange * 2) + 1 ) - m_SpawnRange);
				int y = Location.Y + (Utility.Random( (m_SpawnRange * 2) + 1 ) - m_SpawnRange);
				int z = Map.GetAverageZ( x, y );

				if( Map.CanSpawnMobile( new Point2D( x, y ), this.Z ) )
					return new Point3D( x, y, this.Z );
				else if( Map.CanSpawnMobile( new Point2D( x, y ), z ) )
					return new Point3D( x, y, z );
			}

			return this.Location;
		}