mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-06 04:44:16 +02:00
Fixed so that CompendiumBrowserSettings saves source/pack names as slugified version to avoid foundrdy not saving names with dots in the middle
This commit is contained in:
parent
2f589c1b8e
commit
ca29903a56
3 changed files with 11 additions and 6 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { slugify } from '../../helpers/utils.mjs';
|
||||
|
||||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
|
||||
export default class CompendiumBrowserSettings extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
|
|
@ -50,11 +52,12 @@ export default class CompendiumBrowserSettings extends HandlebarsApplicationMixi
|
|||
const excludedSourceData = this.browserSettings.excludedSources;
|
||||
const excludedPackData = this.browserSettings.excludedPacks;
|
||||
context.typePackCollections = game.packs.reduce((acc, pack) => {
|
||||
const { type, label, packageType, packageName: basePackageName, id } = pack.metadata;
|
||||
const { type, label, packageType, packageName: basePackageName, id: baseId } = pack.metadata;
|
||||
if (!CompendiumBrowserSettings.#browserPackTypes.includes(type)) return acc;
|
||||
|
||||
const id = slugify(baseId);
|
||||
const isWorldPack = packageType === 'world';
|
||||
const packageName = isWorldPack ? 'world' : basePackageName;
|
||||
const packageName = isWorldPack ? 'world' : slugify(basePackageName);
|
||||
const sourceChecked =
|
||||
!excludedSourceData[packageName] ||
|
||||
!excludedSourceData[packageName].excludedDocumentTypes.includes(type);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { slugify } from '../helpers/utils.mjs';
|
||||
|
||||
export default class CompendiumBrowserSettings extends foundry.abstract.DataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
|
@ -24,11 +26,12 @@ export default class CompendiumBrowserSettings extends foundry.abstract.DataMode
|
|||
const pack = game.packs.get(item.pack);
|
||||
if (!pack) return false;
|
||||
|
||||
const packageName = pack.metadata.packageType === 'world' ? 'world' : pack.metadata.packageName;
|
||||
const packageName = pack.metadata.packageType === 'world' ? 'world' : slugify(pack.metadata.packageName);
|
||||
const excludedSourceData = this.excludedSources[packageName];
|
||||
if (excludedSourceData && excludedSourceData.excludedDocumentTypes.includes(pack.metadata.type)) return true;
|
||||
|
||||
const excludedPackData = this.excludedPacks[item.pack];
|
||||
const packName = slugify(item.pack);
|
||||
const excludedPackData = this.excludedPacks[packName];
|
||||
if (excludedPackData && excludedPackData.excludedDocumentTypes.includes(pack.metadata.type)) return true;
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -449,12 +449,11 @@ export async function createEmbeddedItemsWithEffects(actor, baseData) {
|
|||
effects: data.effects?.map(effect => effect.toObject())
|
||||
});
|
||||
}
|
||||
|
||||
await actor.createEmbeddedDocuments('Item', effectData);
|
||||
}
|
||||
|
||||
export const slugify = name => {
|
||||
return name.toLowerCase().replaceAll(' ', '-').replaceAll('.', '');
|
||||
return name.toLowerCase().replaceAll(' ', '-').replaceAll('.', '_');
|
||||
};
|
||||
|
||||
export function shuffleArray(array) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue