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

HasSpell() public méthode

public HasSpell ( int spellID ) : bool
spellID int
Résultat bool
        public bool HasSpell( int spellID )
        {
            spellID -= BookOffset;

            return ( spellID >= 0 && spellID < BookCount && (m_Content & ((ulong)1 << spellID)) != 0 );
        }

Usage Example

Exemple #1
0
        private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
        {
            Mobile from = e.Mobile;

            Spellbook book    = e.Spellbook as Spellbook;
            int       spellID = e.SpellID;

            if (book == null || !book.HasSpell(spellID))
            {
                book = Find(from, spellID);
            }

            if (book != null && book.HasSpell(spellID))
            {
                Spell spell = SpellRegistry.NewSpell(spellID, from, null);

                if (spell != null)
                {
                    spell.Cast();
                }
                else
                {
                    from.SendLocalizedMessage(502345); // This spell has been temporarily disabled.
                }
            }
            else
            {
                from.SendLocalizedMessage(500015);                   // You do not have that spell!
            }
        }
All Usage Examples Of Server.Items.Spellbook::HasSpell