diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js
index a734f4c7..e0d92bd1 100644
--- a/module/actor/base-actor-sheet.js
+++ b/module/actor/base-actor-sheet.js
@@ -31,32 +31,21 @@ export class RdDBaseActorSheet extends ActorSheet {
Monnaie.validerMonnaies(this.actor.itemTypes['monnaie']);
this.actor.recompute();
- const userRightLevel = game.user.isGM ? CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER : this.actor.getUserLevel(game.user)
- const options = duplicate(this.options);
- mergeObject(options, {
- isGM: game.user.isGM,
- editable: this.isEditable,
- cssClass: this.isEditable ? "editable" : "locked",
- isLimited: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.LIMITED,
- isObserver: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER,
- isOwner: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER,
- owner: this.actor.isOwner,
- });
-
let formData = {
title: this.title,
id: this.actor.id,
type: this.actor.type,
img: this.actor.img,
name: this.actor.name,
- system: foundry.utils.deepClone(this.actor.system),
+ system: this.actor.system,
description: await TextEditor.enrichHTML(this.actor.system.description, { async: true }),
notesmj: await TextEditor.enrichHTML(this.actor.system.notesmj, { async: true }),
- options: options,
+ options: RdDSheetUtility.mergeDocumentRights(this.options, this.actor, this.isEditable)
}
+
RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
formData.calc = {
- fortune: this.toSolsDeniers(this.actor.getFortune()),
+ fortune: Monnaie.toSolsDeniers(this.actor.getFortune()),
prixTotalEquipement: this.actor.computePrixTotalEquipement(),
encTotal: await this.actor.computeEncTotal(),
}
@@ -64,17 +53,9 @@ export class RdDBaseActorSheet extends ActorSheet {
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs);
-
return formData;
}
- toSolsDeniers(fortune) {
- return {
- sols: Math.floor(fortune),
- deniers: Math.round(100 * (fortune - Math.floor(fortune)))
- };
- }
-
/* -------------------------------------------- */
static filterItemsPerTypeForSheet(formData, itemTypes) {
formData.recettescuisine = Misc.arrayOrEmpty(itemTypes['recettecuisine']);
diff --git a/module/dialog-item-vente.js b/module/dialog-item-vente.js
index 5b6a62ce..fed81902 100644
--- a/module/dialog-item-vente.js
+++ b/module/dialog-item-vente.js
@@ -8,7 +8,7 @@ export class DialogItemVente extends Dialog {
const venteData = {
item: item,
alias: item.actor?.name ?? game.user.name,
- vendeurId: item.actor?.id ,
+ vendeurId: item.actor?.id,
prixOrigine: item.calculerPrixCommercant(),
prixUnitaire: item.calculerPrixCommercant(),
prixLot: item.calculerPrixCommercant(),
@@ -40,51 +40,62 @@ export class DialogItemVente extends Dialog {
activateListeners(html) {
super.activateListeners(html);
+
this.html = html;
- this.setQuantiteIllimite(this.venteData.quantiteIllimite);
this.html.find(".tailleLot").change(event => this.setTailleLot(Number(event.currentTarget.value)));
this.html.find(".quantiteNbLots").change(event => this.setNbLots(Number(event.currentTarget.value)));
this.html.find(".quantiteIllimite").change(event => this.setQuantiteIllimite(event.currentTarget.checked));
this.html.find(".prixLot").change(event => this.setPrixLot(Number(event.currentTarget.value)));
+
+ this.setQuantiteIllimite(this.venteData.quantiteIllimite);
}
async onProposer(it) {
- await this.html.find(".tailleLot").change();
- await this.html.find(".quantiteNbLots").change();
- await this.html.find(".quantiteIllimite").change();
- await this.html.find(".prixLot").change();
+ this.updateVente(this.getChoixVente());
this.callback(this.venteData);
}
+ updateVente(update) {
+ mergeObject(this.venteData, update);
+ }
+
+ getChoixVente() {
+ return {
+ quantiteNbLots: Number(this.html.find(".quantiteNbLots").val()),
+ tailleLot: Number(this.html.find(".tailleLot").val()),
+ quantiteIllimite: this.html.find(".quantiteIllimite").is(':checked'),
+ prixLot: Number(this.html.find(".prixLot").val())
+ };
+ }
+
/* -------------------------------------------- */
setPrixLot(prixLot) {
this.venteData.prixLot = prixLot;
}
setTailleLot(tailleLot) {
- // recalculer le prix du lot
- if (tailleLot != this.venteData.tailleLot) {
- this.venteData.prixLot = (tailleLot * this.venteData.prixOrigine).toFixed(2);
- this.html.find(".prixLot").val(this.venteData.prixLot);
- }
- this.venteData.tailleLot = tailleLot;
- // recalculer le nombre de lots max
- this.venteData.quantiteMaxLots = Math.floor(this.venteData.quantiteMax / tailleLot);
- this.venteData.quantiteNbLots = Math.min(this.venteData.quantiteMaxLots, this.venteData.quantiteNbLots);
+ const maxLots = Math.floor(this.venteData.quantiteMax / tailleLot);
+ this.updateVente({
+ tailleLot,
+ quantiteNbLots: Math.min(maxLots, this.venteData.quantiteNbLots),
+ quantiteMaxLots: maxLots,
+ prixLot: (tailleLot * this.venteData.prixOrigine).toFixed(2)
+ });
+
+ this.html.find(".prixLot").val(this.venteData.prixLot);
this.html.find(".quantiteNbLots").val(this.venteData.quantiteNbLots);
this.html.find(".quantiteNbLots").attr("max", this.venteData.quantiteMaxLots)
}
setNbLots(nbLots) {
- if (this.venteData.isOwned) {
- nbLots = Math.max(0, Math.min(nbLots, this.venteData.quantiteMaxLots));
- }
- this.venteData.quantiteNbLots = nbLots;
+ this.updateVente({
+ quantiteNbLots: this.venteData.isOwned ? Math.max(0, Math.min(nbLots, this.venteData.quantiteMaxLots)) : nbLots
+ })
this.html.find(".quantiteNbLots").val(this.venteData.quantiteNbLots);
}
setQuantiteIllimite(checked) {
- this.venteData.quantiteIllimite = checked;
+ this.updateVente({ quantiteIllimite: checked })
this.html.find(".label-quantiteIllimite").text(this.venteData.quantiteIllimite ? "Illimités" : "disponibles");
HtmlUtility.showControlWhen(this.html.find(".quantiteNbLots"), !this.venteData.quantiteIllimite)
}
diff --git a/module/item-monnaie.js b/module/item-monnaie.js
index 5e091b7f..610ee2d9 100644
--- a/module/item-monnaie.js
+++ b/module/item-monnaie.js
@@ -62,6 +62,13 @@ export class Monnaie {
return deniers;
}
+ static toSolsDeniers(fortune) {
+ return {
+ sols: Math.floor(fortune),
+ deniers: Math.round(100 * (fortune - Math.floor(fortune)))
+ };
+ }
+
static getFortune(monnaies) {
return (monnaies??[])
.map(m => Number(m.system.cout) * Number(m.system.quantite))
diff --git a/module/item-sheet.js b/module/item-sheet.js
index af48e451..8747e0a3 100644
--- a/module/item-sheet.js
+++ b/module/item-sheet.js
@@ -86,22 +86,17 @@ export class RdDItemSheet extends ItemSheet {
/* -------------------------------------------- */
async getData() {
let formData = {
- id: this.item.id,
title: this.item.name,
+ id: this.item.id,
type: this.item.type,
img: this.item.img,
name: this.item.name,
system: this.item.system,
- isGM: game.user.isGM,
actorId: this.actor?.id,
- isOwned: this.actor ? true : false,
- owner: this.item.isOwner,
- editable: this.isEditable,
- cssClass: this.isEditable ? "editable" : "locked",
- isSoins: false,
description: await TextEditor.enrichHTML(this.item.system.description, { async: true }),
descriptionmj: await TextEditor.enrichHTML(this.item.system.descriptionmj, { async: true }),
- isComestible: this.item.getUtilisationCuisine()
+ isComestible: this.item.getUtilisationCuisine(),
+ options: RdDSheetUtility.mergeDocumentRights(this.options, this.item, this.isEditable)
}
const competences = await SystemCompendiums.getCompetences(this.actor?.type);
@@ -138,12 +133,12 @@ export class RdDItemSheet extends ItemSheet {
if (this.item.type == 'potion') {
await RdDHerbes.addPotionFormData(formData);
}
- if (formData.isOwned && this.item.type == 'herbe' && (formData.system.categorie == 'Soin' || formData.system.categorie == 'Repos')) {
+ if (formData.options.isOwned && this.item.type == 'herbe' && (formData.system.categorie == 'Soin' || formData.system.categorie == 'Repos')) {
formData.isIngredientPotionBase = true;
}
if (this.item.type == 'sortreserve') {
const sortId = this.item.system.sortid;
- formData.sort = formData.isOwned ? this.item.actor.items.get(sortId) : game.items.get(sortId);
+ formData.sort = formData.options.isOwned ? this.item.actor.items.get(sortId) : game.items.get(sortId);
}
formData.bonusCaseList = RdDItemSort.getBonusCaseList(formData, true);
@@ -156,7 +151,9 @@ export class RdDItemSheet extends ItemSheet {
super.activateListeners(html);
this.html = html;
- HtmlUtility.showControlWhen(this.html.find(".item-cout"), ReglesOptionelles.isUsing('afficher-prix-joueurs') || game.user.isGM || !this.item.isOwned);
+ HtmlUtility.showControlWhen(this.html.find(".item-cout"), ReglesOptionelles.isUsing('afficher-prix-joueurs')
+ || game.user.isGM
+ || !this.item.isOwned);
HtmlUtility.showControlWhen(this.html.find(".item-magique"), this.item.isMagique());
// Everything below here is only needed if the sheet is editable
diff --git a/module/item/sheet-conteneur.js b/module/item/sheet-conteneur.js
index b5ff7855..fc0f7948 100644
--- a/module/item/sheet-conteneur.js
+++ b/module/item/sheet-conteneur.js
@@ -29,7 +29,6 @@ export class RdDConteneurItemSheet extends RdDItemInventaireSheet {
/* -------------------------------------------- */
prepareConteneurData(formData) {
RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
-
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
formData.subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems;
}
@@ -44,7 +43,8 @@ export class RdDConteneurItemSheet extends RdDItemInventaireSheet {
const dragData = {
actorId: this.actor.id,
type: "Item",
- data: item.system
+ data: item.system,
+ uuid: item.uuid
};
event.dataTransfer.setData("text/plain", JSON.stringify(dragData));
@@ -52,7 +52,8 @@ export class RdDConteneurItemSheet extends RdDItemInventaireSheet {
async _onDropItem(event, dragData) {
if (this.actor) {
- const dropParams = await RdDSheetUtility.prepareItemDropParameters(this.item.id, this.actor, dragData, this.objetVersConteneur);
+ const destItemId = this.html.find(event.target)?.closest('.item').attr('data-item-id') ?? this.item.id
+ const dropParams = await RdDSheetUtility.prepareItemDropParameters(destItemId, this.actor, dragData, this.objetVersConteneur);
await this.actor.processDropItem(dropParams);
await this.render(true);
}
diff --git a/module/item/sheet-service.js b/module/item/sheet-service.js
index a819247d..b9b00146 100644
--- a/module/item/sheet-service.js
+++ b/module/item/sheet-service.js
@@ -6,7 +6,7 @@ export class RdDServiceItemSheet extends RdDItemSheet {
async getData() {
const formData = await super.getData();
- formData.disabled = formData.isGM || formData.isOwned ? '' : 'disabled';
+ formData.disabled = formData.options.isGM || formData.options.isOwned ? '' : 'disabled';
return formData;
}
diff --git a/module/rdd-alchimie.js b/module/rdd-alchimie.js
index add4bd7c..64605ab4 100644
--- a/module/rdd-alchimie.js
+++ b/module/rdd-alchimie.js
@@ -8,13 +8,11 @@ export class RdDAlchimie {
/* -------------------------------------------- */
static processManipulation(recette, actorId = undefined) {
- //console.log("CALLED", recette, recette.isOwned, actorId );
let manip = recette.system.manipulation;
let matchArray = manip.match(matchOperations);
if (matchArray) {
for (let matchStr of matchArray) {
let result = matchStr.match(matchOperationTerms);
- //console.log("RESULT ", result);
if (result[1] && result[2]) {
let commande = Misc.upperFirst(result[1]);
let replacement = this[`_alchimie${commande}`](recette, result[2], actorId);
diff --git a/module/rdd-sheet-utility.js b/module/rdd-sheet-utility.js
index e1090a04..da9732cb 100644
--- a/module/rdd-sheet-utility.js
+++ b/module/rdd-sheet-utility.js
@@ -1,9 +1,24 @@
import { DialogSplitItem } from "./dialog-split-item.js";
import { RdDItem } from "./item.js";
-import { SystemCompendiums } from "./settings/system-compendiums.js";
export class RdDSheetUtility {
+ static mergeDocumentRights(options, document, editable) {
+ const userRightLevel = game.user.isGM
+ ? CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER
+ : document.getUserLevel(game.user);
+ mergeObject(options, {
+ isGM: game.user.isGM,
+ isOwned: document.parent,
+ editable: editable,
+ cssClass: editable ? "editable" : "locked",
+ isLimited: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.LIMITED,
+ isObserver: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER,
+ isOwner: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER
+ });
+ return options;
+ }
+
static getItem(event, actor) {
return actor.items.get(RdDSheetUtility.getItemId(event))
}
@@ -23,7 +38,7 @@ export class RdDSheetUtility {
static async prepareItemDropParameters(destItemId, actor, dragData, objetVersConteneur) {
let item = fromUuidSync(dragData.uuid);
- if (item.pack && !item.system){
+ if (item.pack && !item.system) {
item = await RdDItem.getCorrespondingItem(item);
}
if (actor.canReceive(item)) {
diff --git a/module/rdd-utility.js b/module/rdd-utility.js
index ef8a1000..d0b8ccb5 100644
--- a/module/rdd-utility.js
+++ b/module/rdd-utility.js
@@ -278,8 +278,9 @@ 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, templateItem, options) => { return new Handlebars.SafeString(RdDUtility.buildConteneur(objet, 1, templateItem, options)); });
- Handlebars.registerHelper('buildContenu', (objet) => { return new Handlebars.SafeString(RdDUtility.buildContenu(objet, 1, true)); });
+ Handlebars.registerHelper('buildLigneInventaire', (item, options) => { return new Handlebars.SafeString(RdDUtility.buildLigneInventaire(item, options)); });
+ Handlebars.registerHelper('buildInventaireConteneur', (actorId, itemId, options) => { return new Handlebars.SafeString(RdDUtility.buildInventaireConteneur(actorId, itemId, options)); });
+ Handlebars.registerHelper('buildContenuConteneur', (item, options) => { return new Handlebars.SafeString(RdDUtility.buildContenuConteneur(item, options)); });
Handlebars.registerHelper('calculerPrixCommercant', item => item.calculerPrixCommercant());
Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord));
Handlebars.registerHelper('caseTmr-type', coord => TMRUtility.getTMRType(coord));
@@ -394,38 +395,58 @@ export class RdDUtility {
return conteneurs.filter((conteneur, index, arr) => !conteneur.estContenu);
}
- /* -------------------------------------------- */
- /** Construit la structure récursive des conteneurs, avec imbrication potentielle
- *
- */
- static buildConteneur(objet, profondeur, templateItem, options) {
- if (!profondeur) profondeur = 1;
- if (!templateItem) templateItem = '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/${templateItem}`]({
- item: objet,
- vide: isVide,
- ouvert: isOuvert,
- options: options
- });
- const contenu = isConteneur ? RdDUtility.buildContenu(objet, profondeur, isOuvert, templateItem, options) : '';
- return conteneur + contenu;
+ static prepareOptionsArbreInventaire(item, optionsArbre) {
+ if (!optionsArbre.profondeur) {
+ optionsArbre.profondeur = 1
+ };
+ if (!optionsArbre.templateItem) {
+ optionsArbre.templateItem = item.parent?.type == 'commerce'
+ ? "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.html"
+ : "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.html";
+ }
+ item.niveau = optionsArbre.profondeur;
}
/* -------------------------------------------- */
- static buildContenu(objet, profondeur, afficherContenu, templateItem, options) {
- if (!profondeur) profondeur = 1;
- if (!templateItem) templateItem = 'actor/inventaire-item.html'
- objet.niveau = profondeur;
- const display = afficherContenu ? 'item-display-show' : 'item-display-hide';
- let strContenu = `
`;
- for (let subItem of objet.subItems) {
- strContenu += this.buildConteneur(subItem, profondeur + 1, templateItem, options);
+ /**
+ * Construit la structure récursive des conteneurs, avec imbrication potentielle
+ */
+ static buildLigneInventaire(item, options = {}, optionsArbre = { ouvert: false, profondeur: 1 }) {
+ RdDUtility.prepareOptionsArbreInventaire(item, optionsArbre);
+
+ const isConteneur = item.type == 'conteneur';
+ const inventaire = {
+ item: item,
+ vide: isConteneur && item.system.contenu.length == 0,
+ ouvert: isConteneur && RdDUtility.getAfficheContenu(item._id),
+ options: options
+ };
+ optionsArbre.ouvert = inventaire.ouvert
+ const ligneObjet = Handlebars.partials[optionsArbre.templateItem](inventaire);
+ if (isConteneur) {
+ return ligneObjet + RdDUtility.buildContenuConteneur(item, options, optionsArbre);
+ }
+ return ligneObjet;
+ }
+
+ static buildInventaireConteneur(actorId, itemId, options) {
+ const actor = game.actors.get(actorId)
+ const item = actor?.items.get(itemId)
+ if (item) {
+ return RdDUtility.buildContenuConteneur(item, options, { ouvert: true, profondeur: 1 });
+ }
+ return '';
+ }
+
+ /* -------------------------------------------- */
+ static buildContenuConteneur(conteneur, options = {}, optionsArbre = {}) {
+ RdDUtility.prepareOptionsArbreInventaire(conteneur, optionsArbre);
+ const display = optionsArbre.ouvert ? 'item-display-show' : 'item-display-hide';
+ let strContenu = ``;
+ optionsArbre.profondeur++;
+ for (let contenu of conteneur.subItems) {
+ strContenu += this.buildLigneInventaire(contenu, options, optionsArbre);
}
return strContenu + "
";
}
diff --git a/system.json b/system.json
index 7870a9f4..39d94531 100644
--- a/system.json
+++ b/system.json
@@ -1,8 +1,8 @@
{
"id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
- "version": "10.6.6",
- "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.6.zip",
+ "version": "10.6.7",
+ "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.7.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"compatibility": {
"minimum": "10",
diff --git a/templates/actor-creature-sheet.html b/templates/actor-creature-sheet.html
index 0e93a954..6995640c 100644
--- a/templates/actor-creature-sheet.html
+++ b/templates/actor-creature-sheet.html
@@ -67,7 +67,7 @@
{{!-- Description Tab --}}
- {{editor description target="system.description" button=true owner=owner editable=editable engine="prosemirror"}}
+ {{editor description target="system.description" button=true owner=options.isOwner editable=options.editable engine="prosemirror"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/editor-notes-mj.html"}}
diff --git a/templates/actor-entite-sheet.html b/templates/actor-entite-sheet.html
index 61cee9d6..5706efde 100644
--- a/templates/actor-entite-sheet.html
+++ b/templates/actor-entite-sheet.html
@@ -44,7 +44,7 @@
- {{editor description target="system.description" button=true owner=owner editable=editable engine="prosemirror"}}
+ {{editor description target="system.description" button=true owner=options.isOwner editable=options.editable engine="prosemirror"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/editor-notes-mj.html"}}
diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html
index 9a877b60..de44d86f 100644
--- a/templates/actor-sheet.html
+++ b/templates/actor-sheet.html
@@ -190,11 +190,11 @@
Biographie :
- {{editor biographie target="system.biographie" button=true owner=options.owner editable=true engine="prosemirror"}}
+ {{editor biographie target="system.biographie" button=true owner=options.isOwner editable=options.editable engine="prosemirror"}}
Notes :
- {{editor notes target="system.notes" button=true owner=owner editable=true engine="prosemirror"}}
+ {{editor notes target="system.notes" button=true owner=options.isOwner editable=options.editable engine="prosemirror"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/xp-journal.html"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/editor-notes-mj.html"}}
diff --git a/templates/actor-vehicule-sheet.html b/templates/actor-vehicule-sheet.html
index fe9dcf88..ea6527f4 100644
--- a/templates/actor-vehicule-sheet.html
+++ b/templates/actor-vehicule-sheet.html
@@ -84,7 +84,7 @@
- {{editor description target="system.description" button=true owner=owner editable=true engine="prosemirror"}}
+ {{editor description target="system.description" button=true owner=options.isOwner editable=options.editable engine="prosemirror"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/editor-notes-mj.html"}}
diff --git a/templates/actor/commerce-actor-sheet.html b/templates/actor/commerce-actor-sheet.html
index 9bff7277..ae98e7bc 100644
--- a/templates/actor/commerce-actor-sheet.html
+++ b/templates/actor/commerce-actor-sheet.html
@@ -36,7 +36,7 @@
{{!-- Sheet Body --}}
- {{editor description target="system.description" button=true owner=options.owner editable=options.isOwner engine="prosemirror"}}
+ {{editor description target="system.description" button=true owner=options.isOwner editable=options.isOwner engine="prosemirror"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire.html"}}
diff --git a/templates/actor/commerce-inventaire.html b/templates/actor/commerce-inventaire.html
index 934560f8..f4fc2b81 100644
--- a/templates/actor/commerce-inventaire.html
+++ b/templates/actor/commerce-inventaire.html
@@ -24,13 +24,12 @@
{{#each objets as |item id|}}
{{#unless item.estContenu}}
- {{#if (ne item.type 'conteneur')}}
- {{> "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.html"
- item=item vide=true ouvert=true options=../options}}
- {{/if}}
+ {{#if (ne item.type 'conteneur')}}
+ {{buildLigneInventaire item ../options}}
+ {{/if}}
{{/unless}}
{{/each}}
{{#each conteneurs as |conteneur id|}}
- {{buildConteneur conteneur 'actor/commerce-inventaire-item.html' ../options}}
+ {{buildLigneInventaire conteneur ../options}}
{{/each}}
diff --git a/templates/actor/editor-notes-mj.html b/templates/actor/editor-notes-mj.html
index c34e91b8..32c17a6e 100644
--- a/templates/actor/editor-notes-mj.html
+++ b/templates/actor/editor-notes-mj.html
@@ -1,6 +1,6 @@
{{#if options.isGM}}
Notes du MJ :
- {{editor notesmj target="system.notesmj" button=true owner=owner editable=true engine="prosemirror"}}
+ {{editor notesmj target="system.notesmj" button=true owner=options.isOwner editable=options.editable engine="prosemirror"}}
{{/if}}
diff --git a/templates/actor/inventaire-item.html b/templates/actor/inventaire-item.html
index a1f25f49..a89f0716 100644
--- a/templates/actor/inventaire-item.html
+++ b/templates/actor/inventaire-item.html
@@ -1,4 +1,4 @@
-{{#if (or @root.options.isObserver (ne item.type 'monnaie'))}}
+{{#if (or options.isObserver (ne item.type 'monnaie'))}}
{{#if (eq item.type 'conteneur')}}
@@ -21,24 +21,24 @@
{{numberFormat item.system.encTotal decimals=2}}
- {{#if @root.options.isOwner}}
- {{#unless item.estContenu}}
- {{#if (or (eq item.type 'arme') (eq item.type 'armure') )}}
- {{#if item.system.equipe}}{{else}}{{/if}}
- {{/if}}
- {{/unless}}
-
-
-
- {{#if (ne item.system.quantite 0)}}
-
- {{/if}}
+ {{#if options.isOwner}}
+ {{#unless item.estContenu}}
+ {{#if (or (eq item.type 'arme') (eq item.type 'armure') )}}
+ {{#if item.system.equipe}}{{else}}{{/if}}
+ {{/if}}
+ {{/unless}}
+
+
+
+ {{#if (ne item.system.quantite 0)}}
+
+ {{/if}}
{{/if}}
- {{#if @root.options.isOwner}}
- {{#if item.system.actionPrincipale}}
- {{item.system.actionPrincipale}}
- {{/if}}
+ {{#if options.isOwner}}
+ {{#if item.system.actionPrincipale}}
+ {{item.system.actionPrincipale}}
+ {{/if}}
{{/if}}
diff --git a/templates/actor/inventaire.html b/templates/actor/inventaire.html
index c080c069..61e13c29 100644
--- a/templates/actor/inventaire.html
+++ b/templates/actor/inventaire.html
@@ -1,6 +1,8 @@
Equipement
+ {{#if options.isOwned}}
Nouvel objet
+ {{/if}}
{{#if options.isGM}}
Tout vider
{{/if}}
@@ -20,11 +22,11 @@
{{#each objets as |item id|}}
{{#unless item.estContenu}}
{{#if (ne item.type 'conteneur')}}
- {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.html" item=item vide=true ouvert=true options=@root.options}}
+ {{buildLigneInventaire item @root.options}}
{{/if}}
{{/unless}}
{{/each}}
{{#each conteneurs as |conteneur id|}}
- {{buildConteneur this 'actor/inventaire-item.html' @root.options}}
+ {{buildLigneInventaire conteneur @root.options}}
{{/each}}
diff --git a/templates/dialog-item-vente.html b/templates/dialog-item-vente.html
index 1307b33a..0a2b4313 100644
--- a/templates/dialog-item-vente.html
+++ b/templates/dialog-item-vente.html
@@ -13,7 +13,7 @@
- {{#unless isOwned}}
+ {{#unless options.isOwned}}
diff --git a/templates/item-competence-sheet.html b/templates/item-competence-sheet.html
index 78a7a780..d0287462 100644
--- a/templates/item-competence-sheet.html
+++ b/templates/item-competence-sheet.html
@@ -3,7 +3,7 @@
- {{#if isGM}}
+ {{#if options.isGM}}
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
-
- {{#if isOwned}}
+ {{#if options.isOwned}}
-
- {{buildContenu this}}
+ {{buildInventaireConteneur actorId id options}}
{{/if}}
diff --git a/templates/item-extraitpoetique-sheet.html b/templates/item-extraitpoetique-sheet.html
index a02127c0..5c0414b5 100644
--- a/templates/item-extraitpoetique-sheet.html
+++ b/templates/item-extraitpoetique-sheet.html
@@ -12,13 +12,13 @@
- {{editor extrait target="system.extrait" button=true owner=owner editable=true engine="prosemirror"}}
+ {{editor extrait target="system.extrait" button=true owner=options.isOwner editable=options.editable engine="prosemirror"}}
- {{editor texte target="system.texte" button=true owner=owner editable=true engine="prosemirror"}}
+ {{editor texte target="system.texte" button=true owner=options.isOwner editable=options.editable engine="prosemirror"}}
diff --git a/templates/item-faune-sheet.html b/templates/item-faune-sheet.html
index cde0c58c..2970fc02 100644
--- a/templates/item-faune-sheet.html
+++ b/templates/item-faune-sheet.html
@@ -29,7 +29,7 @@
{{#if system.actor.id}}
- {{#if isGM}}
+ {{#if options.isGM}}