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


C# Map.GetSector方法代碼示例

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


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

示例1: BoundingBox_Callback

		private void BoundingBox_Callback( Mobile from, Map map, Point3D start, Point3D end, object state )
		{
			Utility.FixPoints( ref start, ref end );
			Rectangle2D rect = new Rectangle2D(start, end);

			#region MobileSaver
			from.SendMessage( "Extracting Mobiles" );

			foreach ( Mobile m in map.GetMobilesInBounds( rect ) )
			{
				if ( m != null && m is BaseCreature )
				{
					int saveflag = MobileSaver.GetSaveFlag( m );

					if ( saveflag > 0 )
					{
						DesignItem designItem = new DesignItem();
						designItem.ItemID = (short)0x1;
						designItem.X = m.X;
						designItem.Y = m.Y;
						designItem.Z = m.Z + saveflag;
						designItem.Hue = (short)m.Hue;
					}
				}
			}
			#endregion

			for ( int x = 0; x <= rect.Width; ++x )
			{
				for ( int y = 0; y <= rect.Height; ++y )
				{
					int tileX = rect.Start.X + x;
					int tileY = rect.Start.Y + y;

					Sector sector = map.GetSector( tileX, tileY );

					for ( int i = 0; i < sector.Items.Count; ++i )
					{
						Item item = (Item)sector.Items[i];

						if(_args.UseMinZ && item.Z < _args.MinZ)
							continue;
						else if(_args.UseMaxZ && item.Z > _args.MaxZ)
							continue;

						if ( item.Visible && item.X == tileX && item.Y == tileY && !((item is BaseMulti) || (item is HouseSign)) )
						{
							_itemSerials.Add(item.Serial.Value);
						}
					}
				}
			}

			if(_itemSerials.Count > 0)
				SendResponse(new SelectItemsResponse((int[])_itemSerials.ToArray(typeof(int))));
			else
				SendResponse(null);
		}
開發者ID:greeduomacro,項目名稱:last-wish,代碼行數:58,代碼來源:SelectItemsRequest.cs

示例2: FindBoatAt

		public static BaseBoat FindBoatAt( IPoint2D loc, Map map )
		{
			Sector sector = map.GetSector( loc );

			for ( int i = 0; i < sector.Multis.Count; i++ )
			{
				BaseBoat boat = sector.Multis[i] as BaseBoat;

				if ( boat != null && boat.Contains( loc.X, loc.Y ) )
					return boat;
			}

			return null;
		}
開發者ID:PepeBiondi,項目名稱:runsa,代碼行數:14,代碼來源:BaseBoat.cs

示例3: CheckMulti

		public static bool CheckMulti( Point3D p, Map map, bool houses )
		{
			if( map == null || map == Map.Internal )
				return false;

			Sector sector = map.GetSector( p.X, p.Y );

			for( int i = 0; i < sector.Multis.Count; ++i )
			{
				BaseMulti multi = sector.Multis[i];

				if( multi is BaseHouse )
				{
					if( houses && ((BaseHouse)multi).IsInside( p, 16 ) )
						return true;
				}
				else if( multi.Contains( p ) )
				{
					return true;
				}
			}

			return false;
		}
開發者ID:brodock,項目名稱:genova-project,代碼行數:24,代碼來源:SpellHelper.cs

示例4: BoundingBox_Callback

        private void BoundingBox_Callback( Mobile from, Map map, Point3D start, Point3D end, object state )
        {
            Utility.FixPoints( ref start, ref end );
            Rectangle2D rect = new Rectangle2D(start, end);

            for ( int x = 0; x <= rect.Width; ++x )
            {
                for ( int y = 0; y <= rect.Height; ++y )
                {
                    int tileX = rect.Start.X + x;
                    int tileY = rect.Start.Y + y;

                    Sector sector = map.GetSector( tileX, tileY );

                    for ( int i = 0; i < sector.Items.Count; ++i )
                    {
                        Item item = (Item)sector.Items[i];

                        if(_args.UseMinZ && item.Z < _args.MinZ)
                            continue;
                        else if(_args.UseMaxZ && item.Z > _args.MaxZ)
                            continue;

                        if ( item.Visible && item.X == tileX && item.Y == tileY && !((item is BaseMulti) || (item is HouseSign)) )
                        {
                            _itemSerials.Add(item.Serial.Value);
                        }
                    }
                }
            }

            if(_itemSerials.Count > 0)
                SendResponse(new SelectItemsResponse((int[])_itemSerials.ToArray(typeof(int))));
            else
                SendResponse(null);
        }
