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

# Items & inventory

Complete Ox and QB item definitions, ESX registration and images.

Register these eight items before starting the resource. Choose the tab for your inventory. The Ox definitions match `install/ox_itemlist.md`; the qb-inventory tab contains the complete supplied QB definitions.

{% tabs %}
{% tab title="ox\_inventory" %}
Paste inside the existing table in `ox_inventory/data/items.lua`:

```lua
['shovel_basic'] = {
    label = 'Basic Shovel',
    weight = 1500,
    stack = false,
    close = true,
    client = { export = 'tn_treasurehunter.useShovel' }
},

['shovel_iron'] = {
    label = 'Iron Shovel',
    weight = 1800,
    stack = false,
    close = true,
    client = { export = 'tn_treasurehunter.useShovel' }
},

['shovel_wide'] = {
    label = 'Wide Iron Shovel',
    weight = 2200,
    stack = false,
    close = true,
    client = { export = 'tn_treasurehunter.useShovel' }
},

['map_common'] = {
    label = 'Common Treasure Map',
    weight = 50,
    stack = true,
    close = true,
    client = { export = 'tn_treasurehunter.useMap' }
},

['map_rare'] = {
    label = 'Rare Treasure Map',
    weight = 50,
    stack = true,
    close = true,
    client = { export = 'tn_treasurehunter.useMap' }
},

['map_epic'] = {
    label = 'Epic Treasure Map',
    weight = 50,
    stack = true,
    close = true,
    client = { export = 'tn_treasurehunter.useMap' }
},

['map_mythic'] = {
    label = 'Mythic Treasure Map',
    weight = 50,
    stack = true,
    close = true,
    client = { export = 'tn_treasurehunter.useMap' }
},

['metaldetector'] = {
    label = 'Metal Detector',
    weight = 3000,
    stack = false,
    close = false,
    description = 'Beeps faster the closer you are to the treasure.',
    client = { export = 'tn_treasurehunter.useDetector' }
},
```

{% endtab %}

{% tab title="qb-inventory" %}

## qb-inventory item list

Add these items to `qb-core/shared/items.lua`.

Copy the images from `install/itemimages/` to `qb-inventory/html/images/`.

Maps and the metal detector are registered as usable items by the script itself. Shovels do not need to be used; the best shovel in the inventory is picked automatically when digging.

```lua
shovel_basic = {
    name = 'shovel_basic',
    label = 'Basic Shovel',
    weight = 1500,
    type = 'item',
    image = 'shovel_basic.png',
    unique = true,
    useable = false,
    shouldClose = true,
    description = 'A simple shovel for digging up treasure.'
},

shovel_iron = {
    name = 'shovel_iron',
    label = 'Iron Shovel',
    weight = 1800,
    type = 'item',
    image = 'shovel_iron.png',
    unique = true,
    useable = false,
    shouldClose = true,
    description = 'A sturdy iron shovel. Makes digging easier.'
},

shovel_wide = {
    name = 'shovel_wide',
    label = 'Wide Iron Shovel',
    weight = 2200,
    type = 'item',
    image = 'shovel_wide.png',
    unique = true,
    useable = false,
    shouldClose = true,
    description = 'A wide iron shovel. The easiest way to dig.'
},

map_common = {
    name = 'map_common',
    label = 'Common Treasure Map',
    weight = 50,
    type = 'item',
    image = 'map_common.png',
    unique = false,
    useable = true,
    shouldClose = true,
    description = 'An old map with a marked spot.'
},

map_rare = {
    name = 'map_rare',
    label = 'Rare Treasure Map',
    weight = 50,
    type = 'item',
    image = 'map_rare.png',
    unique = false,
    useable = true,
    shouldClose = true,
    description = 'A rare map with a marked spot.'
},

map_epic = {
    name = 'map_epic',
    label = 'Epic Treasure Map',
    weight = 50,
    type = 'item',
    image = 'map_epic.png',
    unique = false,
    useable = true,
    shouldClose = true,
    description = 'An epic map with a marked spot.'
},

map_mythic = {
    name = 'map_mythic',
    label = 'Mythic Treasure Map',
    weight = 50,
    type = 'item',
    image = 'map_mythic.png',
    unique = false,
    useable = true,
    shouldClose = true,
    description = 'A legendary map. Your fate is marked.'
},

metaldetector = {
    name = 'metaldetector',
    label = 'Metal Detector',
    weight = 3000,
    type = 'item',
    image = 'metaldetector.png',
    unique = true,
    useable = true,
    shouldClose = true,
    description = 'Beeps faster the closer you are to the treasure.'
},
```

### Reward items

The default rewards in `Config.Maps` use `gold`, `iron` and `trash`. If your server does not have them yet, add them too or change the rewards in `config.lua`. With the QB inventory bridge, `money` is paid out as cash.
{% endtab %}

{% tab title="ESX default" %}
Register the following names in your ESX item catalog using the schema of your installed inventory. Weight units depend on your ESX inventory implementation.

| Item                      | Purpose          |
| ------------------------- | ---------------- |
| `shovel_basic`            | Basic shovel.    |
| `shovel_iron`             | Iron shovel.     |
| `shovel_wide`             | Wide shovel.     |
| `metaldetector`           | Detector.        |
| `map_common` / `map_rare` | Common/rare map. |
| `map_epic` / `map_mythic` | Epic/mythic map. |

The framework bridge registers map and detector use. Shovels only need to be held in the inventory.
{% endtab %}
{% endtabs %}

## Images

Copy all eight images from `install/itemimages/` to `ox_inventory/web/images/` or your QB inventory's image directory. The filenames match the item names.

## Match names to configuration

| Config field                 | Item(s)                                     |
| ---------------------------- | ------------------------------------------- |
| `Config.Shovels.<type>.item` | Shovel item for each type.                  |
| `Config.MetalDetector.item`  | Detector item.                              |
| `Config.Maps.<tier>.item`    | Map item; Ox callback expects `map_<tier>`. |
| `Config.Maps.<tier>.rewards` | Every configured reward item must exist.    |

Shop labels use locale keys matching item names. Register `gold`, `iron` and `trash` or replace the default reward pools. With the QB and ESX-default bridges, `money` is paid as framework cash. With the Ox bridge, `money` is added as an inventory item.

## Test

Buy tools and a common map at the NPC. Use the map, toggle the detector, complete the dig, and verify map consumption, chest rewards and XP.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://tn-modifications.gitbook.io/tn-modifications/tn_treasurehunter/items.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
