Beispiel #1
0
        public static void DismountPlayer(Mobile m)
        {
            CleanClaimList(m);

            if (m.Mount is EtherealMount)
            {
                Server.Mobiles.EtherealMount.Dismount(m);
                m.SendMessage("Your mount has moved to your pack.");
            }
            else if (m.Mount is BaseMount)
            {
                BaseCreature pet = (BaseCreature)(m.Mount);
                Server.Mobiles.BaseMount.Dismount(m);

                pet.ControlTarget = null;
                //pet.ControlOrder = OrderType.Stay;
                pet.Internalize();
                pet.SetControlMaster(null);
                pet.SummonMaster = null;
                pet.IsStabled    = true;
                pet.Loyalty      = BaseCreature.MaxLoyalty;
                pet.Language     = "mount";

                m.Stabled.Add(pet);

                m.SendMessage("Your mount is safely waiting for you elsewhere.");
            }
        }
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive())
            {
                return;
            }

            if (!pet.Controled || pet.ControlMaster != from)
            {
                SayTo(from, 1042562);                   // You do not own that pet!
            }
            else if (pet.IsDeadPet)
            {
                SayTo(from, 1049668);                   // Living pets only, please.
            }
            else if (pet.Summoned)
            {
                SayTo(from, 502673);                   // I can not stable summoned creatures.
            }
            else if (pet.Body.IsHuman)
            {
                SayTo(from, 502672);                   // HA HA HA! Sorry, I am not an inn.
            }
            else if ((pet is PackLlama || pet is PackHorse || pet is Beetle) && (pet.Backpack != null && pet.Backpack.Items.Count > 0))
            {
                SayTo(from, 1042563);                   // You need to unload your pet.
            }
            else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                SayTo(from, 1042564);                   // I'm sorry.  Your pet seems to be busy.
            }
            else if (from.Stabled.Count >= GetMaxStabled(from))
            {
                SayTo(from, 1042565);                   // You have too many pets in the stables!
            }
            else
            {
                Container bank = from.BankBox;

                if (bank != null && bank.ConsumeTotal(typeof(Gold), 30))
                {
                    pet.ControlTarget = null;
                    pet.ControlOrder  = OrderType.Stay;
                    pet.Internalize();

                    pet.SetControlMaster(null);
                    pet.SummonMaster = null;

                    pet.IsStabled = true;
                    from.Stabled.Add(pet);

                    SayTo(from, 502679);                       // Very well, thy pet is stabled. Thou mayst recover it by saying 'claim' to me. In one real world week, I shall sell it off if it is not claimed!
                }
                else
                {
                    SayTo(from, 502677);                       // But thou hast not the funds in thy bank account!
                }
            }
        }
