> For the complete documentation index, see [llms.txt](https://xpressdev.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xpressdev.gitbook.io/docs/mods/shinyreroll.md).

# ShinyReroll

ShinyReroll lets players **turn in a set of shiny Pokémon for a chance to roll a brand new random shiny**. Select any number of shinies from your party or PC, confirm, and watch the reveal - win and you walk away with a fresh shiny; lose and the selection is gone.

Everything about the odds and the reward pool is config - how much each Pokémon contributes to the chance, how many can be selected at once, and which kinds of species are eligible to be rolled.

***

## Features

* **Turn in any number of shinies** from your party or PC in a single reroll
* **Configurable win chance per Pokémon selected**, capped by a configurable maximum selection
* **Reward species pool driven by Cobblemon's own species labels** - legendary, mythical, ultra beast and paradox Pokémon are each independently toggleable
* **Nothing is consumed unless the reroll actually completes** - a selection that changed after confirming (traded, released, no longer shiny) aborts the roll instead of eating your Pokémon
* **The reward always finds a home** - it's delivered to your party if there's room, otherwise your PC
* **Works with any Fabric permissions plugin**, not just LuckPerms
* **Every message is editable** through `lang.json`, with MiniMessage formatting

***

## How it works

Running `/shinyreroll open` opens a GUI where you pick shiny Pokémon from your **party** and **PC**. Every shiny you select is added to the roll:

* Each selected Pokémon adds `reroll.chancePerPokemon` percent to your win chance, linearly, up to `reroll.maxPokemonSelected` Pokémon.
* Confirming opens a rolling animation - win, and a brand new random shiny is created for you; lose, and every selected Pokémon is gone.
* Only shiny Pokémon can be selected. Non-shiny entries show up as an unclickable "Not a Shiny Pokemon" placeholder so you can see why they're not selectable.

{% hint style="info" %}
Your selection is **re-checked the moment the roll finishes**, not when you confirm. If a selected Pokémon stopped resolving, stopped being shiny, or the count is no longer within `reroll.maxPokemonSelected`, the roll aborts and **nothing is consumed**.
{% endhint %}

{% hint style="success" %}
The reward is delivered to your **party** if there's room, otherwise your **PC**. If both are full, the reroll is refused outright and nothing is taken from you.
{% endhint %}

***

## Commands

All commands live under `/shinyreroll`.

| Command                      | What it does                                                                       | Default Permission |
| ---------------------------- | ---------------------------------------------------------------------------------- | ------------------ |
| `/shinyreroll open`          | Opens the reroll GUI for yourself. Refuses if you already have a roll in progress. | everyone           |
| `/shinyreroll open <player>` | Opens the reroll GUI for another player. Supports tab completion and selectors.    | operators          |
| `/shinyreroll reload`        | Reloads config and lang.                                                           | operators          |

***

## Permissions

ShinyReroll uses [Fabric's permissions API](https://github.com/lucko/fabric-permissions-api), which works with any permissions plugin - LuckPerms or otherwise - and falls back to the vanilla permission level when none is installed.

| Node                 | Grants                       | Default   |
| -------------------- | ---------------------------- | --------- |
| `shinyreroll.self`   | `/shinyreroll open`          | everyone  |
| `shinyreroll.other`  | `/shinyreroll open <player>` | operators |
| `shinyreroll.reload` | `/shinyreroll reload`        | operators |

***

## Configuration

Config files live in `config/ShinyReroll/` and are created on first run:

| File          | Purpose                                                                                |
| ------------- | -------------------------------------------------------------------------------------- |
| `config.json` | Roll odds and selection limit, and which kinds of species can be rolled as the reward. |
| `lang.json`   | Every player-facing message.                                                           |

Edit a file and run `/shinyreroll reload`, or restart the server, to apply changes.

{% hint style="success" %}
Configs from older versions load fine and are rewritten in the current format automatically - nothing needs migrating by hand.
{% endhint %}

### `reroll`

| Key                  | Default | Description                                                                                                                                       |
| -------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `maxPokemonSelected` | `10`    | Most shinies a player may put into one reroll.                                                                                                    |
| `chancePerPokemon`   | `10.0`  | **Percent** chance contributed by each selected shiny. Overall chance is `selectedCount × chancePerPokemon`, capped only by `maxPokemonSelected`. |

### `allowed`

| Key             | Default | Description                                                                                                                 |
| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
| `legendary`     | `false` | Legendaries may be rolled as the reward. Also covers restricted species such as the Tapus, the Treasures of Ruin and Ho-Oh. |
| `mythical`      | `false` | Mythicals may be rolled as the reward.                                                                                      |
| `ultraBeast`    | `false` | Ultra Beasts may be rolled as the reward.                                                                                   |
| `paradox`       | `false` | Paradox Pokémon may be rolled as the reward.                                                                                |
| `unimplemented` | `false` | Species Cobblemon has not implemented may be rolled as the reward.                                                          |

{% hint style="info" %}
If every flag stays off and the config filters out every reachable species, the reroll refuses with a message and logs an error rather than hanging - turn at least one category on if the pool ends up empty.
{% endhint %}

***

## Messages

Every message players see is in `lang.json` and uses [MiniMessage](https://docs.advntr.dev/minimessage/format.html) formatting. Delete a key to fall back to its default.

| Key                        | When it's shown                                                             |
| -------------------------- | --------------------------------------------------------------------------- |
| `command.config_reloaded`  | `/shinyreroll reload` succeeded.                                            |
| `command.roll_in_progress` | A roll command is used while one is already running.                        |
| `gui.party_pc_select.*`    | The party/PC picker screen.                                                 |
| `gui.party_select.*`       | The party selection screen.                                                 |
| `gui.pc_select.title`      | The PC selection screen.                                                    |
| `gui.selected.*`           | The selected-Pokémon review screen.                                         |
| `gui.confirmation.*`       | The confirmation screen.                                                    |
| `gui.rolling.title`        | The rolling animation screen.                                               |
| `gui.info.*`               | The chance info button shown during selection.                              |
| `gui.not_shiny`            | Shown on a non-shiny Pokémon in the selection screens.                      |
| `roll.validation_failed`   | The selection changed since it was confirmed, so nothing was rerolled.      |
| `roll.no_eligible_species` | No species are eligible with the current `allowed` settings.                |
| `roll.no_space`            | Both party and PC are full - nothing was consumed.                          |
| `roll.win`                 | A reroll wins.                                                              |
| `roll.loss`                | A reroll loses.                                                             |
| `pokemon.lore.*`           | Level, nature, ability, IV and EV lines shown on Pokémon items in the GUIs. |

***

## Requirements

* Minecraft 1.21.1 (Fabric)
* Cobblemon
* Fabric API + Fabric Language Kotlin
