diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 3b927d64..e16f28db 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -239,36 +239,38 @@ export class RdDUtility { Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord)); Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1))); - Handlebars.registerHelper('sortCompetence', competences => competences.sort((a, b) => { - if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) { - if (a.name.includes("Cité")) return -1; - if (b.name.includes("Cité")) return 1; - if (a.name.includes("Extérieur")) return -1; - if (b.name.includes("Extérieur")) return 1; + Handlebars.registerHelper('filtreTriCompetences', competences => competences.filter(it => it.visible) + .sort((a, b) => { + if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) { + if (a.name.includes("Cité")) return -1; + if (b.name.includes("Cité")) return 1; + if (a.name.includes("Extérieur")) return -1; + if (b.name.includes("Extérieur")) return 1; + return a.name.localeCompare(b.name); + } + if (a.data.categorie.startsWith("melee") && b.data.categorie.startsWith("melee")) { + if (a.name.includes("Corps")) return -1; + if (b.name.includes("Corps")) return 1; + if (a.name.includes("Dague")) return -1; + if (b.name.includes("Dague")) return 1; + if (a.name.includes("Esquive")) return -1; + if (b.name.includes("Esquive")) return 1; + return a.name.localeCompare(b.name); + } + if (a.name.startsWith("Voie") && b.name.startsWith("Voie")) { + if (a.name.includes("Oniros")) return -1; + if (b.name.includes("Oniros")) return 1; + if (a.name.includes("Hypnos")) return -1; + if (b.name.includes("Hypnos")) return 1; + if (a.name.includes("Narcos")) return -1; + if (b.name.includes("Narcos")) return 1; + if (a.name.includes("Thanatos")) return -1; + if (b.name.includes("Thanatos")) return 1; + return a.name.localeCompare(b.name); + } return a.name.localeCompare(b.name); - } - if (a.data.categorie.startsWith("melee") && b.data.categorie.startsWith("melee")) { - if (a.name.includes("Corps")) return -1; - if (b.name.includes("Corps")) return 1; - if (a.name.includes("Dague")) return -1; - if (b.name.includes("Dague")) return 1; - if (a.name.includes("Esquive")) return -1; - if (b.name.includes("Esquive")) return 1; - return a.name.localeCompare(b.name); - } - if (a.name.startsWith("Voie") && b.name.startsWith("Voie")) { - if (a.name.includes("Oniros")) return -1; - if (b.name.includes("Oniros")) return 1; - if (a.name.includes("Hypnos")) return -1; - if (b.name.includes("Hypnos")) return 1; - if (a.name.includes("Narcos")) return -1; - if (b.name.includes("Narcos")) return 1; - if (a.name.includes("Thanatos")) return -1; - if (b.name.includes("Thanatos")) return 1; - return a.name.localeCompare(b.name); - } - return a.name.localeCompare(b.name); - })); + }) + ); return loadTemplates(templatePaths); } diff --git a/templates/actor-sheet-categorie-competences-partial.html b/templates/actor-sheet-categorie-competences-partial.html index 75ea7bd4..26d7a1db 100644 --- a/templates/actor-sheet-categorie-competences-partial.html +++ b/templates/actor-sheet-categorie-competences-partial.html @@ -1,27 +1,31 @@ -
- {{categorie}} -
- +
+ + Arch + + {{#if @root.options.isGM}} + + {{/if}} +
+ + {{/if}} + {{#each competences as |comp key|}} + {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} + {{/each}} + + +{{/if}}