FEAT: add eritch to NPC description

FIX: missing htmlFieldss on manfiest
FIX: add misisng localizations
This commit is contained in:
Joaquin Pereyra 2025-07-18 15:26:27 -03:00
parent f56c2482cb
commit ff8c257d2c
8 changed files with 59 additions and 12 deletions

View file

@ -109,7 +109,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
context.getEffectDetails = this.getEffectDetails.bind(this); context.getEffectDetails = this.getEffectDetails.bind(this);
context.costOptions = this.getCostOptions(); context.costOptions = this.getCostOptions();
context.disableOption = this.disableOption.bind(this); 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; context.hasRoll = this.action.hasRoll;
const settingsTiers = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers; const settingsTiers = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers;

View file

@ -43,6 +43,9 @@ export default class AdversarySheet extends DHBaseActorSheet {
async _preparePartContext(partId, context, options) { async _preparePartContext(partId, context, options) {
context = await super._preparePartContext(partId, context, options); context = await super._preparePartContext(partId, context, options);
switch (partId) { switch (partId) {
case 'header':
await this._prepareHeaderContext(context, options);
break;
case 'notes': case 'notes':
await this._prepareNotesContext(context, options); await this._prepareNotesContext(context, options);
break; 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<void>}
* @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 */ /* Application Clicks Actions */
/* -------------------------------------------- */ /* -------------------------------------------- */

View file

@ -36,6 +36,9 @@ export default class DhpEnvironment extends DHBaseActorSheet {
async _preparePartContext(partId, context, options) { async _preparePartContext(partId, context, options) {
context = await super._preparePartContext(partId, context, options); context = await super._preparePartContext(partId, context, options);
switch (partId) { switch (partId) {
case 'header':
await this._prepareHeaderContext(context, options);
break;
case 'notes': case 'notes':
await this._prepareNotesContext(context, options); await this._prepareNotesContext(context, options);
break; 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<void>}
* @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) { async _onDragStart(event) {

View file

@ -13,6 +13,7 @@ export default class DhCompanion extends BaseDataActor {
return foundry.utils.mergeObject(super.metadata, { return foundry.utils.mergeObject(super.metadata, {
label: 'TYPES.Actor.companion', label: 'TYPES.Actor.companion',
type: 'companion', type: 'companion',
isNPC: false,
settingSheet: DHCompanionSettings settingSheet: DHCompanionSettings
}); });
} }

View file

@ -35,6 +35,12 @@
}, },
{ {
"name": "Po0lp" "name": "Po0lp"
},
{
"name": "JoaquinP",
"url": "https://github.com/joaquinpereyra98",
"email": "joaquinpereyra98@gmail.com",
"discord": "joaquinp98"
} }
], ],
"esmodules": ["build/daggerheart.js"], "esmodules": ["build/daggerheart.js"],
@ -182,10 +188,10 @@
}, },
"companion": {}, "companion": {},
"adversary": { "adversary": {
"htmlFields": ["description"] "htmlFields": ["notes", "description"]
}, },
"environment": { "environment": {
"htmlFields": ["description"] "htmlFields": ["notes", "description"]
} }
}, },
"Item": { "Item": {

View file

@ -27,7 +27,7 @@
<line-div></line-div> <line-div></line-div>
<div class="adversary-info"> <div class="adversary-info">
<div class="description"> <div class="description">
<i>{{{source.system.description}}}</i> <i>{{{description}}}</i>
</div> </div>
<div class="motives-and-tatics"> <div class="motives-and-tatics">
<b>{{localize 'DAGGERHEART.ACTORS.Adversary.FIELDS.motivesAndTactics.label'}}: </b>{{{source.system.motivesAndTactics}}} <b>{{localize 'DAGGERHEART.ACTORS.Adversary.FIELDS.motivesAndTactics.label'}}: </b>{{{source.system.motivesAndTactics}}}

View file

@ -17,7 +17,7 @@
<progress class='progress-bar' value='{{source.system.resources.hitPoints.value}}' <progress class='progress-bar' value='{{source.system.resources.hitPoints.value}}'
max='{{source.system.resources.hitPoints.max}}'></progress> max='{{source.system.resources.hitPoints.max}}'></progress>
<div class="status-label"> <div class="status-label">
<h4>HP</h4> <h4>{{localize 'DAGGERHEART.GENERAL.attack.hitPoints.short'}}</h4>
</div> </div>
</div> </div>
@ -31,7 +31,7 @@
<progress class='progress-bar stress-color' value='{{source.system.resources.stress.value}}' <progress class='progress-bar stress-color' value='{{source.system.resources.stress.value}}'
max='{{source.system.resources.stress.max}}'></progress> max='{{source.system.resources.stress.max}}'></progress>
<div class="status-label"> <div class="status-label">
<h4>Stress</h4> <h4>{{localize 'DAGGERHEART.GENERAL.stress'}}</h4>
</div> </div>
</div> </div>
</div> </div>
@ -54,7 +54,7 @@
{{/if}} {{/if}}
</div> </div>
<div class="status-label"> <div class="status-label">
<h4>Difficulty</h4> <h4>{{localize DAGGERHEART.GENERAL.difficulty}}</h4>
</div> </div>
</div> </div>
<div class="status-number"> <div class="status-number">
@ -66,7 +66,7 @@
{{/if}} {{/if}}
</div> </div>
<div class="status-label"> <div class="status-label">
<h4>Attack</h4> <h4>{{localize "DAGGERHEART.GENERAL.attack"}}</h4>
</div> </div>
</div> </div>
</div> </div>
@ -74,7 +74,7 @@
<div class="attack-section"> <div class="attack-section">
<div class="title"> <div class="title">
<side-line-div class="invert"></side-line-div> <side-line-div class="invert"></side-line-div>
<h3>Attack</h3> <h3>{{localize "DAGGERHEART.GENERAL.attack"}}</h3>
<side-line-div></side-line-div> <side-line-div></side-line-div>
</div> </div>
<ul class="items-sidebar-list"> <ul class="items-sidebar-list">
@ -92,7 +92,7 @@
<div class="experience-section"> <div class="experience-section">
<div class="title"> <div class="title">
<side-line-div class="invert"></side-line-div> <side-line-div class="invert"></side-line-div>
<h3>Experience</h3> <h3>{{localize DAGGERHEART.GENERAL.experience.plural}}</h3>
<side-line-div></side-line-div> <side-line-div></side-line-div>
</div> </div>
<div class="experience-list"> <div class="experience-list">
@ -113,6 +113,6 @@
</div> </div>
<line-div></line-div> <line-div></line-div>
<div class="reaction-section"> <div class="reaction-section">
<button data-action="reactionRoll">Reaction Test</button> <button data-action="reactionRoll">{{localize DAGGERHEART.GENERAL.Roll.reaction}}</button>
</div> </div>
</aside> </aside>

View file

@ -34,7 +34,7 @@
<line-div></line-div> <line-div></line-div>
<div class="environment-info"> <div class="environment-info">
<div class="description"> <div class="description">
<i>{{{source.system.description}}}</i> <i>{{{description}}}</i>
</div> </div>
<div class="impulses"> <div class="impulses">
<b>{{localize 'DAGGERHEART.ACTORS.Environment.FIELDS.impulses.label'}}: </b>{{{source.system.impulses}}} <b>{{localize 'DAGGERHEART.ACTORS.Environment.FIELDS.impulses.label'}}: </b>{{{source.system.impulses}}}