Parser: demi-rêve/valeurs actuelles/remise à neuf
This commit is contained in:
parent
bf0eea693a
commit
417db33752
@ -216,22 +216,21 @@ export class RdDStatBlockParser {
|
||||
|
||||
|
||||
if (type == "personnage") {
|
||||
// Attemp to detect spell
|
||||
await RdDStatBlockParser.parseHautReve(statString, items);
|
||||
|
||||
RdDStatBlockParser.parsePersonnage(statString, actorData);
|
||||
}
|
||||
|
||||
let name = RdDStatBlockParser.extractName(type, statString);
|
||||
|
||||
let newActor = RdDBaseActorReve.create({ name, type: type, system: actorData, items });
|
||||
|
||||
let newActor = await RdDBaseActorReve.create({ name, type: type, system: actorData, items });
|
||||
await newActor.remiseANeuf()
|
||||
// DUmp....
|
||||
console.log(actorData);
|
||||
}
|
||||
|
||||
static async parseHautReve(statString, items) {
|
||||
let hautRevant = false;
|
||||
// Attemp to detect spell
|
||||
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"));
|
||||
@ -255,45 +254,53 @@ export class RdDStatBlockParser {
|
||||
if (donHR) {
|
||||
items.push(donHR.toObject());
|
||||
}
|
||||
|
||||
const demiReve = XRegExp.exec(statString, XRegExp("Demi-rêve\\s+(?<value>[A-M]\\d{1,2})", 'giu'))
|
||||
actorData.reve.tmrpos.coord = demiReve?.value ?? 'A1'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static parsePersonnage(statString, actorData) {
|
||||
let feminin = XRegExp.exec(statString, XRegExp("né(?<value>e?) à", 'giu'));
|
||||
actorData.reve.seuil.value = actorData.carac.reve.value
|
||||
|
||||
const reveActuel = XRegExp.exec(statString, XRegExp("Rêve actuel\\s+(?<value>\\d+)", 'giu'))
|
||||
actorData.reve.reve.value = reveActuel?.value ? Number(reveActuel.value) : actorData.reve.seuil.value
|
||||
|
||||
const 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>[A-Za-zÀ-ÖØ-öø-ÿ\\s]+),", 'giu'));
|
||||
const 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'));
|
||||
const age = XRegExp.exec(statString, XRegExp("(?<value>\\d+) ans", 'giu'));
|
||||
if (age?.value) {
|
||||
actorData.age = Number(age.value);
|
||||
}
|
||||
// Get height
|
||||
let taille = XRegExp.exec(statString, XRegExp("(?<value>\\d+m\\d+)", 'giu'));
|
||||
const taille = XRegExp.exec(statString, XRegExp("(?<value>\\d+m\\d+)", 'giu'));
|
||||
if (taille?.value) {
|
||||
actorData.taille = taille.value;
|
||||
}
|
||||
// Get weight
|
||||
let poids = XRegExp.exec(statString, XRegExp("(?<value>\\d+) kg", 'giu'));
|
||||
const poids = XRegExp.exec(statString, XRegExp("(?<value>\\d+) kg", 'giu'));
|
||||
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'));
|
||||
const 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'));
|
||||
const 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'));
|
||||
const beaute = XRegExp.exec(statString, XRegExp("beauté\\s+(?<value>\\d+)", 'giu'));
|
||||
if (beaute?.value) {
|
||||
actorData.beaute = Number(beaute.value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user