Beispiel #3
0
        //RUFO beginfunction
        private void SellPetForGold(Mobile from, BaseCreature pet, int goldamount)
        {
            Item gold = new Gold(goldamount);

            pet.ControlTarget = null;
            pet.ControlOrder  = OrderType.None;
            pet.Internalize();
            pet.SetControlMaster(null);
            pet.SummonMaster = null;
            pet.Delete();

            Container backpack = from.Backpack;

            if (backpack == null || !backpack.TryDropItem(from, gold, false))
            {
                gold.MoveToWorld(from.Location, from.Map);
            }
        }
        public static bool StablePet(Mobile from, BaseCreature pet, bool bForceStable)
        {
            bool bHasGold = from.BankBox != null && from.BankBox.ConsumeTotal(typeof(Gold), UODayChargePerPet(from));

            if (pet is IMount)
            {
                ((IMount)pet).Rider = null;                 // make sure it's dismounted
            }
            // First try to get the gold, if not and force is set, stable anyway and tell the player they will loose their pet soon.
            // Force is set when we are sending a player to prison or jail and they don't really have any choice
            if (bHasGold || bForceStable)
            {
                pet.ControlTarget = null;
                pet.ControlOrder  = OrderType.Stay;
                pet.Internalize();

                pet.SetControlMaster(null);
                pet.SummonMaster = null;

                pet.IsStabled = true;
                from.Stabled.Add(pet);

                pet.LastStableChargeTime = DateTime.Now;

                // they are probably being jailed, let them slide for this FIRST payment only
                if (bHasGold == false && bForceStable == true)
                {
                    pet.SetFlag(CreatureFlags.StableHold, true);
                    pet.StableBackFees = UODayChargePerPet(from);
                    from.SendMessage("Thou hast not the funds in thy bank account to stable this pet.");
                    from.SendMessage("The stable master will keep a runing account for {0} of owed fees.", pet.Name);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static void DismountPlayer(Mobile m)
        {
            CleanClaimList(m);

            if (m.Mount is EtherealMount)
            {
                IMount        mount = m.Mount;
                EtherealMount ethy  = (EtherealMount)mount;
                Server.Mobiles.EtherealMount.Dismount(m);
                ethy.Owner = m;
                if (!Server.Misc.Worlds.InBuilding(m))
                {
                    m.SendMessage("Your mount has moved to your pack.");
                }
            }
            else if (m.Mount is BaseMount)
            {
                BaseCreature pet = (BaseCreature)(m.Mount);
                Server.Mobiles.BaseMount.Dismount(m);

                pet.ControlTarget = null;
                pet.Internalize();
                pet.SetControlMaster(null);
                pet.SummonMaster = null;
                pet.IsStabled    = true;
                pet.Loyalty      = BaseCreature.MaxLoyalty;
                pet.Language     = "mount";

                m.Stabled.Add(pet);

                if (!Server.Misc.Worlds.InBuilding(m))
                {
                    m.SendMessage("Your mount is safely waiting for you elsewhere.");
                }
            }
        }
Beispiel #6
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (this.Deleted || !from.CheckAlive())
                return;

            if (!pet.Controlled || pet.ControlMaster != from)
            {
                from.SendLocalizedMessage(1042562); // You do not own that pet!
            }
            else if (pet.IsDeadPet)
            {
                from.SendLocalizedMessage(1049668); // Living pets only, please.
            }
            else if (pet.Summoned)
            {
                from.SendLocalizedMessage(502673); // I can not stable summoned creatures.
            }
            #region Mondain's Legacy
            else if (pet.Allured)
            {
                from.SendLocalizedMessage(1048053); // You can't stable that!
            }
            #endregion
            else if (pet.Body.IsHuman)
            {
                from.SendLocalizedMessage(502672); // HA HA HA! Sorry, I am not an inn.
            }
            else if ((pet is PackLlama || pet is PackHorse || pet is Beetle) && (pet.Backpack != null && pet.Backpack.Items.Count > 0))
            {
                from.SendLocalizedMessage(1042563); // You need to unload your pet.
            }
            else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                from.SendLocalizedMessage(1042564); // I'm sorry.  Your pet seems to be busy.
            }
            else if (from.Stabled.Count >= GetMaxStabled(from))
            {
                from.SendLocalizedMessage(1042565); // You have too many pets in the stables!
            }
            else
            {
                Container bank = from.FindBankNoCreate();

                if (bank != null && bank.ConsumeTotal(typeof(Gold), 30))
                {
                    pet.ControlTarget = null;
                    pet.ControlOrder = OrderType.Stay;
                    pet.Internalize();

                    pet.SetControlMaster(null);
                    pet.SummonMaster = null;

                    pet.IsStabled = true;

                    if (Core.SE)
                        pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully happy

                    from.Stabled.Add(pet);

                    this.UsesRemaining -= 1;

                    from.SendLocalizedMessage(502679); // Very well, thy pet is stabled. Thou mayst recover it by saying 'claim' to me. In one real world week, I shall sell it off if it is not claimed!
                }
                else
                {
                    from.SendLocalizedMessage(502677); // But thou hast not the funds in thy bank account!
                }
            }
        }
Beispiel #7
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive())
            {
                return;
            }

            if (pet.Body.IsHuman)
            {
                SayTo(from, 502672); // HA HA HA! Sorry, I am not an inn.
            }
            else if (!pet.Controlled)
            {
                SayTo(from, 1048053); // You can't stable that!
            }
            else if (pet.ControlMaster != from)
            {
                SayTo(from, 1042562); // You do not own that pet!
            }
            else if (pet.IsDeadPet)
            {
                SayTo(from, 1049668); // Living pets only, please.
            }
            else if (pet.Summoned)
            {
                SayTo(from, 502673); // I can not stable summoned creatures.
            }
            else if (pet.Allured)
            {
                SayTo(from, 1048053); // You can't stable that!
            }
            else if ((pet is PackLlama || pet is PackHorse || pet is Beetle) && pet.Backpack != null && pet.Backpack.Items.Count > 0)
            {
                SayTo(from, 1042563); // You need to unload your pet.
            }
            else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                SayTo(from, 1042564); // I'm sorry.  Your pet seems to be busy.
            }
            else if (from.Stabled.Count >= GetMaxStabled(from))
            {
                SayTo(from, 1042565); // You have too many pets in the stables!
            }
            else
            {
                pet.ControlTarget = null;
                pet.ControlOrder  = OrderType.Stay;
                pet.Internalize();

                pet.SetControlMaster(null);
                pet.SummonMaster = null;

                pet.IsStabled = true;
                pet.StabledBy = from;

                pet.Loyalty = MaxLoyalty; // Wonderfully happy

                from.Stabled.Add(pet);

                SayTo(from, 1049677); // Your pet has been stabled.
            }
        }
