コード例 #1
0
        public static bool MobileHasSpell(Mobile m, School school, Type type)
        {
            if (m == null || m.Deleted || m.Backpack == null || school == School.Invalid || type == null)
            {
                return(false);
            }

            foreach (Item i in m.Backpack.Items)
            {
                if (i is CSpellbook)
                {
                    CSpellbook book = (CSpellbook)i;
                    if (book.School == school && book.HasSpell(type))
                    {
                        return(true);
                    }
                }
            }

            Item layer = m.FindItemOnLayer(Layer.OneHanded);

            if (layer is CSpellbook)
            {
                CSpellbook book = (CSpellbook)layer;
                if (book.School == school && book.HasSpell(type))
                {
                    return(true);
                }
            }

            layer = m.FindItemOnLayer(Layer.FirstValid);
            if (layer is CSpellbook)
            {
                CSpellbook book = (CSpellbook)layer;
                if (book.School == school && book.HasSpell(type))
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #2
0
 public bool HasSpell(Type type)
 {
     return(m_Book != null && m_Book.HasSpell(type));
 }