Fix ouverture sort compendium

Pas de bonus de case pour les sorts du compendium
This commit is contained in:
2020-12-10 02:29:11 +01:00
parent 0eea44d2c5
commit 4b0ed58797
2 changed files with 11 additions and 8 deletions

View File

@ -32,8 +32,11 @@ export class RdDItemSort extends Item {
/* -------------------------------------------- */
static buildBonusCaseList( caseBonusString, newCase ) {
if (caseBonusString == undefined) {
return [];
}
let bonusCaseList = [];
let bonusCaseArray = caseBonusString.split(',');
let bonusCaseArray = caseBonusString == undefined ? [] : caseBonusString.split(',');
for( let bonusCase of bonusCaseArray) {
let bonusSplit = bonusCase.split(':');
bonusCaseList.push( { case: bonusSplit[0], bonus: bonusSplit[1] } );
@ -49,14 +52,12 @@ export class RdDItemSort extends Item {
* @param {} item
*/
static getBonusCaseList( data, newCase = false ) {
let bonusCaseList = [];
// Gestion spéciale case bonus
if ( data.item.type == 'sort') {
bonusCaseList = this.buildBonusCaseList(data.data.bonuscase, newCase );
}
return bonusCaseList;
// Gestion spéciale case bonus
if ( data.item.type == 'sort') {
return this.buildBonusCaseList(data.data.bonuscase, newCase );
}
return undefined;
}
/* -------------------------------------------- */
/** Met à jour les données de formulaire