diff --git a/module/actor-sheet.js b/module/actor-sheet.js index b0b99090..732b1922 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -216,7 +216,7 @@ export class RdDActorSheet extends ActorSheet { html.find('.item-edit').click(ev => { const li = $(ev.currentTarget).parents(".item"); - const item = this.actor.getOwnedItem(li.data("item-id")); + const item = this.actor.items.get(li.data("item-id")); item.sheet.render(true); }); // Update Inventory Item diff --git a/module/item-sheet.js b/module/item-sheet.js index aec1cc75..cd298a3f 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -48,24 +48,34 @@ export class RdDItemSheet extends ItemSheet { /* -------------------------------------------- */ async getData() { - let formData = super.getData(); + const objectData = Misc.data(this.object); + console.log("3", objectData); + + let formData ={ + title: this.title, + id: objectData.id, + type: objectData.type, + img: objectData.img, + name: objectData.name, + data: objectData.data, + isGM: game.user.isGM + } formData.categorieCompetences = RdDItemCompetence.getCategorieCompetences(); - if ( formData.item.type == 'tache' || formData.item.type == 'livre' || formData.item.type == 'meditation' || formData.item.type == 'oeuvre') { + if ( formData.type == 'tache' || formData.type == 'livre' || formData.type == 'meditation' || formData.type == 'oeuvre') { formData.caracList = duplicate(game.system.model.Actor.personnage.carac); formData.competences = await RdDUtility.loadCompendium( 'foundryvtt-reve-de-dragon.competences' ); } - if (formData.item.type == 'arme') { + if (formData.type == 'arme') { formData.competences = await RdDUtility.loadCompendium( 'foundryvtt-reve-de-dragon.competences', it => RdDItemCompetence.isCompetenceArme(it)); } - if ( formData.item.type == 'recettealchimique' ) { - RdDAlchimie.processManipulation(formData.item, this.actor && this.actor._id ); + if ( formData.type == 'recettealchimique' ) { + RdDAlchimie.processManipulation(formData.item, this.actor && this.actor.id ); } if ( this.actor ) { formData.isOwned = true; - formData.actorId = this.actor._id; + formData.actorId = this.actor.id; } formData.bonusCaseList = RdDItemSort.getBonusCaseList(formData, true); - formData.isGM = game.user.isGM; // Pour verrouiller certaines éditions return formData; } @@ -120,14 +130,16 @@ export class RdDItemSheet extends ItemSheet { /* -------------------------------------------- */ get template() { - let type = this.item.type; + //console.log(this); + let type = this.object.data.type; return `systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html`; } /* -------------------------------------------- */ /** @override */ - _updateObject(event, formData) { + _updateObject(event, formData) { // Deprecated en v0.8 à clarifier + console.log("UPDATE !", formData); // Données de bonus de cases ? formData = RdDItemSort.buildBonusCaseStringFromFormData( formData ); diff --git a/module/item-sort.js b/module/item-sort.js index d529f879..f9942b18 100644 --- a/module/item-sort.js +++ b/module/item-sort.js @@ -51,10 +51,10 @@ export class RdDItemSort extends Item { * Retourne une liste de bonus/case pour un item-sheet * @param {} item */ - static getBonusCaseList( data, newCase = false ) { + static getBonusCaseList( item, newCase = false ) { // Gestion spéciale case bonus - if ( data.item.type == 'sort') { - return this.buildBonusCaseList(data.data.bonuscase, newCase ); + if ( item.type == 'sort') { + return this.buildBonusCaseList(item.data.bonuscase, newCase ); } return undefined; } diff --git a/templates/item-arme-sheet.html b/templates/item-arme-sheet.html index 8441eccd..e7ee4b32 100644 --- a/templates/item-arme-sheet.html +++ b/templates/item-arme-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-armure-sheet.html b/templates/item-armure-sheet.html index e2bcb8af..b180f0d4 100644 --- a/templates/item-armure-sheet.html +++ b/templates/item-armure-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-casetmr-sheet.html b/templates/item-casetmr-sheet.html index c6fc3ea9..96e33db7 100644 --- a/templates/item-casetmr-sheet.html +++ b/templates/item-casetmr-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-chant-sheet.html b/templates/item-chant-sheet.html index 1d9af9ff..f24685b9 100644 --- a/templates/item-chant-sheet.html +++ b/templates/item-chant-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-competence-sheet.html b/templates/item-competence-sheet.html index 06bb9dea..cd31eb19 100644 --- a/templates/item-competence-sheet.html +++ b/templates/item-competence-sheet.html @@ -1,10 +1,10 @@
- +

{{#if isGM}} - + {{else}} {{item.name}} {{/if}} diff --git a/templates/item-competencecreature-sheet.html b/templates/item-competencecreature-sheet.html index 11760d4f..d01b24a8 100644 --- a/templates/item-competencecreature-sheet.html +++ b/templates/item-competencecreature-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-conteneur-sheet.html b/templates/item-conteneur-sheet.html index 6f291219..ffca355b 100644 --- a/templates/item-conteneur-sheet.html +++ b/templates/item-conteneur-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-danse-sheet.html b/templates/item-danse-sheet.html index ea410cf4..dc67d164 100644 --- a/templates/item-danse-sheet.html +++ b/templates/item-danse-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-herbe-sheet.html b/templates/item-herbe-sheet.html index baec3279..38234bc7 100644 --- a/templates/item-herbe-sheet.html +++ b/templates/item-herbe-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-ingredient-sheet.html b/templates/item-ingredient-sheet.html index 96d9e54b..8ab2dded 100644 --- a/templates/item-ingredient-sheet.html +++ b/templates/item-ingredient-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-jeu-sheet.html b/templates/item-jeu-sheet.html index 11649435..68d7fe97 100644 --- a/templates/item-jeu-sheet.html +++ b/templates/item-jeu-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-livre-sheet.html b/templates/item-livre-sheet.html index 88d60e54..a4a57af2 100644 --- a/templates/item-livre-sheet.html +++ b/templates/item-livre-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-maladie-sheet.html b/templates/item-maladie-sheet.html index 8c2601d9..ddd30e01 100644 --- a/templates/item-maladie-sheet.html +++ b/templates/item-maladie-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-meditation-sheet.html b/templates/item-meditation-sheet.html index 0b484acb..72af3de1 100644 --- a/templates/item-meditation-sheet.html +++ b/templates/item-meditation-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-monnaie-sheet.html b/templates/item-monnaie-sheet.html index 3133a691..5d807445 100644 --- a/templates/item-monnaie-sheet.html +++ b/templates/item-monnaie-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-munition-sheet.html b/templates/item-munition-sheet.html index eed1dc1d..7374f057 100644 --- a/templates/item-munition-sheet.html +++ b/templates/item-munition-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-musique-sheet.html b/templates/item-musique-sheet.html index 1d9af9ff..f24685b9 100644 --- a/templates/item-musique-sheet.html +++ b/templates/item-musique-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-objet-sheet.html b/templates/item-objet-sheet.html index 89a40b0f..db84dffe 100644 --- a/templates/item-objet-sheet.html +++ b/templates/item-objet-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-oeuvre-sheet.html b/templates/item-oeuvre-sheet.html index 82f2c2b0..571a11c5 100644 --- a/templates/item-oeuvre-sheet.html +++ b/templates/item-oeuvre-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-ombre-sheet.html b/templates/item-ombre-sheet.html index 216e1638..281d1ff0 100644 --- a/templates/item-ombre-sheet.html +++ b/templates/item-ombre-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-poison-sheet.html b/templates/item-poison-sheet.html index 8c2601d9..ddd30e01 100644 --- a/templates/item-poison-sheet.html +++ b/templates/item-poison-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-potion-sheet.html b/templates/item-potion-sheet.html index a78d1e35..b5ed869d 100644 --- a/templates/item-potion-sheet.html +++ b/templates/item-potion-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-queue-sheet.html b/templates/item-queue-sheet.html index 4ffbc24c..70d0dd92 100644 --- a/templates/item-queue-sheet.html +++ b/templates/item-queue-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-recettealchimique-sheet.html b/templates/item-recettealchimique-sheet.html index c8211a92..5eda4bcf 100644 --- a/templates/item-recettealchimique-sheet.html +++ b/templates/item-recettealchimique-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-recettecuisine-sheet.html b/templates/item-recettecuisine-sheet.html index 2d64730c..77b262b6 100644 --- a/templates/item-recettecuisine-sheet.html +++ b/templates/item-recettecuisine-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-rencontresTMR-sheet.html b/templates/item-rencontresTMR-sheet.html index 3f153150..9f548367 100644 --- a/templates/item-rencontresTMR-sheet.html +++ b/templates/item-rencontresTMR-sheet.html @@ -1,6 +1,6 @@
- +

diff --git a/templates/item-sheet.html b/templates/item-sheet.html index c8acc8e5..ee410077 100644 --- a/templates/item-sheet.html +++ b/templates/item-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-sort-sheet.html b/templates/item-sort-sheet.html index 5672c489..a10a79ec 100644 --- a/templates/item-sort-sheet.html +++ b/templates/item-sort-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-souffle-sheet.html b/templates/item-souffle-sheet.html index 3f153150..e22523d7 100644 --- a/templates/item-souffle-sheet.html +++ b/templates/item-souffle-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-tache-sheet.html b/templates/item-tache-sheet.html index 1fccfcdf..ca3ca804 100644 --- a/templates/item-tache-sheet.html +++ b/templates/item-tache-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-tarot-sheet.html b/templates/item-tarot-sheet.html index 752b39ef..0b57ee12 100644 --- a/templates/item-tarot-sheet.html +++ b/templates/item-tarot-sheet.html @@ -1,8 +1,8 @@
- +
-

+

diff --git a/templates/item-tete-sheet.html b/templates/item-tete-sheet.html index 3f153150..e22523d7 100644 --- a/templates/item-tete-sheet.html +++ b/templates/item-tete-sheet.html @@ -1,8 +1,8 @@
- +
-

+