From ff8c257d2c6d02e13085e88c255c699fcd9df27b Mon Sep 17 00:00:00 2001 From: Joaquin Pereyra Date: Fri, 18 Jul 2025 15:26:27 -0300 Subject: [PATCH] FEAT: add eritch to NPC description FIX: missing htmlFieldss on manfiest FIX: add misisng localizations --- .../sheets-configs/action-config.mjs | 2 +- .../applications/sheets/actors/adversary.mjs | 20 +++++++++++++++++++ .../sheets/actors/environment.mjs | 20 +++++++++++++++++++ module/data/actor/companion.mjs | 1 + system.json | 10 ++++++++-- templates/sheets/actors/adversary/header.hbs | 2 +- templates/sheets/actors/adversary/sidebar.hbs | 14 ++++++------- .../sheets/actors/environment/header.hbs | 2 +- 8 files changed, 59 insertions(+), 12 deletions(-) diff --git a/module/applications/sheets-configs/action-config.mjs b/module/applications/sheets-configs/action-config.mjs index e1a62e0d..db3c4d27 100644 --- a/module/applications/sheets-configs/action-config.mjs +++ b/module/applications/sheets-configs/action-config.mjs @@ -109,7 +109,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) { context.getEffectDetails = this.getEffectDetails.bind(this); context.costOptions = this.getCostOptions(); context.disableOption = this.disableOption.bind(this); - context.isNPC = this.action.actor && this.action.actor.type !== 'character'; + context.isNPC = this.action.actor?.isNPC; context.hasRoll = this.action.hasRoll; const settingsTiers = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers; diff --git a/module/applications/sheets/actors/adversary.mjs b/module/applications/sheets/actors/adversary.mjs index 1e3747f6..e6508695 100644 --- a/module/applications/sheets/actors/adversary.mjs +++ b/module/applications/sheets/actors/adversary.mjs @@ -43,6 +43,9 @@ export default class AdversarySheet extends DHBaseActorSheet { async _preparePartContext(partId, context, options) { context = await super._preparePartContext(partId, context, options); switch (partId) { + case 'header': + await this._prepareHeaderContext(context, options); + break; case 'notes': await this._prepareNotesContext(context, options); break; @@ -78,6 +81,23 @@ export default class AdversarySheet extends DHBaseActorSheet { } } + /** + * Prepare render context for the Header part. + * @param {ApplicationRenderContext} context + * @param {ApplicationRenderOptions} options + * @returns {Promise} + * @protected + */ + async _prepareHeaderContext(context, _options) { + const { system } = this.document; + const { TextEditor } = foundry.applications.ux; + + context.description = await TextEditor.implementation.enrichHTML(system.description, { + secrets: this.document.isOwner, + relativeTo: this.document + }); + } + /* -------------------------------------------- */ /* Application Clicks Actions */ /* -------------------------------------------- */ diff --git a/module/applications/sheets/actors/environment.mjs b/module/applications/sheets/actors/environment.mjs index c7022a42..7a9c92ac 100644 --- a/module/applications/sheets/actors/environment.mjs +++ b/module/applications/sheets/actors/environment.mjs @@ -36,6 +36,9 @@ export default class DhpEnvironment extends DHBaseActorSheet { async _preparePartContext(partId, context, options) { context = await super._preparePartContext(partId, context, options); switch (partId) { + case 'header': + await this._prepareHeaderContext(context, options); + break; case 'notes': await this._prepareNotesContext(context, options); break; @@ -71,6 +74,23 @@ export default class DhpEnvironment extends DHBaseActorSheet { } } + /** + * Prepare render context for the Header part. + * @param {ApplicationRenderContext} context + * @param {ApplicationRenderOptions} options + * @returns {Promise} + * @protected + */ + async _prepareHeaderContext(context, _options) { + const { system } = this.document; + const { TextEditor } = foundry.applications.ux; + + context.description = await TextEditor.implementation.enrichHTML(system.description, { + secrets: this.document.isOwner, + relativeTo: this.document + }); + } + /* -------------------------------------------- */ async _onDragStart(event) { diff --git a/module/data/actor/companion.mjs b/module/data/actor/companion.mjs index fc8195d8..b7774284 100644 --- a/module/data/actor/companion.mjs +++ b/module/data/actor/companion.mjs @@ -13,6 +13,7 @@ export default class DhCompanion extends BaseDataActor { return foundry.utils.mergeObject(super.metadata, { label: 'TYPES.Actor.companion', type: 'companion', + isNPC: false, settingSheet: DHCompanionSettings }); } diff --git a/system.json b/system.json index 241c11d1..bfa25df3 100644 --- a/system.json +++ b/system.json @@ -35,6 +35,12 @@ }, { "name": "Po0lp" + }, + { + "name": "JoaquinP", + "url": "https://github.com/joaquinpereyra98", + "email": "joaquinpereyra98@gmail.com", + "discord": "joaquinp98" } ], "esmodules": ["build/daggerheart.js"], @@ -182,10 +188,10 @@ }, "companion": {}, "adversary": { - "htmlFields": ["description"] + "htmlFields": ["notes", "description"] }, "environment": { - "htmlFields": ["description"] + "htmlFields": ["notes", "description"] } }, "Item": { diff --git a/templates/sheets/actors/adversary/header.hbs b/templates/sheets/actors/adversary/header.hbs index 28c0d002..fd6389aa 100644 --- a/templates/sheets/actors/adversary/header.hbs +++ b/templates/sheets/actors/adversary/header.hbs @@ -27,7 +27,7 @@
- {{{source.system.description}}} + {{{description}}}
{{localize 'DAGGERHEART.ACTORS.Adversary.FIELDS.motivesAndTactics.label'}}: {{{source.system.motivesAndTactics}}} diff --git a/templates/sheets/actors/adversary/sidebar.hbs b/templates/sheets/actors/adversary/sidebar.hbs index e3b72815..dabbbffe 100644 --- a/templates/sheets/actors/adversary/sidebar.hbs +++ b/templates/sheets/actors/adversary/sidebar.hbs @@ -17,7 +17,7 @@
-

HP

+

{{localize 'DAGGERHEART.GENERAL.attack.hitPoints.short'}}

@@ -31,7 +31,7 @@
-

Stress

+

{{localize 'DAGGERHEART.GENERAL.stress'}}

@@ -54,7 +54,7 @@ {{/if}}
-

Difficulty

+

{{localize DAGGERHEART.GENERAL.difficulty}}

@@ -66,7 +66,7 @@ {{/if}}
-

Attack

+

{{localize "DAGGERHEART.GENERAL.attack"}}

@@ -74,7 +74,7 @@
-

Attack

+

{{localize "DAGGERHEART.GENERAL.attack"}}

    @@ -92,7 +92,7 @@
    -

    Experience

    +

    {{localize DAGGERHEART.GENERAL.experience.plural}}

    @@ -113,6 +113,6 @@
    - +
    \ No newline at end of file diff --git a/templates/sheets/actors/environment/header.hbs b/templates/sheets/actors/environment/header.hbs index e9921bae..fff55144 100644 --- a/templates/sheets/actors/environment/header.hbs +++ b/templates/sheets/actors/environment/header.hbs @@ -34,7 +34,7 @@
    - {{{source.system.description}}} + {{{description}}}
    {{localize 'DAGGERHEART.ACTORS.Environment.FIELDS.impulses.label'}}: {{{source.system.impulses}}}