Beispiel #8
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive())
            {
                return;
            }

            if (pet.Body.IsHuman)
            {
                SayTo(from, 502672); // HA HA HA! Sorry, I am not an inn.
            }
            else if (!pet.Controlled)
            {
                SayTo(from, 1048053); // You can't stable that!
            }
            else if (pet.ControlMaster != from)
            {
                SayTo(from, 1042562); // You do not own that pet!
            }
            else if (pet.Summoned || pet.AI == AIType.AI_Familiar)
            {
                SayTo(from, 502673); // I can not stable summoned creatures.
            }
            else if ((pet is PackLlama || pet is PackHorse) && pet.Backpack != null && pet.Backpack.Items.Count > 0)
            {
                SayTo(from, 1042563); // You need to unload your pet.
            }
            else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                SayTo(from, 1042564); // I'm sorry.  Your pet seems to be busy.
            }
            else
            {
                var       amount = pet.Str * 2;
                Container bank   = from.FindBankNoCreate();

                SayTo(from, true, $"I charge {amount} to take care of that {pet.Name}.");

                if (@from.Backpack != null && @from.Backpack.ConsumeTotal(typeof(Gold), amount) ||
                    bank != null && bank.ConsumeTotal(typeof(Gold), amount))
                {
                    pet.ControlTarget = null;
                    pet.ControlOrder  = OrderType.Stay;
                    pet.Internalize();

                    pet.SetControlMaster(null);
                    pet.SummonMaster = null;

                    pet.IsStabled = true;
                    pet.StabledBy = from;

                    var petClaimTicket = new PetClaimTicket {
                        Name = $"Pet claim ticket - Name: {pet.Name}"
                    };
                    petClaimTicket.Stabled = pet;

                    var cont = from.Backpack;
                    if (cont == null || !cont.TryDropItem(from, petClaimTicket, false))
                    {
                        petClaimTicket.MoveToWorld(from.Location, from.Map);
                    }

                    SayTo(from, true, $"Keep this ticket and give it to me when you want {pet.Name} back.");
                }
                else
                {
                    SayTo(from, 502677); // But thou hast not the funds in thy bank account!
                }
            }
        }
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (this.Deleted || !from.CheckAlive())
            {
                return;
            }

            if (pet.Body.IsHuman)
            {
                this.SayTo(from, 502672); // HA HA HA! Sorry, I am not an inn.
            }
            else if (!pet.Controlled)
            {
                this.SayTo(from, 1048053); // You can't stable that!
            }
            else if (pet.ControlMaster != from)
            {
                this.SayTo(from, 1042562); // You do not own that pet!
            }
            else if (pet.IsDeadPet)
            {
                this.SayTo(from, 1049668); // Living pets only, please.
            }
            else if (pet.Summoned)
            {
                this.SayTo(from, 502673); // I can not stable summoned creatures.
            }
            #region Mondain's Legacy
            else if (pet.Allured)
            {
                this.SayTo(from, 1048053); // You can't stable that!
            }
            #endregion
            else if ((pet is PackLlama || pet is PackHorse || pet is Beetle) && (pet.Backpack != null && pet.Backpack.Items.Count > 0))
            {
                this.SayTo(from, 1042563); // You need to unload your pet.
            }
            else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                this.SayTo(from, 1042564); // I'm sorry.  Your pet seems to be busy.
            }
            else if (from.Stabled.Count >= GetMaxStabled(from))
            {
                this.SayTo(from, 1042565); // You have too many pets in the stables!
            }
            else
            {
                Container bank = from.FindBankNoCreate();

                if ((from.Backpack != null && from.Backpack.ConsumeTotal(typeof(Gold), 30)) || (bank != null && bank.ConsumeTotal(typeof(Gold), 30)))
                {
                    pet.ControlTarget = null;
                    pet.ControlOrder  = OrderType.Stay;
                    pet.Internalize();

                    pet.SetControlMaster(null);
                    pet.SummonMaster = null;

                    pet.IsStabled = true;
                    pet.StabledBy = from;

                    if (Core.SE)
                    {
                        pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully happy
                    }
                    from.Stabled.Add(pet);

                    this.SayTo(from, Core.AOS ? 1049677 : 502679); // [AOS: Your pet has been stabled.] Very well, thy pet is stabled. Thou mayst recover it by saying 'claim' to me. In one real world week, I shall sell it off if it is not claimed!
                }
                else
                {
                    this.SayTo(from, 502677); // But thou hast not the funds in thy bank account!
                }
            }
        }
