SetControlMaster() public method

public SetControlMaster ( Mobile m ) : bool
m Mobile
return bool
Beispiel #1
0
		/// <summary>
		/// Creates a new MobileStatuette object - for internal use only
		/// </summary>
		private MobileStatuette( BaseCreature creature )
		{
			m_Creature = creature;
			ItemID = ShrinkTable.Lookup( m_Creature );
			Hue = m_Creature.Hue;

			m_Creature.ControlTarget = null;
			m_Creature.ControlOrder = OrderType.Stay;
			m_Creature.Internalize();
			m_Creature.SetControlMaster( null );
			m_Creature.SummonMaster = null;
			m_Creature.IsStabled = true;

			// Set the type of the creature as the name for this item
			Name = InsertSpaces( creature.GetType().Name );
		}
		/// <summary>
		/// Creates a new MobileStatuette object - for internal use only
		/// </summary>
		private MobileStatuette( BaseCreature creature )
		{
			m_Creature = creature;
			ItemID = ShrinkTable.Lookup( m_Creature );
			Hue = m_Creature.Hue;

			m_Creature.ControlTarget = null;
			m_Creature.ControlOrder = OrderType.Stay;
			m_Creature.Internalize();
			m_Creature.SetControlMaster( null );
			m_Creature.SummonMaster = null;
			m_Creature.IsStabled = true;

			// Set the type of the creature as the name for this item
			Name = Xanthos.Utilities.Misc.GetFriendlyClassName( creature.GetType().Name );
		}
 public MiniaturePet( int itemid, BaseCreature creature, Mobile owner )
     : base(itemid)
 {
     m_Creature = creature;
     creature.IsStabled = true;
     creature.ControlTarget = null;
     creature.ControlOrder = OrderType.Stay;
     creature.StabledOwner = owner;
     creature.Internalize();
     creature.SetControlMaster( null );
     creature.SummonMaster = null;
     creature.Loyalty = BaseCreature.MaxLoyalty;
     Weight = 10;
     Name = creature.Name;
     Movable = false;
 }
        public static void GetLastMounted(Mobile from)
        {
            bool hasMount = false;

            List <BaseCreature> list = new List <BaseCreature>();

            BaseCreature bc      = null;
            int          stabled = 0;

            for (int i = 0; i < from.Stabled.Count; ++i)
            {
                BaseCreature pet = from.Stabled[i] as BaseCreature;

                if (pet == null || pet.Deleted)
                {
                    pet.IsStabled = false;
                    from.Stabled.RemoveAt(i);
                    --i;
                    continue;
                }
                else if (pet.Language == "mount")
                {
                    bc = pet;
                }
            }

            for (int i = 0; i < from.Stabled.Count; ++i)
            {
                BaseCreature pet = from.Stabled[i] as BaseCreature;

                ++stabled;

                if (CanGetLastMounted(from, pet) && pet is BaseMount && pet == bc)
                {
                    pet.SetControlMaster(from);
                    pet.ControlTarget = from;
                    pet.MoveToWorld(from.Location, from.Map);
                    pet.IsStabled = false;
                    pet.Loyalty   = BaseCreature.MaxLoyalty;                   // Wonderfully Happy

                    from.Stabled.RemoveAt(i);
                    --i;

                    ((Mobile)pet).Language = null;
                    Server.Mobiles.BaseMount.Ride(((BaseMount)pet), from);
                    hasMount = true;
                }
                else if (pet == bc)
                {
                    ((Mobile)pet).Language = null;
                }
            }

            Server.Mobiles.AnimalTrainer.CleanClaimList(from);

            if (!hasMount)
            {
                ArrayList ethy = new ArrayList();
                foreach (Item item in World.Items.Values)
                {
                    if (item is EtherealMount)
                    {
                        if (((EtherealMount)item).Owner == from)
                        {
                            ((EtherealMount)item).Rider = from;
                            ((EtherealMount)item).Owner = from;
                        }
                    }
                }
            }
        }
		public void EndClaimList( Mobile from, BaseCreature pet )
		{
			if ( pet == null || pet.Deleted || from.Map != this.Map || !from.InRange( this, 14 ) || !from.Stabled.Contains( pet ) || !from.CheckAlive() )
				return;

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

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

				pet.ControlTarget = from;
				pet.ControlOrder = OrderType.Follow;

				pet.MoveToWorld( from.Location, from.Map );

				pet.IsStabled = false;
				from.Stabled.Remove( pet );

				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.
			}
		}
