added some filters for the new dnd5e item types

features_update
Zoltan the DM 2023-02-03 20:46:26 -08:00
parent d4181d347e
commit 165445df29
2 changed files with 26 additions and 2 deletions

View File

@ -568,7 +568,7 @@ class CompendiumBrowser extends Application {
const decoratedItem = this.decorateItem(item5e);
if(decoratedItem && ["feat","class"].includes(decoratedItem.type) && this.passesFilter(decoratedItem, this.featFilters.activeFilters)){
if(decoratedItem && ["feat","class","subclass"].includes(decoratedItem.type) && this.passesFilter(decoratedItem, this.featFilters.activeFilters)){
itemsList[item5e.id] = {
compendium : pack.collection,
name : decoratedItem.name,
@ -595,7 +595,7 @@ class CompendiumBrowser extends Application {
const decoratedItem = this.decorateItem(item5e);
if(decoratedItem && !["spell","feat","class"].includes(decoratedItem.type) && this.passesFilter(decoratedItem, this.itemFilters.activeFilters)){
if(decoratedItem && !["spell","feat","class","subclass"].includes(decoratedItem.type) && this.passesFilter(decoratedItem, this.itemFilters.activeFilters)){
itemsList[item5e.id] = {
compendium : pack.collection,
name : decoratedItem.name,
@ -1219,6 +1219,7 @@ class CompendiumBrowser extends Application {
return false;
}
} else {
if (prop === undefined) return false;
if (filter.value !== undefined && prop !== undefined && prop != filter.value && !(filter.value === true && prop)) {
return false;
}
@ -1566,6 +1567,24 @@ class CompendiumBrowser extends Application {
wizard: game.i18n.localize("CMPBrowser.wizard")
}, true);
this.addFeatFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.overall"), 'type', 'select',
{
class: game.i18n.localize("CMPBrowser.class"),
subclass: game.i18n.localize("CMPBrowser.subclass"),
feat: game.i18n.localize("CMPBrowser.feature"),
}
, false);
this.addFeatFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.featureType"), 'system.type.value', 'select',
Object.keys(dnd5e.config.featureTypes).reduce(function(acc, current) {
acc[current] = dnd5e.config.featureTypes[current].label;
return acc;
}, {})
, false);
this.addFeatFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.subfeature"), 'system.type.subtype', 'select',
dnd5e.config.featureTypes.class.subtypes);
if (CompendiumBrowser.isFoundryV10Plus) {
this.addFeatFilter("Game Mechanics", game.i18n.localize("DND5E.ItemActivationCost"), 'system.activation.type', 'select', CONFIG.DND5E.abilityActivationTypes);
}

View File

@ -22,6 +22,7 @@
"CMPBrowser.spellType":"Spell Type",
"CMPBrowser.damageType":"Damage Type",
"CMPBrowser.class":"Class",
"CMPBrowser.subclass":"Subclass",
"CMPBrowser.artificer":"Artificer",
"CMPBrowser.bard":"Bard",
"CMPBrowser.cleric":"Cleric",
@ -32,6 +33,10 @@
"CMPBrowser.warlock":"Warlock",
"CMPBrowser.wizard":"Wizard",
"CMPBrowser.general":"General",
"CMPBrowser.overall":"Overall Type",
"CMPBrowser.featureType":"Feature Type",
"CMPBrowser.subfeature":"Subfeature Type",
"CMPBrowser.feature":"Feature",
"CMPBrowser.components":"Components",
"CMPBrowser.hasSpells":"Has Spells",
"CMPBrowser.hasLegAct":"Has Legendary Actions",