Auto-translat careers/skills.comp

This commit is contained in:
2021-08-24 21:43:47 +02:00
parent d40f768909
commit d9bfa7efc4
8 changed files with 490 additions and 348 deletions

View File

@ -110,7 +110,7 @@ const __create_translation_tables = async (compmod) => {
* */
const __auto_patch_translation_journal_compendium = async (compmod) => {
if (game.user.isGM) {
/*let compData = game.packs.get( "WH4-fr-translation.tables-des-traductions" );
let compData = game.packs.get( "WH4-fr-translation.tables-des-traductions" );
compData.locked = false;
let translEntries = await compData.getContent();
for (let entryData of translEntries ) {
@ -118,7 +118,7 @@ const __auto_patch_translation_journal_compendium = async (compmod) => {
mydata.content = mydata.content.replace(/wfrp4e-content/g, compmod );
entryData.update( mydata );
}
compData.locked = true;*/
compData.locked = true;
}
}
@ -164,29 +164,6 @@ const __check_fix_wrong_modules = ( chatFlag, patchFinished ) => {
patch_core_tables( __dotr_tables );
patch_trade_gazeteer()
}
if ( name == "wfrp4e-rnhd" && module.active && game.wfrp4e.tables.career) {
game.wfrp4e.tables.career.name = "Carrières aléatoires";
/*FilePicker.browse("data", "modules/WH4-fr-translation/tables/").then(resp => {
for (var file of resp.files) {
if ( file.match("career_gnome.json") ) {
fetch(file).then(r=>r.json()).then(records => {
let mycareer = records;
game.wfrp4e.tables.career.columns = mycareer.columns;
for (let k=0; k<game.wfrp4e.tables.career.rows.length; k++) {
game.wfrp4e.tables.career.rows[k].range = mycareer.rows[k].range;
game.wfrp4e.tables.career.rows[k].name = mycareer.rows[k].name; // Patch !!!
}
});
}
}
});*/
WH4FRPatchConfig.perform_rnhd_patch();
if (game.user.isGM && chatFlag)
ChatMessage.create( { title: "Module RNHD patché", content: "<strong>Le module RHND a été detecté et automatiquement patché.</strong>", whisper: ChatMessage.getWhisperRecipients("GM") } );
}
if ( name == 'ogre-kingdom-wfrp4e' && module.active) {
WH4FRPatchConfig.perform_ogrekingdom_patch();
@ -202,8 +179,9 @@ const __check_fix_wrong_modules = ( chatFlag, patchFinished ) => {
}
});
if (game.user.isGM && patchFinished)
if (game.user.isGM && patchFinished) {
ChatMessage.create( { title: "Patch fini !", content: "Les modules WFRP4E ont été patchés <strong>avec succès</strong>. Vous pouvez y aller et que <strong>Shallya vous garde !</strong>", whisper: ChatMessage.getWhisperRecipients("GM") } );
}
}
/************************************************************************************/
@ -287,6 +265,7 @@ const __add_actors_translation = ( ) => {
}
}
/************************************************************************************/
/* Hook for specific command */
Hooks.on("chatMessage", (html, content, msg) => {
@ -308,7 +287,8 @@ Hooks.once('ready', () => {
setTimeout( __check_fix_wrong_modules, 10000, true, false);
setTimeout( __check_fix_wrong_modules, 20000, false, true);
setTimeout( __add_actors_translation, 21000, false, true);
/*
let compmod = "wfrp4e";
// Check various settings in the installation
game.modules.forEach((module, name) => {
@ -321,6 +301,5 @@ Hooks.once('ready', () => {
Auto-create translation journal tables
__create_translation_tables(compmod);
*/
//__create_translation_tables(compmod);
} );