Sync with new Compendium structure

This commit is contained in:
2020-05-11 10:01:50 +02:00
parent 382ec09b1c
commit f75a8a0789
3 changed files with 18 additions and 15 deletions

View File

@ -52,9 +52,11 @@ Hooks.on("chatMessage", (html, content, msg) => {
Hooks.once('ready', () => {
const lang = game.settings.get('core', 'language');
if ( lang == "fr" ) {
game.packs.forEach((pack, idx) => {
if(!pack.translated && pack.entity === 'Actor') {
if ( lang == "fr" ) {
let pack_array = [];
game.packs.forEach((pack, name) => {
let newpack = pack;
if(!pack.translated && pack.entity === 'Actor') {
let translations = {
"label": pack.metadata.name,
"mapping": {
@ -71,11 +73,12 @@ Hooks.once('ready', () => {
},
"entries": [
]
};
};
console.log("Actor compendium has been replaced !!!!");
game.packs[idx] = new TranslatedCompendium(pack, translations);
newpack = new TranslatedCompendium(pack, translations);
}
pack_array.push( [name, newpack ] );
} );
game.packs = new Collection( pack_array );
}
} );