Update compendium-browser.js

pull/1/head
Matheus Clemente 2023-11-12 03:11:53 -03:00
parent ef6fa264e3
commit e335544bf6
1 changed files with 22 additions and 15 deletions

View File

@ -631,7 +631,12 @@ class CompendiumBrowser extends Application {
}
hookCompendiumList(html) {
if (game.user.isGM || this.settings.allowSpellBrowser || this.settings.allowNpcBrowser) {
if (game.user.isGM
|| this.settings.allowSpellBrowser
|| this.settings.allowNpcBrowser
|| this.settings.allowFeatBrowser
|| this.settings.allowItemBrowser) {
const cbButton = $(
`<button class="compendium-browser-btn"><i class="fas fa-fire"></i> ${game.i18n.localize(
"CMPBrowser.compendiumBrowser"
@ -1304,14 +1309,20 @@ class CompendiumBrowser extends Application {
async addItemFilters() {
this.addItemFilter("CMPBrowser.general", "DND5E.Source", "system.source", "text");
this.addItemFilter("CMPBrowser.general", "Item Type", "type", "select", {
this.addItemFilter(
"CMPBrowser.general",
"Item Type",
"type",
"select",
this._sortPackValues({
consumable: "ITEM.TypeConsumable",
backpack: "ITEM.TypeContainer",
equipment: "ITEM.TypeEquipment",
loot: "ITEM.TypeLoot",
tool: "ITEM.TypeTool",
weapon: "ITEM.TypeWeapon",
});
})
);
this.addItemFilter(
"CMPBrowser.general",
@ -1842,12 +1853,8 @@ Hooks.once("init", async () => {
});
Hooks.on("ready", () => {
if (game.compendiumBrowser === undefined) {
game.compendiumBrowser = new CompendiumBrowser();
// 0.4.0 Defer loading content until we actually use the Compendium Browser
// A compromise approach would be better (periodic loading) except would still create the memory use problem
game.compendiumBrowser.initialize();
}
game.compendiumBrowser.addSpellFilters();
game.compendiumBrowser.addFeatFilters();