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

# Darknet Crates

A case-opening app in the tablet. Players spend Altcoin (AC) on a crate, watch a reel spin and win an item. It is on by default and every part of it is yours to set: which crates exist, what is in them and how likely each item is.

Turn the whole app off in `configs/shared.lua`:

```lua
EnableCrates = false,
```

## What a player sees

* The crates, cheapest first, each with its price.
* Inside a crate, every item with its **chance**, worked out from your weights.
* A reel that lands on the prize. Big wins (rare, covert, gold) also show in everyone's live feed.
* If something is refused (not enough Altcoin, a cooldown), the tablet says why.

Players cannot read your drop table: it lives in `configs/server.lua`, which is never sent to them. The server rolls every opening; the tablet only plays the result.

## Setting the contents

Everything is in `configs/server.lua`, under `Crates` and `CrateOptions`.

```lua
Crates = {
    contraband = {
        id = 'contraband',
        label = 'Contraband Cache',
        tagline = 'TIER I // STREET CONTRABAND',
        description = 'Street-level contraband.',
        price = 25,                       -- Altcoin, a whole number (0 = free)
        color = 'teal', hexColor = '#14b8a6',
        badge = 'bg-teal-500/20 text-teal-300 border-teal-500/40',
        -- enabled = false,               -- take the whole crate out
        items = {
            { name = 'lockpick', label = 'Standard Lockpick (x3)', count = 3, rarity = 'common', weight = 16 },
            { name = 'WEAPON_M9', label = 'Beretta M9A3', count = 1, rarity = 'rare', weight = 4.5 },
            -- { name = 'c4', label = 'C4', count = 1, rarity = 'gold', weight = 1, enabled = false },
        },
    },
},
```

| Field     | Meaning                                                                                       |
| --------- | --------------------------------------------------------------------------------------------- |
| `name`    | The item as your inventory knows it. Weapons: `WEAPON_X`.                                     |
| `label`   | What the tablet shows.                                                                        |
| `count`   | How many are given.                                                                           |
| `rarity`  | `common`, `uncommon`, `rare`, `covert` or `gold`: the colour, and whether a win is announced. |
| `weight`  | How likely the item is compared with the others in that crate.                                |
| `enabled` | `false` takes a crate or an item out without deleting it.                                     |

**Chance = the item's weight ÷ the total of all weights in that crate.** With weights 75, 24 and 1 the chances are 75%, 24% and 1%. The tablet shows these, so what players read is what the server rolls. Weights do not have to add up to 100.

To add a crate, copy one, give it a new key and `id`, and set its price and items.

### Items your inventory does not know

At start the server checks every item against your inventory. An item it does not know is left out of that crate and listed in the console (`Crates: the inventory does not know "..."`). A crate with no usable item is hidden. So nobody can pay for a prize that cannot be given. Remove or fix the items that are listed.

## Options

```lua
CrateOptions = {
    OpenCooldown = 3,          -- seconds between two openings by the same player
    ClaimSeconds = 25,         -- the prize is handed over after this long even if the tablet was closed
    RecentDrops = 8,           -- how many big wins the live feed remembers
    Broadcast = { rare = true, covert = true, gold = true },       -- these wins show in the live feed
    WebhookRarities = { covert = true, gold = true },              -- these wins go to Discord
},
```

Big wins are posted to `Webhooks.CrateLogs` (or `StoreLogs` when that is empty).

## Good to know

* The price is taken in one step, and only one opening runs at a time per player, so a double click can never open two crates for one price.
* A prize that does not fit in the inventory is left on the ground with ox\_inventory. On other inventories it waits for the player and is handed over once there is room.
* A prize is handed over by itself after `ClaimSeconds`, so closing the tablet during the reel never loses it.
* Chances are not adjusted by luck, streaks or the price paid.
