|
|
|
@ -233,8 +233,34 @@ Hooks.once('init', () => {
|
|
|
|
|
}
|
|
|
|
|
return talents_list;
|
|
|
|
|
},
|
|
|
|
|
"bestiary_traits": (value) => {
|
|
|
|
|
console.log("Traits converter is calle d!!!!");
|
|
|
|
|
"bestiary_traits": (beast_traits, translations) => {
|
|
|
|
|
var compendium = game.packs.find(p => p.collection === 'wfrp4e.traits');
|
|
|
|
|
for (let trait_en of beast_traits)
|
|
|
|
|
{
|
|
|
|
|
var nbt = "";
|
|
|
|
|
var special = "";
|
|
|
|
|
var name_en = trait_en.name.trim(); // strip \r in some traits name
|
|
|
|
|
if ( name_en.includes("Tentacles") ) { // Process specific Tentacles case
|
|
|
|
|
var re = /(.d*)x Tentacles/i;
|
|
|
|
|
var res = re.exec( name_en );
|
|
|
|
|
nbt = res[1] + "x ";
|
|
|
|
|
name_en = "Tentacles";
|
|
|
|
|
} else if ( name_en.includes("(") && name_en.includes(")") ) { // Then process specific traits name with (xxxx) inside
|
|
|
|
|
var re = /(.*) \((.*)\)/i;
|
|
|
|
|
var res = re.exec( name_en );
|
|
|
|
|
name_en = res[1]; // Get the root traits name
|
|
|
|
|
special = " (" + res[2] + ")"; // And the special keyword
|
|
|
|
|
}
|
|
|
|
|
var trait_fr = compendium.translate( { name: name_en } );
|
|
|
|
|
//console.log(">>>>> Trait ?", name_en, nbt, trait_fr.name);
|
|
|
|
|
trait_en.name = nbt + trait_fr.name + special;
|
|
|
|
|
trait_en.data.description.value = trait_fr.data.description.value;
|
|
|
|
|
if ( isNaN(trait_en.data.specification.value) ) { // This is a string, so translate it
|
|
|
|
|
//console.log("Translating : ", trait_en.data.specification.value);
|
|
|
|
|
trait_en.data.specification.value = game.i18n.localize(trait_en.data.specification.value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return beast_traits;
|
|
|
|
|
},
|
|
|
|
|
// To avoid duplicateing class for all careers
|
|
|
|
|
"generic_localization": (value) => {
|
|
|
|
|