Exemple #1
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (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 bool IsProvokable( BaseCreature bc )
 {
     return IsTargeteable( bc ) && !bc.BardImmune && !bc.BardPacified && !bc.IsDeadBondedPet && bc.InRange( this, BaseInstrument.GetBardRange( this, SkillName.Provocation ) );
 }
Exemple #3
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target == from)
                {
                    m_Post.Say("You can't place yourself in a stable!");
                }
                else if (target is PlayerMobile)
                {
                    m_Post.Say("You can't place other players in a stable!");
                }
                else if (target is Item)
                {
                    m_Post.Say("Why would you want to stable an item?");
                }
                else if (Server.Spells.SpellHelper.CheckCombat(from))
                {
                    m_Post.Say("You cannot stable your pet while you're fighting.");
                }
                else if ((target is BaseCreature) && m_Post.Controlled == null)
                {
                    BaseCreature c = (BaseCreature)target;

                    if (c.ControlMaster == null || !c.Controlled)
                    {
                        m_Post.Say("You can only stable a pet that has been tamed.");
                    }
                    if (c.ControlMaster != from && c.Controlled)
                    {
                        m_Post.Say("You can only stable a pet you control.");
                    }
                    else if (c.Summoned)
                    {
                        m_Post.Say("You cannot stable a summoned creature.");
                    }
                    else if (c.Combatant != null && c.InRange(c.Combatant, 12) && c.Map == c.Combatant.Map)
                    {
                        m_Post.Say("Your pet is fighting, You cannot stable it yet.");
                    }
                    else if (c.Controlled && c.ControlMaster == from)
                    {
                        m_Post.Owner    = c.ControlMaster;             //
                        c.ControlMaster = null;                        //
//						m_Post.IsStabled = c.IsStabled;
                        c.IsStabled = true;                            //
                        //	m_Post.IsStabled = true;//
                        //	m_Post.Blessed = c.Blessed;
                        c.Blessed = true;                        //
//						m_Post.Blessed = true; //Note causes the player to become blessed when put pet
//						m_Post.Tamable = c.Tamable;
                        c.Tamable = false;                                                     //
//						m_Post.Tamable = false;//Note I think this will also
                        m_Post.Controlled       = c;                                           //
                        c.Home                  = m_Post.Location;                             //
                        c.RangeHome             = m_Post.HomeRange;                            //
                        m_Post.Loyal            = c.Loyalty;                                   //
                        c.Loyalty               = 100;                                         //
                        m_Post.IsBonded         = c.IsBonded;                                  //
                        m_Post.Mode             = c.FightMode;                                 //
                        c.FightMode             = FightMode.Aggressor;                         //
                        m_Post.Order            = c.ControlOrder;                              //
                        c.ControlOrder          = OrderType.None;                              //
                        c.CurrentSpeed          = 0.5;                                         //
                        m_Post.Command          = c.Controlled;                                //
                        m_Post.BondingBegin     = c.BondingBegin;                              //
                        c.BondingBegin          = DateTime.MaxValue;                           //
                        m_Post.OwnerAbandonTime = c.OwnerAbandonTime;                          //
                        c.OwnerAbandonTime      = DateTime.MaxValue;                           //
                        m_Post.MinTameSkill     = c.MinTameSkill;                              //
                        m_Post.PetName          = c.Name;                                      //
                        c.Name                  = m_Post.Owner.Name + "'s: " + m_Post.PetName; //
                        m_Post.Name             = "In use by: " + m_Post.Owner.Name + " Attached to: " + m_Post.PetName;
                    }
                }
                else if ((target is BaseCreature) && m_Post.Controlled != null)
                {
                    BaseCreature c = null;
                    if (m_Post.Controlled == (BaseCreature)target && m_Post.Owner == from)
                    {
                        c = (BaseCreature)target;
                        if ((from.Followers + c.ControlSlots) > from.FollowersMax)
                        {
                            from.SendMessage(38, "You can not release that creature at this time because you are unable to control it. You would have TO MANY FOLLOWERS.");
                            return;
                        }
                        if (!c.CanBeControlledBy(from))
                        {
                            from.SendMessage(38, "You do not have the required skills to control this pet.");
                            return;
                        }

                        c.ControlMaster = m_Post.Owner;                    //
                        c.Home          = m_Post.Owner.Location;           //
                        c.RangeHome     = 0;                               //
                        c.Loyalty       = m_Post.Loyal;                    //
                        m_Post.Loyal    = 100;                             //
                        c.IsBonded      = m_Post.IsBonded;                 //
                        //	m_Post.IsBonded = false;
                        c.FightMode    = m_Post.Mode;                      //
                        m_Post.Mode    = FightMode.None;
                        c.ControlOrder = m_Post.Order;                     //
                        m_Post.Order   = OrderType.None;
                        c.CurrentSpeed = 0.1;                              //
                        c.Controlled   = m_Post.Command;                   //
                        m_Post.Command = false;                            //
                        //	c.Blessed = m_Post.Blessed;
                        c.Blessed = false;                                 //
//						m_Post.Blessed = false;// Note since the put causes problem no need for it here
                        c.BondingBegin          = m_Post.BondingBegin;     //
                        m_Post.BondingBegin     = DateTime.MaxValue;       //
                        c.OwnerAbandonTime      = m_Post.OwnerAbandonTime; //
                        m_Post.OwnerAbandonTime = DateTime.MaxValue;       //
                        c.MinTameSkill          = m_Post.MinTameSkill;     //
                        m_Post.MinTameSkill     = 0.0;                     //
                        //	c.Tamable = m_Post.Tamable;
                        c.Tamable = true;                                  //
//						m_Post.Tamable = true;// Note since the put causes problem no need for it here
                        //	c.IsStabled = m_Post.IsStabled;
                        c.IsStabled = false;
//						m_Post.IsStabled = false;
                        c.Name            = m_Post.PetName;
                        c.NameMod         = null;
                        m_Post.NameMod    = null;
                        m_Post.Controlled = null;
                        m_Post.Owner      = null;
                        m_Post.Name       = "Hitching Post: Unused.";
                    }
                    else
                    {
                        from.SendMessage(38, "This post already has a creature stabled. (Unstable the other first)");
                    }
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature)
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if (m_Creature.Unprovokable || creature.Unprovokable)
                    {
                        from.SendLocalizedMessage(1049446);                           // You have no chance of provoking those creatures.
                    }
                    else if (m_Creature.Map != creature.Map || !m_Creature.InRange(creature, BaseInstrument.GetBardRange(from, SkillName.Provocation)))
                    {
                        from.SendLocalizedMessage(1049450);                           // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                    }
                    else if (m_Creature != creature)
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                        double diff  = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) * 0.5) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(creature, true))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.SendLocalizedMessage(500612);                                   // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                //from.DoHarmful( m_Creature );
                                //from.DoHarmful( creature );

                                if (!from.CheckTargetSkill(SkillName.Provocation, creature, diff - 25.0, diff + 25.0))
                                {
                                    from.SendLocalizedMessage(501599);                                       // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602);                                       // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell(from);
                                    m_Instrument.ConsumeUse(from);
                                    m_Creature.Provoke(from, creature, true);
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501593);                           // You can't tell someone to attack themselves!
                    }
                }
            }
