mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2025-10-28 20:45:35 -05:00
v1.198.1
This commit is contained in:
53
js/filter-rewards.js
Normal file
53
js/filter-rewards.js
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
class PageFilterRewards extends PageFilter {
|
||||
constructor () {
|
||||
super();
|
||||
|
||||
this._typeFilter = new Filter({
|
||||
header: "Type",
|
||||
items: [
|
||||
"Blessing",
|
||||
"Boon",
|
||||
"Charm",
|
||||
],
|
||||
});
|
||||
this._rarityFilter = new Filter({
|
||||
header: "Rarity",
|
||||
items: ["unknown", ...Parser.RARITIES],
|
||||
itemSortFn: null,
|
||||
displayFn: StrUtil.toTitleCase,
|
||||
});
|
||||
}
|
||||
|
||||
static mutateForFilters (it) {
|
||||
it._fRarity = it.rarity || "unknown";
|
||||
}
|
||||
|
||||
addToFilters (reward, isExcluded) {
|
||||
if (isExcluded) return;
|
||||
|
||||
this._sourceFilter.addItem(reward.source);
|
||||
this._typeFilter.addItem(reward.type);
|
||||
this._rarityFilter.addItem(reward._fRarity);
|
||||
}
|
||||
|
||||
async _pPopulateBoxOptions (opts) {
|
||||
opts.filters = [
|
||||
this._sourceFilter,
|
||||
this._typeFilter,
|
||||
this._rarityFilter,
|
||||
];
|
||||
}
|
||||
|
||||
toDisplay (values, r) {
|
||||
return this._filterBox.toDisplay(
|
||||
values,
|
||||
r.source,
|
||||
r.type,
|
||||
r._fRarity,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
globalThis.PageFilterRewards = PageFilterRewards;
|
||||
Reference in New Issue
Block a user