diff --git a/module/item-sheet.js b/module/item-sheet.js index 1a92be79..0a2302b0 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -250,9 +250,9 @@ export class RdDItemSheet extends ItemSheet { /* -------------------------------------------- */ /** @override */ - _updateObject(event, formData) { // Deprecated en v0.8 à clarifier + _updateObject(event, formData) { // Données de bonus de cases ? - formData = RdDItemSort.buildBonusCaseStringFromFormData(formData); + formData['system.bonuscase'] = RdDItemSort.buildBonusCaseStringFromFormData(formData.bonusValue, formData.caseValue); return this.item.update(formData); } diff --git a/module/item-sort.js b/module/item-sort.js index 5047cc23..befbb6b0 100644 --- a/module/item-sort.js +++ b/module/item-sort.js @@ -63,26 +63,21 @@ export class RdDItemSort extends Item { /** Met à jour les données de formulaire * si static des bonus de cases sont présents * */ - static buildBonusCaseStringFromFormData( formData ) { - if ( formData.bonusValue ) { + static buildBonusCaseStringFromFormData( bonuses, cases ) { + if ( bonuses ) { let list = []; let caseCheck = {}; - for(let i=0; i 0 && caseCheck[coord] == undefined ) { - caseCheck[coord] = bonus; - list.push( coord+":"+bonus ); - } + for (let i=0; i 0 && caseCheck[coord] == undefined ) { + caseCheck[coord] = bonus; + list.push( coord+":"+bonus ); } } - formData.bonusValue = undefined; - formData.caseValue = undefined; - formData.system.bonuscase = list.toString(); // Reset + return list.toString(); } - return formData; + return undefined; } /* -------------------------------------------- */