public virtual void SpawnBoss()
        {
            if (Peerless == null)
            {
                // spawn boss
                Peerless = Boss;

                if (Peerless == null)
                {
                    return;
                }

                Peerless.Home      = BossLocation;
                Peerless.RangeHome = 12;
                Peerless.MoveToWorld(BossLocation, Map);
                Peerless.Altar = this;

                StartSlayTimer();
            }
        }
Esempio n. 2
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;
            }
        }
Esempio n. 3
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (Owner != null && Owner != from)
            {
                if (Peerless != null && Peerless.CheckAlive())
                {
                    from.SendLocalizedMessage(1075213); // The master of this realm has already been summoned and is engaged in combat.  Your opportunity will come after he has squashed the current batch of intruders!
                }
                else
                {
                    from.SendLocalizedMessage(1072683, Owner.Name); // ~1_NAME~ has already activated the Prism, please wait...
                }
                return(false);
            }

            if (IsKey(dropped) && MasterKeys.Count == 0)
            {
                if (KeyValidation == null)
                {
                    KeyValidation = new List <PeerlessKeyArray>();

                    for (int i = 0; i < Keys.Length; i++)
                    {
                        KeyValidation.Add(new PeerlessKeyArray {
                            Key = Keys[i], Active = false
                        });
                    }
                }

                if (KeyValidation.Any(x => x.Active))
                {
                    if (KeyValidation.Any(x => x.Key == dropped.GetType() && !x.Active))
                    {
                        KeyValidation.Find(s => s.Key == dropped.GetType()).Active = true;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1072682); // This is not the proper key.
                        return(false);
                    }
                }
                else
                {
                    Owner = from;
                    KeyStartTimer(from);
                    from.SendLocalizedMessage(1074575); // You have activated this object!
                    KeyValidation.Find(s => s.Key == dropped.GetType()).Active = true;
                }

                if (KeysValidated())
                {
                    ActivateEncounter(from);
                }
            }
            else
            {
                from.SendLocalizedMessage(1072682); // This is not the proper key.
                return(false);
            }

            return(base.OnDragDrop(from, dropped));
        }
Esempio n. 4
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (IsKey(dropped))
            {
                if (Owner != null)
                {
                    if (Peerless != null && Peerless.CheckAlive())
                    {
                        from.SendLocalizedMessage(1075213); // The master of this realm has already been summoned and is engaged in combat.  Your opportunity will come after he has squashed the current batch of intruders!
                    }
                    else
                    {
                        from.SendLocalizedMessage(1072683, Owner.Name); // ~1_NAME~ has already activated the Prism, please wait...
                    }
                    return(false);
                }

                for (int i = 0; i < Keys.Length; i++)
                {
                    if (i == 0)
                    {
                        Owner = from;
                        KeyStartTimer(from);
                        from.SendLocalizedMessage(1074575); // You have activated this object!
                    }

                    if (Keys.Length == (i + 1))
                    {
                        KeyStopTimer();

                        from.SendLocalizedMessage(1072678); // You have awakened the master of this realm. You need to hurry to defeat it in time!

                        for (int k = 0; k < KeyCount; k++)
                        {
                            from.SendLocalizedMessage(1072680); // You have been given the key to the boss.

                            MasterKey key = MasterKey;

                            if (key != null)
                            {
                                key.Altar = this;
                                key._Map  = Map;

                                if (!from.AddToBackpack(key))
                                {
                                    key.MoveToWorld(from.Location, from.Map);
                                }

                                MasterKeys.Add(key);
                            }
                        }

                        dropped.Delete();
                        ClearContainer();
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1072682); // This is not the proper key.
                return(false);
            }

            return(base.OnDragDrop(from, dropped));
        }
Esempio n. 5
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (Owner != null && Owner != from)
            {
                if (Peerless != null && Peerless.CheckAlive())
                {
                    from.SendLocalizedMessage(1075213); // The master of this realm has already been summoned and is engaged in combat.  Your opportunity will come after he has squashed the current batch of intruders!
                }
                else
                {
                    from.SendLocalizedMessage(1072683, Owner.Name); // ~1_NAME~ has already activated the Prism, please wait...
                }
                return(false);
            }

            if (IsKey(dropped) && MasterKeys.Count() == 0)
            {
                if (KeyValidation == null)
                {
                    KeyValidation = new List <PeerlessKeyArray>();

                    Keys.ToList().ForEach(x => KeyValidation.Add(new PeerlessKeyArray {
                        Key = x, Active = false
                    }));
                }

                if (KeyValidation.Any(x => x.Active == true))
                {
                    if (KeyValidation.Any(x => x.Key == dropped.GetType() && x.Active == false))
                    {
                        KeyValidation.Find(s => s.Key == dropped.GetType()).Active = true;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1072682); // This is not the proper key.
                        return(false);
                    }
                }
                else
                {
                    Owner = from;
                    KeyStartTimer(from);
                    from.SendLocalizedMessage(1074575); // You have activated this object!
                    KeyValidation.Find(s => s.Key == dropped.GetType()).Active = true;
                }

                if (KeyValidation.Where(x => x.Active == true).Count() == Keys.Count())
                {
                    KeyStopTimer();

                    from.SendLocalizedMessage(1072678); // You have awakened the master of this realm. You need to hurry to defeat it in time!
                    BeginSequence(from);

                    for (int k = 0; k < KeyCount; k++)
                    {
                        from.SendLocalizedMessage(1072680); // You have been given the key to the boss.

                        MasterKey key = MasterKey;

                        if (key != null)
                        {
                            key.Altar = this;
                            key._Map  = Map;

                            if (!from.AddToBackpack(key))
                            {
                                key.MoveToWorld(from.Location, from.Map);
                            }

                            MasterKeys.Add(key);
                        }
                    }

                    Timer.DelayCall(TimeSpan.FromSeconds(1), () => ClearContainer());
                    KeyValidation = null;
                }
            }
            else
            {
                from.SendLocalizedMessage(1072682); // This is not the proper key.
                return(false);
            }

            return(base.OnDragDrop(from, dropped));
        }