Beispiel #6
0
		public static bool Summon( BaseCreature creature, bool controlled, Mobile caster, Point3D p, int sound, TimeSpan duration )
		{
			if ( caster.Followers + creature.ControlSlots > caster.FollowersMax )
			{
				caster.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature.
				creature.Delete();
				return false;
			}

			m_Summoning = true;

			if ( controlled )
				creature.SetControlMaster( caster );

			creature.RangeHome = 10;
			creature.Summoned = true;

			creature.SummonMaster = caster;

			Container pack = creature.Backpack;

			if ( pack != null )
			{
				for ( int i = pack.Items.Count - 1; i >= 0; --i )
				{
					if ( i >= pack.Items.Count )
						continue;

					pack.Items[i].Delete();
				}
			}

			new UnsummonTimer( caster, creature, duration ).Start();
			creature.m_SummonEnd = DateTime.Now + duration;

			creature.MoveToWorld( p, caster.Map );

			Effects.PlaySound( p, creature.Map, sound );

			m_Summoning = false;

			return true;
		}
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
			{
				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 );

					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 #8
0
        public static bool Summon( BaseCreature creature, bool controlled, Mobile caster, Point3D p, int sound, TimeSpan duration )
        {
            if ( caster.Followers + creature.ControlSlots > caster.FollowersMax )
            {
                caster.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature.
                creature.Delete();
                return false;
            }

            m_Summoning = true;

            creature.RangeHome = 10;
            creature.Summoned = true;

            if ( controlled )
                creature.SetControlMaster( caster );

            creature.SummonMaster = caster;

            Container pack = creature.Backpack;

            if ( pack != null )
            {
                for ( int i = pack.Items.Count - 1; i >= 0; --i )
                {
                    if ( i >= pack.Items.Count )
                        continue;

                    ( (Item) pack.Items[i] ).Delete();
                }
            }

            double hitsScalar = 1.0 + ( ArcaneEmpowermentSpell.GetSummonHitsBonus( caster ) / 100 );

            if ( hitsScalar != 1.0 )
                creature.SetHits( (int) ( creature.HitsMax * hitsScalar ) );

            new UnsummonTimer( caster, creature, duration ).Start();
            creature.m_SummonEnd = DateTime.Now + duration;

            creature.MoveToWorld( p, caster.Map );

            Effects.PlaySound( p, creature.Map, sound );

            if ( creature is EnergyVortex || creature is BladeSpirits )
                SpellHelper.CheckSummonLimits( creature );

            m_Summoning = false;

            return true;
        }
Beispiel #9
0
        public void EndClaimList(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive() || !m_Stored.ContainsKey(from))
                return;

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

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

                pet.ControlTarget = from;
                pet.ControlOrder = OrderType.Follow;

                pet.MoveToWorld(from.Location, from.Map);

                pet.IsStabled = false;

                if (m_Stored[from].Contains(pet))
                    m_Stored[from].Remove(pet);

                from.SendLocalizedMessage(1042559); // Here you go... and good day to you!
            }
            else
            {
                from.SendLocalizedMessage(1049612, pet.Name); // ~1_NAME~ remained in the stables because you have too many followers.
            }
        }
		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 #11
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!
                }
            }
        }
Beispiel #12
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 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 >= Server.Mobiles.AnimalTrainer.GetMaxStabled(from))
            {
                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.Language      = null;
                    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);

                    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 #13
