# Armory Shop System

<figure><img src="https://3505378470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmOhVROw9E3kpmAG3JYVe%2Fuploads%2FigSjlTeW15WLAgmSDpX8%2Farmory.png?alt=media&#x26;token=fa9d61ab-8242-452a-a424-71c6259d6060" alt=""><figcaption></figcaption></figure>

#### Armory Shop — General Logic

* **Categories:** Items are organized into “Weapons, Ammunition, Equipment, Protection, Utility.”
* **Rank filter:** Each item has a `grade`. A player only sees/selects items if their job grade meets or exceeds that level.
* **Cart flow:** Items are added with “Select,” then quantity can be increased/decreased or removed in the cart.
* **Quantity system:** `stack` defines how much is added per click (e.g., ammo boxes), and `maxPerCart` sets the maximum limit per purchase.
* **Payment:** The total cost is calculated, and the player pays with Card or Cash. If successful, items are added directly to the inventory.
* **Item binding:** `itemName` is the actual inventory item name; the system gives that item when purchased.
* **Validation:** Rank, limits, and funds are checked in the UI and verified again on the server side.
* **Configuration:** Price, rank, stock/limit, descriptions, and images are all configurable. Adding new items is done by copying a line and editing its fields.

**Summary:** A simple armory system that works with **rank-based visibility, a cart system, and payment options** to manage police equipment distribution.

Config;<br>

```lua
    Items = {

        { id = "pistol",   name = "Pistol",   category = "weapons", grade = 0, price = 0.00, image = "",    desc = "Sidearm.", itemName = "weapon_pistol", stack = 1, maxPerCart = 1 },
        { id = "smg",      name = "SMG",      category = "weapons", grade = 2, price = 0.00, image = "",       desc = "SMG.", itemName = "weapon_smg", stack = 1, maxPerCart = 1 },
        { id = "carbine",  name = "Rifle",    category = "weapons", grade = 3, price = 0.00, image = "",   desc = "Rifle.", itemName = "weapon_carbinerifle", stack = 1, maxPerCart = 1 },
        { id = "shotgun",  name = "Shotgun",  category = "weapons", grade = 3, price = 0.00, image = "",   desc = "Shotgun.", itemName = "weapon_pumpshotgun", stack = 1, maxPerCart = 1 },
        { id = "flashbang",name = "Flash",    category = "weapons", grade = 4, price = 0.00, image = "", desc = "Flash.", itemName = "weapon_flashlight", stack = 2, maxPerCart = 5 },

        -- Ammo
        { id = "pistol_ammo",  name = "Pistol Ammo",  category = "ammo", grade = 0, price = 0.00, image = "", desc = "Ammo.", itemName = "pistol_ammo", stack = 30, maxPerCart = 200 },
        { id = "smg_ammo",     name = "SMG Ammo",     category = "ammo", grade = 2, price = 0.00, image = "",    desc = "Ammo.", itemName = "smg_ammo", stack = 30, maxPerCart = 200 },
        { id = "rifle_ammo",   name = "Rifle Ammo",   category = "ammo", grade = 3, price = 0.00, image = "",  desc = "Ammo.", itemName = "rifle_ammo", stack = 30, maxPerCart = 200 },
        { id = "shotgun_ammo", name = "Shotgun Ammo", category = "ammo", grade = 3, price = 0.00, image = "", desc = "Ammo.", itemName = "shotgun_ammo", stack = 10, maxPerCart = 50 },

        -- Equipment
        { id = "cuffs",     name = "Cuffs",    category = "equipment", grade = 0, price = 0.00, image = "", desc = "Cuffs.", itemName = "handcuffs", stack = 1, maxPerCart = 5 },
        { id = "taser",     name = "Taser",    category = "equipment", grade = 1, price = 0.00, image = "",     desc = "Taser.", itemName = "weapon_stungun", stack = 1, maxPerCart = 1 },
        { id = "flashlight",name = "Light",    category = "equipment", grade = 0, price = 0.00, image = "", desc = "Light.", itemName = "weapon_flashlight", stack = 1, maxPerCart = 1 },
        { id = "radio",     name = "Radio",    category = "equipment", grade = 0, price = 0.00, image = "",      desc = "Radio.", itemName = "radio", stack = 1, maxPerCart = 1 },

        -- Protection
        { id = "armor_light", name = "L-Armor", category = "protection", grade = 0, price = 0.00, image = "", desc = "Light armor.", itemName = "armor", stack = 1, maxPerCart = 2 },
        { id = "armor_heavy", name = "H-Armor", category = "protection", grade = 2, price = 0.00, image = "", desc = "Heavy armor.", itemName = "heavyarmor", stack = 1, maxPerCart = 2 },
        { id = "shield",      name = "Shield",  category = "protection", grade = 4, price = 0.00, image = "", desc = "Shield.", itemName = "police_stormram", stack = 1, maxPerCart = 1 },

        -- Utility
        { id = "spikes",   name = "Spikes",   category = "utility", grade = 2, price = 0.00, image = "", desc = "Spikes.", itemName = "police_spikestrip", stack = 1, maxPerCart = 5 },
        { id = "breach",   name = "Breach",   category = "utility", grade = 3, price = 0.00, image = "", desc = "Breach kit.", itemName = "police_breachkit", stack = 1, maxPerCart = 2 },
        { id = "bodycam",  name = "Bodycam",  category = "utility", grade = 0, price = 0.00, image = "", desc = "Bodycam.", itemName = "police_bodycam", stack = 1, maxPerCart = 1 }
    },
```
