# Magic Extends SRL's TMagic. - - - ## Magic.SpellWasCast ```pascal function TMagic.SpellWasCast(spell: ESpell): Boolean; ``` Internal helper function to decide wether we cast a spell or not. - - - ## Magic.CastSpell ```pascal function TMagic.CastSpell(spell: ESpell): Boolean; override; ``` Overrides the existing SRL TMagic.CastSpell() for better cast detection with the usage of WaspLib's TMagic.SpellWasCast(). - - - ## Magic.GetFilterButton ```pascal function TMagic.GetFilterButton(): TGameButton; ``` Returns the filter button in the magic tab. Example: ```pascal Debug([Magic.GetFilterButton()]); ``` - - - ## Magic.FiltersIsOpen ```pascal function TMagic.FiltersIsOpen(): Boolean; ``` Returns true/false if the filters interface of the magic tab is open. Example: ```pascal WriteLn Magic.FiltersIsOpen(); ``` - - - ## Magic.OpenFilters ```pascal function TMagic.OpenFilters(): Boolean; ``` Attempts to open the filters interface of the magic tab. Returns true on success. Example: ```pascal WriteLn Magic.OpenFilters(); ``` - - - ## Magic.CloseFilters ```pascal function TMagic.CloseFilters(): Boolean; ``` Attempts to close the filters interface of the magic tab. Returns true on success. Example: ```pascal WriteLn Magic.CloseFilters(); ``` - - - ## Magic.GetBookSpellCount ```pascal function TMagic.GetBookSpellCount(): Int32; ``` Returns the number of spells declared in SRL for the current spellbook. Example: ```pascal WriteLn Magic.GetBookSpellCount(); ``` - - - ## Magic.CountSpells ```pascal function TMagic.CountSpells(): Int32; ``` Returns the number of spells that exist in your magic tab. Example: ```pascal WriteLn Magic.CountSpells(); if Magic.GetBookSpellCount() <> Magic.CountSpells() then WriteLn 'Something is wrong!'; ``` - - - ## Magic.GetFilterButtons ```pascal function TMagic.GetFilterButtons(): TGameButtonArray; ``` Returns the buttons of the magic tab filter interface. Example: ```pascal Debug(Magic.GetFilterButtons()); ``` - - - ## Magic.IsFiltered ```pascal function TMagic.IsFiltered(): Boolean; ``` Returns wether the spells are currently filtered or not. Can work with the filter interface open or closed as long as the magic tab is open. Example: ```pascal WriteLn Magic.IsFiltered(); ``` - - - ## Magic.DisableFilters ```pascal function TMagic.DisableFilters(): Boolean; ``` Attempts to disable magic spell filters. Example: ```pascal WriteLn Magic.DisableFilters(); ```