Change token name too ;)

This commit is contained in:
Vlyan
2021-06-08 12:59:06 +02:00
parent 060701baba
commit e77d1358d5
2 changed files with 15 additions and 10 deletions

View File

@@ -2,9 +2,10 @@
## 1.3.1 - Scholar helper
- Added a Journal Compendium for School Curriculums.
- Fix for the "bought_at_rank" value when an Item was on dropped on a sheet.
- Fix for issue #23 "Token image does not save".
- Added Curriculums in description for Titles.
- Added English Compendiums for Field of Victory (thanks to mdosantos !).
- Fix for the "bought_at_rank" does not change according to the PC rank value when an Item is drop on a sheet.
- Fix for issue #23 "Token image does not save". Now we reflect the change on the token name/image only if it's a linked actor and if the token/sheet have the same values.
## 1.3.0 - Foundry 0.8 Compatibility
__! Be certain to carefully back up any critical user data before installing this update !__

View File

@@ -69,14 +69,18 @@ export class ActorL5r5e extends Actor {
data["_id"] = this.id;
}
// Update the token image if the sheet image changed, but only if they are the same and linked to actor
if (
data.img &&
this.data.img === this.data.token.img &&
this.data.img !== data.img &&
(data.token?.actorLink || (data.token?.actorLink === undefined && this.data.token.actorLink))
) {
data["token.img"] = data.img;
// Only on linked Actor
if (data.token?.actorLink || (data.token?.actorLink === undefined && this.data.token.actorLink)) {
// Update the token name/image if the sheet name/image changed, but only if they was previously the same
["name", "img"].forEach((fieldName) => {
if (
data[fieldName] &&
this.data[fieldName] === this.data.token[fieldName] &&
this.data[fieldName] !== data[fieldName]
) {
data["token." + fieldName] = data[fieldName];
}
});
}
// Now using updateDocuments