Class Spellbook

java.lang.Object
com.valhalla.sdk.api.methods.Spellbook

public final class Spellbook extends Object
Safe spellbook discovery and spell selection through live widget actions.

isOpen() means the current frame proves a coherent, cast-ready spell panel; it does not remember a prior open request. open() uses the existing revision-pinned Magic tab path, while cast(String) resolves a fresh visible spell and invokes only its exact Cast operation through Widgets.interact(WidgetSnapshot, String).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The only generic spell-selection operation this facade authorizes.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    canCast(String spellName)
    Returns whether one uniquely named visible spell currently publishes an exact Cast operation.
    static boolean
    canCastOnNpc(String spellName)
    Returns whether one current named spell can enter the NPC-target path.
    static boolean
    cast(String spellName)
    Requests selection of one visible spell whose current operation is exactly Cast.
    static boolean
    castOn(String spellName, Npc target)
    Atomically selects one current named targeted spell and applies it to one current NPC.
    find(String spellName)
    Finds one uniquely visible spell by its display name.
    findTargeted(String spellName)
    Finds one current targeted-spell component in the same proven spell panel as at least two self-contained Cast controls.
    static boolean
    Returns whether this revision supports the separately reviewed, identity-bound spell-on-NPC transaction.
    static boolean
    Returns whether a coherent cast-ready spell panel is currently visible.
    static boolean
    Returns whether the active adapter supports safe spellbook selection.
    static boolean
    Opens the Magic tab when it is not currently proven cast-ready.
    Returns visible, current spell widgets that are ready to accept the exact Cast operation from the one confirmed spell panel.

    Methods inherited from class java.lang.Object

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

    • CAST_ACTION

      public static final String CAST_ACTION
      The only generic spell-selection operation this facade authorizes.
      See Also:
  • Method Details

    • isSupported

      public static boolean isSupported()
      Returns whether the active adapter supports safe spellbook selection. Scripts still need game:interact-widget in their manifest.
    • isNpcTargetingSupported

      public static boolean isNpcTargetingSupported()
      Returns whether this revision supports the separately reviewed, identity-bound spell-on-NPC transaction. Scripts additionally need both game:interact-widget and game:interact-npc permissions.
    • isOpen

      public static boolean isOpen()
      Returns whether a coherent cast-ready spell panel is currently visible. A lone matching widget or multiple plausible groups returns false.
    • open

      public static boolean open()
      Opens the Magic tab when it is not currently proven cast-ready.
      Returns:
      true when the panel is already open or the tab request was accepted
    • visibleSpells

      public static List<WidgetSnapshot> visibleSpells()
      Returns visible, current spell widgets that are ready to accept the exact Cast operation from the one confirmed spell panel. The returned snapshots are observations, so re-query after a wait rather than retaining one for a later action.
    • find

      public static Optional<WidgetSnapshot> find(String spellName)
      Finds one uniquely visible spell by its display name.
    • canCast

      public static boolean canCast(String spellName)
      Returns whether one uniquely named visible spell currently publishes an exact Cast operation.
    • findTargeted

      public static Optional<WidgetSnapshot> findTargeted(String spellName)
      Finds one current targeted-spell component in the same proven spell panel as at least two self-contained Cast controls.

      The returned component publishes no ordinary action because the client models a target spell as a separate select-then-target operation. Its sprite is corroborating metadata only; the native call rechecks the complete live panel and never lets a sprite alone authorize a cast.

    • canCastOnNpc

      public static boolean canCastOnNpc(String spellName)
      Returns whether one current named spell can enter the NPC-target path.
    • cast

      public static boolean cast(String spellName)
      Requests selection of one visible spell whose current operation is exactly Cast.

      Acceptance means the native queue accepted the request, not that a spell has completed. Use castOn(String, Npc) for the separately reviewed NPC-target operation.

    • castOn

      public static boolean castOn(String spellName, Npc target)
      Atomically selects one current named targeted spell and applies it to one current NPC.

      The runtime re-resolves the spell's mounted/visible widget identity, text, renderer-backed bounds, no-ordinary-action state, and coherent spell panel. It also re-resolves the NPC by index, definition ID, and exact tile immediately before the measured client action pair. A true result means queue acceptance only; it is not hit, damage, pathing, or requirement confirmation.