diff --git a/module/actor.js b/module/actor.js index c9bc7fae..369bc762 100644 --- a/module/actor.js +++ b/module/actor.js @@ -240,7 +240,7 @@ export class RdDActor extends RdDBaseActorSang { } async _recuperationSante(message) { - const maladiesPoisons = this.getMaladiePoisons(); + const maladiesPoisons = this.getMaladiesPoisons(); const isMaladeEmpoisonne = maladiesPoisons.length > 0; this._messageRecuperationMaladiePoisons(maladiesPoisons, message); @@ -248,7 +248,7 @@ export class RdDActor extends RdDBaseActorSang { await this._recupererVie(message, isMaladeEmpoisonne); } - getMaladiePoisons() { + getMaladiesPoisons() { return this.items.filter(item => item.type == 'maladie' || (item.type == 'poison' && item.system.active)); } diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js index 0106ff96..89f2fa1f 100644 --- a/module/actor/base-actor-sheet.js +++ b/module/actor/base-actor-sheet.js @@ -81,48 +81,13 @@ export class RdDBaseActorSheet extends ActorSheet { /* -------------------------------------------- */ static filterItemsPerTypeForSheet(formData, itemTypes) { - formData.blessures = Misc.arrayOrEmpty(itemTypes['blessure']); - formData.recettescuisine = Misc.arrayOrEmpty(itemTypes['recettecuisine']); - formData.recettesAlchimiques = Misc.arrayOrEmpty(itemTypes['recettealchimique']); - formData.maladies = Misc.arrayOrEmpty(itemTypes['maladie']); - formData.poisons = Misc.arrayOrEmpty(itemTypes['poison']); - formData.possessions = Misc.arrayOrEmpty(itemTypes['possession']); - formData.maladiesPoisons = formData.maladies.concat(formData.poisons); - formData.competences = (itemTypes['competence'] ?? []).concat(itemTypes['competencecreature'] ?? []); - formData.sortsReserve = Misc.arrayOrEmpty(itemTypes['sortreserve']); + Object.values(ITEM_TYPES).forEach(t => { + formData[t + 's'] = Misc.arrayOrEmpty(itemTypes[t]) + }) - formData.sorts = Misc.arrayOrEmpty(itemTypes['sort']); - formData.rencontres = Misc.arrayOrEmpty(itemTypes['rencontre']); - formData.casestmr = Misc.arrayOrEmpty(itemTypes['casetmr']); - formData.signesdraconiques = Misc.arrayOrEmpty(itemTypes['signedraconique']); - formData.queues = Misc.arrayOrEmpty(itemTypes['queue']); - formData.souffles = Misc.arrayOrEmpty(itemTypes['souffle']); - formData.ombres = Misc.arrayOrEmpty(itemTypes['ombre']); - formData.tetes = Misc.arrayOrEmpty(itemTypes['tete']); - formData.taches = Misc.arrayOrEmpty(itemTypes['tache']); - formData.meditations = Misc.arrayOrEmpty(itemTypes['meditation']); - formData.chants = Misc.arrayOrEmpty(itemTypes['chant']); - formData.danses = Misc.arrayOrEmpty(itemTypes['danse']); - formData.musiques = Misc.arrayOrEmpty(itemTypes['musique']); - formData.oeuvres = Misc.arrayOrEmpty(itemTypes['oeuvre']); - formData.jeux = Misc.arrayOrEmpty(itemTypes['jeu']); - - formData.services = Misc.arrayOrEmpty(itemTypes['service']); - formData.conteneurs = Misc.arrayOrEmpty(itemTypes['conteneur']); - formData.materiel = Misc.arrayOrEmpty(itemTypes['objet']); - formData.armes = Misc.arrayOrEmpty(itemTypes['arme']); - formData.armures = Misc.arrayOrEmpty(itemTypes['armure']); - formData.munitions = Misc.arrayOrEmpty(itemTypes['munition']); - formData.livres = Misc.arrayOrEmpty(itemTypes['livre']); - formData.potions = Misc.arrayOrEmpty(itemTypes['potion']); - formData.plantes = Misc.arrayOrEmpty(itemTypes['plante']); - formData.ingredients = Misc.arrayOrEmpty(itemTypes['ingredient']); - formData.faunes = Misc.arrayOrEmpty(itemTypes['faune']); - formData.herbes = Misc.arrayOrEmpty(itemTypes['herbe']); - formData.nourritureboissons = Misc.arrayOrEmpty(itemTypes['nourritureboisson']); - formData.gemmes = Misc.arrayOrEmpty(itemTypes['gemme']); - formData.monnaies = Misc.arrayOrEmpty(itemTypes['monnaie']).sort(Monnaie.triValeurEntiere()); - formData.objets = Misc.arrayOrEmpty(itemTypes['objet']) + formData.maladiesPoisons = formData.maladies.concat(formData.poisons) + formData.competences = formData.competences.concat(formData.competencecreatures) + formData.monnaies = formData.monnaies.sort(Monnaie.triValeurEntiere()) formData.inventaires = RdDItem.getItemTypesInventaire('all') .map(t => Misc.arrayOrEmpty(itemTypes[t])) diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index a805954f..e738c971 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -212,7 +212,7 @@ export class RdDTMRDialog extends Dialog { } getSortsReserve(coord) { - return this.actor.itemTypes[ITEM_TYPES.sortreserve].filter(// Reserve sur une case fleuve ou normale + return this.sortsReserve.filter(// Reserve sur une case fleuve ou normale TMRUtility.getTMR(coord).type == 'fleuve' ? it => TMRUtility.getTMR(it.system.coord).type == 'fleuve' : it => it.system.coord == coord @@ -271,8 +271,7 @@ export class RdDTMRDialog extends Dialog { } _getTokensSortsReserve() { - const sortsReserve = this.actor.itemTypes[ITEM_TYPES.sortreserve]; - return Misc.concat(sortsReserve.map(sortReserve => + return Misc.concat(this.sortsReserve.map(sortReserve => EffetsDraconiques.sortReserve.tokens(this.pixiTMR, sortReserve, () => sortReserve.system.coord))) } @@ -908,8 +907,8 @@ export class RdDTMRDialog extends Dialog { /* -------------------------------------------- */ lancerSortEnReserve(coord, sortId) { - let sorts = this.getSortsReserve(coord); - let sort = sorts.find(it => it.id == sortId); + const sort = this.getSortsReserve(coord) + .find(it => it.id == sortId); if (sort) { this.processSortReserve(sort); } else { diff --git a/module/rdd-utility.js b/module/rdd-utility.js index b4da7b51..4504ebfe 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -145,7 +145,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor/taches.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/jeux.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/jeus.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html', @@ -160,17 +160,17 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts-reserve.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-meditations.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-casestmr.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/hr-casetmrs.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/xp-journal.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/editor-notes-mj.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.hbs', "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.html", 'systems/foundryvtt-reve-de-dragon/templates/actor/liens-animaux.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/liens-suivants.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/liens-vehicules.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.hbs', //Items 'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete-script.hbs', 'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete.hbs', @@ -436,8 +436,8 @@ export class RdDUtility { }; if (!optionsArbre.templateItem) { optionsArbre.templateItem = item.parent?.type == 'commerce' - ? "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.html" - : "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.html"; + ? "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.hbs" + : "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.hbs"; } item.niveau = optionsArbre.profondeur; } diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index fdc3c8c0..d6f4d61b 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -122,7 +122,7 @@ {{> "systems/foundryvtt-reve-de-dragon/templates/actor/taches.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.html"}} - {{> "systems/foundryvtt-reve-de-dragon/templates/actor/jeux.html"}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor/jeus.hbs"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html"}} {{/if}} diff --git a/templates/actor/alchimie.html b/templates/actor/alchimie.html index f10c0da8..2b0f5826 100644 --- a/templates/actor/alchimie.html +++ b/templates/actor/alchimie.html @@ -1,7 +1,7 @@ -{{#if recettesAlchimiques.length}} +{{#if recettealchimiques.length}}

Recettes Alchimiques