Server.Items.SpecialFishingNet.ValidateDeepWater C# (CSharp) Méthode

ValidateDeepWater() private static méthode

private static ValidateDeepWater ( Server.Map map, int x, int y ) : bool
map Server.Map
x int
y int
Résultat bool
		private static bool ValidateDeepWater( Map map, int x, int y )
		{
			int tileID = map.Tiles.GetLandTile( x, y ).ID;
			bool water = false;

			for ( int i = 0; !water && i < m_WaterTiles.Length; i += 2 )
				water = ( tileID >= m_WaterTiles[i] && tileID <= m_WaterTiles[i + 1] );

			return water;
		}

Usage Example

Exemple #1
0
        public void Spawn(PlunderZone zone, int amount)
        {
            Map map = Map.Trammel;

            if (zone == PlunderZone.Fel)
            {
                map = Map.Felucca;
            }
            else if (zone > PlunderZone.Fel)
            {
                map = Map.Tokuno;
            }

            for (int i = 0; i < amount; i++)
            {
                var     rec = _Zones[(int)zone];
                Point3D p;

                while (true)
                {
                    p = map.GetRandomSpawnPoint(rec); //new Point3D(rec.X + Utility.Random(rec.Width), rec.Y + Utility.RandomMinMax(rec.Start.X, rec.Height), -5);

                    if (p.Z != -5)
                    {
                        p.Z = -5;
                    }

                    var bounds = new Rectangle2D(p.X - 7, p.Y - 7, 15, 15);

                    bool badSpot = false;

                    for (int x = bounds.Start.X; x <= bounds.Start.X + bounds.Width; x++)
                    {
                        for (int y = bounds.Start.Y; y <= bounds.Start.Y + bounds.Height; y++)
                        {
                            if (BaseBoat.FindBoatAt(new Point3D(x, y, -5), map) != null || !SpecialFishingNet.ValidateDeepWater(map, x, y))
                            {
                                badSpot = true;
                                break;
                            }
                        }

                        if (badSpot)
                        {
                            break;
                        }
                    }

                    if (!badSpot)
                    {
                        IPooledEnumerable eable = map.GetMobilesInBounds(bounds);

                        foreach (Mobile m in eable)
                        {
                            if (m.AccessLevel == AccessLevel.Player)
                            {
                                badSpot = true;
                                break;
                            }
                        }

                        eable.Free();

                        if (!badSpot)
                        {
                            var beacon = new PlunderBeaconAddon();
                            beacon.MoveToWorld(p, map);

                            PlunderBeacons[zone].Add(beacon);
                            break;
                        }
                    }
                }
            }
        }
All Usage Examples Of Server.Items.SpecialFishingNet::ValidateDeepWater