0.7.2b 4-Jan-2022
- Merge PR #33 (improved NPC search performance) - thanks kyleady - Fixed #29,#30,#31: Problems running with Foundry v9 - Fixed #28: Problems sorting by magical rarity - change message to Loading... while still loading.features_update
parent
72227b1a4f
commit
755308e83c
|
@ -1,30 +1,39 @@
|
|||
#0.7.1
|
||||
#0.7
|
||||
Works only with Foundry v0.8 and 9
|
||||
##0.7.2
|
||||
- Merged PR [League-of-Foundry-Developers/compendium-browser#33](https://github.com/League-of-Foundry-Developers/compendium-browser/pull/33)
|
||||
- Fixed: Issue [League-of-Foundry-Developers/compendium-browser#29](https://github.com/League-of-Foundry-Developers/compendium-browser/issues/29)
|
||||
- Fixed: Issue [League-of-Foundry-Developers/compendium-browser#30](https://github.com/League-of-Foundry-Developers/compendium-browser/issues/30)
|
||||
- Fixed: Issue [League-of-Foundry-Developers/compendium-browser#31](https://github.com/League-of-Foundry-Developers/compendium-browser/issues/31)
|
||||
- Change message to "Loading..." until we're done, then "Loaded" (also when we hit the maxLoaded)
|
||||
|
||||
##0.7.1
|
||||
- Merged PR [League-of-Foundry-Developers/compendium-browser#26](https://github.com/League-of-Foundry-Developers/compendium-browser/pull/26)
|
||||
- Fixed: Issue [League-of-Foundry-Developers/compendium-browser#25](https://github.com/League-of-Foundry-Developers/compendium-browser/issues/25)
|
||||
|
||||
#v0.7.0 (only Foundry 0.8+)
|
||||
##v0.7.0 (only Foundry 0.8+)
|
||||
- Merged PR #24 (performance speed ups)
|
||||
- Fixed: Issue [League-of-Foundry-Developers/compendium-browser#19](https://github.com/League-of-Foundry-Developers/compendium-browser/issues/19)
|
||||
- Fixed: Issue [League-of-Foundry-Developers/compendium-browser#7](https://github.com/League-of-Foundry-Developers/compendium-browser/issues/7)
|
||||
|
||||
#v0.6.0
|
||||
##v0.6.0
|
||||
- Merged PR #14, #8 (classes for new spells and Optional Class Features in Tasha's)
|
||||
- Manually merged PR #3 (German and Spanish translations)
|
||||
|
||||
#v0.5.0
|
||||
##v0.5.0
|
||||
- Fixed: Issue #17 (error in filtering NPCs by Creature Type)
|
||||
|
||||
#v0.4.5
|
||||
##v0.4.5
|
||||
- Fixed: [Suggestion] Show compendium source in results; Issue #11
|
||||
- Fixed: Spells from non-system compendium show up in items tab. Issue#10
|
||||
|
||||
#v0.4.3
|
||||
##v0.4.3
|
||||
|
||||
#v0.3.1
|
||||
##v0.3.1
|
||||
- fixed a bug that prevented loading when Class type items were loaded.
|
||||
- fixed a bug that prevented disabled the scrollbar in the settings tab.
|
||||
|
||||
#v0.3.0
|
||||
##v0.3.0
|
||||
- improved load times by lazyloading images
|
||||
- fixed some css problems
|
||||
- new Feature: Feat Browser
|
||||
|
@ -36,10 +45,10 @@
|
|||
- this list can be modified by editing the "item-packs.json" file to customize your packs
|
||||
- many further filters available!
|
||||
|
||||
#v0.2.1
|
||||
##v0.2.1
|
||||
- fixed an issue that prevented the rendering of the Button to open the browser
|
||||
|
||||
#v0.2
|
||||
##v0.2
|
||||
- fixed a bug that could prevent proper npc loading
|
||||
- added a filter for "Source" for both spells and npcs
|
||||
- migrated to the new TabsV2
|
||||
|
|
|
@ -49,6 +49,10 @@
|
|||
12-Sep-2021 0.7.1 Issue #25 Initialization fails because of corrupted settings
|
||||
Fix: Check for settings.loadedSpellCompendium and settings.loadedNpcCompendium
|
||||
1-Jan-2022 0.7.2 Switch to isFoundryV8Plus class variable
|
||||
4-Jan-2022 0.7.2 Merge PR #33 (thanks kyleady) to improve NPC filtering performance
|
||||
0.7.2c Fix rarity encoding (uses camelcase names) (Issue #28)
|
||||
Check for data.details?.cr in case you have NPCs without details (type=character)
|
||||
Change message to "Loading..." until we're done, then "Loaded"
|
||||
*/
|
||||
|
||||
const CMPBrowser = {
|
||||
|
@ -504,7 +508,7 @@ class CompendiumBrowser extends Application {
|
|||
//OR filter the content up front for the decoratedItem.type??
|
||||
await pack.getDocuments(query).then(content => {
|
||||
|
||||
if (browserTab == "spell"){
|
||||
if (browserTab === "spell"){
|
||||
|
||||
content.reduce(function(itemsList, item5e) {
|
||||
if (this.CurrentSeachNumber != seachNumber) throw STOP_SEARCH;
|
||||
|
@ -512,7 +516,7 @@ class CompendiumBrowser extends Application {
|
|||
numItemsLoaded = Object.keys(itemsList).length;
|
||||
|
||||
if (maxLoad <= numItemsLoaded) {
|
||||
if (updateLoading) {updateLoading(numItemsLoaded);}
|
||||
if (updateLoading) {updateLoading(numItemsLoaded, true);}
|
||||
throw STOP_SEARCH;
|
||||
}
|
||||
|
||||
|
@ -543,7 +547,7 @@ class CompendiumBrowser extends Application {
|
|||
numItemsLoaded = Object.keys(itemsList).length;
|
||||
|
||||
if (maxLoad <= numItemsLoaded) {
|
||||
if (updateLoading) {updateLoading(numItemsLoaded);}
|
||||
if (updateLoading) {updateLoading(numItemsLoaded, true);}
|
||||
throw STOP_SEARCH;
|
||||
}
|
||||
|
||||
|
@ -570,7 +574,7 @@ class CompendiumBrowser extends Application {
|
|||
numItemsLoaded = Object.keys(itemsList).length;
|
||||
|
||||
if (maxLoad <= numItemsLoaded) {
|
||||
if (updateLoading) {updateLoading(numItemsLoaded);}
|
||||
if (updateLoading) {updateLoading(numItemsLoaded, true);}
|
||||
throw STOP_SEARCH;
|
||||
}
|
||||
|
||||
|
@ -591,7 +595,7 @@ class CompendiumBrowser extends Application {
|
|||
}
|
||||
|
||||
numItemsLoaded = Object.keys(compactItems).length;
|
||||
if (updateLoading) {updateLoading(numItemsLoaded);}
|
||||
if (updateLoading) {updateLoading(numItemsLoaded, false);}
|
||||
});
|
||||
}//end if pack entity === Item
|
||||
}//for packs
|
||||
|
@ -616,6 +620,7 @@ class CompendiumBrowser extends Application {
|
|||
this.itemsLoaded = true;
|
||||
console.timeEnd("loadAndFilterItems");
|
||||
console.log(`Load and Filter Items | Finished loading ${Object.keys(compactItems).length} ${browserTab}s`);
|
||||
updateLoading(numItemsLoaded, true)
|
||||
return compactItems;
|
||||
}
|
||||
|
||||
|
@ -660,7 +665,7 @@ class CompendiumBrowser extends Application {
|
|||
numNpcsLoaded = Object.keys(npcs).length;
|
||||
|
||||
if (maxLoad <= numNpcsLoaded) {
|
||||
if (updateLoading) {updateLoading(numNpcsLoaded);}
|
||||
if (updateLoading) {updateLoading(numNpcsLoaded, true);}
|
||||
throw STOP_SEARCH;
|
||||
}
|
||||
|
||||
|
@ -675,7 +680,7 @@ class CompendiumBrowser extends Application {
|
|||
displayCR : decoratedNpc.displayCR,
|
||||
displaySize : decoratedNpc.displaySize,
|
||||
displayType: this.getNPCType(decoratedNpc.data?.details?.type),
|
||||
orderCR : decoratedNpc.data.details.cr,
|
||||
orderCR : decoratedNpc.data?.details?.cr,
|
||||
orderSize : decoratedNpc.filterSize
|
||||
};
|
||||
}
|
||||
|
@ -684,7 +689,7 @@ class CompendiumBrowser extends Application {
|
|||
}.bind(this), npcs);
|
||||
|
||||
numNpcsLoaded = Object.keys(npcs).length;
|
||||
if (updateLoading) {updateLoading(numNpcsLoaded);}
|
||||
if (updateLoading) {updateLoading(numNpcsLoaded, false);}
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -704,6 +709,7 @@ class CompendiumBrowser extends Application {
|
|||
this.npcsLoaded = true;
|
||||
console.timeEnd("loadAndFilterNpcs");
|
||||
console.log(`NPC Browser | Finished loading NPCs: ${Object.keys(npcs).length} NPCs`);
|
||||
updateLoading(numNpcsLoaded, true)
|
||||
return npcs;
|
||||
}
|
||||
|
||||
|
@ -791,11 +797,10 @@ class CompendiumBrowser extends Application {
|
|||
if (options?.reload || !elements[0].children.length) {
|
||||
|
||||
const maxLoad = game.settings.get(CMPBrowser.MODULE_NAME, "maxload") ?? CMPBrowser.MAXLOAD;
|
||||
const updateLoading = async numLoaded => {
|
||||
if (loadingMessage.length) {this.renderLoading(loadingMessage[0], browserTab, numLoaded, numLoaded>=maxLoad);}
|
||||
const updateLoading = async (numLoaded,doneLoading) => {
|
||||
if (loadingMessage.length) {this.renderLoading(loadingMessage[0], browserTab, numLoaded, numLoaded>=maxLoad, doneLoading);}
|
||||
}
|
||||
updateLoading(0);
|
||||
|
||||
updateLoading(0, false);
|
||||
//Uses loadAndFilterItems to read compendia for items which pass the current filters and render on this tab
|
||||
const newItemsHTML = await this.renderItemData(browserTab, updateLoading);
|
||||
elements[0].innerHTML = newItemsHTML;
|
||||
|
@ -814,10 +819,10 @@ class CompendiumBrowser extends Application {
|
|||
|
||||
}
|
||||
|
||||
async renderLoading(messageElement, itemType, numLoaded, maxLoaded=false) {
|
||||
async renderLoading(messageElement, itemType, numLoaded, maxLoaded=false, doneLoading=false) {
|
||||
if (!messageElement) return;
|
||||
|
||||
let loadingHTML = await renderTemplate("modules/compendium-browser/template/loading.html", {numLoaded: numLoaded, itemType: itemType, maxLoaded: maxLoaded});
|
||||
let loadingHTML = await renderTemplate("modules/compendium-browser/template/loading.html", {numLoaded: numLoaded, itemType: itemType, maxLoaded: maxLoaded, doneLoading: doneLoading});
|
||||
messageElement.innerHTML = loadingHTML;
|
||||
}
|
||||
|
||||
|
@ -1045,8 +1050,8 @@ class CompendiumBrowser extends Application {
|
|||
const decoratedNpc = npc;
|
||||
|
||||
// cr display
|
||||
let cr = decoratedNpc.data.details.cr;
|
||||
if (cr == undefined || cr == '') cr = 0;
|
||||
let cr = decoratedNpc.data.details?.cr; //0.7.2c: Possibly because of getIndex() use we now have to check for existence of details (doesn't for Character-type NPCs)
|
||||
if (cr === undefined || cr === '') cr = 0;
|
||||
else cr = Number(cr);
|
||||
if (cr > 0 && cr < 1) cr = "1/" + (1 / cr);
|
||||
decoratedNpc.displayCR = cr;
|
||||
|
@ -1066,8 +1071,8 @@ class CompendiumBrowser extends Application {
|
|||
}
|
||||
|
||||
// getting value for HasSpells and damage types
|
||||
decoratedNpc.hasSpells = decoratedNpc.items.type.reduce((hasSpells, itemType) => hasSpells || itemType == 'spell', false);
|
||||
decoratedNpc.damageDealt = decoratedNpc.items.data.damage.parts.filter(p => p.length >= 2).map(p => p[1]);
|
||||
decoratedNpc.hasSpells = decoratedNpc.items?.type?.reduce((hasSpells, itemType) => hasSpells || itemType === 'spell', false);
|
||||
decoratedNpc.damageDealt = decoratedNpc.items?.data?.damage?.parts ? decoratedNpc.items?.data?.damage?.parts?.filter(p => p?.length >= 2).map(p => p[1]) : 0;
|
||||
|
||||
//handle poorly constructed npc
|
||||
if (decoratedNpc.data?.details?.type && !(decoratedNpc.data?.details?.type instanceof Object)){
|
||||
|
@ -1358,13 +1363,14 @@ class CompendiumBrowser extends Application {
|
|||
this.addItemFilter("Item Subtype", "Equipment", 'data.armor.type', 'text', CONFIG.DND5E.equipmentTypes);
|
||||
this.addItemFilter("Item Subtype", "Consumable", 'data.consumableType', 'text', CONFIG.DND5E.consumableTypes);
|
||||
|
||||
//0.7.2c: Fix rarity encoding (uses camelcase names)
|
||||
this.addItemFilter("Magic Items", "Rarity", 'data.rarity', 'select',
|
||||
{
|
||||
Common: "Common",
|
||||
Uncommon: "Uncommon",
|
||||
Rare: "Rare",
|
||||
"Very rare": "Very Rare",
|
||||
Legendary: "Legendary"
|
||||
common: "Common",
|
||||
uncommon: "Uncommon",
|
||||
rare: "Rare",
|
||||
veryRare: "Very Rare",
|
||||
legendary: "Legendary"
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -62,8 +62,9 @@
|
|||
"CMPBrowser.Tab.Settings":"Settings",
|
||||
"CMPBrowser.SETTING.Maxload.NAME" : "Maximum load",
|
||||
"CMPBrowser.SETTING.Maxload.HINT" : "Maximum number of spells, feats, items, or NPCs to display; to see more use the filters. This setting is to allow manageing memory and server load.",
|
||||
"CMPBrowser.LOADING.Message" : "Loaded...{numLoaded} {itemType}s",
|
||||
"CMPBrowser.LOADING.MaxLoaded" : "(maximum displayed; to see more, use the filters)",
|
||||
"CMPBrowser.LOADING.Message" : "Loading...{numLoaded} {itemType}s",
|
||||
"CMPBrowser.LOADED.Message": "Loaded {numLoaded} {itemType}s",
|
||||
"CMPBrowser.LOADED.MaxLoaded" : "(maximum displayed; to see more, use the filters)",
|
||||
"CMPBrowser.Filters.ResetFilters" : "Reset Filters"
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "compendium-browser",
|
||||
"title": "Compendium Browser",
|
||||
"description": "<p>Easily browse and filter spells, feats, items, and npcs loaded from compendia!</p><strong>NEW! Compendium Browser is faster and better-behaved;</strong> 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.<br>Changes in 0.7.0: Supports Foundry 0.8+ only; faster searches using Foundry 0.8 queries!",
|
||||
"description": "<p>Easily browse and filter spells, feats, items, and npcs loaded from compendia!</p><p>Now works with Foundry 0.8 and 9 only</p><strong>NEW! Compendium Browser is faster and better-behaved;</strong> 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.<br>Changes in 0.7.0: Supports Foundry 0.8+ only; faster searches using Foundry 0.8 queries!",
|
||||
"version": "0.7.2",
|
||||
"author": "Spetzel#0103",
|
||||
"authors": [
|
||||
|
|
|
@ -138,7 +138,6 @@
|
|||
"dreamoftheblueveil": "bard,sorcerer,warlock,wizard",
|
||||
"instantsummons": "wizard",
|
||||
"dream": "bard,warlock,wizard",
|
||||
"dreamoftheblueveil": "bard",
|
||||
"druidgrove": "druid",
|
||||
"druidcraft": "druid",
|
||||
"dustdevil": "druid,sorcerer,wizard",
|
||||
|
@ -430,13 +429,13 @@
|
|||
"summonfiend": "warlock,wizard",
|
||||
"summongreaterdemon": "warlock,wizard",
|
||||
"summonlesserdemons": "warlock,wizard",
|
||||
"summonshadowpawn": "warlock,wizard",
|
||||
"summonshadowspawn": "warlock,wizard",
|
||||
"summonundead": "warlock,wizard",
|
||||
"sunbeam": "druid,sorcerer,wizard",
|
||||
"sunburst": "druid,sorcerer,wizard",
|
||||
"swiftquiver": "ranger",
|
||||
"swordburst": "artificer,sorcerer,warlock,wizard",
|
||||
"synapticstatic": "bard,sorcerer,warlock,wizard",
|
||||
"synapticstatic": "bard,sorcerer,warlock,wizard",
|
||||
"symbol": "bard,cleric,wizard",
|
||||
"tashascausticbrew": "artificer,sorcerer,wizard",
|
||||
"tashashideouslaughter": "bard,wizard",
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
|
||||
<img class="" src="icons/sundries/books/book-open-turquoise.webp" title="Loading book" width="32" height="32"/>
|
||||
<span class="item-edit" >
|
||||
{{localize "CMPBrowser.LOADING.Message" numLoaded=numLoaded itemType=itemType}}
|
||||
{{#if maxLoaded}}{{localize "CMPBrowser.LOADING.MaxLoaded"}}{{/if}}
|
||||
{{#if doneLoading}}
|
||||
{{localize "CMPBrowser.LOADED.Message" numLoaded=numLoaded itemType=itemType}}
|
||||
{{else}}
|
||||
{{localize "CMPBrowser.LOADING.Message" numLoaded=numLoaded itemType=itemType}}
|
||||
{{/if}}
|
||||
{{#if maxLoaded}}{{localize "CMPBrowser.LOADED.MaxLoaded"}}{{/if}}
|
||||
</span>
|
||||
|
|
Loading…
Reference in New Issue