Skip to content

Commit

Permalink
feat(resolver): prefer "name" over "lid" during resolution
Browse files Browse the repository at this point in the history
This allows the name of a renamed item to take precedence over its
user-invisible LID. This allows a user to copy and customize an existing
item.
  • Loading branch information
cirrahn committed Aug 2, 2024
1 parent b6ee292 commit 8e466a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/effectResolver/effectResolverCustom.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ export const getCustomMacroUuid = ({ actorUuid, itemLid, itemName = null }) => {
const customState = game.settings.get(MODULE_ID, SETTING_EFFECTS_MANAGER_STATE);
if (!Object.keys(customState?.effects || {}).length) return null;

const byLid = _getCustomMacroUuidByItemLid({ actorUuid, itemLid, customState });
if (byLid) return byLid;

// Resolve by name first. This allows the name of a renamed item to take precedence over its user-invisible LID.
const byName = _getCustomMacroUuidByItemName({ actorUuid, itemName, customState });
if (byName) return byName;

const byLid = _getCustomMacroUuidByItemLid({ actorUuid, itemLid, customState });
if (byLid) return byLid;

return null;
};

0 comments on commit 8e466a5

Please sign in to comment.