diff --git a/src/utils/core.js b/src/utils/core.js index 8c24c27..1aa7c3c 100644 --- a/src/utils/core.js +++ b/src/utils/core.js @@ -140,7 +140,7 @@ export class CoreUtility { } const actorImage = (actor.img && !actor.img.includes("*")) ? actor.img : null; - const tokenImage = actor.prototypeToken?.texture?.src ? actor.prototypeToken.texture.src : null; + const tokenImage = actor.prototypeToken?.randomImg ? (actor.token?.texture?.src ?? null) : (actor.prototypeToken?.texture?.src ?? null); switch(SettingsUtility.getSettingValue(SETTING_NAMES.DEFAULT_ROLL_ART)) { case "actor": diff --git a/src/utils/hooks.js b/src/utils/hooks.js index 050df88..5a632d0 100644 --- a/src/utils/hooks.js +++ b/src/utils/hooks.js @@ -97,7 +97,7 @@ export class HooksUtility { Hooks.on(HOOKS_DND5E.USE_ITEM, (item, config, options) => { if (!options?.ignore) { - RollUtility.rollItem(item, { ...config, ...options }); + RollUtility.rollItem(item, foundry.utils.mergeObject(config, options, { recursive: false })); } }); } diff --git a/src/utils/item.js b/src/utils/item.js index 148362a..4fb81b8 100644 --- a/src/utils/item.js +++ b/src/utils/item.js @@ -409,7 +409,9 @@ function _addFieldDamageButton(fields, item) { * @param {Item} item The item from which to derive the field. * @private */ - function _addFieldEffectsButton(fields, item, params) { + function _addFieldEffectsButton(fields, item, params) { + ItemUtility.ensurePropertiesOnItem(item); + if (item.hasEffects) { if (!Object.values(params.effectFlags).some(f => f === true)) { return; diff --git a/src/utils/roll.js b/src/utils/roll.js index cd898da..b1d7b82 100644 --- a/src/utils/roll.js +++ b/src/utils/roll.js @@ -81,9 +81,11 @@ export class RollUtility { return await wrapper.call(caller, {}, { ignore: true }); } - const isAltRoll = CoreUtility.eventToAltRoll(options?.event); const advMode = CoreUtility.eventToAdvantage(options?.event); - const config = ItemUtility.getRollConfigFromItem(caller, isAltRoll) + const isAltRoll = CoreUtility.eventToAltRoll(options?.event) || (options?.isAltRoll ?? false); + + const config = foundry.utils.mergeObject(options, ItemUtility.getRollConfigFromItem(caller, isAltRoll), { recursive: false }); + const configureDialog = config?.configureDialog ?? (caller?.type === ITEM_TYPE.SPELL ? true : false); // Handle quantity when uses are not consumed // While the rest can be handled by Item._getUsageUpdates(), this one thing cannot @@ -101,7 +103,7 @@ export class RollUtility { } return await wrapper.call(caller, config, { - configureDialog: caller?.type === ITEM_TYPE.SPELL ? true : false, + configureDialog, createMessage: false, advMode, isAltRoll, @@ -129,7 +131,7 @@ export class RollUtility { const skill = CONFIG.DND5E.skills[skillId]; let title = CoreUtility.localize(skill.label); - title += SettingsUtility.getSettingValue(SETTING_NAMES.SHOW_SKILL_ABILITIES) ? ` (${CONFIG.DND5E.abilities[skill.ability]})` : ""; + title += SettingsUtility.getSettingValue(SETTING_NAMES.SHOW_SKILL_ABILITIES) ? ` (${CONFIG.DND5E.abilities[actor.system.skills[skillId].ability]})` : ""; return await _getActorRoll(actor, title, roll, ROLL_TYPE.SKILL, options); }