Exemple #5
0
        public static int UseBandage(BaseCreature from, bool healmaster)
        {
            if (from.IsDeadPet)
                return 12;

            var delay = (500 + (50*((120 - from.Dex)/10)))/100;

            if (delay < 3)
                delay = 3;

            if (from.Controlled && from.ControlMaster != null && from.Hits >= (from.Hits/2) && healmaster)
            {
                if (from.InRange(from.ControlMaster, 2) && from.ControlMaster.Alive &&
                    from.ControlMaster.Hits < from.ControlMaster.HitsMax)
                    BandageContext.BeginHeal(from, from.ControlMaster);
            }
            else if (from.Hits < from.HitsMax)
            {
                BandageContext.BeginHeal(from, from);
            }

            return delay + 3;
        }
Exemple #6
0
        public void DoAbilityMoltenBreath(BaseCreature target, BaseMetaPet pet)
        {
            pet.AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds(1.0);
            pet.PlaySound(pet.BaseSoundID);
            pet.Animate(12, 5, 1, true, false, 0);

            var queue = new EffectQueue();
            queue.Deferred = false;

            Point3D endpoint = target.Location;
            Point3D[] line = pet.Location.GetLine3D(endpoint, pet.Map);

            if (target.InRange(pet.Location, 10))
            {
                int n = 0;
                foreach (Point3D p in line)
                {
                    n += 20;
                    Point3D p1 = p;
                    queue.Add(
                        new EffectInfo(
                            p,
                            pet.Map,
                            14089,
                            0,
                            10,
                            30,
                            EffectRender.Normal,
                            TimeSpan.FromMilliseconds(n),
                            () =>
                            {
                                foreach (Mobile player in AcquireTargets(pet, p1, 0))
                                {
                                    player.Damage(Level * 5, pet);
                                }
                            }));
                }

                queue.Callback = () =>
                {
                    BaseExplodeEffect e = ExplodeFX.Fire.CreateInstance(
                        endpoint, pet.Map, 2, 0, TimeSpan.FromMilliseconds(1000 - ((10) * 100)), null, () =>
                        {
                            foreach (Mobile mobile in AcquireTargets(pet, endpoint, 2))
                            {
                                mobile.Damage(Level * 3, pet);
                            }
                        });
                    e.Send();
                };


                queue.Process();
                Experience++;

                if (Experience >= NextLevelExperience)
                {
                    LevelUpMoltenBreath(pet.ControlMaster);
                }

                NextUse = DateTime.UtcNow + CoolDown;
            }
        }
