> ## Documentation Index
> Fetch the complete documentation index at: https://docs.selvut.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Wynn & Spell

> Wynncraft state and spell queue APIs.

## Spell

| Function                             | Description                                                                   |
| ------------------------------------ | ----------------------------------------------------------------------------- |
| `Spell.cast(spell, options?)`        | Queue spell by slot or name                                                   |
| `Spell.melee(options?)`              | Queue melee                                                                   |
| `Spell.wait(options?)`               | Wait until spell queue is idle                                                |
| `Spell.castAndWait(spell, options?)` | Cast and wait                                                                 |
| `Spell.meleeAndWait(options?)`       | Melee and wait                                                                |
| `Spell.idle()` / `busy()`            | Queue state                                                                   |
| `Spell.clear()`                      | Clear spell queue                                                             |
| `Spell.class()`                      | Detected Wynn class                                                           |
| `Spell.name(slot)`                   | Spell name for slot                                                           |
| `Spell.names()`                      | Known spell names                                                             |
| `Spell.queue()`                      | Queue entries                                                                 |
| `Spell.size()`                       | Queue size                                                                    |
| `Spell.maxQueue()`                   | Configured max spell queue length (Spells module setting), `0` if unavailable |

Options may include:

| Option                             | Description                                                                                      |
| ---------------------------------- | ------------------------------------------------------------------------------------------------ |
| `crouch`                           | Cast while crouching                                                                             |
| `flip`                             | Flip click order                                                                                 |
| `maxQueue`                         | Do not queue if queue is larger than this (per-call cap, distinct from `Spell.maxQueue()` above) |
| `timeoutMs` / `timeout` / `waitMs` | Wait timeout for wait APIs                                                                       |

Wait APIs must run from `Script.thread`, not event callbacks.

## Wynn

| Function                       | Description                               |
| ------------------------------ | ----------------------------------------- |
| `Wynn.class()`                 | Detected Wynn class                       |
| `Wynn.health()`                | `{ current, max, fraction }` or `null`    |
| `Wynn.mana()`                  | `{ current, max, fraction }`              |
| `Wynn.powder()`                | `{ type, charge, ready }`                 |
| `Wynn.powderReady(threshold?)` | Powder ready check                        |
| `Wynn.resource(name?)`         | Class-resource snapshot or named resource |
| `Wynn.state()`                 | `{ class, health, mana, resource }`       |
| `Wynn.Spell`                   | Alias for `Spell`                         |
