Class Magic


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean canCast​(@NonNull Spell spell)
      Checks if you can cast the given spell.
      static boolean canCast​(@NonNull Spell spell, boolean useBank)
      Checks if you can cast the given spell Does account for any staffs equipped.
      static boolean castSpell​(@NonNull Spell spell)
      Casts a spell
      static boolean castSpell​(@NonNull Spell spell, @Nullable java.lang.String action)
      Casts a spell with the given action
      static boolean castSpellOn​(@NonNull Spell spell, @NonNull Entity entity)
      Casts a spell on an entity
      static boolean castSpellOn​(@NonNull Spell spell, @NonNull Item item)
      Casts a spell on an item in inventory
      static boolean deselect()
      Deselects the current spell if one is selected
      static @Nullable Spell getAutocastSpell()
      Gets the active spell that is selected via autocast
      static @Nullable java.lang.String getSelectedSpellName()
      Gets the currently selected spell name
      static @Nullable Spellbook getSpellbook()
      Returns the current spellbook
      static boolean interact​(@NonNull Spell spell, @Nullable java.lang.String action)
      Interacts with the spell with the given action
      static boolean isAutocastDefensive()  
      static boolean isAutocasting()  
      static boolean isSpellFilteringEnabled()
      This is used to check if spell filtering is enabled.
      static boolean isSpellSelected()
      Checks if a spell is currently selected
      static boolean setAutocastSpell​(@NonNull Spell spell)  
      static boolean setDefensiveAutocastSpell​(@NonNull Spell spell)  
      static boolean setSpellFilteringEnabled​(boolean enabled)
      Either enables or disables the spell filtering options in the Magic tab
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • interact

        public static boolean interact​(@NonNull Spell spell,
                                       @Nullable 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​(@NonNull Spell spell)
        Casts a spell
        Parameters:
        spell - spell to be cast
        Returns:
        true if successfully clicked on spell
      • castSpell

        public static boolean castSpell​(@NonNull Spell spell,
                                        @Nullable 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​(@NonNull Spell spell,
                                          @NonNull 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​(@NonNull Spell spell,
                                          @NonNull 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 @Nullable java.lang.String getSelectedSpellName()
        Gets the currently selected spell name
        Returns:
        Spell name if spell selected, otherwise null
      • canCast

        public static boolean canCast​(@NonNull 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​(@NonNull 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 @Nullable 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​(@NonNull Spell spell)
      • setAutocastSpell

        public static boolean setAutocastSpell​(@NonNull 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 @Nullable Spellbook getSpellbook()
        Returns the current spellbook
        Returns:
        the current spellbook, or null if not logged in