mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
.
This commit is contained in:
parent
9d353fe54a
commit
4a027e8591
8 changed files with 45 additions and 16 deletions
|
|
@ -79,7 +79,9 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
|
|
||||||
switch (partId) {
|
switch (partId) {
|
||||||
case 'description':
|
case 'description':
|
||||||
context.enrichedDescription = await this.document.system.getEnrichedDescription(true);
|
context.enrichedDescription = await this.document.system.getEnrichedDescription({
|
||||||
|
headerStyle: 'large'
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case 'effects':
|
case 'effects':
|
||||||
await this._prepareEffectsContext(context, options);
|
await this._prepareEffectsContext(context, options);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ export default class DHArmor extends AttachableItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async getDescriptionData(large) {
|
async getDescriptionData(options = {}) {
|
||||||
const baseDescription = await super.getDescriptionData();
|
const baseDescription = await super.getDescriptionData();
|
||||||
const allFeatures = CONFIG.DH.ITEM.allArmorFeatures();
|
const allFeatures = CONFIG.DH.ITEM.allArmorFeatures();
|
||||||
const features = this.armorFeatures.map(x => allFeatures[x.value]);
|
const features = this.armorFeatures.map(x => allFeatures[x.value]);
|
||||||
|
|
@ -63,7 +63,7 @@ export default class DHArmor extends AttachableItem {
|
||||||
|
|
||||||
const prepend = await foundry.applications.handlebars.renderTemplate(
|
const prepend = await foundry.applications.handlebars.renderTemplate(
|
||||||
'systems/daggerheart/templates/sheets/items/armor/description.hbs',
|
'systems/daggerheart/templates/sheets/items/armor/description.hbs',
|
||||||
{ features, large }
|
{ features, headerStyle: options.headerStyle }
|
||||||
);
|
);
|
||||||
|
|
||||||
const mainDescription = baseDescription ? `\n<hr>\n${baseDescription}` : '';
|
const mainDescription = baseDescription ? `\n<hr>\n${baseDescription}` : '';
|
||||||
|
|
|
||||||
|
|
@ -124,16 +124,24 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||||
return [source, page ? `pg ${page}.` : null].filter(x => x).join('. ');
|
return [source, page ? `pg ${page}.` : null].filter(x => x).join('. ');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/**
|
||||||
async getDescriptionData() {
|
* Augments the description for the item with type specific info to display. Implemented in applicable item subtypes.
|
||||||
|
* @param {object} [options] - Options that modify the styling of the rendered template. { headerStyle: undefined|'none'|'large' }
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
async getDescriptionData(_options) {
|
||||||
return this.description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/**
|
||||||
async getEnrichedDescription(large) {
|
* Gets the enriched and augmented description for the item.
|
||||||
|
* @param {object} [options] - Options that modify the styling of the rendered template. { headerStyle: undefined|'none'|'large' }
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
async getEnrichedDescription(options) {
|
||||||
if (!this.metadata.hasDescription) return '';
|
if (!this.metadata.hasDescription) return '';
|
||||||
|
|
||||||
const description = await this.getDescriptionData(large);
|
const description = await this.getDescriptionData(options);
|
||||||
return await foundry.applications.ux.TextEditor.implementation.enrichHTML(description, {
|
return await foundry.applications.ux.TextEditor.implementation.enrichHTML(description, {
|
||||||
relativeTo: this,
|
relativeTo: this,
|
||||||
rollData: this.getRollData(),
|
rollData: this.getRollData(),
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ export default class DHWeapon extends AttachableItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async getDescriptionData(large) {
|
async getDescriptionData(options = {}) {
|
||||||
const baseDescription = await super.getDescriptionData();
|
const baseDescription = await super.getDescriptionData();
|
||||||
const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures();
|
const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures();
|
||||||
const features = this.weaponFeatures.map(x => allFeatures[x.value]);
|
const features = this.weaponFeatures.map(x => allFeatures[x.value]);
|
||||||
|
|
@ -119,7 +119,7 @@ export default class DHWeapon extends AttachableItem {
|
||||||
|
|
||||||
const prepend = await foundry.applications.handlebars.renderTemplate(
|
const prepend = await foundry.applications.handlebars.renderTemplate(
|
||||||
'systems/daggerheart/templates/sheets/items/weapon/description.hbs',
|
'systems/daggerheart/templates/sheets/items/weapon/description.hbs',
|
||||||
{ features, large }
|
{ features, headerStyle: options.headerStyle }
|
||||||
);
|
);
|
||||||
|
|
||||||
const mainDescription = baseDescription ? `\n<hr>\n${baseDescription}` : '';
|
const mainDescription = baseDescription ? `\n<hr>\n${baseDescription}` : '';
|
||||||
|
|
|
||||||
|
|
@ -220,12 +220,16 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
||||||
for (const [index, itemValue] of pathValue.entries()) {
|
for (const [index, itemValue] of pathValue.entries()) {
|
||||||
const itemIsAction = itemValue instanceof game.system.api.models.actions.actionsTypes.base;
|
const itemIsAction = itemValue instanceof game.system.api.models.actions.actionsTypes.base;
|
||||||
const value = itemIsAction || !itemValue?.item ? itemValue : itemValue.item;
|
const value = itemIsAction || !itemValue?.item ? itemValue : itemValue.item;
|
||||||
const enrichedValue = await TextEditor.enrichHTML(value.system?.description ?? value.description);
|
const enrichedValue =
|
||||||
|
(await value.system?.getEnrichedDescription?.({ headerStyle: 'none' })) ??
|
||||||
|
(await TextEditor.enrichHTML(value.system?.description ?? value.description));
|
||||||
if (itemIsAction) value.enrichedDescription = enrichedValue;
|
if (itemIsAction) value.enrichedDescription = enrichedValue;
|
||||||
else foundry.utils.setProperty(item, `${basePath}.${index}.enrichedDescription`, enrichedValue);
|
else foundry.utils.setProperty(item, `${basePath}.${index}.enrichedDescription`, enrichedValue);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const enrichedValue = await TextEditor.enrichHTML(pathValue);
|
const enrichedValue =
|
||||||
|
(await item.system?.getEnrichedDescription?.({ headerStyle: 'none' })) ??
|
||||||
|
(await TextEditor.enrichHTML(pathValue));
|
||||||
foundry.utils.setProperty(
|
foundry.utils.setProperty(
|
||||||
item,
|
item,
|
||||||
`${data.path ? `${data.path}.` : ''}enriched${data.name.capitalize()}`,
|
`${data.path ? `${data.path}.` : ''}enriched${data.name.capitalize()}`,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ aside[role='tooltip']:has(div.daggerheart.dh-style.tooltip.card-style) {
|
||||||
width: 18rem;
|
width: 18rem;
|
||||||
background-image: url('../assets/parchments/dh-parchment-dark.png');
|
background-image: url('../assets/parchments/dh-parchment-dark.png');
|
||||||
outline: 1px solid light-dark(@dark-80, @beige-80);
|
outline: 1px solid light-dark(@dark-80, @beige-80);
|
||||||
box-shadow: 0 0 25px rgba(0, 0, 0, 0.80);
|
box-shadow: 0 0 25px rgba(0, 0, 0, 0.8);
|
||||||
|
|
||||||
.tooltip-title {
|
.tooltip-title {
|
||||||
font-size: var(--font-size-20);
|
font-size: var(--font-size-20);
|
||||||
|
|
@ -235,7 +235,6 @@ aside[role='tooltip'].locked-tooltip:has(div.daggerheart.dh-style.tooltip.card-s
|
||||||
.theme-light aside[role='tooltip'].locked-tooltip:has(div.daggerheart.dh-style.tooltip) {
|
.theme-light aside[role='tooltip'].locked-tooltip:has(div.daggerheart.dh-style.tooltip) {
|
||||||
box-shadow: 0 0 25px @dark-blue-90;
|
box-shadow: 0 0 25px @dark-blue-90;
|
||||||
outline: 1px solid light-dark(@dark-blue, @golden);
|
outline: 1px solid light-dark(@dark-blue, @golden);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#tooltip,
|
#tooltip,
|
||||||
|
|
@ -283,6 +282,18 @@ aside[role='tooltip'].locked-tooltip:has(div.daggerheart.dh-style.tooltip.card-s
|
||||||
.tooltip-description {
|
.tooltip-description {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
text-align: start;
|
text-align: start;
|
||||||
|
|
||||||
|
.feature-descriptions {
|
||||||
|
.features-header {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: underline;
|
||||||
|
|
||||||
|
&.large {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.simple-info {
|
.simple-info {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<div class="feature-descriptions">
|
<div class="feature-descriptions">
|
||||||
<div class="features-header {{#if @root.large}}large{{/if}}">{{localize "DAGGERHEART.SETTINGS.Homebrew.itemFeatures"}}</div>
|
{{#unless (eq headerStyle 'none')}}
|
||||||
|
<div class="features-header {{#if (eq headerStyle 'large')}}large{{/if}}">{{localize "DAGGERHEART.SETTINGS.Homebrew.itemFeatures"}}</div>
|
||||||
|
{{/unless}}
|
||||||
{{#each features as | feature |}}
|
{{#each features as | feature |}}
|
||||||
<div><strong>{{localize feature.label}}</strong>: {{{localize feature.description}}}</div>
|
<div><strong>{{localize feature.label}}</strong>: {{{localize feature.description}}}</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<div class="feature-descriptions">
|
<div class="feature-descriptions">
|
||||||
<div class="features-header {{#if @root.large}}large{{/if}}">{{localize "DAGGERHEART.SETTINGS.Homebrew.itemFeatures"}}</div>
|
{{#unless (eq headerStyle 'none')}}
|
||||||
|
<div class="features-header {{#if (eq headerStyle 'large')}}large{{/if}}">{{localize "DAGGERHEART.SETTINGS.Homebrew.itemFeatures"}}</div>
|
||||||
|
{{/unless}}
|
||||||
{{#each features as | feature |}}
|
{{#each features as | feature |}}
|
||||||
<div><strong>{{localize feature.label}}</strong>: {{{localize feature.description}}}</div>
|
<div><strong>{{localize feature.label}}</strong>: {{{localize feature.description}}}</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue