From f4bb541bb75371bb7dd41682a39977bb89a947f5 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sun, 6 Dec 2020 22:19:40 +0100 Subject: [PATCH] =?UTF-8?q?#63=20Jet=20d'=C3=A9thylisme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor-sheet.js | 31 ++++++++++++++++++-------- templates/actor-sheet.html | 45 ++++++++++++++++++++++++++------------ 2 files changed, 53 insertions(+), 23 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index dd0ccfab..88ed655f 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -20,7 +20,8 @@ export class RdDActorSheet extends ActorSheet { //height: 720, tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac"}], dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}], - editCaracComp: false + editCaracComp: false, + cacherCompetencesNiveauBase: false, }); } @@ -28,6 +29,14 @@ export class RdDActorSheet extends ActorSheet { getData() { let data = super.getData(); + // Gestion du lock/unlock des zones éditables (carac+compétences) + data.data.editCaracComp = this.options.editCaracComp; + data.data.lockUnlockText = (this.options.editCaracComp) ? "Bloquer" : "Débloquer"; + // Gestion de l'affichage total/partiel des compétences + data.data.cacherCompetencesNiveauBase = this.options.cacherCompetencesNiveauBase; + data.data.showHideCompetenceText = (this.options.cacherCompetencesNiveauBase) ? "Cacher Comp." : "Montrer Comp." ; + + let compCategorieNiveau = RdDUtility.getLevelCategory(); // recup catégorie data.itemsByType = RdDUtility.buildItemsClassification(data.items); // Competence per category data.competenceByCategory = {}; @@ -41,7 +50,11 @@ export class RdDActorSheet extends ActorSheet { data.competenceByCategory[item.data.categorie] = list; } if (!RdDUtility.isTronc( item.name ) ) // Ignorer les compétences 'troncs' à ce stade - competenceXPTotal += RdDUtility.computeCompetenceXPCost(item) + competenceXPTotal += RdDUtility.computeCompetenceXPCost(item); + item.data.afficherCompetence = true; + if ( data.data.cacherCompetencesNiveauBase && (Number(item.data.niveau) == Number(compCategorieNiveau[item.data.categorie]) ) ) { + item.data.afficherCompetence = false; + } list.push(item); } } @@ -102,11 +115,7 @@ export class RdDActorSheet extends ActorSheet { data.data.isGM = game.user.isGM; data.ajustementsConditions = CONFIG.RDD.ajustementsConditions; data.difficultesLibres = CONFIG.RDD.difficultesLibres; - - // Gestion du lock/unlock des zones éditables (carac+compétences) - data.data.editCaracComp = this.options.editCaracComp; - data.data.lockUnlockText = (this.options.editCaracComp) ? "Bloquer" : "Débloquer"; - + // low is normal, this the base used to compute the grid. data.data.fatigue = { malus: RdDUtility.calculMalusFatigue(data.data.sante.fatigue.value, data.data.sante.endurance.max), @@ -351,11 +360,15 @@ export class RdDActorSheet extends ActorSheet { } // Gestion du bouton lock/unlock - html.find('.lock-unlock-sheet a').click((event) => { + html.find('.lock-unlock-sheet').click((event) => { this.options.editCaracComp = !this.options.editCaracComp; this.render(true); }); - + html.find('.show-hide-competences').click((event) => { + this.options.cacherCompetencesNiveauBase = !this.options.cacherCompetencesNiveauBase; + this.render(true); + }); + // On pts de reve change html.find('.pointsreve-value').change((event) => { let reveValue = event.currentTarget.value; diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index c0b12d6d..7ed312aa 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -52,8 +52,9 @@ + -
  • - +
  • + +
  • @@ -168,6 +169,7 @@
    + {{/if}} {{/each}} @@ -186,6 +189,7 @@
    @@ -203,6 +208,7 @@
    @@ -223,6 +230,7 @@
    @@ -241,6 +250,7 @@
    @@ -259,6 +270,7 @@ @@ -277,6 +290,7 @@ @@ -295,16 +310,18 @@