fix for dnd5e 3.0

master 2.2.0
Matheus Clemente 2024-02-02 02:21:43 -03:00
parent 6fc06c7be2
commit 378818672b
2 changed files with 23 additions and 20 deletions

View File

@ -447,7 +447,8 @@ class CompendiumBrowser extends Application {
img: decoratedItem.img, img: decoratedItem.img,
data: { data: {
level: decoratedItem.level, level: decoratedItem.level,
components: decoratedItem.components, properties: [...decoratedItem.properties]
.reduce((obj, prop) => ({ ...obj, [prop]: true }), {}),
}, },
id: item5e.id, id: item5e.id,
}; };
@ -881,7 +882,7 @@ class CompendiumBrowser extends Application {
const item = { ...item5e }; const item = { ...item5e };
item.level = item5e.system?.level; item.level = item5e.system?.level;
item.components = item5e.system?.components; item.properties = item5e.system?.properties;
item.damage = item5e.system?.damage; item.damage = item5e.system?.damage;
item.classes = item5e.system?.classes; item.classes = item5e.system?.classes;
item.requirements = item5e.system?.requirements; item.requirements = item5e.system?.requirements;
@ -1260,12 +1261,11 @@ class CompendiumBrowser extends Application {
if (possibleValues !== null) { if (possibleValues !== null) {
filter.possibleValueIds = possibleValues; filter.possibleValueIds = possibleValues;
filter.possibleValues = Object.keys(possibleValues).reduce( filter.possibleValues = Object.fromEntries(
function (acc, current) { Object.entries(possibleValues).map(([key, data]) => {
acc[current] = game.i18n.localize(possibleValues[current]) ?? possibleValues[current]; if (typeof data === "string") return [key, game.i18n.localize(data) ?? data];
return acc; return [key, data.label];
}.bind(this), })
{}
); );
} }
filter.valIsArray = valIsArray; filter.valIsArray = valIsArray;
@ -1343,11 +1343,11 @@ class CompendiumBrowser extends Application {
}), }),
true true
); );
this.addSpellFilter("DND5E.SpellComponents", "DND5E.Ritual", "system.components.ritual", "bool"); this.addSpellFilter("DND5E.SpellComponents", "DND5E.Ritual", "system.properties.ritual", "bool");
this.addSpellFilter("DND5E.SpellComponents", "DND5E.Concentration", "system.components.concentration", "bool"); this.addSpellFilter("DND5E.SpellComponents", "DND5E.Concentration", "system.properties.concentration", "bool");
this.addSpellFilter("DND5E.SpellComponents", "DND5E.ComponentVerbal", "system.components.vocal", "bool"); this.addSpellFilter("DND5E.SpellComponents", "DND5E.ComponentVerbal", "system.properties.vocal", "bool");
this.addSpellFilter("DND5E.SpellComponents", "DND5E.ComponentSomatic", "system.components.somatic", "bool"); this.addSpellFilter("DND5E.SpellComponents", "DND5E.ComponentSomatic", "system.properties.somatic", "bool");
this.addSpellFilter("DND5E.SpellComponents", "DND5E.ComponentMaterial", "system.components.material", "bool"); this.addSpellFilter("DND5E.SpellComponents", "DND5E.ComponentMaterial", "system.properties.material", "bool");
} }
async addItemFilters() { async addItemFilters() {
@ -1515,8 +1515,11 @@ class CompendiumBrowser extends Application {
} }
_sortPackValues(packValue) { _sortPackValues(packValue) {
const sortable = Object.keys(packValue) const sortable = Object.entries(packValue)
.map((pack) => [pack, game.i18n.localize(packValue[pack])]) .map(([key, data]) => {
if (typeof data === "string") return [key, game.i18n.localize(data)];
return [key, data.label];
})
.sort((a, b) => a[1].localeCompare(b[1])); .sort((a, b) => a[1].localeCompare(b[1]));
return sortable.reduce((acc, item) => { return sortable.reduce((acc, item) => {

View File

@ -21,32 +21,32 @@
> >
<div class="spacer-large"></div> <div class="spacer-large"></div>
<span <span
class="{{#unless spell.data.components.ritual}}negative{{/unless}}" class="{{#unless spell.data.properties.ritual}}negative{{/unless}}"
data-tooltip="{{localize 'DND5E.Ritual'}}" data-tooltip="{{localize 'DND5E.Ritual'}}"
data-tooltip-direction="UP" data-tooltip-direction="UP"
>R</span >R</span
> >
<span <span
class="{{#unless spell.data.components.concentration}}negative{{/unless}}" class="{{#unless spell.data.properties.concentration}}negative{{/unless}}"
data-tooltip="{{localize 'DND5E.Concentration'}}" data-tooltip="{{localize 'DND5E.Concentration'}}"
data-tooltip-direction="UP" data-tooltip-direction="UP"
>C</span >C</span
> >
<div class="spacer"></div> <div class="spacer"></div>
<span <span
class="{{#unless spell.data.components.vocal}}negative{{/unless}}" class="{{#unless spell.data.properties.vocal}}negative{{/unless}}"
data-tooltip="{{localize 'DND5E.ComponentVerbal'}}" data-tooltip="{{localize 'DND5E.ComponentVerbal'}}"
data-tooltip-direction="UP" data-tooltip-direction="UP"
>V</span >V</span
> >
<span <span
class="{{#unless spell.data.components.somatic}}negative{{/unless}}" class="{{#unless spell.data.properties.somatic}}negative{{/unless}}"
data-tooltip="{{localize 'DND5E.ComponentSomatic'}}" data-tooltip="{{localize 'DND5E.ComponentSomatic'}}"
data-tooltip-direction="UP" data-tooltip-direction="UP"
>S</span >S</span
> >
<span <span
class="{{#unless spell.data.components.material}}negative{{/unless}}" class="{{#unless spell.data.properties.material}}negative{{/unless}}"
data-tooltip="{{localize 'DND5E.ComponentMaterial'}}" data-tooltip="{{localize 'DND5E.ComponentMaterial'}}"
data-tooltip-direction="UP" data-tooltip-direction="UP"
>M</span >M</span