mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
.
This commit is contained in:
parent
708056713b
commit
0e3f2fe632
11 changed files with 51 additions and 99 deletions
|
|
@ -252,7 +252,7 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
/* If any noticeable slowdown occurs, consider replacing with enriching description on clicking to expand descriptions */
|
/* If any noticeable slowdown occurs, consider replacing with enriching description on clicking to expand descriptions */
|
||||||
for (const item of this.items) {
|
for (const item of this.items) {
|
||||||
item.system.enrichedDescription =
|
item.system.enrichedDescription =
|
||||||
(await item.system.getEnrichedDescription?.()) ??
|
(await item.system.getEnrichedDescription?.({ inCompendium: true })) ??
|
||||||
(await foundry.applications.ux.TextEditor.implementation.enrichHTML(item.description));
|
(await foundry.applications.ux.TextEditor.implementation.enrichHTML(item.description));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,14 +53,14 @@ export default class DHArmor extends AttachableItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async getDescriptionData() {
|
async getDescriptionData({ inCompendium }) {
|
||||||
const baseDescription = this.description;
|
const baseDescription = this.description;
|
||||||
const allFeatures = CONFIG.DH.ITEM.allArmorFeatures();
|
const allFeatures = CONFIG.DH.ITEM.allArmorFeatures();
|
||||||
const features = this.armorFeatures.map(x => allFeatures[x.value]).filter(x => x);
|
const features = this.armorFeatures.map(x => allFeatures[x.value]).filter(x => x);
|
||||||
|
|
||||||
const prefix = await foundry.applications.handlebars.renderTemplate(
|
const prefix = await foundry.applications.handlebars.renderTemplate(
|
||||||
'systems/daggerheart/templates/sheets/items/armor/description.hbs',
|
'systems/daggerheart/templates/sheets/items/armor/description.hbs',
|
||||||
{ item: this.parent, features }
|
{ item: this.parent, inCompendium, features }
|
||||||
);
|
);
|
||||||
|
|
||||||
return { prefix, value: baseDescription, suffix: null };
|
return { prefix, value: baseDescription, suffix: null };
|
||||||
|
|
|
||||||
|
|
@ -138,10 +138,10 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||||
* @param {object} [options] - Options that modify the styling of the rendered template. { headerStyle: undefined|'none'|'large' }
|
* @param {object} [options] - Options that modify the styling of the rendered template. { headerStyle: undefined|'none'|'large' }
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
async getEnrichedDescription() {
|
async getEnrichedDescription(options = { inCompendium: false }) {
|
||||||
if (!this.metadata.hasDescription) return '';
|
if (!this.metadata.hasDescription) return '';
|
||||||
|
|
||||||
const { prefix, value, suffix } = await this.getDescriptionData();
|
const { prefix, value, suffix } = await this.getDescriptionData(options);
|
||||||
const fullDescription = [prefix, value, suffix].filter(p => !!p).join('\n<hr>\n');
|
const fullDescription = [prefix, value, suffix].filter(p => !!p).join('\n<hr>\n');
|
||||||
|
|
||||||
return await foundry.applications.ux.TextEditor.implementation.enrichHTML(fullDescription, {
|
return await foundry.applications.ux.TextEditor.implementation.enrichHTML(fullDescription, {
|
||||||
|
|
|
||||||
|
|
@ -109,27 +109,18 @@ export default class DHWeapon extends AttachableItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
async getDescriptionData() {
|
async getDescriptionData({ inCompendium }) {
|
||||||
const baseDescription = this.description;
|
const baseDescription = this.description;
|
||||||
|
|
||||||
const tier = game.i18n.localize(`DAGGERHEART.GENERAL.Tiers.${this.tier}`);
|
|
||||||
const trait = game.i18n.localize(CONFIG.DH.ACTOR.abilities[this.attack.roll.trait].label);
|
|
||||||
const range = game.i18n.localize(`DAGGERHEART.CONFIG.Range.${this.attack.range}.name`);
|
|
||||||
const damage = Roll.replaceFormulaData(this.attack.damageFormula, this.parent.parent ?? this.parent);
|
|
||||||
const burden = game.i18n.localize(CONFIG.DH.GENERAL.burden[this.burden].label);
|
|
||||||
|
|
||||||
const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures();
|
const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures();
|
||||||
const features = this.weaponFeatures.map(x => allFeatures[x.value]).filter(x => x);
|
const features = this.weaponFeatures.map(x => allFeatures[x.value]).filter(x => x);
|
||||||
|
|
||||||
const prefix = await foundry.applications.handlebars.renderTemplate(
|
const prefix = await foundry.applications.handlebars.renderTemplate(
|
||||||
'systems/daggerheart/templates/sheets/items/weapon/description.hbs',
|
'systems/daggerheart/templates/sheets/items/weapon/description.hbs',
|
||||||
{
|
{
|
||||||
features,
|
item: this,
|
||||||
tier,
|
inCompendium,
|
||||||
trait,
|
features
|
||||||
range,
|
|
||||||
damage,
|
|
||||||
burden
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,10 @@ export const preloadHandlebarsTemplates = async function () {
|
||||||
'systems/daggerheart/templates/sheets/global/partials/resource-section/dice-value.hbs',
|
'systems/daggerheart/templates/sheets/global/partials/resource-section/dice-value.hbs',
|
||||||
'systems/daggerheart/templates/sheets/global/partials/resource-section/die.hbs',
|
'systems/daggerheart/templates/sheets/global/partials/resource-section/die.hbs',
|
||||||
'systems/daggerheart/templates/sheets/global/partials/resource-bar.hbs',
|
'systems/daggerheart/templates/sheets/global/partials/resource-bar.hbs',
|
||||||
|
'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs',
|
||||||
|
'systems/daggerheart/templates/sheets/global/partials/item-tags.hbs',
|
||||||
'systems/daggerheart/templates/components/card-preview.hbs',
|
'systems/daggerheart/templates/components/card-preview.hbs',
|
||||||
'systems/daggerheart/templates/levelup/parts/selectable-card-preview.hbs',
|
'systems/daggerheart/templates/levelup/parts/selectable-card-preview.hbs',
|
||||||
'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs',
|
|
||||||
'systems/daggerheart/templates/ui/combatTracker/combatTrackerSection.hbs',
|
'systems/daggerheart/templates/ui/combatTracker/combatTrackerSection.hbs',
|
||||||
'systems/daggerheart/templates/actionTypes/damage.hbs',
|
'systems/daggerheart/templates/actionTypes/damage.hbs',
|
||||||
'systems/daggerheart/templates/actionTypes/resource.hbs',
|
'systems/daggerheart/templates/actionTypes/resource.hbs',
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,24 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-tags {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
align-items: center;
|
||||||
|
background: light-dark(@dark-15, @beige-15);
|
||||||
|
border-radius: 3px;
|
||||||
|
border: 1px solid light-dark(@dark, @beige);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
font-size: var(--font-size-12);
|
||||||
|
justify-content: start;
|
||||||
|
padding: 3px 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Remove me when this issue is resolved https://github.com/foundryvtt/foundryvtt/issues/13734 */
|
/* TODO: Remove me when this issue is resolved https://github.com/foundryvtt/foundryvtt/issues/13734 */
|
||||||
|
|
|
||||||
|
|
@ -138,24 +138,6 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-tags {
|
|
||||||
display: flex;
|
|
||||||
gap: 10px;
|
|
||||||
|
|
||||||
.tag {
|
|
||||||
align-items: center;
|
|
||||||
background: light-dark(@dark-15, @beige-15);
|
|
||||||
border-radius: 3px;
|
|
||||||
border: 1px solid light-dark(@dark, @beige);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
font-size: var(--font-size-12);
|
|
||||||
justify-content: start;
|
|
||||||
padding: 3px 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-resource {
|
.item-resource {
|
||||||
|
|
|
||||||
|
|
@ -45,30 +45,20 @@ Parameters:
|
||||||
<span class="item-name">{{localize item.name}} {{#unless (or noExtensible (not item.system.description))}}<span class="expanded-icon"><i class="fa-solid fa-expand"></i></span>{{/unless}}</span>
|
<span class="item-name">{{localize item.name}} {{#unless (or noExtensible (not item.system.description))}}<span class="expanded-icon"><i class="fa-solid fa-expand"></i></span>{{/unless}}</span>
|
||||||
|
|
||||||
{{!-- Tags Start --}}
|
{{!-- Tags Start --}}
|
||||||
{{#with item}}
|
{{#if (not ../hideTags)}}
|
||||||
{{#if (not ../hideTags)}}
|
{{#> "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs" item }}
|
||||||
<div class="item-tags">
|
{{#if (eq ../type 'feature')}}
|
||||||
{{#each this._getTags as |tag|}}
|
{{#if (or (eq @root.document.type 'adversary') (eq @root.document.type 'environment'))}}
|
||||||
<div class="tag">
|
{{#if system.featureForm}}
|
||||||
{{tag}}
|
<div class="tag feature-form">
|
||||||
</div>
|
<span class="recall-value">{{localize (concat "DAGGERHEART.CONFIG.FeatureForm." system.featureForm)}}</span>
|
||||||
{{/each}}
|
</div>
|
||||||
|
{{/if}}
|
||||||
{{!-- Feature Form Tag Start --}}
|
|
||||||
{{#if (eq ../type 'feature')}}
|
|
||||||
{{#if (or (eq @root.document.type 'adversary') (eq @root.document.type 'environment'))}}
|
|
||||||
{{#if system.featureForm}}
|
|
||||||
<div class="tag feature-form">
|
|
||||||
<span class="recall-value">{{localize (concat "DAGGERHEART.CONFIG.FeatureForm." system.featureForm)}}</span>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/ "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{!-- Feature Form Tag End --}}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{/with}}
|
|
||||||
{{!--Tags End --}}
|
{{!--Tags End --}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
8
templates/sheets/global/partials/item-tags.hbs
Normal file
8
templates/sheets/global/partials/item-tags.hbs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<div class="item-tags">
|
||||||
|
{{#each _getTags as |tag|}}
|
||||||
|
<div class="tag">
|
||||||
|
{{tag}}
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{#if @partial-block}}{{> @partial-block}}{{/if}}
|
||||||
|
</div>
|
||||||
|
|
@ -1,16 +1,6 @@
|
||||||
<div class="item-description-outer-container">
|
<div class="item-description-outer-container">
|
||||||
<div class="two-columns">
|
{{#if inCompendium}}{{> "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs" item }}{{/if}}
|
||||||
<div class="item-description-container">
|
|
||||||
<h4>{{localize "DAGGERHEART.ITEMS.Armor.baseThresholds.base"}}</h4>
|
|
||||||
<span>{{item.system.baseThresholds.major}}/{{item.system.baseThresholds.severe}}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="item-description-container">
|
|
||||||
<h4>{{localize "DAGGERHEART.ITEMS.Armor.baseScore"}}</h4>
|
|
||||||
<span>{{item.system.baseScore}}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{#if features.length}}
|
{{#if features.length}}
|
||||||
<div class="item-description-container">
|
<div class="item-description-container">
|
||||||
<h4>{{localize "DAGGERHEART.GENERAL.features"}}</h4>
|
<h4>{{localize "DAGGERHEART.GENERAL.features"}}</h4>
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,8 @@
|
||||||
<div class="item-description-outer-container">
|
<div class="item-description-outer-container">
|
||||||
<div class="three-columns">
|
{{#if inCompendium}}{{> "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs" item }}{{/if}}
|
||||||
<div class="item-description-container">
|
|
||||||
<h4>{{localize "DAGGERHEART.GENERAL.Tiers.singular"}}</h4>
|
|
||||||
<span>{{tier}}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="item-description-container">
|
|
||||||
<h4>{{localize "DAGGERHEART.GENERAL.Trait.single"}}</h4>
|
|
||||||
<span>{{trait}}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="item-description-container">
|
|
||||||
<h4>{{localize "DAGGERHEART.GENERAL.range"}}</h4>
|
|
||||||
<span>{{range}}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="three-columns">
|
|
||||||
<div class="item-description-container">
|
|
||||||
<h4>{{localize "DAGGERHEART.GENERAL.damage"}}</h4>
|
|
||||||
<span>{{damage}}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="item-description-container">
|
|
||||||
<h4>{{localize "DAGGERHEART.GENERAL.burden"}}</h4>
|
|
||||||
<span>{{burden}}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{#if features.length}}
|
{{#if features.length}}
|
||||||
<div class="item-description-container">
|
<div class="item-description-container">
|
||||||
<h4>{{localize "DAGGERHEART.GENERAL.features"}}</h4>
|
|
||||||
{{#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