Exemple #7
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive())
            {
                return;
            }

            if (pet.Body.IsHuman)
            {
                from.SendLocalizedMessage(502672); // HA HA HA! Sorry, I am not an inn.
            }
            else if (!pet.Controlled)
            {
                from.SendLocalizedMessage(1048053); // You can't stable that!
            }
            else if (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.
            }
            else if (pet.Allured)
            {
                from.SendLocalizedMessage(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))
            {
                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 >= AnimalTrainer.GetMaxStabled(from))
            {
                from.SendLocalizedMessage(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 = BaseCreature.MaxLoyalty; // Wonderfully happy

                from.Stabled.Add(pet);

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


      public void EndPetSale( 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 ) 
		SayTo( from, 502673 ); // I can not PetSale summoned creatures. 
	else if ( pet.Body.IsHuman ) 
		SayTo( from, 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 ) 
            SayTo( from, 1042564 ); // I'm sorry.  Your pet seems to be busy. 
	else 
	{ 
		if ( pet is Rudolph )
		{
			SellPetForGold( from, pet, 250 );
		    from.AddToBackpack( new ReindeerReward1() );
			this.Say( "Thank you {0}, you have found Rudolph!",from.Name  );
		}
		else if ( pet is Dasher )
		{
			SellPetForGold(from, pet, 250 );
			from.AddToBackpack( new ReindeerReward2() );
			this.Say( "Thank you {0}, you have found Dasher!",from.Name  );
		}
		else if ( pet is Dancer )
		{
			SellPetForGold(from, pet, 250 );
			from.AddToBackpack( new ReindeerReward3() );
			this.Say( "Thank you {0}, you have found Dancer!",from.Name  );
		}
        else if ( pet is Prancer )
        {
			SellPetForGold(from, pet, 250 );
        	from.AddToBackpack( new ReindeerReward4() );
        	this.Say( "Thank you {0}, you have found Prancer!",from.Name  );
        }
        else if ( pet is Vixen )
        {
			SellPetForGold(from, pet, 250 );
        	from.AddToBackpack( new ReindeerReward5() );
        	this.Say( "Thank you {0}, you have found Vixen!",from.Name  );
        }
        else if ( pet is Comet ) 
        {
			SellPetForGold(from, pet, 250 );
        	from.AddToBackpack( new ReindeerReward6() );
        	this.Say( "Thank you {0}, you have found Comet!",from.Name  );
        }
        else if ( pet is Cupid )
        {
			SellPetForGold(from, pet, 250 );
        	from.AddToBackpack( new ReindeerReward7() );
        	this.Say( "Thank you {0}, you have found Cupid!",from.Name  );
        }
        else if ( pet is Donner )
        {
			SellPetForGold(from, pet, 250 );
        	from.AddToBackpack( new ReindeerReward8() );
        	this.Say( "Thank you {0}, you have found Donner!",from.Name  );
        }
		else if ( pet is Blitzen )
		{
			SellPetForGold( from, pet, 250 );
			from.AddToBackpack( new ReindeerReward9() );
			this.Say( "Thank you {0}, you have found Blitzen!",from.Name  );
		}
		else 
		
			this.Say( "{0}, that is not one of my lost reindeer...*sigh*.",from.Name  );
		
	}
			
      }
Exemple #9
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature || (from is BaseCreature && ((BaseCreature)from).CanProvoke))
                {
                    BaseCreature creature = targeted as BaseCreature;
                    Mobile       target   = targeted as Mobile;

                    bool questTargets = QuestTargets(creature, from);

                    if (!m_Instrument.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if (m_Creature.Unprovokable)
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else if (creature != null && creature.Unprovokable && !(creature is DemonKnight) && !questTargets)
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else if (m_Creature.Map != target.Map ||
                             !m_Creature.InRange(target, BaseInstrument.GetBardRange(from, SkillName.Provocation)))
                    {
                        from.SendLocalizedMessage(1049450);
                        // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                    }
                    else if (m_Creature != target)
                    {
                        from.NextSkillTime = Core.TickCount + 10000;

                        double diff         = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(target)) * 0.5) - 5.0;
                        double music        = from.Skills[SkillName.Musicianship].Value;
                        int    masteryBonus = 0;

                        if (from is PlayerMobile)
                        {
                            masteryBonus = Spells.SkillMasteries.BardSpell.GetMasteryBonus((PlayerMobile)from, SkillName.Provocation);
                        }

                        if (masteryBonus > 0)
                        {
                            diff -= (diff * ((double)masteryBonus / 100));
                        }

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (questTargets || (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(target, true)))
                        {
                            if (from.Player && !BaseInstrument.CheckMusicianship(from))
                            {
                                from.NextSkillTime = Core.TickCount + (10000 - ((masteryBonus / 5) * 1000));
                                from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                //from.DoHarmful( m_Creature );
                                //from.DoHarmful( creature );
                                if (!from.CheckTargetSkill(SkillName.Provocation, target, diff - 25.0, diff + 25.0))
                                {
                                    from.NextSkillTime = Core.TickCount + (10000 - ((masteryBonus / 5) * 1000));
                                    from.SendLocalizedMessage(501599); // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell(from);
                                    m_Instrument.ConsumeUse(from);
                                    m_Creature.Provoke(from, target, true);

                                    #region Bard Mastery Quest
                                    if (questTargets)
                                    {
                                        BaseQuest quest = QuestHelper.GetQuest((PlayerMobile)from, typeof(IndoctrinationOfABattleRouserQuest));

                                        if (quest != null)
                                        {
                                            foreach (BaseObjective objective in quest.Objectives)
                                            {
                                                objective.Update(creature);
                                            }
                                        }
                                    }
                                    #endregion
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501593); // You can't tell someone to attack themselves!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501589); // You can't incite that!
                }
            }
Exemple #10
0
        public void DoAbilityMoltenBreath(BaseCreature target, BaseMetaPet pet)
        {
            pet.AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds(1.0);
            pet.PlaySound(pet.BaseSoundID);
            pet.Animate(12, 5, 1, true, false, 0);

            var queue = new EffectQueue();

            queue.Deferred = false;

            Point3D endpoint = target.Location;

            Point3D[] line = pet.Location.GetLine3D(endpoint, pet.Map);

            if (target.InRange(pet.Location, 10))
            {
                int n = 0;
                foreach (Point3D p in line)
                {
                    n += 20;
                    Point3D p1 = p;
                    queue.Add(
                        new EffectInfo(
                            p,
                            pet.Map,
                            14089,
                            0,
                            10,
                            30,
                            EffectRender.Normal,
                            TimeSpan.FromMilliseconds(n),
                            () =>
                    {
                        foreach (Mobile player in AcquireTargets(pet, p1, 0))
                        {
                            player.Damage(Level * 5, pet);
                        }
                    }));
                }

                queue.Callback = () =>
                {
                    BaseExplodeEffect e = ExplodeFX.Fire.CreateInstance(
                        endpoint, pet.Map, 2, 0, TimeSpan.FromMilliseconds(1000 - ((10) * 100)), null, () =>
                    {
                        foreach (Mobile mobile in AcquireTargets(pet, endpoint, 2))
                        {
                            mobile.Damage(Level * 3, pet);
                        }
                    });
                    e.Send();
                };


                queue.Process();
                Experience++;

                if (Experience >= NextLevelExperience)
                {
                    LevelUpMoltenBreath(pet.ControlMaster);
                }

                NextUse = DateTime.UtcNow + CoolDown;
            }
        }
        protected override void OnTarget(Mobile from, object target)
        {
            ShrinkPotion pot  = null;
            HitchingPost post = null;

            if (m_ShrinkTool is ShrinkPotion)
            {
                pot = (ShrinkPotion)m_ShrinkTool;
            }
            else if (m_ShrinkTool is HitchingPost)
            {
                post = (HitchingPost)m_ShrinkTool;
            }


            if (!m_StaffCommand)
            {
                if (pot != null)
                {
                    if (!from.InRange(pot.GetWorldLocation(), 1))
                    {
                        from.SendAsciiMessage("You are too far away from the shrink potion");
                        return;
                    }
                }
                else if (post != null)
                {
                    if (!from.InRange(post.GetWorldLocation(), 1))
                    {
                        from.SendAsciiMessage("You are too far away from the hitching post");
                        return;
                    }
                }
            }

            BaseCreature pet = target as BaseCreature;

            if (target == from)
            {
                from.SendMessage("You cannot shrink yourself!");
            }

            else if (target is Item)
            {
                from.SendMessage("You cannot shrink that!");
            }

            else if (target is PlayerMobile)
            {
                from.SendMessage("That person gives you a dirty look!");
            }

            else if (SpellHelper.CheckCombat(from))
            {
                from.SendMessage("You cannot shrink your pet while you are fighting.");
            }

            else if (null == pet)
            {
                from.SendMessage("That is not a pet!");
            }

            else if ((pet.BodyValue == 400 || pet.BodyValue == 401) && pet.Controlled == false)
            {
                from.SendMessage("That person gives you a dirty look!");
            }

            else if (pet.IsDeadPet)
            {
                from.SendMessage("You cannot shrink the dead!");
            }

            else if (pet.Summoned)
            {
                from.SendMessage("You cannot shrink a summoned creature!");
            }

            else if (!m_StaffCommand && pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                from.SendMessage("Your pet is fighting; you cannot shrink it yet.");
            }

            else if (pet.BodyMod != 0)
            {
                from.SendMessage("You cannot shrink your pet while it is polymorphed.");
            }

            else if (!m_StaffCommand && pet.Controlled == false)
            {
                from.SendMessage("You cannot not shrink wild creatures.");
            }

            else if (!m_StaffCommand && pet.ControlMaster != from)
            {
                from.SendMessage("That is not your pet.");
            }

            else if (!m_StaffCommand && ShrinkItem.IsPackAnimal(pet) && (null != pet.Backpack && pet.Backpack.Items.Count > 0))
            {
                from.SendMessage("You must unload this pet's pack before it can be shrunk.");
            }
            //
            else if (target is YoungNightmare)
            {
                from.SendMessage("The creature refuses!");
            }
            //
            else
            {
                if (pet.ControlMaster != from && !pet.Controlled)
                {
                    ISpawner se = pet.Spawner;
                    if (se != null && se.UnlinkOnTaming)
                    {
                        pet.Spawner.Remove(pet);
                        pet.Spawner = null;
                    }

                    pet.CurrentWayPoint = null;
                    pet.ControlMaster   = from;
                    pet.Controlled      = true;
                    pet.ControlTarget   = null;
                    pet.ControlOrder    = OrderType.Come;
                    pet.Guild           = null;
                    pet.Delta(MobileDelta.Noto);
                }

                IEntity p1 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z), from.Map);
                IEntity p2 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);

                Effects.SendMovingParticles(p2, p1, ShrinkTable.Lookup(pet), 1, 0, true, false, 0, 3, 1153, 1, 0, EffectLayer.Head, 0x100);
                from.PlaySound(492);
                from.AddToBackpack(new ShrinkItem(pet));

                if (!m_StaffCommand && m_ShrinkTool != null)
                {
                    if (m_ShrinkTool.ShrinkCharges > 0)
                    {
                        m_ShrinkTool.ShrinkCharges--;
                    }

                    if (m_ShrinkTool.ShrinkCharges <= 0 && m_ShrinkTool is ShrinkPotion)
                    {
                        ((ShrinkPotion)m_ShrinkTool).Consume(1);
                    }
                }
            }
        }
