diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 10d48c6d..5466a50e 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -11,6 +11,7 @@ export class RdDActorSheet extends ActorSheet { /** @override */ static get defaultOptions() { + RdDUtility.initAfficheContenu(); return mergeObject(super.defaultOptions, { classes: ["rdd", "sheet", "actor"], template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html", @@ -25,7 +26,7 @@ export class RdDActorSheet extends ActorSheet { /* -------------------------------------------- */ getData() { let data = super.getData(); - + data.itemsByType = RdDUtility.buildItemsClassification(data.items); // Competence per category data.competenceByCategory = {}; @@ -279,6 +280,13 @@ export class RdDActorSheet extends ActorSheet { item.sheet.render(true); }); + // Display info about queue + html.find('.conteneur-name a').click((event) => { + let myID = event.currentTarget.attributes['data-item-id'].value; + RdDUtility.toggleAfficheContenu( myID ); + this.render(true); + }); + if (this.options.editCaracComp) { // On carac change html.find('.carac-value').change((event) => { diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 016b452b..ce1bcd25 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -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 + "