0
        public void Claim(Mobile from)
        {
            if (Deleted || !from.CheckAlive())
            {
                return;
            }

            bool claimed = false;
            int  stabled = 0;

            for (int i = 0; i < from.Stabled.Count; ++i)
            {
                BaseCreature pet = from.Stabled[i] as BaseCreature;

                if (pet == null || pet.Deleted)
                {
                    pet.IsStabled = false;
                    from.Stabled.RemoveAt(i);
                    --i;
                    continue;
                }

                ++stabled;

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

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

                    pet.ControlTarget = from;
                    pet.ControlOrder  = OrderType.Follow;

                    pet.MoveToWorld(from.Location, from.Map);

                    pet.IsStabled = false;

                    if (Core.SE)
                    {
                        pet.Loyalty = BaseCreature.MaxLoyalty;                         // Wonderfully Happy
                    }
                    from.Stabled.RemoveAt(i);
                    --i;

                    claimed = true;
                }
                else
                {
                    SayTo(from, 1049612, pet.Name);                       // ~1_NAME~ remained in the stables because you have too many followers.
                }
            }

            if (claimed)
            {
                SayTo(from, 1042559);                   // Here you go... and good day to you!
            }
            else if (stabled == 0)
            {
                SayTo(from, 502671);                   // But I have no animals stabled with me at the moment!
            }
        }
Beispiel #14
0
        public void Target( BaseCreature bc )
        {
            if ( !Caster.CanSee( bc ) )
            {
                Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
            }
            if ( !Caster.InRange( bc, 6 ) )
            {
                Caster.SendLocalizedMessage( 500643 ); // Target is too far away.
            }
            else if ( !Caster.CanBeHarmful( bc ) || !bc.CanBeDamaged() )
            {
                Caster.SendLocalizedMessage( 1074379 ); // You cannot charm that!
            }
            else if ( bc.Controlled || bc.Name == null )
            {
                Caster.SendLocalizedMessage( 1074379 ); // You cannot charm that!
            }
            else if ( bc is BaseChampion || bc.IsParagon || bc is Medusa || bc is Lurg || !SlayerGroup.GetEntryByName( SlayerName.Repond ).Slays( bc ) )
            {
                Caster.SendLocalizedMessage( 1074379 ); // You cannot charm that!
            }
            else if ( CheckSequence() )
            {
                double chance = Caster.Skills[SkillName.Spellweaving].Fixed / 1000;

                chance += ( SpellweavingSpell.GetFocusLevel( Caster ) * 2 ) / 100;

                if ( chance > Utility.RandomDouble() )
                {
                    SpellHelper.Turn( Caster, bc );

                    bc.ControlSlots = 3;

                    bc.ActiveSpeed = 2;
                    bc.PassiveSpeed = 2;

                    bc.Owners.Add( Caster );

                    bc.SetControlMaster( Caster );

                    bc.IsBonded = false;

                    Caster.SendLocalizedMessage( 1072527 ); // You allure the humanoid to follow and protect you.

                    Caster.PlaySound( 0x5C4 );
                }
                else
                {
                    bc.Combatant = Caster;

                    Caster.SendLocalizedMessage( 1072528 ); // The humanoid becomes enraged by your charming attempt and attacks you.

                    Caster.PlaySound( 0x5C5 );
                }
            }

            FinishSequence();
        }
