Accueil › Documentation › Installation · origen_tradingcards

Installation · origen_tradingcards

1. Base de données

Aucun SQL manuel n’est nécessaire. La ressource crée automatiquement toutes les tables requises lors de son premier démarrage, via oxmysql.

Les tables suivantes sont créées :

sql
CREATE TABLE IF NOT EXISTS origen_albumcards_albums (
    id    INT AUTO_INCREMENT PRIMARY KEY,
    name  VARCHAR(255) UNIQUE,
    label VARCHAR(255),
    image TEXT
);
 
CREATE TABLE IF NOT EXISTS origen_albumcards_cards (
    id          INT AUTO_INCREMENT PRIMARY KEY,
    number      INT UNIQUE,
    name        VARCHAR(255),
    description TEXT,
    image       TEXT,
    rarity      VARCHAR(50),
    album_id    INT,
    FOREIGN KEY (album_id) REFERENCES origen_albumcards_albums(id) ON DELETE SET NULL
);
 
CREATE TABLE IF NOT EXISTS origen_albumcards_player (
    identifier VARCHAR(60),
    card_id    INT,
    quantity   INT DEFAULT 1,
    PRIMARY KEY (identifier, card_id)
);
 
CREATE TABLE IF NOT EXISTS origen_albumcards_shops (
    id        INT AUTO_INCREMENT PRIMARY KEY,
    name      VARCHAR(255),
    coords    TEXT,
    npc_model VARCHAR(50),
    items     TEXT
);

Si tu mets à jour depuis une ancienne version qui utilisait une colonne card_number, la ressource effectue au démarrage une migration automatique vers le nouveau système card_id. Aucune action manuelle n’est nécessaire.


2. Items

Ajoute les items suivants à ton inventaire. Chaque item utilise le champ client.export pour se brancher sur la ressource.

ox_inventory

Ajoute à ton ox_inventory/data/items.lua :

lua
['album'] = {
    label       = 'Card Album',
    weight      = 500,
    stack       = false,
    description = 'An album to store your card collection.',
    close       = true,
    client      = { export = 'origen_tradingcards.album' },
},
['albumpack'] = {
    label       = 'Card Pack',
    weight      = 100,
    stack       = true,
    description = 'Contains collectible cards. Open it to see what you get.',
    close       = true,
    client      = { export = 'origen_tradingcards.albumpack' },
},
['albumcardcommon'] = {
    label       = 'Collectible Card',
    weight      = 0,
    stack       = false,
    description = 'A common collection card.',
    close       = true,
    client      = { export = 'origen_tradingcards.albumcard' },
},
['albumcardunrare'] = {
    label       = 'Collectible Card',
    weight      = 0,
    stack       = false,
    description = 'An uncommon collection card.',
    close       = true,
    client      = { export = 'origen_tradingcards.albumcard' },
},
['albumcardrare'] = {
    label       = 'Collectible Card',
    weight      = 0,
    stack       = false,
    description = 'A rare collection card.',
    close       = true,
    client      = { export = 'origen_tradingcards.albumcard' },
},
['albumcardepic'] = {
    label       = 'Collectible Card',
    weight      = 0,
    stack       = false,
    description = 'An epic collection card.',
    close       = true,
    client      = { export = 'origen_tradingcards.albumcard' },
},
['albumcardlegendary'] = {
    label       = 'Collectible Card',
    weight      = 0,
    stack       = false,
    description = 'A legendary collection card.',
    close       = true,
    client      = { export = 'origen_tradingcards.albumcard' },
},

QBCore / QBX

Ajoute à ta table d’items partagés :

lua
['album']             = { name = 'album',             label = 'Card Album',      weight = 500, type = 'item', image = 'album.png',             unique = true,  useable = true, shouldClose = true, combinable = nil, description = 'An album to store your card collection.' },
['albumpack']         = { name = 'albumpack',         label = 'Card Pack',       weight = 100, type = 'item', image = 'albumpack.png',         unique = false, useable = true, shouldClose = true, combinable = nil, description = 'Contains collectible cards.' },
['albumcardcommon']   = { name = 'albumcardcommon',   label = 'Collectible Card', weight = 0,   type = 'item', image = 'albumcardcommon.png',   unique = true,  useable = true, shouldClose = true, combinable = nil, description = 'A common collection card.' },
['albumcardunrare']   = { name = 'albumcardunrare',   label = 'Collectible Card', weight = 0,   type = 'item', image = 'albumcardunrare.png',   unique = true,  useable = true, shouldClose = true, combinable = nil, description = 'An uncommon collection card.' },
['albumcardrare']     = { name = 'albumcardrare',     label = 'Collectible Card', weight = 0,   type = 'item', image = 'albumcardrare.png',     unique = true,  useable = true, shouldClose = true, combinable = nil, description = 'A rare collection card.' },
['albumcardepic']     = { name = 'albumcardepic',     label = 'Collectible Card', weight = 0,   type = 'item', image = 'albumcardepic.png',     unique = true,  useable = true, shouldClose = true, combinable = nil, description = 'An epic collection card.' },
['albumcardlegendary'] = { name = 'albumcardlegendary', label = 'Collectible Card', weight = 0, type = 'item', image = 'albumcardlegendary.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'A legendary collection card.' },

Images des items

Copie les images de items/img/ dans le dossier d’images de ton inventaire :

Fichier Item
album.png album
albumpack.png albumpack
albumcardcommon.png albumcardcommon
albumcardunrare.png albumcardunrare
albumcardrare.png albumcardrare
albumcardepic.png albumcardepic
albumcardlegendary.png albumcardlegendary

3. server.cfg

text
ensure oxmysql
ensure origen_tradingcards

oxmysql doit démarrer avant origen_tradingcards pour que les tables soient créées au premier démarrage.