Add spells rolls and enhance CSS styling
This commit is contained in:
+21
-2
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user