[Feature] Add GROWTH sorting option to dropdown in Starter Select UI

This commit is contained in:
Arthur Abeilice 2024-11-04 13:37:58 -03:00
parent a70f0860e1
commit e5e3bfcab2
No known key found for this signature in database
GPG Key ID: DFF6675C96AA6BC2
2 changed files with 5 additions and 1 deletions

View File

@ -28,7 +28,8 @@ export enum SortCriteria {
COST = 1,
CANDY = 2,
IV = 3,
NAME = 4
NAME = 4,
GROWTH = 5
}
export class DropDownLabel {

View File

@ -490,6 +490,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
new DropDownOption(this.scene, SortCriteria.CANDY, new DropDownLabel(i18next.t("filterBar:sortByCandies"))),
new DropDownOption(this.scene, SortCriteria.IV, new DropDownLabel(i18next.t("filterBar:sortByIVs"))),
new DropDownOption(this.scene, SortCriteria.NAME, new DropDownLabel(i18next.t("filterBar:sortByName")))
new DropDownOption(this.scene, SortCriteria.GROWTH, new DropDownLabel(i18next.t("filterBar:sortByGrowth")))
];
this.filterBar.addFilter(DropDownColumn.SORT, i18next.t("filterBar:sortFilter"), new DropDown(this.scene, 0, 0, sortOptions, this.updateStarters, DropDownType.SINGLE));
this.filterBarContainer.add(this.filterBar);
@ -2555,6 +2556,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
return (avgIVsA - avgIVsB) * -sort.dir;
case SortCriteria.NAME:
return a.species.name.localeCompare(b.species.name) * -sort.dir;
case SortCriteria.GROWTH:
return (a.species.growthRate - b.species.growthRate) * -sort.dir;
}
return 0;
});