#48 : Zone de saisie privée pour le MJ

This commit is contained in:
2020-12-01 22:18:15 +01:00
parent 8361a90f32
commit 9c16cf7641
4 changed files with 56 additions and 12 deletions

View File

@ -171,6 +171,20 @@ export class RdDUtility {
return [];
}
/* -------------------------------------------- */
static initAfficheContenu( actorId ) { // persistent handling of conteneur show/hide
if ( !this.afficheContenu )
this.afficheContenu = {};
}
/* -------------------------------------------- */
static toggleAfficheContenu( conteneurId) {
this.afficheContenu[conteneurId] = !this.afficheContenu[conteneurId];
}
/* -------------------------------------------- */
static getAfficheContenu( conteneurId) {
return this.afficheContenu[conteneurId];
}
/* -------------------------------------------- */
static filterItemsPerTypeForSheet( data ) {
data.data.materiel = this.checkNull(data.itemsByType['objet']);
@ -240,9 +254,16 @@ export class RdDUtility {
*/
static buildConteneur( objet, niveau ) {
if (!niveau) niveau = 1;
objet.niveau = niveau;
//console.log("OBJ:", objet);
let str = Handlebars.partials['systems/foundryvtt-reve-de-dragon/templates/actor-inventaire-conteneur.html']( { item: objet} );
if (objet.type == 'conteneur') {
str = str + "<ul class='item-list alterne-list list-item-margin"+niveau+"'>";
//console.log("ITEM DISPLAYED", this.getAfficheContenu(objet._id) );
if ( this.getAfficheContenu(objet._id) ) {
str = str + "<ul class='item-list alterne-list item-display-show list-item-margin"+niveau+"'>";
} else {
str = str + "<ul class='item-list alterne-list item-display-hide list-item-margin"+niveau+"'>";
}
for (let subItem of objet.subItems) {
str = str + this.buildConteneur(subItem, niveau+1);
}