Exemple #12
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive() || !CanUse() || !CheckAccess(from))
            {
                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 (GetCount() >= MaxStables)
            {
                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
                }
                if (!m_Stored.ContainsKey(from))
                {
                    m_Stored.Add(from, new List <BaseCreature>());
                }

                if (!m_Stored[from].Contains(pet))
                {
                    m_Stored[from].Add(pet);
                }

                from.SendMessage("Your chicken has been stabled.");
                //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!
                //}
            }
        }
Exemple #13
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature || (from is BaseCreature && ((BaseCreature)from).CanProvoke))
                {
                    BaseCreature creature = targeted as BaseCreature;
                    Mobile       target   = targeted as Mobile;

                    if (!m_Instrument.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1062488);                         // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if (m_Creature.Unprovokable)
                    {
                        from.SendLocalizedMessage(1049446);                         // You have no chance of provoking those creatures.
                    }
                    else if (creature != null && creature.Unprovokable && !(creature is DemonKnight))
                    {
                        from.SendLocalizedMessage(1049446);                         // You have no chance of provoking those creatures.
                    }
                    else if (m_Creature.Map != target.Map ||
                             !m_Creature.InRange(target, BaseInstrument.GetBardRange(from, SkillName.Provocation)))
                    {
                        from.SendLocalizedMessage(1049450);
                        // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                    }
                    else if (m_Creature != target)
                    {
                        from.NextSkillTime = Core.TickCount + 10000;

                        double diff  = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(target)) * 0.5) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        diff += (XmlMobFactions.GetScaledFaction(from, m_Creature, -25, 25, -0.001) +
                                 XmlMobFactions.GetScaledFaction(from, target, -25, 25, -0.001)) * 0.5;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(target, true))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.NextSkillTime = Core.TickCount + 5000;
                                from.SendLocalizedMessage(500612);                                 // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                //from.DoHarmful( m_Creature );
                                //from.DoHarmful( creature );
                                if (!from.CheckTargetSkill(SkillName.Provocation, target, diff - 25.0, diff + 25.0))
                                {
                                    from.NextSkillTime = Core.TickCount + 5000;
                                    from.SendLocalizedMessage(501599);                                     // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602);                                     // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell(from);
                                    m_Instrument.ConsumeUse(from);
                                    m_Creature.Provoke(from, target, true);
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501593);                         // You can't tell someone to attack themselves!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501589);                     // You can't incite that!
                }
            }
        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!
                }
            }
        }
            protected override void OnTarget(Mobile from, object target)
            {
                if (target == from)
                {
                    from.SendMessage("You cant shrink yourself!");
                }

                else if (target is PlayerMobile)
                {
                    from.SendMessage("That person gives you a dirty look.");
                }

                else if (target is Item)
                {
                    from.SendMessage("You can only shrink pets that you own");
                }

                else if (target is BaseBioCreature && FSATS.EnableBioShrink == false)
                {
                    from.SendMessage("Unnatural creatures cannot be shrunk");
                }

                else if (Server.Spells.SpellHelper.CheckCombat(from))
                {
                    from.SendMessage("You cannot shrink your pet while your fighting.");
                }

                else if (target is PersonalAttendant)
                {
                    from.SendMessage("Really! Stop that! Can't be done!");
                }

                else if (target is BaseCreature)
                {
                    BaseCreature c = (BaseCreature)target;

                    bool   packanimal = false;
                    Type   typ        = c.GetType();
                    string nam        = typ.Name;

                    foreach (string ispack in FSATS.PackAnimals)
                    {
                        if (ispack == nam)
                        {
                            packanimal = true;
                        }
                    }

                    if (c.BodyValue == 400 || c.BodyValue == 401 && c.Controlled == false)
                    {
                        from.SendMessage("That person gives you a dirty look.");
                    }
                    else if (c.ControlMaster != from && c.Controlled == false)
                    {
                        from.SendMessage("This is not your pet.");
                    }
                    else if (packanimal == true && (c.Backpack != null && c.Backpack.Items.Count > 0))
                    {
                        from.SendMessage("You must unload your pets backpack first.");
                    }
                    else if (c.IsDeadPet)
                    {
                        from.SendMessage("You cannot shrink the dead.");
                    }
                    else if (c.Summoned)
                    {
                        from.SendMessage("You cannot shrink a summoned creature.");
                    }
                    else if (c.Allured == true)
                    {
                        from.SendMessage("You cannot shrink an allured creature!");
                    }
                    else if (c.Combatant != null && c.InRange(c.Combatant, 12) && c.Map == c.Combatant.Map)
                    {
                        from.SendMessage("Your pet is fighting, You cannot shrink it yet.");
                    }
                    else if (c.BodyMod != 0)
                    {
                        from.SendMessage("You cannot shrink your pet while its polymorphed.");
                    }
                    //else if ( Server.Spells.LostArts.CharmBeastSpell.IsCharmed( c ) )
                    //{
                    //	from.SendMessage( "Your hold over this pet is not strong enough to shrink it." );
                    //}
                    else if (c.Controlled == true && c.ControlMaster == from)
                    {
                        Type       type = c.GetType();
                        ShrinkItem si   = new ShrinkItem();
                        si.MobType  = type;
                        si.Pet      = c;
                        si.PetOwner = from;

                        if (c is BaseMount)
                        {
                            BaseMount mount = (BaseMount)c;
                            si.MountID = mount.ItemID;
                        }

                        from.AddToBackpack(si);

                        IEntity p1 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z), from.Map);
                        IEntity p2 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);

                        Effects.SendMovingParticles(p2, p1, ShrinkTable.Lookup(c), 1, 0, true, false, 0, 3, 1153, 1, 0, EffectLayer.Head, 0x100);
                        from.PlaySound(492);

                        c.Controlled    = true;
                        c.ControlMaster = null;
                        c.Internalize();

                        c.OwnerAbandonTime = DateTime.MinValue;

                        c.IsStabled = true;

                        m_Powder.Consume();
                        from.AddToBackpack(new Bottle());
                    }
                }
            }
		public static void DoBomber(BaseCreature mobile, Mobile player)
		{
			Mobile combatant = player;

			if ( combatant == null || combatant.Deleted || combatant.Map != mobile.Map || !mobile.InRange( combatant, 12 ) || !mobile.CanBeHarmful( combatant ) || !mobile.InLOS( combatant ) )
				return;

			if ( DateTime.Now >= m_NextBomb )
			{
				ThrowBomb( combatant, player );

				m_Thrown++;

				if ( 0.75 >= Utility.RandomDouble() && (m_Thrown % 2) == 1 )
					m_NextBomb = DateTime.Now + TimeSpan.FromSeconds( 3.0 );
				else
					m_NextBomb = DateTime.Now + TimeSpan.FromSeconds( 5.0 + (10.0 * Utility.RandomDouble()) );
			}
		}
