[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

@ -102,26 +102,11 @@ export default class DHClass extends BaseDataItem {
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.value' : 'class.value'}`;
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' : 'class'}`;
options.parent.update({
[`${path}.value`]: null
});
foundry.utils.getProperty(options.parent, `${path}.subclass`)?.delete();
}
}