mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
[Feature] Advantage/Disadvantage Tooltips (#362)
* Added advantage/disadvantageSource to Character model. It's shown from a tooltip icon on rolls * Added support for beastform advantageOn
This commit is contained in:
parent
ad9e0aa558
commit
d7e024be02
6 changed files with 36 additions and 0 deletions
|
|
@ -21,6 +21,24 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
|
|||
this.tooltip.innerHTML = html;
|
||||
options.direction = this._determineItemTooltipDirection(element);
|
||||
}
|
||||
} else {
|
||||
const isAdvantage = element.dataset.tooltip?.startsWith('#advantage#');
|
||||
const isDisadvantage = element.dataset.tooltip?.startsWith('#disadvantage#');
|
||||
if (isAdvantage || isDisadvantage) {
|
||||
const actorUuid = element.dataset.tooltip.slice(isAdvantage ? 11 : 14);
|
||||
const actor = await foundry.utils.fromUuid(actorUuid);
|
||||
|
||||
if (actor) {
|
||||
html = await foundry.applications.handlebars.renderTemplate(
|
||||
`systems/daggerheart/templates/ui/tooltip/advantage.hbs`,
|
||||
{
|
||||
sources: isAdvantage ? actor.system.advantageSources : actor.system.disadvantageSources
|
||||
}
|
||||
);
|
||||
|
||||
this.tooltip.innerHTML = html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.activate(element, { ...options, html: html });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue