Fix #142 - Perks alpha sorted

This commit is contained in:
sladecraven 2022-11-26 12:03:21 +01:00
parent 50f4339454
commit 43d4acaea4

View File

@ -371,12 +371,13 @@ export class PegasusActorCreate {
async showRoleStartSpec() { async showRoleStartSpec() {
if (!this.roleSpecStart) { if (!this.roleSpecStart) {
this.roleSpecStart = this.specs.filter(spec => spec.system.statistic.toUpperCase() == this.currentRole.system.statincrease1.toUpperCase() || spec.system.statistic.toUpperCase() == this.currentRole.system.statincrease2.toUpperCase()) this.roleSpecStart = this.specs.filter(spec => spec.system.statistic.toUpperCase() == this.currentRole.system.statincrease1.toUpperCase() || spec.system.statistic.toUpperCase() == this.currentRole.system.statincrease2.toUpperCase())
console.log("SPEC FOUND", this.roleSpecStart) //console.log("SPEC FOUND", this.roleSpecStart)
//this.roleSpecStart = duplicate(this.currentRole.data.specialisationsplus1) //this.roleSpecStart = duplicate(this.currentRole.data.specialisationsplus1)
this.nbRoleSpecStart = 2; this.nbRoleSpecStart = 2;
} }
let formData = this.createFormData("select-role-start-spec") let formData = this.createFormData("select-role-start-spec")
formData.rolestartspec = this.roleSpecStart formData.rolestartspec = this.roleSpecStart
formData.rolestartspec.sort(function compare(a, b) { if (a.name < b.name) { return -1 } else { return 1 } })
formData.nbrolespecstart = this.nbRoleSpecStart; formData.nbrolespecstart = this.nbRoleSpecStart;
this.renderChatMessage(formData) this.renderChatMessage(formData)
} }
@ -398,6 +399,7 @@ export class PegasusActorCreate {
async showRoleSpecialisations() { async showRoleSpecialisations() {
let formData = this.createFormData("select-role-spec") let formData = this.createFormData("select-role-spec")
formData.rolespec = duplicate(this.roleSpec) formData.rolespec = duplicate(this.roleSpec)
formData.rolespec.sort(function compare(a, b) { if (a.name < b.name) { return -1 } else { return 1 } })
formData.dt = 1 formData.dt = 1
if (this.nbDT2 > 0) { if (this.nbDT2 > 0) {
formData.dt = 2 formData.dt = 2
@ -410,6 +412,7 @@ export class PegasusActorCreate {
async showRolePerks() { async showRolePerks() {
let formData = this.createFormData("select-role-perk") let formData = this.createFormData("select-role-perk")
formData.roleperks = duplicate(this.rolePerks) formData.roleperks = duplicate(this.rolePerks)
formData.roleperks.sort(function compare(a, b) { if (a.name < b.name) { return -1 } else { return 1 } })
formData.nbperks = this.nbPerks formData.nbperks = this.nbPerks
this.renderChatMessage(formData) this.renderChatMessage(formData)
} }