Class Magic


  • public class Magic
    extends java.lang.Object
    Created by Pandemic
    • Method Detail

      • interact

        public static boolean interact​(Spell spell,
                                       java.lang.String action)
        Interacts with the spell with the given action
        Parameters:
        spell - spell to be cast
        action - the action to perform on the spell widget
        Returns:
        true if successfully interacted with the spell
      • castSpell

        public static boolean castSpell​(Spell spell)
        Casts a spell
        Parameters:
        spell - spell to be cast
        Returns:
        true if successfully clicked on spell
      • castSpell

        public static boolean castSpell​(Spell spell,
                                        java.lang.String action)
        Casts a spell with the given action
        Parameters:
        spell - spell to be cast
        Returns:
        true if successfully casted the spell with the action
      • castSpellOn

        public static boolean castSpellOn​(Spell spell,
                                          Entity entity)
        Casts a spell on an entity
        Parameters:
        spell - spell to be cast
        entity - entity to cast spell on
        Returns:
        true if successfully cast spell on entity
      • castSpellOn

        public static boolean castSpellOn​(Spell spell,
                                          Item item)
        Casts a spell on an item in inventory
        Parameters:
        spell - spell to be cast
        item - item to cast spell on
        Returns:
        true if successfully cast spell on item
      • isSpellSelected

        public static boolean isSpellSelected()
        Checks if a spell is currently selected
        Returns:
        True if a spell is selected, false if not
      • getSelectedSpellName

        public static java.lang.String getSelectedSpellName()
        Gets the currently selected spell name
        Returns:
        Spell name if spell selected, otherwise null
      • canCast

        public static boolean canCast​(Spell spell)
        Checks if you can cast the given spell. Does account for any staffs equipped. Uses WebFinder.getCurrentPathQuery() to determine if bank should be included
        Parameters:
        spell - The spell to check
        Returns:
        true if you have the level requirement and costs to cast the spell, otherwise false
      • canCast

        public static boolean canCast​(Spell spell,
                                      boolean useBank)
        Checks if you can cast the given spell Does account for any staffs equipped.
        Parameters:
        spell - The spell to check
        useBank - whether it should include runes in your bank or not
        Returns:
        False if wearing greegree, True if you have level requirement, costs, and necessary equipment to cast the spell, otherwise false
      • deselect

        public static boolean deselect()
        Deselects the current spell if one is selected
        Returns:
        true if successfully deselected spell or if no spell was selected to being with
      • getAutocastSpell

        public static Spell getAutocastSpell()
        Gets the active spell that is selected via autocast
        Returns:
        Spell if one is selected, null otherwise
      • isAutocasting

        public static boolean isAutocasting()
      • isAutocastDefensive

        public static boolean isAutocastDefensive()
      • setDefensiveAutocastSpell

        public static boolean setDefensiveAutocastSpell​(Spell spell)
      • setAutocastSpell

        public static boolean setAutocastSpell​(Spell spell)
      • isSpellFilteringEnabled

        public static boolean isSpellFilteringEnabled()
        This is used to check if spell filtering is enabled. If spell filtering is enabled, it does not necessarily mean something is currently being filtered, just that the ability to do so will be available via the "Filter" button in the Magic tab.
        Returns:
        true if spell filtering is enabled, false otherwise
      • setSpellFilteringEnabled

        public static boolean setSpellFilteringEnabled​(boolean enabled)
        Either enables or disables the spell filtering options in the Magic tab
        Parameters:
        enabled - if spell filtering should be enabled
        Returns:
        true if it's already correctly set or if it's successfully changed
      • getSpellbook

        public static Spellbook getSpellbook()
        Returns the current spellbook
        Returns:
        the current spellbook, or null if not logged in