Traductions + fix v12

This commit is contained in:
2024-05-31 12:13:20 +02:00
parent 2ed5a36282
commit 90214619d6
62 changed files with 754 additions and 596 deletions

View File

@ -167,7 +167,7 @@ const __auto_patch_translation_journal_compendium = async (compmod) => {
compData.locked = false;
let translEntries = await compData.getContent();
for (let entryData of translEntries) {
let mydata = duplicate(entryData.data);
let mydata = foundry.utils.duplicate(entryData.data);
mydata.content = mydata.content.replace(/wfrp4e-content/g, compmod);
entryData.update(mydata);
}
@ -264,13 +264,13 @@ const __check_fix_wrong_modules = (chatFlag, patchFinished) => {
}
const __history = [
"Nouveautés 7.0.28: <ul><li>Traduction des items du Starter Set (Ashbury77)</li><li>Traduction des items du d'Archives of the Empire (Bimkiz)</li></ul>"
"Nouveautés 7.1.6: <ul><li>Traduction des acteurs de EiS et Middenheim grâce à Eltrys et Kyllian !</li></ul>"
]
/************************************************************************************/
const convertColumnToMulti = (table) => {
let columns = table.columns;
let newTable = duplicate(table)
let newTable = foundry.utils.duplicate(table)
delete newTable.columns;
newTable.rows = table.rows.map(i => { return { range: {} } })
@ -423,7 +423,7 @@ Hooks.once('ready', () => {
if ( !sorted[spell.data.data.lore.value]) {
sorted[spell.data.data.lore.value] = [];
}
sorted[spell.data.data.lore.value].push( duplicate(spell.data) );
sorted[spell.data.data.lore.value].push( foundry.utils.duplicate(spell.data) );
}
console.log("SORTED", sorted);
});*/

View File

@ -114,10 +114,10 @@ Hooks.once('init', () => {
}
game.wfrp4e.apps.StatBlockParser.parseStatBlock = async function (statString, type = "npc") {
console.log("PARSER FR DONE");
return statParserFR(statString, type);
}
console.log("WFRP4E-FR | Loading Babele translation module ...");
loadScripts();
/*---------------------------------------------------------------------*/
@ -307,7 +307,7 @@ Hooks.once('init', () => {
"npc_details": (details) => {
//console.log("DETAILS: ", details);
let newDetails = duplicate(details);
let newDetails = foundry.utils.duplicate(details);
if (details.species?.value)
newDetails.species.value = game.i18n.localize(details.species.value);
if (details.gender?.value)
@ -483,7 +483,7 @@ Hooks.once('init', () => {
if (career_fr?.system) {
trait_en.name = career_fr.name || trait_en.name
// DEBG: console.log(">>>>> Career ?", career_fr.name );
trait_en.system = duplicate(career_fr.system);
trait_en.system = foundry.utils.duplicate(career_fr.system);
break;
}
}
@ -527,7 +527,7 @@ Hooks.once('init', () => {
}
}
for (let i = 0; i < list.length; i++) {
newQF[i] = duplicate(list[i])
newQF[i] = foundry.utils.duplicate(list[i])
if (newQF[i].name == "Trap Blade") {
newQF[i].name = "TrapBlade"; // Auto-patch, without space!
//console.log("PATCHED", trim);

View File

@ -529,7 +529,7 @@ export default class ActorWfrp4e_fr extends Actor {
let title = game.i18n.localize("WeaponTest") + " - " + weapon.name;
// Prepare the weapon to have the complete data object, including qualities/flaws, damage value, etc.
let wep = this.prepareWeaponCombat(duplicate(weapon));
let wep = this.prepareWeaponCombat(foundry.utils.duplicate(weapon));
let testData = {
target: 0,
hitLocation: true,
@ -551,7 +551,7 @@ export default class ActorWfrp4e_fr extends Actor {
skillCharList.push(game.i18n.localize("Ballistic Skill"))
if (weapon.data.weaponGroup.value != "throwing" && weapon.data.weaponGroup.value != "explosives" && weapon.data.weaponGroup.value != "entangling") {
// Check to see if they have ammo if appropriate
testData.extra.ammo = duplicate(this.getEmbeddedEntity("OwnedItem", weapon.data.currentAmmo.value))
testData.extra.ammo = foundry.utils.duplicate(this.getEmbeddedEntity("OwnedItem", weapon.data.currentAmmo.value))
if (!testData.extra.ammo || weapon.data.currentAmmo.value == 0 || testData.extra.ammo.data.quantity.value == 0) {
AudioHelper.play({ src: "systems/wfrp4e/sounds/no.wav" }, false)
ui.notifications.error(game.i18n.localize("Error.NoAmmo"))
@ -1198,7 +1198,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
result.postFunction = "basicTest";
if (testData.extra)
mergeObject(result, testData.extra);
foundry.utils.mergeObject(result, testData.extra);
if (result.options.corruption) {
this.handleCorruptionResult(result);
@ -1382,7 +1382,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
// Find ingredient being used, if any
let ing = duplicate(this.getEmbeddedEntity("OwnedItem", testData.extra.spell.data.currentIng.value))
let ing = foundry.utils.duplicate(this.getEmbeddedEntity("OwnedItem", testData.extra.spell.data.currentIng.value))
if (ing) {
// Decrease ingredient quantity
testData.extra.ingredient = true;
@ -1433,7 +1433,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
result.postFunction = "channelTest";
// Find ingredient being used, if any
let ing = duplicate(this.getEmbeddedEntity("OwnedItem", testData.extra.spell.data.currentIng.value))
let ing = foundry.utils.duplicate(this.getEmbeddedEntity("OwnedItem", testData.extra.spell.data.currentIng.value))
if (ing) {
// Decrease ingredient quantity
testData.extra.ingredient = true;
@ -1527,7 +1527,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
} // If something went wrong calculating damage, do nothing and still render the card
if (testData.extra)
mergeObject(result, testData.extra);
foundry.utils.mergeObject(result, testData.extra);
try {
let contextAudio = await game.wfrp4e.audio.MatchContextAudio(game.wfrp4e.audio.FindContext(result))
@ -1573,9 +1573,9 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
* an actor. This function is called whenever the sheet is rendered.
*/
prepare() {
let preparedData = duplicate(this.data)
let preparedData = foundry.utils.duplicate(this.data)
// Call prepareItems first to organize and process OwnedItems
mergeObject(preparedData, this.prepareItems())
foundry.utils.mergeObject(preparedData, this.prepareItems())
// Add speciality functions for each Actor type
if (preparedData.type == "character")
@ -1602,7 +1602,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
*
*/
prepareItems() {
let actorData = duplicate(this.data)
let actorData = foundry.utils.duplicate(this.data)
// These containers are for the various different tabs
const careers = [];
const basicSkills = [];
@ -2817,7 +2817,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
*
*/
async addBasicSkills() {
let allItems = duplicate(this.data.items)
let allItems = foundry.utils.duplicate(this.data.items)
let ownedBasicSkills = allItems.filter(i => i.type == "skill" && i.data.advanced.value == "bsc");
let allBasicSkills = await game.wfrp4e.utility.allBasicSkills()
@ -3240,7 +3240,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
let existingSkill = this.data.items.find(i => i.name.trim() == skillName && i.type == "skill")
// If so, simply update the skill with the new advancement value.
if (existingSkill) {
existingSkill = duplicate(existingSkill);
existingSkill = foundry.utils.duplicate(existingSkill);
// If the existing skill has a greater amount of advances, use the greater value instead (make no change) - ??? Is this needed? I'm not sure why I did this. TODO: Evaluate.
existingSkill.data.advances.value = (existingSkill.data.advances.value < advances) ? advances : existingSkill.data.advances.value;
await this.updateEmbeddedEntity("OwnedItem", existingSkill);
@ -3571,7 +3571,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
async handleExtendedTest(testResult) {
let test = duplicate(this.getEmbeddedEntity("OwnedItem", testResult.options.extended));
let test = foundry.utils.duplicate(this.getEmbeddedEntity("OwnedItem", testResult.options.extended));
if(game.settings.get("wfrp4e", "extendedTests") && testResult.SL == 0)
testResult.SL = testResult.roll <= testResult.target ? 1 : -1

View File

@ -246,21 +246,21 @@ function __patchName(name) {
/************************************************************************************/
export default async function statParserFR(statString, type = "npc") {
let model = duplicate(game.system.model.Actor[type]);
let model = foundry.utils.duplicate(game.system.model.Actor[type]);
// Patch wront/strange carac value before processing
statString = statString.replace(/ /g, " 0")
let moneys = { gc: 0, ss: 0, bp: 0 }
let statNameReg = us_carac
let sectionData = duplicate(sectionDataUS)
let sectionData = foundry.utils.duplicate(sectionDataUS)
let skillGrouping = __SkillGroupsUS
let moneyLang = moneyUS
// Detect French stat block
if (statString.includes('CC') && statString.includes('CT') && statString.includes('FM')) {
//ui.notifications.warn("Le parsing de stablock en Français n'est pas encore prêt")
statNameReg = fr_carac
sectionData = duplicate(sectionDataFR)
sectionData = foundry.utils.duplicate(sectionDataFR)
skillGrouping = __SkillGroupsFR
moneyLang = moneyFR
}