Server.Mobiles.BaseCreature.PackItem C# (CSharp) Method

PackItem() public method

public PackItem ( Item item ) : void
item Item
return void
        public void PackItem( Item item )
        {
            if ( Summoned || item == null )
            {
                if ( item != null )
                    item.Delete();

                return;
            }

            Container pack = Backpack;

            if ( pack == null )
            {
                pack = new Backpack();

                pack.Movable = false;

                AddItem( pack );
            }

            if ( !item.Stackable || !pack.TryDropItem( this, item, false ) ) // try stack
                pack.DropItem( item ); // failed, drop it anyway
        }

Usage Example

コード例 #1
0
        public static void GiveArtifact(BaseCreature bc)
        {
//**Begin Artifact Randomness**\\
            if (percent > Utility.RandomDouble())               // 0.7 = 70% = chance to drop

            {
                bc.PackItem(ArtifactList.RandomArtifact());
            }
        }
All Usage Examples Of Server.Mobiles.BaseCreature::PackItem
BaseCreature