當前位置: 首頁>>代碼示例>>C#>>正文


C# Map.GetItemsInRange方法代碼示例

本文整理匯總了C#中Server.Map.GetItemsInRange方法的典型用法代碼示例。如果您正苦於以下問題:C# Map.GetItemsInRange方法的具體用法?C# Map.GetItemsInRange怎麽用?C# Map.GetItemsInRange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.Map的用法示例。


在下文中一共展示了Map.GetItemsInRange方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DeleteMoonGate

		private static int DeleteMoonGate(Map map, Point3D p)
		{
			Queue<Item> m_Queue = new Queue<Item>();

			IPooledEnumerable eable = map.GetItemsInRange(p, 0);

			foreach (Item item in eable)
			{
				if (item is PublicMoongate)
				{
					int delta = item.Z - p.Z;

					if (delta >= -12 && delta <= 12)
						m_Queue.Enqueue(item);
				}
			}

			eable.Free();

			int m_Count = m_Queue.Count;

			while (m_Queue.Count > 0)
				(m_Queue.Dequeue()).Delete();

			return m_Count;
		}
開發者ID:romeov007,項目名稱:imagine-uo,代碼行數:26,代碼來源:MoonGenDelete.cs

示例2: Add_Static

        public static void Add_Static( int itemID, Point3D location, Map map, string name )
        {
            var eable = map.GetItemsInRange( location, 0 );

            foreach ( Item item in eable )
            {
                if ( item is Sign && item.Z == location.Z && item.ItemID == itemID )
                    m_ToDelete.Enqueue( item );
            }

            while ( m_ToDelete.Count > 0 )
                ( (Item) m_ToDelete.Dequeue() ).Delete();

            Item sign;

            if ( name.StartsWith( "#" ) )
            {
                sign = new LocalizedSign( itemID, Utility.ToInt32( name.Substring( 1 ) ) );
            }
            else
            {
                sign = new Sign( itemID );
                sign.Name = name;
            }

            if ( map == Map.Malas )
            {
                if ( location.X >= 965 && location.Y >= 502 && location.X <= 1012 && location.Y <= 537 )
                    sign.Hue = 0x47E;
                else if ( location.X >= 1960 && location.Y >= 1278 && location.X < 2106 && location.Y < 1413 )
                    sign.Hue = 0x44E;
            }

            sign.MoveToWorld( location, map );
        }
開發者ID:Ravenwolfe,項目名稱:xrunuo,代碼行數:35,代碼來源:SignParser.cs

示例3: CheckItems

        private static bool CheckItems( Point3D loc, Map map, int range, int maxAmount, bool checkTraps )
        {
            var eable = map.GetItemsInRange( loc, range );
            int amount = 0;

            foreach ( Item item in eable )
            {
                if ( !checkTraps || item is FloorTrap )
                    amount++;
            }

            return amount < maxAmount;
        }
開發者ID:Ravenwolfe,項目名稱:xrunuo,代碼行數:13,代碼來源:FloorTrapKit.cs

示例4: CheckPlantSeed

		public virtual bool CheckPlantSeed( Point3D location, Map map, int range )
		{
			IPooledEnumerable eable = map.GetItemsInRange( location, range );
			int cropCount = 0;

			foreach( Item i in eable )
			{
				if( i is BaseCrop )
					cropCount++;
			}

			eable.Free();

			return (cropCount == 0);
		}
開發者ID:greeduomacro,項目名稱:hubroot,代碼行數:15,代碼來源:BaseCropSeed.cs

示例5: ClearSpawners

			public static void ClearSpawners( int x, int y, int z, Map map )
			{
				IPooledEnumerable eable = map.GetItemsInRange( new Point3D( x, y, z ), 0 );

				foreach ( Item item in eable )
				{
					if ( item is Spawner && item.Z == z )
						m_ToDelete.Enqueue( item );
				}

				eable.Free();

				while ( m_ToDelete.Count > 0 )
					((Item)m_ToDelete.Dequeue()).Delete();
			}
開發者ID:greeduomacro,項目名稱:cov-shard-svn-1,代碼行數:15,代碼來源:GenerateOFQ.cs

示例6: FindMarkContainer

		private static bool FindMarkContainer( Point3D p, Map map )
		{
			IPooledEnumerable eable = map.GetItemsInRange( p, 0 );

			foreach ( Item item in eable )
			{
				if ( item.Z == p.Z && item is MarkContainer )
				{
					eable.Free();
					return true;
				}
			}

			eable.Free();
			return false;
		}
開發者ID:jackuoll,項目名稱:Pre-AOS-RunUO,代碼行數:16,代碼來源:MarkContainer.cs

示例7: FindSHTeleporter

			public static SHTeleporter FindSHTeleporter(Map map, Point3D p)
			{
				IPooledEnumerable eable = map.GetItemsInRange(p, 0);

				foreach (Item item in eable)
				{
					if (item is SHTeleporter && item.Z == p.Z)
					{
						eable.Free();
						return (SHTeleporter)item;
					}
				}

				eable.Free();
				return null;
			}
開發者ID:romeov007,項目名稱:imagine-uo,代碼行數:16,代碼來源:SHTelGenDelete.cs

示例8: FindTeleporter

			public static bool FindTeleporter( Map map, Point3D p )
			{
				IPooledEnumerable eable = map.GetItemsInRange( p, 0 );

				foreach ( Item item in eable )
				{
					if ( item is Teleporter && !(item is KeywordTeleporter) && !(item is SkillTeleporter) )
					{
						int delta = item.Z - p.Z;

						if ( delta >= -12 && delta <= 12 )
							m_Queue.Enqueue( item );
					}
				}

				eable.Free();

				while ( m_Queue.Count > 0 )
					((Item)m_Queue.Dequeue()).Delete();

				return false;
			}
