示例#1
0
        public static void OnLogin(LoginEventArgs e)
        {
            Pause pauseatt = (Pause)XmlAttach.FindAttachment(e.Mobile, typeof(Pause));

            if (pauseatt == null)
            {
                XmlAttach.AttachTo(e.Mobile, new Pause());

                return;
            }

            if (pauseatt.Paused == true)
            {
                e.Mobile.SendGump(new Pausegump(e.Mobile));
                e.Mobile.Blessed   = true;
                e.Mobile.Hidden    = true;
                e.Mobile.Paralyzed = true;
                e.Mobile.Frozen    = true;
            }
        }
示例#2
0
        public static void Pause_OnCommand(CommandEventArgs e)
        {
            Pause pauseatt = (Pause)XmlAttach.FindAttachment(e.Mobile, typeof(Pause));

            if (pauseatt == null)
            {
                XmlAttach.AttachTo(e.Mobile, new Pause());

                return;
            }

            if (pauseatt.Paused == true)
            {
                pauseatt.Paused    = false;
                e.Mobile.Hidden    = false;
                e.Mobile.Paralyzed = false;
                e.Mobile.Frozen    = false;
                e.Mobile.Blessed   = false;

                if (e.Mobile.HasGump(typeof(Pausegump)))
                {
                    ;
                }
                {
                    e.Mobile.CloseGump(typeof(Pausegump));
                }


                PlayerMobile pm = (PlayerMobile)e.Mobile;
                ((PlayerMobile)pm).ClaimAutoStabledPets();
            }

            else
            {
                // region check only requires player to be about 30 steps away from the altar. this still puts them too close to the altar and could allow players to "steal" a champion spawn from another player. so I've used range check instead.
                //if (e.Mobile.Region.IsPartOf(typeof(ChampionSpawnRegion)) )
                foreach (Item item in e.Mobile.GetItemsInRange(50))                     // 50 = range.
                {
                    if (item is ChampionAltar)
                    {
                        // if you change the range above or if you use Region check instead of range, you'll want to change the message below
                        e.Mobile.SendMessage("You must be more than 50 steps away from the Champion's altar to use Pause.");
                        return;
                    }
                }
                // prevents players from using pause if they're paralyzed, frozen, holding a faction sigil, "holding" a spell target, in the middle of casting a spell, or currently attacking something.

                if (e.Mobile.Paralyzed == true || e.Mobile.Frozen == true || Factions.Sigil.ExistsOn(e.Mobile) || Server.Spells.SpellHelper.CheckCombat(e.Mobile) || e.Mobile.Spell != null || e.Mobile.Combatant != null)
                {
                    e.Mobile.SendMessage("You cannot pause at this time.");
                    return;
                }

                if (e.Mobile is PlayerMobile && (e.Mobile as PlayerMobile).DuelContext != null)
                {
                    e.Mobile.SendMessage("You cannot pause while duelling!");
                    return;
                }
                if (e.Mobile.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone)))
                {
                    e.Mobile.SendMessage("You cannot pause while duelling!");
                    return;
                }
                if (pauseatt.CanPause == false)
                {
                    e.Mobile.SendMessage("Your ability to Pause has been deactivated.");
                    return;
                }

                pauseatt.Paused    = true;
                e.Mobile.Hidden    = true;
                e.Mobile.Paralyzed = true;
                e.Mobile.Frozen    = true;
                e.Mobile.Warmode   = false;
                e.Mobile.Blessed   = true;

                e.Mobile.SendGump(new Pausegump(e.Mobile));

                PlayerMobile pm = (PlayerMobile)e.Mobile;

                if (((!pm.Mounted || (pm.Mount != null && pm.Mount is EtherealMount)) && (pm.AllFollowers.Count > pm.AutoStabled.Count)) || (pm.Mounted && (pm.AllFollowers.Count > (pm.AutoStabled.Count + 1))))
                {
                    pm.AutoStablePets();                             /* autostable checks summons, et al: no need here */
                }

                for (int i = pm.AllFollowers.Count - 1; i >= 0; --i)
                {
                    BaseCreature pet = pm.AllFollowers[i] as BaseCreature;
                    if (pet.Summoned)
                    {
                        //if (pet.Map != Map)
                        //{
                        pet.PlaySound(pet.GetAngerSound());
                        Timer.DelayCall(TimeSpan.Zero, pet.Delete);
                        //}
                    }
                }
            }
        }