当前位置: 首页>>代码示例>>C#>>正文


C# Map.GetItemsInBounds方法代码示例

本文整理汇总了C#中Server.Map.GetItemsInBounds方法的典型用法代码示例。如果您正苦于以下问题:C# Map.GetItemsInBounds方法的具体用法?C# Map.GetItemsInBounds怎么用?C# Map.GetItemsInBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.Map的用法示例。


在下文中一共展示了Map.GetItemsInBounds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindEntity

		public static bool FindEntity( Type type, Point3D p, Map map, bool mob )
		{
			IPooledEnumerable loc;
			Rectangle2D rect = new Rectangle2D( p.X, p.Y, 1, 1 );
			if( mob )
				loc = map.GetMobilesInBounds( rect );
			else
				loc = map.GetItemsInBounds( rect );

			bool found = false;

			try
			{
				foreach( object o in loc )
					if( o != null && o.GetType() == type || o.GetType().IsSubclassOf( type ) )
					{
						found = true;
						break;
					}
			}
			catch
			{
			}

			loc.Free();

			return found;
		}
开发者ID:greeduomacro,项目名称:GoUO,代码行数:28,代码来源:Utilities.cs

示例2: OnTarget

        public void OnTarget( Mobile from, Map map, Point3D start, Point3D end, object state )
        {
            try
            {
                object[] states = (object[]) state;
                BaseCommand command = (BaseCommand) states[0];
                string[] args = (string[]) states[1];

                ObjectConditional cond = ObjectConditional.Parse( from, ref args );

                Rectangle2D rect = new Rectangle2D( start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1 );

                bool items, mobiles;

                if ( !CheckObjectTypes( command, cond, out items, out mobiles ) )
                {
                    return;
                }

                IEnumerable<object> eable;

                if ( items && mobiles )
                {
                    eable = map.GetObjectsInBounds( rect );
                }
                else if ( items )
                {
                    eable = map.GetItemsInBounds( rect );
                }
                else if ( mobiles )
                {
                    eable = map.GetMobilesInBounds( rect );
                }
                else
                {
                    return;
                }

                ArrayList objs = new ArrayList();

                foreach ( object obj in eable )
                {
                    if ( mobiles && obj is Mobile && !BaseCommand.IsAccessible( from, obj ) )
                    {
                        continue;
                    }

                    if ( cond.CheckCondition( obj ) )
                    {
                        objs.Add( obj );
                    }
                }

                RunCommand( from, objs, command, args );
            }
            catch ( Exception ex )
            {
                from.SendMessage( ex.Message );
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:60,代码来源:AreaCommandImplementor.cs

示例3: DoWipe

        public static void DoWipe( Mobile from, Map map, Point3D start, Point3D end, WipeType type )
        {
            CommandLogging.WriteLine( from, "{0} {1} wiping from {2} to {3} in {5} ({4})", from.AccessLevel, CommandLogging.Format( from ), start, end, type, map );

            bool mobiles = ( ( type & WipeType.Mobiles ) != 0 );
            bool multis = ( ( type & WipeType.Multis ) != 0 );
            bool items = ( ( type & WipeType.Items ) != 0 );

            ArrayList toDelete = new ArrayList();

            Rectangle2D rect = new Rectangle2D( start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1 );

            IEnumerable<object> eable;

            if ( ( items || multis ) && mobiles )
            {
                eable = map.GetObjectsInBounds( rect );
            }
            else if ( items || multis )
            {
                eable = map.GetItemsInBounds( rect );
            }
            else if ( mobiles )
            {
                eable = map.GetMobilesInBounds( rect );
            }
            else
            {
                return;
            }

            foreach ( object obj in eable )
            {
                if ( items && ( obj is Item ) && !( ( obj is BaseMulti ) || ( obj is HouseSign ) ) )
                {
                    toDelete.Add( obj );
                }
                else if ( multis && ( obj is BaseMulti ) )
                {
                    toDelete.Add( obj );
                }
                else if ( mobiles && ( obj is Mobile ) && !( (Mobile) obj ).IsPlayer )
                {
                    toDelete.Add( obj );
                }
            }

            for ( int i = 0; i < toDelete.Count; ++i )
            {
                if ( toDelete[i] is Item )
                {
                    ( (Item) toDelete[i] ).Delete();
                }
                else if ( toDelete[i] is Mobile )
                {
                    ( (Mobile) toDelete[i] ).Delete();
                }
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:59,代码来源:Wipe.cs

示例4: OnTarget

		public void OnTarget( Mobile from, Map map, Point3D start, Point3D end, object state )
		{
			try
			{
                if ( from.AccessLevel < MaxLengthOverride && Math.Max(end.X - start.X, end.Y - start.Y) > MaxLength )
                {
                    from.SendMessage("Maximum bounding box size exceeded.");
                    return;
                }

                object[] states = (object[])state;
				BaseCommand command = (BaseCommand)states[0];
				string[] args = (string[])states[1];

				Rectangle2D rect = new Rectangle2D( start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1 );

				Extensions ext = Extensions.Parse( from, ref args );

				bool items, mobiles;

				if ( !CheckObjectTypes( from, command, ext, out items, out mobiles ) )
					return;

				IPooledEnumerable eable;

				if ( items && mobiles )
					eable = map.GetObjectsInBounds( rect );
				else if ( items )
					eable = map.GetItemsInBounds( rect );
				else if ( mobiles )
					eable = map.GetMobilesInBounds( rect );
				else
					return;

				ArrayList objs = new ArrayList();

				foreach ( object obj in eable )
				{
					if ( mobiles && obj is Mobile && !BaseCommand.IsAccessible( from, obj ) )
						continue;

					if ( ext.IsValid( obj ) )
						objs.Add( obj );
				}

				eable.Free();

				ext.Filter( objs );

				RunCommand( from, objs, command, args );
			}
			catch ( Exception ex )
			{
				from.SendMessage( ex.Message );
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:56,代码来源:AreaCommandImplementor.cs

示例5: OnTarget

		public void OnTarget( Mobile from, Map map, Point3D start, Point3D end, object state )
		{
			try
			{
                if (from.AccessLevel < MIN_MAX_EDGE_OVERRIDE_ACCESS_LEVEL &&
                    Math.Max(end.X - start.X, end.Y - start.Y) > MAX_EDGE_LENGTH)
                {
                    from.SendMessage("Maximum bounding box size exceeded.");
                    return;
                }

                object[] states = (object[])state;
				BaseCommand command = (BaseCommand)states[0];
				string[] args = (string[])states[1];

				ObjectConditional cond = ObjectConditional.Parse( from, ref args );

				Rectangle2D rect = new Rectangle2D( start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1 );

				bool items, mobiles;

				if ( !CheckObjectTypes( command, cond, out items, out mobiles ) )
					return;

				IPooledEnumerable eable;

				if ( items && mobiles )
					eable = map.GetObjectsInBounds( rect );
				else if ( items )
					eable = map.GetItemsInBounds( rect );
				else if ( mobiles )
					eable = map.GetMobilesInBounds( rect );
				else
					return;

				ArrayList objs = new ArrayList();

				foreach ( object obj in eable )
				{
					if ( mobiles && obj is Mobile && !BaseCommand.IsAccessible( from, obj ) )
						continue;

					if ( cond.CheckCondition( obj ) )
						objs.Add( obj );
				}

				eable.Free();

				RunCommand( from, objs, command, args );
			}
			catch ( Exception ex )
			{
				from.SendMessage( ex.Message );
			}
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:55,代码来源:AreaCommandImplementor.cs

示例6: boxPicker_callback

		private static void boxPicker_callback( Mobile m, Map map, Point3D start, Point3D end, object state )
		{
			string filename = (string)state;

			if( start.X > end.X )
			{
				int x = start.X;
				start.X = end.X;
				end.X = x;
			}

			if( start.Y > end.Y )
			{
				int y = start.Y;
				start.Y = end.Y;
				end.Y = y;
			}

			IPooledEnumerable eable = map.GetItemsInBounds( new Rectangle2D( start.X, start.Y, ((end.X - start.X) + 1), ((end.Y - start.Y) + 1) ) );
			List<Item> items = new List<Item>();

			try
			{
				foreach( Item i in eable )
				{
					items.Add( i );
				}
			}
			catch
			{
				m.SendMessage( "The targeted area was modified during collection. Please try again." );
				return;
			}
			finally
			{
				eable.Free();
			}

			if( items.Count > 0 )
			{
				m.BeginTarget( 12, true, TargetFlags.None, new TargetStateCallback( originTarget_callback ), new object[] { filename, items } );
				m.SendMessage( "Select the point of origin." );
			}
			else
			{
				m.SendMessage( "No items were found in the targeted area." );
			}
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:48,代码来源:GenMulti.cs

示例7: DoWipe

		public static void DoWipe( Mobile from, Map map, Point3D start, Point3D end, WipeType type )
		{
			CommandLogging.WriteLine( from, "{0} {1} wiping from {2} to {3} in {5} ({4})", from.AccessLevel, CommandLogging.Format( from ), start, end, type, map );

			bool mobiles = ( (type & WipeType.Mobiles) != 0 );
			bool multis = ( (type & WipeType.Multis) != 0 );
			bool items = ( (type & WipeType.Items) != 0 );

			List<IEntity> toDelete = new List<IEntity>();

			Rectangle2D rect = new Rectangle2D( start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1 );

			IPooledEnumerable eable;

			if ( (items || multis) && mobiles )
				eable = map.GetObjectsInBounds( rect );
			else if ( items || multis )
				eable = map.GetItemsInBounds( rect );
			else if ( mobiles )
				eable = map.GetMobilesInBounds( rect );
			else
				return;

			foreach ( IEntity obj in eable )
			{
				if ( items && (obj is Item) && ((Item)obj).CommandDelete && !((obj is BaseMulti) || (obj is HouseSign)) )
					toDelete.Add( obj );
				else if ( multis && (obj is BaseMulti) )
					toDelete.Add( obj );
				else if ( mobiles && (obj is Mobile) && !((Mobile)obj).Player )
					toDelete.Add( obj );
			}

			eable.Free();

			foreach (IEntity d in toDelete)
				d.Delete();
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:38,代码来源:Wipe.cs

示例8: InvBox_Callback

		private static void InvBox_Callback(Mobile from, Map map, Point3D start, Point3D end, object state)
		{

			LogHelper Logger = new LogHelper("inventory.log", true);

			Logger.Log(LogType.Text, string.Format("{0}\t{1,-25}\t{7,-25}\t{2,-25}\t{3,-20}\t{4,-20}\t{5,-20}\t{6,-20}",
				"Qty ---",
				"Item ------------",
				"Damage / Protection --",
				"Durability -----",
				"Accuracy -----",
				"Exceptional",
				"Slayer ----",
				"Serial ----"));

			// Create rec and retrieve items within from bounding box callback
			// result
			Rectangle2D rect = new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1);
			IPooledEnumerable eable = map.GetItemsInBounds(rect);

			// Loop through and add objects returned
			foreach (object obj in eable)
			{

				if (m_ItemType == null || obj is BaseContainer)
					AddInv(obj);
				else
				{
					Type ot = obj.GetType();

					if (ot.IsSubclassOf(m_ItemType) || ot == m_ItemType)
						AddInv(obj);
				}
			}

			eable.Free();

			m_Inv.Sort();	// Sort results

			// Loop and log
			foreach (InvItem ir in m_Inv)
			{
				// ir.m_description += String.Format(" ({0})", it.Serial.ToString());
				string output = string.Format("{0}\t{1,-25}\t{7,-25}\t{2,-25}\t{3,-20}\t{4,-20}\t{5,-20}\t{6,-20}",
					ir.m_count + ",",
					(ir.GetDescription()) + ",",
					(ir.m_damage != null ? ir.m_damage : "N/A") + ",",
					(ir.m_durability != null ? ir.m_durability : "N/A") + ",",
					(ir.m_accuracy != null ? ir.m_accuracy : "N/A") + ",",
					(ir.m_quality != null ? ir.m_quality : "N/A") + ",",
					(ir.m_slayer != null ? ir.m_slayer : "N/A") + ",",
					ir.m_serial.ToString()
					);

				Logger.Log(LogType.Text, output);

				if (m_verbose)
				{
					output = string.Format("{0}{1}{7}{2}{3}{4}{5}{6}",
						ir.m_count + ",",
						(ir.GetDescription()) + ",",
						(ir.m_damage != null ? ir.m_damage : "N/A") + ",",
						(ir.m_durability != null ? ir.m_durability : "N/A") + ",",
						(ir.m_accuracy != null ? ir.m_accuracy : "N/A") + ",",
						(ir.m_quality != null ? ir.m_quality : "N/A") + ",",
						(ir.m_slayer != null ? ir.m_slayer : "N/A") + ",",
						ir.m_serial.ToString()
						);

					from.SendMessage(output);
				}
			}

			Logger.Count--; // count-1 for header
			Logger.Finish();
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:76,代码来源:Inventory.cs

示例9: PickerCallback

		private static void PickerCallback( Mobile from, Map map, Point3D start, Point3D end, object state )
		{
			object[] args = state as object[];

			if( start.X > end.X )
			{
				int x = start.X;
				start.X = end.X;
				end.X = x;
			}

			if( start.Y > end.Y )
			{
				int y = start.Y;
				start.Y = end.Y;
				end.Y = y;
			}

			Rectangle2D bounds = new Rectangle2D( start, end );

			string name = args[0] as string;
			string ns = args[1] as string;

			bool items = (bool)args[2];
			bool statics = (bool)args[3];
			bool range = (bool)args[4];

			sbyte min = sbyte.MinValue;
			sbyte max = sbyte.MaxValue;

			try { min = sbyte.Parse( args[5] as string ); }
			catch { }
			try { max = sbyte.Parse( args[6] as string ); }
			catch { }

			if( max < min )
			{
				sbyte temp = max;
				max = min;
				min = temp;
			}

			Dictionary<Point2D, List<StaticTile>> tiles = new Dictionary<Point2D, List<StaticTile>>();

			if( statics )
			{
				for( int x = start.X; x <= end.X; x++ )
				{
					for( int y = start.Y; y <= end.Y; y++ )
					{
						StaticTile[] tileArray = map.Tiles.GetStaticTiles( x, y, items );
						List<StaticTile> list = new List<StaticTile>( tileArray );

						if( range )
						{
							ArrayList remove = new ArrayList();

							foreach( StaticTile t in list )
							{
								if( t.Z < min || t.Z > max )
									remove.Add( t );
							}

							foreach( StaticTile t in remove )
								list.Remove( t );
						}

						if( list != null && list.Count > 0 )
						{
							tiles[new Point2D( x, y )] = list;
						}
					}
				}
			}

			IPooledEnumerable en = map.GetItemsInBounds( bounds );
			ArrayList target = new ArrayList();
			bool fail = false;

			try
			{
				foreach( object o in en )
				{
					Static s = o as Static;

					if( s == null )
						continue;

					if( range && (s.Z < min || s.Z > max) )
						continue;

					target.Add( o );
				}
			}
			catch( Exception err )
			{
				Console.WriteLine( err.ToString() );
				from.SendMessage( 0x40, "The targeted items have been modified. Please retry." );
				fail = true;
			}
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:hubroot,代码行数:101,代码来源:AddonGenerator.cs

示例10: CanFit

        public bool CanFit(Point3D p, Map map, int itemID)
        {
            if (map == null || map == Map.Internal || Deleted || CheckDecay())
                return false;

            MultiComponentList newComponents = MultiData.GetComponents(itemID);

            if (RequiresWater)
            {
                for (int x = 0; x < newComponents.Width; ++x)
                {
                    for (int y = 0; y < newComponents.Height; ++y)
                    {
                        int tx = p.X + newComponents.Min.X + x;
                        int ty = p.Y + newComponents.Min.Y + y;

                        if (newComponents.Tiles[x][y].Length == 0 || Contains(tx, ty))
                            continue;

                        LandTile landTile = map.Tiles.GetLandTile(tx, ty);
                        StaticTile[] tiles = map.Tiles.GetStaticTiles(tx, ty, true);

                        bool hasWater = false;

                        if (landTile.Z == p.Z && ((landTile.ID >= 168 && landTile.ID <= 171) || (landTile.ID >= 310 && landTile.ID <= 311)))
                            hasWater = true;

                        int z = p.Z;

                        //int landZ = 0, landAvg = 0, landTop = 0;

                        //map.GetAverageZ( tx, ty, ref landZ, ref landAvg, ref landTop );

                        //if ( !landTile.Ignored && top > landZ && landTop > z )
                        //	return false;

                        for (int i = 0; i < tiles.Length; ++i)
                        {
                            StaticTile tile = tiles[i];
                            bool isWater = (tile.ID >= 0x1796 && tile.ID <= 0x17B2);

                            if (tile.Z == p.Z && isWater)
                                hasWater = true;
                            else if (tile.Z >= p.Z && !isWater)
                            {
                                Console.WriteLine("RETURNED FALSE HER1E");
                                return false;
                            }
                        }

                        if (!hasWater)
                        {
                            Console.WriteLine("RETURNED FALSE HE2RE");
                            return false;
                        }
                    }
                }
            }

            List<Corpse> corpsesToGrab = new List<Corpse>();
            List<Item> toDelete = new List<Item>();

            IPooledEnumerable eable = map.GetItemsInBounds(new Rectangle2D(p.X + newComponents.Min.X, p.Y + newComponents.Min.Y, newComponents.Width, newComponents.Height));

            foreach (Item item in eable)
            {
                if (item is BaseMulti || item.ItemID > TileData.MaxItemValue || item.Z < p.Z || !item.Visible)
                    continue;

                int x = item.X - p.X + newComponents.Min.X;
                int y = item.Y - p.Y + newComponents.Min.Y;

                if (x >= 0 && x < newComponents.Width && y >= 0 && y < newComponents.Height && newComponents.Tiles[x][y].Length == 0)
                    continue;
                else if (Contains(item))
                    continue;
                else if (item is Corpse)
                {
                    corpsesToGrab.Add((Corpse)item);
                    continue;
                }
                else if (item is Arrow || item is Bolt)
                {
                    toDelete.Add(item);
                    continue;
                }

                eable.Free();
                return false;
            }

            eable.Free();

            foreach (Corpse corpse in corpsesToGrab)
            {
                corpse.MoveToWorld(new Point3D(Location.X + MarkOffset.X, Location.Y + MarkOffset.Y, Location.Z + MarkOffset.Z), Map);
            }
            foreach (Item item in toDelete)
            {
                item.Delete();
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:101,代码来源:BaseBoat.cs

示例11: BoxPickerCallback

		private static void BoxPickerCallback( Mobile from, Map map, Point3D start, Point3D end, object state )
		{
			object[] args = state as object[];

			if( args == null || args.Length != 4 )
				return;

			if( start.X > end.X )
			{
				int x = start.X;
				start.X = end.X;
				end.X = x;
			}

			if( start.Y > end.Y )
			{
				int y = start.Y;
				start.Y = end.Y;
				end.Y = y;
			}

			IPooledEnumerable eable = map.GetItemsInBounds( new Rectangle2D( start.X, start.Y, ((end.X - start.X) + 1), ((end.Y - start.Y) + 1) ) );
			List<Static> selection = new List<Static>();
			bool fail = false;
			int startID = (int)args[0];
			int endID = (int)args[1];
			int zLevel = (int)args[2];
			bool includeWalls = (bool)args[3];

			if( startID > endID )
			{
				int temp = startID;
				startID = endID;
				endID = startID;
			}

			try
			{
				foreach( object o in eable )
				{
					if( o is Static )
					{
						Static st = o as Static;

						if( st.Z != zLevel )
							continue;
						else if( !includeWalls && !IsFlooring( st.ItemID ) )
							continue;

						selection.Add( st );
					}
				}
			}
			catch( Exception e )
			{
				Server.Utilities.ExceptionManager.LogException( "RandomizeCommand.cs", e );
				from.SendMessage( "The targeted items were modified during assembly. Please try again." );
				fail = true;
			}
			finally
			{
				eable.Free();
			}

			if( fail )
				return;

			#region Random list creation
			List<int> list = new List<int>();

			while( startID <= endID )
			{
				int i = startID;
				list.Add( i );

				startID++;
			}

			int[] IDlist = new int[list.Count];

			for( int i = 0; i < IDlist.Length; i++ )
			{
				IDlist[i] = list[i];
			}

			list.Clear();
			#endregion

			int count = 0;

			for( int i = 0; i < selection.Count; i++ )
			{
				selection[i].ItemID = Utility.RandomList( IDlist );
				count++;
			}

			from.SendMessage( "Randomization complete: {0} tiles were processed.", count );
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:98,代码来源:RandomizeCommand.cs

示例12: CanFit

        public bool CanFit( Point3D p, Map map, int itemID )
        {
            if ( map == null || map == Map.Internal || Deleted || CheckDecay() )
                return false;

            MultiComponentList newComponents = MultiData.GetComponents( itemID );

            for ( int x = 0; x < newComponents.Width; ++x )
            {
                for ( int y = 0; y < newComponents.Height; ++y )
                {
                    int tx = p.X + newComponents.Min.X + x;
                    int ty = p.Y + newComponents.Min.Y + y;

                    if ( newComponents.Tiles[x][y].Length == 0 || Contains( tx, ty ) )
                        continue;

                    LandTile landTile = map.Tiles.GetLandTile( tx, ty );

                    bool hasWater = false;

                    if ( landTile.Z == p.Z && ((landTile.ID >= 168 && landTile.ID <= 171) || (landTile.ID >= 310 && landTile.ID <= 311)) )
                        hasWater = true;

                    int z = p.Z;

                    StaticTile[] tiles = map.Tiles.GetStaticTiles( tx, ty, true );

                    //int landZ = 0, landAvg = 0, landTop = 0;

                    //map.GetAverageZ( tx, ty, ref landZ, ref landAvg, ref landTop );

                    //if ( !landTile.Ignored && top > landZ && landTop > z )
                    //	return false;

                    for ( int i = 0; i < tiles.Length; ++i )
                    {
                        StaticTile tile = tiles[i];
                        bool isWater = ( tile.ID >= 0x1796 && tile.ID <= 0x17B2 );

                        if ( tile.Z == p.Z && isWater )
                            hasWater = true;
                        else if ( tile.Z >= p.Z && !isWater )
                            return false;
                    }

                    if ( !hasWater )
                        return false;
                }
            }

            IPooledEnumerable eable = map.GetItemsInBounds( new Rectangle2D( p.X + newComponents.Min.X, p.Y + newComponents.Min.Y, newComponents.Width, newComponents.Height ) );

            foreach ( Item item in eable )
            {
                if ( item is BaseMulti || item.ItemID > TileData.MaxItemValue || item.Z < p.Z || !item.Visible )
                    continue;

                int x = item.X - p.X + newComponents.Min.X;
                int y = item.Y - p.Y + newComponents.Min.Y;

                Plank plank = item as Plank;
                int plankx = 0;
                int planky = 0;
                bool checkplank = false;

                if ( plank != null )
                {
                    plankx = plank.X;
                    planky = plank.Y;
                }

                //east, west, north, south
                if ( plank != null && plank.ItemID == 16084 )
                {
                    plankx += 1;
                    checkplank = true;
                }
                else if ( plank != null && plank.ItemID == 16085 )
                {
                    plankx -= 1;
                    checkplank = true;
                }
                else if ( plank != null && plank.ItemID == 16009 )
                {
                    planky -= 1;
                    checkplank = true;
                }
                else if ( plank != null && plank.ItemID == 16004 )
                {
                    planky += 1;
                    checkplank = true;
                }

                if ( plank != null && checkplank )
                {
                    StaticTile[] tiles = map.Tiles.GetStaticTiles( plankx, planky, true );

                    for ( int i = 0; i < tiles.Length; ++i )
                    {
//.........这里部分代码省略.........
开发者ID:Ravenwolfe,项目名称:Origins,代码行数:101,代码来源:BaseBoat.cs

示例13: ValidateVinyardPlot

        public static bool ValidateVinyardPlot(Map map, int x, int y)
        {
            bool ground = false;

            IPooledEnumerable eable = map.GetItemsInBounds(new Rectangle2D(x, y, 1, 1));
            foreach (Item item in eable)
            {
                if (item.ItemID == 0x32C9 || item.ItemID == 0x31F4)
                    ground = true;
            }
            eable.Free();

            if (!ground)
            {
                StaticTile[] tiles = map.Tiles.GetStaticTiles(x, y);
                for (int i = 0; i < tiles.Length; ++i)
                {
                    if ((tiles[i].ID & 0x3FFF) == 0x32C9 || (tiles[i].ID & 0x3FFF) == 0x31F4)
                        ground = true;
                }
            }

            return ground;
        }
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:24,代码来源:VinePlacement.cs

示例14: CanFit

        public bool CanFit( Point3D p, Map map, int itemID )
        {
            if ( map == null || map == Map.Internal || Deleted || CheckDecay() )
                return false;

            MultiComponentList newComponents = MultiData.GetComponents( itemID );

            for ( int x = 0; x < newComponents.Width; ++x )
            {
                for ( int y = 0; y < newComponents.Height; ++y )
                {
                    int tx = p.X + newComponents.Min.X + x;
                    int ty = p.Y + newComponents.Min.Y + y;

                    if ( newComponents.Tiles[x][y].Length == 0 || Contains( tx, ty ) )
                        continue;

                    Tile landTile = map.Tiles.GetLandTile( tx, ty );
                    Tile[] tiles = map.Tiles.GetStaticTiles( tx, ty, true );

                    bool hasWater = false;

                    if ( landTile.Z == p.Z && ( ( landTile.ID >= 168 && landTile.ID <= 171 ) || ( landTile.ID >= 310 && landTile.ID <= 311 ) ) )
                        hasWater = true;

                    for ( int i = 0; i < tiles.Length; ++i )
                    {
                        Tile tile = tiles[i];
                        bool isWater = ( tile.ID >= 0x1796 && tile.ID <= 0x17B2 );

                        if ( tile.Z == p.Z && isWater )
                            hasWater = true;
                        else if ( tile.Z >= p.Z && !isWater )
                            return false;
                    }

                    if ( !hasWater )
                        return false;
                }
            }

            var eable = map.GetItemsInBounds( new Rectangle2D( p.X + newComponents.Min.X, p.Y + newComponents.Min.Y, newComponents.Width, newComponents.Height ) );

            foreach ( Item item in eable )
            {
                if ( item is BaseMulti || item.ItemID > TileData.MaxItemValue || item.Z < p.Z || !item.Visible )
                    continue;

                int x = item.X - p.X + newComponents.Min.X;
                int y = item.Y - p.Y + newComponents.Min.Y;

                if ( x >= 0 && x < newComponents.Width && y >= 0 && y < newComponents.Height && newComponents.Tiles[x][y].Length == 0 )
                    continue;
                else if ( Contains( item ) )
                    continue;

                return false;
            }

            return true;
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:61,代码来源:BaseBoat.cs

示例15: PickerCallback


//.........这里部分代码省略.........
			if (statics)
			{
				for (int x = start.X; x <= end.X; x++)
				{
					for (int y = start.Y; y <= end.Y; y++)
					{
						ArrayList list = map.GetTilesAt(new Point2D(x, y), items, land, statics);

						if (range)
						{
							ArrayList remove = new ArrayList();

							foreach (Tile t in list)
							{
								if (t.Z < min || t.Z > max)
									remove.Add(t);
							}

							foreach (Tile t in remove)
								list.Remove(t);
						}

						if (list != null && list.Count > 0)
						{
							tiles[new Point2D(x, y)] = list;
						}
					}
				}
			}

			// we increase the bounds by one here to match the way we scan for static above, that is: including end.X and end.Y
			//	the end.X and end.Y allows us to pick up things on the steps, and the house sign hanger
			Rectangle2D iBounds = new Rectangle2D(bounds.X, bounds.Y, bounds.Width + 1, bounds.Height + 1);
			IPooledEnumerable en = map.GetItemsInBounds(iBounds);
			ArrayList target = new ArrayList();
			bool foundSign = false;

			// info pulled from captured house  
			DateTime BuiltOn = DateTime.MaxValue;
			string OriginalOwnerName = "(unknown)";
			string OriginalOwnerAccount = "(unknown)";
			Serial OriginalOwnerSerial = Serial.MinusOne;
			Point3D SignLocation = Point3D.Zero;	// not used
			int SignHangerGraphic = 0xB98;			// default
			int SignpostGraphic = 0x09;				// default

			try
			{
				// (x == end.X || y == end.Y) will be steps or other deco outside the plot
				// see below where we output statics and set TileType 'flags'
				foreach (object o in en)
				{

					// remove all doors
					if (o is BaseDoor)
					{
						from.SendMessage(0x40, "Progress: removing door.");
						continue;
					}

					// Remove SignHanger from the outside of a Custom House
					//	we look for it at a particular location
					if (raw == false && houseInRect != null && houseInRect is HouseFoundation == true)
						if (IsSignHanger(o) && (o as Item).Y == bounds.Y + bounds.Height)
						{
							from.SendMessage(0x40, "Progress: removing sign hanger.");
开发者ID:zerodowned,项目名称:angelisland,代码行数:67,代码来源:HouseGen.cs


注:本文中的Server.Map.GetItemsInBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。