Beispiel #15
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;

                pet.Loyalty = MaxLoyalty; // Wonderfully happy

                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!
            }
        }
		public static void StablePet( PlayerMobile player, BaseCreature pet )
		{
			if ( null == player || null == pet )
				return;

			pet.Internalize();
			pet.ControlTarget = null;
			pet.ControlOrder = OrderType.Stay;
			pet.SetControlMaster( null );
			pet.SummonMaster = null;
			pet.IsStabled = true;
			player.Stabled.Add( pet );
			player.SendMessage( "Your pet has been stabled" );
		}
	//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 void EndStable(Mobile from, BaseCreature pet)
        {
            if (this.Deleted || !from.CheckAlive())
                return;

            else 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.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(1114325); // There is no more room in your chicken coop!
            }
            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);

                    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!
                }
            }
        }
        public static void UnStablePet(Mobile from, BaseCreature pet, Mobile gm)
        {
            if (from == null || from.Deleted || pet == null || pet.Deleted || gm == null || gm.Deleted)
                return;

			if (from.Stabled.Contains(pet))
			{
				gm.SendMessage("Warning: This is a force claiming. Followers count will not be checked!");

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

				pet.ControlTarget = from;
				pet.ControlOrder = OrderType.Follow;

				if (from.Map == Map.Internal)
				{
					gm.MoveToWorld(from.Location, from.Map);
				}
				else
				{
					pet.MoveToWorld(from.Location, from.Map);
				}

				pet.IsStabled = false;
				from.Stabled.Remove(pet);
				//break;
			}
        }
Beispiel #20
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!
            }
            //Pix: 10/7/2004 - allow dead pets to be stabled.
            //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.IOBFollower)               // Don't stable IOB Bretheren
            {
                SayTo(from, "You can't stable your bretheren!");
            }
            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!
                }
            }
        }
        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!
                }
            }
        }
Beispiel #22
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 void EndClaimList( Mobile from, BaseCreature pet )
        {
            if ( pet == null || pet.Deleted || from.Map != this.Map || !from.InRange( this, 14 ) || !from.Stabled.Contains( pet ) || !from.CheckAlive() )
                return;

            pet.SetControlMaster( from );

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

            if ( pet.AIObject != null )
                pet.AIObject.NumCommands = 0;
            pet.ControlTarget = from;
            pet.ControlOrder = OrderType.Follow;

            pet.Location = from.Location;
            pet.Map = from.Map;

            pet.IsStabled = false;
            from.Stabled.Remove( pet );

            SayTo( from, 1042559 ); // Here you go... and good day to you!
        }
        public static void StablePet(Mobile from, BaseCreature pet)
        {
            if (pet == null || pet.Deleted || !(pet is BaseCreature) || 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 >= Server.Mobiles.AnimalTrainer.GetMaxStabled(owner))
					from.SendMessage("Warning: The owner has not enough free stable slots. Forcing GM stable...");

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

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

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

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

				from.SendMessage("The pet is now stabled.");
			}
        }
        public void EndStable( Mobile from, BaseCreature pet )
        {
            if ( Deleted || !from.CheckAlive() )
                return;

            int maxStabled = GetMaxStabled( from );
            int newCount = GetNumStabled( from ) + GetStableSlotsFor( from, pet );

            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.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 ( newCount > maxStabled )
            {
                //SayTo( from, 1042565 ); // You have too many pets in the stables!
                SayTo( from, "There is not enough room in the stable for that!  Claim some of your other animals first." );
            }
            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 #26
0
		private void ShrinkPet( BaseCreature pet )
		{
			m_Pet = pet;
			m_Owner = pet.ControlMaster;
				
			if ( ShrinkConfig.LootStatus == ShrinkConfig.BlessStatus.All
				|| ( m_Pet.IsBonded && ShrinkConfig.LootStatus == ShrinkConfig.BlessStatus.BondedOnly ))
				LootType = LootType.Blessed;
			else
				LootType = LootType.Regular;

			m_Pet.Internalize();
			m_Pet.SetControlMaster( null );
			m_Pet.ControlOrder = OrderType.Stay;
			m_Pet.SummonMaster = null;
			m_Pet.IsStabled = true;

			if ( pet is IEvoCreature )
				((IEvoCreature)m_Pet).OnShrink( this );
		}
Beispiel #27
0
        private static void SendAway( BaseCreature b )
        {
            b.Controlled = true;	//To make it so It won't still be a part of a spawner.
            b.SetControlMaster( null );
            b.SummonMaster = null;
            b.Internalize();

            if ( ShrinkConfig.ResetBondingStatus )
                b.IsBonded = false;

            if( !ShrinkConfig.RetainBondingTimer )
                b.BondingBegin = DateTime.MinValue;

            b.OwnerAbandonTime = DateTime.MinValue;

            b.IsStabled = true;
        }
Beispiel #28
0
		private void DoClaim( Mobile from, BaseCreature pet )
		{
			pet.SetControlMaster( from );

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

			pet.ControlTarget = from;
			pet.ControlOrder = OrderType.Follow;

			pet.MoveToWorld( from.Location, from.Map );

			pet.IsStabled = false;
            pet.StabledBy = null;

			if ( Core.SE )
				pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully Happy
		}
		public static void BeginFollow( BaseCreature quester, PlayerMobile pm )
		{
			quester.ControlSlots = 0;
			quester.SetControlMaster( pm );

			quester.ActiveSpeed = 0.1;
			quester.PassiveSpeed = 0.2;

			quester.ControlOrder = OrderType.Follow;
			quester.ControlTarget = pm;

			quester.CantWalk = false;
			quester.CurrentSpeed = 0.1;
		}
Beispiel #30
0
		private static void SendAway( BaseCreature b )
		{
			b.SetControlMaster( null );
			b.SummonMaster = null;
			b.Internalize();
			b.IsStabled = true;	
		}
		public static void EndFollow( BaseCreature quester )
		{
			quester.ActiveSpeed = 0.2;
			quester.PassiveSpeed = 1.0;

			quester.ControlOrder = OrderType.None;
			quester.ControlTarget = null;

			quester.CurrentSpeed = 1.0;

			quester.SetControlMaster( null );

			if ( quester is BaseEscortable )
				( (BaseEscortable)quester ).BeginDelete();
		}
Beispiel #32
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!
			}
			//Pix: 10/7/2004 - allow dead pets to be stabled.
			//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.IOBFollower ) // Don't stable IOB Bretheren
			{
				SayTo( from, "You can't stable your bretheren!" );
			}
			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 #33
