Corrections sur commande /tirage
This commit is contained in:
@@ -7,7 +7,7 @@ export class MaleficesUtility {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async init() {
|
static async init() {
|
||||||
Hooks.on('renderChatLog', (log, html, data) => MaleficesUtility.chatListeners(html));
|
Hooks.on('renderChatMessageHTML', (message, html) => MaleficesUtility.chatListeners(message, html));
|
||||||
|
|
||||||
this.rollDataStore = {}
|
this.rollDataStore = {}
|
||||||
this.defenderStore = {}
|
this.defenderStore = {}
|
||||||
@@ -105,29 +105,32 @@ export class MaleficesUtility {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static drawDeckCard(msgId) {
|
static drawDeckCard(msgId) {
|
||||||
if (game.user.isGM) {
|
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 {
|
} else {
|
||||||
game.socket.emit("system.fvtt-malefices", { name: "msg-draw-card", data: { msgId: msgId } })
|
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 => {
|
html.querySelector('.roll-destin')?.addEventListener('click', () => {
|
||||||
let messageId = MaleficesUtility.findChatMessageId(event.currentTarget)
|
const rollData = message.getFlag("world", "rolldata")
|
||||||
let message = game.messages.get(messageId)
|
const actor = MaleficesUtility.getActorFromRollData(rollData)
|
||||||
let rollData = message.getFlag("world", "rolldata")
|
|
||||||
let actor = this.getActorFromRollData(rollData)
|
|
||||||
actor.incDecDestin(-1)
|
actor.incDecDestin(-1)
|
||||||
rollData.isReroll = true
|
rollData.isReroll = true
|
||||||
this.rollMalefices(rollData)
|
MaleficesUtility.rollMalefices(rollData)
|
||||||
})
|
|
||||||
$(html).on("click", '.draw-tarot-card', event => {
|
|
||||||
let messageId = MaleficesUtility.findChatMessageId(event.currentTarget)
|
|
||||||
this.drawDeckCard(messageId)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
html.querySelector('.draw-tarot-card')?.addEventListener('click', () => {
|
||||||
|
MaleficesUtility.drawDeckCard(message.id)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|||||||
0
packs/malefices-archetypes/000074.log
Normal file
0
packs/malefices-archetypes/000074.log
Normal file
Binary file not shown.
0
packs/malefices-armes/000074.log
Normal file
0
packs/malefices-armes/000074.log
Normal file
Binary file not shown.
0
packs/malefices-macros/000074.log
Normal file
0
packs/malefices-macros/000074.log
Normal file
Binary file not shown.
0
packs/malefices-tarots/000074.log
Normal file
0
packs/malefices-tarots/000074.log
Normal file
Binary file not shown.
Reference in New Issue
Block a user