Skip to content

Commit

Permalink
fix: correctly set parent for items with stored data (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
akrigline committed Jan 28, 2022
1 parent 4defb20 commit 7068cfa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mre-dnd5e",
"title": "Minimal Rolling Enhancements for D&D5e",
"description": "Some minimalist enhancements to the core D&D5e rolling workflow. Attempts to stay as close to core as possible while improving convenience.",
"version": "3.2.0",
"version": "3.2.6",
"author": "Cole Schultz, Andrew Krigline",
"authors": [
{
Expand Down Expand Up @@ -41,7 +41,7 @@
}
],
"minimumCoreVersion": "0.8.9",
"compatibleCoreVersion": "9.232",
"compatibleCoreVersion": "9",
"url": "https://github.com/ElfFriend-DnD/FVTT-Minimal-Rolling-Enhancements-DND5E",
"manifest": "https://github.com/ElfFriend-DnD/FVTT-Minimal-Rolling-Enhancements-DND5E/releases/latest/download/module.json",
"download": "https://github.com/ElfFriend-DnD/FVTT-Minimal-Rolling-Enhancements-DND5E/releases/latest/download/module.zip",
Expand Down
7 changes: 5 additions & 2 deletions scripts/hooks/render-chat-log.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { MODULE_NAME } from "../const.mjs";

Hooks.on("renderChatLog", (app, html, data) => _handleRenderChatLog(html));
Hooks.on("renderChatPopout", (app, html, data) => _handleRenderChatLog(html));

Expand All @@ -18,12 +20,13 @@ function _handleRenderChatLog(html) {

// Get the Item from stored flag data or by the item ID on the Actor
const storedData = message.getFlag("dnd5e", "itemData");
const item = storedData ? new CONFIG.Item.documentClass(storedData, actor) : actor.items.get(card.dataset.itemId);
const item = storedData ? new CONFIG.Item.documentClass(storedData, {parent: actor}) : actor.items.get(card.dataset.itemId);
if ( !item ) {
return ui.notifications.error(game.i18n.format("DND5E.ActionWarningNoItem", {item: card.dataset.itemId, name: actor.name}))
}

const spellLevel = parseInt(card.dataset.spellLevel) || null;
const spellLevel = message.getFlag(MODULE_NAME, 'spellLevel') ?? parseInt(card.dataset.spellLevel) ?? null;

const formulaGroup = button.dataset.formulaGroup;
item.rollDamage({ event, spellLevel, formulaGroup });
});
Expand Down

0 comments on commit 7068cfa

Please sign in to comment.