public virtual void Use( Item item ) { if ( item == null || item.Deleted ) return; DisruptiveAction(); if ( m_Spell != null && !m_Spell.OnCasterUsingObject( item ) ) return; object root = item.RootParent; bool okay = false; if ( !Utility.InUpdateRange( this, item.GetWorldLocation() ) ) item.OnDoubleClickOutOfRange( this ); else if ( !CanSee( item ) ) item.OnDoubleClickCantSee( this ); else if ( !item.IsAccessibleTo( this ) ) { Region reg = Region.Find( item.GetWorldLocation(), item.Map ); if ( reg == null || !reg.SendInaccessibleMessage( item, this ) ) item.OnDoubleClickNotAccessible( this ); } else if ( !CheckAlive( false ) ) item.OnDoubleClickDead( this ); else if ( item.InSecureTrade ) item.OnDoubleClickSecureTrade( this ); else if ( !AllowItemUse( item ) ) okay = false; else if ( !item.CheckItemUse( this, item ) ) okay = false; else if ( root != null && root is Mobile && ((Mobile)root).IsSnoop( this ) ) item.OnSnoop( this ); else if ( m_Region.OnDoubleClick( this, item ) ) okay = true; if ( okay ) { if ( !item.Deleted ) item.OnItemUsed( this, item ); if ( !item.Deleted ) item.OnDoubleClick( this ); } }
public void Open( Mobile from, Item item ) { if(item is BaseBook) { from.CloseGump(typeof(BookGump)); from.SendGump(new BookGump(from, (BaseBook)item)); } else // item is Runebook item.OnDoubleClick(from); }