Permettre un arbre d'inventaire alternatif
This commit is contained in:
parent
92388df5c7
commit
5972db035d
@ -296,7 +296,7 @@ export class RdDUtility {
|
||||
Handlebars.registerHelper('apostrophe', (article, str) => Grammar.apostrophe(article, str));
|
||||
Handlebars.registerHelper('un', str => Grammar.articleIndetermine(str));
|
||||
Handlebars.registerHelper('accord', (genre, ...args) => Grammar.accord(genre, args));
|
||||
Handlebars.registerHelper('buildConteneur', (objet) => { return new Handlebars.SafeString(RdDUtility.buildConteneur(objet)); });
|
||||
Handlebars.registerHelper('buildConteneur', (objet, tplItem) => { return new Handlebars.SafeString(RdDUtility.buildConteneur(objet, 1, tplItem)); });
|
||||
Handlebars.registerHelper('buildContenu', (objet) => { return new Handlebars.SafeString(RdDUtility.buildContenu(objet, 1, true)); });
|
||||
Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord));
|
||||
Handlebars.registerHelper('caseTmr-type', coord => TMRUtility.getTMRType(coord));
|
||||
@ -472,25 +472,29 @@ export class RdDUtility {
|
||||
/** Construit la structure récursive des conteneurs, avec imbrication potentielle
|
||||
*
|
||||
*/
|
||||
static buildConteneur(objet, profondeur) {
|
||||
static buildConteneur(objet, profondeur, tplItem) {
|
||||
if (!profondeur) profondeur = 1;
|
||||
if (!tplItem) tplItem = 'actor/inventaire-item.html'
|
||||
objet.niveau = profondeur;
|
||||
|
||||
const isConteneur = objet.type == 'conteneur';
|
||||
const isOuvert = isConteneur && this.getAfficheContenu(objet._id);
|
||||
const isVide = isConteneur && objet.system.contenu.length == 0;
|
||||
const conteneur = Handlebars.partials['systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.html']({
|
||||
const conteneur = Handlebars.partials[`systems/foundryvtt-reve-de-dragon/templates/${tplItem}`]({
|
||||
item: objet,
|
||||
vide: isVide,
|
||||
ouvert: isOuvert
|
||||
});
|
||||
const contenu = isConteneur ? RdDUtility.buildContenu(objet, profondeur, isOuvert) : '';
|
||||
const contenu = isConteneur ? RdDUtility.buildContenu(objet, profondeur, isOuvert, tplItem) : '';
|
||||
return conteneur + contenu;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static buildContenu(objet, profondeur, afficherContenu) {
|
||||
static buildContenu(objet, profondeur, afficherContenu, tplItem) {
|
||||
if (!profondeur) profondeur = 1;
|
||||
if (!tplItem) tplItem = 'actor/inventaire-item.html'
|
||||
objet.niveau = profondeur;
|
||||
|
||||
const display = afficherContenu ? 'item-display-show' : 'item-display-hide';
|
||||
let strContenu = `<ul class='item-list alterne-list ${display} list-item-margin${Math.min(profondeur,6)}'>`;
|
||||
for (let subItem of objet.subItems) {
|
||||
|
Loading…
Reference in New Issue
Block a user