Amelioration parser : heures, cheveux, yeux et sorts
This commit is contained in:
parent
c0563efcfa
commit
bbfac286a6
@ -265,6 +265,15 @@ export class RdDStatBlockParser {
|
||||
|
||||
}
|
||||
|
||||
static getHeureKey(heure) {
|
||||
for (let h of game.system.rdd.config.heuresRdD) {
|
||||
if (h.label.toLowerCase() == heure.toLowerCase()) {
|
||||
return h.value;
|
||||
}
|
||||
}
|
||||
return "vaisseau";
|
||||
}
|
||||
|
||||
static async parseStatBlock(statString, type = "npc") {
|
||||
|
||||
//statString = statBlock03;
|
||||
@ -394,14 +403,36 @@ export class RdDStatBlockParser {
|
||||
}
|
||||
}
|
||||
|
||||
// Attemp to detect spell
|
||||
let hautRevant = false
|
||||
let sorts = await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-oniros")
|
||||
sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-hypnos"))
|
||||
sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-narcos"))
|
||||
sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-thanatos"))
|
||||
XRegExp.forEach(statString, XRegExp("[OHNT]\\s+(?<name>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)\\s+\\((?<case>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)\\)\\s+R(?<diff>[\\-\\d]+)\\s+r(?<reve>\\d+)", 'giu'),
|
||||
function (match, i) {
|
||||
let sortCompendium = sorts.find(s => Grammar.equalsInsensitive(s.name, match.name))
|
||||
if (sortCompendium) {
|
||||
hautRevant = true
|
||||
let sort = sortCompendium.toObject();
|
||||
items.push(sort);
|
||||
}
|
||||
});
|
||||
if (hautRevant) {
|
||||
let tetes = await SystemCompendiums.getWorldOrCompendiumItems("tete", "tetes-de-dragon-pour-tous-personnages")
|
||||
let donHR = tetes.find(t => Grammar.equalsInsensitive(t.name, "Don de Haut-Rêve"))
|
||||
if (donHR) {
|
||||
items.push(donHR.toObject());
|
||||
}
|
||||
}
|
||||
|
||||
let feminin = XRegExp.exec(statString, XRegExp("né(?<value>e?) à", 'giu'));
|
||||
actorData.sexe = (feminin?.value == 'e') ? 'féminin' : 'masculin'
|
||||
|
||||
// Get hour name : heure du XXXXX
|
||||
let heure = XRegExp.exec(statString, XRegExp("heure (du|de la|des|de l\')\\s*(?<value>[\\p{Letter}\s]+),", 'giu'));
|
||||
if (heure?.value) {
|
||||
actorData.heure = heure.value;
|
||||
}
|
||||
let heure = XRegExp.exec(statString, XRegExp("heure (du|de la|des|de l\')\\s*(?<value>[A-Za-zÀ-ÖØ-öø-ÿ\\s]+),", 'giu'));
|
||||
actorData.heure = this.getHeureKey(heure?.value || "Vaisseau");
|
||||
|
||||
// Get age
|
||||
let age = XRegExp.exec(statString, XRegExp("(?<value>\\d+) ans", 'giu'));
|
||||
if (age?.value) {
|
||||
@ -417,6 +448,17 @@ export class RdDStatBlockParser {
|
||||
if (poids?.value) {
|
||||
actorData.poids = poids.value;
|
||||
}
|
||||
// Get cheveux
|
||||
let cheveux = XRegExp.exec(statString, XRegExp("kg,\\s+(?<value>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+),\\s+yeux", 'giu'));
|
||||
if (cheveux?.value) {
|
||||
actorData.cheveux = cheveux.value;
|
||||
}
|
||||
// Get yeux
|
||||
let yeux = XRegExp.exec(statString, XRegExp("yeux\\s+(?<value>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+), Beau", 'giu'));
|
||||
if (yeux?.value) {
|
||||
actorData.yeux = yeux.value;
|
||||
}
|
||||
|
||||
// Get beauty
|
||||
let beaute = XRegExp.exec(statString, XRegExp("beauté\\s+(?<value>\\d+)", 'giu'));
|
||||
if (beaute?.value) {
|
||||
|
Loading…
Reference in New Issue
Block a user