[Fix] 940 Character Import (#962)

* Changed Class/Multiclass to simple getters to avoid having to keep them up to date

* Corrected variable
This commit is contained in:
WBHarry 2025-08-16 01:56:17 +02:00 committed by GitHub
parent 0e43bf197d
commit ab76d9e91d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 27 additions and 50 deletions

View file

@ -88,24 +88,4 @@ export default class DHSubclass extends BaseDataItem {
const allowed = await super._preCreate(data, options, user);
if (allowed === false) return;
}
_onCreate(data, options, userId) {
super._onCreate(data, options, userId);
if (userId !== game.user.id) return;
if (options.parent?.type === 'character') {
const path = `system.${data.system.isMulticlass ? 'multiclass.subclass' : 'class.subclass'}`;
options.parent.update({ [path]: `${options.parent.uuid}.Item.${data._id}` });
}
}
_onDelete(options, userId) {
super._onDelete(options, userId);
if (options.parent?.type === 'character') {
const path = `system.${this.isMulticlass ? 'multiclass.subclass' : 'class.subclass'}`;
options.parent.update({ [path]: null });
}
}
}