Fix import de creatures sans heure de naissance

This commit is contained in:
LeRatierBretonnien 2024-12-06 13:11:19 +01:00
parent 3cbd777e6a
commit 6479f00642

View File

@ -377,8 +377,14 @@ export class RdDStatBlockParser {
static extractName(actorType, statString) { static extractName(actorType, statString) {
switch (actorType) { switch (actorType) {
case "personnage": case "personnage":
// Name is all string before first comma ',' // Check if ',né le' is present
const namePersonnage = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\\s\\d]+),", 'giu')); let namePersonnage = "Importé"
if (statString.match(/, né le/)) {
// Name is all string before first comma ','
namePersonnage = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\\s\\d]+),", 'giu'));
} else {
namePersonnage = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\\s\\d]+)\\s+TAILLE", 'giu'));
}
if (namePersonnage?.value) { if (namePersonnage?.value) {
return Misc.upperFirst(namePersonnage?.value); return Misc.upperFirst(namePersonnage?.value);
} }