From d198daba036c0e07dc7f5cd123032b84b3f3f070 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Sat, 11 Jul 2026 00:19:37 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20messages=20Sous=20tension/Oppos=C3=A9?= =?UTF-8?q?=20stylis=C3=A9s=20(template=20chat-tension.hbs)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Affiche les scores du joueur et du MJ/opposant côte à côte avec un séparateur VS, résultat coloré, badges et icônes. --- css/fvtt-hamalron.css | 73 ++++++++++++++++++ fvtt-hamalron.mjs | 25 +++---- packs-system/hamalron-items/CURRENT | 2 +- packs-system/hamalron-items/MANIFEST-000002 | Bin 129 -> 0 bytes packs-system/hamalron-items/MANIFEST-000006 | Bin 0 -> 114 bytes styles/chat.less | 79 ++++++++++++++++++++ templates/chat-tension.hbs | 27 +++++++ 7 files changed, 192 insertions(+), 14 deletions(-) delete mode 100644 packs-system/hamalron-items/MANIFEST-000002 create mode 100644 packs-system/hamalron-items/MANIFEST-000006 create mode 100644 templates/chat-tension.hbs diff --git a/css/fvtt-hamalron.css b/css/fvtt-hamalron.css index 810049f..3d7522a 100644 --- a/css/fvtt-hamalron.css +++ b/css/fvtt-hamalron.css @@ -2997,6 +2997,79 @@ i.fvtt-hamalron { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); } } +.tension-roll { + background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); + border: 1px solid #e94560; + border-radius: 8px; + overflow: hidden; +} +.tension-roll .tension-header { + text-align: center; + padding: 6px; + background: rgba(233, 69, 96, 0.15); + border-bottom: 1px solid rgba(233, 69, 96, 0.3); +} +.tension-roll .tension-header .tension-badge { + color: #e94560; + font-size: 13px; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 2px; + display: flex; + align-items: center; + justify-content: center; + gap: 6px; +} +.tension-roll .tension-players { + display: flex; + align-items: center; + justify-content: space-around; + padding: 12px 8px; +} +.tension-roll .tension-players .tension-side { + text-align: center; +} +.tension-roll .tension-players .tension-side .tension-side-label { + font-size: 11px; + color: #888; + text-transform: uppercase; + letter-spacing: 1px; + margin-bottom: 4px; +} +.tension-roll .tension-players .tension-side .tension-side-value { + font-size: 28px; + font-weight: 700; + color: #f0e6d3; +} +.tension-roll .tension-players .tension-side .tension-side-name { + font-size: 11px; + color: #aaa; + margin-top: 2px; +} +.tension-roll .tension-players .tension-side.tension-winner .tension-side-value { + color: #4caf50; +} +.tension-roll .tension-players .tension-vs { + font-size: 14px; + font-weight: 700; + color: #e94560; + opacity: 0.7; +} +.tension-roll .tension-result { + text-align: center; + padding: 6px; + font-size: 13px; + font-weight: 600; + border-top: 1px solid rgba(233, 69, 96, 0.2); +} +.tension-roll .tension-result.result-success { + background: rgba(76, 175, 80, 0.15); + color: #4caf50; +} +.tension-roll .tension-result.result-failure { + background: rgba(244, 67, 54, 0.15); + color: #f44336; +} .initiative-roll { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); border: 1px solid #e94560; diff --git a/fvtt-hamalron.mjs b/fvtt-hamalron.mjs index c598de2..0e8276e 100644 --- a/fvtt-hamalron.mjs +++ b/fvtt-hamalron.mjs @@ -325,13 +325,12 @@ $(document).on("click", "[data-action='sousTension']", async function () { deckManager.addToDiscard(card) await deckManager.saveDeckState() - const success = totalJoueur >= valeurMJ - ChatMessage.create({ - content: `

${game.i18n.localize("HAMALRON.Label.sousTension")}

-

${actorName}: ${totalJoueur} vs MJ: ${card.name} (${valeurMJ})

-

${success ? game.i18n.localize("HAMALRON.Label.success") : game.i18n.localize("HAMALRON.Label.failure")}

`, - style: CONST.CHAT_MESSAGE_STYLES.OTHER, - }) + const content = await foundry.applications.handlebars.renderTemplate( + "systems/fvtt-hamalron/templates/chat-tension.hbs", + { cssClass: "fvtt-hamalron tension-roll", icon: "fa-bolt", label: game.i18n.localize("HAMALRON.Label.sousTension"), + joueurName: actorName, joueurScore: totalJoueur, mjCard: `${card.name} (${valeurMJ})`, mjScore: valeurMJ, + isSuccess: success, isMJ: totalJoueur < valeurMJ, isSousTension: true }) + ChatMessage.create({ content, style: CONST.CHAT_MESSAGE_STYLES.OTHER }) }) $(document).on("click", "[data-action='oppose']", async function () { @@ -356,12 +355,12 @@ $(document).on("click", "[data-action='oppose']", async function () { await deckManager.saveDeckState() const success = totalJoueur >= valeurOpposant - ChatMessage.create({ - content: `

