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.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;

View file

@ -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<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 */
/* -------------------------------------------- */

View file

@ -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<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) {

View file

@ -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
});
}

View file

@ -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": {

View file

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

View file

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