예제 #1
0
        /// <summary>
        /// Overridable. Event invoked when a Mobile (<paramref name="from" />) drops an <see cref="Item"><paramref name="dropped" /></see> onto the Mobile.
        /// </summary>
        public virtual bool OnDragDrop( Mobile from, Item dropped )
        {
            if ( from == this )
            {
                Container pack = this.Backpack;

                if ( pack != null )
                    return dropped.DropToItem( from, pack, new Point3D( -1, -1, 0 ) );

                return false;
            }
            else if ( from.Player && this.Player && from.Alive && this.Alive && from.InRange( Location, 2 ) )
            {
                NetState ourState = m_NetState;
                NetState theirState = from.m_NetState;

                if ( ourState != null && theirState != null )
                {
                    SecureTradeContainer cont = theirState.FindTradeContainer( this );

                    if ( !from.CheckTrade( this, dropped, cont, true, true, 0, 0 ) )
                        return false;

                    if ( cont == null )
                        cont = theirState.AddTrade( ourState );

                    cont.DropItem( dropped );

                    return true;
                }

                return false;
            }
            else
            {
                return false;
            }
        }