> For the complete documentation index, see [llms.txt](https://docs.hyper-code.eu/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyper-code.eu/documentation/collectors/config.md).

# Gather & Trade – Configuration

All options of Gather & Trade: framework, notifications, progress bar, gathering zones, openable items, sellers, translations and colours.

The settings are split into three files in `shared/`. None of them is escrowed.

| File                | Content                                                                   |
| ------------------- | ------------------------------------------------------------------------- |
| `config.lua`        | Framework, image path, notifications, progress bar, translations, colours |
| `farm_config.lua`   | Gathering zones and openable items                                        |
| `seller_config.lua` | Sellers and prices                                                        |

## General

`shared/config.lua`

| Option                              | Default                                   | Description                                                                                                                                      |
| ----------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Config.Framework`                  | `"es_extended"`                           | Resource name of your framework (`es_extended`, `qb-core` or a renamed core). ESX is detected via `getSharedObject`, QBCore via `GetCoreObject`. |
| `Config.General.ItemPath`           | `"nui://hc_inventory/html/public/items/"` | Folder with your item images, as `nui://<resource>/<path>/`. Change it to your inventory, for example `nui://ox_inventory/web/images/`.          |
| `Config.General.MarkerDrawDistance` | `5.0`                                     | Extra distance (on top of the marker size) at which seller markers are drawn                                                                     |

{% hint style="warning" %}
Do not edit the `rgba()` helper at the end of `config.lua`. It is used by the other config files.
{% endhint %}

## Notifications and progress bar

```lua
Config.ShowNotification = function(source, message, title, type)
    if IsDuplicityVersion() then -- server side
        TriggerClientEvent("hc_notify:notify", source, message, title, type, 3000)
    else -- client side
        exports['hc_notify']:notify(message, title, type, 3000)
    end
end

Config.CallProgressBar = function(source, message, duration)
    if IsDuplicityVersion() then -- server side
        TriggerClientEvent('hc_notify:progressbar', source, message, duration)
    else
        exports["hc_notify"]:progressbar(message, duration)
    end
end

Config.ShowHelpNotification = function(message)
    exports['hc_notify']:helpNotify(message, 'E', -1)
end
```

Replace the calls with your own notification and progress bar resource if you do not use [Premium Notify](https://shop.hyper-code.eu/package/6496308). `duration` is in milliseconds.

## Gathering zones

`shared/farm_config.lua`

### General

| Option                                | Default | Description                               |
| ------------------------------------- | ------- | ----------------------------------------- |
| `Config.Farm.General.Key`             | `38`    | Control to collect a prop (`38` = E)      |
| `Config.Farm.General.ShowHelpNotify`  | `true`  | Show the help notification next to a prop |
| `Config.Farm.General.ShowProgressbar` | `true`  | Show the progress bar while collecting    |

### Zones

```lua
Config.Farm.Farms = {
    {
        Name = "Pearl",
        SpawnProp = 'prop_coral_stone_03',
        MinimalDistanceBetweenProps = 5.0,
        PropsSpawnCount = 15,
        ProgressBarText = "You are searching for pearls ...",
        CenterCoords = vector3(-2039.3169, -533.4743, 9.1501),
        Radius = 20.0,
        GatheringTime = 5,
        BlipConfig = { SpawnBlip = true, Sprite = 780, Color = 8, Size = 1.0 },
        Animation = {
            -- Library = "amb@world_human_stand_fishing@idle_a",
            -- Anim = "idle_c",
            Scenario = "world_human_gardener_plant",
        },
        RequiredItem = "shovel",
        Item = "shell",
        ItemAmountMin = 2,
        ItemAmountMax = 5,
        UsableItem = { ... }, -- see below
    },
}
```

| Field                             | Description                                                              |
| --------------------------------- | ------------------------------------------------------------------------ |
| `Name`                            | Name of the zone, used for the blip and as notification title            |
| `SpawnProp`                       | Prop model (name or hash) that spawns inside the zone                    |
| `MinimalDistanceBetweenProps`     | Minimum distance between two props                                       |
| `PropsSpawnCount`                 | Number of props in the zone at the same time                             |
| `ProgressBarText`                 | Text of the progress bar                                                 |
| `CenterCoords`                    | Centre of the zone                                                       |
| `Radius`                          | Radius around the centre in which props spawn                            |
| `GatheringTime`                   | Time to collect one prop, in seconds                                     |
| `BlipConfig`                      | `SpawnBlip`, `Sprite`, `Color`, `Size` of the zone blip                  |
| `Animation`                       | Either `Library` + `Anim` (animation) or `Scenario`                      |
| `RequiredItem`                    | Item the player must have to collect, or `false`                         |
| `Item`                            | Item the player receives                                                 |
| `ItemAmountMin` / `ItemAmountMax` | Random amount per prop. If left out, the player gets 1.                  |
| `UsableItem`                      | Optional openable item, see below. Use `UsableItem = {}` to turn it off. |

A collected prop is removed for everyone and a new one spawns at another random spot in the zone.

{% hint style="info" %}
Props spawn on the ground. The ground height is measured by the first player who comes within 200 m of the zone, so props appear once a player is nearby.
{% endhint %}

### Openable items

If `UsableItem.ItemChances` has entries, the zone's `Item` becomes usable. Using it opens **all** of these items in the inventory at once:

```lua
UsableItem = {
    ItemChances = {
        ["pearl"]     = { Probability = 15 },
        ["shellmeat"] = { Probability = 40 },
    },
    OpenAnimation = {
        Scenario = "PROP_HUMAN_PARKING_METER",
    },
    OpenTimePerItem = 2 -- seconds
}
```

| Field             | Description                                                                                                                                                                  |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ItemChances`     | Loot table. `Probability` is a chance in percent out of 100 per opened item. Whatever is left up to 100 is "empty". In the example: 15 % pearl, 40 % shell meat, 45 % empty. |
| `OpenAnimation`   | `Library` + `Anim` or `Scenario` while opening                                                                                                                               |
| `OpenTimePerItem` | Opening time per item in seconds. 10 shells take 20 seconds.                                                                                                                 |

{% hint style="warning" %}
Keep the sum of all `Probability` values at 100 or below.
{% endhint %}

## Sellers

`shared/seller_config.lua`

### General

| Option                                 | Default | Description                              |
| -------------------------------------- | ------- | ---------------------------------------- |
| `Config.Seller.General.Key`            | `38`    | Control to open the sell menu (`38` = E) |
| `Config.Seller.General.SpawnMarkers`   | `true`  | Draw a marker at every seller            |
| `Config.Seller.General.ShowHelpNotify` | `true`  | Show the help notification at the seller |

### Seller entries

```lua
Config.Seller.Sellers = {
    {
        Name = "Pearl Seller",
        Position = vector3(-1600.8698, -975.8824, 13.0174),
        BlipConfig = { SpawnBlip = true, Sprite = 434, Color = 8, Size = 1.0 },
        MarkerConfig = {
            Type = 1,
            Color = rgba(254, 9, 67, 100),
            Size = vector3(1.0, 1.0, 0.5),
        },
        MoneyAccount = "bank", -- "money" (cash), "bank" or "black_money"
        Items = {
            { Name = "shellmeat", Price = 12 },
            { Name = "pearl", Price = 30 },
        },
        PedConfig = {
            Model = "a_m_m_soucent_03", -- "" = no ped
            Heading = 35.0
        },
    },
}
```

| Field          | Description                                                                                                                                    |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `Name`         | Name in the UI and on the blip                                                                                                                 |
| `Position`     | Position of the seller (ped and interaction point)                                                                                             |
| `BlipConfig`   | `SpawnBlip`, `Sprite`, `Color`, `Size`                                                                                                         |
| `MarkerConfig` | `Type`, `Color` (`rgba(r, g, b, a)`) and `Size` of the marker. Also needed when markers are off, because `Size` sets the interaction distance. |
| `MoneyAccount` | Account that receives the money. If not set, `money` (cash) is used.                                                                           |
| `Items`        | Items the seller buys, with a fixed `Price` per piece                                                                                          |
| `PedConfig`    | Ped `Model` and `Heading`                                                                                                                      |

{% hint style="info" %}
The sell menu opens within `MarkerConfig.Size.x` of the seller. The server accepts the sale within `MarkerConfig.Size.z × 2`. Keep `Size.z × 2` at least as large as `Size.x` (the default `1.0 / 0.5` is fine).
{% endhint %}

{% hint style="warning" %}
The default seller entry contains `MoneyAccount` twice (`"money"` and `"bank"`). In Lua the last one wins, so the default pays to `bank`. Keep only one line.
{% endhint %}

## Translations and colours

`shared/config.lua`

* `Config.Translation` contains every text of the zones, the opening, the seller UI and the notifications.
* `Config.Style` sets the two accent colours of the UI (`LightColor`, `DarkColor`).
