First round of changes

This commit is contained in:
2026-04-23 14:27:33 +02:00
parent f72230dd39
commit abe35cb537
45 changed files with 1860 additions and 56 deletions

View File

@@ -309,6 +309,29 @@ export class MigrationL5r5e {
}
// ***** End of 1.3.0 *****
// ***** Start of 2.0.0 (Chiaroscuro) *****
if (options?.force || MigrationL5r5e.needUpdate("2.0.0")) {
// Migrate character skill ranks from numeric (1-5) to Chiaroscuro string enum.
// Rank 0 (unranked) stays as the number 0 — this is intentional: the template
// defaults to 0 (number) and JS coerces it correctly when keying into skillRanks.
if (actor.type === "character" && system.skills) {
const rankMap = { 1: "initie", 2: "expert", 3: "maitre", 4: "parangon1", 5: "parangon2" };
const groups = ["artisan", "martial", "scholar", "social", "trade"];
for (const group of groups) {
const groupSkills = system.skills[group];
if (!groupSkills) continue;
for (const [skillName, rank] of Object.entries(groupSkills)) {
const numRank = Number(rank);
// Only migrate non-zero numeric ranks; 0 is already valid as-is
if (numRank > 0 && rankMap[numRank]) {
updateData[`system.skills.${group}.${skillName}`] = rankMap[numRank];
}
}
}
}
}
// ***** End of 2.0.0 (Chiaroscuro) *****
return updateData;
}