Server.Items.Spellbook.DisplayTo C# (CSharp) Méthode

DisplayTo() public méthode

public DisplayTo ( Server.Mobile to ) : void
to Server.Mobile
Résultat void
        public void DisplayTo( Mobile to )
        {
            // The client must know about the spellbook or it will crash!

            NetState ns = to.NetState;

            if ( ns == null )
                return;

            if ( Parent == null )
            {
                to.Send( this.WorldPacket );
            }
            else if ( Parent is Item )
            {
                // What will happen if the client doesn't know about our parent?
                if ( ns.ContainerGridLines )
                    to.Send( new ContainerContentUpdate6017( this ) );
                else
                    to.Send( new ContainerContentUpdate( this ) );
            }
            else if ( Parent is Mobile )
            {
                // What will happen if the client doesn't know about our parent?
                to.Send( new EquipUpdate( this ) );
            }

            if ( ns.HighSeas )
                to.Send( new DisplaySpellbookHS( this ) );
            else
                to.Send( new DisplaySpellbook( this ) );

            if ( Core.AOS ) {
                if ( ns.NewSpellbook ) {
                    to.Send( new NewSpellbookContent( this, ItemID, BookOffset + 1, m_Content ) );
                } else {
                    to.Send( new SpellbookContent( m_Count, BookOffset + 1, m_Content, this ) );
                }
            }
            else {
                if ( ns.ContainerGridLines ) {
                    to.Send( new SpellbookContent6017( m_Count, BookOffset + 1, m_Content, this ) );
                } else {
                    to.Send( new SpellbookContent( m_Count, BookOffset + 1, m_Content, this ) );
                }
            }
        }

Usage Example

        private static void EventSink_OpenSpellbookRequest(OpenSpellbookRequestEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!Multis.DesignContext.Check(from))
            {
                return;                 // They are customizing
            }
            SpellbookType type;

            switch (e.Type)
            {
            default:
            case 1: type = SpellbookType.Regular; break;

            case 2: type = SpellbookType.Necromancer; break;

            case 3: type = SpellbookType.Paladin; break;

            case 4: type = SpellbookType.Ninja; break;

            case 5: type = SpellbookType.Samurai; break;

            case 6: type = SpellbookType.Arcanist; break;
            }

            Spellbook book = Spellbook.Find(from, -1, type);

            if (book != null)
            {
                book.DisplayTo(from);
            }
        }
All Usage Examples Of Server.Items.Spellbook::DisplayTo