> For the complete documentation index, see [llms.txt](https://organized-chaos.gitbook.io/organized-chaos-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://organized-chaos.gitbook.io/organized-chaos-docs/duck-down/stake-leaderboard-and-saved-files.md).

# Stake, leaderboard and saved files

How stakes and the leaderboard work, and what Duck Down stores.

## Stake

With a framework, the first player at the table chooses the stake in the lobby from `Config.BuyIns`. The table starts out with `Config.BuyIn`.

* Everyone at the table is told about a change, and the game can only be started `Config.BuyInDelay` seconds after it, so that nobody is caught off guard.
* The stake is taken from everyone when the game starts, or from nobody if one player cannot pay.
* The winner takes the pot. A tie splits it, and whatever does not divide evenly goes to the first winner.
* A winner who is not connected at that moment is paid as soon as they are back.
* Games with computer players are never played for money.

To switch the stake off completely, leave `Config.BuyIn = 0` and set `Config.BuyIns = {}`.

## Leaderboard

With `oxmysql`, the following is kept for every player: games, wins, rounds, points and calls that held. The leaderboard shows the players with the most wins, and among equals those with the fewest points a round. It is `Config.LeaderboardSize` entries long and also shows the player's own record.

* A game counts when it is played to its end. Rounds, points and calls also count against the computer.
* A win only counts among humans, also when all the others have given up.

`Config.Stats = false` switches records and the leaderboard off.

## What the resource stores

| Where                                | Contents                                              |
| ------------------------------------ | ----------------------------------------------------- |
| `tables.json` in the resource folder | Tables placed with `/duckdown_place`                  |
| `owed.json` in the resource folder   | Winnings for players who were away when they were due |
| `duckdown_stats` in your database    | Records and the leaderboard. Created automatically    |

{% hint style="warning" %}
Keep `tables.json` and `owed.json` when you update the resource. Overwriting them removes your placed tables and any winnings still owed.
{% endhint %}
