Various enhancements

This commit is contained in:
sladecraven 2020-11-08 13:53:15 +01:00
parent 318dd00042
commit 9bbf00cf9c
5 changed files with 46 additions and 11 deletions

View File

@ -152,7 +152,7 @@ Hooks.once('init', () => {
Babele.get().registerConverters({ Babele.get().registerConverters({
"career_skills": (skills_list) => { "career_skills": (skills_list) => {
var compendium = game.packs.find(p => p.collection === compmod+'.skills'); 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 ) { if ( skills_list ) {
var i; var i;
var len = skills_list.length; var len = skills_list.length;

View File

@ -1,5 +1,24 @@
{ {
"label": "UG - Carrières", "label": "UG - Carrières",
"mapping": {
"skills": {
"path": "data.skills",
"converter": "career_skills"
},
"talents": {
"path": "data.talents",
"converter": "career_talents"
},
"class": {
"path": "data.class.value",
"converter": "generic_localization"
},
"careergroup": {
"path": "data.careergroup.value",
"converter": "career_careergroup"
},
"trappings": "data.trappings"
},
"entries": [ "entries": [
{ {
"id": "Apprentice", "id": "Apprentice",

View File

@ -3,7 +3,7 @@
"name": "WH4-fr-translation", "name": "WH4-fr-translation",
"title": "Traduction du module WH4 en Français.", "title": "Traduction du module WH4 en Français.",
"description": "La traduction du module WH4.", "description": "La traduction du module WH4.",
"version": "1.3.16", "version": "1.3.17",
"minimumCoreVersion" : "0.6.6", "minimumCoreVersion" : "0.6.6",
"compatibleCoreVersion": "1.0.0", "compatibleCoreVersion": "1.0.0",
"author": "LeRatierBretonnien", "author": "LeRatierBretonnien",

View File

@ -152,7 +152,7 @@ const fr_carac = 'm\\s+ws\\s+bs\\s+s\\s+t\\s+i\\s+agi?\\s+dex\\s+int\\s+\\wp\\s+
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+(?<Soc>[0-9-]+)\\s+(?<W>[0-9-]+)'; 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+(?<Soc>[0-9-]+)\\s+(?<W>[0-9-]+)';
let sectionData = [ let sectionData = [
{ name: "trait", toFind:"Traits\\s*:", secondParse: '(?<name>[a-z\\s]*)[\\s\\+]*(?<value>.*|[0-9]+)', index:-1 }, { name: "trait", toFind:"Traits\\s*:", secondParse: '(?<name>[a-z\\s]*)[\\s\\+]*(?<value>.*|[0-9]+)', index:-1 },
{ name: "skill", toFind:"Skills\\s*:", index:-1 }, { name: "skill", toFind:"Skills\\s*:", secondParse: '(?<name>[a-z\\s]*)[\\s\\+]*(?<value>.*|[0-9]+)', index:-1 },
{ name: "talent", toFind:"Talents\\s*:", index:-1 }, { name: "talent", toFind:"Talents\\s*:", index:-1 },
{ name: "trapping", toFind:"Trappings\\s*:", index:-1 } { name: "trapping", toFind:"Trappings\\s*:", index:-1 }
]; ];
@ -199,17 +199,21 @@ Hooks.once('ready', () => {
let subres = XRegExp.exec( name, XRegExp(def.secondParse, 'gi') ); let subres = XRegExp.exec( name, XRegExp(def.secondParse, 'gi') );
console.log("Subres", subres); console.log("Subres", subres);
name = subres.name.trim(); name = subres.name.trim();
if ( def.name == 'trait') {
if ( subres.value.length > 0 ) { if ( subres.value.length > 0 ) {
if ( subres.value.substring(0, 1) == '(' ) if ( subres.value.substring(0, 1) == '(' )
name += ' ' + subres.value; name += ' ' + subres.value;
else else
name += ' (' + subres.value + ')'; name += ' (' + subres.value + ')';
} }
} else if ( def.name == 'skill') {
// TODO
}
} }
def.termList.push( { name: name, type: def.name, data: { description: { value: "" } } } ); def.termList.push( { name: name, type: def.name, data: { description: { value: "" } } } );
} }
let newlist = autoTranslateItems( def.termList ); def.itemList = autoTranslateItems( def.termList );
console.log(newlist); console.log(def.itemList);
} }
} }
} }

File diff suppressed because one or more lines are too long