mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Improved tooltips wiht more data (#701)
This commit is contained in:
parent
df99d0e4c6
commit
5045801475
7 changed files with 73 additions and 12 deletions
|
|
@ -4,7 +4,25 @@ export default class BeastformField extends fields.SchemaField {
|
||||||
constructor(options = {}, context = {}) {
|
constructor(options = {}, context = {}) {
|
||||||
const beastformFields = {
|
const beastformFields = {
|
||||||
tierAccess: new fields.SchemaField({
|
tierAccess: new fields.SchemaField({
|
||||||
exact: new fields.NumberField({ integer: true, nullable: true, initial: null })
|
exact: new fields.NumberField({
|
||||||
|
integer: true,
|
||||||
|
nullable: true,
|
||||||
|
initial: null,
|
||||||
|
choices: () => {
|
||||||
|
const settingsTiers = game.settings.get(
|
||||||
|
CONFIG.DH.id,
|
||||||
|
CONFIG.DH.SETTINGS.gameSettings.LevelTiers
|
||||||
|
).tiers;
|
||||||
|
return Object.values(settingsTiers).reduce(
|
||||||
|
(acc, tier) => {
|
||||||
|
acc[tier.tier] = game.i18n.localize(tier.name);
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{ 1: game.i18n.localize('DAGGERHEART.GENERAL.Tiers.1') }
|
||||||
|
);
|
||||||
|
},
|
||||||
|
hint: 'DAGGERHEART.ACTIONS.Config.beastform.exactHint'
|
||||||
|
})
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
super(beastformFields, options, context);
|
super(beastformFields, options, context);
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,26 @@ export default class DHBeastform extends BaseDataItem {
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
|
get beastformAttackData() {
|
||||||
|
const effect = this.parent.effects.find(x => x.type === 'beastform');
|
||||||
|
if (!effect) return null;
|
||||||
|
|
||||||
|
const traitBonus = effect.changes.find(x => x.key === `system.traits.${this.mainTrait}.value`)?.value ?? 0;
|
||||||
|
const evasionBonus = effect.changes.find(x => x.key === 'system.evasion')?.value ?? 0;
|
||||||
|
|
||||||
|
const damageDiceIndex = effect.changes.find(x => x.key === 'system.rules.attack.damage.diceIndex');
|
||||||
|
const damageDice = damageDiceIndex ? Object.keys(CONFIG.DH.GENERAL.diceTypes)[damageDiceIndex.value] : null;
|
||||||
|
const damageBonus = effect.changes.find(x => x.key === 'system.rules.attack.damage.bonus')?.value ?? 0;
|
||||||
|
|
||||||
|
return {
|
||||||
|
trait: game.i18n.localize(CONFIG.DH.ACTOR.abilities[this.mainTrait].label),
|
||||||
|
traitBonus: traitBonus ? Number(traitBonus).signedString() : '',
|
||||||
|
evasionBonus: evasionBonus ? Number(evasionBonus).signedString() : '',
|
||||||
|
damageDice: damageDice,
|
||||||
|
damageBonus: damageBonus ? `${Number(damageBonus).signedString()}` : ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
async _preCreate() {
|
async _preCreate() {
|
||||||
if (!this.actor) return;
|
if (!this.actor) return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ 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.description);
|
const enrichedValue = 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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,10 @@
|
||||||
text-align: start;
|
text-align: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.simple-info {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
.tooltip-sub-title {
|
.tooltip-sub-title {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: light-dark(@dark-blue, @beige);
|
color: light-dark(@dark-blue, @beige);
|
||||||
|
|
@ -45,6 +49,10 @@
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
|
||||||
|
&.spaced {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
&.triple {
|
&.triple {
|
||||||
grid-template-columns: 1fr 1fr 1fr;
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,6 @@
|
||||||
</legend>
|
</legend>
|
||||||
|
|
||||||
<div class="action-category-data open">
|
<div class="action-category-data open">
|
||||||
<div class="hint-group">
|
{{formGroup fields.tierAccess.fields.exact value=beastform.tierAccess.exact labelAttr="label" valueAttr="key" localize=true blank=""}}
|
||||||
<div class="form-fields">
|
|
||||||
<label>{{localize "DAGGERHEART.ACTIONS.Config.beastform.exact"}}</label>
|
|
||||||
<select name="beastform.tierAccess.exact" data-dtype="Number">
|
|
||||||
{{selectOptions tierOptions selected=@root.source.beastform.tierAccess.exact labelAttr="label" valueAttr="key" blank="" }}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<p class="hint">{{localize "DAGGERHEART.ACTIONS.Config.beastform.exactHint"}}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
@ -10,5 +10,5 @@
|
||||||
{{#if fields.resource}}{{> 'systems/daggerheart/templates/actionTypes/resource.hbs' fields=fields.resource.fields source=source.resource}}{{/if}}
|
{{#if fields.resource}}{{> 'systems/daggerheart/templates/actionTypes/resource.hbs' fields=fields.resource.fields source=source.resource}}{{/if}}
|
||||||
{{#if fields.documentUUID}}{{> 'systems/daggerheart/templates/actionTypes/uuid.hbs' fields=fields.documentUUID source=source.documentUUID}}{{/if}}
|
{{#if fields.documentUUID}}{{> 'systems/daggerheart/templates/actionTypes/uuid.hbs' fields=fields.documentUUID source=source.documentUUID}}{{/if}}
|
||||||
{{#if fields.effects}}{{> 'systems/daggerheart/templates/actionTypes/effect.hbs' fields=fields.effects.element.fields source=source.effects}}{{/if}}
|
{{#if fields.effects}}{{> 'systems/daggerheart/templates/actionTypes/effect.hbs' fields=fields.effects.element.fields source=source.effects}}{{/if}}
|
||||||
{{#if fields.beastform}}{{> 'systems/daggerheart/templates/actionTypes/beastform.hbs' fields=fields.effects.element.fields source=source.beastform}}{{/if}}
|
{{#if fields.beastform}}{{> 'systems/daggerheart/templates/actionTypes/beastform.hbs' fields=fields.beastform.fields source=source.beastform}}{{/if}}
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -3,6 +3,29 @@
|
||||||
<img class="tooltip-image" src="{{item.img}}" />
|
<img class="tooltip-image" src="{{item.img}}" />
|
||||||
<div class="tooltip-description">{{{description}}}</div>
|
<div class="tooltip-description">{{{description}}}</div>
|
||||||
|
|
||||||
|
<div class="simple-info">{{item.system.examples}}</div>
|
||||||
{{> "systems/daggerheart/templates/ui/tooltip/parts/tooltipChips.hbs" chips=item.system.advantageOn label=(localize "DAGGERHEART.ITEMS.Beastform.FIELDS.advantageOn.label")}}
|
{{> "systems/daggerheart/templates/ui/tooltip/parts/tooltipChips.hbs" chips=item.system.advantageOn label=(localize "DAGGERHEART.ITEMS.Beastform.FIELDS.advantageOn.label")}}
|
||||||
|
|
||||||
|
<div class="tooltip-information-section spaced">
|
||||||
|
{{#with item.system.beastformAttackData}}
|
||||||
|
<div class="tooltip-information">
|
||||||
|
<label>{{localize "Main Trait"}}</label>
|
||||||
|
<div>{{this.trait}}</div>
|
||||||
|
</div>
|
||||||
|
<div class="tooltip-information">
|
||||||
|
<label>{{localize "Trait Bonus"}}</label>
|
||||||
|
<div>{{this.traitBonus}}</div>
|
||||||
|
</div>
|
||||||
|
<div class="tooltip-information">
|
||||||
|
<label>{{localize "Evasion"}}</label>
|
||||||
|
<div>{{this.evasionBonus}}</div>
|
||||||
|
</div>
|
||||||
|
<div class="tooltip-information">
|
||||||
|
<label>{{localize "Damage"}}</label>
|
||||||
|
<div>{{concat this.damageDice ' ' this.damageBonus}} <i class="fa-solid fa-hand-fist"></i></div>
|
||||||
|
</div>
|
||||||
|
{{/with}}
|
||||||
|
</div>
|
||||||
|
|
||||||
{{> "systems/daggerheart/templates/ui/tooltip/parts/tooltipTags.hbs" features=item.system.features label=(localize "DAGGERHEART.GENERAL.features")}}
|
{{> "systems/daggerheart/templates/ui/tooltip/parts/tooltipTags.hbs" features=item.system.features label=(localize "DAGGERHEART.GENERAL.features")}}
|
||||||
</div>
|
</div>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue