ConsumeUse() public method

public ConsumeUse ( Mobile from ) : void
from Mobile
return void
Esempio n. 1
0
        public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
        {
            from.RevealingAction();
            if (!BaseInstrument.CheckMusicianship(from))
            {
                from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.
                instrument.PlayInstrumentBadly(from);
                instrument.ConsumeUse(from);
            }
            else if (!from.CheckSkill(SkillName.Peacemaking, 0.0, 100.0))
            {
                from.SendLocalizedMessage(500613); // You attempt to calm everyone, but fail.
                instrument.PlayInstrumentBadly(from);
                instrument.ConsumeUse(from);
            }
            else
            {
                instrument.PlayInstrumentWell(from);
                instrument.ConsumeUse(from);

                Map map = from.Map;

                if (map != null)
                {
                    int range = BaseInstrument.GetBardRange(from, SkillName.Peacemaking);

                    bool calmed = false;

                    foreach (Mobile m in from.GetMobilesInRange(range))
                    {
                        #region Dueling
                        if (m.Region is Engines.ConPVP.SafeZone)
                            continue;
                        #endregion

                        BaseCreature bc = m as BaseCreature;
                        if ((bc != null && bc.Uncalmable) || m == from || !m.Alive)
                            continue;

                        calmed = true;

                        m.SendLocalizedMessage(500616); // You hear lovely music, and forget to continue battling!
                        m.Combatant = null;
                        if (!m.Player)
                            m.Warmode = false;

                        if (bc != null && !bc.BardPacified)
                            bc.Pacify(from, DateTime.Now + TimeSpan.FromSeconds(2.5));
                    }

                    if (!calmed)
                        from.SendLocalizedMessage(1049648); // You play hypnotic music, but there is nothing in range for you to calm.
                    else
                        from.SendLocalizedMessage(500615); // You play your hypnotic music, stopping the battle.
                }
            }
        }
		public static void OnPickedInstrument( Mobile from, BaseInstrument instrument )
		{
			from.RevealingAction();

      if ( !BaseInstrument.CheckMusicianship( from ) )
      { 
        from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
        instrument.PlayInstrumentBadly( from );
        instrument.ConsumeUse( from );
      }
      else if ( !from.CheckSkill( SkillName.Peacemaking, 0.0, 100.0 ) )
      {
        from.SendLocalizedMessage( 500613 ); // You attempt to calm everyone, but fail.
        instrument.PlayInstrumentBadly( from );
        instrument.ConsumeUse( from );
      }
      else
      {
        instrument.PlayInstrumentWell( from );
        instrument.ConsumeUse( from );

        Map map = from.Map;

        if ( map != null )
        {
          int range = BaseInstrument.GetBardRange( from, SkillName.Peacemaking );

          bool calmed = false;

          foreach ( Mobile m in from.GetMobilesInRange( range ) )
          {
            if ( (m is BaseCreature && ((BaseCreature)m).Uncalmable) || m == from || !from.CanBeHarmful( m, false ) )
              continue;

            calmed = true;

            m.SendLocalizedMessage( 500616 ); // You hear lovely music, and forget to continue battling!
            m.Combatant = null;
            m.Warmode = false;

            if ( m is BaseCreature && !((BaseCreature)m).BardPacified )
              ((BaseCreature)m).Pacify( from, DateTime.Now + TimeSpan.FromSeconds( 1.0 ) );
          }

          if ( !calmed )
            from.SendLocalizedMessage( 1049648 ); // You play hypnotic music, but there is nothing in range...
          else
            from.SendLocalizedMessage( 500615 ); // You play your hypnotic music, stopping the battle.
            
        }
      }
		}
Esempio n. 3
0
        public static void OnPickedInstrument( Mobile from, BaseInstrument instrument )
        {
            //from.RevealingAction();
            //from.SendLocalizedMessage( 1049525 ); // Whom do you wish to calm?
            //from.Target = new InternalTarget( from, instrument );
            //from.NextSkillTime = DateTime.Now + TimeSpan.FromHours( 6.0 );
            from.RevealingAction();

            if ( !instrument.IsChildOf( from.Backpack ) )
            {
                from.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack!
            }
            else
            {
                //m_SetSkillTime = false;
                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 );

                if ( !BaseInstrument.CheckMusicianship( from ) )
                {
                    from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
                    instrument.PlayInstrumentBadly( from );
                    instrument.ConsumeUse( from );
                }
                else if ( !from.CheckSkill( SkillName.Peacemaking, 0.0, 100.0 ) )
                {
                    from.SendLocalizedMessage( 500613 ); // You attempt to calm everyone, but fail.
                    instrument.PlayInstrumentBadly( from );
                    instrument.ConsumeUse( from );
                }
                else
                {
                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 );
                    instrument.PlayInstrumentWell( from );
                    instrument.ConsumeUse( from );

                    Map map = from.Map;

                    if ( map != null )
                    {
                        int range = BaseInstrument.GetBardRange( from, SkillName.Peacemaking );

                        bool calmed = false;

                        foreach ( Mobile m in from.GetMobilesInRange( range ) )
                        {
                            if ( (m is BaseCreature && ((BaseCreature)m).Uncalmable) || m == from || !from.CanBeHarmful( m, false ) )
                                continue;

                            calmed = true;

                            m.SendLocalizedMessage( 500616 ); // You hear lovely music, and forget to continue battling!
                            m.Combatant = null;
                            m.Warmode = false;

                            if ( m is BaseCreature && !((BaseCreature)m).BardPacified )
                                ((BaseCreature)m).Pacify( from, DateTime.Now + TimeSpan.FromSeconds( 1.0 ) );
                        }

                        if ( !calmed )
                            from.SendLocalizedMessage( 1049648 ); // You play hypnotic music, but there is nothing in range for you to calm.
                        else
                            from.SendLocalizedMessage( 500615 ); // You play your hypnotic music, stopping the battle.
                    }
                }
            }
        }
Esempio n. 4
0
		public static void PlayNote( PlayerMobile from, string note, BaseInstrument instrument )
		{
			try
			{
				//Pix: added sanity checks
				if (from == null || instrument == null) return;

				int it = (int)GetInstrumentType(instrument);
				int nv;

				// If Musicianship is not GM, there is a chance of playing a random note.
				if (!BaseInstrument.CheckMusicianship(from))
				{
					instrument.ConsumeUse(from);
					nv = Utility.Random(25);
					//Console.WriteLine("Random note value chosen: {0}", nv );
				}
				else
				{
					nv = (int)GetNoteValue(note);
				}

				//Pix: added bounds checking
				if (nv >= 0 && it >=0 &&
					nv < NoteSounds.Length && it < NoteSounds[nv].Length)
				{
					int sound = NoteSounds[nv][it];

					from.PlaySound(sound, true);
				}
			}
			catch (Exception ex)
			{
				Scripts.Commands.LogHelper.LogException(ex);
			}
		}