12.0.29 - L'indexation d'Astrobazzarh #732

Merged
uberwald merged 6 commits from VincentVk/foundryvtt-reve-de-dragon:v11 into v11 2024-12-17 07:12:00 +01:00
Showing only changes of commit 1f564e0d89 - Show all commits

View File

@ -491,21 +491,27 @@ export class RdDStatBlockParser {
} }
static extractName(actorType, statString) { static extractName(actorType, statString) {
switch (actorType) { if (actorType == "personnage") {
case "personnage": // Check if ',né le' is present
// Check if ',né le' is present let namePersonnage = "Importé"
let namePersonnage = "Importé" if (statString.includes(", né")) {
if (statString.includes(", né")) { // Name is all string before first comma ','
// Name is all string before first comma ',' namePersonnage = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\\'\\-\\s\\d]+),", 'giu'));
namePersonnage = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\\'\\-\\s\\d]+),", 'giu')); } else {
} else { namePersonnage = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\\'\\-\\s\\d]+)\\s+TAILLE", 'giu'));
namePersonnage = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\\'\\-\\s\\d]+)\\s+TAILLE", 'giu')); }
} if (namePersonnage?.value) {
if (namePersonnage?.value) { return Misc.upperFirst(namePersonnage?.value.toLowerCase());
return Misc.upperFirst(namePersonnage?.value.toLowerCase()); }
}
} }
const name = XRegExp.exec(statString, XRegExp("(?<value>.+)\\s+taille", 'giu')); const name = XRegExp.exec(statString, XRegExp("(?<value>.+)\\s+taille", 'giu'));
if (actorType == "entite") {
if (!(name?.value)) {
const nameEntiteReve = XRegExp.exec(statString, XRegExp("(?<value>.+)\\s+rêve", 'giu'));
return Misc.upperFirst(nameEntiteReve?.value || "Importé");
}
}
return Misc.upperFirst(name?.value || "Importé"); return Misc.upperFirst(name?.value || "Importé");
} }