public bool HasSpell(Type type) { if (SchoolSpells.Contains(type) && SpellInfoRegistry.CheckRegistry(this.School, type)) { return((m_Content & ((ulong)1 << SchoolSpells.IndexOf(type))) != 0); } return(false); }
public override bool OnDragDrop(Mobile from, Item dropped) { if (dropped is CSpellScroll && dropped.Amount == 1) { CSpellScroll scroll = (CSpellScroll)dropped; if (!SchoolSpells.Contains(scroll.SpellType)) { return(false); } else if (HasSpell(scroll.SpellType)) { from.SendLocalizedMessage(500179); // That spell is already present in that spellbook. return(false); } else { AddSpell(scroll.SpellType); scroll.Delete(); from.Send(new PlaySound(0x249, GetWorldLocation())); return(true); } } else if (dropped is SpellScroll && dropped.Amount == 1) { SpellScroll scroll = (SpellScroll)dropped; Type type = SpellRegistry.Types[scroll.SpellID]; if (!SchoolSpells.Contains(type)) { return(false); } else if (HasSpell(type)) { from.SendLocalizedMessage(500179); // That spell is already present in that spellbook. return(false); } else { AddSpell(type); scroll.Delete(); from.Send(new PlaySound(0x249, GetWorldLocation())); return(true); } } else { return(false); } }
public bool AddSpell(Type type) { if (!SchoolSpells.Contains(type)) { return(false); } m_Content |= (ulong)1 << SchoolSpells.IndexOf(type); ++m_Count; InvalidateProperties(); return(true); }