Package org.dreambot.api.methods.magic
Class Magic
- java.lang.Object
-
- org.dreambot.api.methods.magic.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 spellstatic boolean
castSpell(@NonNull Spell spell, @Nullable java.lang.String action)
Casts a spell with the given actionstatic boolean
castSpellOn(@NonNull Spell spell, @NonNull Entity entity)
Casts a spell on an entitystatic boolean
castSpellOn(@NonNull Spell spell, @NonNull Item item)
Casts a spell on an item in inventorystatic boolean
deselect()
Deselects the current spell if one is selectedstatic @Nullable Spell
getAutocastSpell()
Gets the active spell that is selected via autocaststatic @Nullable java.lang.String
getSelectedSpellName()
Gets the currently selected spell namestatic @Nullable Spellbook
getSpellbook()
Returns the current spellbookstatic boolean
interact(@NonNull Spell spell, @Nullable java.lang.String action)
Interacts with the spell with the given actionstatic 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 selectedstatic 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
-
-
-
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 castaction
- 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 castentity
- 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 castitem
- 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. UsesWebFinder.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 checkuseBank
- 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
-
-