Compare commits

..

No commits in common. "52b81de11f7224c15f2e76243f4228abb0ea859f" and "5ac4fc3b9ceec0f83e829295e6b197a47cdd4e01" have entirely different histories.

5 changed files with 6 additions and 15 deletions

View file

@ -358,14 +358,14 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
const experienceIncreaseTagify = htmlElement.querySelector('.levelup-experience-increases'); const experienceIncreaseTagify = htmlElement.querySelector('.levelup-experience-increases');
if (experienceIncreaseTagify) { if (experienceIncreaseTagify) {
const allExperiences = { const allExperiences = {
...this.actor.system.experiences,
...Object.values(this.levelup.levels).reduce((acc, level) => { ...Object.values(this.levelup.levels).reduce((acc, level) => {
for (const key of Object.keys(level.achievements.experiences)) { for (const key of Object.keys(level.achievements.experiences)) {
acc[key] = level.achievements.experiences[key]; acc[key] = level.achievements.experiences[key];
} }
return acc; return acc;
}, {}), }, {})
...this.actor.system.experiences
}; };
tagifyElement( tagifyElement(
experienceIncreaseTagify, experienceIncreaseTagify,

View file

@ -1,6 +1,6 @@
import BaseDataItem from './base.mjs'; import BaseDataItem from './base.mjs';
import ItemLinkFields from '../../data/fields/itemLinkFields.mjs'; import ItemLinkFields from '../../data/fields/itemLinkFields.mjs';
import { fromUuids, getFeaturesHTMLData } from '../../helpers/utils.mjs'; import { getFeaturesHTMLData } from '../../helpers/utils.mjs';
export default class DHAncestry extends BaseDataItem { export default class DHAncestry extends BaseDataItem {
/** @inheritDoc */ /** @inheritDoc */
@ -45,10 +45,6 @@ export default class DHAncestry extends BaseDataItem {
/**@inheritdoc */ /**@inheritdoc */
async getDescriptionData() { async getDescriptionData() {
// Preload all ancestry features for acquisition from the cache
// todo: make feature acquisition async and replace feature helpers for methods
await fromUuids(this._source.features.map(f => f.item));
const baseDescription = this.description; const baseDescription = this.description;
const features = await getFeaturesHTMLData(this.features); const features = await getFeaturesHTMLData(this.features);

View file

@ -1,4 +1,4 @@
import { fromUuids, getFeaturesHTMLData } from '../../helpers/utils.mjs'; import { getFeaturesHTMLData } from '../../helpers/utils.mjs';
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs'; import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
import BaseDataItem from './base.mjs'; import BaseDataItem from './base.mjs';
@ -27,10 +27,6 @@ export default class DHCommunity extends BaseDataItem {
/**@inheritdoc */ /**@inheritdoc */
async getDescriptionData() { async getDescriptionData() {
// Preload all community features for acquisition from the cache
// todo: make feature acquisition async and replace feature helpers for methods
await fromUuids(this._source.features);
const baseDescription = this.description; const baseDescription = this.description;
const features = await getFeaturesHTMLData(this.features); const features = await getFeaturesHTMLData(this.features);

View file

@ -91,7 +91,7 @@ export default class DHSubclass extends BaseDataItem {
? game.i18n.localize(CONFIG.DH.ACTOR.abilities[this.spellcastingTrait].label) ? game.i18n.localize(CONFIG.DH.ACTOR.abilities[this.spellcastingTrait].label)
: null; : null;
// Preload all subclass features for acquisition from the cache // Preload all class features for acquisition from the cache
// todo: make feature acquisition async and replace feature helpers for methods // todo: make feature acquisition async and replace feature helpers for methods
await fromUuids(this._source.features.map(f => f.item)); await fromUuids(this._source.features.map(f => f.item));

View file

@ -879,7 +879,6 @@ export async function fromUuids(uuids) {
const packEmbeddedEntries = entries.filter( const packEmbeddedEntries = entries.filter(
e => e =>
!(e.value instanceof Document) && !(e.value instanceof Document) &&
e.parsed &&
e.parsed.collection instanceof foundry.documents.collections.CompendiumCollection && e.parsed.collection instanceof foundry.documents.collections.CompendiumCollection &&
e.parsed.embedded.length > 0 e.parsed.embedded.length > 0
); );
@ -896,7 +895,7 @@ export async function fromUuids(uuids) {
const pack = game.packs.get(packGroup[0].value.pack); const pack = game.packs.get(packGroup[0].value.pack);
if (!pack) continue; if (!pack) continue;
const ids = packGroup.map(p => p.parsed?.id).filter(id => !!id); const ids = packGroup.map(p => p.parsed.id);
const documents = await pack.getDocuments({ _id__in: ids }); const documents = await pack.getDocuments({ _id__in: ids });
for (const p of packGroup) { for (const p of packGroup) {
p.value = documents.find(d => d.id === p.parsed.id) ?? p.value; p.value = documents.find(d => d.id === p.parsed.id) ?? p.value;