Continue work on updating identifier

This commit is contained in:
Carlos Fernandez 2026-05-01 22:09:21 -04:00
parent d2ec5283a0
commit 20f42e8a0d
12 changed files with 122 additions and 69 deletions

View file

@ -40,4 +40,27 @@ export default class SubclassSheet extends DHBaseItemSheet {
get relatedDocs() {
return this.document.system.features.map(x => x.item);
}
async _onDrop(event) {
event.stopPropagation();
const data = TextEditor.getDragEventData(event);
const item = await fromUuid(data.uuid);
const itemType = data.type === 'ActiveEffect' ? data.type : item.type;
if (itemType === 'class') {
const identifier = item.system.identifier;
if (!identifier) {
return ui.notifications.error(
game.i18n.localize('DAGGERHEART.UI.Notifications.classMissingIdentifier')
);
}
if (this.document.system.classLink.identifier !== identifier) {
const { img, name } = item;
await this.document.update({ 'system.classLink': { identifier, img, name } });
}
return;
}
return super._onDrop(event);
}
}