Do some logic tweaks for the item filter functionality
This commit is contained in:
parent
aab71df1fc
commit
5fe854a0f3
2 changed files with 20 additions and 7 deletions
|
|
@ -53,6 +53,19 @@ export const localizerConfig = {
|
|||
maxDepth: 10,
|
||||
};
|
||||
|
||||
export const itemFilters = [
|
||||
`untyped`,
|
||||
`aspect`,
|
||||
`weapon`,
|
||||
`armour`,
|
||||
`equipment`,
|
||||
`foil`,
|
||||
`pet`,
|
||||
`transportation`,
|
||||
`structure`,
|
||||
`service`,
|
||||
];
|
||||
|
||||
export default {
|
||||
stats,
|
||||
statDice,
|
||||
|
|
@ -69,5 +82,6 @@ export default {
|
|||
itemTiers,
|
||||
syncMilestones,
|
||||
syncDice,
|
||||
localizerConfig
|
||||
localizerConfig,
|
||||
itemFilters,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -114,20 +114,19 @@ export class PlayerSheetv2 extends GenericActorSheet {
|
|||
_itemFiltersActive = new Set();
|
||||
toggleItemFilter(filterName) {
|
||||
if (this._itemFiltersActive.has(filterName)) {
|
||||
this._itemFiltersActive.add(filterName);
|
||||
} else {
|
||||
this._itemFiltersActive.delete(filterName);
|
||||
} else {
|
||||
this._itemFiltersActive.add(filterName);
|
||||
};
|
||||
this.render();
|
||||
};
|
||||
|
||||
get #itemFilters() {
|
||||
const types = CONFIG.Item.typeLabels;
|
||||
const types = DOTDUNGEON.itemFilters;
|
||||
const filters = [];
|
||||
for (const type in types) {
|
||||
if (["base", "spell", "legendaryItem"].includes(type)) continue;
|
||||
for (const type of types) {
|
||||
filters.push({
|
||||
label: localizer(types[type]),
|
||||
label: localizer(`TYPES.Item.${type}`),
|
||||
key: type,
|
||||
active: this._itemFiltersActive.has(type),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue