Add the filter checkboxes and infra for toggling them (closes #110)

This commit is contained in:
Oliver-Akins 2024-03-08 22:27:04 -07:00
parent c525c1390b
commit 609b5820ba
3 changed files with 57 additions and 0 deletions

View file

@ -50,6 +50,7 @@ export class PlayerSheetv2 extends GenericActorSheet {
canChangeGroup: ctx.settings.playersCanChangeGroup || ctx.isGM,
canAddAspect: !await actor.proxyFunction.bind(actor)(`atAspectLimit`),
stats: this.#statData,
itemFilters: this.#itemFilters,
};
console.log(ctx)
return ctx;
@ -102,6 +103,30 @@ export class PlayerSheetv2 extends GenericActorSheet {
return stats;
};
_itemFiltersActive = new Set();
toggleItemFilter(filterName) {
if (this._itemFiltersActive.has(filterName)) {
this._itemFiltersActive.add(filterName);
} else {
this._itemFiltersActive.delete(filterName);
};
this.render();
};
get #itemFilters() {
const types = CONFIG.Item.typeLabels;
const filters = [];
for (const type in types) {
if (["base", "spell", "legendaryItem"].includes(type)) continue;
filters.push({
label: localizer(types[type]),
key: type,
active: this._itemFiltersActive.has(type),
});
};
return filters;
};
_updateObject(...args) {
console.log(args)
super._updateObject(...args);