Configuration

All configuration for legends_cases lives in two places:

  • config.lua — spin timings, cooldown, locale, integrations, and case definitions
  • shared/rarities.lua — rarity tier names, colors, and labels

This page documents every setting in config.lua. For step-by-step recipes (adding a new case, balancing weights, custom rarities) see Adding a Case.

Spin & Reveal Timings

Config.SpinDuration

Config.SpinDuration = 6500

Description: How long the roulette reel spins before stopping on the winning slot, in milliseconds.

Type: number

Default: 6500


Config.RevealDelay

Config.RevealDelay = 600

Description: Delay between the reel landing on the winning slot and the reward reveal modal appearing, in milliseconds. Tunes the dramatic pause.

Type: number

Default: 600


Config.WinModalTime

Config.WinModalTime = 4000

Description: How long the win modal stays on screen before auto-closing, in milliseconds.

Type: number

Default: 4000


Config.ReelLength

Config.ReelLength = 60

Description: Number of items rendered on the roulette reel. Larger values produce a longer-feeling spin without changing the spin duration.

Type: number

Default: 60


Config.ReelWinIndex

Config.ReelWinIndex = 55

Description: Which slot index (1-indexed) on the reel contains the winning item. The reel is built so the player visually lands here. Adjust if you change ReelLength.

Type: number

Default: 55

⚠️

ReelWinIndex must be less than or equal to ReelLength. Changing reel length without updating the win index will cause the reveal to land on the wrong slot.


Rate Limiting

Config.OpenCooldown

Config.OpenCooldown = 1500

Description: Minimum milliseconds between case opens by the same player. Anti-spam protection. Combined with the per-player pending-state lock, blocks both flood opens and timing-based double-redemption exploits.

Type: number

Default: 1500


Localization

Config.Locale

Config.Locale = 'en'

Description: Active language. Keys into locales/<lang>.lua. Ships with English; add new languages by creating locales/de.lua, locales/fr.lua, etc.

Type: string

Default: 'en'

Locale strings (en.lua):

KeyDefault textWhen shown
not_configuredThis case is not configured.Player uses an item that isn't in Config.Cases
cooldownSlow down.Player tries to open within OpenCooldown
pending_openFinish your previous case first.Player tries to open while another spin is pending
case_not_foundCase not found.Server can't resolve the case key
consume_failedFailed to consume case.Inventory removal failed
inventory_full_dropInventory full, reward dropped.Reward dropped to the ground
use_blocked_busyAlready opening a case.Client blocked a use call while UI is open

Integrations

Config.Integrations

Config.Integrations = {
    Framework = 'auto',
    Inventory = 'auto',
    Notify    = 'auto',
}

Description: Each entry is either 'auto' (the bridge picks based on GetResourceState) or a literal resource name to pin explicitly.

PropertyTypeAccepted values
Frameworkstring'auto', 'qbx_core', 'qb-core', 'es_extended', 'standalone'
Inventorystring'auto', 'ox_inventory', 'qs-inventory', 'codem-inventory', 'origen_inventory', 'tgiann-inventory', 'ps-inventory', 'qb-inventory', 'esx'
Notifystring'auto', 'ox_lib', 'okokNotify', 'qbx_core', 'qb-core', 'es_extended', 'native'

QBox is expected to use ox_inventory. Other inventories work on QBox only if their exports don't depend on a qb-core player object. qb-inventory does not work on QBox.


Case Definitions

Config.Cases

Config.Cases = {
    ['starter_case'] = {
        label = 'Starter Case',
        items = {
            { item = 'bandage',        count = 5, chance = 35.0, rarity = 'milspec'    },
            { item = 'lockpick',       count = 2, chance = 25.0, rarity = 'milspec'    },
            { item = 'radio',          count = 1, chance = 18.0, rarity = 'restricted' },
            { item = 'phone',          count = 1, chance =  6.0, rarity = 'classified' },
            { item = 'WEAPON_STUNGUN', count = 1, chance =  3.0, rarity = 'covert'     },
            { item = 'WEAPON_PISTOL',  count = 1, chance =  0.9, rarity = 'gold'       },
        },
    },
}

Description: A table of every case definition keyed by the inventory item name. Each case has a label (shown in the UI) and an items array of possible rewards.

Per-item entry:

PropertyTypeDescription
itemstringInventory item name to award (any item your inventory recognizes — consumables, weapons, cash, custom)
countnumberQuantity to award when this slot wins
chancenumberWeight — see note below. NOT a percentage
raritystringOne of the keys in shared/rarities.lua (default: milspec, restricted, classified, covert, gold)

Chance is a weight, not a percentage. Values do NOT need to sum to 100. A slot with chance = 50.0 is twice as likely as one with chance = 25.0, regardless of the total. This makes balancing easy — tweak any single item without recalculating every other entry.


Rarity Tiers

Rarity tiers are defined in shared/rarities.lua. The default set follows the CS-style palette:

KeyDisplayColor treatment
milspecMil-SpecBlue (common)
restrictedRestrictedPurple (uncommon)
classifiedClassifiedPink (rare)
covertCovertRed (very rare)
goldGoldYellow / gold (extremely rare)
(custom)Reserved slot for server-specific styling

Edit shared/rarities.lua to rename tiers, add new ones, or swap colors. The roulette reel and reveal modal pick up the changes automatically — there is no hardcoded tier name in the React source.

Performance Notes

  • No server tick. The server only does work when a player opens a case (build reel → roll → award).
  • No client tick when the UI is closed. The client only listens for inventory use events.
  • Idle resmon: ~0.00ms on both client and server.

Legends Store - Premium FiveM Scripts