Skip to content

Commit

Permalink
Merge pull request #470 from MangoFVTT/develop
Browse files Browse the repository at this point in the history
release/3.1.4
  • Loading branch information
MangoFVTT authored Jul 31, 2024
2 parents fcd131b + f172eb5 commit a59d846
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/utils/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,23 +307,15 @@ async function _injectContent(message, type, html) {
html.find('.dice-tooltip').prepend(html.find('.dice-formula'));
break;
case ROLL_TYPE.ITEM:
const actions = html.find('.card-buttons');
if (!message.isContentVisible) {
return;
}

const actions = html.find('.card-buttons');

// Remove any redundant dice roll elements that were added forcefully by dnd5e system
html.find('.dice-roll').remove();

if (!CoreUtility.isVisible(message)) {
const ChatMessage5e = CONFIG.ChatMessage.documentClass;
const chatData = await (new Roll("0d0")).toMessage({}, {
rollMode: game.settings.get("core", "rollMode"),
create: false
});
const rollHTML = await new ChatMessage5e(chatData).getHTML();
html.parent().find('.message-header').replaceWith(rollHTML.find('.message-header'));
html.replaceWith(rollHTML.find('.message-content'));
return;
}

if (message.flags[MODULE_SHORT].hideSave) {
actions.find(`[data-action='${ROLL_TYPE.ABILITY_SAVE}']`).remove();
}
Expand Down

0 comments on commit a59d846

Please sign in to comment.