Add auto-computed tables

This commit is contained in:
LeRatierBretonnien 2020-07-04 21:48:40 +02:00
parent e9504f7e3b
commit 46330eed61
4 changed files with 69 additions and 5 deletions

View File

@ -207,7 +207,6 @@ const _manage_inn_roll = async (content, msg) => {
} }
} }
/************************************************************************************/ /************************************************************************************/
let __eis_tables = { "animalmishap":1, "beasthead":1, "coincedentalenc":1, "demonic-mien":1, let __eis_tables = { "animalmishap":1, "beasthead":1, "coincedentalenc":1, "demonic-mien":1,
"expandedmutatemental":1, "expandedmutatephys":1, "fixations":1, "expandedmutatemental":1, "expandedmutatephys":1, "fixations":1,
@ -216,6 +215,26 @@ 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, 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 "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 ) => { const __check_fix_wrong_modules = ( chatFlag, patchFinished ) => {
@ -372,4 +391,17 @@ Hooks.once('ready', () => {
} ); } );
game.packs = new Collection( pack_array ); 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);
*/
} ); } );

View File

@ -3,7 +3,7 @@
"name": "WH4-fr-translation", "name": "WH4-fr-translation",
"title": "Traduction du module WH4 en Français.", "title": "Traduction du module WH4 en Français.",
"description": "La traduction du module WH4.", "description": "La traduction du module WH4.",
"version": "1.0.4", "version": "1.1.0",
"minimumCoreVersion" : "0.6.0", "minimumCoreVersion" : "0.6.0",
"compatibleCoreVersion": "1.0.0", "compatibleCoreVersion": "1.0.0",
"author": "LeRatierBretonnien", "author": "LeRatierBretonnien",
@ -33,6 +33,14 @@
"path": "packs/plats-dauberges.db", "path": "packs/plats-dauberges.db",
"system": "wfrp4e", "system": "wfrp4e",
"module": "WH4-fr-translation" "module": "WH4-fr-translation"
},
{
"label": "Tables des Traduction",
"entity": "JournalEntry",
"name": "tables-des-traductions",
"path": "packs/tables-des-traductions.db",
"system": "wfrp4e",
"module": "WH4-fr-translation"
} }
], ],
"languages": [{ "languages": [{

File diff suppressed because one or more lines are too long