Added an app to work on campaign frame things in

This commit is contained in:
WBHarry 2026-05-22 17:17:21 +02:00
parent bae9006f64
commit 044ecd9d55
12 changed files with 187 additions and 1 deletions

View file

@ -1,3 +1,4 @@
export * as campaignFrame from './campaignFrame/_module.mjs';
export * as characterCreation from './characterCreation/_module.mjs';
export * as dialogs from './dialogs/_module.mjs';
export * as hud from './hud/_module.mjs';

View file

@ -0,0 +1 @@
export { default as CampaignFrames } from './campaignFrames.mjs';

View file

@ -0,0 +1,46 @@
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
export default class DhCampaignFrames extends HandlebarsApplicationMixin(ApplicationV2) {
constructor() {
super({});
}
get title() {
return game.i18n.format('DAGGERHEART.APPLICATIONS.CampaignFrames.title');
}
static DEFAULT_OPTIONS = {
classes: ['daggerheart', 'dh-style', 'campaign-frame'],
position: { width: 640, height: 'auto' },
window: { icon: 'fa-solid fa-globe' },
actions: {}
};
static PARTS = {
application: {
id: 'campaign-frames',
template: 'systems/daggerheart/templates/campaignFrames/campaign-frames.hbs'
}
};
getCampaignFrameTabs(frames) {
for (const v of Object.values(frames)) {
v.active = this.tabGroups[v.group]
? this.tabGroups[v.group] === v.id
: this.tabGroups.primary !== 'equipment'
? v.active
: false;
v.cssClass = v.active ? 'active' : '';
}
return tabs;
}
async _prepareContext(_options) {
const context = await super._prepareContext(_options);
context.campaignFrames = game.system.campaignFrames.frames;
// context.campaignFrameTabs = this.getCampaignFrameTabs(context.campaignFrames);
return context;
}
}

View file

@ -32,7 +32,8 @@ export default class DaggerheartMenu extends HandlebarsApplicationMixin(Abstract
actions: {
selectRefreshable: DaggerheartMenu.#selectRefreshable,
refreshActors: DaggerheartMenu.#refreshActors,
createFallCollisionDamage: DaggerheartMenu.#createFallCollisionDamage
createFallCollisionDamage: DaggerheartMenu.#createFallCollisionDamage,
openCampaignFrames: DaggerheartMenu.#openCampaignFrames
}
};
@ -91,4 +92,8 @@ export default class DaggerheartMenu extends HandlebarsApplicationMixin(Abstract
sound: CONFIG.sounds.dice
});
}
static async #openCampaignFrames() {
new game.system.api.applications.campaignFrame.CampaignFrames().render({ force: true });
}
}