示例#1
0
        public virtual void OnCarve( Mobile from, Corpse corpse )
        {
            if ( !from.InRange( corpse.Location, 1 ) )
            {
                from.SendMessage( "You are too far away." );
                return;
            }

            BodyPartsContainer bpc = corpse.FindItemByType( typeof( BodyPartsContainer ) ) as BodyPartsContainer;
            if (bpc == null)
            {
                bpc = new BodyPartsContainer();
                corpse.DropItem( bpc );
            }

            if ( !corpse.Carved && !Summoned && !IsBonded )
            {
                AddBodyParts( bpc, corpse );
                corpse.Carved = true;
            }

            if ( bpc.TotalItems > 0 )
            {
                from.CloseGump( typeof( SkinningGump ) );
                from.SendGump( new SkinningGump( corpse, corpse.FindItemByType( typeof( BodyPartsContainer ) ) as BodyPartsContainer, from ) );
            }
            else
                from.SendMessage( "There's nothing left to carve." );

            PlayerMobile pm = from as PlayerMobile;
            if ( pm != null )
            {
                OnXMLEvent( XMLEventType.OnCarveInvokeOnMobile, pm );
                OnXMLEvent( XMLEventType.OnCarveInvokeOnItem, corpse );
                OnXMLEvent( XMLEventType.OnCarve );
            }
        }