Exemple #17
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive() || !CanUse() || !CheckAccess(from))
            {
                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.
            }
            else if (pet.Allured)
            {
                from.SendLocalizedMessage(1048053); // You can't stable that!
            }
            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 (GetCount() >= MaxStables)
            {
                from.SendLocalizedMessage(1114325); // There is no more room in your chicken coop!
            }
            else
            {
                pet.ControlTarget = null;
                pet.ControlOrder  = OrderType.Stay;
                pet.Internalize();

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

                pet.IsStabled = true;

                pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully happy

                if (!m_Stored.ContainsKey(from))
                {
                    m_Stored.Add(from, new List <BaseCreature>());
                }

                if (!m_Stored[from].Contains(pet))
                {
                    m_Stored[from].Add(pet);
                }

                from.SendMessage("Your chicken has been stabled.");
            }
        }
Exemple #18
0
        public void EndStable( Mobile from, BaseCreature pet )
        {
            if ( Deleted || !from.CheckAlive() )
                return;

            if ( !pet.Controlled || pet.ControlMaster != from )
            {
                SayTo( from, true, "You do not own that pet!" ); // You do not own that pet!
            }
            else if ( pet.IsDeadPet )
            {
                SayTo( from, true, "Living pets only, please." ); // Living pets only, please.
            }
            else if ( pet.Summoned )
            {
                SayTo( from, true, "I can not stable summoned creatures." ); // I can not stable summoned creatures.
            }
            else if ( pet.Body.IsHuman )
            {
                SayTo( from, true, "HA HA HA! Sorry, I am not an inn." ); // 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, true, "You need to unload your pet." ); // You need to unload your pet.
            }
            else if ( pet.Combatant != null && pet.InRange( pet.Combatant, 12 ) && pet.Map == pet.Combatant.Map )
            {
                SayTo( from, true, "I'm sorry.  Your pet seems to be busy." ); // I'm sorry.  Your pet seems to be busy.
            }
            else
            {
                Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerCallback( pet.Delete ) );
                from.Tag = (Convert(from.Tag) - 1).ToString();
                return;
            }
        }
        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!
                }
            }
        }
		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!
				}
			}
		}
