This commit is contained in:
WBHarry 2025-11-16 02:43:18 +01:00
parent 481ce46edf
commit 496de55a27
3 changed files with 37 additions and 23 deletions

View file

@ -9,7 +9,8 @@ export default class BeastformEffect extends BaseEffect {
tokenImg: new fields.FilePathField({
categories: ['IMAGE'],
base64: false,
nullable: true
nullable: true,
wildcard: true
}),
tokenRingImg: new fields.FilePathField({
initial: 'icons/svg/mystery-man.svg',
@ -38,9 +39,12 @@ export default class BeastformEffect extends BaseEffect {
async _preDelete() {
if (this.parent.parent.type === 'character') {
const update = {
const baseUpdate = {
height: this.characterTokenData.tokenSize.height,
width: this.characterTokenData.tokenSize.width,
width: this.characterTokenData.tokenSize.width
};
const update = {
...baseUpdate,
texture: {
src: this.characterTokenData.tokenImg
},
@ -51,7 +55,20 @@ export default class BeastformEffect extends BaseEffect {
}
};
await updateActorTokens(this.parent.parent, update);
const updateToken = token => ({
...baseUpdate,
'texture': {
src: token.flags.daggerheart.beastformTokenImg
},
'ring': {
subject: {
texture: token.flags.daggerheart.beastformSubjectTexture
}
},
'flags.daggerheart': { '-=beastformTokenImg': null, '-=beastformSubjectTexture': null }
});
await updateActorTokens(this.parent.parent, update, updateToken);
await this.parent.parent.deleteEmbeddedDocuments('Item', this.featureIds);
await this.parent.parent.deleteEmbeddedDocuments('ActiveEffect', this.effectIds);