diff --git a/module/data/actor/character.mjs b/module/data/actor/character.mjs index 638465e5..484c821c 100644 --- a/module/data/actor/character.mjs +++ b/module/data/actor/character.mjs @@ -336,7 +336,8 @@ export default class DhCharacter extends BaseDataActor { ...this.attack, id: this.attack.id, name: this.activeBeastform ? 'DAGGERHEART.ITEMS.Beastform.attackName' : this.attack.name, - img: this.activeBeastform ? 'icons/creatures/claws/claw-straight-brown.webp' : this.attack.img + img: this.activeBeastform ? 'icons/creatures/claws/claw-straight-brown.webp' : this.attack.img, + actor: this.parent } : null; } diff --git a/module/documents/tooltipManager.mjs b/module/documents/tooltipManager.mjs index e622059d..96b13103 100644 --- a/module/documents/tooltipManager.mjs +++ b/module/documents/tooltipManager.mjs @@ -1,5 +1,7 @@ export default class DhTooltipManager extends foundry.helpers.interaction.TooltipManager { async activate(element, options = {}) { + const { TextEditor } = foundry.applications.ux; + let html = options.html; if (element.dataset.tooltip?.startsWith('#item#')) { const splitValues = element.dataset.tooltip.slice(6).split('#action#'); @@ -10,10 +12,16 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti const item = actionId ? baseItem.system.actions.find(x => x.id === actionId) : baseItem; if (item) { const type = actionId ? 'action' : item.type; + const description = await TextEditor.enrichHTML(item.system.description); + for (let feature of item.system.features) { + feature.system.enrichedDescription = await TextEditor.enrichHTML(feature.system.description); + } + html = await foundry.applications.handlebars.renderTemplate( `systems/daggerheart/templates/ui/tooltip/${type}.hbs`, { item: item, + description: description, config: CONFIG.DH } ); @@ -22,6 +30,26 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti options.direction = this._determineItemTooltipDirection(element); } } else { + const attack = element.dataset.tooltip?.startsWith('#attack#'); + if (attack) { + const actorUuid = element.dataset.tooltip.slice(8); + const actor = await foundry.utils.fromUuid(actorUuid); + const attack = actor.system.attack; + + const description = await TextEditor.enrichHTML(attack.description); + html = await foundry.applications.handlebars.renderTemplate( + `systems/daggerheart/templates/ui/tooltip/attack.hbs`, + { + attack: attack, + description: description, + parent: actor, + config: CONFIG.DH + } + ); + + this.tooltip.innerHTML = html; + } + const shortRest = element.dataset.tooltip?.startsWith('#shortRest#'); const longRest = element.dataset.tooltip?.startsWith('#longRest#'); if (shortRest || longRest) { @@ -29,11 +57,14 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti const downtimeOptions = shortRest ? CONFIG.DH.GENERAL.defaultRestOptions.shortRest() : CONFIG.DH.GENERAL.defaultRestOptions.longRest(); + const move = downtimeOptions[key]; + const description = await TextEditor.enrichHTML(move.description); html = await foundry.applications.handlebars.renderTemplate( `systems/daggerheart/templates/ui/tooltip/downtime.hbs`, { - move: move + move: move, + description: description } ); diff --git a/module/systemRegistration/handlebars.mjs b/module/systemRegistration/handlebars.mjs index f732fbd9..b15bf820 100644 --- a/module/systemRegistration/handlebars.mjs +++ b/module/systemRegistration/handlebars.mjs @@ -28,6 +28,7 @@ export const preloadHandlebarsTemplates = async function () { 'systems/daggerheart/templates/settings/components/settings-item-line.hbs', 'systems/daggerheart/templates/ui/chat/parts/damage-chat.hbs', 'systems/daggerheart/templates/ui/chat/parts/target-chat.hbs', + 'systems/daggerheart/templates/ui/tooltip/parts/tooltipChips.hbs', 'systems/daggerheart/templates/ui/tooltip/parts/tooltipTags.hbs', 'systems/daggerheart/templates/dialogs/downtime/activities.hbs' ]); diff --git a/styles/less/ux/tooltip/tooltip.less b/styles/less/ux/tooltip/tooltip.less index 0060f74b..e6b660a5 100644 --- a/styles/less/ux/tooltip/tooltip.less +++ b/styles/less/ux/tooltip/tooltip.less @@ -74,6 +74,22 @@ } } + .tooltip-chips { + display: flex; + justify-content: space-around; + flex-wrap: wrap; + gap: 8px; + + .tooltip-chip { + font-size: 18px; + padding: 2px 4px; + border: 1px solid light-dark(@dark-blue, @golden); + border-radius: 6px; + color: light-dark(@dark, @beige); + background-image: url(../assets/parchments/dh-parchment-dark.png); + } + } + .tooltip-tags { width: 100%; display: flex; diff --git a/templates/sheets/global/partials/inventory-item-V2.hbs b/templates/sheets/global/partials/inventory-item-V2.hbs index e3ffa64a..b58f6f44 100644 --- a/templates/sheets/global/partials/inventory-item-V2.hbs +++ b/templates/sheets/global/partials/inventory-item-V2.hbs @@ -21,7 +21,14 @@ Parameters: {{!-- Image --}}