Exemple #21
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (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)) || Banker.Withdraw(from, 30, true))
                {
                    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);

                    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!
                }
            }
        }
		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!
				}
			}
		}
Exemple #23
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature)
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if (!m_Instrument.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1062488);                           // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if (creature.UnprovokableTarget)
                    {
                        from.SendLocalizedMessage(1049446);                           // You have no chance of provoking those creatures.
                    }
                    //else if ( m_Creature.Map != creature.Map || !m_Creature.InRange( creature, BaseInstrument.GetBardRange( from, SkillName.Provocation ) ) )
                    else if (m_Creature.Map != creature.Map || !m_Creature.InRange(creature, m_Creature.RangePerception))
                    {
                        from.SendLocalizedMessage(1049450);                           // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                    }
                    else if (m_Creature != creature)
                    {
                        from.NextSkillTime = DateTime.UtcNow + TimeSpan.FromSeconds(7.0);

                        double diff  = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) * 0.35) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(creature, true))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.NextSkillTime = DateTime.UtcNow + TimeSpan.FromSeconds(5.05);
                                from.SendLocalizedMessage(500612);                                   // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                from.DoHarmful(m_Creature, true);
                                from.DoHarmful(creature, true);

                                if (!from.CheckTargetSkill(SkillName.Provocation, creature, diff - 25.0, diff + 25.0))
                                {
                                    from.NextSkillTime = DateTime.UtcNow + TimeSpan.FromSeconds(5.05);
                                    from.SendLocalizedMessage(501599);                                       // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602);                                       // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell(from);
                                    m_Instrument.ConsumeUse(from);
                                    m_Creature.Provoke(from, creature, true);
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501593);                           // You can't tell someone to attack themselves!
                    }
                }
                //allow for targetting a player
                else if (targeted is PlayerMobile)
                {
                    PlayerMobile player = (PlayerMobile)targeted;

                    if (m_Creature.Unprovokable)
                    {
                        from.SendLocalizedMessage(1049446);                           // You have no chance of provoking those creatures.
                    }
                    else if (m_Creature.Map != player.Map ||
                             !m_Creature.InRange(player, BaseInstrument.GetBardRange(from, SkillName.Provocation)))
                    {
                        from.SendLocalizedMessage(1049450);                           // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                        from.Target = new InternalFirstTarget(from, m_Instrument);
                    }
                    else                                                                   //valid pair
                    {
                        from.NextSkillTime = DateTime.UtcNow + TimeSpan.FromSeconds(10.0); //Appropriate skill delay for player provoke

                        double diff  = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(player)) * 0.5) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(player, true))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.SendLocalizedMessage(500612);                                   // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                from.DoHarmful(m_Creature);
                                from.DoHarmful(player);

                                if (!from.CheckTargetSkill(SkillName.Provocation, player, diff - 25.0, diff + 25.0))
                                {
                                    from.SendLocalizedMessage(501599);                                       // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602);                                       // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell(from);
                                    m_Instrument.ConsumeUse(from);
                                    m_Creature.Provoke(from, player, true);
                                }
                            }
                        }
                    }
                }                //end of else (target is player)

                else
                {
                    from.SendLocalizedMessage(501589);                       // You can't incite that!
                }
            }