> For the complete documentation index, see [llms.txt](https://edseries-plugins.gitbook.io/p/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://edseries-plugins.gitbook.io/p/edpets/core/leveling-sources.md).

# Leveling & Grind Sources

A **grind source id** names where grinding happened. Pets declare which sources level them up (`leveling.sources`) and which they boost (`buffs`). One grind action = one XP grant per eligible active pet.

## Built-in source ids

| Source id                 | Fires when                                               | Notes                                                        |
| ------------------------- | -------------------------------------------------------- | ------------------------------------------------------------ |
| `pinnaprison-break-block` | A raw block is hand-mined in a PinnaPrison private mine  | one per block                                                |
| `pinnaprison-bulk-break`  | Enchant sweeps / bombs / drills / autominers finish      | scaled by block count                                        |
| `pinnaprison-<currency>`  | *(buff only)* boosts that PinnaPrison currency           | shows in its boosters GUI                                    |
| `pinnaprison-enchants`    | *(buff only)* boosts all PinnaPrison enchant proc chance | shows in its boosters GUI                                    |
| `edtools-break-block`     | Any block mined in an EdTools regen zone                 | one per block                                                |
| `edtools-break-<toolId>`  | A block mined with that zone tool                        | e.g. `edtools-break-pickaxe-tool`, `edtools-break-crop-tool` |
| `edtools-<currency>`      | *(buff only)* boosts that EdTools currency               | shows in its boosters GUI                                    |
| `eddungeons-swing-sword`  | Each hit on a dungeon mob                                | one per hit                                                  |
| `eddungeons-mob-kill`     | A dungeon mob dies                                       | one per kill                                                 |
| `eddungeons-<currency>`   | *(buff only)* boosts that EdDungeons currency            | shows in its boosters GUI                                    |
| `eddungeons-damage`       | *(buff only)* boosts EdDungeons sword damage             | shows in its boosters GUI                                    |
| `eddungeons-attack-speed` | *(buff only)* speeds up EdDungeons auto-hits             | shows in its boosters GUI                                    |
| `edprison-break-block`    | EdPrison's block batch event                             | scaled by the batch's block count                            |
| `edprison-<currency>`     | *(buff only)* boosts that EdPrison currency              | via its multiplier event                                     |

Third-party plugins can add their own ids — see [Custom Grind Sources](/p/edpets/developers/custom-sources.md).

## The XP math

For each active pet with the source configured:

```
xp = (source.xp + source.xp-increase-per-level × petLevel) × actions
xp = xp × (1 + totalXpBoostPercent / 100)
```

`totalXpBoostPercent` stacks the pet's rolled **experience boost**, its **mastery** XP bonus, **runes** with a `pet-xp` buff, **enhancements** with a `pet-xp` buff and the **XP Booster upgrade**.

XP needed for the next level: `xp-base + xp-increase-per-level × level`. The **effective max level** = the pet's `max-level` + mastery level bonus + `level-cap` enhancements + the Level Cap upgrade.

{% hint style="info" %}
The whole grind path is **async-safe and O(1)** — EdPets pre-computes a per-player cache of the sources its active pets react to, rebuilt only when pets change (equip, level-up, rune/enhancement changes). Grinding never walks configs.
{% endhint %}
