From 6943a1f429b9e75e3c883fcca29177ef49f655b5 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Fri, 10 Jul 2026 23:13:05 +0200 Subject: [PATCH] fix: 4 bugs post-review (JSON, rangMagie, GM guard, inline styles) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Trailing comma dans fr.json qui cassait le parsing JSON (critique) - RANG_MAGICIEN utilisait val.name au lieu de val.label - Bouton tirage MJ accessible aux non-GM (ajout guard game.user.isGM) - style='flex:1' et style='display:none' externalisés dans roll.less --- css/fvtt-hamalron.css | 32 +++++++++++++++++++++++++++---- lang/fr.json | 2 +- module/documents/tirage-tarot.mjs | 1 + module/models/personnage.mjs | 2 +- styles/roll.less | 30 +++++++++++++++++++++++++---- templates/roll-dialog.hbs | 4 ++-- 6 files changed, 59 insertions(+), 12 deletions(-) diff --git a/css/fvtt-hamalron.css b/css/fvtt-hamalron.css index 41ccb21..98abd67 100644 --- a/css/fvtt-hamalron.css +++ b/css/fvtt-hamalron.css @@ -3410,10 +3410,34 @@ i.fvtt-hamalron { font-weight: bold; color: var(--color-dark-1); } -.fvtt-hamalron-roll-dialog .difficulty-select { - width: 100%; - text-align: center; - padding: 0.25rem; +.fvtt-hamalron-roll-dialog .difficulty-row { + display: flex; + align-items: center; + gap: 4px; +} +.fvtt-hamalron-roll-dialog .difficulty-row .difficulty-select-input { + flex: 1; +} +.fvtt-hamalron-roll-dialog .difficulty-row .draw-difficulty-btn { + padding: 4px 10px; + background: #2a2a4a; + color: #e0e0e0; + border: 1px solid #555; + border-radius: 4px; + cursor: pointer; +} +.fvtt-hamalron-roll-dialog .difficulty-row .draw-difficulty-btn:hover { + background: #3a3a6a; + border-color: #e94560; +} +.fvtt-hamalron-roll-dialog .drawn-card-info { + margin-top: 4px; + font-size: 12px; + color: #e94560; + font-style: italic; +} +.fvtt-hamalron-roll-dialog .drawn-card-info#drawn-card-info { + display: none; } .dialog-modifier { display: flex; diff --git a/lang/fr.json b/lang/fr.json index 91b64cd..89fbf2f 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -854,6 +854,6 @@ "Remove": "Guérir la blessure", "RemoveConfirm": "La blessure est-elle guérie ? Cela restaurera vos capacités physiques.", "Healed": "Blessure guérie !" - }, + } } } \ No newline at end of file diff --git a/module/documents/tirage-tarot.mjs b/module/documents/tirage-tarot.mjs index 8df7fca..2b13831 100644 --- a/module/documents/tirage-tarot.mjs +++ b/module/documents/tirage-tarot.mjs @@ -279,6 +279,7 @@ export default class HamalronTirageTarot extends Roll { // Tirage d'une carte pour la difficulté (épreuve sous tension) $("#draw-difficulty-btn").click(async function () { + if (!game.user.isGM) return const deckManager = globalThis.HamalronTarotDeckManager?._instance if (!deckManager || deckManager.deck.length === 0) { ui.notifications.warn(game.i18n.localize("HAMALRON.Notifications.deckEmpty")) diff --git a/module/models/personnage.mjs b/module/models/personnage.mjs index f7905ca..5ab83cd 100644 --- a/module/models/personnage.mjs +++ b/module/models/personnage.mjs @@ -34,7 +34,7 @@ export default class HamalronPersonnage extends foundry.abstract.TypeDataModel { schema.historial = new fields.HTMLField({ required: true, textSearch: true }) schema.progression = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }) - schema.rangMagie = new fields.StringField({ required: true, initial: "initie", choices: Object.fromEntries(Object.entries(SYSTEM.RANG_MAGICIEN).map(([key, val]) => [key, val.name])) }) + schema.rangMagie = new fields.StringField({ required: true, initial: "initie", choices: Object.fromEntries(Object.entries(SYSTEM.RANG_MAGICIEN).map(([key, val]) => [key, val.label])) }) schema.resistanceRecovery = new fields.ObjectField({ required: false, initial: {} }) schema.blessureIncapacitante = new fields.BooleanField({ required: true, initial: false }) schema.malusBlessure = new fields.NumberField({ required: true, integer: true, initial: 0, min: -8, max: 0 }) diff --git a/styles/roll.less b/styles/roll.less index a684586..8ecca6c 100644 --- a/styles/roll.less +++ b/styles/roll.less @@ -229,10 +229,32 @@ } } - .difficulty-select { - width: 100%; - text-align: center; - padding: 0.25rem; + .difficulty-row { + display: flex; + align-items: center; + gap: 4px; + + .difficulty-select-input { + flex: 1; + } + + .draw-difficulty-btn { + padding: 4px 10px; + background: #2a2a4a; + color: #e0e0e0; + border: 1px solid #555; + border-radius: 4px; + cursor: pointer; + &:hover { background: #3a3a6a; border-color: #e94560; } + } + } + + .drawn-card-info { + margin-top: 4px; + font-size: 12px; + color: #e94560; + font-style: italic; + &#drawn-card-info { display: none; } } } diff --git a/templates/roll-dialog.hbs b/templates/roll-dialog.hbs index 4f3e34d..5e4775a 100644 --- a/templates/roll-dialog.hbs +++ b/templates/roll-dialog.hbs @@ -64,7 +64,7 @@
{{localize "HAMALRON.Label.difficulty"}}
- {{selectOptions difficultyChoices selected="soustension_oppose" @@ -75,7 +75,7 @@
-