開發者ID:cynricthehun,項目名稱:UOLegends,代碼行數:36,代碼來源:SelectItemsRequest.cs

示例5: CheckMovement

		public bool CheckMovement( Mobile m, Map map, Point3D loc, Direction d, out int newZ )
		{
			if ( map == null || map == Map.Internal )
			{
				newZ = 0;
				return false;
			}

			int xStart = loc.X;
			int yStart = loc.Y;
			int xForward = xStart, yForward = yStart;
			int xRight = xStart, yRight = yStart;
			int xLeft = xStart, yLeft = yStart;

			bool checkDiagonals = ((int)d & 0x1) == 0x1;

			Offset( d, ref xForward, ref yForward );
			Offset( (Direction)(((int)d - 1) & 0x7), ref xLeft, ref yLeft );
			Offset( (Direction)(((int)d + 1) & 0x7), ref xRight, ref yRight );

			if ( xForward < 0 || yForward < 0 || xForward >= map.Width || yForward >= map.Height )
			{
				newZ = 0;
				return false;
			}

			int startZ, startTop;

			List<Item> itemsStart = m_Pools[0];
			List<Item> itemsForward = m_Pools[1];
			List<Item> itemsLeft = m_Pools[2];
			List<Item> itemsRight = m_Pools[3];

			bool ignoreMovableImpassables = m_IgnoreMovableImpassables;
			TileFlag reqFlags = ImpassableSurface;

			if ( m.CanSwim )
				reqFlags |= TileFlag.Wet;

			List<Mobile> mobsForward = m_MobPools[0];
			List<Mobile> mobsLeft = m_MobPools[1];
			List<Mobile> mobsRight = m_MobPools[2];

			bool checkMobs = ( m is BaseCreature && !((BaseCreature)m).Controlled && ( xForward != m_Goal.X || yForward != m_Goal.Y ) );

			if ( checkDiagonals )
			{
				Sector sectorStart = map.GetSector( xStart, yStart );
				Sector sectorForward = map.GetSector( xForward, yForward );
				Sector sectorLeft = map.GetSector( xLeft, yLeft );
				Sector sectorRight = map.GetSector( xRight, yRight );

				List<Sector> sectors = m_Sectors;

				sectors.Add( sectorStart );

				if ( !sectors.Contains( sectorForward ) )
					sectors.Add( sectorForward );

				if ( !sectors.Contains( sectorLeft ) )
					sectors.Add( sectorLeft );

				if ( !sectors.Contains( sectorRight ) )
					sectors.Add( sectorRight );

				for ( int i = 0; i < sectors.Count; ++i )
				{
					Sector sector = sectors[i];

					for ( int j = 0; j < sector.Items.Count; ++j )
					{
						Item item = sector.Items[j];

						if ( ignoreMovableImpassables && item.Movable && ( item.ItemData.Flags & ImpassableSurface ) != 0 )
							continue;

						if ( (item.ItemData.Flags & reqFlags) == 0 )
							continue;

						if ( sector == sectorStart && item.AtWorldPoint( xStart, yStart ) && !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue )
							itemsStart.Add( item );
						else if ( sector == sectorForward && item.AtWorldPoint( xForward, yForward ) && !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue )
							itemsForward.Add( item );
						else if ( sector == sectorLeft && item.AtWorldPoint( xLeft, yLeft ) && !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue )
							itemsLeft.Add( item );
						else if ( sector == sectorRight && item.AtWorldPoint( xRight, yRight ) && !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue )
							itemsRight.Add( item );
					}

					if ( checkMobs )
					{
						for ( int j = 0; j < sector.Mobiles.Count; ++j )
						{
							Mobile mob = sector.Mobiles[j];

							if ( sector == sectorForward && mob.X == xForward && mob.Y == yForward )
								mobsForward.Add( mob );
							else if ( sector == sectorLeft && mob.X == xLeft && mob.Y == yLeft )
								mobsLeft.Add( mob );
							else if ( sector == sectorRight && mob.X == xRight && mob.Y == yRight )
//.........這裏部分代碼省略.........
開發者ID:jackuoll,項目名稱:Pre-AOS-RunUO,代碼行數:101,代碼來源:Movement.cs

示例6: CheckTravel


//.........這裏部分代碼省略.........
							return false;

						if(regstone.NoGateInto && type == TravelCheckType.GateTo)
							return false;

						Spell spell = new GateTravelSpell(caster, null);

						if(regstone.IsRestrictedSpell(spell, caster) && type == TravelCheckType.GateFrom)
							return false;


						if(regstone.CannotEnter && type == TravelCheckType.TeleportTo)
							return false;
					}

				}
	
				catch(NullReferenceException e)
				{
					LogHelper.LogException(e);
					Console.WriteLine("{0} Caught exception.", e); 
				}
				catch(Exception ex)
				{
                    LogHelper.LogException(ex);
				}
			}

			//Deal with house SecurePremises flag
            if ((type == TravelCheckType.GateTo || type == TravelCheckType.RecallTo ||
                type == TravelCheckType.TeleportTo) && caster.AccessLevel == AccessLevel.Player)
			{
				BaseHouse dst_house = null;
				Sector sector = map.GetSector( loc );
				foreach (BaseMulti mx in sector.Multis.Values)
				{
					BaseHouse _house = mx as BaseHouse;
                    if (_house == null)
                        continue;

					if ( _house != null && _house.Region.Contains(loc) )
					{
						dst_house = _house;
					}
				}

				if( dst_house != null )
				{
					if( dst_house.SecurePremises )
					{
						if( !dst_house.IsFriend( caster ) )
						{
							return false;
						}
					}
				}

			}

            // Gate inside a PreviewHouse exploit. Go directally to jail, don't collect $200.0
            if ((type == TravelCheckType.GateTo ||type == TravelCheckType.RecallTo ||
                type == TravelCheckType.TeleportTo) && caster.AccessLevel == AccessLevel.Player)
            {
                if (PreviewHouseAt(caster.Map, loc))
                {
                    LogHelper.Cheater(caster, "Travel inside a PreviewHouse exploit.", true);
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:67,代碼來源:SpellHelper.cs

示例7: FindDRDTRegion

		public static CustomRegion FindDRDTRegion(Map map, Point3D loc)
		{
			Point3D p = loc;

			if (p == Point3D.Zero)
				return null;

			if (map == Map.Internal || map == null)
				return null;

			Sector sector = map.GetSector(p);

			if (sector == null || sector.Owner == null || sector == sector.Owner.InvalidSector)
				return null;

			if (sector.Regions == null) //new check 2/2/07
				return null;

			ArrayList list = sector.Regions;

			if (list == null || list.Count == 0)
				return null;

			ArrayList list2 = new ArrayList();

			for (int i = 0; i < list.Count; ++i)
			{
				if (list[i] is Region) //new check 2/2/07 
				{
					Region region = (Region)list[i];

					if (region == null)
						continue;

					if (region.Contains(p))
						list2.Add(region);
				}

			}
			foreach (Region reg in list2)
			{
				if (reg == null)
					continue;

				CustomRegion test = null;

				if (reg is CustomRegion)
				{
					test = reg as CustomRegion;
					if (test != null)
						return test;
				}

			}
			//no custom region found
			return null;
		}
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:57,代碼來源:CustomRegion.cs

示例8: CheckMovement

		public bool CheckMovement( Mobile m, Map map, Point3D loc, Direction d, out int newZ )
		{
			if ( map == null || map == Map.Internal )
			{
				newZ = 0;
				return false;
			}

			int xStart = loc.X;
			int yStart = loc.Y;
			int xForward = xStart, yForward = yStart;
			int xRight = xStart, yRight = yStart;
			int xLeft = xStart, yLeft = yStart;

			bool checkDiagonals = ((int)d & 0x1) == 0x1;

			Offset( d, ref xForward, ref yForward );
			Offset( (Direction)(((int)d - 1) & 0x7), ref xLeft, ref yLeft );
			Offset( (Direction)(((int)d + 1) & 0x7), ref xRight, ref yRight );

			if ( xForward < 0 || yForward < 0 || xForward >= map.Width || yForward >= map.Height )
			{
				newZ = 0;
				return false;
			}

			int startZ, startTop;

			ArrayList itemsStart = m_Pools[0];
			ArrayList itemsForward = m_Pools[1];
			ArrayList itemsLeft = m_Pools[2];
			ArrayList itemsRight = m_Pools[3];
			ArrayList items;

			bool ignoreMovableImpassables = m_IgnoreMovableImpassables;
			TileFlag reqFlags = ImpassableSurface;

			if ( m.CanSwim )
				reqFlags |= TileFlag.Wet;

			if ( checkDiagonals )
			{
				Sector sectorStart = map.GetSector( xStart, yStart );
				Sector sectorForward = map.GetSector( xForward, yForward );
				Sector sectorLeft = map.GetSector( xLeft, yLeft );
				Sector sectorRight = map.GetSector( xRight, yRight );

				ArrayList sectors = m_Pools[4];

				sectors.Add( sectorStart );

				if ( !sectors.Contains( sectorForward ) )
					sectors.Add( sectorForward );

				if ( !sectors.Contains( sectorLeft ) )
					sectors.Add( sectorLeft );

				if ( !sectors.Contains( sectorRight ) )
					sectors.Add( sectorRight );

				for ( int i = 0; i < sectors.Count; ++i )
				{
					Sector sector = (Sector)sectors[i];

					items = sector.Items;

					for ( int j = 0; j < items.Count; ++j )
					{
						Item item = (Item)items[j];

						if ( ignoreMovableImpassables && item.Movable && item.ItemData.Impassable )
							continue;

						if ( (item.ItemData.Flags & reqFlags) == 0 )
							continue;

						if ( sector == sectorStart && item.AtWorldPoint( xStart, yStart ) && item.ItemID < 0x4000 )
							itemsStart.Add( item );
						else if ( sector == sectorForward && item.AtWorldPoint( xForward, yForward ) && item.ItemID < 0x4000 )
							itemsForward.Add( item );
						else if ( sector == sectorLeft && item.AtWorldPoint( xLeft, yLeft ) && item.ItemID < 0x4000 )
							itemsLeft.Add( item );
						else if ( sector == sectorRight && item.AtWorldPoint( xRight, yRight ) && item.ItemID < 0x4000 )
							itemsRight.Add( item );
					}
				}

				if ( m_Pools[4].Count > 0 )
					m_Pools[4].Clear();
			}
			else
			{
				Sector sectorStart = map.GetSector( xStart, yStart );
				Sector sectorForward = map.GetSector( xForward, yForward );

				if ( sectorStart == sectorForward )
				{
					items = sectorStart.Items;

					for ( int i = 0; i < items.Count; ++i )
//.........這裏部分代碼省略.........
開發者ID:kamronbatman,項目名稱:DefianceUO-Pre1.10,代碼行數:101,代碼來源:Movement.cs

示例9: GetTilesAt

        public static List<StaticTile> GetTilesAt(Map map, Point2D p, bool items, bool land, bool statics)
        {
            List<StaticTile> list = new List<StaticTile>();

            if (map == Map.Internal)
                return list;

            if (statics)
                list.AddRange(map.Tiles.GetStaticTiles(p.X, p.Y, true));

            if (items)
            {
                Sector sector = map.GetSector(p);

                foreach (Item item in sector.Items)
                    if (item.AtWorldPoint(p.X, p.Y))
                        list.Add(new StaticTile((ushort)item.ItemID, (sbyte)item.Z));
            }

            return list;
        }
開發者ID:greeduomacro,項目名稱:RuneUO,代碼行數:21,代碼來源:[2.0]AddonGenerator.cs

示例10: Find

        public static Region Find( Point3D p, Map map )
        {
            if ( map == null )
                return Map.Internal.DefaultRegion;

            Sector sector = map.GetSector( p );
            ArrayList list = sector.Regions;

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

                if ( region.Contains( p ) )
                    return region;
            }

            return map.DefaultRegion;
        }
開發者ID:BackupTheBerlios,項目名稱:sunuo-svn,代碼行數:18,代碼來源:BaseRegion.cs

示例11: HousePlacementRegionCheck

		private static HousePlacementResult HousePlacementRegionCheck(Mobile from, Map map, Point3D testPoint)
		{
			Sector sector = map.GetSector(testPoint);
			ArrayList list = sector.Regions;

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

				if (region.Contains(testPoint))
				{
					if (region is HouseRegion)
						return HousePlacementResult.BadRegion;

					if (!region.AllowHousing(from, testPoint)) // Cannot place houses in dungeons, towns, treasure map areas etc
					{
						if (region is TreasureRegion)
							return HousePlacementResult.BadRegionHidden;

						return HousePlacementResult.BadRegion;
					}

					if (region is TownshipRegion)
					{
						if (((TownshipRegion)region).CanBuildHouseInTownship(from) == false)
						{
							return HousePlacementResult.BadRegionTownship;
						}
					}

					if (region is NoHousingRegion)
						return HousePlacementResult.BadRegion;
				}
			}

			return HousePlacementResult.Valid;
		}
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:37,代碼來源:HousePlacement.cs

示例12: FindAll

		public static ArrayList FindAll(Point3D p, Map map)
		{
			ArrayList all = new ArrayList();

			if (map == null)
			{
				all.Add(Map.Internal.DefaultRegion);
				return all;
			}

			Sector sector = map.GetSector(p);
			ArrayList list = sector.Regions;

			for (int i = 0; i < list.Count; ++i)
			{
				if (list[i] is Region)
				{
					Region region = list[i] as Region;
					if (region.Contains(p))
						all.Add(region);
				}
			}

			all.Add(map.DefaultRegion);
			return all;
		}
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:26,代碼來源:BaseRegion.cs

示例13: IsPointInNoMurderZone

		private static bool IsPointInNoMurderZone(Point3D p, Map map)
		{
			if (map == null)
				return false;

			Sector sector = map.GetSector(p);
			ArrayList list = sector.Regions;

			bool bReturn = false;

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

				if (region.Contains(p))
				{
					if (region.IsNoMurderZone)
					{
						bReturn = true;
					}
				}
			}

			return bReturn;
		}
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:25,代碼來源:BaseRegion.cs

示例14: IsMobileCountableAtPoint

		private static bool IsMobileCountableAtPoint(Mobile m, Point3D p, Map map)
		{
			if (map == null)
				return true;

			Sector sector = map.GetSector(p);
			ArrayList list = sector.Regions;

			bool bReturn = true;

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

				if (region.Contains(p))
				{
					if (region.IsMobileCountable(m) == false)
					{
						bReturn = false;
					}
				}
			}

			return bReturn;
		}
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:25,代碼來源:BaseRegion.cs

示例15: FindHouseAt

		public static BaseHouse FindHouseAt(Point3D loc, Map map, int height)
		{
			if (map == null || map == Map.Internal)
				return null;

			Sector sector = map.GetSector(loc);

            foreach (BaseMulti mult in sector.Multis.Values)
			{
				BaseHouse house = mult as BaseHouse;
				if (house != null && house.IsInside(loc, height))
					return house;
			}

			return null;
		}
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:16,代碼來源:BaseHouse.cs


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