diff --git a/module/apps/PlayerSheet.mjs b/module/apps/PlayerSheet.mjs index dfcef25..23b1082 100644 --- a/module/apps/PlayerSheet.mjs +++ b/module/apps/PlayerSheet.mjs @@ -1,5 +1,6 @@ import { __ID__, filePath } from "../consts.mjs"; import { AttributeManager } from "./AttributeManager.mjs"; +import { attributeSorter } from "../utils/attributeSort.mjs"; const { HandlebarsApplicationMixin } = foundry.applications.api; const { ActorSheetV2 } = foundry.applications.sheets; @@ -88,7 +89,7 @@ export class PlayerSheet extends HandlebarsApplicationMixin(ActorSheetV2) { path: `system.attr.${id}`, }); }; - ctx.attrs = attrs.toSorted((a, b) => a.name.localeCompare(b.name)); + ctx.attrs = attrs.toSorted(attributeSorter); }; async _prepareContent(ctx) { diff --git a/module/data/Player.mjs b/module/data/Player.mjs index 9b449a1..b2ad529 100644 --- a/module/data/Player.mjs +++ b/module/data/Player.mjs @@ -10,6 +10,7 @@ export class PlayerData extends foundry.abstract.TypeDataModel { attr: new fields.TypedObjectField( new fields.SchemaField({ name: new fields.StringField({ blank: false, trim: true }), + sort: new fields.NumberField({ min: 1, initial: 1, integer: true, nullable: false }), value: new fields.NumberField({ min: 0, initial: 0, integer: true, nullable: false }), max: new fields.NumberField({ min: 0, initial: null, integer: true, nullable: true }), isRange: new fields.BooleanField({ initial: false, nullable: false }),