Add auto-computed tables
This commit is contained in:
@ -207,7 +207,6 @@ const _manage_inn_roll = async (content, msg) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
let __eis_tables = { "animalmishap":1, "beasthead":1, "coincedentalenc":1, "demonic-mien":1,
|
||||
"expandedmutatemental":1, "expandedmutatephys":1, "fixations":1,
|
||||
@ -216,7 +215,27 @@ let __eis_tables = { "animalmishap":1, "beasthead":1, "coincedentalenc":1, "demo
|
||||
let __wfrp4e_tables = { "career": 1, "critbody":1, "critleg": 1, "doom": 1, "eyes": 1, "majormis": 1, "mutatemental": 1, "oops": 1, "species":1, "travel": 1,
|
||||
"critarm": 1, "crithead": 1, "delirium": 1, "event": 1, "hair": 1, "minormis": 1, "mutatephys": 1, "talents": 1, "wrath": 1
|
||||
}
|
||||
|
||||
let __to_table_translate = [ { name:"traits", transl:"Traits"}, {name:"talents", transl:"Talents"}, {name:"skills", transl:"Compétences"} ,
|
||||
{ name:"careers", transl:"Carrières"}, {name:"spells", transl:"Sorts"}, {name:"prayers", transl:"Bénédictions et Miracles" }
|
||||
]
|
||||
|
||||
/************************************************************************************/
|
||||
const __create_translation_tables = async (compmod) => {
|
||||
for (let iterData of __to_table_translate) {
|
||||
|
||||
let entityName = compmod+'.' + iterData.name;
|
||||
let compData = game.packs.get( entityName);
|
||||
let compFull = await compData.getContent();
|
||||
let htmlTab = "<table border='1'><tbody>";
|
||||
for (let entryData of compFull ) {
|
||||
htmlTab += "<tr><td>"+ entryData.data.originalName + "</td><td>@Compendium["+ entityName + '.' + entryData.id + "]{"+ entryData.name +"}</td></tr>\n";
|
||||
};
|
||||
htmlTab += "</table>";
|
||||
let myjournal = await JournalEntry.create( {name: 'Traduction des ' + iterData.transl, content: htmlTab } );
|
||||
game.journal.insert( myjournal );
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************/
|
||||
const __check_fix_wrong_modules = ( chatFlag, patchFinished ) => {
|
||||
|
||||
@ -328,7 +347,7 @@ Hooks.once('ready', () => {
|
||||
setTimeout( __check_fix_wrong_modules, 2000, true, false);
|
||||
setTimeout( __check_fix_wrong_modules, 10000, false, false);
|
||||
setTimeout( __check_fix_wrong_modules, 20000, false, true);
|
||||
|
||||
|
||||
const lang = game.settings.get('core', 'language');
|
||||
if ( lang == "fr" ) {
|
||||
|
||||
@ -372,4 +391,17 @@ Hooks.once('ready', () => {
|
||||
} );
|
||||
game.packs = new Collection( pack_array );
|
||||
}
|
||||
|
||||
/* Uncomment this to auto-create the translation tables
|
||||
let compmod = "wfrp4e";
|
||||
// Check various settings in the installation
|
||||
game.modules.forEach((module, name) => {
|
||||
if ( name == "wfrp4e-content" && module.active) {
|
||||
compmod = "wfrp4e-content";
|
||||
}
|
||||
} );
|
||||
// Auto-create translation journal tables
|
||||
__create_translation_tables(compmod);
|
||||
*/
|
||||
|
||||
} );
|
||||
|
Reference in New Issue
Block a user