# Configuration

## Configuration

All settings are stored in `config.lua`.

***

### Core Modes

#### Framework

```lua
Config.Framework = 'auto'  -- 'auto' | 'esx' | 'qb'
```

* `auto` – detect `es_extended` or `qb-core` / `qbx-core` automatically.
* `esx` / `qb` – force a specific framework.

***

#### Inventory

```lua
Config.Inventory = 'auto'  -- 'auto' | 'ox' | 'qb'
```

* `auto` – detect `ox_inventory` or `qb-inventory`.
* `ox` – force `ox_inventory`.
* `qb` – force `qb-inventory`.

The inventory bridge is used for all item checks, adding and removing items.

***

#### Locale & Notify

```lua
Config.Locale      = 'en'
Config.Notify      = 'okok'    -- 'esx' | 'okok'
Config.NotifyTitle = 'Obavijest'
```

* `Config.Locale` – which language to use from `locale/locales.lua` (`'en'`, `'hr'`, or your custom).
* `Config.Notify`:
  * `esx` – ESX notifications (if ESX is running).
  * `okok` – `okokNotify` resource (if started).
* `Config.NotifyTitle` – title used for okok/notify providers that support a title.

***

### Discord Logging

```lua
Config.Discord = {
  Webhook = ''
}
```

* Set `Webhook` to your Discord webhook URL to enable:
  * **Robbery start** embeds
  * **Loot** embeds\
    If empty, Discord logging is disabled.

***

### Minigame Bridge

```lua
Config.Minigame = {
  provider = 'boii_wire',       -- 'boii_wire' | 'psui_circle' | 'ox_skill' | 't3_lockpick' | 'fallback'
  resource = 'boii_minigames',  -- resource name that provides the minigame
  options  = {
    -- boii_minigames:
    style = 'default',
    timer = 60000,

    -- ps-ui:
    circles = 3,
    time    = 20,

    -- ox_lib (skillCheck):
    difficulties = { 'easy', 'easy', 'medium' },
    keys         = { 'W', 'A', 'S', 'D' },

    -- t3_lockpick:
    -- item       = 'lockpick',
    -- difficulty = 0.95,
    -- pins       = 12,
  }
}
```

* `provider` – which minigame implementation to use.
* `resource` – which resource to call exports from.
* `options` – provider-specific configuration.

If the provider or resource is missing, the script will fall back to a simple timed progress bar using `ox_lib` (if available) or `Wait`.

***

### Noise / Alarm System

```lua
Config.Noise = {
  Threshold    = 150,
  GainRun      = 10,
  GainWalk     = 1.5,
  GainAction   = 5,
  Decay        = 0.5,
  TickInterval = 50,
}
```

* `Threshold` – noise level at which the alarm triggers.
* `GainRun` – noise gained while running/sprinting.
* `GainWalk` – noise gained while walking.
* `GainAction` – noise gained on actions (e.g. shooting).
* `Decay` – how fast noise decreases when crouched.
* `TickInterval` – update interval in milliseconds.

A HUD bar is drawn on the client showing current noise percentage.

***

### Robbery Start & Basic Settings

```lua
Config.StartRadius  = 1.5
Config.RequiredItem = 'lockpick'
Config.Cooldown     = 10  -- minutes
```

* `StartRadius` – distance from a `StartLocation` where the prompt appears.
* `RequiredItem` – item name required to start a robbery (must exist in your inventory system).
* `Cooldown` – per-player cooldown between attempts (in minutes).

***

### Houses (Interiors)

```lua
Config.Houses = {
  {
    ipl    = 'apa_v_mp_h_01_a',
    coord  = vector3(-786.8663, 315.7642, 217.6385),
    chance = 10,
  },
  {
    ipl    = 'apa_v_mp_h_01_c',
    coord  = vector3(-786.9563, 315.6229, 187.9136),
    chance = 20,
  },
  -- ...
}
```

Each house entry:

* `ipl` – name of the IPL / interior (string).
* `coord` – vector3 coordinates inside the apartment.
* `chance` – weight for random selection (higher value = more likely).

The script picks one house based on these weights when a robbery starts.

***

### Police Settings

```lua
Config.Police = {
  minOnline = 0,
  jobName   = 'police',
}
```

* `minOnline` – minimum number of police online to allow robberies and alarms.
* `jobName` – job name used to count police players (ESX / QB job).

***

### Dispatch Bridge

```lua
-- 'lb-tablet' -> LB Tablet dispatch
-- 'tk'        -> tk_dispatch
-- 'ps'        -> ps-dispatch
-- 'next'      -> Next Scripts dispatch (resource 'dispatch')
-- 'none'      -> no dispatch

Config.Dispatch = 'lb-tablet'
```

Supported values:

* `'lb-tablet'` – LB Tablet dispatch.
* `'tk'` – `tk_dispatch`.
* `'ps'` – `ps-dispatch`.
* `'next'` – Next Scripts `dispatch`.
* `'none'` – disable dispatch entirely.

Each dispatch adapter uses its own API and passes translated titles/descriptions based on `locale/locales.lua`.

***

### Loot Configuration

```lua
Config.Loot = {
  defaultRadius = 0.3,
  zones = {
    ['apa_v_mp_h_01_a'] = {
      {
        coords = vector3(-789.63, 321.68, 217.13),
        radius = 1.0,
        items  = {
          { name = 'firstaid',        chance = 60, min = 1, max = 1 },
          { name = 'firstaid',        chance = 30, min = 1, max = 3 },
          { name = 'weapon_appistol', chance = 10, min = 1, max = 1 },
        },
      },
      -- more spots...
    },

    ['vanilla_3'] = {
      -- loot spots for that interior...
    },
  }
}
```

For each IPL/interior (`zones['iplName']`):

* Each table entry is a **loot zone**:
  * `coords` – vector3 of the spot.
  * `radius` – (optional) radius for target interaction.
    * If omitted, `Config.Loot.defaultRadius` is used.
  * `items` – list of possible loot items:
    * `name` – item name.
    * `chance` – relative weight for this item (all chances are normalized per zone).
    * `min` / `max` – random quantity range if this item is selected.

Server picks one item based on `chance` values and adds it to the player.

***

### Start Locations

```lua
Config.StartLocations = {
  vector3(-1112.25, -1578.4, 7.7),
  vector3(-1114.34, -1579.47, 7.7),
  -- ...
}
```

* Each vector3 is a world position where the robbery can be started.
* If a player is within `Config.StartRadius` of any point, the **E to start** help text appears.

***

### Locales

Locales are configured in `locale/locales.lua`:

* `Locales['en']` – English strings.
* `Locales['hr']` – Croatian strings.

The helper `L(key, ...)` reads from `Config.Locale`.

You can:

* Change existing texts.
* Add new language tables (e.g. `Locales['de'] = { ... }`).
* Set `Config.Locale = 'de'` to use your language.
