[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:
WBHarry 2025-07-17 19:01:15 +02:00 committed by GitHub
parent ad9e0aa558
commit d7e024be02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 36 additions and 0 deletions

View file

@ -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 });