diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 614dec35..3817ec8d 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -220,7 +220,36 @@ export class RdDUtility { Handlebars.registerHelper('caseTmr-type', coord => TMRUtility.getTMRType(coord)); Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord)); Handlebars.registerHelper('equals', (a, b) => a == b); - Handlebars.registerHelper('sortCompetence', competences => competences.sort((a, b) => { return a.name.localeCompare(b.name); }) ); + 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; + 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); }