Beispiel #10
0
		public void StablePet(BaseCreature pet, bool maxloyal, bool autostable)
		{
			if (pet is IMount)
			{
				((IMount)pet).Rider = null;
			}

			pet.ControlTarget = null;
			pet.ControlOrder = OrderType.Stay;
			pet.Internalize();

			pet.SetControlMaster(null);
			pet.SummonMaster = null;

			pet.IsStabled = true;
			pet.StabledDate = DateTime.UtcNow;

			Stabled.Add(pet);

			if (maxloyal)
			{
				pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully happy
			}

			if (autostable)
			{
				AutoStabled.Add(pet);
			}
		}
        public static void StablePet(Mobile from, BaseCreature pet)
        {
            if (pet == null || pet.Deleted || from == null || from.Deleted)
            {
                return;
            }

            if (pet.ControlMaster == null)
            {
                from.SendMessage("This creature has no owner.");
            }
            else if (pet.IsStabled)
            {
                from.SendMessage("The pet is already stabled.");
            }
            else
            {
                Mobile owner = pet.ControlMaster;

                if (owner.Stabled.Count >= AnimalTrainer.GetMaxStabled(owner))
                {
                    from.SendMessage("Warning: The owner has not enough free stable slots. Forcing GM stable...");
                }

                if (pet is IMount)
                {
                    var bm = (IMount) pet;
                    bm.Rider = null;
                }

                pet.ControlTarget = null;
                pet.ControlOrder = OrderType.Stay;
                pet.Internalize();

                pet.SetControlMaster(null);
                pet.SummonMaster = null;

                pet.IsStabled = true;
                pet.StabledDate = DateTime.UtcNow;
                owner.Stabled.Add(pet);

                from.SendMessage("The pet is now stabled.");
            }
        }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseCreature)
                {
                    BaseCreature m_Creature = (BaseCreature)targeted;
                    if (!m_Creature.Controled || m_Creature.ControlMaster != from)
                    {
                        m_Trainer.SayTo(from, false, "You've no claim to that animal.");
                    }
                    else if (!m_Creature.Alive || m_Creature == null)
                    {
                        m_Trainer.SayTo(from, false, "They don't look up to the task.");
                    }
                    else if (m_Creature.Female == m_First.Female || m_Creature.GetType() != m_First.GetType())
                    {
                        m_Trainer.SayTo(from, false, "I'm afraid that's biologically impossible.");
                        // DEBUG TEXT
                        //from.SendMessage("{0},{1}",m_First.GetType().ToString(), m_Creature.GetType().ToString());
                    }
                    else if (from.Stabled.Count + 3 >= GetMaxStabled(from))
                    {
                        m_Trainer.SayTo(from, false, "I'm afraid there's no room in the stable to breed these animals.");
                    }
                    else
                    {
                        Type type = m_First.GetType();
                        if (type != null)
                        {
                            try
                            {
                                object o = Activator.CreateInstance(type);

                                if (o is BaseCreature)
                                {
                                    BaseCreature child = (BaseCreature)o;

                                    m_First.ControlTarget = null;
                                    m_First.ControlOrder  = OrderType.Stay;

                                    m_First.SetControlMaster(null);
                                    m_First.SummonMaster = null;

                                    m_First.IsStabled = true;

                                    m_Creature.ControlTarget = null;
                                    m_Creature.ControlOrder  = OrderType.Stay;

                                    m_Creature.SetControlMaster(null);
                                    m_Creature.SummonMaster = null;

                                    m_Creature.IsStabled = true;

                                    child.IsStabled = true;

                                    from.Stabled.Add(child);
                                    from.Stabled.Add(m_First);
                                    from.Stabled.Add(m_Creature);
                                    child.BardEndTime      = DateTime.Now.AddDays(1);
                                    m_First.BardEndTime    = DateTime.Now.AddDays(1);
                                    m_Creature.BardEndTime = DateTime.Now.AddDays(1);
                                    child.Internalize();
                                    m_First.Internalize();
                                    m_Creature.Internalize();
                                    TAVUtilities.Reproduce(m_Creature, m_First, child);
                                    from.SendMessage("The animals have been stabled, neither the new born nor the parents may be removed from the stable for 24 hours.");
                                    m_Trainer.SayTo(from, false, "Very well, the animals will be stored in the stable overnight.");
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                else if (targeted == from)
                {
                    m_Trainer.SayTo(from, 502672); // HA HA HA! Sorry, I am not an inn.
                }
                else
                {
                    m_Trainer.SayTo(from, false, "I'm afraid I wouldn't know anything about that."); // You can't stable that!
                }
            }
		public void EndStable( Mobile from, BaseCreature pet )
		{
			if ( Deleted || !from.CheckAlive() )
				return;

			if ( !pet.Controlled || pet.ControlMaster != from )
			{
				Say( 1042562 ); // You do not own that pet!
			}
			else if ( pet.IsDeadPet )
			{
				Say( 1049668 ); // Living pets only, please.
			}
			else if ( pet.Summoned )
			{
				Say( 502673 ); // I can not stable summoned creatures.
			}
			else if ( pet.Body.IsHuman )
			{
				Say( 502672 ); // HA HA HA! Sorry, I am not an inn.
			}
			else if ( (pet is PackLlama || pet is PackHorse || pet is Beetle) && (pet.Backpack != null && pet.Backpack.Items.Count > 0) )
			{
				Say( 1042563 ); // You need to unload your pet.
			}
			else if ( pet.Combatant != null && pet.InRange( pet.Combatant, 12 ) && pet.Map == pet.Combatant.Map )
			{
				Say( 1042564 ); // I'm sorry.  Your pet seems to be busy.
			}
			else if ( from.Stabled.Count >= GetMaxStabled( from ) )
			{
				Say( 1042565 ); // You have too many pets in the stables!
			}
			else
			{
				if ( Banker.Withdraw( from, 30 ) )
				{
					if ( m_Sign != null )
						m_Sign.Stone.CityTreasury += 30;

					pet.ControlTarget = null;
					pet.ControlOrder = OrderType.Stay;
					pet.Internalize();

					pet.SetControlMaster( null );
					pet.SummonMaster = null;

					pet.IsStabled = true;
					from.Stabled.Add( pet );

					Say( 502679 ); // Very well, thy pet is stabled. Thou mayst recover it by saying 'claim' to me. In one real world week, I shall sell it off if it is not claimed!
				}
				else
				{
					Say( 502677 ); // But thou hast not the funds in thy bank account!
				}
			}
		}
Beispiel #14
0
		public void EndStable(Mobile from, BaseCreature pet)
		{
			if (Deleted || !from.CheckAlive())
			{
				return;
			}

			if (pet.Body.IsHuman)
			{
				SayTo(from, 502672); // HA HA HA! Sorry, I am not an inn.
			}
			else if (!pet.Controlled)
			{
				SayTo(from, 1048053); // You can't stable that!
			}
			else if (pet.ControlMaster != from)
			{
				SayTo(from, 1042562); // You do not own that pet!
			}
			else if (pet.IsDeadPet)
			{
				SayTo(from, 1049668); // Living pets only, please.
			}
			else if (pet.Summoned)
			{
				SayTo(from, 502673); // I can not stable summoned creatures.
			}
			else if (pet.Allured)
			{
				SayTo(from, 1048053); // You can't stable that!
			}
			else if ((pet is PackLlama || pet is PackHorse || pet is Beetle) &&
					 (pet.Backpack != null && pet.Backpack.Items.Count > 0))
			{
				SayTo(from, 1042563); // You need to unload your pet.
			}
			else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
			{
				SayTo(from, 1042564); // I'm sorry.  Your pet seems to be busy.
			}
			else if (from.Stabled.Count >= GetMaxStabled(from))
			{
				SayTo(from, 1042565); // You have too many pets in the stables!
			}
			else if ((from.Backpack != null && from.Backpack.ConsumeTotal(typeof(Gold), 30)) || Banker.Withdraw(from, 30))
			{
				pet.ControlTarget = null;
				pet.ControlOrder = OrderType.Stay;
				pet.Internalize();

				pet.SetControlMaster(null);
				pet.SummonMaster = null;

				pet.IsStabled = true;
				pet.StabledBy = from;

				if (Core.SE)
				{
					pet.Loyalty = MaxLoyalty; // Wonderfully happy
				}

				from.Stabled.Add(pet);

				SayTo(from, Core.AOS ? 1049677 : 502679);
				// [AOS: Your pet has been stabled.] Very well, thy pet is stabled. 
				// Thou mayst recover it by saying 'claim' to me. In one real world week, 
				// I shall sell it off if it is not claimed!
			}
			else
			{
				SayTo(from, 502677); // But thou hast not the funds in thy bank account!
			}
		}
Beispiel #15
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive())
            {
                return;
            }

            if (!this.InRange(from.Location, 14))
            {
                return;
            }

            if (!pet.Controlled || pet.ControlMaster != from)
            {
                SayTo(from, 1042562);                   // You do not own that pet!
            }
            else if (!pet.Tamable && !pet.IsGolem)
            {
                SayTo(from, 1048053);                   // You can't stable that!
            }
            else if (pet.IsDeadPet)
            {
                SayTo(from, 1049668);                   // Living pets only, please.
            }
            else if (pet.Summoned)
            {
                SayTo(from, 502673);                   // I can not stable summoned creatures.
            }
            else if (pet.Body.IsHuman)
            {
                SayTo(from, 502672);                   // HA HA HA! Sorry, I am not an inn.
            }
            else if ((pet is PackLlama || pet is PackHorse || pet is Beetle) && (pet.Backpack != null && pet.Backpack.Items.Count > 0))
            {
                SayTo(from, 1042563);                   // You need to unload your pet.
            }
            else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                SayTo(from, 1042564);                   // I'm sorry.  Your pet seems to be busy.
            }
            else if (from.Stabled.Count >= GetMaxStabled(from))
            {
                SayTo(from, 1042565);                   // You have too many pets in the stables!
            }
            else if (pet.IsInvolvedInTrade())
            {
                SayTo(from, 1062908);                   // Please remove your pet from the transfer crate before attempting to stable it.
            }
            else
            {
                Container bank = from.BankBox;

                if (bank != null && bank.ConsumeTotal(typeof(Gold), 30))
                {
                    pet.ControlTarget = null;
                    pet.ControlOrder  = OrderType.Stay;
                    pet.Internalize();

                    pet.SetControlMaster(null);
                    pet.SummonMaster = null;

                    pet.IsStabled = true;
                    from.Stabled.Add(pet);

                    SayTo(from, 1049677);                       // Your pet has been stabled.
                }
                else
                {
                    SayTo(from, 502677);                       // But thou hast not the funds in thy bank account!
                }
            }
        }