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,
|
maxDepth: 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const itemFilters = [
|
||||||
|
`untyped`,
|
||||||
|
`aspect`,
|
||||||
|
`weapon`,
|
||||||
|
`armour`,
|
||||||
|
`equipment`,
|
||||||
|
`foil`,
|
||||||
|
`pet`,
|
||||||
|
`transportation`,
|
||||||
|
`structure`,
|
||||||
|
`service`,
|
||||||
|
];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
stats,
|
stats,
|
||||||
statDice,
|
statDice,
|
||||||
|
|
@ -69,5 +82,6 @@ export default {
|
||||||
itemTiers,
|
itemTiers,
|
||||||
syncMilestones,
|
syncMilestones,
|
||||||
syncDice,
|
syncDice,
|
||||||
localizerConfig
|
localizerConfig,
|
||||||
|
itemFilters,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -114,20 +114,19 @@ export class PlayerSheetv2 extends GenericActorSheet {
|
||||||
_itemFiltersActive = new Set();
|
_itemFiltersActive = new Set();
|
||||||
toggleItemFilter(filterName) {
|
toggleItemFilter(filterName) {
|
||||||
if (this._itemFiltersActive.has(filterName)) {
|
if (this._itemFiltersActive.has(filterName)) {
|
||||||
this._itemFiltersActive.add(filterName);
|
|
||||||
} else {
|
|
||||||
this._itemFiltersActive.delete(filterName);
|
this._itemFiltersActive.delete(filterName);
|
||||||
|
} else {
|
||||||
|
this._itemFiltersActive.add(filterName);
|
||||||
};
|
};
|
||||||
this.render();
|
this.render();
|
||||||
};
|
};
|
||||||
|
|
||||||
get #itemFilters() {
|
get #itemFilters() {
|
||||||
const types = CONFIG.Item.typeLabels;
|
const types = DOTDUNGEON.itemFilters;
|
||||||
const filters = [];
|
const filters = [];
|
||||||
for (const type in types) {
|
for (const type of types) {
|
||||||
if (["base", "spell", "legendaryItem"].includes(type)) continue;
|
|
||||||
filters.push({
|
filters.push({
|
||||||
label: localizer(types[type]),
|
label: localizer(`TYPES.Item.${type}`),
|
||||||
key: type,
|
key: type,
|
||||||
active: this._itemFiltersActive.has(type),
|
active: this._itemFiltersActive.has(type),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue