public SpawnEntry(Level3Spawner spawner, Rectangle2D[] bounds, int maxCount = 8)
 {
     Bounds   = bounds;
     MaxCount = maxCount;
     Spawner  = spawner;
     Spawn    = new List <BaseCreature>();
 }
Exemple #2
0
        public override void Delete()
        {
            if (OnGoing)
            {
                EndInvasion();
            }

            if (Region != null)
            {
                Region.Unregister();
                Region = null;
            }

            if (Timer != null)
            {
                Timer.Stop();
                Timer = null;
            }

            foreach (var wp in WaypointsA.Where(w => w != null && !w.Deleted))
            {
                wp.Delete();
            }

            foreach (var wp in WaypointsB.Where(w => w != null && !w.Deleted))
            {
                wp.Delete();
            }

            if (Level3Spawner != null)
            {
                Level3Spawner.Deactivate();
                Level3Spawner = null;
            }

            base.Delete();
        }
Exemple #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            case 1:
                if (version == 1 || reader.ReadInt() == 0)
                {
                    Level3Spawner = new Level3Spawner(reader, this);
                }
                goto case 0;

            case 0:
                if (version == 0)
                {
                    Level3Spawner = new Level3Spawner(this);

                    Timer.DelayCall(() =>
                    {
                        ResetLevel3Spawners();
                    });
                }

                RespawnMin = reader.ReadInt();
                RespawnMax = reader.ReadInt();

                WaypointsA = new List <WayPoint>();
                WaypointsB = new List <WayPoint>();

                Active    = reader.ReadBool();
                NextStart = DateTime.UtcNow;

                int counta = reader.ReadInt();
                int countb = reader.ReadInt();

                for (int i = 0; i < counta; i++)
                {
                    WayPoint wp = reader.ReadItem() as WayPoint;

                    if (wp != null)
                    {
                        WaypointsA.Add(wp);
                    }
                }

                for (int i = 0; i < countb; i++)
                {
                    WayPoint wp = reader.ReadItem() as WayPoint;

                    if (wp != null)
                    {
                        WaypointsB.Add(wp);
                    }
                }

                break;
            }

            if (Map == Map.Felucca)
            {
                InstanceFel = this;
            }
            else
            {
                InstanceTram = this;
            }

            Timer.DelayCall(TimeSpan.FromSeconds(10), () => { ClearSpawn(); ClearSpawners(); });
        }