diff --git a/Patchnotes.md b/Patchnotes.md index a1b148c..33c22e9 100644 --- a/Patchnotes.md +++ b/Patchnotes.md @@ -1,3 +1,11 @@ +#0.9.0 +- Button on character sheets for opening a search with class and spell level (works on default and TidySheet5e) +- added filters for subclasses and backgrounds [League-of-Foundry-Developers/compendium-browser#48](https://github.com/League-of-Foundry-Developers/compendium-browser/issues/48) +- Additional searches for sub-features +- Merged PR [League-of-Foundry-Developers/compendium-browser#45](https://github.com/League-of-Foundry-Developers/compendium-browser/pull/45) +- Used more DnD5e loaclization tags. Should be less work to translate, also defaults localization to tag name +- Fixed item rarity search in Foundry 10+ [League-of-Foundry-Developers/compendium-browser#54](https://github.com/League-of-Foundry-Developers/compendium-browser/issues/54) + #0.8.2 - Fixed Class searching for spells - issue: #43 - Fixed Drag-and-Drop error in Foundry V10 - issue: #41 diff --git a/README.md b/README.md index f5bc204..f09507e 100644 --- a/README.md +++ b/README.md @@ -3,25 +3,15 @@ Tired of scrolling compendia? Easily browse and filter for spells, feats, items, 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. -[Patch Notes](https://raw.githubusercontent.com/League-of-Foundry-Developers/compendium-browser/master/Patchnotes.md) -## v0.8: -- Compatibility with Foundry V10 -- Added check for "Compendium Folders" module 'phantom' actors (#[CF_tempEntity]) to filter out of NPC list. -- Fix to handle un-migrated compendiums (they get auto-excluded from the browser even if selected) -## v0.7: -- Supports Foundry 0.8.x and Foundry 9 -- Faster searches using Foundry 0.8.x queries (thanks ZoltantheDM!) -- Faster NPC searches using getIndex() (thanks kyleady!) -## v0.6: -- Additional and Optional Features spells from Tasha's -- Spanish, German translations ## Summary -* **Authors**: Discord: Spetzel#0103; Felix (felix.mueller.86@web.de); ZoltantheDM -* **Version**: 0.7.2 -* **Foundry VTT Compatibility**: 0.8.6-9 +* **Authors**: Discord: Spetzel#0103; Felix (felix.mueller.86@web.de); ZoltantheDM (Zoltan#8700); eduardopato41 +* **Version**: 0.9.0 +* **Foundry VTT Compatibility**: 9-10 * **System Compatibility (If applicable)**: dnd5e * **Translation Support**: en, de (thanks https://github.com/CarnVanBeck), es (thanks https://github.com/JJBocanegra), fr, ja, pt-BR +[Patch Notes](https://github.com/ZoltanTheDM/compendium-browser/blob/master/Patchnotes.md) + ## Installation 1. Go to the Add-on Modules tab in Foundry Setup 2. Click Install Module and search for **Compendium Browser** OR paste this link: `https://github.com/League-of-Foundry-Developers/compendium-browser/releases/latest/download/module.json` @@ -36,9 +26,6 @@ This application enables anyone to add their own custom spell or npc filters via All filters featured in the app are included in this manner and can be found in the compendium-browser.js at around line 726. -## Contribution -If you feel like supporting my work, feel free to leave a tip at my paypal felix.mueller.86@web.de - ## License Creative Commons Licence
Compendium Browser - a module for Foundry VTT - by Felix Müller is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/compendium-browser.js b/compendium-browser.js index cbaa9cb..2c96c90 100644 --- a/compendium-browser.js +++ b/compendium-browser.js @@ -284,36 +284,21 @@ class CompendiumBrowser extends Application { }); this.triggerSort(html, "npc"); - // reset filters and re-render - //0.4.3: Reset ALL filters because when we do a re-render it affects all tabs - html.find('#reset-spell-filter').click(ev => { - this.resetFilters(); - //v0.4.3: Re-render so that we display the filters correctly - this.refreshList = "spell"; - this.render(); - }); + for (let tab of ["spell", "feat", "item", "npc"]){ + // reset filters and re-render + //0.4.3: Reset ALL filters because when we do a re-render it affects all tabs + html.find(`#reset-${tab}-filter`).click(ev => { + this.resetFilters(); + //v0.4.3: Re-render so that we display the filters correctly + this.refreshList = tab; + this.render(); + }); - html.find('#reset-feat-filter').click(ev => { - this.resetFilters(); - //v0.4.3: Re-render so that we display the filters correctly - this.refreshList = "feat"; - this.render(); - }); - - html.find('#reset-item-filter').click(ev => { - this.resetFilters(); - //v0.4.3: Re-render so that we display the filters correctly - this.refreshList = "item"; - this.render(); - - }); - - html.find('#reset-npc-filter').click(ev => { - this.resetFilters(); - //v0.4.3: Re-render so that we display the filters correctly - this.refreshList = "npc"; - this.render(); - }); + //copy Javascript seach to clipboard + html.find(`#copy-search-${tab}`).click(async ev => { + this.copySearchToClipboard(tab); + }); + } // settings html.find('.settings input').on('change', ev => { @@ -395,7 +380,13 @@ class CompendiumBrowser extends Application { value:value } } - this.replaceList(html, browserTab); + this.replaceList(html, browserTab); + + + // console.log(this.spellFilters.activeFilters); + // console.log(this.featFilters.activeFilters); + // console.log(this.itemFilters.activeFilters); + // console.log(this.npcFilters.activeFilters); }); // multiselect filters @@ -568,7 +559,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", "background"].includes(decoratedItem.type) && this.passesFilter(decoratedItem, this.featFilters.activeFilters)){ itemsList[item5e.id] = { compendium : pack.collection, name : decoratedItem.name, @@ -595,7 +586,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", "background"].includes(decoratedItem.type) && this.passesFilter(decoratedItem, this.itemFilters.activeFilters)){ itemsList[item5e.id] = { compendium : pack.collection, name : decoratedItem.name, @@ -799,6 +790,10 @@ class CompendiumBrowser extends Application { cb.replaceList(html, cb.refreshList); cb.refreshList = null; + + if(CompendiumBrowser.postRender){ + CompendiumBrowser.postRender(); + } } resetFilters() { @@ -1084,6 +1079,10 @@ class CompendiumBrowser extends Application { if (!CompendiumBrowser.isFoundryV10Plus) { item.hasSave = item5e.hasSave; } + } else if (item.type === 'subclass') { + //subclasses dont exist lower then version 10 + item.classRequirement = [item.system.classIdentifier]; + item.classRequirementString = item.system.classIdentifier } else { // getting pack let matchedPacks = []; @@ -1219,6 +1218,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; } @@ -1373,23 +1373,36 @@ class CompendiumBrowser extends Application { //FILTERS - Added on the Ready hook //0.4.0 Make this async so filters can be added all at once async addFilter(entityType, category, label, path, type, possibleValues = null, valIsArray = false) { + let target = `${entityType}Filters`; let filter = {}; filter.path = path; - filter.label = label; + filter.labelId = stripSpecialCharacters(label); + filter.label = game.i18n.localize(label) ?? label; filter.type = 'text'; if (['text', 'bool', 'select', 'multiSelect', 'numberCompare'].indexOf(type) !== -1) { filter[`is${type}`] = true; filter.type = type; } + if (possibleValues !== null) { - filter.possibleValues = possibleValues; + filter.possibleValueIds = possibleValues; + + filter.possibleValues = Object.keys(possibleValues).reduce(function (acc, current) { + acc[current] = game.i18n.localize(possibleValues[current]) ?? possibleValues[current]; + return acc; + }.bind(this), + {}) } filter.valIsArray = valIsArray; - let catId = category.replace(/\W/g, ''); + let catId = stripSpecialCharacters(category); if (this[target].registeredFilterCategorys[catId] === undefined) { - this[target].registeredFilterCategorys[catId] = {label: category, filters: []}; + this[target].registeredFilterCategorys[catId] = { + label: game.i18n.localize(category) ?? category, + labelId: catId, + filters: [] + }; } this[target].registeredFilterCategorys[catId].filters.push(filter); @@ -1400,75 +1413,75 @@ class CompendiumBrowser extends Application { //Foundry v10+ Item#data is now Item#system if (CompendiumBrowser.isFoundryV10Plus) { - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("DND5E.Source"), 'system.source', 'text'); - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.lvl"), 'system.level', 'multiSelect', [game.i18n.localize("CMPBrowser.cantip"), 1, 2, 3, 4, 5, 6, 7, 8, 9]); - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.school"), 'system.school', 'select', CONFIG.DND5E.spellSchools); - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.castingTime"), 'system.activation.type', 'select', + this.addSpellFilter("CMPBrowser.general", "DND5E.Source", 'system.source', 'text'); + this.addSpellFilter("CMPBrowser.general", "DND5E.Level", 'system.level', 'multiSelect', {0:"DND5E.SpellCantrip", 1:"1", 2:"2", 3:"3", 4:"4", 5:"5", 6:"6", 7:"7", 8:"8", 9:"9"}); + this.addSpellFilter("CMPBrowser.general", "DND5E.SpellSchool", 'system.school', 'select', CONFIG.DND5E.spellSchools); + this.addSpellFilter("CMPBrowser.general", "CMPBrowser.castingTime", 'system.activation.type', 'select', { - action: game.i18n.localize("DND5E.Action"), - bonus: game.i18n.localize("CMPBrowser.bonusAction"), - reaction: game.i18n.localize("CMPBrowser.reaction"), - minute: game.i18n.localize("DND5E.TimeMinute"), - hour: game.i18n.localize("DND5E.TimeHour"), - day: game.i18n.localize("DND5E.TimeDay") + action: "DND5E.Action", + bonus: "DND5E.BonusAction", + reaction: "DND5E.Reaction", + minute: "DND5E.TimeMinute", + hour: "DND5E.TimeHour", + day: "DND5E.TimeDay" } ); - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.spellType"), 'system.actionType', 'select', CONFIG.DND5E.itemActionTypes); - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.damageType"), 'damageTypes', 'select', CONFIG.DND5E.damageTypes); + this.addSpellFilter("CMPBrowser.general", "CMPBrowser.spellType", 'system.actionType', 'select', CONFIG.DND5E.itemActionTypes); + this.addSpellFilter("CMPBrowser.general", "CMPBrowser.damageType", 'damageTypes', 'select', CONFIG.DND5E.damageTypes); //JV-082: Fix for missing "Class" search feature - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.class"), 'classes', 'select', + this.addSpellFilter("CMPBrowser.general", "ITEM.TypeClass", 'classes', 'select', { - artificer: game.i18n.localize("CMPBrowser.artificer"), - bard: game.i18n.localize("CMPBrowser.bard"), - cleric: game.i18n.localize("CMPBrowser.cleric"), - druid: game.i18n.localize("CMPBrowser.druid"), - paladin: game.i18n.localize("CMPBrowser.paladin"), - ranger: game.i18n.localize("CMPBrowser.ranger"), - sorcerer: game.i18n.localize("CMPBrowser.sorcerer"), - warlock: game.i18n.localize("CMPBrowser.warlock"), - wizard: game.i18n.localize("CMPBrowser.wizard"), + artificer: "CMPBrowser.artificer", + bard: "CMPBrowser.bard", + cleric: "CMPBrowser.cleric", + druid: "CMPBrowser.druid", + paladin: "CMPBrowser.paladin", + ranger: "CMPBrowser.ranger", + sorcerer: "CMPBrowser.sorcerer", + warlock: "CMPBrowser.warlock", + wizard: "CMPBrowser.wizard", }, true ); - this.addSpellFilter(game.i18n.localize("CMPBrowser.components"), game.i18n.localize("CMPBrowser.ritual"), 'system.components.ritual', 'bool'); - this.addSpellFilter(game.i18n.localize("CMPBrowser.components"), game.i18n.localize("CMPBrowser.concentration"), 'system.components.concentration', 'bool'); - this.addSpellFilter(game.i18n.localize("CMPBrowser.components"), game.i18n.localize("CMPBrowser.verbal"), 'system.components.vocal', 'bool'); - this.addSpellFilter(game.i18n.localize("CMPBrowser.components"), game.i18n.localize("CMPBrowser.somatic"), 'system.components.somatic', 'bool'); - this.addSpellFilter(game.i18n.localize("CMPBrowser.components"), game.i18n.localize("CMPBrowser.material"), 'system.components.material', 'bool'); + this.addSpellFilter("DND5E.SpellComponents", "DND5E.Ritual", 'system.components.ritual', 'bool'); + this.addSpellFilter("DND5E.SpellComponents", "DND5E.Concentration", 'system.components.concentration', 'bool'); + this.addSpellFilter("DND5E.SpellComponents", "DND5E.ComponentVerbal", 'system.components.vocal', 'bool'); + this.addSpellFilter("DND5E.SpellComponents", "DND5E.ComponentSomatic", 'system.components.somatic', 'bool'); + this.addSpellFilter("DND5E.SpellComponents", "DND5E.ComponentMaterial", 'system.components.material', 'bool'); } else { - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("DND5E.Source"), 'data.source', 'text'); - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.lvl"), 'data.level', 'multiSelect', [game.i18n.localize("CMPBrowser.cantip"), 1, 2, 3, 4, 5, 6, 7, 8, 9]); - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.school"), 'data.school', 'select', CONFIG.DND5E.spellSchools); - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.castingTime"), 'data.activation.type', 'select', + this.addSpellFilter("CMPBrowser.general", "DND5E.Source", 'data.source', 'text'); + this.addSpellFilter("CMPBrowser.general", "DND5E.Level", 'data.level', 'multiSelect', {0:"DND5E.SpellCantrip", 1:"1", 2:"2", 3:"3", 4:"4", 5:"5", 6:"6", 7:"7", 8:"8", 9:"9"}); + this.addSpellFilter("CMPBrowser.general", "DND5E.SpellSchool", 'data.school', 'select', CONFIG.DND5E.spellSchools); + this.addSpellFilter("CMPBrowser.general", "CMPBrowser.castingTime", 'data.activation.type', 'select', { - action: game.i18n.localize("DND5E.Action"), - bonus: game.i18n.localize("CMPBrowser.bonusAction"), - reaction: game.i18n.localize("CMPBrowser.reaction"), - minute: game.i18n.localize("DND5E.TimeMinute"), - hour: game.i18n.localize("DND5E.TimeHour"), - day: game.i18n.localize("DND5E.TimeDay") + action: "DND5E.Action", + bonus: "DND5E.BonusAction", + reaction: "DND5E.Reaction", + minute: "DND5E.TimeMinute", + hour: "DND5E.TimeHour", + day: "DND5E.TimeDay" } ); - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.spellType"), 'data.actionType', 'select', CONFIG.DND5E.itemActionTypes); - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.damageType"), 'damageTypes', 'select', CONFIG.DND5E.damageTypes); - this.addSpellFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.class"), 'data.classes', 'select', + this.addSpellFilter("CMPBrowser.general", "CMPBrowser.spellType", 'data.actionType', 'select', CONFIG.DND5E.itemActionTypes); + this.addSpellFilter("CMPBrowser.general", "CMPBrowser.damageType", 'damageTypes', 'select', CONFIG.DND5E.damageTypes); + this.addSpellFilter("CMPBrowser.general", "ITEM.TypeClass", 'data.classes', 'select', { - artificer: game.i18n.localize("CMPBrowser.artificer"), - bard: game.i18n.localize("CMPBrowser.bard"), - cleric: game.i18n.localize("CMPBrowser.cleric"), - druid: game.i18n.localize("CMPBrowser.druid"), - paladin: game.i18n.localize("CMPBrowser.paladin"), - ranger: game.i18n.localize("CMPBrowser.ranger"), - sorcerer: game.i18n.localize("CMPBrowser.sorcerer"), - warlock: game.i18n.localize("CMPBrowser.warlock"), - wizard: game.i18n.localize("CMPBrowser.wizard"), + artificer: "CMPBrowser.artificer", + bard: "CMPBrowser.bard", + cleric: "CMPBrowser.cleric", + druid: "CMPBrowser.druid", + paladin: "CMPBrowser.paladin", + ranger: "CMPBrowser.ranger", + sorcerer: "CMPBrowser.sorcerer", + warlock: "CMPBrowser.warlock", + wizard: "CMPBrowser.wizard", }, true ); - this.addSpellFilter(game.i18n.localize("CMPBrowser.components"), game.i18n.localize("CMPBrowser.ritual"), 'data.components.ritual', 'bool'); - this.addSpellFilter(game.i18n.localize("CMPBrowser.components"), game.i18n.localize("CMPBrowser.concentration"), 'data.components.concentration', 'bool'); - this.addSpellFilter(game.i18n.localize("CMPBrowser.components"), game.i18n.localize("CMPBrowser.verbal"), 'data.components.vocal', 'bool'); - this.addSpellFilter(game.i18n.localize("CMPBrowser.components"), game.i18n.localize("CMPBrowser.somatic"), 'data.components.somatic', 'bool'); - this.addSpellFilter(game.i18n.localize("CMPBrowser.components"), game.i18n.localize("CMPBrowser.material"), 'data.components.material', 'bool'); + this.addSpellFilter("DND5E.SpellComponents", "DND5E.Ritual", 'data.components.ritual', 'bool'); + this.addSpellFilter("DND5E.SpellComponents", "DND5E.Concentration", 'data.components.concentration', 'bool'); + this.addSpellFilter("DND5E.SpellComponents", "DND5E.ComponentVerbal", 'data.components.vocal', 'bool'); + this.addSpellFilter("DND5E.SpellComponents", "DND5E.ComponentSomatic", 'data.components.somatic', 'bool'); + this.addSpellFilter("DND5E.SpellComponents", "DND5E.ComponentMaterial", 'data.components.material', 'bool'); } } @@ -1478,64 +1491,69 @@ class CompendiumBrowser extends Application { // Feature Filters //Foundry v10+ Item#data is now Item#system if (CompendiumBrowser.isFoundryV10Plus) { - this.addItemFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("DND5E.Source"), 'system.source', 'text'); + this.addItemFilter("CMPBrowser.general", "DND5E.Source", 'system.source', 'text'); } else { - this.addItemFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("DND5E.Source"), 'data.source', 'text'); + this.addItemFilter("CMPBrowser.general", "DND5E.Source", 'data.source', 'text'); } - this.addItemFilter(game.i18n.localize("CMPBrowser.general"), "Item Type", 'type', 'select', { - consumable: game.i18n.localize("DND5E.ItemTypeConsumable"), - backpack: game.i18n.localize("DND5E.ItemTypeContainer"), - equipment: game.i18n.localize("DND5E.ItemTypeEquipment"), - loot: game.i18n.localize("DND5E.ItemTypeLoot"), - tool: game.i18n.localize("DND5E.ItemTypeTool"), - weapon: game.i18n.localize("DND5E.ItemTypeWeapon") + this.addItemFilter("CMPBrowser.general", "Item Type", 'type', 'select', { + consumable: "ITEM.TypeConsumable", + backpack: "ITEM.TypeContainer", + equipment: "ITEM.TypeEquipment", + loot: "ITEM.TypeLoot", + tool: "ITEM.TypeTool", + weapon: "ITEM.TypeWeapon" }); - this.addItemFilter(game.i18n.localize("CMPBrowser.general"), "Packs", 'matchedPacks', 'select', + this.addItemFilter("CMPBrowser.general", "CMPBrowser.ItemsPacks", 'matchedPacks', 'select', { - burglar: "Burglar's Pack", - diplomat: "Diplomat's Pack", - dungeoneer: "Dungeoneer's Pack", - entertainer: "Entertainer's Pack", - explorer: "Explorer's Pack", - monsterhunter: "Monster Hunter's Pack", - priest: "Priest's Pack", - scholar: "Scholar's Pack", + burglar: "CMPBrowser.ItemsPacksBurglar", + diplomat: "CMPBrowser.ItemsPacksDiplomat", + dungeoneer: "CMPBrowser.ItemsPacksDungeoneer", + entertainer: "CMPBrowser.ItemsPacksEntertainer", + explorer: "CMPBrowser.ItemsPacksExplorer", + monsterhunter: "CMPBrowser.ItemsPacksMonsterHunter", + priest: "CMPBrowser.ItemsPacksPriest", + scholar: "CMPBrowser.ItemsPacksScholar", }, true ); if (CompendiumBrowser.isFoundryV10Plus) { - this.addItemFilter("Game Mechanics", game.i18n.localize("DND5E.ItemActivationCost"), 'system.activation.type', 'select', CONFIG.DND5E.abilityActivationTypes); + this.addItemFilter("CMPBrowser.GameMechanics", "DND5E.ItemActivationCost", 'system.activation.type', 'select', CONFIG.DND5E.abilityActivationTypes); } else { - this.addItemFilter("Game Mechanics", game.i18n.localize("DND5E.ItemActivationCost"), 'data.activation.type', 'select', CONFIG.DND5E.abilityActivationTypes); + this.addItemFilter("CMPBrowser.GameMechanics", "DND5E.ItemActivationCost", 'data.activation.type', 'select', CONFIG.DND5E.abilityActivationTypes); } - this.addItemFilter("Game Mechanics", game.i18n.localize("CMPBrowser.damageType"), 'damageTypes', 'select', CONFIG.DND5E.damageTypes); - this.addItemFilter("Game Mechanics", "Uses Resources", 'usesRessources', 'bool'); + this.addItemFilter("CMPBrowser.GameMechanics", "CMPBrowser.damageType", 'damageTypes', 'select', CONFIG.DND5E.damageTypes); + this.addItemFilter("CMPBrowser.GameMechanics", "CMPBrowser.UsesResources", 'usesRessources', 'bool'); if (CompendiumBrowser.isFoundryV10Plus) { - this.addItemFilter("Item Subtype", "Weapon", 'system.weaponType', 'text', CONFIG.DND5E.weaponTypes); - this.addItemFilter("Item Subtype", "Equipment", 'system.armor.type', 'text', CONFIG.DND5E.equipmentTypes); - this.addItemFilter("Item Subtype", "Consumable", 'system.consumableType', 'text', CONFIG.DND5E.consumableTypes); + this.addItemFilter("CMPBrowser.ItemSubtype", "ITEM.TypeWeapon", 'system.weaponType', 'text', CONFIG.DND5E.weaponTypes); + this.addItemFilter("CMPBrowser.ItemSubtype", "ITEM.TypeEquipment", 'system.armor.type', 'text', CONFIG.DND5E.equipmentTypes); + this.addItemFilter("CMPBrowser.ItemSubtype", "ITEM.TypeConsumable", 'system.consumableType', 'text', CONFIG.DND5E.consumableTypes); } else { - this.addItemFilter("Item Subtype", "Weapon", 'data.weaponType', 'text', CONFIG.DND5E.weaponTypes); - this.addItemFilter("Item Subtype", "Equipment", 'data.armor.type', 'text', CONFIG.DND5E.equipmentTypes); - this.addItemFilter("Item Subtype", "Consumable", 'data.consumableType', 'text', CONFIG.DND5E.consumableTypes); + this.addItemFilter("CMPBrowser.ItemSubtype", "ITEM.TypeWeapon", 'data.weaponType', 'text', CONFIG.DND5E.weaponTypes); + this.addItemFilter("CMPBrowser.ItemSubtype", "ITEM.TypeEquipment", 'data.armor.type', 'text', CONFIG.DND5E.equipmentTypes); + this.addItemFilter("CMPBrowser.ItemSubtype", "ITEM.TypeConsumable", '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", - veryRare: "Very Rare", - legendary: "Legendary" - }); + if (CompendiumBrowser.isFoundryV10Plus) { + this.addItemFilter("CMPBrowser.MagicItems", "DND5E.Rarity", 'system.rarity', 'select', CONFIG.DND5E.itemRarity); + } + else { + //0.7.2c: Fix rarity encoding (uses camelcase names) + this.addItemFilter("CMPBrowser.MagicItems", "DND5E.Rarity", 'data.rarity', 'select', + { + common: "DND5E.ItemRarityCommon", + uncommon: "DND5E.ItemRarityUncommon", + rare: "DND5E.ItemRarityRare", + veryRare: "DND5E.ItemRarityVeryRare", + legendary: "DND5E.ItemRarityLegendary", + }); + } } async addFeatFilters() { @@ -1543,37 +1561,66 @@ class CompendiumBrowser extends Application { // Feature Filters //Foundry v10+ Item#data is now Item#system if (CompendiumBrowser.isFoundryV10Plus) { - this.addFeatFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("DND5E.Source"), 'system.source', 'text'); + this.addFeatFilter("CMPBrowser.general", "DND5E.Source", 'system.source', 'text'); } else { - this.addFeatFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("DND5E.Source"), 'data.source', 'text'); + this.addFeatFilter("CMPBrowser.general", "DND5E.Source", 'data.source', 'text'); } - this.addFeatFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.class"), 'classRequirement', 'select', + this.addFeatFilter("CMPBrowser.general", "ITEM.TypeClass", 'classRequirement', 'select', { - artificer: game.i18n.localize("CMPBrowser.artificer"), - barbarian: "Barbarian", - bard: game.i18n.localize("CMPBrowser.bard"), - cleric: game.i18n.localize("CMPBrowser.cleric"), - druid: game.i18n.localize("CMPBrowser.druid"), - fighter: "Fighter", - monk: "Monk", - paladin: game.i18n.localize("CMPBrowser.paladin"), - ranger: game.i18n.localize("CMPBrowser.ranger"), - rogue: "Rogue", - sorcerer: game.i18n.localize("CMPBrowser.sorcerer"), - warlock: game.i18n.localize("CMPBrowser.warlock"), - wizard: game.i18n.localize("CMPBrowser.wizard") + artificer: "CMPBrowser.artificer", + barbarian: "CMPBrowser.barbarian", + bard: "CMPBrowser.bard", + cleric: "CMPBrowser.cleric", + druid: "CMPBrowser.druid", + fighter: "CMPBrowser.fighter", + monk: "CMPBrowser.monk", + paladin: "CMPBrowser.paladin", + ranger: "CMPBrowser.ranger", + rogue: "CMPBrowser.rogue", + sorcerer: "CMPBrowser.sorcerer", + warlock: "CMPBrowser.warlock", + wizard: "CMPBrowser.wizard" }, true); + let featureTypes = { + class: "ITEM.TypeClass", + feat: "ITEM.TypeFeat", + }; + + //subclasses don't exist lower then version 10 if (CompendiumBrowser.isFoundryV10Plus) { - this.addFeatFilter("Game Mechanics", game.i18n.localize("DND5E.ItemActivationCost"), 'system.activation.type', 'select', CONFIG.DND5E.abilityActivationTypes); + featureTypes.subclass = "ITEM.TypeSubclass"; + featureTypes.background = "DND5E.Background"; + } + + this.addFeatFilter("CMPBrowser.general", "CMPBrowser.overall", 'type', 'select', + featureTypes + , false); + + if (CompendiumBrowser.isFoundryV10Plus) { + this.addFeatFilter("CMPBrowser.general", "DND5E.ItemFeatureType", 'system.type.value', 'select', + Object.keys(dnd5e.config.featureTypes).reduce(function(acc, current) { + acc[current] = dnd5e.config.featureTypes[current].label; + return acc; + }, {}) + , false); + } + + if (CompendiumBrowser.isFoundryV10Plus) { + this.addFeatFilter("CMPBrowser.general", "CMPBrowser.subfeature", 'system.type.subtype', 'select', + dnd5e.config.featureTypes.class.subtypes); + } + + if (CompendiumBrowser.isFoundryV10Plus) { + this.addFeatFilter("CMPBrowser.GameMechanics", "DND5E.ItemActivationCost", 'system.activation.type', 'select', CONFIG.DND5E.abilityActivationTypes); } else { - this.addFeatFilter("Game Mechanics", game.i18n.localize("DND5E.ItemActivationCost"), 'data.activation.type', 'select', CONFIG.DND5E.abilityActivationTypes); + this.addFeatFilter("CMPBrowser.GameMechanics", "DND5E.ItemActivationCost", 'data.activation.type', 'select', CONFIG.DND5E.abilityActivationTypes); } - this.addFeatFilter("Game Mechanics", game.i18n.localize("CMPBrowser.damageType"), 'damageTypes', 'select', CONFIG.DND5E.damageTypes); - this.addFeatFilter("Game Mechanics", "Uses Resources", 'usesRessources', 'bool'); + this.addFeatFilter("CMPBrowser.GameMechanics", "CMPBrowser.damageType", 'damageTypes', 'select', CONFIG.DND5E.damageTypes); + this.addFeatFilter("CMPBrowser.GameMechanics", "CMPBrowser.UsesResources", 'usesRessources', 'bool'); } @@ -1583,20 +1630,20 @@ class CompendiumBrowser extends Application { //Foundry v10+ Actor#data is now Actor#system if (CompendiumBrowser.isFoundryV10Plus) { - this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("DND5E.Source"), 'system.details.source', 'text'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.size"), 'system.traits.size', 'select', CONFIG.DND5E.actorSizes); - this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.hasSpells"), 'hasSpells', 'bool'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.hasLegAct"), 'system.resources.legact.max', 'bool'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.hasLegRes"), 'system.resources.legres.max', 'bool'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.cr"), 'system.details.cr', 'numberCompare'); + this.addNpcFilter("CMPBrowser.general", "DND5E.Source", 'system.details.source', 'text'); + this.addNpcFilter("CMPBrowser.general", "DND5E.Size", 'system.traits.size', 'select', CONFIG.DND5E.actorSizes); + this.addNpcFilter("CMPBrowser.general", "CMPBrowser.hasSpells", 'hasSpells', 'bool'); + this.addNpcFilter("CMPBrowser.general", "CMPBrowser.hasLegAct", 'system.resources.legact.max', 'bool'); + this.addNpcFilter("CMPBrowser.general", "CMPBrowser.hasLegRes", 'system.resources.legres.max', 'bool'); + this.addNpcFilter("CMPBrowser.general", "DND5E.ChallengeRating", 'system.details.cr', 'numberCompare'); } else { - this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("DND5E.Source"), 'data.details.source', 'text'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.size"), 'data.traits.size', 'select', CONFIG.DND5E.actorSizes); - this.addNpcFilter(game.i18n.localize("CMPBrowser.general"), game.i18n.localize("CMPBrowser.hasSpells"), 'hasSpells', 'bool'); - 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("CMPBrowser.general", "DND5E.Source", 'data.details.source', 'text'); + this.addNpcFilter("CMPBrowser.general", "DND5E.Size", 'data.traits.size', 'select', CONFIG.DND5E.actorSizes); + this.addNpcFilter("CMPBrowser.general", "CMPBrowser.hasSpells", 'hasSpells', 'bool'); + this.addNpcFilter("CMPBrowser.general", "CMPBrowser.hasLegAct", 'data.resources.legact.max', 'bool'); + this.addNpcFilter("CMPBrowser.general", "CMPBrowser.hasLegRes", 'data.resources.legres.max', 'bool'); + this.addNpcFilter("CMPBrowser.general", "DND5E.ChallengeRating", 'data.details.cr', 'numberCompare'); } let npcDetailsPath; //Foundry v10+ Actor#data is now Actor#system @@ -1611,51 +1658,51 @@ class CompendiumBrowser extends Application { 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"), - construct: game.i18n.localize("CMPBrowser.construct"), - dragon: game.i18n.localize("CMPBrowser.dragon"), - elemental: game.i18n.localize("CMPBrowser.elemental"), - fey: game.i18n.localize("CMPBrowser.fey"), - fiend: game.i18n.localize("CMPBrowser.fiend"), - giant: game.i18n.localize("CMPBrowser.giant"), - humanoid: game.i18n.localize("CMPBrowser.humanoid"), - monstrosity: game.i18n.localize("CMPBrowser.monstrosity"), - ooze: game.i18n.localize("CMPBrowser.ooze"), - plant: game.i18n.localize("CMPBrowser.plant"), - undead: game.i18n.localize("CMPBrowser.undead") + this.addNpcFilter("CMPBrowser.general", "DND5E.CreatureType", npcDetailsPath, 'text', { + aberration: "DND5E.CreatureAberration", + beast: "DND5E.CreatureBeast", + celestial: "DND5E.CreatureCelestial", + construct: "DND5E.CreatureConstruct", + dragon: "DND5E.CreatureDragon", + elemental: "DND5E.CreatureElemental", + fey: "DND5E.CreatureFey", + fiend: "DND5E.CreatureFiend", + giant: "DND5E.CreatureGiant", + humanoid: "DND5E.CreatureHumanoid", + monstrosity: "DND5E.CreatureMonstrosity", + ooze: "DND5E.CreatureOoze", + plant: "DND5E.CreaturePlant", + undead: "DND5E.CreatureUndead" }); //Foundry v10+ Actor#data is now Actor#system if (CompendiumBrowser.isFoundryV10Plus) { - this.addNpcFilter(game.i18n.localize("CMPBrowser.abilities"), game.i18n.localize("DND5E.AbilityStr"), 'system.abilities.str.value', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.abilities"), game.i18n.localize("DND5E.AbilityDex"), 'system.abilities.dex.value', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.abilities"), game.i18n.localize("DND5E.AbilityCon"), 'system.abilities.con.value', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.abilities"), game.i18n.localize("DND5E.AbilityInt"), 'system.abilities.int.value', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.abilities"), game.i18n.localize("DND5E.AbilityWis"), 'system.abilities.wis.value', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.abilities"), game.i18n.localize("DND5E.AbilityCha"), 'system.abilities.cha.value', 'numberCompare'); + this.addNpcFilter("DND5E.Abilities", "DND5E.AbilityStr", 'system.abilities.str.value', 'numberCompare'); + this.addNpcFilter("DND5E.Abilities", "DND5E.AbilityDex", 'system.abilities.dex.value', 'numberCompare'); + this.addNpcFilter("DND5E.Abilities", "DND5E.AbilityCon", 'system.abilities.con.value', 'numberCompare'); + this.addNpcFilter("DND5E.Abilities", "DND5E.AbilityInt", 'system.abilities.int.value', 'numberCompare'); + this.addNpcFilter("DND5E.Abilities", "DND5E.AbilityWis", 'system.abilities.wis.value', 'numberCompare'); + this.addNpcFilter("DND5E.Abilities", "DND5E.AbilityCha", 'system.abilities.cha.value', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.dmgInteraction"), game.i18n.localize("DND5E.DamImm"), 'system.traits.di.value', 'multiSelect', CONFIG.DND5E.damageTypes, true); - this.addNpcFilter(game.i18n.localize("CMPBrowser.dmgInteraction"), game.i18n.localize("DND5E.DamRes"), 'system.traits.dr.value', 'multiSelect', CONFIG.DND5E.damageTypes, true); - this.addNpcFilter(game.i18n.localize("CMPBrowser.dmgInteraction"), game.i18n.localize("DND5E.DamVuln"), 'system.traits.dv.value', 'multiSelect', CONFIG.DND5E.damageTypes, true); - this.addNpcFilter(game.i18n.localize("CMPBrowser.dmgInteraction"), game.i18n.localize("DND5E.ConImm"), 'system.traits.ci.value', 'multiSelect', CONFIG.DND5E.conditionTypes, true); - this.addNpcFilter(game.i18n.localize("CMPBrowser.dmgInteraction"), game.i18n.localize("CMPBrowser.dmgDealt"), 'damageDealt', 'multiSelect', CONFIG.DND5E.damageTypes, true); + this.addNpcFilter("CMPBrowser.dmgInteraction", "DND5E.DamImm", 'system.traits.di.value', 'multiSelect', CONFIG.DND5E.damageTypes, true); + this.addNpcFilter("CMPBrowser.dmgInteraction", "DND5E.DamRes", 'system.traits.dr.value', 'multiSelect', CONFIG.DND5E.damageTypes, true); + this.addNpcFilter("CMPBrowser.dmgInteraction", "DND5E.DamVuln", 'system.traits.dv.value', 'multiSelect', CONFIG.DND5E.damageTypes, true); + this.addNpcFilter("CMPBrowser.dmgInteraction", "DND5E.ConImm", 'system.traits.ci.value', 'multiSelect', CONFIG.DND5E.conditionTypes, true); + this.addNpcFilter("CMPBrowser.dmgInteraction", "CMPBrowser.dmgDealt", 'damageDealt', 'multiSelect', CONFIG.DND5E.damageTypes, true); } else { - this.addNpcFilter(game.i18n.localize("CMPBrowser.abilities"), game.i18n.localize("DND5E.AbilityStr"), 'data.abilities.str.value', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.abilities"), game.i18n.localize("DND5E.AbilityDex"), 'data.abilities.dex.value', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.abilities"), game.i18n.localize("DND5E.AbilityCon"), 'data.abilities.con.value', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.abilities"), game.i18n.localize("DND5E.AbilityInt"), 'data.abilities.int.value', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.abilities"), game.i18n.localize("DND5E.AbilityWis"), 'data.abilities.wis.value', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.abilities"), game.i18n.localize("DND5E.AbilityCha"), 'data.abilities.cha.value', 'numberCompare'); + this.addNpcFilter("DND5E.Abilities", "DND5E.AbilityStr", 'data.abilities.str.value', 'numberCompare'); + this.addNpcFilter("DND5E.Abilities", "DND5E.AbilityDex", 'data.abilities.dex.value', 'numberCompare'); + this.addNpcFilter("DND5E.Abilities", "DND5E.AbilityCon", 'data.abilities.con.value', 'numberCompare'); + this.addNpcFilter("DND5E.Abilities", "DND5E.AbilityInt", 'data.abilities.int.value', 'numberCompare'); + this.addNpcFilter("DND5E.Abilities", "DND5E.AbilityWis", 'data.abilities.wis.value', 'numberCompare'); + this.addNpcFilter("DND5E.Abilities", "DND5E.AbilityCha", 'data.abilities.cha.value', 'numberCompare'); - this.addNpcFilter(game.i18n.localize("CMPBrowser.dmgInteraction"), game.i18n.localize("DND5E.DamImm"), 'data.traits.di.value', 'multiSelect', CONFIG.DND5E.damageTypes, true); - this.addNpcFilter(game.i18n.localize("CMPBrowser.dmgInteraction"), game.i18n.localize("DND5E.DamRes"), 'data.traits.dr.value', 'multiSelect', CONFIG.DND5E.damageTypes, true); - this.addNpcFilter(game.i18n.localize("CMPBrowser.dmgInteraction"), game.i18n.localize("DND5E.DamVuln"), 'data.traits.dv.value', 'multiSelect', CONFIG.DND5E.damageTypes, true); - this.addNpcFilter(game.i18n.localize("CMPBrowser.dmgInteraction"), game.i18n.localize("DND5E.ConImm"), 'data.traits.ci.value', 'multiSelect', CONFIG.DND5E.conditionTypes, true); - this.addNpcFilter(game.i18n.localize("CMPBrowser.dmgInteraction"), game.i18n.localize("CMPBrowser.dmgDealt"), 'damageDealt', 'multiSelect', CONFIG.DND5E.damageTypes, true); + this.addNpcFilter("CMPBrowser.dmgInteraction", "DND5E.DamImm", 'data.traits.di.value', 'multiSelect', CONFIG.DND5E.damageTypes, true); + this.addNpcFilter("CMPBrowser.dmgInteraction", "DND5E.DamRes", 'data.traits.dr.value', 'multiSelect', CONFIG.DND5E.damageTypes, true); + this.addNpcFilter("CMPBrowser.dmgInteraction", "DND5E.DamVuln", 'data.traits.dv.value', 'multiSelect', CONFIG.DND5E.damageTypes, true); + this.addNpcFilter("CMPBrowser.dmgInteraction", "DND5E.ConImm", 'data.traits.ci.value', 'multiSelect', CONFIG.DND5E.conditionTypes, true); + this.addNpcFilter("CMPBrowser.dmgInteraction", "CMPBrowser.dmgDealt", 'damageDealt', 'multiSelect', CONFIG.DND5E.damageTypes, true); } } @@ -1705,6 +1752,246 @@ class CompendiumBrowser extends Application { addItemFilter(category, label, path, type, possibleValues = null, valIsArray = false) { this.addFilter('item', category, label, path, type, possibleValues, valIsArray); } + + async renderWith(tab="spell", filters=[]){ + + //if there isn't a tab error out + if(!this[`${tab}Filters`]){ + ui.notifications.warn(`no tab by name ${tab}`); + return + } + + this.resetFilters(); + + this.refreshList = tab; + + let html = await this.render(); + + let activateFilters = filters.reduce((acc, input) => { + let filter = this.findFilter(tab, input.section, input.label); + + if (filter){ + if (input.value){ + filter.value = input.value; + } + else if(input.values){ + filter.values = input.values; + } + else{ + ui.notifications.warn(`no value(s) in filter:${tab} ${input.section}, ${input.label}`); + } + + acc[stripSpecialCharacters(filter.path)] = filter; + } + else{ + ui.notifications.warn(`filter not found: tab:${tab} ${input.section}, ${input.label}.`); + } + + return acc; + }, + {}) + + this[`${tab}Filters`].activeFilters = activateFilters; + + //wait for after the afterRender function to change tabs + //this avoids some errors when initially opening the window + CompendiumBrowser.postRender = async ()=>{ + + CompendiumBrowser.postRender = ()=>{}; + + await html.activateTab(tab); + + for (let input of filters){ + let filter = this.findFilter(tab, input.section, input.label); + + if (!filter){ + continue; + } + + const typeMap = { + select:"select", + bool: "select", + text: "input", + } + + if (filter.type in typeMap){ + let component = html.element.find(`div.tab.active #${input.section}-${input.label} ${typeMap[filter.type]}`) + + component[0].value = input.value; + } + else if (filter.type == "multiSelect"){ + let components = html.element.find(`div.tab.active #${input.section}-${input.label}`) + + for (let v of input.values){ + let c = components.find(`input[data-value=${v}]`) + c.prop( "checked", true ); + } + } + else{ + ui.notifications.warn(`Unknown filter type?`); + console.log(filter) + } + + } + + }; + + this.render(true); + + return this + } + + findFilter(type, category, label){ + let target = `${type}Filters`; + let catId = stripSpecialCharacters(category); + + if (!this[target].registeredFilterCategorys[catId]){ + return; + } + + let filter = this[target].registeredFilterCategorys[catId].filters. + find(x => x.labelId == label) + + if (!filter){ + return; + } + + return { + path: filter.path, + type: filter.type, + valIsArray: filter.valIsArray, + } + } + + async copySearchToClipboard(tab){ + const text = this.getSearchText(tab) + + try { + await navigator.clipboard.writeText(text); + ui.notifications.info("Javascript Copied to clipboard") + } catch (err) { + ui.notifications.warn("failed to copy javascript to clipboard, check logs for string") + console.error('Failed to copy: ', err); + console.log(text); + } + } + + getSearchText(tab){ + const target = `${tab}Filters` + + //map active filters to their labels + let output = Object.values(this[target].activeFilters).map(filter => { + //find Filters from paths + let out = this.findFilterR(target, filter) + + if(filter.value){ + out.value = filter.value; + } + else if(filter.values){ + out.values = filter.values; + } + + return out; + }) + + const strOut = `game.compendiumBrowser.renderWith("${tab}", ${JSON.stringify(output)})` + + return strOut; + } + + findFilterR(target, filterTarget){ + for (let cat of Object.keys(this[target].registeredFilterCategorys)){ + for (let filter of this[target].registeredFilterCategorys[cat].filters){ + if (filterTarget.path == filter.path){ + return {section:`${cat}`, label:`${filter.labelId}`} + } + } + } + + ui.notifications.warn("Could not find the filter!!") + console.warn(filterTarget) + return; + } + + static async addTidySheetButton(cb, html, actor){ + + await html.find('.spell-browser-btn').remove(); + + let tabBar = html.find("div.tab.spellbook .spellcasting-ability") + // console.log(tabBar) + const cbButton = $(`
`); + + tabBar.append(cbButton) + + CompendiumBrowser.addSpellsButton(cbButton, actor.actor) + } + + static async addDefaultSheetButton(cb, html, actor){ + + await html.find('.spell-browser-btn').remove(); + + let tabBar = html.find("div.spellbook-filters") + // console.log(tabBar) + const cbButton = $(`
`); + + tabBar.append(cbButton) + + CompendiumBrowser.addSpellsButton(cbButton, actor.actor) + } + + static addSpellsButton(cbButton, character){ + + cbButton.click(async ev => { + ev.preventDefault(); + + let target = []; + + target = target.concat(CompendiumBrowser.findCasterClass(character)); + target = target.concat(CompendiumBrowser.findMaxCasterLevel(character)); + + game.compendiumBrowser.renderWith("spell", target); + }); + + } + + //find the first caster class of the character + static findCasterClass(character){ + const options = ["artificer", "bard", "cleric", "druid", "paladin", "ranger", "sorcerer", "warlock", "wizard"] + + for (let cls of Object.keys(character.classes)){ + if (options.includes(cls)){ + return [{"section":"CMPBrowsergeneral","label":"ITEMTypeClass","value":cls}]; + } + } + + return []; + } + + static findMaxCasterLevel(character){ + + //find max spell level + let maxLevel = Object.keys(character.system.spells).reduce((acc, spell)=>{ + //special case for pact magic + if (spell == "pact"){ + return Math.max(character.system.spells[spell].level, acc) + } + else{ + let spellObject = character.system.spells[spell]; + if ((spellObject.override ?? spellObject.max) > 0){ + let match = spell.match(/spell(?\d+)/); + return Math.max(parseInt(match.groups.lvl), acc) + } + } + + return acc + }, 0) + + if (maxLevel > 0){ + return [{"section":"CMPBrowsergeneral","label":"DND5ELevel", values: [...Array(maxLevel + 1).keys()]}]; + } + + return []; + } } Hooks.on('ready', async () => { @@ -1723,4 +2010,11 @@ Hooks.on('ready', async () => { }); +function stripSpecialCharacters(str){ + return str.replace(/\W/g, ''); +} + +Hooks.on("renderActorSheet5eCharacter", CompendiumBrowser.addDefaultSheetButton); +Hooks.on("renderTidy5eSheet", CompendiumBrowser.addTidySheetButton); + Hooks.on("renderCompendiumBrowser", CompendiumBrowser.afterRender); diff --git a/lang/de.json b/lang/de.json index 2248f3b..ae5cbfb 100644 --- a/lang/de.json +++ b/lang/de.json @@ -1,61 +1,59 @@ { - "CMPBrowser.compendiumBrowser": "Kompendium Browser", - "CMPBrowser.sortBy": "Sortiere anhand", - "CMPBrowser.cr": "Herausforderungsgrad", - "CMPBrowser.generalSettings": "Allgemeine Einstellungen", - "CMPBrowser.allowSpellAcc": "Erlaubew Spielern den Zugriff auf den Zauber Browser", - "CMPBrowser.allowNpcAcc": "Erlaube Spielern den Zugriff auf den NSC Browser", - "CMPBrowser.compSettingsSpell": "Gegenstands Kompendium Einstellungen", - "CMPBrowser.compSettingsNpc": "NSC Kompendium Einstellungen", - "CMPBrowser.load": "Laden", - "CMPBrowser.lvl": "Stufe", - "CMPBrowser.ritual": "Ritual", - "CMPBrowser.concentration": "Konzentration", - "CMPBrowser.verbal": "Verbal", - "CMPBrowser.somatic": "Gesten", - "CMPBrowser.material": "Material", - "CMPBrowser.cantip": "Zaubertrick", - "CMPBrowser.school": "Schule", - "CMPBrowser.castingTime": "Wirkungsdauer", - "CMPBrowser.bonusAction": "Bonusaktion", - "CMPBrowser.reaction": "Reaktion", - "CMPBrowser.spellType": "Zauberart", - "CMPBrowser.damageType": "Schadensart", - "CMPBrowser.class": "Klasse", - "CMPBrowser.artificer": "Artificer", - "CMPBrowser.bard": "Barde", - "CMPBrowser.cleric": "Kleriker", - "CMPBrowser.druid": "Druide", - "CMPBrowser.paladin": "Paladin", - "CMPBrowser.ranger": "Waldläufer", - "CMPBrowser.sorcerer": "Zauberer", - "CMPBrowser.warlock": "Hexenmeister", - "CMPBrowser.wizard": "Magier", - "CMPBrowser.general": "Allgemein", - "CMPBrowser.components": "Komponenten", - "CMPBrowser.hasSpells": "Hat Zauber", - "CMPBrowser.hasLegAct": "Hat Legendäre Aktionen", - "CMPBrowser.hasLegRes": "Hat Legendäre Resistenz", - "CMPBrowser.creatureType": "Kreaturentyp", - "CMPBrowser.aberration": "Aberration", - "CMPBrowser.beast": "Tier", - "CMPBrowser.celestial": "Himmlischer", - "CMPBrowser.construct": "Konstrukt", - "CMPBrowser.dragon": "Drache", - "CMPBrowser.elemental": "Elementar", - "CMPBrowser.fey": "Fee", - "CMPBrowser.fiend": "Unhold", - "CMPBrowser.giant": "Riese", - "CMPBrowser.humanoid": "Humanoid", - "CMPBrowser.monstrosity": "Monstrosität", - "CMPBrowser.ooze": "Schlick", - "CMPBrowser.plant": "Pflanze", - "CMPBrowser.undead": "Untot", - "CMPBrowser.abilities": "Fertigkeiten", - "CMPBrowser.dmgInteraction": "Schadensinteraktion", - "CMPBrowser.dmgDealt": "Schaden zugefügt", - "CMPBrowser.size": "Größe", - "CMPBrowser.spellBrowser": "Zauber Browser", - "CMPBrowser.npcBrowser": "NSC Browser", - "CMPBrowser.settings": "Einstellungen" -} + "CMPBrowser.compendiumBrowser": "Kompendium Browser", + "CMPBrowser.sortBy": "Sortiere anhand", + "CMPBrowser.generalSettings": "Allgemeine Einstellungen", + "CMPBrowser.allowSpellAcc": "Erlaubew Spielern den Zugriff auf den Zauber Browser", + "CMPBrowser.allowFeatAcc": "Allow Players Access to the feat browser", + "CMPBrowser.allowItemAcc": "Allow Players Access to the item browser", + "CMPBrowser.allowNpcAcc": "Erlaube Spielern den Zugriff auf den NSC Browser", + "CMPBrowser.compSettingsSpell": "Gegenstands Kompendium Einstellungen", + "CMPBrowser.compSettingsNpc": "NSC Kompendium Einstellungen", + "CMPBrowser.load": "Laden", + "CMPBrowser.castingTime": "Wirkungsdauer", + "CMPBrowser.spellType": "Zauberart", + "CMPBrowser.damageType": "Schadensart", + "CMPBrowser.UsesResources": "Uses Resources", + "CMPBrowser.GameMechanics": "Game Mechanics", + "CMPBrowser.ItemSubtype": "Item Subtype", + "CMPBrowser.MagicItems": "Magic Items", + "CMPBrowser.ItemsPacks": "Packs", + "CMPBrowser.ItemsPacksBurglar": "Burglar's Pack", + "CMPBrowser.ItemsPacksDiplomat": "Diplomat's Pack", + "CMPBrowser.ItemsPacksDungeoneer": "Dungeoneer's Pack", + "CMPBrowser.ItemsPacksEntertainer": "Entertainer's Pack", + "CMPBrowser.ItemsPacksExplorer": "Explorer's Pack", + "CMPBrowser.ItemsPacksMonsterHunter": "Monster Hunter's Pack", + "CMPBrowser.ItemsPacksPriest": "Priest's Pack", + "CMPBrowser.ItemsPacksScholar": "Scholar's Pack", + "CMPBrowser.artificer": "Artificer", + "CMPBrowser.barbarian": "Barbarian", + "CMPBrowser.bard": "Barde", + "CMPBrowser.cleric": "Kleriker", + "CMPBrowser.druid": "Druide", + "CMPBrowser.fighter": "Fighter", + "CMPBrowser.monk": "Monk", + "CMPBrowser.paladin": "Paladin", + "CMPBrowser.ranger": "Waldläufer", + "CMPBrowser.rogue": "Rogue", + "CMPBrowser.sorcerer": "Zauberer", + "CMPBrowser.warlock": "Hexenmeister", + "CMPBrowser.wizard": "Magier", + "CMPBrowser.general": "Allgemein", + "CMPBrowser.hasSpells": "Hat Zauber", + "CMPBrowser.hasLegAct": "Hat Legendäre Aktionen", + "CMPBrowser.hasLegRes": "Hat Legendäre Resistenz", + "CMPBrowser.dmgInteraction": "Schadensinteraktion", + "CMPBrowser.dmgDealt": "Schaden zugefügt", + "CMPBrowser.Tab.SpellBrowser": "Zauber Browser", + "CMPBrowser.Tab.FeatBrowser": "Feat Browser", + "CMPBrowser.Tab.ItemBrowser": "Item Browser", + "CMPBrowser.Tab.NPCBrowser": "NSC Browser", + "CMPBrowser.Tab.Settings": "Einstellungen", + "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": "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" + +} \ No newline at end of file diff --git a/lang/en.json b/lang/en.json index 6ee9710..6bb1067 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1,70 +1,61 @@ { "CMPBrowser.compendiumBrowser":"Compendium Browser", "CMPBrowser.sortBy":"Sort by", - "CMPBrowser.cr":"Challenge Rating", "CMPBrowser.generalSettings":"General Settings", - "CMPBrowser.allowSpellAcc":"Allow Players Access to the spell browser", - "CMPBrowser.allowNpcAcc":"Allow Players Access to the npc browser", - "CMPBrowser.compSettingsSpell":"Item Compendium Settings", - "CMPBrowser.compSettingsNpc":"NPC Compendium Settings", + "CMPBrowser.allowSpellAcc": "Allow Players Access to the spell browser", + "CMPBrowser.allowFeatAcc": "Allow Players Access to the feat browser", + "CMPBrowser.allowItemAcc": "Allow Players Access to the item browser", + "CMPBrowser.allowNpcAcc": "Allow Players Access to the npc browser", + "CMPBrowser.compSettingsSpell": "Item Compendium Settings", + "CMPBrowser.compSettingsNpc": "NPC Compendium Settings", "CMPBrowser.load":"Load", - "CMPBrowser.lvl":"Level", - "CMPBrowser.ritual":"Ritual", - "CMPBrowser.concentration":"Concentration", - "CMPBrowser.verbal":"Verbal", - "CMPBrowser.somatic":"Somatic", - "CMPBrowser.material":"Material", - "CMPBrowser.cantip":"Cantrip", - "CMPBrowser.school":"School", "CMPBrowser.castingTime":"Casting Time", - "CMPBrowser.bonusAction":"Bonus Action", - "CMPBrowser.reaction":"Reaction", "CMPBrowser.spellType":"Spell Type", "CMPBrowser.damageType":"Damage Type", - "CMPBrowser.class":"Class", - "CMPBrowser.artificer":"Artificer", - "CMPBrowser.bard":"Bard", - "CMPBrowser.cleric":"Cleric", - "CMPBrowser.druid":"Druid", - "CMPBrowser.paladin":"Paladin", - "CMPBrowser.ranger":"Ranger", - "CMPBrowser.sorcerer":"Sorcerer", - "CMPBrowser.warlock":"Warlock", - "CMPBrowser.wizard":"Wizard", + "CMPBrowser.UsesResources": "Uses Resources", + "CMPBrowser.GameMechanics": "Game Mechanics", + "CMPBrowser.ItemSubtype": "Item Subtype", + "CMPBrowser.MagicItems": "Magic Items", + "CMPBrowser.ItemsPacks": "Packs", + "CMPBrowser.ItemsPacksBurglar": "Burglar's Pack", + "CMPBrowser.ItemsPacksDiplomat": "Diplomat's Pack", + "CMPBrowser.ItemsPacksDungeoneer": "Dungeoneer's Pack", + "CMPBrowser.ItemsPacksEntertainer": "Entertainer's Pack", + "CMPBrowser.ItemsPacksExplorer": "Explorer's Pack", + "CMPBrowser.ItemsPacksMonsterHunter": "Monster Hunter's Pack", + "CMPBrowser.ItemsPacksPriest": "Priest's Pack", + "CMPBrowser.ItemsPacksScholar": "Scholar's Pack", + "CMPBrowser.artificer": "Artificer", + "CMPBrowser.barbarian": "Barbarian", + "CMPBrowser.bard": "Bard", + "CMPBrowser.cleric": "Cleric", + "CMPBrowser.druid": "Druid", + "CMPBrowser.fighter": "Fighter", + "CMPBrowser.monk": "Monk", + "CMPBrowser.paladin": "Paladin", + "CMPBrowser.ranger": "Ranger", + "CMPBrowser.rogue": "Rogue", + "CMPBrowser.sorcerer": "Sorcerer", + "CMPBrowser.warlock": "Warlock", + "CMPBrowser.wizard": "Wizard", "CMPBrowser.general":"General", - "CMPBrowser.components":"Components", + "CMPBrowser.overall":"Overall Type", + "CMPBrowser.subfeature":"Subfeature Type", "CMPBrowser.hasSpells":"Has Spells", "CMPBrowser.hasLegAct":"Has Legendary Actions", "CMPBrowser.hasLegRes":"Has Legendary Resistance", - "CMPBrowser.creatureType":"Creature Type", - "CMPBrowser.aberration": "Aberration", - "CMPBrowser.beast": "Beast", - "CMPBrowser.celestial": "Celestial", - "CMPBrowser.construct": "construct", - "CMPBrowser.dragon": "Dragon", - "CMPBrowser.elemental": "Elemental", - "CMPBrowser.fey": "Fey", - "CMPBrowser.fiend": "Fiend", - "CMPBrowser.giant": "Giant", - "CMPBrowser.humanoid": "Humanoid", - "CMPBrowser.monstrosity": "Monstrosity", - "CMPBrowser.ooze": "Ooze", - "CMPBrowser.plant": "Plant", - "CMPBrowser.undead": "Undead", - "CMPBrowser.abilities": "Abilities", "CMPBrowser.dmgInteraction": "Damage Interaction", "CMPBrowser.dmgDealt": "Damage Dealt", - "CMPBrowser.size": "Size", - "CMPBrowser.Tab.SpellBrowser":"Spell Browser", + "CMPBrowser.Tab.SpellBrowser": "Spell Browser", "CMPBrowser.Tab.FeatBrowser": "Feat Browser", "CMPBrowser.Tab.ItemBrowser": "Item Browser", - "CMPBrowser.Tab.NPCBrowser":"NPC Browser", - "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" : "Loading...{numLoaded} {itemType}s", + "CMPBrowser.Tab.NPCBrowser": "NPC Browser", + "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": "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" - + "CMPBrowser.LOADED.MaxLoaded": "(maximum displayed; to see more, use the filters)", + "CMPBrowser.Filters.ResetFilters": "Reset Filters" + } \ No newline at end of file diff --git a/lang/es.json b/lang/es.json index 4ec0fed..9c37a8b 100644 --- a/lang/es.json +++ b/lang/es.json @@ -1,66 +1,59 @@ { - "CMPBrowser.compendiumBrowser": "Compendium Browser", - "CMPBrowser.sortBy": "Ordenar por", - "CMPBrowser.cr": "Valor de Desafío", - "CMPBrowser.generalSettings": "Opciones generales", - "CMPBrowser.allowSpellAcc": "Permitir a los jugadores el acceso al navegador de conjuros", - "CMPBrowser.allowNpcAcc": "Permitir a los jugadores el acceso al navegador de NPCs", - "CMPBrowser.compSettingsSpell": "Opciones del compendio de objetos", - "CMPBrowser.compSettingsNpc": "Opciones del compendio de NPCs", - "CMPBrowser.load": "Cargar", - "CMPBrowser.lvl": "Nivel", - "CMPBrowser.ritual": "Ritual", - "CMPBrowser.concentration": "Concentración", - "CMPBrowser.verbal": "Verbal", - "CMPBrowser.somatic": "Somático", - "CMPBrowser.material": "Material", - "CMPBrowser.cantip": "Truco", - "CMPBrowser.school": "Escuela", - "CMPBrowser.castingTime": "Tiempo de lanzamiento", - "CMPBrowser.bonusAction": "Acción adicional", - "CMPBrowser.reaction": "Reacción", - "CMPBrowser.spellType": "Tipo de conjuro", - "CMPBrowser.damageType": "Tipo de daño", - "CMPBrowser.class": "Clase", - "CMPBrowser.artificer": "Artificiero", - "CMPBrowser.bard": "Bardo", - "CMPBrowser.cleric": "Clérigo", - "CMPBrowser.druid": "Druida", - "CMPBrowser.fighter": "Guerrero", - "CMPBrowser.monk": "Monje", - "CMPBrowser.paladin": "Paladín", - "CMPBrowser.ranger": "Explorador", - "CMPBrowser.rogue": "Pícaro", - "CMPBrowser.sorcerer": "Hechicero", - "CMPBrowser.warlock": "Brujo", - "CMPBrowser.wizard": "Mago", - "CMPBrowser.general": "General", - "CMPBrowser.components": "Componentes", - "CMPBrowser.hasSpells": "Tiene conjuros", - "CMPBrowser.hasLegAct": "Tiene acciones legendarias", - "CMPBrowser.hasLegRes": "Tiene resistencia legendaria", - "CMPBrowser.creatureType": "Tipo de criatura", - "CMPBrowser.aberration": "Aberración", - "CMPBrowser.beast": "Bestia", - "CMPBrowser.celestial": "Celestial", - "CMPBrowser.construct": "Autómata", - "CMPBrowser.dragon": "Dragón", - "CMPBrowser.elemental": "Elemental", - "CMPBrowser.fey": "Feérico", - "CMPBrowser.fiend": "Infernal", - "CMPBrowser.giant": "Gigante", - "CMPBrowser.humanoid": "Humanoide", - "CMPBrowser.monstrosity": "Monstruosidad", - "CMPBrowser.ooze": "Cieno", - "CMPBrowser.plant": "Planta", - "CMPBrowser.undead": "Muerto viviente", - "CMPBrowser.abilities": "Habilidades", - "CMPBrowser.dmgInteraction": "Interacción con el daño", - "CMPBrowser.dmgDealt": "Daño infligido", - "CMPBrowser.size": "Tamaño", - "CMPBrowser.spellBrowser": "Conjuros", - "CMPBrowser.npcBrowser": "NPCs", - "CMPBrowser.featBrowser": "Rasgos de clase", - "CMPBrowser.itemBrowser": "Objetos", - "CMPBrowser.settings": "Opciones" -} + "CMPBrowser.compendiumBrowser": "Compendium Browser", + "CMPBrowser.sortBy": "Ordenar por", + "CMPBrowser.generalSettings": "Opciones generales", + "CMPBrowser.allowSpellAcc": "Permitir a los jugadores el acceso al navegador de conjuros", + "CMPBrowser.allowFeatAcc": "Allow Players Access to the feat browser", + "CMPBrowser.allowItemAcc": "Allow Players Access to the item browser", + "CMPBrowser.allowNpcAcc": "Permitir a los jugadores el acceso al navegador de NPCs", + "CMPBrowser.compSettingsSpell": "Opciones del compendio de objetos", + "CMPBrowser.compSettingsNpc": "Opciones del compendio de NPCs", + "CMPBrowser.load": "Cargar", + "CMPBrowser.castingTime": "Tiempo de lanzamiento", + "CMPBrowser.spellType": "Tipo de conjuro", + "CMPBrowser.damageType": "Tipo de daño", + "CMPBrowser.UsesResources": "Uses Resources", + "CMPBrowser.GameMechanics": "Game Mechanics", + "CMPBrowser.ItemSubtype": "Item Subtype", + "CMPBrowser.MagicItems": "Magic Items", + "CMPBrowser.ItemsPacks": "Packs", + "CMPBrowser.ItemsPacksBurglar": "Burglar's Pack", + "CMPBrowser.ItemsPacksDiplomat": "Diplomat's Pack", + "CMPBrowser.ItemsPacksDungeoneer": "Dungeoneer's Pack", + "CMPBrowser.ItemsPacksEntertainer": "Entertainer's Pack", + "CMPBrowser.ItemsPacksExplorer": "Explorer's Pack", + "CMPBrowser.ItemsPacksMonsterHunter": "Monster Hunter's Pack", + "CMPBrowser.ItemsPacksPriest": "Priest's Pack", + "CMPBrowser.ItemsPacksScholar": "Scholar's Pack", + "CMPBrowser.artificer": "Artificiero", + "CMPBrowser.barbarian": "Barbarian", + "CMPBrowser.bard": "Bardo", + "CMPBrowser.cleric": "Clérigo", + "CMPBrowser.druid": "Druida", + "CMPBrowser.fighter": "Guerrero", + "CMPBrowser.monk": "Monje", + "CMPBrowser.paladin": "Paladín", + "CMPBrowser.ranger": "Explorador", + "CMPBrowser.rogue": "Pícaro", + "CMPBrowser.sorcerer": "Hechicero", + "CMPBrowser.warlock": "Brujo", + "CMPBrowser.wizard": "Mago", + "CMPBrowser.general": "General", + "CMPBrowser.hasSpells": "Tiene conjuros", + "CMPBrowser.hasLegAct": "Tiene acciones legendarias", + "CMPBrowser.hasLegRes": "Tiene resistencia legendaria", + "CMPBrowser.dmgInteraction": "Interacción con el daño", + "CMPBrowser.dmgDealt": "Daño infligido", + "CMPBrowser.Tab.SpellBrowser": "Conjuros", + "CMPBrowser.Tab.FeatBrowser": "Rasgos de clase", + "CMPBrowser.Tab.ItemBrowser": "Objetos", + "CMPBrowser.Tab.NPCBrowser": "NPCs", + "CMPBrowser.Tab.Settings": "Opciones", + "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": "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" + +} \ No newline at end of file diff --git a/lang/fr.json b/lang/fr.json index fbf3402..fd40278 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -1,60 +1,59 @@ - { +{ "CMPBrowser.compendiumBrowser":"Recherche dans les Compendium", "CMPBrowser.sortBy":"Trié par", - "CMPBrowser.cr":"Niveau de la rencontre", "CMPBrowser.generalSettings":"Paramètres généraux", "CMPBrowser.allowSpellAcc":"Autoriser les joueurs à accéder aux listes de sorts", + "CMPBrowser.allowFeatAcc": "Allow Players Access to the feat browser", + "CMPBrowser.allowItemAcc": "Allow Players Access to the item browser", "CMPBrowser.allowNpcAcc":"Autoriser les joueurs à accéder aux listes de PNJ", "CMPBrowser.compSettingsSpell":"Paramètres de compendium de sorts", "CMPBrowser.compSettingsNpc":"Paramètres de compendium de PNJ", "CMPBrowser.load":"Charger", - "CMPBrowser.lvl":"Level", - "CMPBrowser.ritual":"Rituel", - "CMPBrowser.concentration":"Concentration", - "CMPBrowser.verbal":"Verbales", - "CMPBrowser.somatic":"Somatiques", - "CMPBrowser.material":"Matérielles", - "CMPBrowser.cantip":"Tours de magie", - "CMPBrowser.school":"Ecole", "CMPBrowser.castingTime":"Durée d'incantation", - "CMPBrowser.bonusAction":"Action Bonus", - "CMPBrowser.reaction":"Réaction", "CMPBrowser.spellType":"Type de sort", "CMPBrowser.damageType":"Type de dégâts", - "CMPBrowser.class":"Classe", + "CMPBrowser.UsesResources": "Uses Resources", + "CMPBrowser.GameMechanics": "Game Mechanics", + "CMPBrowser.ItemSubtype": "Item Subtype", + "CMPBrowser.MagicItems": "Magic Items", + "CMPBrowser.ItemsPacks": "Packs", + "CMPBrowser.ItemsPacksBurglar": "Burglar's Pack", + "CMPBrowser.ItemsPacksDiplomat": "Diplomat's Pack", + "CMPBrowser.ItemsPacksDungeoneer": "Dungeoneer's Pack", + "CMPBrowser.ItemsPacksEntertainer": "Entertainer's Pack", + "CMPBrowser.ItemsPacksExplorer": "Explorer's Pack", + "CMPBrowser.ItemsPacksMonsterHunter": "Monster Hunter's Pack", + "CMPBrowser.ItemsPacksPriest": "Priest's Pack", + "CMPBrowser.ItemsPacksScholar": "Scholar's Pack", + "CMPBrowser.artificer": "Artificer", + "CMPBrowser.barbarian": "Barbarian", "CMPBrowser.bard":"Barde", "CMPBrowser.cleric":"Clerc", "CMPBrowser.druid":"Druide", + "CMPBrowser.fighter": "Fighter", + "CMPBrowser.monk": "Monk", "CMPBrowser.paladin":"Paladin", "CMPBrowser.ranger":"Rôdeur", + "CMPBrowser.rogue": "Rogue", "CMPBrowser.sorcerer":"Sorcier", "CMPBrowser.warlock":"Ensorceleur", "CMPBrowser.wizard":"Magicien", "CMPBrowser.general":"Général", - "CMPBrowser.components":"Composants", "CMPBrowser.hasSpells":"à des Sorts", "CMPBrowser.hasLegAct":"à des Actions Légendaires", "CMPBrowser.hasLegRes":"à des Resistances Légendaires", - "CMPBrowser.creatureType":"Type de Créature", - "CMPBrowser.aberration": "Aberration", - "CMPBrowser.beast": "Bête", - "CMPBrowser.celestial": "Céleste", - "CMPBrowser.construct": "Artificielles", - "CMPBrowser.dragon": "Dragon", - "CMPBrowser.elemental": "Elementaire", - "CMPBrowser.fey": "Fée", - "CMPBrowser.fiend": "Fiélon", - "CMPBrowser.giant": "Géant", - "CMPBrowser.humanoid": "Humanoïde", - "CMPBrowser.monstrosity": "Monstrueuse", - "CMPBrowser.ooze": "Vase", - "CMPBrowser.plant": "Plante", - "CMPBrowser.undead": "Morts-vivants", - "CMPBrowser.abilities": "Capacités", "CMPBrowser.dmgInteraction": "Spécificité des dégâts", "CMPBrowser.dmgDealt": "Type de dégats", - "CMPBrowser.size": "Taille", - "CMPBrowser.spellBrowser":"Recherche de sorts", - "CMPBrowser.npcBrowser":"Recherche de PNJ", - "CMPBrowser.settings":"Paramétrages" - } \ No newline at end of file + "CMPBrowser.Tab.SpellBrowser": "Recherche de sorts", + "CMPBrowser.Tab.FeatBrowser": "Feat Browser", + "CMPBrowser.Tab.ItemBrowser": "Item Browser", + "CMPBrowser.Tab.NPCBrowser": "Recherche de PNJ", + "CMPBrowser.Tab.Settings": "Paramétrages", + "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": "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" + +} \ No newline at end of file diff --git a/lang/ja.json b/lang/ja.json index 5490318..9c6637c 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -1,60 +1,59 @@ { "CMPBrowser.compendiumBrowser":"辞典ブラウザ", "CMPBrowser.sortBy":"並び替え", - "CMPBrowser.cr":"難易度", "CMPBrowser.generalSettings":"一般設定", "CMPBrowser.allowSpellAcc":"プレイヤーに呪文辞典の使用を許可する。", + "CMPBrowser.allowFeatAcc": "Allow Players Access to the feat browser", + "CMPBrowser.allowItemAcc": "Allow Players Access to the item browser", "CMPBrowser.allowNpcAcc":"プレイヤーにNPC辞典の使用を許可する。", "CMPBrowser.compSettingsSpell":"呪文辞典設定", "CMPBrowser.compSettingsNpc":"NPC辞典設定", "CMPBrowser.load":"追加", - "CMPBrowser.lvl":"レベル", - "CMPBrowser.ritual":"儀式", - "CMPBrowser.concentration":"集中", - "CMPBrowser.verbal":"音声", - "CMPBrowser.somatic":"動作", - "CMPBrowser.material":"物質", - "CMPBrowser.cantip":"初級", - "CMPBrowser.school":"系統", "CMPBrowser.castingTime":"発動時間", - "CMPBrowser.bonusAction":"ボーナスアクション", - "CMPBrowser.reaction":"リアクション", "CMPBrowser.spellType":"呪文種別", "CMPBrowser.damageType":"ダメージ種別", - "CMPBrowser.class":"クラス", + "CMPBrowser.UsesResources": "Uses Resources", + "CMPBrowser.GameMechanics": "Game Mechanics", + "CMPBrowser.ItemSubtype": "Item Subtype", + "CMPBrowser.MagicItems": "Magic Items", + "CMPBrowser.ItemsPacks": "Packs", + "CMPBrowser.ItemsPacksBurglar": "Burglar's Pack", + "CMPBrowser.ItemsPacksDiplomat": "Diplomat's Pack", + "CMPBrowser.ItemsPacksDungeoneer": "Dungeoneer's Pack", + "CMPBrowser.ItemsPacksEntertainer": "Entertainer's Pack", + "CMPBrowser.ItemsPacksExplorer": "Explorer's Pack", + "CMPBrowser.ItemsPacksMonsterHunter": "Monster Hunter's Pack", + "CMPBrowser.ItemsPacksPriest": "Priest's Pack", + "CMPBrowser.ItemsPacksScholar": "Scholar's Pack", + "CMPBrowser.artificer": "Artificer", + "CMPBrowser.barbarian": "Barbarian", "CMPBrowser.bard":"バード", "CMPBrowser.cleric":"クレリック", "CMPBrowser.druid":"ドルイド", + "CMPBrowser.fighter": "Fighter", + "CMPBrowser.monk": "Monk", "CMPBrowser.paladin":"パラディン", "CMPBrowser.ranger":"レンジャー", + "CMPBrowser.rogue": "Rogue", "CMPBrowser.sorcerer":"ソーサラー", "CMPBrowser.warlock":"ウォーロック", "CMPBrowser.wizard":"ウィザード", "CMPBrowser.general":"一般", - "CMPBrowser.components":"物質構成要素", "CMPBrowser.hasSpells":"術者", "CMPBrowser.hasLegAct":"伝説的アクション所持", "CMPBrowser.hasLegRes":"伝説的抵抗所持", - "CMPBrowser.creatureType":"クリーチャー種別", - "CMPBrowser.aberration": "異形", - "CMPBrowser.beast": "野獣", - "CMPBrowser.celestial": "セレスチャル", - "CMPBrowser.construct": "人造", - "CMPBrowser.dragon": "ドラゴン", - "CMPBrowser.elemental": "エレメンタル", - "CMPBrowser.fey": "フェイ", - "CMPBrowser.fiend": "フィーンド", - "CMPBrowser.giant": "巨人", - "CMPBrowser.humanoid": "ヒューマノイド", - "CMPBrowser.monstrosity": "怪物", - "CMPBrowser.ooze": "粘体", - "CMPBrowser.plant": "植物", - "CMPBrowser.undead": "アンデッド", - "CMPBrowser.abilities": "能力値", "CMPBrowser.dmgInteraction": "ダメージ関連", "CMPBrowser.dmgDealt": "与えるダメージ種別", - "CMPBrowser.size": "サイズ", - "CMPBrowser.spellBrowser":"呪文ブラウザ", - "CMPBrowser.npcBrowser":"NPCブラウザ", - "CMPBrowser.settings":"設定" + "CMPBrowser.Tab.SpellBrowser":"呪文ブラウザ", + "CMPBrowser.Tab.FeatBrowser": "Feat Browser", + "CMPBrowser.Tab.ItemBrowser": "Item Browser", + "CMPBrowser.Tab.NPCBrowser":"NPCブラウザ", + "CMPBrowser.Tab.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": "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" + } \ No newline at end of file diff --git a/lang/pt-BR.json b/lang/pt-BR.json index 5066be0..d72feaa 100644 --- a/lang/pt-BR.json +++ b/lang/pt-BR.json @@ -1,61 +1,59 @@ { - "CMPBrowser.compendiumBrowser":"Navegador de Compêndio", - "CMPBrowser.sortBy":"Classificar por", - "CMPBrowser.cr":"Nivel de Desafio", - "CMPBrowser.generalSettings":"Configurações Gerais", - "CMPBrowser.allowSpellAcc":"Permite o acesso dos jogadores ao navegador de magias", - "CMPBrowser.allowNpcAcc":"Permite o acesso dos jogadores ao navegador de NPCs", - "CMPBrowser.compSettingsSpell":"Configuração de Compêndio de Itens", - "CMPBrowser.compSettingsNpc":"Configuração de Compêndio de NPCs", - "CMPBrowser.load":"Carregar", - "CMPBrowser.lvl":"Nivel", - "CMPBrowser.ritual":"Ritual", - "CMPBrowser.concentration":"Concentraçãon", - "CMPBrowser.verbal":"Verbal", - "CMPBrowser.somatic":"Somático", - "CMPBrowser.material":"Material", - "CMPBrowser.cantip":"Truque", - "CMPBrowser.school":"Escola", - "CMPBrowser.castingTime":"Custo de Ativação", - "CMPBrowser.bonusAction":"Ação bonus", - "CMPBrowser.reaction":"Reação", - "CMPBrowser.spellType":"Tipo da Magia", - "CMPBrowser.damageType":"Tipo de Dano", - "CMPBrowser.class":"Classe", - "CMPBrowser.artificer":"Artífice", - "CMPBrowser.bard":"Bardo", - "CMPBrowser.cleric":"Clerigo", - "CMPBrowser.druid":"Druida", - "CMPBrowser.paladin":"Paladino", - "CMPBrowser.ranger":"Guardião", - "CMPBrowser.sorcerer":"Geiticeiro", - "CMPBrowser.warlock":"Bruxo", - "CMPBrowser.wizard":"Mago", - "CMPBrowser.general":"Geral", - "CMPBrowser.components":"Componentes", - "CMPBrowser.hasSpells":"Tem Magias", - "CMPBrowser.hasLegAct":"Tem Ações Lendárias", - "CMPBrowser.hasLegRes":"Tem Resistência Lendária", - "CMPBrowser.creatureType":"Tipo de Criatura", - "CMPBrowser.aberration": "Aberração", - "CMPBrowser.beast": "Besta", - "CMPBrowser.celestial": "Celestial", - "CMPBrowser.construct": "Constructo", - "CMPBrowser.dragon": "Dragão", - "CMPBrowser.elemental": "Elemental", - "CMPBrowser.fey": "Feérico", - "CMPBrowser.fiend": "Ínfero", - "CMPBrowser.giant": "Giante", - "CMPBrowser.humanoid": "Humanoide", - "CMPBrowser.monstrosity": "Monstruosidade", - "CMPBrowser.ooze": "Gosma", - "CMPBrowser.plant": "Planta", - "CMPBrowser.undead": "Morto-Vivo", - "CMPBrowser.abilities": "Atributos", + "CMPBrowser.compendiumBrowser": "Navegador de Compêndio", + "CMPBrowser.sortBy": "Classificar por", + "CMPBrowser.generalSettings": "Configurações Gerais", + "CMPBrowser.allowSpellAcc": "Permite o acesso dos jogadores ao navegador de Magias", + "CMPBrowser.allowFeatAcc": "Permite o acesso dos jogadores ao navegador de Características", + "CMPBrowser.allowItemAcc": "Permite o acesso dos jogadores ao navegador de Itens", + "CMPBrowser.allowNpcAcc": "Permite o acesso dos jogadores ao navegador de NPCs", + "CMPBrowser.compSettingsSpell": "Configuração de Compêndio de Itens", + "CMPBrowser.compSettingsNpc": "Configuração de Compêndio de NPCs", + "CMPBrowser.load": "Carregar", + "CMPBrowser.castingTime": "Custo de Ativação", + "CMPBrowser.spellType": "Tipo da Magia", + "CMPBrowser.damageType": "Tipo de Dano", + "CMPBrowser.UsesResources": "Usa Recursos", + "CMPBrowser.GameMechanics": "Mecânicas do Jogo", + "CMPBrowser.ItemSubtype": "Tipo do Item", + "CMPBrowser.MagicItems": "Itens Mágicos", + "CMPBrowser.ItemsPacks": "Kits de Equipamentos", + "CMPBrowser.ItemsPacksBurglar": "Kit de Assaltante", + "CMPBrowser.ItemsPacksDiplomat": "Kit de Diplomata", + "CMPBrowser.ItemsPacksDungeoneer": "Kit de Explorador", + "CMPBrowser.ItemsPacksEntertainer": "Kit de Artista", + "CMPBrowser.ItemsPacksExplorer": "Kit de Aventureiro", + "CMPBrowser.ItemsPacksMonsterHunter": "Monster Hunter's Pack", + "CMPBrowser.ItemsPacksPriest": "Kit de Sacerdote", + "CMPBrowser.ItemsPacksScholar": "Kit de Erudito", + "CMPBrowser.artificer": "Artífice", + "CMPBrowser.barbarian": "Bárbaro", + "CMPBrowser.bard": "Bardo", + "CMPBrowser.cleric": "Clérigo", + "CMPBrowser.druid": "Druida", + "CMPBrowser.fighter": "Guerreiro", + "CMPBrowser.monk": "Monge", + "CMPBrowser.paladin": "Paladino", + "CMPBrowser.ranger": "Guardião", + "CMPBrowser.rogue": "Ladino", + "CMPBrowser.sorcerer": "Feiticeiro", + "CMPBrowser.warlock": "Bruxo", + "CMPBrowser.wizard": "Mago", + "CMPBrowser.general": "Geral", + "CMPBrowser.hasSpells": "Tem Magias", + "CMPBrowser.hasLegAct": "Tem Ações Lendárias", + "CMPBrowser.hasLegRes": "Tem Resistência Lendária", "CMPBrowser.dmgInteraction": "Interação do Dano", "CMPBrowser.dmgDealt": "Dano Causado", - "CMPBrowser.size": "Tamanho", - "CMPBrowser.spellBrowser":"Navegador de Magias", - "CMPBrowser.npcBrowser":"Navegador de NPC", - "CMPBrowser.settings":"Configurações" -} + "CMPBrowser.Tab.SpellBrowser": "Navegador de Magias", + "CMPBrowser.Tab.FeatBrowser": "Navegador de Características", + "CMPBrowser.Tab.ItemBrowser": "Navegador de Itens", + "CMPBrowser.Tab.NPCBrowser": "Navegador de NPC", + "CMPBrowser.Tab.Settings": "Configurações", + "CMPBrowser.SETTING.Maxload.NAME": "Capacidade máxima", + "CMPBrowser.SETTING.Maxload.HINT": "Número máximo de magias, características, itens ou NPCs a serem exibidos; para ver mais use os filtros. Essa configuração é usada para gerenciar memória e capacidade do servidor.", + "CMPBrowser.LOADING.Message": "Carregando...{numLoaded} {itemType}s", + "CMPBrowser.LOADED.Message": "{numLoaded} {itemType}s carregados(as)", + "CMPBrowser.LOADED.MaxLoaded": "(máximo exibido; para ver mais, use os filtros)", + "CMPBrowser.Filters.ResetFilters": "Redefinir Filtros" + +} \ No newline at end of file diff --git a/template/feat-browser.html b/template/feat-browser.html index 0960e31..2d55f48 100644 --- a/template/feat-browser.html +++ b/template/feat-browser.html @@ -12,6 +12,7 @@ + {{> "modules/compendium-browser/template/filter-container.html" filters=featFilters}} diff --git a/template/filter-container.html b/template/filter-container.html index 282863f..850e17d 100644 --- a/template/filter-container.html +++ b/template/filter-container.html @@ -3,7 +3,7 @@

{{cat.label}}

{{#each cat.filters as |filter key|}} -
+
{{#if filter.istext}}
{{filter.label}}
diff --git a/template/item-browser.html b/template/item-browser.html index 7b8b217..eb8b44d 100644 --- a/template/item-browser.html +++ b/template/item-browser.html @@ -12,6 +12,7 @@
+
{{> "modules/compendium-browser/template/filter-container.html" filters=itemFilters}}
diff --git a/template/npc-browser.html b/template/npc-browser.html index 16167a3..bb8a23e 100644 --- a/template/npc-browser.html +++ b/template/npc-browser.html @@ -8,11 +8,12 @@
{{localize "CMPBrowser.sortBy"}}:
+
{{> "modules/compendium-browser/template/filter-container.html" filters=npcFilters}} diff --git a/template/settings.html b/template/settings.html index 9a442be..c0d3a75 100644 --- a/template/settings.html +++ b/template/settings.html @@ -7,11 +7,11 @@