feat: boutons d'accès rapide dans le tchat (Tarot, Actions, Sort)
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
This commit is contained in:
@@ -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 = `<i class="${icon}"></i> <span>${label}</span>`
|
||||||
|
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
|
// Store card info from initiative rolls for the chat hook
|
||||||
globalThis._initiativeCardMap = new Map()
|
globalThis._initiativeCardMap = new Map()
|
||||||
Hooks.on("createChatMessage", async (message, options, userId) => {
|
Hooks.on("createChatMessage", async (message, options, userId) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user