${game.i18n.localize("HAMALRON.Label.oppose")}

-

${actorName}: ${totalJoueur} vs Opposant: ${card.name} (${valeurOpposant})

-

${success ? game.i18n.localize("HAMALRON.Label.success") : game.i18n.localize("HAMALRON.Label.failure")}

`, - style: CONST.CHAT_MESSAGE_STYLES.OTHER, - }) + const content = await foundry.applications.handlebars.renderTemplate( + "systems/fvtt-hamalron/templates/chat-tension.hbs", + { cssClass: "fvtt-hamalron tension-roll", icon: "fa-shield-halved", label: game.i18n.localize("HAMALRON.Label.oppose"), + joueurName: actorName, joueurScore: totalJoueur, mjCard: `${card.name} (${valeurOpposant})`, mjScore: valeurOpposant, + isSuccess: success, isMJ: totalJoueur < valeurOpposant, isSousTension: false }) + ChatMessage.create({ content, style: CONST.CHAT_MESSAGE_STYLES.OTHER }) }) Hooks.on("hotbarDrop", (bar, data, slot) => { diff --git a/packs-system/hamalron-items/CURRENT b/packs-system/hamalron-items/CURRENT index 1a84852..f7753e2 100644 --- a/packs-system/hamalron-items/CURRENT +++ b/packs-system/hamalron-items/CURRENT @@ -1 +1 @@ -MANIFEST-000002 +MANIFEST-000006 diff --git a/packs-system/hamalron-items/MANIFEST-000002 b/packs-system/hamalron-items/MANIFEST-000002 deleted file mode 100644 index bd79a2869e4acc5375e4635072a219c699aa49cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 129 zcmWIhx#Ncn10$nUPHI_dPD+xVQ)NkNd1i5{bAE0?Vo_pAe$kRS-TOEg7@3$k8JJmE z7dDXB%piirj&z>txV0SqJ*GfPr)ixo=}i}Fk2 L4a_YV{UH(nvGpM9 diff --git a/packs-system/hamalron-items/MANIFEST-000006 b/packs-system/hamalron-items/MANIFEST-000006 new file mode 100644 index 0000000000000000000000000000000000000000..29fd216addf0d0df2399855e3d96f2ae923ccd7c GIT binary patch literal 114 zcmXRqU$rlWfss)vC$%g!CnZVGsj?)sJhM2}IX|}`u_&=5zlfcQ^@fh3Vp@JqN@`KD yVxj>GFl1z800Rld%#zgHV#SigqWqG019J;Te~84alI6`D42(?doD9qyEdBu0nH`@1 literal 0 HcmV?d00001 diff --git a/styles/chat.less b/styles/chat.less index 01f9a75..4c37db6 100644 --- a/styles/chat.less +++ b/styles/chat.less @@ -788,6 +788,85 @@ } } +.tension-roll { + background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); + border: 1px solid #e94560; + border-radius: 8px; + overflow: hidden; + + .tension-header { + text-align: center; + padding: 6px; + background: rgba(233, 69, 96, 0.15); + border-bottom: 1px solid rgba(233, 69, 96, 0.3); + + .tension-badge { + color: #e94560; + font-size: 13px; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 2px; + display: flex; + align-items: center; + justify-content: center; + gap: 6px; + } + } + + .tension-players { + display: flex; + align-items: center; + justify-content: space-around; + padding: 12px 8px; + + .tension-side { + text-align: center; + + .tension-side-label { + font-size: 11px; + color: #888; + text-transform: uppercase; + letter-spacing: 1px; + margin-bottom: 4px; + } + + .tension-side-value { + font-size: 28px; + font-weight: 700; + color: #f0e6d3; + } + + .tension-side-name { + font-size: 11px; + color: #aaa; + margin-top: 2px; + } + + &.tension-winner .tension-side-value { + color: #4caf50; + } + } + + .tension-vs { + font-size: 14px; + font-weight: 700; + color: #e94560; + opacity: 0.7; + } + } + + .tension-result { + text-align: center; + padding: 6px; + font-size: 13px; + font-weight: 600; + border-top: 1px solid rgba(233, 69, 96, 0.2); + + &.result-success { background: rgba(76, 175, 80, 0.15); color: #4caf50; } + &.result-failure { background: rgba(244, 67, 54, 0.15); color: #f44336; } + } +} + .initiative-roll { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); border: 1px solid #e94560; diff --git a/templates/chat-tension.hbs b/templates/chat-tension.hbs new file mode 100644 index 0000000..7edcb4d --- /dev/null +++ b/templates/chat-tension.hbs @@ -0,0 +1,27 @@ +
+
+
+ + {{label}} +
+
+ +
+
+
{{localize "HAMALRON.Label.player"}}
+
{{joueurScore}}
+
{{joueurName}}
+
+
VS
+
+
{{localize "HAMALRON.Label.gm"}}
+
{{mjScore}}
+
{{mjCard}}
+
+
+ +
+ + {{#if isSuccess}}{{localize "HAMALRON.Label.success"}}{{else}}{{localize "HAMALRON.Label.failure"}}{{/if}} +
+