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


C# Map.GetItemsInRange方法代码示例

本文整理汇总了C#中Map.GetItemsInRange方法的典型用法代码示例。如果您正苦于以下问题:C# Map.GetItemsInRange方法的具体用法?C# Map.GetItemsInRange怎么用?C# Map.GetItemsInRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在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:FeehTuffani,项目名称:ServUO,代码行数:26,代码来源:MoonGenDelete.cs

示例2: CheckExistance

		private static bool CheckExistance( Point3D loc, Map facet, Type type )
		{
			foreach ( Item item in facet.GetItemsInRange( loc, 0 ) )
				if ( type.IsAssignableFrom( item.GetType() ) )
					return true;

			return false;
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:8,代码来源:Generator.cs

示例3: 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:greeduomacro,项目名称:last-wish,代码行数:16,代码来源:MarkContainer.cs

示例4: 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:m309,项目名称:ForkUO,代码行数:16,代码来源:SHTelGenDelete.cs

示例5: GateExistsAt

		private bool GateExistsAt(Map map, Point3D loc )
		{
			bool _gateFound = false;

			IPooledEnumerable eable = map.GetItemsInRange( loc, 0 );
			foreach ( Item item in eable )
			{
				if ( item is Moongate || item is PublicMoongate )
				{
					_gateFound = true;
					break;
				}
			}
			eable.Free();

			return _gateFound;
		}
开发者ID:jsrn,项目名称:MidnightWatchServer,代码行数:17,代码来源:GateTravel.cs

示例6: 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:FreeReign,项目名称:forkuo,代码行数:22,代码来源:GenTeleporter.cs

示例7: IsValidLocation

		private static bool IsValidLocation( Point3D location, Map map )
		{
			Tile lt = map.Tiles.GetLandTile( location.X, location.Y );         // Land   Tiles            

			if( IsValidTile( lt.ID ) && lt.Z == location.Z )
				return true;

			Tile[] tiles = map.Tiles.GetStaticTiles( location.X, location.Y ); // Static Tiles

			for( int i = 0; i < tiles.Length; ++i )
			{
				Tile t = tiles[i];
				ItemData id = TileData.ItemTable[t.ID & 0x3FFF];

				int tand = t.ID & 0x3FFF;

				if( t.Z != location.Z )
					continue;
				else if( IsValidTile( tand ) )
					return true;
			}

			IPooledEnumerable eable = map.GetItemsInRange( location, 0 );      // Added  Tiles

			foreach( Item item in eable )
			{
				if( item == null || item.Z != location.Z )
					continue;
				else if( IsValidTile( item.ItemID ) )
				{
					eable.Free();
					return true;
				}
			}

			eable.Free();
			return false;
		}
开发者ID:brodock,项目名称:genova-project,代码行数:38,代码来源:ArcaneCircle.cs

示例8: Add_Static

        public static void Add_Static(int itemID, Point3D location, Map map, string name)
        {
            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);
            }

            eable.Free();

            while (m_ToDelete.Count > 0)
                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:FreeReign,项目名称:forkuo,代码行数:37,代码来源:SignParser.cs

示例9: DestroyTeleporter

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

                foreach (Item item in eable)
                {
                    if (item is Teleporter && !(item is KeywordTeleporter) && !(item is SkillTeleporter) && item.Z == p.Z)
                        m_Queue.Enqueue(item);
                }

                eable.Free();

                while (m_Queue.Count > 0)
                    ((Item)m_Queue.Dequeue()).Delete();
            }
开发者ID:FreeReign,项目名称:forkuo,代码行数:16,代码来源:GenTeleporter.cs

示例10: IsValidLocation

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

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

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

                        if (region != null && region.Faction == this.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 == this.m_Faction)
                            return 0;

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

            return 0;
        }
开发者ID:m309,项目名称:ForkUO,代码行数:47,代码来源:BaseFactionTrap.cs

