From 6416a4462b6f52aeb723b03e67cc351dbd5816fa Mon Sep 17 00:00:00 2001 From: Matheus Clemente Date: Sat, 30 Mar 2024 20:58:27 -0300 Subject: [PATCH] NPC: General section feature parity --- .../CompendiumBrowserCreatures.vue | 60 ++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/src/vue/components/dialogs/compendium-browser/CompendiumBrowserCreatures.vue b/src/vue/components/dialogs/compendium-browser/CompendiumBrowserCreatures.vue index b890e3e..da7ae51 100644 --- a/src/vue/components/dialogs/compendium-browser/CompendiumBrowserCreatures.vue +++ b/src/vue/components/dialogs/compendium-browser/CompendiumBrowserCreatures.vue @@ -4,8 +4,7 @@
- - +
@@ -45,6 +44,34 @@ :options="getOptions(CONFIG.DND5E.actorSizes)" />
+
+ + +
+
+ + +
+
+ + +
@@ -139,7 +166,10 @@ export default { // Mixed decimals and ints aren't supported by the slider, so // just use 0 for all CRs below 1. crRange: [0, 30], + legact: '', + legres: '', size: [], + creatureType: [], } }, methods: { @@ -173,7 +203,10 @@ export default { this.sortBy = 'name'; this.name = ''; this.crRange = [0, 30]; + this.legact = ''; + this.legres = ''; this.size = []; + this.creatureType = []; }, /** * Get multiselect options. @@ -209,10 +242,25 @@ export default { ); } + if (this.legact === "yes") { + result = result.filter((entry) => entry.system.resources.legact.max); + } else if (this.legact === "no") { + result = result.filter((entry) => !entry.system.resources.legact.max); + } + + if (this.legres === "yes") { + result = result.filter((entry) => entry.system.resources.legres.max); + } else if (this.legres === "no") { + result = result.filter((entry) => !entry.system.resources.legres.max); + } + // Handle multiselect filters, which use arrays as their values. if (Array.isArray(this.size) && this.size.length > 0) { result = result.filter(entry => this.size.includes(entry.system.traits.size)); } + if (Array.isArray(this.creatureType) && this.creatureType.length > 0) { + result = result.filter(entry => this.creatureType.includes(entry.system.details.type.value)); + } // Reflow pager. if (result.length > this.pager.perPage) { @@ -243,6 +291,9 @@ export default { ? result.slice(this.pager.firstIndex, this.pager.lastIndex) : result; }, + yesNo() { + return { "yes": { label: "Yes" }, "no": { label: "No" }}; + } }, watch: {}, // Handle created hook. @@ -254,8 +305,13 @@ export default { 'dnd5e.monsters', // insert additional packs as needed. ], [ + 'system.attributes.ac', + 'system.attributes.hp', + 'system.abilities', 'system.details.cr', 'system.details.type', + 'system.resources.legact', + 'system.resources.legres', 'system.traits.size' // insert additional properties as needed. ]).then(packIndex => {