diff --git a/module/actor-sheet.js b/module/actor-sheet.js
index 9ff645e3..ef9ad208 100644
--- a/module/actor-sheet.js
+++ b/module/actor-sheet.js
@@ -456,9 +456,9 @@ export class RdDActorSheet extends RdDBaseActorSheet {
/* -------------------------------------------- */
async selectTypeOeuvreToCreate() {
- let typeObjets = RdDItem.getTypesOeuvres();
+ let types = RdDItem.getTypesOeuvres();
let content = `Selectionnez le type d'oeuvre';
diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js
index e6af9247..201f845f 100644
--- a/module/actor/base-actor-sheet.js
+++ b/module/actor/base-actor-sheet.js
@@ -50,16 +50,16 @@ export class RdDBaseActorSheet extends ActorSheet {
encTotal: await this.actor.computeEncTotal(),
}
- this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
- this._appliquerRechercheObjets(formData.objets, formData.conteneurs);
+ this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.inventaires);
+ this._appliquerRechercheObjets(formData.conteneurs, formData.inventaires);
formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs);
return formData;
}
- _appliquerRechercheObjets(objets, conteneurs) {
+ _appliquerRechercheObjets(conteneurs, inventaires) {
if (this.options.recherche?.text) {
const recherche = this.options.recherche;
- const allVisible = objets.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id);
+ const allVisible = inventaires.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id);
let addVisible = conteneurs.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id)
do {
allVisible.push(...addVisible)
@@ -67,11 +67,11 @@ export class RdDBaseActorSheet extends ActorSheet {
addVisible = parentsIds.filter(id => !allVisible.includes(id))
}
while (addVisible.length > 0)
- objets.forEach(it => it.system.isHidden = !allVisible.includes(it.id))
+ inventaires.forEach(it => it.system.isHidden = !allVisible.includes(it.id))
conteneurs.forEach(it => it.system.isHidden = !allVisible.includes(it.id))
}
else {
- objets.forEach(it => it.system.isHidden = false)
+ inventaires.forEach(it => it.system.isHidden = false)
conteneurs.forEach(it => it.system.isHidden = false)
}
}
@@ -118,9 +118,10 @@ export class RdDBaseActorSheet extends ActorSheet {
formData.herbes = Misc.arrayOrEmpty(itemTypes['herbe']);
formData.nourritureboissons = Misc.arrayOrEmpty(itemTypes['nourritureboisson']);
formData.gemmes = Misc.arrayOrEmpty(itemTypes['gemme']);
- formData.monnaie = Misc.arrayOrEmpty(itemTypes['monnaie']).sort(Monnaie.triValeurEntiere());
+ formData.monnaies = Misc.arrayOrEmpty(itemTypes['monnaie']).sort(Monnaie.triValeurEntiere());
+ formData.objets = Misc.arrayOrEmpty(itemTypes['objet'])
- formData.objets = RdDItem.getItemTypesInventaire('all')
+ formData.inventaires = RdDItem.getItemTypesInventaire('all')
.map(t => Misc.arrayOrEmpty(itemTypes[t]))
.reduce((a, b) => a.concat(b), [])
.sort(Misc.ascending(it => it.name));
@@ -230,9 +231,9 @@ export class RdDBaseActorSheet extends ActorSheet {
/* -------------------------------------------- */
async selectObjetTypeToCreate() {
- let typeObjets = this.getTypesInventaire().sort(Misc.ascending(type => Misc.typeName('Item', type)));
+ let types = this.getTypesInventaire().sort(Misc.ascending(type => Misc.typeName('Item', type)));
let content = `Selectionnez le type d'équipement';
diff --git a/module/item.js b/module/item.js
index 67c2df5d..13acfb78 100644
--- a/module/item.js
+++ b/module/item.js
@@ -15,6 +15,7 @@ export const TYPES = {
conteneur: 'conteneur',
sort: 'sort',
herbe: 'herbe',
+ plante: 'plante',
faune: 'faune',
ingredient: 'ingredient',
livre: 'livre',
@@ -34,6 +35,8 @@ export const TYPES = {
maladie: 'maladie',
poison: 'poison',
oeuvre: 'oeuvre',
+ monnaie: 'monnaie',
+ munition: 'munition',
nourritureboisson: 'nourritureboisson',
service: 'service',
signedraconique: 'signedraconique',
@@ -42,7 +45,8 @@ export const TYPES = {
sortreserve: 'sortreserve',
extraitpoetique: 'extraitpoetique',
tarot: 'tarot',
- empoignade: 'empoignade'
+ empoignade: 'empoignade',
+ objet: 'objet'
}
const typesInventaireMateriel = [
TYPES.arme,
diff --git a/module/item/sheet-conteneur.js b/module/item/sheet-conteneur.js
index fc0f7948..ae1bab33 100644
--- a/module/item/sheet-conteneur.js
+++ b/module/item/sheet-conteneur.js
@@ -29,7 +29,7 @@ export class RdDConteneurItemSheet extends RdDItemInventaireSheet {
/* -------------------------------------------- */
prepareConteneurData(formData) {
RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
- this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
+ this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.inventaires);
formData.subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems;
}
diff --git a/module/rdd-utility.js b/module/rdd-utility.js
index 00c05279..c64a4330 100644
--- a/module/rdd-utility.js
+++ b/module/rdd-utility.js
@@ -339,13 +339,13 @@ export class RdDUtility {
}
/* -------------------------------------------- */
- static buildArbreDeConteneurs(conteneurs, objets) {
+ static buildArbreDeConteneurs(conteneurs, inventaires) {
let objetVersConteneur = {};
// Attribution des objets aux conteneurs
for (let conteneur of conteneurs) {
conteneur.subItems = [];
for (let id of conteneur.system.contenu ?? []) {
- let objet = objets.find(objet => (id == objet._id));
+ let objet = inventaires.find(objet => (id == objet._id));
if (objet) {
objet.estContenu = true; // Permet de filtrer ce qui est porté dans le template
objetVersConteneur[id] = conteneur._id;
@@ -354,20 +354,20 @@ export class RdDUtility {
}
}
for (let conteneur of conteneurs) {
- conteneur.system.encTotal = RdDUtility.calculEncContenu(conteneur, objets);
+ conteneur.system.encTotal = RdDUtility.calculEncContenu(conteneur, inventaires);
}
return objetVersConteneur;
}
/* -------------------------------------------- */
- static calculEncContenu(conteneur, objets) {
+ static calculEncContenu(conteneur, inventaires) {
const contenus = (conteneur.system.contenu ?? []).filter(id => id != undefined)
- .map(id => objets.find(it => (id == it.id)))
+ .map(id => inventaires.find(it => (id == it.id)))
.filter(it => it);
let enc = Number(conteneur.system.encombrement ?? 0) * Number(conteneur.system.quantite ?? 1);
for (let contenu of contenus) {
if (contenu.type == 'conteneur') {
- enc += RdDUtility.calculEncContenu(contenu, objets);
+ enc += RdDUtility.calculEncContenu(contenu, inventaires);
}
else {
enc += Number(contenu.system.encombrement ?? 0) * Number(contenu.system.quantite ?? 1)
diff --git a/templates/actor/commerce-inventaire.html b/templates/actor/commerce-inventaire.html
index 472a8277..87529b9d 100644
--- a/templates/actor/commerce-inventaire.html
+++ b/templates/actor/commerce-inventaire.html
@@ -25,7 +25,7 @@
Prix (sols)
Actions
- {{#each (trier objets) as |item id|}}
+ {{#each (trier inventaires) as |item id|}}
{{#unless item.estContenu}}
{{#if (ne item.type 'conteneur')}}
{{buildLigneInventaire item ../options}}
diff --git a/templates/actor/inventaire-monnaie.html b/templates/actor/inventaire-monnaie.html
index e9b73518..f532901c 100644
--- a/templates/actor/inventaire-monnaie.html
+++ b/templates/actor/inventaire-monnaie.html
@@ -1,7 +1,7 @@
{{#if @root.options.isObserver}}
Argent et Monnaies (fortune: {{calc.fortune.sols}} sols {{calc.fortune.deniers}} deniers)