示例11: FindItemDelete

        private static bool FindItemDelete(int x, int y, int z, Map map, Item srcItem)
        {
            int itemID = srcItem.ItemID;

            bool res = false;

            IPooledEnumerable eable;

            if (srcItem is BaseDoor)
            {
                eable = map.GetItemsInRange(new Point3D(x, y, z), 1);

                foreach (Item item in eable)
                {
                    if (!(item is BaseDoor))
                        continue;

                    BaseDoor bd = (BaseDoor)item;
                    Point3D p;
                    int bdItemID;

                    if (bd.Open)
                    {
                        p = new Point3D(bd.X - bd.Offset.X, bd.Y - bd.Offset.Y, bd.Z - bd.Offset.Z);
                        bdItemID = bd.ClosedID;
                    }
                    else
                    {
                        p = bd.Location;
                        bdItemID = bd.ItemID;
                    }

                    if (p.X != x || p.Y != y)
                        continue;

                    if (item.Z == z && bdItemID == itemID)
                    {
                        m_DeleteQueue.Enqueue(item);
                        res = true;
                    }
                    /*else if (Math.Abs(item.Z - z) < 8)
                    m_DeleteQueue.Enqueue(item);*/
                }
            }
            else if ((TileData.ItemTable[itemID & 0x3FFF].Flags & TileFlag.LightSource) != 0)
            {
                eable = map.GetItemsInRange(new Point3D(x, y, z), 0);

                LightType lt = srcItem.Light;
                string srcName = srcItem.ItemData.Name;

                foreach (Item item in eable)
                {
                    if (item.Z == z)
                    {
                        if (item.ItemID == itemID)
                        {
                            /*if ( item.Light != lt )
                            m_DeleteQueue.Enqueue( item );
                            else*/
                            res = true;
                            m_DeleteQueue.Enqueue(item);
                        }
                        else if ((item.ItemData.Flags & TileFlag.LightSource) != 0 && item.ItemData.Name == srcName)
                        {
                            //m_DeleteQueue.Enqueue( item );
                        }
                    }
                }
            }
            else if (srcItem is Teleporter || srcItem is FillableContainer || srcItem is BaseBook)
            {
                eable = map.GetItemsInRange(new Point3D(x, y, z), 0);

                Type type = srcItem.GetType();

                foreach (Item item in eable)
                {
                    if (item.Z == z && item.ItemID == itemID)
                    {
                        if (item.GetType() != type)
                        {
                            //m_DeleteQueue.Enqueue(item);
                        }
                        else
                        {
                            m_DeleteQueue.Enqueue(item);
                            res = true;
                        }
                    }
                }
            }
            else
            {
                eable = map.GetItemsInRange(new Point3D(x, y, z), 0);

                foreach (Item item in eable)
                {
                    if (item.Z == z && item.ItemID == itemID)
                    {
//.........这里部分代码省略.........
开发者ID:aj9251,项目名称:ServUO,代码行数:101,代码来源:DecorateDelete.cs

示例12: 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:aj9251,项目名称:ServUO,代码行数:22,代码来源:DecorateDelete.cs

示例13: GETNEARBYITEMS

			public static ArrayList GETNEARBYITEMS(TriggerObject trigObject, IPoint3D from, int range, Map map)
			{
				if (from == null || map == null)
				{
					return new ArrayList();
				}

				var enumerator = map.GetItemsInRange(new Point3D(from), range);

				ArrayList output = new ArrayList(50);

				foreach (Item nearby in enumerator)
				{
					output.Add(nearby);
				}

				enumerator.Free();
				return output;
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:19,代码来源:UberScriptFunctions.cs

示例14: FindGoldLocation

			private static Point3D FindGoldLocation(Map map, Point3D center, int range)
			{
				int cx = center.X;
				int cy = center.Y;

				for (int i = 0; i < 20; ++i)
				{
					int x = cx + Utility.Random(range * 2) - range;
					int y = cy + Utility.Random(range * 2) - range;
					if ((cx - x) * (cx - x) + (cy - y) * (cy - y) > range * range)
						continue;

					int z = map.GetAverageZ(x, y);
					if (!map.CanFit(x, y, z, 6, false, false))
						continue;

					int topZ = z;
					foreach (Item item in map.GetItemsInRange(new Point3D(x, y, z), 0))
					{
						topZ = Math.Max(topZ, item.Z + item.ItemData.CalcHeight);
					}
					return new Point3D(x, y, topZ);
				}
				return center;
			}
开发者ID:Crome696,项目名称:ServUO,代码行数:25,代码来源:GoldShower.cs

示例15: IsValidLocation

        private static bool IsValidLocation( Point3D location, Map map, out int tile )
        {
            Tile lt = map.Tiles.GetLandTile( location.X, location.Y ); // Land Tiles

            if ( IsValidTile( lt.ID ) && Math.Abs( lt.Z - location.Z ) <= 1 )
            {
                tile = lt.ID;
                return true;
            }

            Tile[] tiles = map.Tiles.GetStaticTiles( location.X, location.Y ); // Static Tiles

            for ( int i = 0; i < tiles.Length; ++i )
            {
                Tile t = tiles[i];

                int tand = t.ID & TileData.MaxItemValue;

                if ( Math.Abs( t.Z - location.Z ) > 1 )
                    continue;
                else if ( IsValidTile( tand ) )
                {
                    tile = tand;
                    return true;
                }
            }

            var eable = map.GetItemsInRange( location, 0 );

            foreach ( Item item in eable )
            {
                if ( item == null || Math.Abs( item.Z - location.Z ) > 1 )
                {
                    continue;
                }
                else if ( IsValidTile( item.ItemID ) )
                {
                    tile = item.ItemID;
                    return true;
                }
            }

            tile = -1;
            return false;
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:45,代码来源:ArcaneCircleSpell.cs


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