0
        public void Target(BaseCreature bc)
        {
            if (!this.Caster.CanSee(bc.Location) || !this.Caster.InLOS(bc))
            {
                this.Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (!IsValidTarget(bc))
            {
                this.Caster.SendLocalizedMessage(1074379); // You cannot charm that!
            }
            else if (this.Caster.Followers + 3 > this.Caster.FollowersMax)
            {
                this.Caster.SendLocalizedMessage(1049607); // You have too many followers to control that creature.
            }
            else if (bc.Allured)
            {
                this.Caster.SendLocalizedMessage(1074380); // This humanoid is already controlled by someone else.
            }
            else if (this.CheckSequence())
            {
                int level = GetFocusLevel(this.Caster);
                double skill = this.Caster.Skills[this.CastSkill].Value;

                double chance = (skill / 150.0) + (level / 50.0);

                if (chance > Utility.RandomDouble())
                {
                    bc.ControlSlots = 3;
                    bc.Combatant = null;

                    if (this.Caster.Combatant == bc)
                    {
                        this.Caster.Combatant = null;
                        this.Caster.Warmode = false;
                    }

                    if (bc.SetControlMaster(this.Caster))
                    {
                        bc.PlaySound(0x5C4);
                        bc.Allured = true;

                        Container pack = bc.Backpack;

                        if (pack != null)
                        {
                            for (int i = pack.Items.Count - 1; i >= 0; --i)
                            {
                                if (i >= pack.Items.Count)
                                    continue;

                                pack.Items[i].Delete();
                            }
                        }

                        this.Caster.SendLocalizedMessage(1074377); // You allure the humanoid to follow and protect you.
                    }
                }
                else
                {
                    bc.PlaySound(0x5C5);
                    bc.ControlTarget = this.Caster;
                    bc.ControlOrder = OrderType.Attack;
                    bc.Combatant = this.Caster;

                    this.Caster.SendLocalizedMessage(1074378); // The humanoid becomes enraged by your charming attempt and attacks you.
                }
            }

            this.FinishSequence();
        }