Ejemplo n.º 1
0
        public void EndStable( Mobile from, BaseCreature pet )
        {
            if ( Deleted || !from.CheckAlive() )
                return;

            if ( !pet.Controlled || 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 || pet.VanishTime != DateTime.MinValue )
            {
                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 WorkHorse || pet is GiantScarab) && (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
            {
                Container bank = from.BankBox;

                if ( bank != null && bank.ConsumeTotal( typeof( Copper ), 1 ) )
                {
                    pet.ControlTarget = null;
                    pet.ControlOrder = OrderType.Stay;
                    pet.StabledOwner = from;
                    pet.Internalize();
                    pet.SetControlMaster( null );
                    pet.SummonMaster = null;
                    pet.IsStabled = true;
                    pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully happy
                    this.Stabled.Add( pet );
                    SayTo( from, "Thy pet has been stabled. I will charge you one copper piece every six hours [OOC: two real-life hours]." );
                    SayTo( from, "Here is your ticket. Hand it back to me when you wish to get your animal back, or say just tell me you wish to claim your pets." );
                    StableTicket ticket = new StableTicket();
                    ticket.StabledPet = pet;
                    pet.StableTicket = ticket;

                    if( from.Backpack != null )
                        from.AddToBackpack( ticket );
                }
                else
                {
                    SayTo( from, 502677 ); // But thou hast not the funds in thy bank account!
                }
            }
        }
Ejemplo n.º 2
0
        public void EndClaimList( Mobile from, BaseCreature pet, StableTicket ticket )
        {
            if ( pet == null || pet.Deleted || from.Map != this.Map || !from.InRange( this, 14 ) || !this.Stabled.Contains( pet ) || !from.CheckAlive() )
                return;

            if ( (from.Followers + pet.ControlSlots) <= from.FollowersMax )
            {
                pet.SetControlMaster( from );

                if ( pet.Summoned )
                    pet.SummonMaster = from;

                if (pet is BaseBreedableCreature)
                {
                    BaseBreedableCreature breedable = pet as BaseBreedableCreature;
                    breedable.UpdateSpeeds();
                }

                pet.ControlTarget = from;
                pet.ControlOrder = OrderType.Follow;
                pet.StabledOwner = null;
                pet.MoveToWorld( from.Location, from.Map );
                pet.IsStabled = false;
                this.Stabled.Remove( pet );

                if( ticket != null && !ticket.Deleted )
                    ticket.Delete();

                if( pet.StableTicket != null && !pet.StableTicket.Deleted )
                    pet.StableTicket.Delete();

                SayTo( from, 1042559 ); // Here you go... and good day to you!
            }
            else
            {
                SayTo( from, 1049612, pet.Name ); // ~1_NAME~ remained in the stables because you have too many followers.
            }
        }