🛠️Installation

Database

circle-info

Before you install this code manually you can run the script and the script gona create everything automatic.

CREATE TABLE IF NOT EXISTS `m_vipshop_coins` (
    `identifier` varchar(50) NOT NULL,
    `coins` int(11) NOT NULL DEFAULT 0,
    `total_earned` int(11) NOT NULL DEFAULT 0,
    `total_spent` int(11) NOT NULL DEFAULT 0,
    `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `m_vipshop_transactions` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `identifier` varchar(50) NOT NULL,
    `type` enum('purchase_weapon', 'purchase_vehicle', 'purchase_item', 'open_case', 'admin_give', 'admin_remove', 'tebex_purchase') NOT NULL,
    `item_id` varchar(100) DEFAULT NULL,
    `item_label` varchar(200) DEFAULT NULL,
    `coins_amount` int(11) NOT NULL,
    `coins_before` int(11) NOT NULL,
    `coins_after` int(11) NOT NULL,
    `metadata` json DEFAULT NULL,
    `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    KEY `identifier` (`identifier`),
    KEY `type` (`type`),
    KEY `created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `m_vipshop_case_history` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `identifier` varchar(50) NOT NULL,
    `case_id` varchar(50) NOT NULL,
    `case_label` varchar(100) NOT NULL,
    `reward_item` varchar(100) NOT NULL,
    `reward_label` varchar(200) NOT NULL,
    `reward_amount` int(11) NOT NULL DEFAULT 1,
    `reward_rarity` int(11) NOT NULL DEFAULT 1,
    `opened_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    KEY `identifier` (`identifier`),
    KEY `case_id` (`case_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `m_vipshop_items` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `type` enum('weapon', 'vehicle', 'item', 'case') NOT NULL,
    `item_id` varchar(100) NOT NULL COMMENT 'Weapon hash, vehicle model, item name, or mystery box id',
    `label` varchar(200) NOT NULL,
    `description` text DEFAULT NULL,
    `price` int(11) NOT NULL,
    `image` varchar(255) DEFAULT NULL,
    `category` varchar(50) DEFAULT NULL,
    `enabled` tinyint(1) NOT NULL DEFAULT 1,
    `stock` int(11) DEFAULT NULL COMMENT 'Item stock (NULL = unlimited)',
    `on_sale` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Is item on sale/promotion',
    `discount` int(11) DEFAULT 0 COMMENT 'Discount percentage (0-100)',
    `daily_limit` int(11) DEFAULT NULL COMMENT 'Daily purchase limit per player (NULL = no limit)',
    `metadata` json DEFAULT NULL COMMENT 'Additional data like ammo config, test drive, spawn location, etc',
    `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `type_item_id` (`type`, `item_id`),
    KEY `type` (`type`),
    KEY `enabled` (`enabled`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `m_vipshop_case_rewards` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `case_id` varchar(100) NOT NULL,
    `item` varchar(100) NOT NULL,
    `label` varchar(200) NOT NULL,
    `amount` int(11) NOT NULL DEFAULT 1,
    `rarity` int(11) NOT NULL DEFAULT 1 COMMENT '1-5, higher is rarer',
    `chance` int(11) NOT NULL COMMENT 'Weight for random selection',
    `enabled` tinyint(1) NOT NULL DEFAULT 1,
    PRIMARY KEY (`id`),
    KEY `case_id` (`case_id`),
    KEY `enabled` (`enabled`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `m_vipshop_daily_purchases` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `identifier` varchar(50) NOT NULL,
    `item_id` int(11) NOT NULL,
    `purchase_count` int(11) DEFAULT 1,
    `purchase_date` date NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `unique_daily_purchase` (`identifier`, `item_id`, `purchase_date`),
    KEY `idx_date` (`purchase_date`),
    KEY `idx_identifier_date` (`identifier`, `purchase_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `m_vipshop_daily_login` (
    `identifier` varchar(50) NOT NULL,
    `current_day` int(11) NOT NULL DEFAULT 1,
    `last_claim` date DEFAULT NULL,
    `total_claims` int(11) NOT NULL DEFAULT 0,
    PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Last updated