Exemple #1
0
        public static void AddPlunderBeacon(PlunderZone zone, PlunderBeaconAddon beacon)
        {
            if (Spawner == null)
            {
                return;
            }

            if (!Spawner.PlunderBeacons[zone].Contains(beacon))
            {
                Spawner.PlunderBeacons[zone].Add(beacon);
            }
        }
Exemple #2
0
        public void CheckSpawn()
        {
            foreach (int i in Enum.GetValues(typeof(PlunderZone)))
            {
                if (i == -1)
                {
                    continue;
                }

                PlunderZone zone = (PlunderZone)i;
                int         low  = _SpawnCount[i] - PlunderBeacons[zone].Count;

                if (low > 0)
                {
                    Spawn(zone, low);
                }
            }
        }
Exemple #3
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;
                        }
                    }
                }
            }
        }