diff --git a/module/applications/sheets-configs/adversary-settings.mjs b/module/applications/sheets-configs/adversary-settings.mjs
index fbd38c41..d95e6129 100644
--- a/module/applications/sheets-configs/adversary-settings.mjs
+++ b/module/applications/sheets-configs/adversary-settings.mjs
@@ -1,4 +1,4 @@
-import DHBaseActorSettings from "../sheets/api/actor-setting.mjs";
+import DHBaseActorSettings from '../sheets/api/actor-setting.mjs';
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
@@ -9,7 +9,7 @@ export default class DHAdversarySettings extends DHBaseActorSettings {
position: { width: 455, height: 'auto' },
actions: {
addExperience: DHAdversarySettings.#addExperience,
- removeExperience: DHAdversarySettings.#removeExperience,
+ removeExperience: DHAdversarySettings.#removeExperience
},
dragDrop: [
{ dragSelector: null, dropSelector: '.tab.features' },
@@ -42,7 +42,6 @@ export default class DHAdversarySettings extends DHBaseActorSettings {
}
};
-
/** @override */
static TABS = {
primary: {
diff --git a/module/applications/sheets-configs/companion-settings.mjs b/module/applications/sheets-configs/companion-settings.mjs
index 47e0de27..fed70c56 100644
--- a/module/applications/sheets-configs/companion-settings.mjs
+++ b/module/applications/sheets-configs/companion-settings.mjs
@@ -11,7 +11,7 @@ export default class DHCompanionSettings extends DHBaseActorSettings {
position: { width: 455, height: 'auto' },
actions: {
levelUp: DHCompanionSettings.#levelUp
- },
+ }
};
/**@inheritdoc */
@@ -35,7 +35,6 @@ export default class DHCompanionSettings extends DHBaseActorSettings {
}
};
-
/** @inheritdoc */
static TABS = {
primary: {
@@ -68,9 +67,7 @@ export default class DHCompanionSettings extends DHBaseActorSettings {
*/
async onPartnerChange(event) {
const value = event.target.value;
- const partnerDocument = value
- ? await foundry.utils.fromUuid(value)
- : this.actor.system.partner;
+ const partnerDocument = value ? await foundry.utils.fromUuid(value) : this.actor.system.partner;
const partnerUpdate = { 'system.companion': value ? this.actor.uuid : null };
if (!partnerDocument.isOwner) {
diff --git a/module/applications/sheets-configs/environment-settings.mjs b/module/applications/sheets-configs/environment-settings.mjs
index 6b5605f8..d0ca897a 100644
--- a/module/applications/sheets-configs/environment-settings.mjs
+++ b/module/applications/sheets-configs/environment-settings.mjs
@@ -1,4 +1,4 @@
-import DHBaseActorSettings from "../sheets/api/actor-setting.mjs";
+import DHBaseActorSettings from '../sheets/api/actor-setting.mjs';
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
@@ -49,7 +49,6 @@ export default class DHEnvironmentSettings extends DHBaseActorSettings {
}
};
-
/**
* Adds a new category entry to the actor.
* @type {ApplicationClickAction}
diff --git a/module/applications/sheets/actors/adversary.mjs b/module/applications/sheets/actors/adversary.mjs
index 0603ae9d..222bedff 100644
--- a/module/applications/sheets/actors/adversary.mjs
+++ b/module/applications/sheets/actors/adversary.mjs
@@ -9,11 +9,11 @@ export default class AdversarySheet extends DHBaseActorSheet {
actions: {
reactionRoll: AdversarySheet.#reactionRoll,
useItem: this.useItem,
- toChat: this.toChat,
+ toChat: this.toChat
},
window: {
resizable: true
- },
+ }
};
static PARTS = {
@@ -24,7 +24,6 @@ export default class AdversarySheet extends DHBaseActorSheet {
effects: { template: 'systems/daggerheart/templates/sheets/actors/adversary/effects.hbs' }
};
-
/** @inheritdoc */
static TABS = {
primary: {
@@ -74,7 +73,7 @@ export default class AdversarySheet extends DHBaseActorSheet {
}
/**
- *
+ *
* @type {ApplicationClickAction}
*/
static async useItem(event) {
@@ -83,7 +82,7 @@ export default class AdversarySheet extends DHBaseActorSheet {
}
/**
- *
+ *
* @type {ApplicationClickAction}
*/
static async toChat(event, button) {
@@ -92,8 +91,9 @@ export default class AdversarySheet extends DHBaseActorSheet {
const cls = getDocumentClass('ChatMessage');
const systemData = {
name: game.i18n.localize('DAGGERHEART.GENERAL.Experience.single'),
- description: `${experience.name} ${experience.modifier < 0 ? experience.modifier : `+${experience.modifier}`
- }`
+ description: `${experience.name} ${
+ experience.modifier < 0 ? experience.modifier : `+${experience.modifier}`
+ }`
};
const msg = new cls({
type: 'abilityUse',
@@ -111,5 +111,4 @@ export default class AdversarySheet extends DHBaseActorSheet {
item.toChat(this.document.id);
}
}
-
}
diff --git a/module/applications/sheets/actors/character.mjs b/module/applications/sheets/actors/character.mjs
index d35293c5..934dac80 100644
--- a/module/applications/sheets/actors/character.mjs
+++ b/module/applications/sheets/actors/character.mjs
@@ -24,7 +24,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
levelManagement: CharacterSheet.#levelManagement,
toggleEquipItem: CharacterSheet.#toggleEquipItem,
useItem: this.useItem, //TODO Fix this
- toChat: this.toChat,
+ toChat: this.toChat
},
window: {
resizable: true
@@ -89,7 +89,9 @@ export default class CharacterSheet extends DHBaseActorSheet {
async _onRender(context, options) {
await super._onRender(context, options);
- this.element.querySelector('.level-value')?.addEventListener('change', (event) => this.document.updateLevel(Number(event.currentTarget.value)));
+ this.element
+ .querySelector('.level-value')
+ ?.addEventListener('change', event => this.document.updateLevel(Number(event.currentTarget.value)));
this._createFilterMenus();
this._createSearchFilter();
@@ -152,8 +154,12 @@ export default class CharacterSheet extends DHBaseActorSheet {
async _preparePartContext(partId, context, options) {
context = await super._preparePartContext(partId, context, options);
switch (partId) {
- case "loadout": await this._prepareLoadoutContext(context, options); break;
- case "sidebar": await this._prepareSidebarContext(context, options); break;
+ case 'loadout':
+ await this._prepareLoadoutContext(context, options);
+ break;
+ case 'sidebar':
+ await this._prepareSidebarContext(context, options);
+ break;
}
return context;
}
@@ -177,67 +183,75 @@ export default class CharacterSheet extends DHBaseActorSheet {
* @protected
*/
static _getContextMenuOptions() {
-
/**
* Get the item from the element.
* @param {HTMLElement} el
* @returns {foundry.documents.Item?}
*/
- const getItem = (el) => this.actor.items.get(el.closest('[data-item-id]')?.dataset.itemId);
+ const getItem = el => this.actor.items.get(el.closest('[data-item-id]')?.dataset.itemId);
- return [{
- name: 'DAGGERHEART.Sheets.PC.ContextMenu.UseItem',
- icon: '',
- condition: el => {
- const item = getItem(el);
- return !['class', 'subclass'].includes(item.type);
+ return [
+ {
+ name: 'DAGGERHEART.Sheets.PC.ContextMenu.UseItem',
+ icon: '',
+ condition: el => {
+ const item = getItem(el);
+ return !['class', 'subclass'].includes(item.type);
+ },
+ callback: (button, event) => CharacterSheet.useItem.call(this, event, button)
},
- callback: (button, event) => CharacterSheet.useItem.call(this, event, button)
- }, {
- name: 'DAGGERHEART.Sheets.PC.ContextMenu.Equip',
- icon: '',
- condition: el => {
- const item = getItem(el);
- return ['weapon', 'armor'].includes(item.type) && !item.system.equipped;
+ {
+ name: 'DAGGERHEART.Sheets.PC.ContextMenu.Equip',
+ icon: '',
+ condition: el => {
+ const item = getItem(el);
+ return ['weapon', 'armor'].includes(item.type) && !item.system.equipped;
+ },
+ callback: CharacterSheet.#toggleEquipItem.bind(this)
},
- callback: CharacterSheet.#toggleEquipItem.bind(this)
- }, {
- name: 'DAGGERHEART.Sheets.PC.ContextMenu.Unequip',
- icon: '',
- condition: el => {
- const item = getItem(el);
- return ['weapon', 'armor'].includes(item.type) && item.system.equipped;
+ {
+ name: 'DAGGERHEART.Sheets.PC.ContextMenu.Unequip',
+ icon: '',
+ condition: el => {
+ const item = getItem(el);
+ return ['weapon', 'armor'].includes(item.type) && item.system.equipped;
+ },
+ callback: CharacterSheet.#toggleEquipItem.bind(this)
},
- callback: CharacterSheet.#toggleEquipItem.bind(this)
- }, {
- name: 'DAGGERHEART.Sheets.PC.ContextMenu.ToLoadout',
- icon: '',
- condition: (el) => {
- const item = getItem(el);
- return ['domainCard'].includes(item.type) && item.system.inVault;
+ {
+ name: 'DAGGERHEART.Sheets.PC.ContextMenu.ToLoadout',
+ icon: '',
+ condition: el => {
+ const item = getItem(el);
+ return ['domainCard'].includes(item.type) && item.system.inVault;
+ },
+ callback: target => getItem(target).update({ 'system.inVault': false })
},
- callback: (target) => getItem(target).update({ 'system.inVault': false })
- }, {
- name: 'DAGGERHEART.Sheets.PC.ContextMenu.ToVault',
- icon: '',
- condition: el => {
- const item = getItem(el);
- return ['domainCard'].includes(item.type) && !item.system.inVault;
+ {
+ name: 'DAGGERHEART.Sheets.PC.ContextMenu.ToVault',
+ icon: '',
+ condition: el => {
+ const item = getItem(el);
+ return ['domainCard'].includes(item.type) && !item.system.inVault;
+ },
+ callback: target => getItem(target).update({ 'system.inVault': true })
},
- callback: (target) => getItem(target).update({ 'system.inVault': true })
- }, {
- name: 'DAGGERHEART.Sheets.PC.ContextMenu.SendToChat',
- icon: '',
- callback: CharacterSheet.toChat.bind(this)
- }, {
- name: 'DAGGERHEART.Sheets.PC.ContextMenu.Edit',
- icon: '',
- callback: (target) => getItem(target).sheet.render({ force: true }),
- }, {
- name: 'DAGGERHEART.Sheets.PC.ContextMenu.Delete',
- icon: '',
- callback: (el) => getItem(el).delete()
- }];
+ {
+ name: 'DAGGERHEART.Sheets.PC.ContextMenu.SendToChat',
+ icon: '',
+ callback: CharacterSheet.toChat.bind(this)
+ },
+ {
+ name: 'DAGGERHEART.Sheets.PC.ContextMenu.Edit',
+ icon: '',
+ callback: target => getItem(target).sheet.render({ force: true })
+ },
+ {
+ name: 'DAGGERHEART.Sheets.PC.ContextMenu.Delete',
+ icon: '',
+ callback: el => getItem(el).delete()
+ }
+ ];
}
/* -------------------------------------------- */
/* Filter Tracking */
@@ -359,7 +373,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
}
}
-
/* -------------------------------------------- */
/* Filter Menus */
/* -------------------------------------------- */
@@ -450,7 +463,8 @@ export default class CharacterSheet extends DHBaseActorSheet {
return new DhCharacterCreation(this.document).render({ force: true });
const { value, subclass } = this.document.system.class;
- if (!value || !subclass) return ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.missingClassOrSubclass'));
+ if (!value || !subclass)
+ return ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.missingClassOrSubclass'));
new DhCharacterlevelUp(this.document).render({ force: true });
}
@@ -493,7 +507,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
/**
* Toggles the equipped state of an item (armor or weapon).
- * @type {ApplicationClickAction}
+ * @type {ApplicationClickAction}
*/
static async #toggleEquipItem(_event, button) {
//TODO: redo this
@@ -543,12 +557,12 @@ export default class CharacterSheet extends DHBaseActorSheet {
/**
* Toggles whether an item is stored in the vault.
- * @type {ApplicationClickAction}
+ * @type {ApplicationClickAction}
*/
static async #toggleVault(event, button) {
const docId = button.closest('[data-item-id]')?.dataset.itemId;
const doc = this.document.items.get(docId);
- await doc?.update({ 'system.inVault': !doc.system.inVault })
+ await doc?.update({ 'system.inVault': !doc.system.inVault });
}
/**
@@ -637,5 +651,4 @@ export default class CharacterSheet extends DHBaseActorSheet {
itemData = itemData instanceof Array ? itemData : [itemData];
return this.document.createEmbeddedDocuments('Item', itemData);
}
-
}
diff --git a/module/applications/sheets/actors/companion.mjs b/module/applications/sheets/actors/companion.mjs
index ccf49b86..042a4bfa 100644
--- a/module/applications/sheets/actors/companion.mjs
+++ b/module/applications/sheets/actors/companion.mjs
@@ -2,7 +2,6 @@ import DHBaseActorSheet from '../api/base-actor.mjs';
/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */
-
export default class DhCompanionSheet extends DHBaseActorSheet {
static DEFAULT_OPTIONS = {
classes: ['actor', 'companion'],
@@ -10,8 +9,8 @@ export default class DhCompanionSheet extends DHBaseActorSheet {
actions: {
viewActor: this.viewActor,
useItem: this.useItem,
- toChat: this.toChat,
- },
+ toChat: this.toChat
+ }
};
static PARTS = {
@@ -34,7 +33,7 @@ export default class DhCompanionSheet extends DHBaseActorSheet {
/* -------------------------------------------- */
/* Application Clicks Actions */
/* -------------------------------------------- */
-
+
static async viewActor(_, button) {
const target = button.closest('[data-item-uuid]');
const actor = await foundry.utils.fromUuid(target.dataset.itemUuid);
diff --git a/module/applications/sheets/actors/environment.mjs b/module/applications/sheets/actors/environment.mjs
index a66145d5..188d24b4 100644
--- a/module/applications/sheets/actors/environment.mjs
+++ b/module/applications/sheets/actors/environment.mjs
@@ -48,7 +48,7 @@ export default class DhpEnvironment extends DHBaseActorSheet {
/* -------------------------------------------- */
/**
- *
+ *
* @type {ApplicationClickAction}
*/
async viewAdversary(_, button) {
diff --git a/module/applications/sheets/api/_modules.mjs b/module/applications/sheets/api/_modules.mjs
index 3043feeb..cb7eee62 100644
--- a/module/applications/sheets/api/_modules.mjs
+++ b/module/applications/sheets/api/_modules.mjs
@@ -1,5 +1,5 @@
export { default as DHApplicationMixin } from './application-mixin.mjs';
export { default as DHBaseItemSheet } from './base-item.mjs';
export { default as DHHeritageSheet } from './heritage-sheet.mjs';
-export { default as DHBaseActorSheet } from "./base-actor.mjs";
-export { default as DHBaseActorSettings } from "./actor-setting.mjs";
+export { default as DHBaseActorSheet } from './base-actor.mjs';
+export { default as DHBaseActorSettings } from './actor-setting.mjs';
diff --git a/module/applications/sheets/api/actor-setting.mjs b/module/applications/sheets/api/actor-setting.mjs
index adc10566..50e2b0a9 100644
--- a/module/applications/sheets/api/actor-setting.mjs
+++ b/module/applications/sheets/api/actor-setting.mjs
@@ -8,44 +8,43 @@ const { DocumentSheetV2 } = foundry.applications.api;
* @extends {DHApplicationMixin}
*/
export default class DHBaseActorSettings extends DHApplicationMixin(DocumentSheetV2) {
+ /**@inheritdoc */
+ static DEFAULT_OPTIONS = {
+ classes: ['dialog'],
+ window: {
+ icon: 'fa-solid fa-wrench',
+ resizable: false,
+ title: 'DAGGERHEART.GENERAL.Tabs.settings'
+ },
+ position: { width: 455, height: 'auto' },
+ actions: {},
+ form: {
+ submitOnChange: true
+ },
+ dragDrop: [
+ { dragSelector: null, dropSelector: '.tab.features' },
+ { dragSelector: '.feature-item', dropSelector: null }
+ ]
+ };
- /**@inheritdoc */
- static DEFAULT_OPTIONS = {
- classes: ['dialog'],
- window: {
- icon: 'fa-solid fa-wrench',
- resizable: false,
- title: "DAGGERHEART.GENERAL.Tabs.settings"
- },
- position: { width: 455, height: 'auto' },
- actions: {},
- form: {
- submitOnChange: true,
- },
- dragDrop: [
- { dragSelector: null, dropSelector: '.tab.features' },
- { dragSelector: '.feature-item', dropSelector: null }
- ]
- };
+ /** @inheritDoc */
+ _initializeApplicationOptions(options) {
+ options = super._initializeApplicationOptions(options);
+ options.classes = options.classes.filter(c => c !== 'sheet');
+ return options;
+ }
- /** @inheritDoc */
- _initializeApplicationOptions(options) {
- options = super._initializeApplicationOptions(options);
- options.classes = options.classes.filter(c => c !== "sheet");
- return options;
- }
+ /**@returns {foundry.documents.Actor} */
+ get actor() {
+ return this.document;
+ }
- /**@returns {foundry.documents.Actor} */
- get actor() {
- return this.document;
- }
+ /**@inheritdoc */
+ async _prepareContext(options) {
+ const context = await super._prepareContext(options);
+ context.systemFields.attack.fields = this.actor.system.attack.schema.fields;
+ context.isNPC = this.actor.isNPC;
- /**@inheritdoc */
- async _prepareContext(options) {
- const context = await super._prepareContext(options);
- context.systemFields.attack.fields = this.actor.system.attack.schema.fields;
- context.isNPC = this.actor.isNPC;
-
- return context
- }
-}
\ No newline at end of file
+ return context;
+ }
+}
diff --git a/module/applications/sheets/api/application-mixin.mjs b/module/applications/sheets/api/application-mixin.mjs
index cbc97c62..d0ef63d6 100644
--- a/module/applications/sheets/api/application-mixin.mjs
+++ b/module/applications/sheets/api/application-mixin.mjs
@@ -5,7 +5,7 @@ import { tagifyElement } from '../../../helpers/utils.mjs';
* @typedef {object} DragDropConfig
* @property {string} [dragSelector] - A CSS selector that identifies draggable elements.
* @property {string} [dropSelector] - A CSS selector that identifies drop targets.
- *
+ *
* @typedef {object} ContextMenuConfig
* @property {() => ContextMenuEntry[]} handler - A handler function that provides initial context options
* @property {string} selector - A CSS selector to which the ContextMenu will be bound
@@ -37,7 +37,7 @@ import { tagifyElement } from '../../../helpers/utils.mjs';
/**
* @typedef {import("@client/applications/api/handlebars-application.mjs").HandlebarsRenderOptions} HandlebarsRenderOptions
* @typedef {foundry.applications.types.ApplicationConfiguration} FoundryAppConfig
- *
+ *
* @typedef {FoundryAppConfig & HandlebarsRenderOptions & {
* dragDrop?: DragDropConfig[],
* tagifyConfigs?: TagifyConfig[],
@@ -45,8 +45,6 @@ import { tagifyElement } from '../../../helpers/utils.mjs';
* }} DHSheetV2Configuration
*/
-
-
/**
* @template {Constructor} BaseDocumentSheet
* @param {BaseDocumentSheet} Base - The base class to extend.
@@ -164,15 +162,14 @@ export default function DHApplicationMixin(Base) {
* @param {DragEvent} event
* @protected
*/
- _onDragStart(event) { }
+ _onDragStart(event) {}
/**
* Handle drop event.
* @param {DragEvent} event
* @protected
*/
- _onDrop(event) { }
-
+ _onDrop(event) {}
/* -------------------------------------------- */
/* Context Menu */
@@ -187,7 +184,6 @@ export default function DHApplicationMixin(Base) {
/* -------------------------------------------- */
-
/**
* Get the set of ContextMenu options which should be used for journal entry pages in the sidebar.
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]}
@@ -226,10 +222,15 @@ export default function DHApplicationMixin(Base) {
const parent = this.document;
const cls = getDocumentClass(documentClass);
- return await cls.createDocuments([{
- name: cls.defaultName({ type, parent }),
- type,
- }], { parent, renderSheet: !event.shiftKey });
+ return await cls.createDocuments(
+ [
+ {
+ name: cls.defaultName({ type, parent }),
+ type
+ }
+ ],
+ { parent, renderSheet: !event.shiftKey }
+ );
}
/**
@@ -251,7 +252,6 @@ export default function DHApplicationMixin(Base) {
const { type, docId } = button.dataset;
await this.document.getEmbeddedDocument(type, docId, { strict: true }).delete();
}
-
}
return DHSheetV2;
diff --git a/module/applications/sheets/api/base-actor.mjs b/module/applications/sheets/api/base-actor.mjs
index 252f2d9f..7102fa1c 100644
--- a/module/applications/sheets/api/base-actor.mjs
+++ b/module/applications/sheets/api/base-actor.mjs
@@ -11,44 +11,42 @@ const { ActorSheetV2 } = foundry.applications.sheets;
* @mixes DHSheetV2
*/
export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
- /** @inheritDoc */
- static DEFAULT_OPTIONS = {
- classes: ['actor'],
- position: {
- width: 480,
- },
- form: {
- submitOnChange: true
- },
- actions: {
- openSettings: DHBaseActorSheet.#openSettings
- },
- dragDrop: [],
- };
+ /** @inheritDoc */
+ static DEFAULT_OPTIONS = {
+ classes: ['actor'],
+ position: {
+ width: 480
+ },
+ form: {
+ submitOnChange: true
+ },
+ actions: {
+ openSettings: DHBaseActorSheet.#openSettings
+ },
+ dragDrop: []
+ };
- /**@type {typeof DHBaseActorSettings}*/
- #settingSheet;
+ /**@type {typeof DHBaseActorSettings}*/
+ #settingSheet;
- /**@returns {DHBaseActorSettings|null} */
- get settingSheet() {
- const SheetClass = this.document.system.metadata.settingSheet;
- return this.#settingSheet ??= SheetClass ? new SheetClass({document: this.document}): null;
- }
+ /**@returns {DHBaseActorSettings|null} */
+ get settingSheet() {
+ const SheetClass = this.document.system.metadata.settingSheet;
+ return (this.#settingSheet ??= SheetClass ? new SheetClass({ document: this.document }) : null);
+ }
- /**@inheritdoc */
- async _prepareContext(_options) {
- const context = await super._prepareContext(_options);
- context.isNPC = this.document.isNPC;
- return context;
- }
+ /**@inheritdoc */
+ async _prepareContext(_options) {
+ const context = await super._prepareContext(_options);
+ context.isNPC = this.document.isNPC;
+ return context;
+ }
- /**
- * Open the Actor Setting Sheet
- * @type {ApplicationClickAction}
- */
- static async #openSettings() {
- await this.settingSheet.render({ force: true });
- }
-
-
-}
\ No newline at end of file
+ /**
+ * Open the Actor Setting Sheet
+ * @type {ApplicationClickAction}
+ */
+ static async #openSettings() {
+ await this.settingSheet.render({ force: true });
+ }
+}