Parser: demi-rêve/valeurs actuelles/remise à neuf

This commit is contained in:
Vincent Vandemeulebrouck 2024-12-04 00:57:39 +01:00
parent bf0eea693a
commit 417db33752

View File

@ -216,22 +216,21 @@ export class RdDStatBlockParser {
if (type == "personnage") { if (type == "personnage") {
// Attemp to detect spell
await RdDStatBlockParser.parseHautReve(statString, items); await RdDStatBlockParser.parseHautReve(statString, items);
RdDStatBlockParser.parsePersonnage(statString, actorData); RdDStatBlockParser.parsePersonnage(statString, actorData);
} }
let name = RdDStatBlockParser.extractName(type, statString); 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.... // DUmp....
console.log(actorData); console.log(actorData);
} }
static async parseHautReve(statString, items) { static async parseHautReve(statString, items) {
let hautRevant = false; let hautRevant = false;
// Attemp to detect spell
let sorts = await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-oniros"); 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-hypnos"));
sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-narcos")); sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-narcos"));
@ -255,45 +254,53 @@ export class RdDStatBlockParser {
if (donHR) { if (donHR) {
items.push(donHR.toObject()); 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) { 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'; actorData.sexe = (feminin?.value == 'e') ? 'féminin' : 'masculin';
// Get hour name : heure du XXXXX // 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"); actorData.heure = this.getHeureKey(heure?.value || "Vaisseau");
// Get age // 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) { if (age?.value) {
actorData.age = Number(age.value); actorData.age = Number(age.value);
} }
// Get height // 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) { if (taille?.value) {
actorData.taille = taille.value; actorData.taille = taille.value;
} }
// Get weight // 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) { if (poids?.value) {
actorData.poids = poids.value; actorData.poids = poids.value;
} }
// Get cheveux // 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) { if (cheveux?.value) {
actorData.cheveux = cheveux.value; actorData.cheveux = cheveux.value;
} }
// Get yeux // 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) { if (yeux?.value) {
actorData.yeux = yeux.value; actorData.yeux = yeux.value;
} }
// Get beauty // 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) { if (beaute?.value) {
actorData.beaute = Number(beaute.value); actorData.beaute = Number(beaute.value);
} }