Esempio n. 1
0
        public virtual void FinishSequence()
        {
            StopTimers();

            if (Owner != null)
            {
                Owner = null;
            }

            // delete peerless
            if (Peerless != null)
            {
                if (Peerless.Corpse != null && !Peerless.Corpse.Deleted)
                {
                    Peerless.Corpse.Delete();
                }

                if (!Peerless.Deleted)
                {
                    Peerless.Delete();
                }
            }

            // teleport party to exit if not already there
            if (Fighters != null)
            {
                var fighters = new List <Mobile>(Fighters);

                fighters.ForEach(x => Exit(x));

                ColUtility.Free(fighters);
            }

            // delete master keys
            if (MasterKeys != null)
            {
                var keys = new List <Item>(MasterKeys);

                keys.ForEach(x => x.Delete());

                ColUtility.Free(keys);
            }

            // delete any remaining helpers
            CleanupHelpers();

            // reset summoner, boss
            Peerless = null;

            Deadline = DateTime.MinValue;

            ColUtility.Free(Fighters);
            ColUtility.Free(MasterKeys);
        }
Esempio n. 2
0
        public virtual void FinishSequence()
        {
            StopTimers();

            if (Owner != null)
            {
                Owner = null;
            }

            // delete peerless
            if (Peerless != null)
            {
                if (Peerless.Corpse != null && !Peerless.Corpse.Deleted)
                {
                    Peerless.Corpse.Delete();
                }

                if (!Peerless.Deleted)
                {
                    Peerless.Delete();
                }
            }

            // teleport party to exit if not already there
            Fighters.ForEach(x => Exit(x));

            // delete master keys
            MasterKeys.ForEach(x => x.Delete());

            if (MasterKeys != null)
            {
                MasterKeys.Clear();
            }

            if (Fighters != null)
            {
                Fighters.Clear();
            }

            // delete any remaining helpers
            CleanupHelpers();

            // reset summoner, boss
            Peerless = null;

            Deadline = DateTime.MinValue;
        }
Esempio n. 3
0
        public virtual void Exit(Mobile fighter)
        {
            if (fighter == null)
            {
                return;
            }

            // teleport fighter
            if (fighter.NetState == null && MobileIsInBossArea(fighter.LogoutLocation))
            {
                fighter.LogoutMap      = this is CitadelAltar ? Map.Tokuno : Map;
                fighter.LogoutLocation = ExitDest;
            }
            else if (MobileIsInBossArea(fighter) && fighter.Map == Map)
            {
                fighter.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                fighter.PlaySound(0x1FE);

                if (this is CitadelAltar)
                {
                    fighter.MoveToWorld(ExitDest, Map.Tokuno);
                }
                else
                {
                    fighter.MoveToWorld(ExitDest, Map);
                }
            }

            // teleport his pets
            if (fighter is PlayerMobile)
            {
                foreach (BaseCreature pet in ((PlayerMobile)fighter).AllFollowers.OfType <BaseCreature>().Where(pet => pet != null &&
                                                                                                                (pet.Alive || pet.IsBonded) &&
                                                                                                                pet.Map != Map.Internal &&
                                                                                                                MobileIsInBossArea(pet)))
                {
                    if (pet is BaseMount)
                    {
                        BaseMount mount = (BaseMount)pet;

                        if (mount.Rider != null && mount.Rider != fighter)
                        {
                            mount.Rider.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                            mount.Rider.PlaySound(0x1FE);

                            if (this is CitadelAltar)
                            {
                                mount.Rider.MoveToWorld(ExitDest, Map.Tokuno);
                            }
                            else
                            {
                                mount.Rider.MoveToWorld(ExitDest, Map);
                            }

                            continue;
                        }
                        else if (mount.Rider != null)
                        {
                            continue;
                        }
                    }

                    pet.FixedParticles(0x376A, 9, 32, 0x13AF, EffectLayer.Waist);
                    pet.PlaySound(0x1FE);

                    if (this is CitadelAltar)
                    {
                        pet.MoveToWorld(ExitDest, Map.Tokuno);
                    }
                    else
                    {
                        pet.MoveToWorld(ExitDest, Map);
                    }
                }
            }

            Fighters.Remove(fighter);
            fighter.SendLocalizedMessage(1072677); // You have been transported out of this room.

            if (MasterKeys.Count == 0 && Fighters.Count == 0 && Owner != null)
            {
                StopTimers();

                Owner = null;

                if (Peerless != null)
                {
                    if (Peerless.Corpse != null && !Peerless.Corpse.Deleted)
                    {
                        Peerless.Corpse.Delete();
                    }

                    if (!Peerless.Deleted)
                    {
                        Peerless.Delete();
                    }
                }

                CleanupHelpers();

                // reset summoner, boss
                Peerless = null;

                Deadline = DateTime.MinValue;
            }
        }