Fix import de creatures sans heure de naissance
This commit is contained in:
parent
2a164f6a32
commit
81d826ee2e
@ -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("(?<value>[\\p{Letter}\\s\\d]+),", 'giu'));
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user