diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..30cf57e --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/client/src/game/objects/CardObject.js b/client/src/game/objects/CardObject.js index 94d922a..b7a027f 100644 --- a/client/src/game/objects/CardObject.js +++ b/client/src/game/objects/CardObject.js @@ -1,106 +1,198 @@ import Phaser from 'phaser' +// Couleurs des 4 attributs (identiques au serveur) +const ATTR = { + food: { color: 0xf0c030, label: 'NOU' }, + war: { color: 0xdd2222, label: 'GUE' }, + health: { color: 0x22aa44, label: 'SAN' }, + diplo: { color: 0x3399ee, label: 'DIP' } +} + +const CARD_W = 130 +const CARD_H = 190 +const CORNER = 28 // taille du badge de coin +const RADIUS = 10 + export class CardObject extends Phaser.GameObjects.Container { + /** + * @param {Phaser.Scene} scene + * @param {number} x + * @param {number} y + * @param {object} cardData - { id, name, food, war, health, diplo, teamColor: { hex } } + */ constructor(scene, x, y, cardData) { super(scene, x, y) this.cardData = cardData this._selected = false + this._baseY = y - this.build() + this._build() scene.add.existing(this) } - build() { - // Fond de carte - this.bg = this.scene.add.image(0, 0, 'card-front') - this.add(this.bg) + _build() { + const teamHex = this.cardData.teamColor?.hex ?? 0x888888 - // Nom de la carte - this.nameText = this.scene.add.text(0, -60, this.cardData.name, { - fontSize: '12px', - color: '#f5e6c8', - fontFamily: 'Georgia', - wordWrap: { width: 100 }, + // --- Fond de carte avec couleur d'équipe --- + const bg = this.scene.add.graphics() + // Ombre portée + bg.fillStyle(0x000000, 0.4) + bg.fillRoundedRect(4, 4, CARD_W, CARD_H, RADIUS) + // Corps principal (couleur équipe assombrie) + bg.fillStyle(this._darken(teamHex, 0.3)) + bg.fillRoundedRect(0, 0, CARD_W, CARD_H, RADIUS) + // Bordure couleur équipe + bg.lineStyle(2, teamHex, 1) + bg.strokeRoundedRect(0, 0, CARD_W, CARD_H, RADIUS) + // Zone portrait (rectangle foncé central) + bg.fillStyle(0x000000, 0.35) + bg.fillRoundedRect(8, 28, CARD_W - 16, CARD_H - 80, 6) + bg.x = -CARD_W / 2 + bg.y = -CARD_H / 2 + this.add(bg) + + // --- Nom du personnage (haut, centré) --- + const nameText = this.scene.add.text(0, -CARD_H / 2 + 9, this.cardData.name, { + fontSize: '13px', + fontFamily: 'Georgia, serif', + color: '#ffffff', + stroke: '#000000', + strokeThickness: 3, + fontStyle: 'bold' + }).setOrigin(0.5, 0) + this.add(nameText) + + // --- Initiale du personnage (zone portrait) --- + const initial = this.scene.add.text(0, -CARD_H / 2 + 75, this.cardData.name[0], { + fontSize: '52px', + fontFamily: 'Georgia, serif', + color: '#ffffff', + alpha: 0.15 + }).setOrigin(0.5, 0.5) + this.add(initial) + + // --- Description courte (bas de carte) --- + const desc = this.scene.add.text(0, CARD_H / 2 - 22, this._shortDesc(), { + fontSize: '8px', + fontFamily: 'Georgia, serif', + color: '#cccccc', + wordWrap: { width: CARD_W - 16 }, align: 'center' - }).setOrigin(0.5) - this.add(this.nameText) + }).setOrigin(0.5, 1) + this.add(desc) - // Valeur/effet - this.valueText = this.scene.add.text(0, 10, `+${this.cardData.points} pts`, { - fontSize: '18px', - color: '#d4a732', - fontFamily: 'Georgia' - }).setOrigin(0.5) - this.add(this.valueText) + // --- 4 badges d'attributs dans les coins --- + this._addCornerBadge('food', -CARD_W / 2 + 2, -CARD_H / 2 + 2, 'topLeft') + this._addCornerBadge('war', CARD_W / 2 - 2, -CARD_H / 2 + 2, 'topRight') + this._addCornerBadge('health', -CARD_W / 2 + 2, CARD_H / 2 - 2, 'bottomLeft') + this._addCornerBadge('diplo', CARD_W / 2 - 2, CARD_H / 2 - 2, 'bottomRight') - // Type de carte - this.typeText = this.scene.add.text(0, 50, this.cardData.type, { - fontSize: '10px', - color: '#a08060', - fontFamily: 'Georgia' - }).setOrigin(0.5) - this.add(this.typeText) - - // Interactivité - this.setSize(120, 180) + // --- Interactivité --- + this.setSize(CARD_W, CARD_H) this.setInteractive({ cursor: 'pointer' }) - - this.on('pointerover', this.onHover, this) - this.on('pointerout', this.onOut, this) - this.on('pointerdown', this.onDown, this) + this.on('pointerover', this._onHover, this) + this.on('pointerout', this._onOut, this) + this.on('pointerdown', this._onDown, this) } - onHover() { - if (!this._selected) { - this.scene.tweens.add({ - targets: this, - y: this.y - 15, - duration: 150, - ease: 'Power2' - }) + /** + * Badge carré coloré dans un coin, avec la valeur de l'attribut + * @param {'food'|'war'|'health'|'diplo'} attr + * @param {number} bx position x relative au centre du container (coin du badge) + * @param {number} by position y relative au centre du container (coin du badge) + * @param {'topLeft'|'topRight'|'bottomLeft'|'bottomRight'} corner + */ + _addCornerBadge(attr, bx, by, corner) { + const { color, label } = ATTR[attr] + const value = this.cardData[attr] + const S = CORNER + + // Calculer l'origine du rectangle selon le coin + let rx = bx, ry = by + if (corner === 'topRight' || corner === 'bottomRight') rx = bx - S + if (corner === 'bottomLeft' || corner === 'bottomRight') ry = by - S + + const g = this.scene.add.graphics() + g.fillStyle(color, 0.9) + // Coins arrondis uniquement vers l'intérieur de la carte + const cornerRadii = { + topLeft: { tl: RADIUS, tr: 2, bl: 2, br: 4 }, + topRight: { tl: 2, tr: RADIUS, bl: 4, br: 2 }, + bottomLeft: { tl: 2, tr: 4, bl: RADIUS, br: 2 }, + bottomRight: { tl: 4, tr: 2, bl: 2, br: RADIUS } } + g.fillRoundedRect(rx, ry, S, S, cornerRadii[corner]) + this.add(g) + + // Valeur (grand, centré dans le badge) + const cx = rx + S / 2 + const cy = ry + S / 2 - 3 + const valText = this.scene.add.text(cx, cy, String(value), { + fontSize: '14px', + fontFamily: 'Georgia, serif', + fontStyle: 'bold', + color: '#ffffff', + stroke: '#000000', + strokeThickness: 2 + }).setOrigin(0.5, 0.5) + this.add(valText) + + // Label abrégé (petit, en bas du badge) + const lblText = this.scene.add.text(cx, cy + 8, label, { + fontSize: '6px', + fontFamily: 'Arial, sans-serif', + color: '#ffffff', + alpha: 0.85 + }).setOrigin(0.5, 0.5) + this.add(lblText) } - onOut() { - if (!this._selected) { - this.scene.tweens.add({ - targets: this, - y: this.y + 15, - duration: 150, - ease: 'Power2' - }) - } + // --- Interactions --- + + _onHover() { + if (this._selected) return + this.scene.tweens.add({ targets: this, y: this._baseY - 18, duration: 120, ease: 'Power2' }) + this.setDepth(10) } - onDown() { - this._selected = !this._selected + _onOut() { + if (this._selected) return + this.scene.tweens.add({ targets: this, y: this._baseY, duration: 120, ease: 'Power2' }) + this.setDepth(0) + } + + _onDown() { if (this._selected) { + this.deselect() + } else { this.select() this.emit('select', this) - } else { - this.deselect() } } select() { this._selected = true - this.bg.setTint(0xd4a732) - this.scene.tweens.add({ - targets: this, - y: this.y - 20, - duration: 150, - ease: 'Power2' - }) + this.setDepth(20) + this.scene.tweens.add({ targets: this, y: this._baseY - 28, duration: 150, ease: 'Back.Out' }) } deselect() { this._selected = false - this.bg.clearTint() - this.scene.tweens.add({ - targets: this, - y: this.y + 20, - duration: 150, - ease: 'Power2' - }) + this.setDepth(0) + this.scene.tweens.add({ targets: this, y: this._baseY, duration: 150, ease: 'Power2' }) + } + + // --- Utilitaires --- + + _darken(hex, factor) { + const r = Math.floor(((hex >> 16) & 0xff) * factor) + const g = Math.floor(((hex >> 8) & 0xff) * factor) + const b = Math.floor(( hex & 0xff) * factor) + return (r << 16) | (g << 8) | b + } + + _shortDesc() { + const d = this.cardData.description || '' + return d.length > 60 ? d.substring(0, 57) + '…' : d } } diff --git a/client/src/game/scenes/GameScene.js b/client/src/game/scenes/GameScene.js index 52565a2..5c46d52 100644 --- a/client/src/game/scenes/GameScene.js +++ b/client/src/game/scenes/GameScene.js @@ -1,99 +1,160 @@ import Phaser from 'phaser' import { CardObject } from '../objects/CardObject' +// Couleurs équipes (synchronisé avec le serveur) +const TEAM_COLORS = { + 0: 0xcc2200, + 1: 0x1155cc, + 2: 0x1a7a2e, + 3: 0xb8860b +} + +// Couleurs attributs +const ATTR_COLORS = { + food: 0xf0c030, + war: 0xdd2222, + health: 0x22aa44, + diplo: 0x3399ee +} + +const ATTR_LABELS = { + food: 'Nourriture', + war: 'Guerre', + health: 'Santé', + diplo: 'Diplomatie' +} + export class GameScene extends Phaser.Scene { constructor() { super('GameScene') - this.hand = [] + this.handCards = [] this.selectedCard = null - this.playedCards = [] + this.resolveObjects = [] } create() { - this.socket = this.registry.get('socket') - this.store = this.registry.get('store') - this.roomId = this.registry.get('roomId') + this.socket = this.registry.get('socket') + this.store = this.registry.get('store') + this.roomId = this.registry.get('roomId') - this.createTable() - this.createHand() - this.createPlayButton() - this.setupSocketListeners() + this._buildTable() + this._buildPlayButton() + this._setupSocketListeners() - // Demander l'état initial this.socket.emit('request-state', { roomId: this.roomId }) } - createTable() { + // ─── Construction du plateau ───────────────────────────────────────────────── + + _buildTable() { const { width, height } = this.scale - // Zone centrale de jeu - this.add.rectangle(width / 2, height / 2, width * 0.6, height * 0.4, 0x1a0800, 0.8) - .setStrokeStyle(1, 0xd4a73240) + // Fond parchemin + this.add.rectangle(width / 2, height / 2, width, height, 0x0d0500) - // Label tour - this.turnText = this.add.text(width / 2, 30, 'Tour 1/10', { - fontSize: '18px', - color: '#d4a732', - fontFamily: 'Georgia' + // Zone de jeu centrale + this.add.rectangle(width / 2, height / 2 - 60, width * 0.7, height * 0.38, 0x1a0800, 0.7) + .setStrokeStyle(1, 0xd4a73230) + + // Titre du tour + this.turnText = this.add.text(width / 2, 18, 'Tour 1 / 12', { + fontSize: '16px', + fontFamily: 'Georgia', + color: '#d4a732' }).setOrigin(0.5) - // Zone cartes jouées (4 emplacements) - this.playZones = [] - const zoneY = height / 2 - const startX = width / 2 - 180 - for (let i = 0; i < 4; i++) { - const x = startX + i * 120 - const zone = this.add.rectangle(x, zoneY, 110, 170, 0x000000, 0) - .setStrokeStyle(1, 0xd4a73250) - this.playZones.push(zone) + // Phase courante + this.phaseText = this.add.text(width / 2, 40, 'Sélectionnez une carte', { + fontSize: '13px', + fontFamily: 'Georgia', + color: '#a08060' + }).setOrigin(0.5) - this.add.text(x, zoneY + 100, `J${i + 1}`, { - fontSize: '12px', - color: '#a08060', - fontFamily: 'Georgia' + // 4 emplacements de cartes jouées (zone centrale) + this.playSlots = [] + const slotY = height / 2 - 60 + const totalW = 4 * 140 + const startX = width / 2 - totalW / 2 + 70 + + for (let i = 0; i < 4; i++) { + const x = startX + i * 140 + const slot = this.add.graphics() + slot.lineStyle(1, 0xd4a73240) + slot.strokeRoundedRect(-65, -95, 130, 190, 8) + slot.x = x + slot.y = slotY + this.playSlots.push({ x, y: slotY, graphics: slot }) + + // Label joueur + this.add.text(x, slotY + 108, `J${i + 1}`, { + fontSize: '11px', + fontFamily: 'Georgia', + color: '#4a3020' }).setOrigin(0.5) } + + // Légende attributs (coin en bas à droite) + this._buildAttrLegend(width - 10, height - 10) } - createHand() { - const { width, height } = this.scale - const handY = height - 110 + _buildAttrLegend(x, y) { + const entries = [ + { attr: 'food', label: '🟡 Nourriture — haut gauche' }, + { attr: 'war', label: '🔴 Guerre — haut droite' }, + { attr: 'health', label: '🟢 Santé — bas gauche' }, + { attr: 'diplo', label: '🔵 Diplomatie — bas droite' } + ] - // Vider l'ancienne main - this.hand.forEach(c => c.destroy()) - this.hand = [] - - const cards = this.store.hand - const totalWidth = cards.length * 130 - const startX = width / 2 - totalWidth / 2 + 60 - - cards.forEach((cardData, i) => { - const card = new CardObject(this, startX + i * 130, handY, cardData) - card.on('select', this.onCardSelected, this) - this.hand.push(card) + entries.forEach((e, i) => { + this.add.text(x, y - i * 16, e.label, { + fontSize: '10px', + fontFamily: 'Georgia', + color: '#6a5040' + }).setOrigin(1, 1) }) } - createPlayButton() { + _buildPlayButton() { const { width, height } = this.scale - this.playBtn = this.add.text(width / 2, height - 30, '[ JOUER LA CARTE ]', { - fontSize: '16px', + this.playBtn = this.add.text(width / 2, height - 18, '[ JOUER LA CARTE ]', { + fontSize: '15px', + fontFamily: 'Georgia', color: '#1a0a00', backgroundColor: '#d4a732', - padding: { x: 20, y: 8 }, - fontFamily: 'Georgia' + padding: { x: 20, y: 8 } }) .setOrigin(0.5) + .setAlpha(0.35) .setInteractive({ cursor: 'pointer' }) - .setAlpha(0.4) - .on('pointerdown', this.playSelectedCard, this) - .on('pointerover', () => { if (this.selectedCard) this.playBtn.setAlpha(1) }) - .on('pointerout', () => { if (!this.selectedCard) this.playBtn.setAlpha(0.4) }) + .on('pointerdown', this._playSelectedCard, this) } - onCardSelected(card) { - // Désélectionner la précédente + // ─── Main du joueur ────────────────────────────────────────────────────────── + + _buildHand(cards) { + const { width, height } = this.scale + + // Vider l'ancienne main + this.handCards.forEach(c => c.destroy()) + this.handCards = [] + + if (!cards || cards.length === 0) return + + const handY = height - 120 + const spacing = Math.min(150, (width * 0.85) / cards.length) + const totalW = spacing * (cards.length - 1) + const startX = width / 2 - totalW / 2 + + cards.forEach((cardData, i) => { + const card = new CardObject(this, startX + i * spacing, handY, cardData) + card.on('select', this._onCardSelected, this) + this.handCards.push(card) + }) + } + + _onCardSelected(card) { + // Désélectionner l'ancienne if (this.selectedCard && this.selectedCard !== card) { this.selectedCard.deselect() } @@ -102,7 +163,7 @@ export class GameScene extends Phaser.Scene { this.playBtn.setAlpha(1) } - playSelectedCard() { + _playSelectedCard() { if (!this.selectedCard || this.store.phase !== 'selecting') return this.socket.emit('play-card', { @@ -110,55 +171,146 @@ export class GameScene extends Phaser.Scene { cardId: this.selectedCard.cardData.id }) - this.selectedCard.setAlpha(0.5) + this.selectedCard.setAlpha(0.4) this.selectedCard = null this.store.clearSelection() - this.playBtn.setAlpha(0.4) + this.playBtn.setAlpha(0.35) + this.phaseText.setText('En attente des autres joueurs...') } - setupSocketListeners() { + // ─── Résolution visuelle ───────────────────────────────────────────────────── + + _showPlayedCards(playedCards) { + // Nettoyer + this.resolveObjects.forEach(o => o.destroy()) + this.resolveObjects = [] + + playedCards.forEach((entry, i) => { + const slot = this.playSlots[i] + if (!slot) return + + const teamColor = TEAM_COLORS[entry.teamIndex] ?? 0x888888 + + // Mini carte de résolution + const g = this.add.graphics() + g.fillStyle(this._darken(teamColor, 0.3)) + g.fillRoundedRect(-55, -85, 110, 170, 6) + g.lineStyle(2, teamColor) + g.strokeRoundedRect(-55, -85, 110, 170, 6) + g.x = slot.x + g.y = slot.y + this.resolveObjects.push(g) + + // Nom du joueur + const pName = this.add.text(slot.x, slot.y - 72, entry.playerName, { + fontSize: '10px', fontFamily: 'Georgia', color: '#ffffff', fontStyle: 'bold' + }).setOrigin(0.5) + this.resolveObjects.push(pName) + + // Nom de la carte + const cName = this.add.text(slot.x, slot.y - 56, entry.cardName, { + fontSize: '13px', fontFamily: 'Georgia', color: '#d4a732', fontStyle: 'bold' + }).setOrigin(0.5) + this.resolveObjects.push(cName) + + // 4 attributs + const attrs = [ + { key: 'food', label: 'NOU', cx: slot.x - 28, cy: slot.y - 20 }, + { key: 'war', label: 'GUE', cx: slot.x + 28, cy: slot.y - 20 }, + { key: 'health', label: 'SAN', cx: slot.x - 28, cy: slot.y + 40 }, + { key: 'diplo', label: 'DIP', cx: slot.x + 28, cy: slot.y + 40 } + ] + + attrs.forEach(({ key, label, cx, cy }) => { + const c = this.add.graphics() + c.fillStyle(ATTR_COLORS[key], 0.85) + c.fillRoundedRect(-20, -18, 40, 36, 4) + c.x = cx + c.y = cy + this.resolveObjects.push(c) + + const v = this.add.text(cx, cy - 4, String(entry[key]), { + fontSize: '14px', fontFamily: 'Georgia', fontStyle: 'bold', + color: '#ffffff', stroke: '#000000', strokeThickness: 2 + }).setOrigin(0.5) + this.resolveObjects.push(v) + + const l = this.add.text(cx, cy + 10, label, { + fontSize: '7px', fontFamily: 'Arial', color: '#ffffff' + }).setOrigin(0.5) + this.resolveObjects.push(l) + }) + }) + } + + _showAttrResults(attrResults) { + const { width, height } = this.scale + const attrs = ['food', 'war', 'health', 'diplo'] + const boxY = height / 2 + 80 + + attrs.forEach((attr, i) => { + const r = attrResults[attr] + const x = width / 2 - 300 + i * 200 + + const g = this.add.graphics() + g.fillStyle(ATTR_COLORS[attr], 0.15) + g.fillRoundedRect(-90, -20, 180, 40, 6) + g.lineStyle(1, ATTR_COLORS[attr], 0.6) + g.strokeRoundedRect(-90, -20, 180, 40, 6) + g.x = x + g.y = boxY + this.resolveObjects.push(g) + + const label = ATTR_LABELS[attr] + const winText = r.winner === 'tie' + ? `Égalité` + : `${r.winner} +${r.value}` + + const t1 = this.add.text(x, boxY - 8, label, { + fontSize: '11px', fontFamily: 'Georgia', color: '#' + ATTR_COLORS[attr].toString(16).padStart(6, '0') + }).setOrigin(0.5) + this.resolveObjects.push(t1) + + const t2 = this.add.text(x, boxY + 8, winText, { + fontSize: '12px', fontFamily: 'Georgia', color: '#ffffff', fontStyle: 'bold' + }).setOrigin(0.5) + this.resolveObjects.push(t2) + }) + } + + // ─── Socket listeners ──────────────────────────────────────────────────────── + + _setupSocketListeners() { this.socket.on('game-state', (state) => { this.store.updateState(state) - this.turnText.setText(`Tour ${state.currentTurn}/${state.maxTurns}`) + this.turnText.setText(`Tour ${state.currentTurn} / ${state.maxTurns}`) if (state.phase === 'selecting') { - this.createHand() + this.resolveObjects.forEach(o => o.destroy()) + this.resolveObjects = [] + this.phaseText.setText('Sélectionnez une carte') + this._buildHand(state.hand) } - if (state.phase === 'resolve') { - this.showPlayedCards(state.playedCards) + if (state.phase === 'waiting') { + this.phaseText.setText('En attente des autres joueurs...') } }) - this.socket.on('round-result', (result) => { - this.showRoundResult(result) + this.socket.on('round-result', ({ playedCards, attrResults }) => { + this.phaseText.setText('Résolution du tour...') + this._showPlayedCards(playedCards) + this._showAttrResults(attrResults) }) } - showPlayedCards(played) { - played.forEach((entry, i) => { - if (!this.playZones[i]) return - const zone = this.playZones[i] - this.add.text(zone.x, zone.y, entry.cardName, { - fontSize: '13px', - color: '#f5e6c8', - fontFamily: 'Georgia', - wordWrap: { width: 100 } - }).setOrigin(0.5).setDepth(10) - }) - } + // ─── Utilitaires ───────────────────────────────────────────────────────────── - showRoundResult(result) { - const { width, height } = this.scale - const txt = this.add.text(width / 2, height / 2 - 100, result.message, { - fontSize: '20px', - color: '#d4a732', - fontFamily: 'Georgia', - stroke: '#000000', - strokeThickness: 4 - }).setOrigin(0.5).setDepth(20) - - this.time.delayedCall(2500, () => txt.destroy()) + _darken(hex, factor) { + const r = Math.floor(((hex >> 16) & 0xff) * factor) + const g = Math.floor(((hex >> 8) & 0xff) * factor) + const b = Math.floor(( hex & 0xff) * factor) + return (r << 16) | (g << 8) | b } update() {} diff --git a/server/package-lock.json b/server/package-lock.json new file mode 100644 index 0000000..268a82f --- /dev/null +++ b/server/package-lock.json @@ -0,0 +1,1465 @@ +{ + "name": "regnum-server", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "regnum-server", + "version": "0.1.0", + "dependencies": { + "cors": "^2.8.5", + "express": "^4.19.0", + "socket.io": "^4.7.5" + }, + "devDependencies": { + "nodemon": "^3.1.0" + } + }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", + "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==", + "license": "MIT" + }, + "node_modules/@types/cors": { + "version": "2.8.19", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz", + "integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "26.2.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.2.0.tgz", + "integrity": "sha512-5IviulTZeRNp2vAJ514cc/HUlY5nZ9fCbq9DMyC52BrhFZACo3nI0R7qBxhQmo/d27NFe96ur/b7Wwxklda+kg==", + "license": "MIT", + "dependencies": { + "undici-types": "~8.3.0" + } + }, + "node_modules/@types/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "license": "MIT" + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/base64id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", + "license": "MIT", + "engines": { + "node": "^4.5.0 || >= 5.9" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/body-parser": { + "version": "1.20.6", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.6.tgz", + "integrity": "sha512-p5tAzS57i5MV9fZFDj9LeIiTZEufbSe2eDozP+ElheSUq1m74CRq1jI4mYNDdVs9vQztXFLuk/Gd6BWTdwRJ5g==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "~1.2.0", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "on-finished": "~2.4.1", + "qs": "~6.15.1", + "raw-body": "~2.5.3", + "type-is": "~1.6.18", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", + "license": "MIT" + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/engine.io": { + "version": "6.6.9", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.9.tgz", + "integrity": "sha512-clKkw4C7nJ22mGgoVcCg6V/W/TxdNyIOTr89k2ONZu81qqkddPFDF0LXcbAwhzPD8DjkiRCjzuiO6Y+fkpD4vg==", + "license": "MIT", + "dependencies": { + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", + "@types/ws": "^8.5.12", + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "~0.7.2", + "cors": "~2.8.5", + "debug": "~4.4.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.21.0" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz", + "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/engine.io/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/engine.io/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz", + "integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "~1.20.5", + "content-disposition": "~0.5.4", + "content-type": "~1.0.4", + "cookie": "~0.7.1", + "cookie-signature": "~1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.3.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "~0.1.12", + "proxy-addr": "~2.0.7", + "qs": "~6.15.1", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "~0.19.0", + "serve-static": "~1.16.2", + "setprototypeof": "1.2.0", + "statuses": "~2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", + "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "statuses": "~2.0.2", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/nodemon/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz", + "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==", + "license": "MIT" + }, + "node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/qs": { + "version": "6.15.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz", + "integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==", + "license": "BSD-3-Clause", + "dependencies": { + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", + "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz", + "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.4.1", + "range-parser": "~1.2.1", + "statuses": "~2.0.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/serve-static": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz", + "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==", + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "~0.19.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/socket.io": { + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.8.3.tgz", + "integrity": "sha512-2Dd78bqzzjE6KPkD5fHZmDAKRNe3J15q+YHDrIsy9WEkqttc7GY+kT9OBLSMaPbQaEd0x1BjcmtMtXkfpc+T5A==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.4", + "base64id": "~2.0.0", + "cors": "~2.8.5", + "debug": "~4.4.1", + "engine.io": "~6.6.0", + "socket.io-adapter": "~2.5.2", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/socket.io-adapter": { + "version": "2.5.8", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.8.tgz", + "integrity": "sha512-6Oy52pbg+kvdCVvjcN+FnY7BvxZ7cIHNScbvztT/It5d0vbwoJoVZmF2gjJmnV0/4WlXRfG15zc45ySk9Ah8bw==", + "license": "MIT", + "dependencies": { + "debug": "~4.4.1", + "ws": "~8.21.0" + } + }, + "node_modules/socket.io-adapter/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io-adapter/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/socket.io-parser": { + "version": "4.2.7", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.7.tgz", + "integrity": "sha512-IH/iSeO9T6gz1KkFleGDWkG9N3dl4jXVYUtMhIqH10Md0ttMer8nUNWiP1DKuNrybD2xBrixLJdCC9J6ECoYkg==", + "license": "MIT", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.4.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io-parser/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/socket.io/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz", + "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==", + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/ws": { + "version": "8.21.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.3.tgz", + "integrity": "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/server/src/game/Room.js b/server/src/game/Room.js index d442731..53b6f35 100644 --- a/server/src/game/Room.js +++ b/server/src/game/Room.js @@ -1,22 +1,32 @@ -const { dealHands, createDeck } = require('./cards') +const { dealHands } = require('./cards') const MAX_PLAYERS = 4 -const MAX_TURNS = 10 -const HAND_SIZE = 5 +const MAX_TURNS = 12 // 12 tours (1 par personnage potentiellement) +const HAND_SIZE = 4 // 4 cartes en main au départ + +/** + * Logique de résolution par tour : + * - Chaque joueur joue une carte simultanément + * - On compare les 4 attributs (food, war, health, diplo) entre tous les joueurs + * - Pour chaque attribut, le joueur avec la valeur la plus élevée marque des points + * - En cas d'égalité, personne ne marque sur cet attribut + * - Les points marqués = valeur de l'attribut gagnant + */ class Room { constructor(id) { - this.id = id - this.players = [] // { socketId, name, score, hand, protected } - this.phase = 'lobby' // lobby | selecting | waiting | resolve | end + this.id = id + this.players = [] // { socketId, name, teamIndex, score, hand } + this.phase = 'lobby' // lobby | selecting | waiting | resolve | end this.currentTurn = 0 - this.maxTurns = MAX_TURNS + this.maxTurns = MAX_TURNS this.pendingPlays = new Map() // socketId -> card - this.deck = [] } get playerCount() { return this.players.length } + // ─── Gestion des joueurs ──────────────────────────────────────────────────── + addPlayer(socketId, name) { if (this.players.length >= MAX_PLAYERS) return false if (this.players.find(p => p.socketId === socketId)) return true @@ -24,9 +34,9 @@ class Room { this.players.push({ socketId, name, + teamIndex: this.players.length, // 0=Écarlate 1=Azur 2=Émeraude 3=Or score: 0, - hand: [], - protected: false + hand: [] }) return true } @@ -35,29 +45,38 @@ class Room { this.players = this.players.filter(p => p.socketId !== socketId) } + // ─── Démarrage ────────────────────────────────────────────────────────────── + startGame() { - const { hands, remaining } = dealHands(this.players.length, HAND_SIZE) - this.deck = remaining + const hands = dealHands(this.players.length, HAND_SIZE) this.players.forEach((p, i) => { p.hand = hands[i] }) this.currentTurn = 1 this.phase = 'selecting' this.pendingPlays.clear() } + // ─── Phase de jeu ─────────────────────────────────────────────────────────── + playCard(socketId, cardId) { - if (this.phase !== 'selecting') return { ok: false, error: 'Ce n\'est pas la phase de jeu' } - if (this.pendingPlays.has(socketId)) return { ok: false, error: 'Tu as déjà joué ce tour' } + if (this.phase !== 'selecting') + return { ok: false, error: 'Ce n\'est pas la phase de sélection' } + if (this.pendingPlays.has(socketId)) + return { ok: false, error: 'Tu as déjà joué une carte ce tour' } const player = this.players.find(p => p.socketId === socketId) if (!player) return { ok: false, error: 'Joueur introuvable' } const cardIndex = player.hand.findIndex(c => c.id === cardId) - if (cardIndex === -1) return { ok: false, error: 'Carte non trouvée dans ta main' } + if (cardIndex === -1) return { ok: false, error: 'Carte absente de ta main' } - const card = player.hand.splice(cardIndex, 1)[0] + const [card] = player.hand.splice(cardIndex, 1) this.pendingPlays.set(socketId, { player, card }) - this.phase = 'waiting' + // Si tous ont joué → passer en "waiting" visible côté client + if (this.pendingPlays.size === this.players.length) { + this.phase = 'waiting' + } + return { ok: true } } @@ -65,119 +84,110 @@ class Room { return this.pendingPlays.size === this.players.length } + // ─── Résolution du tour ───────────────────────────────────────────────────── + resolveRound() { const plays = [...this.pendingPlays.values()] - const playedCards = plays.map(p => ({ name: p.player.name, cardName: p.card.name })) - // Réinitialiser protection - this.players.forEach(p => { p.protected = false }) + // Cartes jouées (pour affichage) + const playedCards = plays.map(({ player, card }) => ({ + playerName: player.name, + teamIndex: player.teamIndex, + cardId: card.id, + cardName: card.name, + food: card.food, + war: card.war, + health: card.health, + diplo: card.diplo + })) - // 1. Appliquer les effets de protection (Enchanteur) - plays.forEach(({ player, card }) => { - if (card.effect === 'protect') { - player.protected = true + // Résolution attribut par attribut + const attrs = ['food', 'war', 'health', 'diplo'] + const pointsGained = {} // socketId -> { food, war, health, diplo, total } + plays.forEach(({ player }) => { + pointsGained[player.socketId] = { food: 0, war: 0, health: 0, diplo: 0, total: 0 } + }) + + const attrResults = {} // attr -> { winner: name | 'tie', value } + + attrs.forEach(attr => { + const max = Math.max(...plays.map(p => p.card[attr])) + const winners = plays.filter(p => p.card[attr] === max) + + if (winners.length === 1) { + // Un seul gagnant + const { player } = winners[0] + pointsGained[player.socketId][attr] = max + pointsGained[player.socketId].total += max + player.score += max + attrResults[attr] = { winner: player.name, value: max } + } else { + // Égalité → personne ne marque + attrResults[attr] = { winner: 'tie', value: max, tiedPlayers: winners.map(w => w.player.name) } } }) - // 2. Calculer les points de base et effets - const messages = [] - plays.forEach(({ player, card }) => { - // Points de base - player.score += card.points - - if (!card.effect) return - - const [effectType, valueStr] = card.effect.split(':') - const value = parseInt(valueStr) || 0 - - switch (effectType) { - case 'steal': { - // Voler des points au joueur le plus riche non protégé - const targets = this.players - .filter(p => p.socketId !== player.socketId && !p.protected && p.score > 0) - .sort((a, b) => b.score - a.score) - - if (targets.length > 0) { - const stolen = Math.min(value, targets[0].score) - targets[0].score -= stolen - player.score += stolen - messages.push(`${player.name} vole ${stolen} pts à ${targets[0].name}`) - } - break - } - - case 'bonus': { - // Bonus si le joueur a le plus de points de Royaume ce tour - const myRoyaume = plays - .filter(p => p.player.socketId === player.socketId && p.card.type === 'Royaume') - .reduce((sum, p) => sum + p.card.points, 0) - if (myRoyaume > 0) { - player.score += value - messages.push(`${player.name} gagne +${value} pts bonus (Commerce)`) - } - break - } - - case 'double': { - // Double les points gagnés CE tour (uniquement la carte jouée) - player.score += card.points - messages.push(`${player.name} double ses gains (Alchimiste)`) - break - } - - case 'draw': { - // Piocher une carte supplémentaire - if (this.deck.length > 0) { - player.hand.push(this.deck.pop()) - messages.push(`${player.name} pioche une carte bonus`) - } - break - } - } + // Message de résumé + const lines = attrs.map(attr => { + const r = attrResults[attr] + const label = { food: 'Nourriture', war: 'Guerre', health: 'Santé', diplo: 'Diplomatie' }[attr] + if (r.winner === 'tie') return `${label} : Égalité (${r.tiedPlayers.join(' & ')}) — personne ne marque` + return `${label} : ${r.winner} gagne ${r.value} pts` }) - const message = messages.length > 0 ? messages.join(' | ') : 'Tour résolu !' - this.pendingPlays.clear() this.phase = 'resolve' - return { playedCards, message } + return { + playedCards, + attrResults, + pointsGained, + message: lines.join('\n') + } } + // ─── Tour suivant ──────────────────────────────────────────────────────────── + nextTurn() { this.currentTurn++ - this.phase = 'selecting' - // Distribuer une nouvelle carte si la main est vide - this.players.forEach(p => { - if (p.hand.length === 0 && this.deck.length >= HAND_SIZE) { - p.hand = this.deck.splice(0, HAND_SIZE) - } else if (p.hand.length < 2 && this.deck.length > 0) { - p.hand.push(this.deck.pop()) - } - }) + if (this.isGameOver()) { + this.phase = 'end' + return + } + + this.phase = 'selecting' + // Si un joueur n'a plus de cartes en main, on lui repioche depuis son deck perso + // (dans cette version simple la main se vide naturellement) } isGameOver() { - return this.currentTurn >= this.maxTurns + // Partie terminée quand tous les joueurs n'ont plus de cartes OU après maxTurns + const allEmpty = this.players.every(p => p.hand.length === 0) + return allEmpty || this.currentTurn >= this.maxTurns } + // ─── Données publiques ─────────────────────────────────────────────────────── + getPlayersInfo() { return this.players.map(p => ({ - name: p.name, - score: p.score, - handSize: p.hand.length + name: p.name, + teamIndex: p.teamIndex, + score: p.score, + handSize: p.hand.length })) } + /** État envoyé à UN joueur spécifique (inclut sa main) */ getStateFor(socketId) { const player = this.players.find(p => p.socketId === socketId) return { - players: this.getPlayersInfo(), + players: this.getPlayersInfo(), currentTurn: this.currentTurn, - maxTurns: this.maxTurns, - phase: this.phase, - hand: player ? player.hand : [] + maxTurns: this.maxTurns, + phase: this.phase, + hand: player ? player.hand : [], + myTeamIndex: player ? player.teamIndex : 0 } } } diff --git a/server/src/game/cards.js b/server/src/game/cards.js index 424e497..adb6332 100644 --- a/server/src/game/cards.js +++ b/server/src/game/cards.js @@ -1,31 +1,161 @@ -// Deck de base de Regnum -// Types: Royaume (points fixes), Armée (attaque), Commerce (multiplicateur), Magie (effets spéciaux) +/** + * Regnum - Définition des 12 personnages + * + * Chaque carte possède 4 attributs (valeurs de 1 à 6) : + * food (🟡 Nourriture) - coin haut gauche - jaune + * war (🔴 Guerre) - coin haut droite - rouge + * health(🟢 Santé) - coin bas gauche - vert + * diplo (🔵 Diplomatie) - coin bas droite - bleu + * + * Toutes les équipes ont exactement le même deck de 12 cartes, + * seule la couleur d'équipe change visuellement. + */ -const BASE_DECK = [ - // === ROYAUME === - { id: 'r1', name: 'Village', type: 'Royaume', points: 2, effect: null }, - { id: 'r2', name: 'Château', type: 'Royaume', points: 5, effect: null }, - { id: 'r3', name: 'Cathédrale', type: 'Royaume', points: 4, effect: null }, - { id: 'r4', name: 'Forteresse', type: 'Royaume', points: 3, effect: null }, - { id: 'r5', name: 'Palais Royal', type: 'Royaume', points: 7, effect: null }, - - // === ARMÉE === - { id: 'a1', name: 'Chevaliers', type: 'Armée', points: 3, effect: 'steal:1' }, - { id: 'a2', name: 'Archers', type: 'Armée', points: 2, effect: 'steal:1' }, - { id: 'a3', name: 'Catapulte', type: 'Armée', points: 1, effect: 'steal:2' }, - { id: 'a4', name: 'Légion', type: 'Armée', points: 4, effect: 'steal:2' }, - - // === COMMERCE === - { id: 'c1', name: 'Marché', type: 'Commerce', points: 2, effect: 'bonus:1' }, - { id: 'c2', name: 'Port', type: 'Commerce', points: 3, effect: 'bonus:2' }, - { id: 'c3', name: 'Route de soie', type: 'Commerce', points: 5, effect: 'bonus:1' }, - - // === MAGIE === - { id: 'm1', name: 'Oracle', type: 'Magie', points: 1, effect: 'draw:1' }, - { id: 'm2', name: 'Enchanteur', type: 'Magie', points: 2, effect: 'protect' }, - { id: 'm3', name: 'Alchimiste', type: 'Magie', points: 3, effect: 'double' }, +const CHARACTERS = [ + { + id: 'queen', + name: 'Reine', + food: 2, + war: 2, + health: 3, + diplo: 5, + description: 'Maîtresse de la diplomatie, elle tisse des alliances avec dextérité.' + }, + { + id: 'prince', + name: 'Prince', + food: 2, + war: 4, + health: 2, + diplo: 4, + description: 'Héritier du trône, équilibré entre le glaive et la parole.' + }, + { + id: 'butcher', + name: 'Boucher', + food: 5, + war: 3, + health: 1, + diplo: 1, + description: 'Maître des viandes, il nourrit le peuple mais soigne peu.' + }, + { + id: 'doctor', + name: 'Médecin', + food: 2, + war: 1, + health: 6, + diplo: 3, + description: 'Expert en guérison, indispensable à la survie du royaume.' + }, + { + id: 'apothecary', + name: 'Apothicaire', + food: 3, + war: 1, + health: 5, + diplo: 3, + description: 'Prépare potions et remèdes, soutien précieux en temps de crise.' + }, + { + id: 'jester', + name: 'Fou du Roi', + food: 1, + war: 1, + health: 2, + diplo: 6, + description: 'Sa sagesse cachée derrière la bouffonnerie fait des miracles diplomatiques.' + }, + { + id: 'assassin', + name: 'Assassin', + food: 1, + war: 6, + health: 1, + diplo: 2, + description: 'Frappe dans l\'ombre, inarrêtable au combat mais inutile ailleurs.' + }, + { + id: 'peasant', + name: 'Paysan', + food: 6, + war: 2, + health: 2, + diplo: 1, + description: 'Nourrit tout le royaume, force vitale de toute civilisation.' + }, + { + id: 'executioner', + name: 'Bourreau', + food: 2, + war: 5, + health: 1, + diplo: 2, + description: 'Bras armé de la justice royale, redouté de tous.' + }, + { + id: 'knight', + name: 'Chevalier', + food: 3, + war: 5, + health: 2, + diplo: 2, + description: 'Défenseur du royaume, vaillant sur le champ de bataille.' + }, + { + id: 'merchant', + name: 'Marchand', + food: 4, + war: 1, + health: 2, + diplo: 5, + description: 'Ses routes commerciales enrichissent et lient les royaumes.' + }, + { + id: 'bishop', + name: 'Évêque', + food: 2, + war: 1, + health: 4, + diplo: 5, + description: 'Voix de l\'Église, il guérit les âmes et négocie la paix.' + } ] +/** + * Couleurs des 4 équipes (teinte principale de la carte) + */ +const TEAM_COLORS = { + 0: { name: 'Écarlate', hex: 0xcc2200, css: '#cc2200' }, + 1: { name: 'Azur', hex: 0x1155cc, css: '#1155cc' }, + 2: { name: 'Émeraude', hex: 0x1a7a2e, css: '#1a7a2e' }, + 3: { name: 'Or', hex: 0xb8860b, css: '#b8860b' } +} + +/** + * Attributs visuels fixes (couleur de chaque coin) + */ +const ATTR_COLORS = { + food: { hex: 0xf0c030, css: '#f0c030', label: 'Nourriture', corner: 'topLeft' }, + war: { hex: 0xdd2222, css: '#dd2222', label: 'Guerre', corner: 'topRight' }, + health: { hex: 0x22aa44, css: '#22aa44', label: 'Santé', corner: 'bottomLeft' }, + diplo: { hex: 0x3399ee, css: '#3399ee', label: 'Diplomatie', corner: 'bottomRight' } +} + +/** + * Retourne le deck complet (les 12 personnages) pour une équipe donnée + */ +function getDeckForTeam(teamIndex) { + return CHARACTERS.map(c => ({ + ...c, + teamIndex, + teamColor: TEAM_COLORS[teamIndex] + })) +} + +/** + * Distribue une main de N cartes par joueur depuis un deck mélangé + */ function shuffle(arr) { const a = [...arr] for (let i = a.length - 1; i > 0; i--) { @@ -35,17 +165,13 @@ function shuffle(arr) { return a } -function createDeck() { - return shuffle([...BASE_DECK, ...BASE_DECK]) // 2 exemplaires -} - -function dealHands(playerCount, handSize = 5) { - const deck = createDeck() +function dealHands(playerCount, handSize = 4) { const hands = [] for (let i = 0; i < playerCount; i++) { - hands.push(deck.splice(0, handSize)) + const deck = shuffle(getDeckForTeam(i)) + hands.push(deck.slice(0, handSize)) } - return { hands, remaining: deck } + return hands } -module.exports = { createDeck, dealHands, BASE_DECK } +module.exports = { CHARACTERS, TEAM_COLORS, ATTR_COLORS, getDeckForTeam, dealHands } diff --git a/server/src/index.js b/server/src/index.js index 96707c9..5467ded 100644 --- a/server/src/index.js +++ b/server/src/index.js @@ -1,7 +1,7 @@ const express = require('express') -const http = require('http') +const http = require('http') const { Server } = require('socket.io') -const cors = require('cors') +const cors = require('cors') const { RoomManager } = require('./game/RoomManager') const app = express() @@ -16,8 +16,9 @@ const io = new Server(server, { const rooms = new RoomManager() io.on('connection', (socket) => { - console.log(`[+] Connexion: ${socket.id}`) + console.log(`[+] ${socket.id}`) + // ─── Rejoindre une salle ───────────────────────────────────────────────────── socket.on('join-room', ({ roomId, playerName }) => { const room = rooms.getOrCreate(roomId) const joined = room.addPlayer(socket.id, playerName) @@ -28,13 +29,14 @@ io.on('connection', (socket) => { } socket.join(roomId) - socket.data.roomId = roomId + socket.data.roomId = roomId socket.data.playerName = playerName io.to(roomId).emit('room-update', { players: room.getPlayersInfo() }) - console.log(`[room:${roomId}] ${playerName} rejoint (${room.playerCount}/4)`) + console.log(`[${roomId}] ${playerName} rejoint (${room.playerCount}/4)`) }) + // ─── Démarrer la partie ────────────────────────────────────────────────────── socket.on('start-game', ({ roomId }) => { const room = rooms.get(roomId) if (!room || room.playerCount < 2) return @@ -42,18 +44,21 @@ io.on('connection', (socket) => { room.startGame() io.to(roomId).emit('game-start') - // Envoyer l'état initial à chaque joueur avec sa main - room.players.forEach((player) => { + // Envoyer la main personnalisée à chaque joueur + room.players.forEach(player => { io.to(player.socketId).emit('game-state', room.getStateFor(player.socketId)) }) + console.log(`[${roomId}] Partie démarrée`) }) + // ─── Demander l'état courant ───────────────────────────────────────────────── socket.on('request-state', ({ roomId }) => { const room = rooms.get(roomId) if (!room) return socket.emit('game-state', room.getStateFor(socket.id)) }) + // ─── Jouer une carte ───────────────────────────────────────────────────────── socket.on('play-card', ({ roomId, cardId }) => { const room = rooms.get(roomId) if (!room) return @@ -64,40 +69,52 @@ io.on('connection', (socket) => { return } - // Mise à jour de phase pour tous + // Informer tous que quelqu'un a joué (sans révéler la carte) io.to(roomId).emit('game-state', { - players: room.getPlayersInfo(), + players: room.getPlayersInfo(), currentTurn: room.currentTurn, - maxTurns: room.maxTurns, - phase: room.phase + maxTurns: room.maxTurns, + phase: room.phase }) - // Tous les joueurs ont joué → résolution + // Tous les joueurs ont joué → résolution automatique if (room.allPlayersPlayed()) { const roundResult = room.resolveRound() - io.to(roomId).emit('game-state', { - players: room.getPlayersInfo(), - currentTurn: room.currentTurn, - maxTurns: room.maxTurns, - phase: 'resolve', - playedCards: roundResult.playedCards + console.log(`[${roomId}] Tour ${room.currentTurn} résolu`) + + // Révéler les cartes jouées et les résultats + io.to(roomId).emit('round-result', { + playedCards: roundResult.playedCards, + attrResults: roundResult.attrResults, + message: roundResult.message }) - io.to(roomId).emit('round-result', { message: roundResult.message }) + // Mise à jour scores + io.to(roomId).emit('game-state', { + players: room.getPlayersInfo(), + currentTurn: room.currentTurn, + maxTurns: room.maxTurns, + phase: 'resolve' + }) + // 3 secondes d'affichage puis tour suivant / fin setTimeout(() => { + room.nextTurn() + if (room.isGameOver()) { io.to(roomId).emit('game-over', room.getPlayersInfo()) + console.log(`[${roomId}] Partie terminée`) } else { - room.nextTurn() - room.players.forEach((player) => { + // Distribuer la nouvelle main à chaque joueur + room.players.forEach(player => { io.to(player.socketId).emit('game-state', room.getStateFor(player.socketId)) }) } - }, 3000) + }, 3500) } }) + // ─── Déconnexion ───────────────────────────────────────────────────────────── socket.on('disconnect', () => { const roomId = socket.data.roomId if (roomId) { @@ -105,13 +122,14 @@ io.on('connection', (socket) => { if (room) { room.removePlayer(socket.id) io.to(roomId).emit('room-update', { players: room.getPlayersInfo() }) + if (room.playerCount === 0) rooms.delete(roomId) } } - console.log(`[-] Déconnexion: ${socket.id}`) + console.log(`[-] ${socket.id}`) }) }) const PORT = process.env.PORT || 3000 server.listen(PORT, () => { - console.log(`Serveur Regnum démarré sur le port ${PORT}`) + console.log(`Regnum server → http://localhost:${PORT}`) })