From 5e01bca4993bdf57894fd5e90922bbf2efc7e540 Mon Sep 17 00:00:00 2001 From: opus1217 Date: Sat, 12 Jun 2021 19:59:08 -0700 Subject: [PATCH] 0.5.0 12-Jun-2021 - Updated to use correct "latest" link - Fixed: Issue https://github.com/League-of-Foundry-Developers/compendium-browser/issues/17 (structure had changed) compendium-browser.js - addNpcFilers(): Test for Foundry 0.8.x in which creature type is now data.details.type.value --- compendium-browser.js | 13 ++++++++++++- module.json | 8 ++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/compendium-browser.js b/compendium-browser.js index bcaed5c..2ec0486 100644 --- a/compendium-browser.js +++ b/compendium-browser.js @@ -40,6 +40,7 @@ loadAndFilterItems(): Changed tests to switch + more explicit tests 0.4.5b Show compendium source in results issue#11 Try showing compendium in the image mouseover +12-Jun-2021 0.5.0 Test for Foundry 0.8.x in which creature type is now data.details.type.value */ const CMPBrowser = { @@ -1405,6 +1406,7 @@ class CompendiumBrowser extends Application { } async addNpcFilters() { + const isFoundryV8 = game.data.version.startsWith("0.8"); // NPC Filters this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("DND5E.Source"), 'data.details.source', 'text'); @@ -1413,7 +1415,16 @@ class CompendiumBrowser extends Application { this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.hasLegAct"), 'data.resources.legact.max', 'bool'); this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.hasLegRes"), 'data.resources.legres.max', 'bool'); this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.cr"), 'data.details.cr', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.creatureType"), 'data.details.type', 'text', { + + //Foundry 0.8.x: Creature type (data.details.type) is now a structure, so we check data.details.types.value instead + let npcDetailsPath; + if (isFoundryV8) { + npcDetailsPath = "data.details.type.value"; + } else {//0.7.x + npcDetailsPath = "data.details.type"; + } + + this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.creatureType"), npcDetailsPath, 'text', { aberration: game.i18n.localize("CMPBrowser.aberration"), beast: game.i18n.localize("CMPBrowser.beast"), celestial: game.i18n.localize("CMPBrowser.celestial"), diff --git a/module.json b/module.json index ffcf7cd..2034677 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "name": "compendium-browser", "title": "Compendium Browser", "description": "

Easily browse and filter spells, feats, items, and npcs loaded from compendia!

NEW! Compendium Browser is faster and better-behaved; it no longer loads all the compendia into memory on start-up (which sometimes hung servers because of memory or CPU requirements). Instead, it filters and loads on-demand, as well as giving you a Module Setting to control how many rows are loaded at a time.
Changes in v0.4.5:", - "version": "0.4.5", + "version": "0.5.0", "author": "Spetzel#0103", "authors": [ { @@ -40,10 +40,10 @@ } ], "url": "https://github.com/League-of-Foundry-Developers/compendium-browser", - "manifest": "https://github.com/League-of-Foundry-Developers/compendium-browser/releases/download/latest/module.json", - "download": "https://github.com/League-of-Foundry-Developers/compendium-browser/releases/download/latest/compendium-browser.zip", + "manifest": "https://github.com/League-of-Foundry-Developers/compendium-browser/releases/latest/download/module.json", + "download": "https://github.com/League-of-Foundry-Developers/compendium-browser/releases/download/v0.5.0/compendium-browser.zip", "minimumCoreVersion": "0.6.2", - "compatibleCoreVersion": "0.7.9", + "compatibleCoreVersion": "0.8.6", "allowBugReporter": true, "bugs": "https://github.com/League-of-Foundry-Developers/compendium-browser/issues", "readme": "https://github.com/League-of-Foundry-Developers/compendium-browser/blob/master/README.md",