Better import of NPC

This commit is contained in:
sladecraven 2020-11-10 15:01:06 +01:00
parent 52cc1bed49
commit 0210b37371
6 changed files with 47 additions and 7 deletions

View File

@ -354,6 +354,10 @@ const __add_actors_translation = ( ) => {
"characteristics": {
"path": "data.characteristics",
"converter": "npc_characteristics"
},
"details": {
"path": "data.details",
"converter": "npc_details"
}
},
"entries": [

View File

@ -156,7 +156,7 @@ Hooks.once('init', () => {
Babele.get().registerConverters({
"career_skills": (skills_list) => {
var compendium = game.packs.find(p => p.collection === compmod+'.skills');
console.log( "Thru here ...", compendium, skills_list);
//console.log( "Thru here ...", compendium, skills_list);
if ( skills_list ) {
var i;
var len = skills_list.length;
@ -187,6 +187,14 @@ Hooks.once('init', () => {
}
return skills_list;
},
"npc_details": (details) => {
//console.log("DETAILS: ", details);
let newDetails = duplicate(details);
newDetails.species.value = game.i18n.localize(details.species.value);
newDetails.gender.value = game.i18n.localize(details.gender.value);
newDetails.class.value = game.i18n.localize(details.class.value);
return newDetails;
},
"career_talents": (talents_list) => {
var compendium = game.packs.find(p => p.collection === compmod+'.talents');
var i;
@ -331,8 +339,9 @@ Hooks.once('init', () => {
}
} else if ( trait_en.type == "career") {
var career_fr = fullcareers.translate( trait_en );
//console.log(">>>>> Career ?", name_en, career_fr.name);
trait_en = career_fr;
console.log(">>>>> Career ?", name_en, career_fr.name );
trait_en.name = career_fr.name;
trait_en.data = duplicate(career_fr.data);
} else if ( trait_en.type == "trapping" || trait_en.type == "weapon" || trait_en.type == "armour" || trait_en.type == "container" || trait_en.type == "money") {
var trapping_fr = fulltrappings.translate( trait_en );
//console.log(">>>>> Trapping ?", name_en, trapping_fr.name);

View File

@ -170,6 +170,7 @@
"Magic": "Magie",
"Religion": "Religion",
"Trappings": "Equipement",
"Trapping": "Equipement",
"Notes": "Notes",
"Income" : "Revenu",
"Wounds" : "Blessures",
@ -1169,6 +1170,8 @@
"Broken": "Dressé",
"Home": "Revenir à la maison",
"Male": "Homme",
"Female": "Femme",
"TRAVEL.TravelMessageBase": "De <b>{from}</b> à <b>{to}</b> : ",
"TRAVEL.TravelMessageRoad": "<br><b>Route</b> : {road_distance} km<br>&nbsp;&nbsp;En chariot : {road_days} jours, danger {road_danger_string}<br>&nbsp;&nbsp;A Cheval : {road_horse_heavy_days} jours, danger {road_danger_string}<br>&nbsp;&nbsp;A Cheval (Rapide) : {road_horse_fast_days} jours, danger {road_danger_string}<br>&nbsp;&nbsp;A Pied : {road_feet_days} jours, danger {road_danger_feet_string}",

View File

@ -3,9 +3,9 @@
"name": "WH4-fr-translation",
"title": "Traduction du module WH4 en Français.",
"description": "La traduction du module WH4.",
"version": "1.3.20",
"version": "1.3.21",
"minimumCoreVersion" : "0.6.6",
"compatibleCoreVersion": "1.0.0",
"compatibleCoreVersion": "0.7.6",
"author": "LeRatierBretonnien",
"dependencies": [
{

View File

@ -33,11 +33,11 @@ import "./xregexp-all.js";
const us_carac = 'm\\s+ws\\s+bs\\s+s\\s+t\\s+i\\s+agi?\\s+dex\\s+int\\s+\\wp\\s+fel\\s+w';
const fr_carac = 'm\\s+ws\\s+bs\\s+s\\s+t\\s+i\\s+agi?\\s+dex\\s+int\\s+\\wp\\s+fel\\s+w';
const carac_val = '(?<m>[0-9-]+)\\s+(?<ws>[0-9-]+)\\s+(?<bs>[0-9-]+)\\s+(?<s>[0-9-]+)\\s+(?<t>[0-9-]+)\\s+(?<i>[0-9-]+)\\s+(?<ag>[0-9-]+)\\s+(?<dex>[0-9-]+)\\s+(?<int>[0-9-]+)\\s+(?<wp>[0-9-]+)\\s+(?<fel>[0-9-]+)\\s+(?<w>[0-9-]+)';
const name_val = '(?<name>[a-z\\s\\-,]*)[\\s\\r\\n]*(?<tiers>.*|[\\(\\)a-z0-9]+)';
const name_val = '(?<name>[a-zA-Z\\s\\-,]*)[\\s\\r\\na-zA-Z]*(?<tiers>.*|[\\(\\)a-z0-9]+)';
let sectionData = [
{ name: "trait", toFind:"Traits\\s*:", secondParse: '(?<name>[a-z\\s]*)[\\s\\+]*(?<value>.*|[0-9]+)', index:-1 },
{ name: "skill", toFind:"Skills\\s*:", secondParse: '(?<name>[a-z\\s\\(\\)]*)[\\s\\+]*(?<value>.*|[0-9]+)', index:-1 },
{ name: "talent", toFind:"Talents\\s*:", secondParse: '(?<name>[a-z\\-\\s]*)[\\s\\+]*(?<value>.*|[0-9]+)', index:-1 },
{ name: "talent", toFind:"Talents\\s*:", secondParse: '(?<name>[a-z\\-\\s!]*)[\\s\\+]*(?<value>.*|[0-9]+)', index:-1 },
{ name: "trapping", toFind:"Trappings\\s*:", secondParse: '(?<name>[a-z\\s]*)[\\s\\+]*(?<value>.*|[0-9]+)', index:-1 }
];
let regSep = XRegExp('\\s*,\\s*', 'gi'); // Term separator, with auto trim

File diff suppressed because one or more lines are too long