mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-06 04:44:16 +02:00
Added an app to work on campaign frame things in
This commit is contained in:
parent
bae9006f64
commit
044ecd9d55
12 changed files with 187 additions and 1 deletions
|
|
@ -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';
|
||||
|
|
|
|||
1
module/applications/campaignFrame/_module.mjs
Normal file
1
module/applications/campaignFrame/_module.mjs
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { default as CampaignFrames } from './campaignFrames.mjs';
|
||||
46
module/applications/campaignFrame/campaignFrames.mjs
Normal file
46
module/applications/campaignFrame/campaignFrames.mjs
Normal 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
export { default as CampaignFrames } from './campaignFrames.mjs';
|
||||
export { default as DhCombat } from './combat.mjs';
|
||||
export { default as DhCombatant } from './combatant.mjs';
|
||||
export { default as DhRollTable } from './rollTable.mjs';
|
||||
|
|
|
|||
29
module/data/campaignFrames.mjs
Normal file
29
module/data/campaignFrames.mjs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
export default class DhCampaignFrames extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
return {
|
||||
frames: new fields.TypedObjectField(new fields.EmbeddedDataField(DhCampaignFrame))
|
||||
};
|
||||
}
|
||||
|
||||
register(frames) {
|
||||
this.updateSource({ frames });
|
||||
}
|
||||
}
|
||||
|
||||
class DhCampaignFrame extends foundry.abstract.DataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
return {
|
||||
name: new fields.StringField({ required: true }),
|
||||
img: new fields.FilePathField({ initial: 'icons/svg/mountain.svg', categories: ['IMAGE'], base64: false }),
|
||||
complexityRating: new fields.NumberField({ required: true, integer: true }),
|
||||
pitch: new fields.HTMLField(),
|
||||
toneAndFeel: new fields.StringField(),
|
||||
themes: new fields.StringField(),
|
||||
touchstones: new fields.StringField()
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue