diff --git a/module/actor/export-scriptarium/mapping.js b/module/actor/export-scriptarium/mapping.js index ffb2b788..6aaee07e 100644 --- a/module/actor/export-scriptarium/mapping.js +++ b/module/actor/export-scriptarium/mapping.js @@ -327,7 +327,8 @@ export class Mapping { const txtByCategories = Object.values(byCategories) .map(it => it.competencesParNiveau) .map(byNiveau => { - const niveaux = Object.keys(byNiveau).map(it => Number(it)).sort(Misc.ascending()) + const niveaux = Object.keys(byNiveau) + .map(it => Number(it)).sort(Misc.ascending()) if (niveaux.length == 0) { return '' } diff --git a/module/item-competence.js b/module/item-competence.js index 25c6659d..f09ca6a8 100644 --- a/module/item-competence.js +++ b/module/item-competence.js @@ -190,7 +190,7 @@ export class RdDItemCompetence extends Item { /* -------------------------------------------- */ static isNiveauBase(item) { - return Number(item.system.niveau) == RdDItemCompetence.getNiveauBase(item.system.categorie, item.type); + return item.system.niveau == undefined || Number(item.system.niveau) == RdDItemCompetence.getNiveauBase(item.system.categorie, item.type); } /* -------------------------------------------- */ diff --git a/module/item-sheet.js b/module/item-sheet.js index 93e3a6c5..dd58ab6f 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -267,10 +267,17 @@ export class RdDItemSheet extends ItemSheet { /* -------------------------------------------- */ /** @override */ _updateObject(event, formData) { - if (this.item.type == 'sort') { - // Données de bonus de cases ? - formData['system.bonuscase'] = RdDItemSort.buildBonuscaseFromArrays(formData.bonusValue, formData.caseValue); + switch (this.item.type) { + case ITEM_TYPES.sort: + // Données de bonus de cases ? + formData['system.bonuscase'] = RdDItemSort.buildBonuscaseFromArrays(formData.bonusValue, formData.caseValue) + break + case ITEM_TYPES.competence: + if (formData['system.niveau'] == undefined) { + formData['system.niveau'] = formData['system.base'] + } } + return this.item.update(formData); }