Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c61179a790 |
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
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