diff --git a/module/actor.js b/module/actor.js index 8165d919..1a033a73 100644 --- a/module/actor.js +++ b/module/actor.js @@ -262,9 +262,9 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ getBestDraconic() { - const list = this.getDraconicList().sort((a, b) => b.data.niveau - a.data.niveau); + const list = this.getDraconicList().sort((a, b) => b.data.data.niveau - a.data.data.niveau); if (list.length == 0) { - return { name: "Aucun", data: { niveau: -11 } }; + return { name: "Aucun", data: { name: "Aucun", data: { niveau: -11 } } }; } return duplicate(list[0]); } @@ -1742,13 +1742,14 @@ export class RdDActor extends Actor { let bestDraconic = this.getBestDraconic(); for (let sort of sortList) { let voie = sort.data.draconic.toLowerCase(); - let draconic = draconicList.find(it => it.data.categorie == 'draconic' && it.name.toLowerCase().includes(voie)); + let draconic = draconicList.find(it => it.data.data.categorie == 'draconic' && it.data.name.toLowerCase().includes(voie)); + //console.log(draconicList, bestDraconic, draconic, voie); if (sort.name.toLowerCase().includes('aura')) { draconic = bestDraconic; } draconic = duplicate(draconic); if (draconicDone[draconic.name] == undefined) { - draconic.data.defaut_carac = 'reve'; + draconic.data.data.defaut_carac = 'reve'; newDraconicList.push(draconic); draconicDone[draconic.name] = newDraconicList.length - 1; // Patch local pour relier facilement voie/compétence } @@ -2029,8 +2030,8 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async rollTache(id) { let tache = duplicate(this.getTache(id)); - let competence = duplicate(this.getCompetence(tache.data.competence)); - competence.data.defaut_carac = tache.data.carac; // Patch ! + let competence = this.getCompetence(tache.data.competence); + competence.data.data.defaut_carac = tache.data.carac; // Patch ! let rollData = { competence: competence, tache: tache, @@ -2436,12 +2437,12 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ getSortList() { - return this.data.items.filter(it => it.type == "sort"); + return this.data.items.filter(it => it.data.type == "sort"); } /* -------------------------------------------- */ getDraconicList() { - return this.data.items.filter(it => it.data.categorie == 'draconic') + return this.data.items.filter(it => it.data.data.categorie == 'draconic') } /* -------------------------------------------- */ @@ -3108,7 +3109,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ _deleteStatusEffectsByIds(effectIds, options) { - this.deleteEmbeddedEntity('ActiveEffect', effectIds, options); + this.deleteEmbeddedDocument('ActiveEffect', effectIds, options); } /* -------------------------------------------- */ diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 4f796a60..e8625e98 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -141,11 +141,12 @@ export class RdDRoll extends Dialog { function onLoad() { let rollData = dialog.rollData; + console.log(rollData); // Update html, according to data if (rollData.competence) { // Set the default carac from the competence item - rollData.selectedCarac = rollData.carac[rollData.competence.data.defaut_carac]; - $("#carac").val(rollData.competence.data.defaut_carac); + rollData.selectedCarac = rollData.carac[rollData.competence.data.data.defaut_carac]; + $("#carac").val(rollData.competence.data.data.defaut_carac); } if (rollData.selectedSort) { $("#draconic").val(rollData.selectedSort.data.listIndex); // Uniquement a la selection du sort, pour permettre de changer diff --git a/module/tmr/effets-draconiques.js b/module/tmr/effets-draconiques.js index a73fc272..a8cabd23 100644 --- a/module/tmr/effets-draconiques.js +++ b/module/tmr/effets-draconiques.js @@ -186,7 +186,7 @@ export class EffetsDraconiques { } static toItems(item) { - return (item?.entity === 'Actor') ? item.data.items : (item?.entity === 'Item') ? [Misc.data(item)] : []; + return (item?.documentName === 'Actor') ? item.data.items : (item?.documentName === 'Item') ? [Misc.data(item)] : []; } } \ No newline at end of file diff --git a/templates/item-tache-sheet.html b/templates/item-tache-sheet.html index ca3ca804..08ec7cf0 100644 --- a/templates/item-tache-sheet.html +++ b/templates/item-tache-sheet.html @@ -11,7 +11,7 @@
- {{#select item.data.competence}} + {{#select data.competence}} {{#each competences as |competence key|}} {{/each}}