diff --git a/module/actor.js b/module/actor.js index 09bf3f22..cb4fadf2 100644 --- a/module/actor.js +++ b/module/actor.js @@ -744,8 +744,8 @@ export class RdDActor extends Actor { content: message }); } - const update = { _id: comp._id, 'data.niveau': maxNiveau }; - const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity + const update = [ { _id: comp.id, 'data.niveau': maxNiveau } ]; + await this.updateEmbeddedDocuments("Item", update); // Updates one EmbeddedEntity } else { console.log("Competence not found", compName); } @@ -756,8 +756,8 @@ export class RdDActor extends Actor { let comp = this.getCompetence(compName); if (comp) { this.checkCompetenceXP(compName, compValue); - const update = { _id: comp._id, 'data.xp': compValue }; - const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity + const update = [ { _id: comp.id, 'data.xp': compValue } ]; + await this.updateEmbeddedDocuments("Item", update); // Updates one EmbeddedEntity } else { console.log("Competence not found", compName); } @@ -768,8 +768,8 @@ export class RdDActor extends Actor { async updateCompetenceXPSort(compName, compValue) { let comp = this.getCompetence(compName); if (comp) { - const update = { _id: comp._id, 'data.xp_sort': compValue }; - const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity + const update = [ { _id: comp.id, 'data.xp_sort': compValue } ]; + await this.updateEmbeddedDocuments("Item", update); // Updates one EmbeddedEntity } else { console.log("Competence not found", compName); } @@ -779,8 +779,8 @@ export class RdDActor extends Actor { async updateCompetenceArchetype(compName, compValue) { let comp = this.getCompetence(compName); if (comp) { - const update = { _id: comp._id, 'data.niveau_archetype': compValue }; - const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity + const update = [ { _id: comp.id, 'data.niveau_archetype': compValue } ]; + await this.updateEmbeddedDocuments("Item", update); // Updates one EmbeddedEntity } else { console.log("Competence not found", compName); } @@ -885,7 +885,7 @@ export class RdDActor extends Actor { this.buildSubConteneurObjetList(itemId, list); //console.log("List to delete", list); for (let item of list) { - await this.deleteOwnedItem(item.id); + await this.deleteEmbeddedDocuments("Item", [item.id] ); } } @@ -904,7 +904,7 @@ export class RdDActor extends Actor { contenu.splice(index, 1); index = contenu.indexOf(itemId); } - await this.updateEmbeddedEntity("OwnedItem", data2use); + await this.updateEmbeddedDocuments("Item", data2use); } } @@ -917,7 +917,7 @@ export class RdDActor extends Actor { if (conteneur && conteneur.type == 'conteneur') { let data2use = duplicate(conteneur.data); data2use.data.contenu.push(itemId); - await this.updateEmbeddedEntity("OwnedItem", data2use); + await this.updateEmbeddedDocuments("Item", [data2use]); } } @@ -932,7 +932,7 @@ export class RdDActor extends Actor { } } if (conteneurFixedList.length > 0) - await this.updateOwnedItem(conteneurFixedList); + await this.updateEmbeddedDocuments('Item', conteneurFixedList); } /* -------------------------------------------- */ @@ -945,7 +945,7 @@ export class RdDActor extends Actor { let itemMap = {}; for (let item of itemsList) { let srcItem = sourceActor.data.items.find(subItem => subItem._id == item.id); - let newItem = await this.createOwnedItem(duplicate(srcItem)); + let newItem = await this.createEmbeddedDocuments("Item", [ duplicate(srcItem) ] ); console.log('New object', newItem, srcItem); itemMap[srcItem._id] = newItem._id; // Pour garder le lien ancien / nouveau } @@ -960,11 +960,11 @@ export class RdDActor extends Actor { console.log('New conteneur filling!', newConteneur, newItemId, item); let contenu = duplicate(newConteneur.data.contenu); contenu.push(newItemId); - await this.updateOwnedItem({ _id: newConteneurId, 'data.contenu': contenu }); + await this.updateEmbeddedDocuments( "Item", [{ _id: newConteneurId, 'data.contenu': contenu } ]); } } for (let item of itemsList) { - await sourceActor.deleteOwnedItem(item.id); + await sourceActor.deleteEmbeddedDocuments("Item", [ item.id] ); } } @@ -3139,7 +3139,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ _deleteStatusEffectsByIds(effectIds, options) { - this.deleteEmbeddedEntity('ActiveEffect', effectIds, options); + this.deleteEmbeddedDocuments('ActiveEffect', effectIds, options); this.applyActiveEffects(); } @@ -3154,7 +3154,7 @@ export class RdDActor extends Actor { this.deleteStatusEffectById(statusEffect.id, options); const effet = duplicate(statusEffect); effet["flags.core.statusId"] = effet.id; - await this.createEmbeddedEntity('ActiveEffect', effet, options); + await this.createEmbeddedDocuments('ActiveEffect', effet, options); this.applyActiveEffects(); } diff --git a/module/item-sheet.js b/module/item-sheet.js index dcb0d42a..093ce575 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -48,6 +48,7 @@ export class RdDItemSheet extends ItemSheet { /* -------------------------------------------- */ async getData() { let data = super.getData(); + data.categorieCompetences = RdDUtility.getCategorieCompetences(); if ( data.item.type == 'tache' || data.item.type == 'livre' || data.item.type == 'meditation' || data.item.type == 'oeuvre') { data.caracList = duplicate(game.system.model.Actor.personnage.carac); @@ -129,7 +130,7 @@ export class RdDItemSheet extends ItemSheet { _updateObject(event, formData) { // Données de bonus de cases ? formData = RdDItemSort.buildBonusCaseStringFromFormData( formData ); - + //console.log("HERE", this, formData, this.object.data ); return this.object.update(formData); } } diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index a3bcff7e..6677aad8 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -176,7 +176,7 @@ export class RdDTMRDialog extends Dialog { updateValuesDisplay() { let ptsreve = document.getElementById("tmr-pointsreve-value"); ptsreve.innerHTML = this.actor.data.data.reve.reve.value; - + console.log( this.actor.data.data ); let tmrpos = document.getElementById("tmr-pos"); let tmr = TMRUtility.getTMR(this.actor.data.data.reve.tmrpos.coord); tmrpos.innerHTML = this.actor.data.data.reve.tmrpos.coord + " (" + tmr.label + ")"; diff --git a/templates/item-arme-sheet.html b/templates/item-arme-sheet.html index 3d5f9a69..43179e10 100644 --- a/templates/item-arme-sheet.html +++ b/templates/item-arme-sheet.html @@ -11,83 +11,83 @@
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
@@ -95,7 +95,7 @@
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-armure-sheet.html b/templates/item-armure-sheet.html index e2bcb8af..906f4dc2 100644 --- a/templates/item-armure-sheet.html +++ b/templates/item-armure-sheet.html @@ -10,28 +10,28 @@
- +
- +
- +
- +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-casetmr-sheet.html b/templates/item-casetmr-sheet.html index c6fc3ea9..d1ecf329 100644 --- a/templates/item-casetmr-sheet.html +++ b/templates/item-casetmr-sheet.html @@ -10,12 +10,12 @@
- +
@@ -23,7 +23,7 @@
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-chant-sheet.html b/templates/item-chant-sheet.html index 1d9af9ff..86c909bc 100644 --- a/templates/item-chant-sheet.html +++ b/templates/item-chant-sheet.html @@ -10,16 +10,16 @@
- +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-competence-sheet.html b/templates/item-competence-sheet.html index f1b01bb2..da5065a3 100644 --- a/templates/item-competence-sheet.html +++ b/templates/item-competence-sheet.html @@ -16,7 +16,7 @@
- {{#select item.data.data.categorie}} {{>"systems/foundryvtt-reve-de-dragon/templates/enum-categorie-competence.html"}} {{/select}} @@ -24,15 +24,15 @@
- +
- +
- {{#select item.data.data.base}} {{>"systems/foundryvtt-reve-de-dragon/templates/competence-base.html"}} {{/select}} @@ -40,7 +40,7 @@
- {{#select item.data.data.defaut_carac}} {{>"systems/foundryvtt-reve-de-dragon/templates/competence-carac-defaut.html"}} {{/select}} @@ -48,22 +48,22 @@
- +
{{#if (eq data.data.categorie 'draconic')}}
- +
{{/if}}
- +
- {{editor content=data.data.description target="data.data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-competencecreature-sheet.html b/templates/item-competencecreature-sheet.html index 11760d4f..749298f6 100644 --- a/templates/item-competencecreature-sheet.html +++ b/templates/item-competencecreature-sheet.html @@ -10,39 +10,39 @@
- +
- +
- +
- +
- +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-conteneur-sheet.html b/templates/item-conteneur-sheet.html index 6f291219..a7569dd7 100644 --- a/templates/item-conteneur-sheet.html +++ b/templates/item-conteneur-sheet.html @@ -10,24 +10,24 @@
- +
- +
- +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-danse-sheet.html b/templates/item-danse-sheet.html index ea410cf4..a9d07a85 100644 --- a/templates/item-danse-sheet.html +++ b/templates/item-danse-sheet.html @@ -11,7 +11,7 @@
+
- +
- +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-herbe-sheet.html b/templates/item-herbe-sheet.html index baec3279..f1b55dd0 100644 --- a/templates/item-herbe-sheet.html +++ b/templates/item-herbe-sheet.html @@ -11,24 +11,24 @@
- +
- +
- +
- +
@@ -36,7 +36,7 @@
@@ -44,7 +44,7 @@
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-ingredient-sheet.html b/templates/item-ingredient-sheet.html index 96d9e54b..680ed754 100644 --- a/templates/item-ingredient-sheet.html +++ b/templates/item-ingredient-sheet.html @@ -11,29 +11,29 @@
- +
- +
- +
- +
- +
@@ -41,7 +41,7 @@
@@ -49,7 +49,7 @@
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-jeu-sheet.html b/templates/item-jeu-sheet.html index 11649435..c5c7a4a5 100644 --- a/templates/item-jeu-sheet.html +++ b/templates/item-jeu-sheet.html @@ -11,7 +11,7 @@
+
- +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-livre-sheet.html b/templates/item-livre-sheet.html index 88d60e54..4dabd130 100644 --- a/templates/item-livre-sheet.html +++ b/templates/item-livre-sheet.html @@ -10,12 +10,12 @@
- +
+
- +
- +
- +
- +
- +
- +
- +
{{#if isOwned}}
@@ -62,7 +62,7 @@
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-maladie-sheet.html b/templates/item-maladie-sheet.html index 8c2601d9..b78c7ebc 100644 --- a/templates/item-maladie-sheet.html +++ b/templates/item-maladie-sheet.html @@ -10,24 +10,24 @@
- +
- +
- +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-meditation-sheet.html b/templates/item-meditation-sheet.html index 0b484acb..e8807738 100644 --- a/templates/item-meditation-sheet.html +++ b/templates/item-meditation-sheet.html @@ -11,7 +11,7 @@
+
- +
- +
- +
- +
@@ -58,7 +58,7 @@ {{#if isGM}} {{else}} - + {{/if}}
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-monnaie-sheet.html b/templates/item-monnaie-sheet.html index 3133a691..86f827b8 100644 --- a/templates/item-monnaie-sheet.html +++ b/templates/item-monnaie-sheet.html @@ -10,19 +10,19 @@
- +
{{#if isGM}} - + {{else}} {{/if}}
- +
diff --git a/templates/item-munition-sheet.html b/templates/item-munition-sheet.html index eed1dc1d..96c15e26 100644 --- a/templates/item-munition-sheet.html +++ b/templates/item-munition-sheet.html @@ -10,24 +10,24 @@
- +
- +
- +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-musique-sheet.html b/templates/item-musique-sheet.html index 1d9af9ff..86c909bc 100644 --- a/templates/item-musique-sheet.html +++ b/templates/item-musique-sheet.html @@ -10,16 +10,16 @@
- +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-objet-sheet.html b/templates/item-objet-sheet.html index 89a40b0f..81fca331 100644 --- a/templates/item-objet-sheet.html +++ b/templates/item-objet-sheet.html @@ -10,28 +10,28 @@
- +
- +
- +
- +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-oeuvre-sheet.html b/templates/item-oeuvre-sheet.html index 82f2c2b0..b2a27c6a 100644 --- a/templates/item-oeuvre-sheet.html +++ b/templates/item-oeuvre-sheet.html @@ -11,7 +11,7 @@
@@ -19,7 +19,7 @@
+
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-ombre-sheet.html b/templates/item-ombre-sheet.html index 216e1638..885c6887 100644 --- a/templates/item-ombre-sheet.html +++ b/templates/item-ombre-sheet.html @@ -10,11 +10,11 @@
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-poison-sheet.html b/templates/item-poison-sheet.html index 8c2601d9..b78c7ebc 100644 --- a/templates/item-poison-sheet.html +++ b/templates/item-poison-sheet.html @@ -10,24 +10,24 @@
- +
- +
- +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-potion-sheet.html b/templates/item-potion-sheet.html index a78d1e35..ec5bf99d 100644 --- a/templates/item-potion-sheet.html +++ b/templates/item-potion-sheet.html @@ -10,20 +10,20 @@
- +
- +
- +
@@ -31,7 +31,7 @@
@@ -39,7 +39,7 @@
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-queue-sheet.html b/templates/item-queue-sheet.html index 4ffbc24c..6440c0ed 100644 --- a/templates/item-queue-sheet.html +++ b/templates/item-queue-sheet.html @@ -10,12 +10,12 @@
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-recettealchimique-sheet.html b/templates/item-recettealchimique-sheet.html index c8211a92..96852ada 100644 --- a/templates/item-recettealchimique-sheet.html +++ b/templates/item-recettealchimique-sheet.html @@ -10,36 +10,36 @@
- +
- {{editor content=data.manipulation_update target="data.manipulation" button=true owner=owner editable=editable}} + {{editor content=data.data.manipulation_update target="data.manipulation" button=true owner=owner editable=editable}}
- {{editor content=data.utilisation target="data.utilisation" button=true owner=owner editable=editable}} + {{editor content=data.data.utilisation target="data.utilisation" button=true owner=owner editable=editable}}
- {{editor content=data.enchantement target="data.enchantement" button=true owner=owner editable=editable}} + {{editor content=data.data.enchantement target="data.enchantement" button=true owner=owner editable=editable}}
- {{editor content=data.sureffet target="data.sureffet" button=true owner=owner editable=editable}} + {{editor content=data.data.sureffet target="data.sureffet" button=true owner=owner editable=editable}}
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-recettecuisine-sheet.html b/templates/item-recettecuisine-sheet.html index 2d64730c..17c93c55 100644 --- a/templates/item-recettecuisine-sheet.html +++ b/templates/item-recettecuisine-sheet.html @@ -10,34 +10,34 @@
- +
- +
- +
- +
- {{editor content=data.ingredients target="data.ingredients" button=true owner=owner editable=editable}} + {{editor content=data.data.ingredients target="data.ingredients" button=true owner=owner editable=editable}}
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-rencontresTMR-sheet.html b/templates/item-rencontresTMR-sheet.html index 3f153150..d9add1e5 100644 --- a/templates/item-rencontresTMR-sheet.html +++ b/templates/item-rencontresTMR-sheet.html @@ -11,7 +11,7 @@
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-sheet.html b/templates/item-sheet.html deleted file mode 100644 index c8acc8e5..00000000 --- a/templates/item-sheet.html +++ /dev/null @@ -1,64 +0,0 @@ -
-
- -
-

-
- - -
-
- - -
-
-
- - {{!-- Sheet Tab Navigation --}} - - - {{!-- Sheet Body --}} -
- - {{!-- Description Tab --}} -
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} -
- - {{!-- Attributes Tab --}} -
-
- Attribute Key - Value - Label - Data Type - -
- -
    - {{#each data.attributes as |attr key|}} -
  1. - - {{#if attr.isCheckbox}} - - {{else}} - - {{/if}} - - - -
  2. - {{/each}} -
-
-
-
diff --git a/templates/item-sort-sheet.html b/templates/item-sort-sheet.html index a77801a0..78b5190a 100644 --- a/templates/item-sort-sheet.html +++ b/templates/item-sort-sheet.html @@ -11,7 +11,7 @@
@@ -19,7 +19,7 @@
+
- +
- +
- +
- +
- +
- +
- +
- +
- +
{{#if owner}} {{#each bonusCaseList as |bcData key|}} @@ -77,7 +77,7 @@
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-souffle-sheet.html b/templates/item-souffle-sheet.html index 3f153150..d9add1e5 100644 --- a/templates/item-souffle-sheet.html +++ b/templates/item-souffle-sheet.html @@ -11,7 +11,7 @@
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-tache-sheet.html b/templates/item-tache-sheet.html index 1fccfcdf..0c5b361f 100644 --- a/templates/item-tache-sheet.html +++ b/templates/item-tache-sheet.html @@ -11,7 +11,7 @@
- {{#select item.data.competence}} + {{#select item.data.data.competence}} {{#each competences as |competence key|}} {{/each}} @@ -30,27 +30,27 @@
- +
- +
- +
- +
- +
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-tarot-sheet.html b/templates/item-tarot-sheet.html index 752b39ef..606722e1 100644 --- a/templates/item-tarot-sheet.html +++ b/templates/item-tarot-sheet.html @@ -11,12 +11,12 @@
- +
@@ -24,7 +24,7 @@
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}
diff --git a/templates/item-tete-sheet.html b/templates/item-tete-sheet.html index 3f153150..d9add1e5 100644 --- a/templates/item-tete-sheet.html +++ b/templates/item-tete-sheet.html @@ -11,7 +11,7 @@
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=data.data.description target="data.description" button=true owner=owner editable=editable}}