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

# Configuration

Documentation / Tru-LootCases

## Configuration

Edit `config.lua`.

```lua
Config.Framework = 'auto'
Config.Inventory = 'auto'
Config.Branding.title = 'Your Server'
Config.Theme.accent = '#8ccc3f'
```

### Rewards <a href="#rewards" id="rewards"></a>

`Config.Cases` defines case labels, images, duration and reward tables. Each reward includes `item`, `label`, `amount`, `chance` and `rarity`. Chance is a weight, not necessarily a percentage. Use valid inventory item names. The included cases are common, rare, legendary and knife.

### Configuration reference <a href="#configuration-reference" id="configuration-reference"></a>

The following settings are present in the supplied configuration. Edit the existing entries rather than adding duplicate definitions. Table settings contain additional options in the original configuration file.

| Setting                      | Supplied value or type |
| ---------------------------- | ---------------------- |
| `Config.Framework`           | `'auto'`               |
| `Config.Inventory`           | `'auto'`               |
| `Config.Debug`               | `false`                |
| `Config.Command`             | `'lootcase'`           |
| `Config.AllowCommandTesting` | `false`                |
| `Config.Branding`            | Configuration table    |
| `Config.Theme`               | Configuration table    |
| `Config.Cases`               | Configuration table    |

### Testing changes <a href="#testing-changes" id="testing-changes"></a>

Use valid inventory item identifiers and test with a nearly full inventory. Keep command testing disabled in production. Restart the resource after editing configuration and check the console for Lua syntax errors. Keep a copy of your previous working settings.

### Additional configuration reference <a href="#additional-configuration-reference" id="additional-configuration-reference"></a>

The following top-level declarations are taken from the supplied configuration. Table openings indicate a nested configuration block; edit its existing fields in the original file rather than copying an incomplete table. Review inline comments and preserve Lua syntax.

```lua
Config.Framework = 'auto'
Config.Inventory = 'auto'
Config.Debug = false
Config.Command = 'lootcase' -- test command: /lootcase common_case
Config.AllowCommandTesting = false
Config.Branding = {
Config.Theme = {
Config.Cases = {
```

### Safe configuration workflow <a href="#safe-configuration-workflow" id="safe-configuration-workflow"></a>

Change one setting at a time on a staging server. Keep a known-working copy of the configuration, restart the resource after changes and test the affected workflow with a normal player. If a change causes a startup error, restore the previous configuration and inspect the first error in the console.

### Understanding reward weights <a href="#understanding-reward-weights" id="understanding-reward-weights"></a>

In the supplied common case, the weights are 35 for beer, 30 for sandwich, 20 for lockpick, 10 for bandage and 5 for cash. They sum to 100, but other pools need not do so. A reward with weight 5 in a pool totaling 200 has a 2.5% relative chance, assuming all entries are eligible. Amount controls quantity, while rarity controls presentation. The supplied common case duration is 6500 milliseconds. Keep command testing disabled in production.
