ENhance and fix

This commit is contained in:
2026-05-10 23:12:21 +02:00
parent e200b5f7b0
commit 7542890232
43 changed files with 638 additions and 390 deletions
+14 -1
View File
@@ -6,7 +6,7 @@ export class MigrationL5r5e {
* Minimum Version needed for migration stuff to trigger
* @type {string}
*/
static NEEDED_VERSION = "1.13.0";
static NEEDED_VERSION = "14.0.1";
/**
* Return true if the version need some updates
@@ -56,6 +56,19 @@ export class MigrationL5r5e {
console.error(err);
}
// ***** 14.0.1: Remove obsolete etat items *****
if (options?.force || MigrationL5r5e.needUpdate("14.0.1")) {
try {
const etatIds = actor.items.filter((i) => i.type === "etat").map((i) => i.id);
if (etatIds.length) {
console.log(`L5R5E | Migration | Removing ${etatIds.length} etat item(s) from Actor ${actor.name}`);
await actor.deleteEmbeddedDocuments("Item", etatIds);
}
} catch (err) {
console.error(`L5R5E | Migration | Failed to remove etat items from Actor ${actor.name}: ${err.message}`);
}
}
// Migrate Actor's Items
if (actor.items.size) {
console.group(`Checking within ${actor.items.size} items`);