Version 10.0.30 #567
@ -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);
|
||||
}
|
||||
|
@ -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<formData.bonusValue.length; i++) {
|
||||
let coord = formData.caseValue[i] || 'A1';
|
||||
coord = coord.toUpperCase();
|
||||
if ( TMRUtility.verifyTMRCoord( coord ) ) { // Sanity check
|
||||
let bonus = formData.bonusValue[i] || 0;
|
||||
if ( bonus > 0 && caseCheck[coord] == undefined ) {
|
||||
caseCheck[coord] = bonus;
|
||||
list.push( coord+":"+bonus );
|
||||
}
|
||||
for (let i=0; i<bonuses.length; i++) {
|
||||
let coord = cases[i]?.toUpperCase() || 'A1';
|
||||
let bonus = bonuses[i] || 0;
|
||||
if ( TMRUtility.verifyTMRCoord( coord ) && bonus > 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;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user