Class Magic

java.lang.Object
net.storm.sdk.magic.Magic

public class Magic extends Object
Utility class for interacting with the magic spellbook system.

This class provides methods for:

  • Casting spells on various targets (items, NPCs, players, objects)
  • Checking and setting autocast settings
  • Managing spell selection state
  • Checking home teleport cooldown

Spells can be cast using different interaction methods for flexibility in how the action is performed.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    cast(InteractMethod interactMethod, Spell spell)
    Casts a spell without a target using a specific interaction method.
    static void
    cast(InteractMethod interactMethod, Spell spell, int actionIndex)
    Casts a spell with a specific action index using a specific interaction method.
    static void
    cast(InteractMethod interactMethod, Spell spell, String action)
    Casts a spell with a specific action using a specific interaction method.
    static void
    cast(InteractMethod interactMethod, Spell spell, INPC target)
    Casts a spell on an NPC using a specific interaction method.
    static void
    cast(InteractMethod interactMethod, Spell spell, IPlayer target)
    Casts a spell on a player using a specific interaction method.
    static void
    cast(InteractMethod interactMethod, Spell spell, IItem target)
    Casts a spell on an inventory item using a specific interaction method.
    static void
    cast(InteractMethod interactMethod, Spell spell, ITileItem target)
    Casts a spell on a ground item using a specific interaction method.
    static void
    cast(InteractMethod interactMethod, Spell spell, ITileObject target)
    Casts a spell on a tile object using a specific interaction method.
    static void
    cast(Spell spell)
    Casts a spell without a target using the default interaction method.
    static void
    cast(Spell spell, int actionIndex)
    Casts a spell with a specific action index using the default interaction method.
    static void
    cast(Spell spell, String action)
    Casts a spell with a specific action using the default interaction method.
    static void
    cast(Spell spell, INPC target)
    Casts a spell on an NPC using the default interaction method.
    static void
    cast(Spell spell, IPlayer target)
    Casts a spell on a player using the default interaction method.
    static void
    cast(Spell spell, IItem target)
    Casts a spell on an inventory item using the default interaction method.
    static void
    cast(Spell spell, ITileItem target)
    Casts a spell on a ground item using the default interaction method.
    static void
    cast(Spell spell, ITileObject target)
    Casts a spell on a tile object using the default interaction method.
    static void
    Disables autocasting.
    static Instant
    Gets the last time the home teleport spell was used.
    static boolean
    Checks if any spell is currently set as autocast.
    static boolean
    Checks if a specific spell is currently set as the autocast spell.
    static boolean
    Checks if defensive autocasting is currently enabled.
    static boolean
    Checks if the home teleport spell is currently on cooldown.
    static boolean
    Checks if a specific spell is currently selected for casting.
    static void
    Selects a spell for use on a subsequent target.
    static void
    setAutoCast(Spell spell, boolean defensive)
    Sets a spell as the autocast spell.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Magic

      public Magic()
  • Method Details

    • isAutoCasting

      public static boolean isAutoCasting(Spell spell)
      Checks if a specific spell is currently set as the autocast spell.
      Parameters:
      spell - the spell to check
      Returns:
      true if the spell is set as autocast, false otherwise
    • isAutoCasting

      public static boolean isAutoCasting()
      Checks if any spell is currently set as autocast.
      Returns:
      true if autocasting is enabled, false otherwise
    • isDefensiveAutoCasting

      public static boolean isDefensiveAutoCasting()
      Checks if defensive autocasting is currently enabled.
      Returns:
      true if defensive autocasting is active, false otherwise
    • isSpellSelected

      public static boolean isSpellSelected(Spell spell)
      Checks if a specific spell is currently selected for casting.
      Parameters:
      spell - the spell to check
      Returns:
      true if the spell is selected, false otherwise
    • cast

      public static void cast(InteractMethod interactMethod, Spell spell, IItem target)
      Casts a spell on an inventory item using a specific interaction method.
      Parameters:
      interactMethod - the method to use for the interaction
      spell - the spell to cast
      target - the item target
    • cast

      public static void cast(Spell spell, IItem target)
      Casts a spell on an inventory item using the default interaction method.
      Parameters:
      spell - the spell to cast
      target - the item target
    • cast

      public static void cast(InteractMethod interactMethod, Spell spell, INPC target)
      Casts a spell on an NPC using a specific interaction method.
      Parameters:
      interactMethod - the method to use for the interaction
      spell - the spell to cast
      target - the NPC target
    • cast

      public static void cast(Spell spell, INPC target)
      Casts a spell on an NPC using the default interaction method.
      Parameters:
      spell - the spell to cast
      target - the NPC target
    • cast

      public static void cast(InteractMethod interactMethod, Spell spell, IPlayer target)
      Casts a spell on a player using a specific interaction method.
      Parameters:
      interactMethod - the method to use for the interaction
      spell - the spell to cast
      target - the player target
    • cast

      public static void cast(Spell spell, IPlayer target)
      Casts a spell on a player using the default interaction method.
      Parameters:
      spell - the spell to cast
      target - the player target
    • cast

      public static void cast(InteractMethod interactMethod, Spell spell, ITileItem target)
      Casts a spell on a ground item using a specific interaction method.
      Parameters:
      interactMethod - the method to use for the interaction
      spell - the spell to cast
      target - the ground item target
    • cast

      public static void cast(Spell spell, ITileItem target)
      Casts a spell on a ground item using the default interaction method.
      Parameters:
      spell - the spell to cast
      target - the ground item target
    • cast

      public static void cast(InteractMethod interactMethod, Spell spell, ITileObject target)
      Casts a spell on a tile object using a specific interaction method.
      Parameters:
      interactMethod - the method to use for the interaction
      spell - the spell to cast
      target - the tile object target
    • cast

      public static void cast(Spell spell, ITileObject target)
      Casts a spell on a tile object using the default interaction method.
      Parameters:
      spell - the spell to cast
      target - the tile object target
    • cast

      public static void cast(InteractMethod interactMethod, Spell spell)
      Casts a spell without a target using a specific interaction method.

      Used for spells like teleports that don't require a target.

      Parameters:
      interactMethod - the method to use for the interaction
      spell - the spell to cast
    • cast

      public static void cast(Spell spell)
      Casts a spell without a target using the default interaction method.

      Used for spells like teleports that don't require a target.

      Parameters:
      spell - the spell to cast
    • cast

      public static void cast(InteractMethod interactMethod, Spell spell, String action)
      Casts a spell with a specific action using a specific interaction method.
      Parameters:
      interactMethod - the method to use for the interaction
      spell - the spell to cast
      action - the action name to use
    • cast

      public static void cast(Spell spell, String action)
      Casts a spell with a specific action using the default interaction method.
      Parameters:
      spell - the spell to cast
      action - the action name to use
    • cast

      public static void cast(Spell spell, int actionIndex)
      Casts a spell with a specific action index using the default interaction method.
      Parameters:
      spell - the spell to cast
      actionIndex - the action index (1-based)
    • cast

      public static void cast(InteractMethod interactMethod, Spell spell, int actionIndex)
      Casts a spell with a specific action index using a specific interaction method.
      Parameters:
      interactMethod - the method to use for the interaction
      spell - the spell to cast
      actionIndex - the action index (1-based)
    • selectSpell

      public static void selectSpell(Spell spell)
      Selects a spell for use on a subsequent target.

      After selecting a spell, the next click on a valid target will cast the spell on that target.

      Parameters:
      spell - the spell to select
    • getLastHomeTeleportUsage

      public static Instant getLastHomeTeleportUsage()
      Gets the last time the home teleport spell was used.
      Returns:
      the instant when home teleport was last used, or null if never used
    • isHomeTeleportOnCooldown

      public static boolean isHomeTeleportOnCooldown()
      Checks if the home teleport spell is currently on cooldown.
      Returns:
      true if home teleport is on cooldown, false otherwise
    • setAutoCast

      public static void setAutoCast(Spell spell, boolean defensive)
      Sets a spell as the autocast spell.
      Parameters:
      spell - the spell to set as autocast
      defensive - whether to use defensive casting (gains defence XP)
    • deselectAutoCast

      public static void deselectAutoCast()
      Disables autocasting.