# Card Collection

### ⚡ First Start

1. **Apply the Database:**
   * Import `collections.sql` into your database.
2. **Install Card Images:**
   * Copy all cards from `html/collections` to `vorp_inventory/html/img/items`.
3. **Start the Script:**
   * Launch the script and wait for the automatic card insertion to complete.
4. **Restart the Server:**
   * Restart to update VORP Inventory images and items.

***

### ➕ Add a New Card or Collection

#### 1. Define the Card in Config

Edit the configuration file and add your card identifier to the appropriate collection in `Config.Cards`.\
Each collection supports up to **6 cards**.

**Example:** Adding `bt_6` to the "Botilus" collection:

```lua
Config.Cards = {
    ["Botilus"] = {
        "bt_1",
        "bt_2",
        "bt_3",
        "bt_4",
        "bt_5",
        "bt_6" -- New card
    },
    -- Other collections...
}
```

#### 2. Add the Card Image

* **Image size:** 150x220 pixels
* **Format:** `.png`
* **Where to place the image:**
  * `html/collections`
  * `vorp_inventory/html/img/items` (for inventory display)

#### 3. Enable Automatic Database Insertion (Optional)

Set in your config:

```lua
Config.AllowAutoInsertInDB = true
```

#### 4. Test the Card

* Restart your server.
* Verify that the card is visible in the correct collection and that the inventory displays the image.

***

### 📝 Admin Command: /collection

#### Description

The `/collection` command lets authorized admins place cards from any collection in the game world, directly at their current location.

#### Command Syntax

```
/collection <collection_name> <card_name>
```

* `<collection_name>`: Name of the collection (e.g., `FarWest`, `Indian`)
* `<card_name>`: Card identifier within the collection (e.g., `fw_1`, `volcae_2`)

#### Usage

* **No arguments:** Lists all available collection names.
* **Collection name only:** Lists all cards within that collection.
* **Collection and card name:** Places the specified card at your current position.

#### 📦 Card Placement Details

* The card’s position (x, y, z) is saved in the database.
* After placing, the list of spawned cards is automatically updated for all players.

#### 📌 Notes & Validations

* The system checks that the collection and card exist in `Config.Cards` before placement.
* Prevents duplicate cards at the same location.
* The card’s location and details are stored in the database (`collections` table).

### 📝 Admin Command: /delcollection

#### Description

The `/delcollection` command lets an admin **remove a spawned card** from the game world if they are standing near it.

#### How it works

* The command checks if the player is an admin.
* It detects your character’s current position.
* If you are **within 5 meters** of a placed card, that card will be deleted from:
  * The world (it disappears for everyone)
  * The database (permanent removal)
* The list of spawned cards is automatically updated and synchronized for all connected players.

#### Usage

```
/delcollection
```

* No arguments needed. Simply stand near the card you want to delete and run the command.

#### 📌 Notes

* Only admins (as defined in your script’s `checkIfPlayerIsAdmin`) can use this command.
* The deletion will affect both the server’s memory and the database (collections table).
* If you’re not close enough to any card, nothing will be deleted.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://botiv.gitbook.io/rdr2/card-collection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
