# Method Global:RegisterSpellEvent [-] [+]

Registers a Spell event handler.

    enum SpellEvents
    {
        SPELL_EVENT_ON_CAST                             = 1,    // (event, spell, skipCheck)
        SPELL_EVENT_BEFORE_HIT                          = 2,    // (event, spell)
        SPELL_EVENT_HIT                                 = 3,    // (event, spell)
        SPELL_EVENT_AFTER_HIT                           = 4,    // (event, spell)
        SPELL_EVENT_CHECK_CAST                          = 5,    // (event, spell, initialCast) - Can return SpellCastResult
        SPELL_EVENT_BEFORE_CAST                         = 6,    // (event, spell)
        SPELL_EVENT_AFTER_CAST                          = 7,    // (event, spell)
        SPELL_EVENT_ON_INTERRUPT                        = 7,    // (event, spell)
        SPELL_EVENT_COUNT
    };

## Synopsis

`cancel = RegisterSpellEvent( entry, event, function )`

`cancel = RegisterSpellEvent( entry, event, function, shots )`

## Arguments

`number entry`

  Spell entry Id (Use negative entry Id for all spell ranks).

  Valid numbers: integers from -2,147,483,647 to 2,147,483,647.

`number event`

  Spell event Id, refer to SpellEvents above.

  Valid numbers: integers from 0 to 4,294,967,295.

`function function`

  Function to register.

`number shots (0)`

  The number of times the function will be called, 0 means "always call this function".

  Valid numbers: integers from 0 to 4,294,967,295.

## Returns

`function cancel`

  A function that cancels the binding when called.

# Keyboard shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

# Search tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct` (or `str`), `enum`, `trait`, `typedef` (or `tdef`).

Generated on
© 2010 - 2024 Eluna Lua Engine