/** * This function is used to hook into the Chat Log context menu to add additional options to each message * These options make it easy to conveniently apply damage to controlled tokens based on the value of a Roll * * @param {HTMLElement} html The Chat Message being rendered * @param {Array} options The Array of Context Menu options * * @return {Array} The extended options Array including new context choices */ export const addChatMessageContextOptions = function(html, options) { let canApply = li => canvas.tokens.controlled.length && li.find(".dice-roll").length; options.push( { name: game.i18n.localize("ACKS.messages.applyDamage"), icon: '', condition: canApply, callback: li => applyChatCardDamage(li, 1) }, { name: game.i18n.localize("ACKS.messages.applyHealing"), icon: '', condition: canApply, callback: li => applyChatCardDamage(li, -1) }, { name: game.i18n.localize("ACKS.messages.applyHalf"), icon: '', condition: canApply, callback: li => applyChatCardDamage(li, 0.5) }, { name: game.i18n.localize("ACKS.messages.applyDouble"), icon: '', condition: canApply, callback: li => applyChatCardDamage(li, 2) } ); return options; }; /* -------------------------------------------- */ export const addChatMessageButtons = function(msg, html, data) { // Hide blind rolls let blindable = html.find('.blindable'); if (msg.data.blind && !game.user.isGM && blindable && blindable.data('blind') === true) { blindable.replaceWith("