Fix actor import

This commit is contained in:
LeRatierBretonnien 2023-09-11 06:43:56 +02:00
parent 6918eaeb1b
commit 43d78c5c68

View File

@ -289,6 +289,7 @@ Hooks.once('init', () => {
console.log("No beast traits found here ...")
return beast_traits
}
//console.log("TRANS:", beast_traits)
for (let trait_en of beast_traits) {
let special = "";
let nbt = "";
@ -403,7 +404,7 @@ Hooks.once('init', () => {
}
if (trait_fr.name && (trait_fr.name == "Sprinter" || trait_fr.name != name_en)) { // Talent translated!
trait_en.name = trait_fr.name.trim() + special
if (trait_fr.system) { // Why ???
if (trait_fr.system?.description?.value) { // Why ???
trait_en.system.description.value = trait_fr.system.description.value;
}
}
@ -412,21 +413,23 @@ Hooks.once('init', () => {
if (game.system.version.match("7.")) {
compendiumCareers = 'wfrp4e-core.items'
}
let career_fr = game.babele.translate(compendiumCareers, trait_en, true);
career_fr.name = career_fr.name || trait_en.name
let career_fr = game.babele.translate(compendiumCareers, { name: name_en }, true);
trait_en.name = career_fr.name || trait_en.name
//console.log(">>>>> Career ?", career_fr.name );
trait_en.system = duplicate(career_fr.system);
if ( career_fr?.system) {
trait_en.system = duplicate(career_fr.system);
}
} else if (trait_en.type == "trapping" || trait_en.type == "weapon" || trait_en.type == "armour" || trait_en.type == "container" || trait_en.type == "money") {
let compendiumTrappings = 'wfrp4e-core.trappings' // Per default
if (game.system.version.match("7.")) {
compendiumTrappings = 'wfrp4e-core.items'
}
let trapping_fr = game.babele.translate(compendiumTrappings, trait_en, true);
let trapping_fr = game.babele.translate(compendiumTrappings, { name: name_en }, true);
//console.log(">>>>> Trapping ?", name_en, trapping_fr.name);
trapping_fr.name = trapping_fr.name || trait_en.name
if (trapping_fr.system) {
trait_en.system.description = trapping_fr.system.description;
trait_en.name = trapping_fr.name || trait_en.name
if (trapping_fr.system?.description?.value) {
trait_en.system.description.value = trapping_fr.system.description.value
}
}
}