當前位置: 首頁>>代碼示例>>C#>>正文


C# BaseInstrument.IsChildOf方法代碼示例

本文整理匯總了C#中Server.Items.BaseInstrument.IsChildOf方法的典型用法代碼示例。如果您正苦於以下問題:C# BaseInstrument.IsChildOf方法的具體用法?C# BaseInstrument.IsChildOf怎麽用?C# BaseInstrument.IsChildOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.Items.BaseInstrument的用法示例。


在下文中一共展示了BaseInstrument.IsChildOf方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnPickedInstrument

        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.
                    }
                }
            }
        }
開發者ID:guy489,項目名稱:runuot2a,代碼行數:66,代碼來源:Peacemaking.cs

示例2: OnPickedInstrument

		public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
		{
			PlayerMobile pm = (PlayerMobile)from;

			if (!instrument.IsChildOf(from.Backpack))
			{
				from.SendLocalizedMessage(1042001); //This must be in your backpack
			}
			else if (instrument is Drums || instrument is Tambourine || instrument is TambourineTassel)
			{
				from.SendMessage("You cannot play a tune on that instrument.");
				BaseInstrument.SetInstrument(from, null);
			}
			else if (!pm.Playing) // If this is a new tune, create a new timer and start it.
			{
				from.Emote("*plays a tune*"); // Player emotes to indicate they are playing
				pm.Playing = true;
				PlayTimer pt = new PlayTimer(pm);
				pt.Start();
			}
		}
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:21,代碼來源:Play.cs


注:本文中的Server.Items.BaseInstrument.IsChildOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。