Fix Traits translation

This commit is contained in:
2022-09-30 20:56:12 +02:00
parent be09aec8cd
commit f916c14848
5 changed files with 43 additions and 37 deletions

View File

@ -134,7 +134,7 @@ async function __findSkill(skillName, value = undefined) {
let spec = XRegExp.replace(skillSplit.specialized, "(", "");
spec = XRegExp.replace(spec, ")", "");
let skillSplit2 = XRegExp.exec(dbSkill.name, XRegExp(parseStr, 'gi'));
dbSkill.data.update( { name: skillSplit2.name + '(' + game.i18n.localize( spec.trim() ) + ')' } );
dbSkill.update( { name: skillSplit2.name + '(' + game.i18n.localize( spec.trim() ) + ')' } );
}
//game.babele.translate('wfrp4e-core.skills', dbSkill);
return dbSkill;
@ -169,7 +169,7 @@ async function __findTalent(talentName) {
if ( talentSplit.specialized ) {
let spec = XRegExp.replace(talentSplit.specialized, "(", "");
spec = XRegExp.replace(spec, ")", "");
dbTalent.data.update( { name: talentSplit.name + '(' + game.i18n.localize( spec.trim() ) + ')' } );
dbTalent.update( { name: talentSplit.name + '(' + game.i18n.localize( spec.trim() ) + ')' } );
}
return dbTalent;
}
@ -285,9 +285,9 @@ export default async function statParserFR(statString, type = "npc") {
if (itemFound && value && value.length > 0) {
if (name.toLowerCase() == 'weapon' || name.toLowerCase() == "bite" || name.toLowerCase() == "tail" ||
name.toLowerCase() == 'arme' || name.toLowerCase() == "morsure" || name.toLowerCase() == "queue") {
itemFound.data.specification.value = Number(value) - Math.floor( Number(model.characteristics.s.initial) / 10)
itemFound.system.specification.value = Number(value) - Math.floor( Number(model.characteristics.s.initial) / 10)
} else {
itemFound.data.specification.value = game.i18n.localize(value)
itemFound.system.specification.value = game.i18n.localize(value)
}
}
if (!itemFound)
@ -301,7 +301,7 @@ export default async function statParserFR(statString, type = "npc") {
if (itemFound)
itemFound = itemFound.toObject();
if (itemFound && subres && value) {
itemFound.data.advances.value = Number(value) - Number(model.characteristics[itemFound.data.characteristic.value].initial);
itemFound.system.advances.value = Number(value) - Number(model.characteristics[itemFound.system.characteristic.value].initial);
}
if (!itemFound)
ui.notifications.error("Compétence non trouvée, à ajouter manuellement : " + name, { permanent: true })
@ -313,7 +313,7 @@ export default async function statParserFR(statString, type = "npc") {
if (itemFound)
itemFound = itemFound.toObject();
if (itemFound && subres && value)
itemFound.data.advances.value = Number(value);
itemFound.system.advances.value = Number(value);
if (!itemFound)
ui.notifications.error("Talent non trouvé, à ajouter manuellement : " + name, { permanent: true })
} else if (def.name == 'trapping') {
@ -323,7 +323,7 @@ export default async function statParserFR(statString, type = "npc") {
catch { }
if (!itemFound && name) {
itemFound = new game.entities.ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: name, type: "trapping", data: game.system.model.Item.trapping })
itemFound.data.data.trappingType.value = "misc"
itemFound.system.trappingType.value = "misc"
}
if (itemFound)
itemFound = itemFound.toObject();
@ -342,13 +342,13 @@ export default async function statParserFR(statString, type = "npc") {
}
}
let moneyItems = await game.wfrp4e.utility.allMoneyItems() || [];
moneyItems = moneyItems.sort((a, b) => (a.data.coinValue.value > b.data.coinValue.value) ? -1 : 1);
moneyItems.forEach(m => m.data.quantity.value = 0)
moneyItems = moneyItems.sort((a, b) => (a.system.coinValue.value > b.system.coinValue.value) ? -1 : 1);
moneyItems.forEach(m => m.system.quantity.value = 0)
globalItemList = globalItemList.concat(moneyItems);
//console.log("My liste :", globalItemList);
let name = pnjName;
let effects = globalItemList.reduce((total, globItem) => total.concat(globItem.data.effects), [])
let effects = globalItemList.reduce((total, globItem) => total.concat(globItem.effects), [])
effects = effects.filter(e => !!e)
effects = effects.filter(e => e.transfer)