> For the complete documentation index, see [llms.txt](https://docs.mantic.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mantic.dev/manticswords/config-files/enchants.yml.md). Agents can also search and read this documentation through its [MCP server](https://docs.mantic.dev/~gitbook/mcp).

# enchants.yml

Configure enchant chances, levels, rewards, and command dispatch in enchants.yml.

Use `/manticsword editor` → **Enchantments**, or edit `plugins/ManticSwords/enchants.yml` directly and run `/manticsword reload`.

ManticSwords 2.0 stores enchant definitions in YAML. Configuration from older versions is converted automatically on first start and the originals are kept in `old-files/`; after that, only `enchants.yml` is read. `enchant-list.txt` is generated for reference and is not read by the plugin.

## Entry fields

Each entry in `enchants` needs a unique `id`. Commonly used keys:

| Key                                                                 | What it does                                                  |
| ------------------------------------------------------------------- | ------------------------------------------------------------- |
| `chance`                                                            | Base activation chance (0–100)                                |
| `chance-per-upgrade`                                                | Extra percentage points for every level above `default-level` |
| `default-level`, `max-level`                                        | Starting and maximum upgrade level                            |
| `required-prestige-level`                                           | Prestige needed before the enchant can be earned or upgraded  |
| `crystals-per`, `money-per`, `exp-per`                              | Rewards per activation                                        |
| `additional-crystals-per-upgrade`                                   | Extra reward for every upgrade level                          |
| `commands`, `command-dispatch-type`, `permission-command-overrides` | Command rewards                                               |
| `messages`                                                          | Messages sent on activation                                   |

```yaml
enchants:
  - id: crystal_finder
    chance: 25.0
    chance-per-upgrade: 0.3
    crystals-per: 1
    additional-crystals-per-upgrade: 1
    default-level: 1
    max-level: 15
    required-prestige-level: 0
use-legacy-chances: false
```

Keep IDs consistent with `mob-swords.yml`, `menus/upgrades.yml`, and any `first-join-sword.enchants` values in `config.yml`.

## Command reward modes

Set `command-dispatch-type` on the enchant:

* `ALL` runs every configured command.
* `RANDOM` runs one command, chosen with equal odds.
* `CHANCE` runs one command, chosen by relative weights.

In `CHANCE` mode, append `CHANCE:<weight>` to each command. Commands without a weight use `100`:

```yaml
    command-dispatch-type: CHANCE
    commands:
      - 'eco give {player} 100 CHANCE:90'
      - 'eco give {player} 1000 CHANCE:10'
```

With weights of `90` and `10`, the first reward is nine times as likely as the second. The pick happens only after the enchant's own activation chance succeeds. `{player}` and `{quantity}` work as before.

## Permission-based command rewards

Add `permission-command-overrides` at the same indentation as `commands`. Only the first permission the player has is used, so put the highest reward first — ranks can inherit permissions. Matching commands replace the normal commands rather than running in addition to them.

```yaml
    command-dispatch-type: ALL
    commands:
      - 'token give {player} 1'
    permission-command-overrides:
      - permission: rewards.vip
        commands:
          - 'token give {player} 3'
      - permission: group.rookie
        commands:
          - 'token give {player} 2'
```

An entry with `commands: []` runs nothing when it matches; with no match, the normal `commands` run. The selected list follows the same `command-dispatch-type`. Overrides replace command rewards only — built-in crystals, money, XP and other enchant effects are unchanged, so avoid paying the same currency through both settings unless that is what you want.
