Add spells rolls and enhance CSS styling

This commit is contained in:
2026-01-12 10:45:20 +01:00
parent e75824cd20
commit 0bc6b43ffe
29 changed files with 2428 additions and 878 deletions
+21 -2
View File
@@ -171,15 +171,19 @@ if (foundry.utils.isNewerVersion(game.version, "12.0",)) {
}
Hooks.on(hookName, (message, html, data) => {
const typeMessage = data.message.flags.prismRPG?.typeMessage
// Convertir html en jQuery pour compatibilité avec le code existant si nécessaire
const $html = html instanceof jQuery ? html : $(html)
// Message de demande de jet de dés
if (typeMessage === "askRoll") {
// Affichage des boutons de jet de dés uniquement pour les joueurs
if (game.user.isGM) {
html.find(".ask-roll-dice").each((i, btn) => {
$html.find(".ask-roll-dice").each((i, btn) => {
btn.style.display = "none"
})
} else {
html.find(".ask-roll-dice").click((event) => {
$html.find(".ask-roll-dice").click((event) => {
const btn = $(event.currentTarget)
const type = btn.data("type")
const value = btn.data("value")
@@ -190,6 +194,21 @@ Hooks.on(hookName, (message, html, data) => {
})
}
}
// Handle Roll Damage button click in weapon attack messages
$html.find(".roll-damage-button").click(async (event) => {
const btn = event.currentTarget
const actorId = btn.dataset.actorId
const weaponId = btn.dataset.weaponId
const actor = game.actors.get(actorId)
if (!actor) {
ui.notifications.error("Actor not found")
return
}
await actor.prepareRoll("weapon-damage-medium", weaponId)
})
})
Hooks.on("getCombatTrackerEntryContext", (html, options) => {