Cleanup
This commit is contained in:
@ -281,4 +281,36 @@ export class RdDItemCompetence extends Item {
|
||||
return duplicate(limitesArchetypes);
|
||||
}
|
||||
|
||||
static triVisible(competences) {
|
||||
return competences.filter(it => it.system.isVisible)
|
||||
.sort((a, b) => RdDItemCompetence.compare(a,b))
|
||||
}
|
||||
|
||||
static $positionTri(comp) {
|
||||
if (comp.name.startsWith("Survie")) {
|
||||
if (comp.name.includes("Cité")) return 0;
|
||||
if (comp.name.includes("Extérieur")) return 1;
|
||||
return 2;
|
||||
}
|
||||
if (comp.system.categorie.startsWith("melee")) {
|
||||
if (comp.name.includes("Corps")) return 0;
|
||||
if (comp.name.includes("Dague")) return 1;
|
||||
if (comp.name.includes("Esquive")) return 2;
|
||||
return 3;
|
||||
}
|
||||
if (comp.system.categorie.startsWith("draconic")) {
|
||||
if (comp.name.includes("Oniros")) return 0;
|
||||
if (comp.name.includes("Hypnos")) return 1;
|
||||
if (comp.name.includes("Narcos")) return 2;
|
||||
if (comp.name.includes("Thanatos")) return 3;
|
||||
return 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static compare(a,b) {
|
||||
const diff = RdDItemCompetence.$positionTri(a) - RdDItemCompetence.$positionTri(b);
|
||||
return diff ? diff : a.name.localeCompare(b.name);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user