From fbe551624dec89fdfc11d49e5f5576636d242759 Mon Sep 17 00:00:00 2001 From: psitacus Date: Fri, 11 Jul 2025 18:38:48 -0600 Subject: [PATCH] change flags --- module/applications/sheets/api/item-attachment-sheet.mjs | 0 module/config/flagsConfig.mjs | 2 ++ module/data/item/attachableItem.mjs | 0 module/helpers/attachmentHelper.mjs | 8 ++++---- 4 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 module/applications/sheets/api/item-attachment-sheet.mjs create mode 100644 module/data/item/attachableItem.mjs diff --git a/module/applications/sheets/api/item-attachment-sheet.mjs b/module/applications/sheets/api/item-attachment-sheet.mjs new file mode 100644 index 00000000..e69de29b diff --git a/module/config/flagsConfig.mjs b/module/config/flagsConfig.mjs index 252863f1..0c112231 100644 --- a/module/config/flagsConfig.mjs +++ b/module/config/flagsConfig.mjs @@ -7,3 +7,5 @@ export const encounterCountdown = { simple: 'countdown-encounter-simple', position: 'countdown-encounter-position' }; + +export const itemAttachmentSource = 'attachmentSource'; \ No newline at end of file diff --git a/module/data/item/attachableItem.mjs b/module/data/item/attachableItem.mjs new file mode 100644 index 00000000..e69de29b diff --git a/module/helpers/attachmentHelper.mjs b/module/helpers/attachmentHelper.mjs index c456d2e4..8f15c18b 100644 --- a/module/helpers/attachmentHelper.mjs +++ b/module/helpers/attachmentHelper.mjs @@ -32,9 +32,9 @@ export async function copyAttachmentEffectsToActor({ parentItem, attachedItem, a effectData.flags = { ...effectData.flags, - daggerheart: { - ...effectData.flags?.daggerheart, - attachmentSource + [CONFIG.DH.id]: { + ...effectData.flags?.[CONFIG.DH.id], + [CONFIG.DH.FLAGS.itemAttachmentSource]: attachmentSource } }; effectsToCreate.push(effectData); @@ -61,7 +61,7 @@ export async function removeAttachmentEffectsFromActor({ parentItem, attachedUui const parentUuidProperty = `${parentType}Uuid`; const effectsToRemove = actor.effects.filter(effect => { - const attachmentSource = effect.flags?.daggerheart?.attachmentSource; + const attachmentSource = effect.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.itemAttachmentSource); return attachmentSource && attachmentSource[parentUuidProperty] === parentItem.uuid && attachmentSource.itemUuid === attachedUuid;