# Magic Extends SRL's TRSMagic. - - - ## Magic.SpellWasCast ```pascal function TRSMagic.SpellWasCast(spell: ERSSpell): Boolean; ``` Internal helper function to decide wether we cast a spell or not. - - - ## Magic.CastSpell ```pascal function TRSMagic.CastSpell(spell: ERSSpell): Boolean; override; ``` Overrides the existing SRL TRSMagic.CastSpell() for better cast detection with the usage of WaspLib's TRSMagic.SpellWasCast(). - - - ## Magic.GetFilterButton ```pascal function TRSMagic.GetFilterButton(): TRSButton; ``` Returns the filter button in the magic tab. Example: ```pascal Debug([Magic.GetFilterButton()]); ``` - - - ## Magic.FiltersIsOpen ```pascal function TRSMagic.FiltersIsOpen(): Boolean; ``` Returns true/false if the filters interface of the magic tab is open. Example: ```pascal WriteLn Magic.FiltersIsOpen(); ``` - - - ## Magic.OpenFilters ```pascal function TRSMagic.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 TRSMagic.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 TRSMagic.GetBookSpellCount(): Int32; ``` Returns the number of spells declared in SRL for the current spellbook. Example: ```pascal WriteLn Magic.GetBookSpellCount(); ``` - - - ## Magic.CountSpells ```pascal function TRSMagic.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 TRSMagic.GetFilterButtons(): TRSButtonArray; ``` Returns the buttons of the magic tab filter interface. Example: ```pascal Debug(Magic.GetFilterButtons()); ``` - - - ## Magic.IsFiltered ```pascal function TRSMagic.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 TRSMagic.DisableFilters(): Boolean; ``` Attempts to disable magic spell filters. Example: ```pascal WriteLn Magic.DisableFilters(); ```