当前位置: 首页>>代码示例>>C#>>正文


C# Mobile.AddToBackpack方法代码示例

本文整理汇总了C#中Mobile.AddToBackpack方法的典型用法代码示例。如果您正苦于以下问题:C# Mobile.AddToBackpack方法的具体用法?C# Mobile.AddToBackpack怎么用?C# Mobile.AddToBackpack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mobile的用法示例。


在下文中一共展示了Mobile.AddToBackpack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnDoubleClick

		//public override bool DisplayLootType{ get{ return true; } }

		public override void OnDoubleClick( Mobile from ) // Override double click of the deed to call our target
		{
			if ( !IsChildOf( from.Backpack ) ) // Make sure its in their pack
			{
				 from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
			else
			{
		 		this.Delete(); 
				from.SendMessage( "The item has been placed in your backpack." );
				switch ( Utility.Random( 5 ) ) //Random chance of armor 
                        	{ 
                          		case 0: from.AddToBackpack( new Vicodin( ) ); 
                          		break; 
                          		case 1: from.AddToBackpack( new Vicodin( ) ); 
                          		break; 
                          		case 2: from.AddToBackpack( new Vicodin( ) ); 
                          		break; 
                          		case 3: from.AddToBackpack( new Vicodin( ) ); 
                          		break; 
                          		case 4: from.AddToBackpack( new Vicodin( ) ); 
                          		break; 
                        	} 

			 }
		}	
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:28,代码来源:Prescription+Vicodin.cs

示例2: Chop

		private void Chop( Mobile from )
		{
			from.SendMessage( "You make sure no one is looking and rip the gift open!" );

			switch (Utility.Random(12))  //picks one of the following
                {
                    case 0:
                        from.AddToBackpack( new HolidayRose() ); break;
                    case 1:
                        from.AddToBackpack( new SnowDrift() ); break;
                  	case 2:
                        from.AddToBackpack( new SantasReindeer1() ); break;
                    case 3:
                        from.AddToBackpack( new SantasReindeer3() ); break;
                    case 4:
                        from.AddToBackpack( new HolidayRose() ); break;
                    case 5:
                        from.AddToBackpack( new SantasBoots() ); break;
                    case 6:
                        from.AddToBackpack( new HolidayRose() ); break;
                    case 7:
                        from.AddToBackpack( new SantasChairAddonDeed() ); break;
                  	case 8:
                        from.AddToBackpack( new SantasElfBoots() ); break;
                    case 9:
                        from.AddToBackpack( new HolidayRose() ); break;
                    case 10:
                        from.AddToBackpack( new SnowDrift() ); break;
                    case 11:
                        from.AddToBackpack( new HolidayRose() ); break;

                }

			this.Delete();
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:35,代码来源:SantaGifts2012.cs

示例3: OnDragDrop

		public override bool OnDragDrop( Mobile from, Item dropped )
		{
			if (dropped.LootType == LootType.Blessed || dropped.LootType == LootType.Newbied || dropped is Gold || dropped is TrTokens || dropped is BoardingVoucher || dropped is ChaosCoin || dropped is OrderCoin || dropped is GauntletToken || dropped is StarWarToken || dropped is BankCheck || dropped is ImagineNickel || dropped is ShrinkItem || dropped is Key || dropped is Container && TotalItems >= 1)
			{
				from.SendMessage( 38,"You can not trash that for a reward!");
				return false;
			}

            int prize = GetSellPriceFor( dropped );
            int totalPrize = prize;

            while (prize > 65000)
            {
                from.AddToBackpack(new TrTokens(65000));
                prize -= 65000;
            }

			from.AddToBackpack( new TrTokens( prize ) );
			from.SendMessage( 53, "You got {0} silver coins for your trash!", totalPrize);
			dropped.Internalize();
            if (m_TrashedItem != null)
                m_TrashedItem.Delete();
            m_TrashedItem = dropped;
            trashedReward = totalPrize;
			return true;
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:26,代码来源:TrBarrel.cs

示例4: OnUse

        public static TimeSpan OnUse( Mobile m )
        {
            m.RevealingAction();

            if ( m.Target != null )
            {
                m.SendLocalizedMessage( 501845 ); // You are busy doing something else and cannot focus.

                return TimeSpan.FromSeconds( 5.0 );
            }
            else if ( m.Hits < (m.HitsMax / 10) ) // Less than 10% health
            {
                m.SendLocalizedMessage( 501849 ); // The mind is strong but the body is weak.

                return TimeSpan.FromSeconds( 5.0 );
            }
            else if ( m.Mana >= m.ManaMax )
            {
                m.SendLocalizedMessage( 501846 ); // You are at peace.

                return TimeSpan.FromSeconds( 5.0 );
            }
            else
            {
                Item oneHanded = m.FindItemOnLayer( Layer.OneHanded );
                Item twoHanded = m.FindItemOnLayer( Layer.TwoHanded );

                if ( Core.AOS )
                {
                    if ( !CheckOkayHolding( oneHanded ) )
                        m.AddToBackpack( oneHanded );

                    if ( !CheckOkayHolding( twoHanded ) )
                        m.AddToBackpack( twoHanded );
                }
                else if ( !CheckOkayHolding( oneHanded ) || !CheckOkayHolding( twoHanded ) )
                {
                    m.SendLocalizedMessage( 502626 ); // Your hands must be free to cast spells or meditate.

                    return TimeSpan.FromSeconds( 2.5 );
                }

                if ( m.CheckSkill( SkillName.Meditation, 0, 100 ) )
                {
                    m.SendLocalizedMessage( 501851 ); // You enter a meditative trance.
                    m.Meditating = true;

                    if ( m.Player || m.Body.IsHuman )
                        m.PlaySound( 0xF9 );
                }
                else
                {
                    m.SendLocalizedMessage( 501850 ); // You cannot focus your concentration.
                }

                return TimeSpan.FromSeconds( 10.0 );
            }
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:58,代码来源:Meditation.cs

示例5: OnUse

        public static TimeSpan OnUse( Mobile m )
        {
            m.RevealingAction();

            if ( m.Target != null )
            {
                m.SendLocalizedMessage( 501845 ); // You are busy doing something else and cannot focus.

                return TimeSpan.FromSeconds( 5.0 );
            }
            else if ( m.Mana >= m.ManaMax )
            {
                m.SendLocalizedMessage( 501846 ); // You are at peace.

                return TimeSpan.FromSeconds( 10.0 );
            }
            else if ( !RegenRates.AllowMeditation( m ) )
            {
                m.SendLocalizedMessage( 500135 ); // Regenative forces cannot penetrate your armor!

                return TimeSpan.FromSeconds( 10.0 );
            }
            else
            {
                Item oneHanded = m.FindItemOnLayer( Layer.OneHanded );
                Item twoHanded = m.FindItemOnLayer( Layer.TwoHanded );

                if ( !CheckOkayHolding( oneHanded ) )
                    m.AddToBackpack( oneHanded );

                if ( !CheckOkayHolding( twoHanded ) )
                    m.AddToBackpack( twoHanded );

                double skillVal = m.Skills[SkillName.Meditation].Value;
                double chance = ( 75.0 + ( ( skillVal - ( m.ManaMax - m.Mana ) ) * 2 ) ) / 100;

                if ( chance > Utility.RandomDouble() )
                {
                    m.CheckSkill( SkillName.Meditation, 0.0, 100.0 );

                    m.SendLocalizedMessage( 501851 ); // You enter a meditative trance.
                    m.Meditating = true;

                    BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.ActiveMeditation, 1075657 ) );

                    if ( m.IsPlayer || m.Body.IsHuman )
                        m.PlaySound( 0xF9 );
                }
                else
                {
                    m.SendLocalizedMessage( 501850 ); // You cannot focus your concentration.
                }

                return TimeSpan.FromSeconds( 10.0 );
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:56,代码来源:Meditation.cs

示例6: OnDoubleClick

        public override void OnDoubleClick(Mobile from)
        {
            Container pack = from.Backpack;

            if (pack != null && pack.ConsumeTotal(typeof(Gold), 10))
            {
                m_GamblePot += 5;
                InvalidateProperties();

                int roll = Utility.Random(1200);

                if (roll == 0) // Jackpot
                {
                    int maxCheck = 1000000;

                    from.SendMessage(0x35, "You win the {0}gp jackpot!", m_GamblePot);

                    while (m_GamblePot > maxCheck)
                    {
                        from.AddToBackpack(new BankCheck(maxCheck));

                        m_GamblePot -= maxCheck;
                    }

                    from.AddToBackpack(new BankCheck(m_GamblePot));

                    m_GamblePot = 100;
                }
                else if (roll <= 20) // Chance for a regbag
                {
                    from.SendMessage(0x35, "You win a bag of reagents!");
                    from.AddToBackpack(new BagOfReagents(50));
                }
                else if (roll <= 40) // Chance for gold
                {
                    from.SendMessage(0x35, "You win 150gp!");
                    from.AddToBackpack(new BankCheck(150));
                }
                else if (roll <= 100) // Another chance for gold
                {
                    from.SendMessage(0x35, "You win 100gp!");
                    from.AddToBackpack(new BankCheck(100));
                }
                else // Loser!
                {
                    from.SendMessage(0x22, "You lose!");
                }
            }
            else
            {
                from.SendMessage(0x22, "You need at least 10gp in your backpack to use this.");
            }
        }
开发者ID:greeduomacro,项目名称:last-wish,代码行数:53,代码来源:GamblingStone.cs

示例7: OnDoubleClick

        public override void OnDoubleClick(Mobile from)
        {
            if (!this.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1040019); // The bola must be in your pack to use it.
            }
            else if (!from.CanBeginAction(typeof(Bola)))
            {
                from.SendLocalizedMessage(1049624); // You have to wait a few moments before you can use another bola!
            }
            else if (from.Target is BolaTarget)
            {
                from.SendLocalizedMessage(1049631); // This bola is already being used.
            }
            else if (!Core.AOS && (from.FindItemOnLayer(Layer.OneHanded) != null || from.FindItemOnLayer(Layer.TwoHanded) != null))
            {
                from.SendLocalizedMessage(1040015); // Your hands must be free to use this
            }
            else if (from.Mounted)
            {
                from.SendLocalizedMessage(1040016); // You cannot use this while riding a mount
            }
            else if (Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(from))
            {
                from.SendLocalizedMessage(1070902); // You can't use this while in an animal form!
            }
			else if (from.Flying)
			{
				from.SendLocalizedMessage(1113414); // You cannot use this while flying!
			}
            else
            {
                EtherealMount.StopMounting(from);

                if (Core.AOS)
                {
                    Item one = from.FindItemOnLayer(Layer.OneHanded);
                    Item two = from.FindItemOnLayer(Layer.TwoHanded);

                    if (one != null)
                        from.AddToBackpack(one);

                    if (two != null)
                        from.AddToBackpack(two);
                }

                from.Target = new BolaTarget(this);
                from.LocalOverheadMessage(MessageType.Emote, 0x3B2, 1049632); // * You begin to swing the bola...*
                from.NonlocalOverheadMessage(MessageType.Emote, 0x3B2, 1049633, from.Name); // ~1_NAME~ begins to menacingly swing a bola...
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:51,代码来源:Bola.cs

示例8: LootItem

 public override bool LootItem(Mobile from)
 {
     if (Utility.RandomDouble() <= .05)
     {
         OnionSeed item = new OnionSeed();
         from.AddToBackpack(item);
         from.SendMessage("You manage to gather 1 onion seed.");
     }
     Onion c = new Onion();
     c.ItemID = 3182;
     from.AddToBackpack(c);
     from.SendMessage("You manage to gather 1 onion.");
     return true;
 }
开发者ID:FreeReign,项目名称:FarmSystem,代码行数:14,代码来源:GrowableOnion.cs

示例9: LootItem

 public override bool LootItem(Mobile from)
 {
     if (Utility.RandomDouble() <= .05)
     {
         GarlicSeed item = new GarlicSeed();
         from.AddToBackpack(item);
         from.SendMessage("You manage to gather 1 garlic seed.");
     }
     Garlic c = new Garlic();
     c.ItemID = 3972;
     from.AddToBackpack(c);
     from.SendMessage("You manage to gather 1 garlic.");
     return true;
 }
开发者ID:FreeReign,项目名称:FarmSystem,代码行数:14,代码来源:GrowableGarlic.cs

示例10: LootItem

 public override bool LootItem(Mobile from)
 {
     if (Utility.RandomDouble() <= .05)
     {
         CarrotSeed item = new CarrotSeed();
         from.AddToBackpack(item);
         from.SendMessage("You manage to gather 1 carrot seed.");
     }
     Carrot c = new Carrot();
     c.ItemID = 3191;
     from.AddToBackpack(c);
     from.SendMessage("You manage to gather 1 carrot.");
     return true;
 }
开发者ID:FreeReign,项目名称:FarmSystem,代码行数:14,代码来源:GrowableCarrot.cs

示例11: LootItem

 public override bool LootItem(Mobile from)
 {
     if (Utility.RandomDouble() <= .05)
     {
         PumpkinSeed item = new PumpkinSeed();
         from.AddToBackpack(item);
         from.SendMessage("You manage to gather 1 pumpkin seed.");
     }
     Pumpkin c = new Pumpkin();
     c.ItemID = 3178;
     from.AddToBackpack(c);
     from.SendMessage("You manage to gather 1 pumpkin.");
     return true;
 }
开发者ID:FreeReign,项目名称:FarmSystem,代码行数:14,代码来源:GrowablePumpkin.cs

示例12: LootItem

 public override bool LootItem(Mobile from)
 {
     if (Utility.RandomDouble() <= .05)
     {
         MandrakeSeed item = new MandrakeSeed();
         from.AddToBackpack(item);
         from.SendMessage("You manage to gather 1 mandrake seed.");
     }
     MandrakeRoot c = new MandrakeRoot();
     c.ItemID = 3974;
     from.AddToBackpack(c);
     from.SendMessage("You manage to gather 1 mandrake.");
     return true;
 }
开发者ID:FreeReign,项目名称:FarmSystem,代码行数:14,代码来源:GrowableMandrake.cs

示例13: LootItem

 public override bool LootItem(Mobile from)
 {
     if (Utility.RandomDouble() <= .05)
     {
         WheatSeed item = new WheatSeed();
         from.AddToBackpack(item);
         from.SendMessage("You manage to gather 1 wheat seed.");
     }
     WheatSheaf c = new WheatSheaf();
     c.ItemID = 7869;
     from.AddToBackpack(c);
     from.SendMessage("You manage to gather 1 wheat sheaf.");
     return true;
 }
开发者ID:FreeReign,项目名称:FarmSystem,代码行数:14,代码来源:GrowableWheat.cs

示例14: LootItem

 public override bool LootItem(Mobile from)
 {
     if (Utility.RandomDouble() <= .05)
     {
         GinsengSeed item = new GinsengSeed();
         from.AddToBackpack(item);
         from.SendMessage("You manage to gather 1 ginseng seed.");
     }
     Ginseng c = new Ginseng();
     c.ItemID = 3973;
     from.AddToBackpack(c);
     from.SendMessage("You manage to gather 1 ginseng.");
     return true;
 }
开发者ID:FreeReign,项目名称:FarmSystem,代码行数:14,代码来源:GrowableGinseng.cs

示例15: LootItem

 public override bool LootItem(Mobile from)
 {
     if (Utility.RandomDouble() <= .05)
     {
         LettuceSeed item = new LettuceSeed();
         from.AddToBackpack(item);
         from.SendMessage("You manage to gather 1 lettuce seed.");
     }
     Lettuce c = new Lettuce();
     c.ItemID = 3184;
     from.AddToBackpack(c);
     from.SendMessage("You manage to gather 1 lettuce.");
     return true;
 }
开发者ID:FreeReign,项目名称:FarmSystem,代码行数:14,代码来源:GrowableLettuce.cs


注:本文中的Mobile.AddToBackpack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。