Added the display

This commit is contained in:
WBHarry 2025-11-25 17:13:13 +01:00
parent 01dd5ced94
commit 4954e41b02
13 changed files with 125 additions and 43 deletions

View file

@ -60,7 +60,9 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
async _renderFrame(options) {
const frame = await super._renderFrame(options);
frame.classList.add('effects-present');
if (game.system.api.applications.ui.DhEffectsDisplay.getTokenEffects().length > 0) {
frame.classList.add('effects-present');
}
const iconOnly =
game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS.userFlags.countdownMode) ===
@ -152,6 +154,11 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
if (refreshType === RefreshType.Countdown) this.render();
};
effectDisplayToggle = (hidden, _token) => {
if (hidden) this.element.classList.remove('effects-present');
else this.element.classList.add('effects-present');
};
static canPerformEdit() {
if (game.user.isGM) return true;
@ -236,6 +243,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
}
setupHooks() {
Hooks.on(CONFIG.DH.HOOKS.effectDisplayToggle, this.effectDisplayToggle.bind());
Hooks.on(socketEvent.Refresh, this.cooldownRefresh.bind());
}
@ -243,6 +251,7 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
/* Opt out of Foundry's standard behavior of closing all application windows marked as UI when Escape is pressed */
if (options.closeKey) return;
Hooks.off(CONFIG.DH.HOOKS.effectDisplayToggle, this.effectDisplayToggle);
Hooks.off(socketEvent.Refresh, this.cooldownRefresh);
return super.close(options);
}