Corrections sur commande /tirage
All checks were successful
Release Creation / build (release) Successful in 1m3s

This commit is contained in:
2026-04-24 21:05:02 +02:00
parent 956ed9e916
commit c61179a790
9 changed files with 16 additions and 13 deletions

View File

@@ -7,7 +7,7 @@ export class MaleficesUtility {
/* -------------------------------------------- */
static async init() {
Hooks.on('renderChatLog', (log, html, data) => MaleficesUtility.chatListeners(html));
Hooks.on('renderChatMessageHTML', (message, html) => MaleficesUtility.chatListeners(message, html));
this.rollDataStore = {}
this.defenderStore = {}
@@ -105,29 +105,32 @@ export class MaleficesUtility {
/* -------------------------------------------- */
static drawDeckCard(msgId) {
if (game.user.isGM) {
game.system.malefices.currentTirage.addCard(msgId)
const tirage = game.system.malefices.currentTirage
if (tirage) {
tirage.addCard(msgId)
} else {
ui.notifications.warn("Aucun tirage en cours.")
}
} else {
game.socket.emit("system.fvtt-malefices", { name: "msg-draw-card", data: { msgId: msgId } })
}
}
/* -------------------------------------------- */
static async chatListeners(html) {
static chatListeners(message, html) {
if (!html) return
$(html).on("click", '.roll-destin', event => {
let messageId = MaleficesUtility.findChatMessageId(event.currentTarget)
let message = game.messages.get(messageId)
let rollData = message.getFlag("world", "rolldata")
let actor = this.getActorFromRollData(rollData)
html.querySelector('.roll-destin')?.addEventListener('click', () => {
const rollData = message.getFlag("world", "rolldata")
const actor = MaleficesUtility.getActorFromRollData(rollData)
actor.incDecDestin(-1)
rollData.isReroll = true
this.rollMalefices(rollData)
})
$(html).on("click", '.draw-tarot-card', event => {
let messageId = MaleficesUtility.findChatMessageId(event.currentTarget)
this.drawDeckCard(messageId)
MaleficesUtility.rollMalefices(rollData)
})
html.querySelector('.draw-tarot-card')?.addEventListener('click', () => {
MaleficesUtility.drawDeckCard(message.id)
})
}
/* -------------------------------------------- */