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


C# Backpack.AddItem方法代码示例

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


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

示例1: Chicken

        public Chicken()
            : base(AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
        {
            Name = Strings.Animal("chicken");
            Body = 0xD0;
            BaseSoundID = 0x6E;

            SetStr( 5 );
            SetDex( 15 );
            SetInt( 5 );

            SetHits( 3 );
            SetMana( 0 );

            SetDamage( 1 );

            SetDamageType( ResistanceType.Physical, 100 );

            SetResistance( ResistanceType.Physical, 1, 5 );

            SetSkill( SkillName.MagicResist, 4.0 );
            SetSkill( SkillName.Tactics, 5.0 );
            SetSkill( SkillName.Wrestling, 5.0 );

            Fame = 150;
            Karma = 0;

            VirtualArmor = 2;

            Tamable = true;
            ControlSlots = 1;
            MinTameSkill = -0.9;

            // Get some Chicken Legs
            Backpack pack = new Backpack();
            pack.Movable = false;
            pack.AddItem(new ChickenLeg(2));
            pack.Layer = Layer.Backpack;
            AddItem(pack);

            FarmingSystemCore.Chickens.Add(Serial, this);
        }
开发者ID:FreeReign,项目名称:runuo-extended,代码行数:42,代码来源:Chicken.cs

示例2: MilitiaWarrior

		public MilitiaWarrior()
			: base( AIType.AI_Melee, FightMode.Closest, 12, 1, 0.2, 0.4 )
		{
			Body = 0x190;
			Hue = Utility.RandomSkinHue();
			Name = NameList.RandomName( "male" ) + ",";
			Title = "the militia fighter";

			HairItemID = Hair.ShortHair;
			HairHue = Utility.RandomHairHue();

			EquipItems( this );

			SetDex( 95, 115 );
			SetInt( 40, 50 );
			SetStr( 300, 375 );

			SetHits( 250, 325 );

			SetDamage( 15, 20 );

			SetResistance( ResistanceType.Cold, 30, 40 );
			SetResistance( ResistanceType.Energy, 30, 40 );
			SetResistance( ResistanceType.Fire, 35, 50 );
			SetResistance( ResistanceType.Physical, 45, 60 );
			SetResistance( ResistanceType.Poison, 10, 25 );

			SetSkill( SkillName.Anatomy, 60.0, 75.0 );
			SetSkill( SkillName.Healing, 85.0, 95.0 );
			SetSkill( SkillName.MagicResist, 85.0, 100.0 );
			SetSkill( SkillName.Parry, 80.0, 100.0 );
			SetSkill( SkillName.Swords, 90.0, 100.0 );
			SetSkill( SkillName.Tactics, 95.0, 105.0 );
			SetSkill( SkillName.Wrestling, 80.0, 95.0 );

			Backpack pack = new Backpack();
			pack.AddItem( new Bandage( Utility.RandomMinMax( 100, 200 ) ) );

			this.AddItem( pack );
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:40,代码来源:MilitiaWarrior.cs

示例3: PackToBank

        /// <summary>
        /// Moves all of the given Mobile's items to their bank.
        /// </summary>
        public virtual void PackToBank( Mobile m )
        {
            if( m == null || !m.Player )
                return;

            BankBox bank = m.FindBankNoCreate();
            Backpack pack = new Backpack();
            pack.Hue = 1157;

            List<Item> items = new List<Item>();

            for( int i = 0; i < m.Items.Count; i++ )
            {
                if( m.Items[i] is BankBox || (m.Backpack != null && m.Items[i].Serial == m.Backpack.Serial) )
                    continue;

                items.Add(m.Items[i]);
            }

            if( m.Backpack != null )
            {
                for( int i = 0; i < m.Backpack.Items.Count; i++ )
                    items.Add(m.Backpack.Items[i]);
            }

            items.ForEach(
                delegate( Item i )
                {
                    pack.AddItem(i);
                });
            items.Clear();

            if( bank == null )
                pack.MoveToWorld(m.Location, m.Map);
            else
                bank.AddItem(pack);
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:40,代码来源:BaseKillCommand.cs

示例4: GiveRewards

        public override void GiveRewards()
        {
            base.GiveRewards();

            Backpack pack = new Backpack();
            PowerScroll ps = new PowerScroll( SkillName.Imbuing, 110.0 );
            pack.Hue = Utility.RandomDyedHue();
            ps.LootType = LootType.Regular;
            pack.AddItem( ps );

            Owner.AddToBackpack( pack );
            Owner.SendLocalizedMessage( 1074360, "backpack" ); // You receive a reward: backpack
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:13,代码来源:Beninort.cs

示例5: SupplyWeapons

        public static void SupplyWeapons(Mobile m, BaseWeapon[] weaponList, WeaponDamageLevel dmgLevel, WeaponAccuracyLevel accLevel, int hue, string teamName, bool newbie, bool consumeItems)
        {
            MakeEventItems(weaponList, hue, teamName, true, false, consumeItems);
            
            Backpack bp = new Backpack {EventItemConsume = consumeItems, EventItem = true, Name = "event backpack"};

            if (newbie)
                bp.LootType = LootType.Newbied;

            for (int i = 0; i < weaponList.Length; ++i)
            {
                BaseWeapon weapon = weaponList[i];
                
                if (newbie)
                    weapon.LootType = LootType.Newbied;

                weapon.EventItemConsume = consumeItems;

                weapon.DamageLevel = dmgLevel;
                weapon.AccuracyLevel = accLevel;

                bp.AddItem(weapon);
            }

            m.AddToBackpack(bp);
        }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:26,代码来源:SupplySystem.cs

示例6: ItemsToBank

        /// <summary>
        /// Moves all the players items to thier bank.
        /// Notifies the player that thier belongings have been placed in thier bank.
        /// </summary>
        /// <param name="m"> The mobile to be have items moved</param>
        public static void ItemsToBank(Mobile m)
        {
            try
            {
                if (m.Backpack != null && m.BankBox != null)
                {
                    Container bp = m.Backpack;
                    BankBox bank = m.BankBox;
                    Container pack = new Backpack();
                    List<Item> list = new List<Item>();
                    Item addItem;

                    foreach (Item item in m.Items)
                    {
                        if (item != bp && item != bank)
                            list.Add(item);
                    }
                    foreach (Item item in bp.Items)
                    {
                        list.Add(item);
                    }

                    for (int i = 0; i < list.Count; i++)
                    {
                        addItem = list[i];
                        pack.AddItem(addItem);
                    }

                    if (pack.Items.Count > 0)
                        bank.AddItem(pack);
                }

                m.SendMessage("All of your items have been sent to your bankbox via a backpack.");

                return;
            }
            catch (Exception e)
            {
                Console.WriteLine("Error : " + e.Message);
                Console.WriteLine("Location : " + e.InnerException);
            }
        }
开发者ID:greeduomacro,项目名称:RunUO-1,代码行数:47,代码来源:DuelTimer.cs

示例7: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
			if( from.AccessLevel >= AccessLevel.Counselor )
				from.SendGump( new PBGMGump( this ) );

			else if( this.m_Active )
				from.SendMessage( "The game has already started" );

			else if( from is Mobile && from.AccessLevel == AccessLevel.Player )
			{
				if( !from.InRange( GetWorldLocation(), 3 ) )
					from.SendLocalizedMessage( 500446 );
				else if( CheckAlreadyPlayer( from ) )
					from.SendMessage( "You are already on a team" );
				else
				{
					Players.Add( from );

					ArrayList ItemsToMove = new ArrayList();
					Backpack itemsPack = new Backpack();
					itemsPack.Hue = 1;
					itemsPack.Name = "Items from PaintBallGame";
					BankBox bankBox = from.BankBox;

					foreach( Item item in from.Items )
						if( item.Layer != Layer.Bank && item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Layer != Layer.Mount && item.Layer != Layer.Backpack )
						ItemsToMove.Add( item );
					foreach( Item item in from.Backpack.Items )
						ItemsToMove.Add( item );

					foreach( Item item in ItemsToMove )
						itemsPack.AddItem( item );

					bankBox.AddItem( itemsPack );

					bankBox.AddItem( new PBPlayerStorage( from ) );

					AddToTeam( from );
				}
			}
			else
				from.SendMessage( "You could not access that item for some reason.  Please page a GM." );
		}
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:43,代码来源:PBGameItem.cs

示例8: OnDragDrop

        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            int newAmount = 0;
            if (m_James == null)
                return false;

            if (DonationList.ContainsValue(MaxAmount))
            {
                m_James.SayTo(from, true, "Thank you but we have already reached our donation amount!");
                return false;
            }

            if (dropped is IronIngot && dropped.Tag == "mining")
            {
                if (!DonationList.ContainsKey((PlayerMobile)from))
                {
                    newAmount = dropped.Amount;
                    if (newAmount > MaxAmount)
                    {
                        from.AddToBackpack(new IronIngot(newAmount - MaxAmount));
                        newAmount = MaxAmount;
                    }

                    DonationList.Add((PlayerMobile)from, dropped.Amount);
                }
                else
                {
                    DonationList.TryGetValue((PlayerMobile)from, out newAmount);

                    newAmount += dropped.Amount;
                    if (newAmount > MaxAmount)
                    {
                        from.AddToBackpack(new IronIngot(newAmount - MaxAmount));
                        newAmount = MaxAmount;
                    }

                    DonationList.Remove((PlayerMobile)from);
                    DonationList.Add((PlayerMobile)from, newAmount);
                }

                if (DonationList.ContainsValue(MaxAmount))
                {
                    m_James.Say(true, String.Format("{0}! You are the first to reach our donation goal! Thank you for your help and here is your reward!", from.Name));
                    World.Broadcast(m_James.SpeechHue, true, String.Format("James: {0} was the first to donate a total of {1} iron ingots. Congratulations!", from.Name, MaxAmount));
                    Backpack prize = new Backpack();
                    prize.LootType = LootType.Newbied;
                    prize.AddItem(new Forge() { Movable = false, Weight = 255 });

                    from.AddToBackpack(prize);
                }
                else
                {
                    DonationList.TryGetValue((PlayerMobile)from, out newAmount);
                    m_James.Say(true, String.Format("Thank you {0}! You have donated {1} iron ingots in total.", from.Name,newAmount));
                }

                UpdateBook();

                dropped.Delete();
                Tag = "mining";
                return true;
            }
            else if (dropped.Tag != "mining")
            {
                m_James.SayTo(from, true, "You can only donate ingots that have been mined after the event began!");
                Tag = "mining";
                return false;
            }
            else
            {
                m_James.SayTo(from, true, "You can only donate iron ingots!");
                Tag = "mining";
                return false;
            }
        }
开发者ID:Godkong,项目名称:RunUO,代码行数:75,代码来源:IngotChest.cs

示例9: Guard

        public Guard(GuardType type, AIType ai)
            : base(ai, FightMode.Closest, 20, 1, 0.2, 0.4)
        {
            m_Type = type;

                        if (m_Type == GuardType.Wizard)
                ChangeAIType(AIType.AI_Mage);

            if (m_Type == GuardType.Archer)
                ChangeAIType(AIType.AI_Archer);

            if (m_Type == GuardType.Medic)
                ChangeAIType(AIType.AI_Healer);

            Title = GetTitle(type);
            Hue = Utility.RandomSkinHue();
            Karma = 12000;

            if (0.50 >= Utility.RandomDouble())
            {
                Name = NameList.RandomName("female") + ",";
                Female = true;
                Body = 0x191;
            }
            else
            {
                Name = NameList.RandomName("male") + ",";
                Body = 0x190;
                FacialHairItemID = Utility.RandomList(0x203E, 0x203F, 0x2040, 0x2041, 0x204B, 0x204C, 0x204D);
            }

            SetStatsAndSkills(type);

            SetDamage(7, 13);
            SetDamageType(ResistanceType.Physical, 100);

            SetResistance(ResistanceType.Physical, 55, 65);
            SetResistance(ResistanceType.Fire, 40, 50);
            SetResistance(ResistanceType.Cold, 30, 45);
            SetResistance(ResistanceType.Poison, 40, 50);
            SetResistance(ResistanceType.Energy, 50, 60);

            HairItemID = Utility.RandomList(0x203B, 0x203C, 0x203D, 0x2048);
            HairHue = FacialHairHue = Utility.RandomHairHue();

            Backpack pack = new Backpack();
            pack.AddItem(new Bandage(Utility.RandomMinMax(100, 200)));

            this.AddItem(pack);

            AddEquipment(type);

            if (type == GuardType.Cavalry)
            {
                Horse horse = new Horse();
                horse.Body = 0xE4;
                horse.Controlled = true;
                horse.ControlMaster = this;
                horse.ControlOrder = OrderType.Come;
                horse.RawName = "an Imperial War Horse";
                horse.Hue = 1410;
                horse.ItemID = 16033;
                horse.Rider = this;

                horse.RawStr += Utility.RandomMinMax(45, 60);
                horse.RawDex += Utility.RandomMinMax(25, 30);
                horse.RawInt += Utility.RandomMinMax(15, 20);

                horse.SetSkill(SkillName.Wrestling, horse.Skills.Wrestling.Value + Utility.RandomMinMax(15, 20));
                horse.SetSkill(SkillName.Tactics, horse.Skills.Tactics.Value + Utility.RandomMinMax(20, 25));
                horse.SetSkill(SkillName.MagicResist, horse.Skills.MagicResist.Value + Utility.RandomMinMax(30, 40));

            }
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:74,代码来源:Guard.cs

示例10: Destroy

        public virtual void Destroy( bool toBackpack )
        {
            Return();

            if ( !BaseHouse.NewVendorSystem )
                FixDresswear();

            /* Possible cases regarding item return:
             *
             * 1. No item must be returned
             *       -> do nothing.
             * 2. ( toBackpack is false OR the vendor is in the internal map ) AND the vendor is associated with a AOS house
             *       -> put the items into the moving crate or a vendor inventory,
             *          depending on whether the vendor owner is also the house owner.
             * 3. ( toBackpack is true OR the vendor isn't associated with any AOS house ) AND the vendor isn't in the internal map
             *       -> put the items into a backpack.
             * 4. The vendor isn't associated with any house AND it's in the internal map
             *       -> do nothing (we can't do anything).
             */

            ArrayList list = GetItems();

            if ( list.Count > 0 || HoldCopper > 0 ) // No case 1
            {
                if ( ( !toBackpack || this.Map == Map.Internal ) && House != null && House.IsAosRules ) // Case 2
                {
                    if ( House.IsOwner( Owner ) ) // Move to moving crate
                    {
                        if ( House.MovingCrate == null )
                            House.MovingCrate = new MovingCrate( House );

                        if ( HoldCopper > 0 )
                            Banker.Deposit( House.MovingCrate, HoldCopper );

                        foreach ( Item item in list )
                        {
                            House.MovingCrate.DropItem( item );
                        }
                    }
                    else // Move to vendor inventory
                    {
                        VendorInventory inventory = new VendorInventory( House, Owner, Name, ShopName );
                        inventory.Copper = HoldCopper;

                        foreach ( Item item in list )
                        {
                            inventory.AddItem( item );
                        }

                        House.VendorInventories.Add( inventory );
                    }
                }
                else if ( ( toBackpack || House == null || !House.IsAosRules ) && this.Map != Map.Internal ) // Case 3 - Move to backpack
                {
                    Container backpack = new Backpack();

                    if ( HoldCopper > 0 )
                        Banker.Deposit( backpack, HoldCopper );

                    foreach ( Item item in list )
                    {
                        backpack.DropItem( item );
                    }

                    backpack.AddItem( new ContractOfEmployment() );
                    backpack.MoveToWorld( this.Location, this.Map );
                }
            }

            Delete();
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:71,代码来源:PlayerVendor+.cs


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