From d5772864b74244c67152ff705986917b8e86b301 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Fri, 10 Jul 2026 23:29:27 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20boutons=20d'acc=C3=A8s=20rapide=20dans?= =?UTF-8?q?=20le=20tchat=20(Tarot,=20Actions,=20Sort)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Barre d'outils ajoutée au-dessus de la zone de saisie du chat : - Tarot 🃏 : ouvre le gestionnaire de deck (GM only) - Actions 📋 : ouvre les actions complexes (GM only) - Sort 🪄 : lance un sort du personnage actif --- fvtt-hamalron.mjs | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/fvtt-hamalron.mjs b/fvtt-hamalron.mjs index 07387a0..fd2bc70 100644 --- a/fvtt-hamalron.mjs +++ b/fvtt-hamalron.mjs @@ -208,6 +208,48 @@ Hooks.on("getSceneControlButtons", (controls) => { } }) +// Add system buttons to the chat log +Hooks.on("renderChatLog", (chatLog, html) => { + const form = html[0]?.querySelector("#chat-form") + if (!form || form.querySelector(".hamalron-chat-tools")) return + + const tools = document.createElement("div") + tools.className = "hamalron-chat-tools" + tools.style.cssText = "display:flex;gap:4px;padding:4px 0;border-bottom:1px solid #333;margin-bottom:4px" + + const addBtn = (icon, label, title, onClick) => { + const btn = document.createElement("button") + btn.type = "button" + btn.style.cssText = "display:flex;align-items:center;gap:4px;padding:3px 8px;background:#2a2a4a;color:#e0e0e0;border:1px solid #555;border-radius:4px;cursor:pointer;font-size:11px" + btn.innerHTML = ` ${label}` + btn.title = title + btn.addEventListener("click", onClick) + btn.addEventListener("mouseenter", () => { btn.style.background = "#3a3a6a" }) + btn.addEventListener("mouseleave", () => { btn.style.background = "#2a2a4a" }) + tools.appendChild(btn) + } + + if (game.user.isGM) { + addBtn("fas fa-cards", "Tarot", game.i18n.localize("HAMALRON.TarotDeck.Title"), () => { + game.system.api.openTarotDeckManager() + }) + addBtn("fas fa-tasks", "Actions", game.i18n.localize("HAMALRON.ActionComplexe.Title"), () => { + game.system.api.openActionComplexe() + }) + } + addBtn("fas fa-wand-magic-sparkles", "Sort", "Lancer un sort", () => { + const actor = game.user?.character || game.actors?.find(a => a.type === "personnage") + if (actor) { + const spell = actor.items.find(i => i.type === "sortilege") + if (spell) { + import("./module/applications/sortilege-casting.mjs").then(m => m.default.prompt(spell, actor)) + } + } + }) + + form.parentNode.insertBefore(tools, form) +}) + // Store card info from initiative rolls for the chat hook globalThis._initiativeCardMap = new Map() Hooks.on("createChatMessage", async (message, options, userId) => {