# Customization

This script offers extensive customization options through its configuration files and adaptable code structure.

### Main Configuration (`config.lua`)

The `config.lua` file is the central place to tweak the script's core behavior.

| Variable                      | Description                                                                                                                                                                                          |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Config.Locale`               | Sets the language for all in-game and UI text. Multiple languages are provided in the `locales/` folder.                                                                                             |
| `Config.Framework`            | Your server's framework. Set to `'esx'` or `'qbcore'`.                                                                                                                                               |
| `Config.Interaction`          | The interaction method for opening a shop menu. Options: `'default'` (3D text prompt), `'ox_target'`, or `'qb-target'`.                                                                              |
| `Config.RadiusInteract`       | If using `'default'` interaction, this determines the distance (in meters) from which a player can interact with the NPC.                                                                            |
| `Config.DefaultPed`           | The fallback ped model used if a shop location is created without a specific model or the specified model is invalid.                                                                                |
| `Config.Command`              | The chat command used to open the Shop Creator management UI.                                                                                                                                        |
| `Config.InventoryImagePath`   | The NUI path to your inventory's item images. This is used to display product images in the shop UI. For `ox_inventory`, the default path is correct.                                                |
| `Config.Screenshot`           | If `true`, the script will use `screenshot-basic` to include a screenshot in Discord webhook notifications.                                                                                          |
| `Config.PedSpawnDistance`     | The maximum distance a player can be from an NPC for it to spawn. This helps optimize performance by despawning distant NPCs.                                                                        |
| `Config.Categories`           | A list of string categories used to organize products in the shop creation menu (e.g., `"items"`, `"weapons"`).                                                                                      |
| `Config.BlacklistWeapons`     | A list of weapon names that are not permitted to be used when initiating a shop robbery.                                                                                                             |
| `Config.RobberyNotifyJobs`    | A list of job names (e.g., `"police"`) that will receive an alert when a shop robbery is in progress.                                                                                                |
| `Config.PoliceAlert`          | Sets the police alert behavior. Options: `'default'` (notifies jobs in `RobberyNotifyJobs`) or `'custom'` (calls the `TriggerPoliceAlert` function in `bridge/server.lua`, which can be customized). |
| `Config.UseDiscordIdentifier` | If `true`, the script uses a player's Discord ID for ownership and employee records. This is highly recommended for accuracy.                                                                        |
| `Config.RobberyCooldown`      | The default cooldown time (in seconds) between robberies for any given shop location. This can be overridden in each shop's specific settings.                                                       |

### Locales (Translations) 🌍

The script is fully translatable.

* **Backend/Command Text:** All server-side notifications and Lua-driven text can be found in the `locales/` directory. Edit the file corresponding to your chosen language.
* **UI Text (NUI):** All text displayed in the user interfaces is located in `html/locales.js`. You can edit existing languages or add new ones here.

### Commands

* `/[Config.Command]` (e.g., `/shopcreator`): This is the primary command used by administrators or permissioned users to open the shop management UI.

### Events & Customization

The script is designed to be largely self-contained, but it provides a key function for deeper integration with other resources.

#### Custom Police Alerts

If you set `Config.PoliceAlert = "custom"` in `config.lua`, the script will call the `TriggerPoliceAlert` function located in `bridge/server.lua` instead of the default notification system. You can edit this function to integrate with your server's specific police dispatch system (e.g., `ps-dispatch`, `cd_dispatch`).

**Example of customization in `bridge/server.lua`:**

```lua
function TriggerPoliceAlert(x, y, z, shopLabel)
    -- Your custom alert logic here. For example:
    exports['ps-dispatch']:SuspiciousActivity(
        "Shop Robbery",
        "A robbery is in progress at " .. shopLabel,
        {x = x, y = y, z = z}
    )
end
```

### NUI (User Interface)

The HTML, CSS, and JavaScript files for all user interfaces are located in the `html/` directory.

* `index.html`: The main structure of the UI.
* `style.css`: All styling for the creator menu, customer shop, and modals.
* `script.js`: The client-side logic that handles all UI interactions, form submissions, and communication with the Lua scripts.
* `locales.js`: Contains all translations for the UI.
