diff --git a/module/apps/rdd-import-stats.js b/module/apps/rdd-import-stats.js index 8efa0b5d..63209789 100644 --- a/module/apps/rdd-import-stats.js +++ b/module/apps/rdd-import-stats.js @@ -106,6 +106,12 @@ export class RdDStatBlockParser { return "vaisseau"; } + static fixCompName(name) { + name = name.replace("Voie d'", ""); + name = name.replace("Voie de ", ""); + return name + } + static async parseStatBlock(statString) { //statString = statBlock03; @@ -152,7 +158,8 @@ export class RdDStatBlockParser { const competences = await SystemCompendiums.getCompetences(type); //console.log("Competences : ", competences); for (let comp of competences) { - let compMatch = XRegExp.exec(statString, XRegExp(comp.name + compParser[type], 'giu')); + let compNameToSearch = RdDStatBlockParser.fixCompName(comp.name) + let compMatch = XRegExp.exec(statString, XRegExp(compNameToSearch + compParser[type], 'giu')); if (compMatch) { comp = comp.toObject() comp.system.niveau = Number(compMatch.value); @@ -380,7 +387,7 @@ export class RdDStatBlockParser { case "personnage": // Check if ',né le' is present let namePersonnage = "Importé" - if (statString.match(/,\\s+né/)) { + if ( statString.includes(", né") ) { // Name is all string before first comma ',' namePersonnage = XRegExp.exec(statString, XRegExp("(?[\\p{Letter}\\s\\d]+),", 'giu')); } else {