開發者ID:svvota,項目名稱:runuo,代碼行數:22,代碼來源:GenTeleporter.cs

示例9: FindItem

        public static bool FindItem(Point3D p, Map map, Item test)
        {
            bool result = false;

            IPooledEnumerable eable = map.GetItemsInRange(p);

            foreach (Item item in eable)
            {
                if (item.Z == p.Z && item.ItemID == test.ItemID)
                {
                    m_DeleteQueue.Enqueue(item);
                    result = true;
                }
            }

            eable.Free();

            while (m_DeleteQueue.Count > 0)
                m_DeleteQueue.Dequeue().Delete();

            return result;
        }
開發者ID:greeduomacro,項目名稱:cov-shard-svn-1,代碼行數:22,代碼來源:Decorate+Magincia.cs

示例10: MakeUniqueSpawner

		//looks at the location provided for a spawner, and returns it if it exists, otherwise makes a new one
		public static Spawner MakeUniqueSpawner( Point3D location, Map map )
		{
			IPooledEnumerable ie = map.GetItemsInRange( location, 0 );
				
			Spawner spawner = null;
			
			foreach( Item item in ie )
			{
				if( item is Spawner )
				{
					spawner = (Spawner)item;
					break;
				}
			}
			
			if( spawner == null )
			{
				spawner = new Spawner();
				spawner.MoveToWorld( location, map );
			}
			
			return spawner;
		}
開發者ID:greeduomacro,項目名稱:annox,代碼行數:24,代碼來源:SpawnHelper.cs

示例11: CheckForAltar

        public static bool CheckForAltar(Point3D p, Map map)
        {
            IPooledEnumerable eable = map.GetItemsInRange(p, 0);

            foreach (Item i in eable)
            {
                if (i is ShameAltar || i is ShameWall)
                {
                    eable.Free();
                    return true;
                }
            }
            eable.Free();

            return false;
        }
開發者ID:Crome696,項目名稱:ServUO,代碼行數:16,代碼來源:Generate.cs

示例12: Del_Static

		public static void Del_Static( int itemID, Point3D location, Map map )
		{
			IPooledEnumerable eable = map.GetItemsInRange( location, 0 );
			
			foreach ( Item item in eable )
			{
				if ( item is Sign && item.Z == location.Z && item.ItemID == itemID )
				{
					m_ToDelete.Enqueue( item );
					m_DelCount++;
				}
			}

			eable.Free();

			while ( m_ToDelete.Count > 0 )
				m_ToDelete.Dequeue().Delete();
		}
開發者ID:ITLongwell,項目名稱:runuo-nerun-distro,代碼行數:18,代碼來源:Signalise.cs

示例13: IsValidLocation

        public virtual int IsValidLocation( Point3D p, Map m )
        {
            if( m == null )
                return 502956; // You cannot place a trap on that.

            if( Core.AOS )
            {
                foreach( Item item in m.GetItemsInRange( p, 5 ) )
                {
                    if( item is BaseFactionTrap && ((BaseFactionTrap)item).Faction == this.Faction )
                        return 1075263; // There is already a trap belonging to your faction at this location.;
                }
            }

            switch( AllowedPlacing )
            {
                case AllowedPlacing.FactionStronghold:
                {
                    StrongholdRegion region = (StrongholdRegion) Region.Find( p, m ).GetRegion( typeof( StrongholdRegion ) );

                    if ( region != null && region.Faction == m_Faction )
                        return 0;

                    return 1010355; // This trap can only be placed in your stronghold
                }
                case AllowedPlacing.AnyFactionTown:
                {
                    Town town = Town.FromRegion( Region.Find( p, m ) );

                    if ( town != null )
                        return 0;

                    return 1010356; // This trap can only be placed in a faction town
                }
                case AllowedPlacing.ControlledFactionTown:
                {
                    Town town = Town.FromRegion( Region.Find( p, m ) );

                    if ( town != null && town.Owner == m_Faction )
                        return 0;

                    return 1010357; // This trap can only be placed in a town your faction controls
                }
            }

            return 0;
        }
開發者ID:kamronbatman,項目名稱:Defiance-AOS-Pre-2012,代碼行數:47,代碼來源:BaseFactionTrap.cs

示例14: RemoveItem

        public static bool RemoveItem(Point3D p, Map map, Type t)
        {
            IPooledEnumerable eable = map.GetItemsInRange(p, 0);

            foreach (Item i in eable)
            {
                if (i.GetType() == t)
                {
                    i.Delete();
                    eable.Free();
                    return true;
                }
            }
            eable.Free();
            return false;
        }
開發者ID:Crome696,項目名稱:ServUO,代碼行數:16,代碼來源:Generate.cs

示例15: FindItem

        public static bool FindItem(Point3D p, Map map, Item test)
        {
            IPooledEnumerable eable = map.GetItemsInRange(p);

            foreach (Item item in eable)
            {
                if (item.Z == p.Z && item.ItemID == test.ItemID)
                {
                    eable.Free();
                    return true;
                }
            }

            eable.Free();
            return false;
        }
開發者ID:aj9251,項目名稱:ServUO,代碼行數:16,代碼來源:MondainsLegacy.cs


注:本文中的Server.Map.GetItemsInRange方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。