From de9e810885cb66df91e6d9a3a8d340d53a0b8eb7 Mon Sep 17 00:00:00 2001 From: rustyrory Date: Tue, 16 Dec 2025 14:40:51 +0100 Subject: [PATCH 1/3] docs(database): Fix #4 --- docs/database/ddd.md | 210 ++++++++++++++++++++++++++++++++++++++++++ docs/database/mcd.md | 3 + docs/database/mld.md | 68 ++++++++++++++ docs/database/mpd.sql | 171 ++++++++++++++++++++++++++++++++++ 4 files changed, 452 insertions(+) create mode 100644 docs/database/ddd.md create mode 100644 docs/database/mcd.md create mode 100644 docs/database/mld.md create mode 100644 docs/database/mpd.sql diff --git a/docs/database/ddd.md b/docs/database/ddd.md new file mode 100644 index 0000000..220f7af --- /dev/null +++ b/docs/database/ddd.md @@ -0,0 +1,210 @@ +# 🧩 Dictionnaire des Données — Projet WorldBoss + +--- + +## **SERVERS** + +`servers` + +| Colonne | Type | Description | +| ------------------- | ------------ | -------------------------------------- | +| id | int, PK | Identifiant unique du serveur | +| discord_id | varchar(50) | Identifiant Discord du serveur, unique | +| name | varchar(100) | Nom du serveur | +| owner_id | varchar(50) | Identifiant Discord du propriétaire | +| level | int | Niveau du serveur | +| prestige | int | Points de prestige | +| gold_reserve | int | Réserve d’or du serveur | +| created_at | datetime | Date de création du serveur | +| category_id | varchar(50) | ID de la catégorie Discord | +| combat_channel_id | varchar(50) | ID du channel combat | +| combat_message_id | varchar(50) | ID du message combat | +| merchant_channel_id | varchar(50) | ID du channel marchand | +| merchant_message_id | varchar(50) | ID du message marchand | +| event_id | varchar(50) | ID du message événement | +| general_channel_id | varchar(50) | ID du channel général | + +**Relations principales :** + +- 1—N `Players` +- 1—1 `Merchants` +- 1—N `Bosses` + +--- + +## **PLAYERS** + +`players` + +| Colonne | Type | Description | +| -------------- | ------------------------- | ------------------------------------- | +| id | int, PK | Identifiant du joueur | +| discord_id | varchar(50) | Identifiant Discord du joueur, unique | +| server_id | int, FK vers `servers.id` | Serveur auquel le joueur appartient | +| name | varchar(100) | Nom du joueur | +| level | int | Niveau du joueur | +| exp | int | Expérience | +| hp | int | Points de vie actuels | +| hp_max | int | Points de vie maximum | +| attack | int | Attaque actuelle | +| attack_max | int | Attaque maximale | +| defense | int | Défense actuelle | +| defense_max | int | Défense maximale | +| crit_rate | int | Taux de critique actuel | +| crit_rate_max | int | Taux de critique maximal | +| gold | int | Or détenu par le joueur | +| actions_points | int | Points d’action | +| skills_points | int | Points de compétence | +| alive | tinyint(1) | Joueur vivant ou non | + +**Relations principales :** + +- N—1 `Servers` +- 1—1 `Inventories` + +--- + +## **INVENTORIES** + +`inventories` + +| Colonne | Type | Description | +| --------- | ------------------------- | ------------------- | +| id | int, PK | Identifiant | +| player_id | int, FK vers `players.id` | Joueur propriétaire | + +**Relations principales :** + +- N—1 `Players` +- 1—N `Item_Instances` + +--- + +## **ITEMS** + +`items` + +| Colonne | Type | Description | +| ------------- | --------------------------------------- | ---------------------------------------- | +| id | int, PK | Identifiant unique | +| name | varchar(100) | Nom de l’objet | +| category | enum('consommable','arme','equipement') | Catégorie de l’objet | +| description | text | Description | +| hp_bonus | int | Bonus points de vie (arme ou équipement) | +| attack_bonus | int | Bonus attaque (arme ou équipement) | +| defense_bonus | int | Bonus défense (arme ou équipement) | +| price | int | Prix d’achat | +| sell_price | int | Prix de vente | + +**Relations principales :** + +- 1—N `Item_Instances` +- N—N `Merchant_Items` + +--- + +## **ITEM_INSTANCES** + +`item_instances` + +| Colonne | Type | Description | +| ------------ | ----------------------------- | --------------------------------------- | +| id | int, PK | Identifiant unique de l’instance | +| item_id | int, FK vers `items.id` | Objet associé | +| inventory_id | int, FK vers `inventories.id` | Inventaire auquel appartient l’instance | +| equipped | tinyint(1) | 1 si équipé, 0 sinon | + +**Relations principales :** + +- N—1 `Items` +- N—1 `Inventories` +- N—1 `Merchants` + +--- + +## **MERCHANTS** + +`merchants` + +| Colonne | Type | Description | +| ------------ | ------------------------- | -------------------------------------- | +| id | int, PK | Identifiant du marchand | +| server_id | int, FK vers `servers.id` | Serveur associé | +| gold | int | Or détenu par le marchand | +| last_refresh | datetime | Dernière actualisation de l’inventaire | + +**Relations principales :** + +- N—1 `Servers` +- 1—N `Merchant_Items` + +--- + +## **MERCHANT_ITEMS** + +`merchant_items` + +| Colonne | Type | Description | +| ----------- | --------------------------- | ---------------- | +| id | int, PK | Identifiant | +| merchant_id | int, FK vers `merchants.id` | Marchand associé | +| item_id | int, FK vers `items.id` | Objet associé | + +**Relations principales :** + +- N—1 `Merchants` +- N—1 `Items` + +--- + +## **BOSS_TEMPLATES** + +`boss_templates` + +| Colonne | Type | Description | +| --------------- | ------------ | --------------------- | +| id | int, PK | Identifiant du modèle | +| name | varchar(100) | Nom du boss | +| level | int | Niveau du boss | +| base_hp | int | Points de vie de base | +| base_attack | int | Attaque de base | +| base_defense | int | Défense de base | +| lore | text | Histoire du boss | +| gif_url | varchar(255) | Image du boss | +| gif_url_lore_01 | varchar(255) | Image lore | +| gif_url_lore_02 | varchar(255) | Image lore | +| gif_url_lore_03 | varchar(255) | Image lore | +| gif_url_lore_04 | varchar(255) | Image lore | +| gif_url_lore_05 | varchar(255) | Image lore | +| gif_url_lore_06 | varchar(255) | Image lore | +| gif_url_lore_07 | varchar(255) | Image lore | +| gif_url_lore_08 | varchar(255) | Image lore | +| gif_url_lore_09 | varchar(255) | Image lore | +| gif_url_lore_10 | varchar(255) | Image lore | + +**Relations principales :** + +- 1—N `Bosses` + +--- + +## **BOSSES** + +`bosses` + +| Colonne | Type | Description | +| ----------- | -------------------------------- | --------------------------------- | +| id | int, PK | Identifiant du boss | +| server_id | int, FK vers `servers.id` | Serveur associé | +| template_id | int, FK vers `boss_templates.id` | Modèle de boss | +| hp | int | Points de vie actuels | +| attack | int | Attaque actuelle | +| defense | int | Défense actuelle | +| last_reset | datetime | Date de dernière réinitialisation | + +**Relations principales :** + +- N—1 `Servers` +- N—1 `Boss_Templates` + +--- diff --git a/docs/database/mcd.md b/docs/database/mcd.md new file mode 100644 index 0000000..014fa73 --- /dev/null +++ b/docs/database/mcd.md @@ -0,0 +1,3 @@ +# 🧩 MCD — Projet WorldBoss + +![MCD WorldBoss](./MCD.png) diff --git a/docs/database/mld.md b/docs/database/mld.md new file mode 100644 index 0000000..0cf2ff7 --- /dev/null +++ b/docs/database/mld.md @@ -0,0 +1,68 @@ +# 🧩 MLD — Projet WorldBoss + +--- + +### **SERVERS** + +SERVERS (id, discord_id, name, owner_id, level, prestige, gold_reserve, created_at, +category_id, combat_channel_id, combat_message_id, +merchant_channel_id, merchant_message_id, event_id, general_channel_id) + +--- + +### **PLAYERS** + +PLAYERS (id, discord_id, name, level, exp, hp, hp_max, attack, attack_max, +defense, defense_max, crit_rate, crit_rate_max, gold, +actions_points, skills_points, alive, +[server_id]) + +--- + +### **INVENTORIES** + +INVENTORIES (id, [player_id]) + +--- + +### **ITEMS** + +ITEMS (id, name, category, description, hp_bonus, attack_bonus, defense_bonus, +price, sell_price) + +--- + +### **ITEM_INSTANCES** + +ITEM_INSTANCES (id, equipped, [item_id], [inventory_id]) + +--- + +### **MERCHANTS** + +MERCHANTS (id, gold, last_refresh, [server_id]) + +--- + +### **MERCHANT_ITEMS** + +MERCHANT_ITEMS (id, [merchant_id], [item_id]) + +--- + +### **BOSS_TEMPLATES** + +BOSS_TEMPLATES (id, name, level, base_hp, base_attack, base_defense, lore, +gif_url, +gif_url_lore_01, gif_url_lore_02, gif_url_lore_03, gif_url_lore_04, +gif_url_lore_05, gif_url_lore_06, gif_url_lore_07, gif_url_lore_08, +gif_url_lore_09, gif_url_lore_10) + +--- + +### **BOSSES** + +BOSSES (id, hp, attack, defense, last_reset, +[server_id], [template_id]) + +--- diff --git a/docs/database/mpd.sql b/docs/database/mpd.sql new file mode 100644 index 0000000..7d33bbb --- /dev/null +++ b/docs/database/mpd.sql @@ -0,0 +1,171 @@ +-- ========================= +-- TABLE : servers +-- ========================= +CREATE TABLE servers ( + id INT AUTO_INCREMENT PRIMARY KEY, + discord_id VARCHAR(50) NOT NULL UNIQUE, + name VARCHAR(100) NOT NULL, + owner_id VARCHAR(50) NOT NULL, + level INT DEFAULT 1, + prestige INT DEFAULT 0, + gold_reserve INT DEFAULT 0, + created_at DATETIME DEFAULT CURRENT_TIMESTAMP, + category_id VARCHAR(50), + combat_channel_id VARCHAR(50), + combat_message_id VARCHAR(50), + merchant_channel_id VARCHAR(50), + merchant_message_id VARCHAR(50), + event_id VARCHAR(50), + general_channel_id VARCHAR(50) +) ENGINE=InnoDB; + +-- ========================= +-- TABLE : players +-- ========================= +CREATE TABLE players ( + id INT AUTO_INCREMENT PRIMARY KEY, + discord_id VARCHAR(50) NOT NULL UNIQUE, + server_id INT NOT NULL, + name VARCHAR(100) NOT NULL, + level INT DEFAULT 1, + exp INT DEFAULT 0, + hp INT, + hp_max INT, + attack INT, + attack_max INT, + defense INT, + defense_max INT, + crit_rate INT, + crit_rate_max INT, + gold INT DEFAULT 0, + actions_points INT DEFAULT 0, + skills_points INT DEFAULT 0, + alive TINYINT(1) DEFAULT 1, + + CONSTRAINT fk_players_server + FOREIGN KEY (server_id) REFERENCES servers(id) + ON DELETE CASCADE +) ENGINE=InnoDB; + +-- ========================= +-- TABLE : inventories +-- ========================= +CREATE TABLE inventories ( + id INT AUTO_INCREMENT PRIMARY KEY, + player_id INT NOT NULL UNIQUE, + + CONSTRAINT fk_inventory_player + FOREIGN KEY (player_id) REFERENCES players(id) + ON DELETE CASCADE +) ENGINE=InnoDB; + +-- ========================= +-- TABLE : items +-- ========================= +CREATE TABLE items ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + category ENUM('consommable', 'arme', 'equipement') NOT NULL, + description TEXT, + hp_bonus INT DEFAULT 0, + attack_bonus INT DEFAULT 0, + defense_bonus INT DEFAULT 0, + price INT DEFAULT 0, + sell_price INT DEFAULT 0 +) ENGINE=InnoDB; + +-- ========================= +-- TABLE : item_instances +-- ========================= +CREATE TABLE item_instances ( + id INT AUTO_INCREMENT PRIMARY KEY, + item_id INT NOT NULL, + inventory_id INT NOT NULL, + equipped TINYINT(1) DEFAULT 0, + + CONSTRAINT fk_item_instance_item + FOREIGN KEY (item_id) REFERENCES items(id) + ON DELETE CASCADE, + + CONSTRAINT fk_item_instance_inventory + FOREIGN KEY (inventory_id) REFERENCES inventories(id) + ON DELETE CASCADE +) ENGINE=InnoDB; + +-- ========================= +-- TABLE : merchants +-- ========================= +CREATE TABLE merchants ( + id INT AUTO_INCREMENT PRIMARY KEY, + server_id INT NOT NULL UNIQUE, + gold INT DEFAULT 0, + last_refresh DATETIME, + + CONSTRAINT fk_merchant_server + FOREIGN KEY (server_id) REFERENCES servers(id) + ON DELETE CASCADE +) ENGINE=InnoDB; + +-- ========================= +-- TABLE : merchant_items +-- ========================= +CREATE TABLE merchant_items ( + id INT AUTO_INCREMENT PRIMARY KEY, + merchant_id INT NOT NULL, + item_id INT NOT NULL, + + CONSTRAINT fk_merchant_items_merchant + FOREIGN KEY (merchant_id) REFERENCES merchants(id) + ON DELETE CASCADE, + + CONSTRAINT fk_merchant_items_item + FOREIGN KEY (item_id) REFERENCES items(id) + ON DELETE CASCADE, + + UNIQUE (merchant_id, item_id) +) ENGINE=InnoDB; + +-- ========================= +-- TABLE : boss_templates +-- ========================= +CREATE TABLE boss_templates ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + level INT NOT NULL, + base_hp INT NOT NULL, + base_attack INT NOT NULL, + base_defense INT NOT NULL, + lore TEXT, + gif_url VARCHAR(255), + gif_url_lore_01 VARCHAR(255), + gif_url_lore_02 VARCHAR(255), + gif_url_lore_03 VARCHAR(255), + gif_url_lore_04 VARCHAR(255), + gif_url_lore_05 VARCHAR(255), + gif_url_lore_06 VARCHAR(255), + gif_url_lore_07 VARCHAR(255), + gif_url_lore_08 VARCHAR(255), + gif_url_lore_09 VARCHAR(255), + gif_url_lore_10 VARCHAR(255) +) ENGINE=InnoDB; + +-- ========================= +-- TABLE : bosses +-- ========================= +CREATE TABLE bosses ( + id INT AUTO_INCREMENT PRIMARY KEY, + server_id INT NOT NULL, + template_id INT NOT NULL, + hp INT NOT NULL, + attack INT NOT NULL, + defense INT NOT NULL, + last_reset DATETIME, + + CONSTRAINT fk_boss_server + FOREIGN KEY (server_id) REFERENCES servers(id) + ON DELETE CASCADE, + + CONSTRAINT fk_boss_template + FOREIGN KEY (template_id) REFERENCES boss_templates(id) + ON DELETE CASCADE +) ENGINE=InnoDB; From f4699db5e97ddeae889d27fd5dba335d528f55f3 Mon Sep 17 00:00:00 2001 From: rustyrory Date: Tue, 16 Dec 2025 14:43:06 +0100 Subject: [PATCH 2/3] docs(database): Fixes #4 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3d5c458..e4a0e9e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # WorldBoss + Discord Bot | RPG Game From 490ba62b07db1ec243d4b813f27426f6989a6ead Mon Sep 17 00:00:00 2001 From: rustyrory Date: Tue, 16 Dec 2025 14:50:14 +0100 Subject: [PATCH 3/3] docs(database): Fixes #4 --- .github/workflows/check-commit-message.yml | 41 ++++++++-------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/.github/workflows/check-commit-message.yml b/.github/workflows/check-commit-message.yml index 07aecb5..abb8694 100644 --- a/.github/workflows/check-commit-message.yml +++ b/.github/workflows/check-commit-message.yml @@ -1,31 +1,27 @@ -name: Check commit message +name: Check PR title on: pull_request: + types: [opened, edited, synchronize] jobs: - check-commit-message: + check-pr-title: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Validate commit message + - name: Validate PR title run: | - COMMIT_MSG=$(git log -1 --pretty=%B) + PR_TITLE="${{ github.event.pull_request.title }}" - echo "🔎 Vérification du message de commit" - echo "----------------------------------" - echo "$COMMIT_MSG" + echo "🔎 Vérification du titre de la Pull Request" + echo "------------------------------------------" + echo "$PR_TITLE" echo "" REGEX="^(feat|fix|hotfix|docs|refactor|test|chore)(\([a-zA-Z0-9_-]+\))?: .+" - if [[ ! "$COMMIT_MSG" =~ $REGEX ]]; then - echo "❌ Message de commit non conforme" + if [[ ! "$PR_TITLE" =~ $REGEX ]]; then + echo "❌ Titre de PR non conforme" echo "" echo "👉 Format attendu :" echo " type(scope): description courte" @@ -33,23 +29,16 @@ jobs: echo "👉 Types autorisés : feat, fix, hotfix, docs, refactor, test, chore" echo "" echo "📌 Exemples valides :" - echo " feat(auth): ajout du login" - echo " fix(button): correction du style" - echo "" - echo "🛠️ Action attendue :" - echo " modifie ton commit avec :" - echo " git commit --amend" + echo " docs(database): ajout du dictionnaire" + echo " fix(auth): correction login" exit 1 fi - if ! echo "$COMMIT_MSG" | grep -qiE "(fixes|closes|resolves) #[0-9]+"; then + if ! echo "$PR_TITLE" | grep -qiE "(fix|fixes|closes|resolves) #[0-9]+"; then echo "⚠️ Aucun lien avec une issue détecté" echo "" echo "👉 Bonne pratique recommandée :" - echo " ajoute dans le message : Fixes #" - echo "" - echo "ℹ️ Exemple :" - echo " Fixes #12" + echo " ajoute dans le titre : Fixes #" fi - echo "✅ Message de commit conforme" + echo "✅ Titre de PR conforme"