Fix conflict

This commit is contained in:
Dapoolp 2025-07-27 23:33:12 +02:00
commit 181f848c4e
216 changed files with 13028 additions and 658 deletions

View file

@ -123,13 +123,15 @@ export default class BeastformDialog extends HandlebarsApplicationMixin(Applicat
);
const compendiumBeastforms = await game.packs.get(`daggerheart.beastforms`)?.getDocuments();
const beastformTiers = [...(compendiumBeastforms ? compendiumBeastforms : []), ...game.items].reduce(
const beastformTiers = [...game.items, ...(compendiumBeastforms ? compendiumBeastforms : [])].reduce(
(acc, x) => {
const tier = CONFIG.DH.GENERAL.tiers[x.system.tier];
if (x.type !== 'beastform' || tier.id > this.configData.tierLimit) return acc;
if (!acc[tier.id]) acc[tier.id] = { label: game.i18n.localize(tier.label), values: {} };
if (Object.values(acc[tier.id].values).find(existing => existing.value.name === x.name)) return acc;
acc[tier.id].values[x.uuid] = {
selected: this.selected?.uuid == x.uuid,
value: x,

View file

@ -91,9 +91,10 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
context.roll = this.roll;
context.rollType = this.roll?.constructor.name;
context.rallyDie = this.roll.rallyChoices;
context.experiences = Object.keys(this.config.data.experiences).map(id => ({
const experiences = this.config.data?.experiences || {};
context.experiences = Object.keys(experiences).map(id => ({
id,
...this.config.data.experiences[id]
...experiences[id]
}));
context.selectedExperiences = this.config.experiences;
context.advantage = this.config.roll?.advantage;

View file

@ -43,7 +43,7 @@ export default class DHAppearanceSettings extends HandlebarsApplicationMixin(App
{ id: 'hope', label: 'DAGGERHEART.GENERAL.hope' },
{ id: 'fear', label: 'DAGGERHEART.GENERAL.fear' },
{ id: 'advantage', label: 'DAGGERHEART.GENERAL.Advantage.full' },
{ id: 'disadvantage', label: 'DAGGERHEART.GENERAL.Advantage.full' }
{ id: 'disadvantage', label: 'DAGGERHEART.GENERAL.Disadvantage.full' }
],
initial: 'hope'
}

View file

@ -55,7 +55,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
},
{
handler: CharacterSheet.#getItemContextOptions,
selector: '[data-item-uuid][data-type="consumable"], [data-item-uuid][data-type="miscellaneous"]',
selector: '[data-item-uuid][data-type="consumable"], [data-item-uuid][data-type="loot"]',
options: {
parentClassHooks: false,
fixed: true
@ -325,7 +325,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
}
/**
* Get the set of ContextMenu options for Consumable and Miscellaneous.
* Get the set of ContextMenu options for Consumable and Loot.
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance
* @this {CharacterSheet}
* @protected

View file

@ -123,7 +123,14 @@ export default function DHApplicationMixin(Base) {
/**@inheritdoc */
async _onFirstRender(context, options) {
await super._onFirstRender(context, options);
this.relatedDocs.filter(doc => doc).map(doc => (doc.apps[this.id] = this));
const docs = [];
for (var docData of this.relatedDocs) {
const doc = await foundry.utils.fromUuid(docData.uuid);
docs.push(doc);
}
docs.filter(doc => doc).map(doc => (doc.apps[this.id] = this));
if (!!this.options.contextMenus.length) this._createContextMenus();
}

View file

@ -249,12 +249,20 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
const target = event.target.closest('fieldset.drop-section');
const item = await fromUuid(data.uuid);
if (item?.type === 'feature') {
await this.document.update({
'system.features': [...this.document.system.features, { type: target.dataset.type, item }].map(x => ({
...x,
item: x.item?.uuid
}))
});
if (target.dataset.type) {
await this.document.update({
'system.features': [...this.document.system.features, { type: target.dataset.type, item }].map(
x => ({
...x,
item: x.item?.uuid
})
)
});
} else {
await this.document.update({
'system.features': [...this.document.system.features, item].map(x => x.uuid)
});
}
}
}
}

View file

@ -6,6 +6,6 @@ export { default as Community } from './community.mjs';
export { default as Consumable } from './consumable.mjs';
export { default as DomainCard } from './domainCard.mjs';
export { default as Feature } from './feature.mjs';
export { default as Miscellaneous } from './miscellaneous.mjs';
export { default as Loot } from './loot.mjs';
export { default as Subclass } from './subclass.mjs';
export { default as Weapon } from './weapon.mjs';

View file

@ -132,14 +132,14 @@ export default class ClassSheet extends DHBaseItemSheet {
});
}
} else if (target.classList.contains('choice-a-section')) {
if (item.type === 'miscellaneous' || item.type === 'consumable') {
if (item.type === 'loot' || item.type === 'consumable') {
const filteredChoiceA = this.document.system.inventory.choiceA;
if (filteredChoiceA.length < 2)
await this.document.update({
'system.inventory.choiceA': [...filteredChoiceA.map(x => x.uuid), item.uuid]
});
}
} else if (item.type === 'miscellaneous') {
} else if (item.type === 'loot') {
if (target.classList.contains('take-section')) {
const filteredTake = this.document.system.inventory.take.filter(x => x);
if (filteredTake.length < 3)

View file

@ -1,15 +1,15 @@
import DHBaseItemSheet from '../api/base-item.mjs';
export default class MiscellaneousSheet extends DHBaseItemSheet {
export default class LootSheet extends DHBaseItemSheet {
/**@inheritdoc */
static DEFAULT_OPTIONS = {
classes: ['miscellaneous'],
classes: ['loot'],
position: { width: 550 }
};
/**@override */
static PARTS = {
header: { template: 'systems/daggerheart/templates/sheets/items/miscellaneous/header.hbs' },
header: { template: 'systems/daggerheart/templates/sheets/items/loot/header.hbs' },
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
actions: {
@ -17,7 +17,7 @@ export default class MiscellaneousSheet extends DHBaseItemSheet {
scrollable: ['.actions']
},
settings: {
template: 'systems/daggerheart/templates/sheets/items/miscellaneous/settings.hbs',
template: 'systems/daggerheart/templates/sheets/items/loot/settings.hbs',
scrollable: ['.settings']
},
effects: {

View file

@ -66,8 +66,8 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
super.close(options);
}
async getActor(id) {
return await fromUuid(id);
async getActor(uuid) {
return await foundry.utils.fromUuid(uuid);
}
getAction(actor, itemId, actionId) {