From 6479f00642fd1834ea036a829010a8a6d0f75bfe Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Fri, 6 Dec 2024 13:11:19 +0100 Subject: [PATCH] Fix import de creatures sans heure de naissance --- module/apps/rdd-import-stats.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/module/apps/rdd-import-stats.js b/module/apps/rdd-import-stats.js index f40fe5e7..91ce0618 100644 --- a/module/apps/rdd-import-stats.js +++ b/module/apps/rdd-import-stats.js @@ -377,8 +377,14 @@ export class RdDStatBlockParser { static extractName(actorType, statString) { switch (actorType) { case "personnage": - // Name is all string before first comma ',' - const namePersonnage = XRegExp.exec(statString, XRegExp("(?[\\p{Letter}\\s\\d]+),", 'giu')); + // Check if ',né le' is present + let namePersonnage = "Importé" + if (statString.match(/, né le/)) { + // Name is all string before first comma ',' + namePersonnage = XRegExp.exec(statString, XRegExp("(?[\\p{Letter}\\s\\d]+),", 'giu')); + } else { + namePersonnage = XRegExp.exec(statString, XRegExp("(?[\\p{Letter}\\s\\d]+)\\s+TAILLE", 'giu')); + } if (namePersonnage?.value) { return Misc.upperFirst(namePersonnage?.value); }