mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
Corrected ActiveEffect template styling and added useage of the new 'showIcon' property
This commit is contained in:
parent
ac998adaa6
commit
115a31423e
9 changed files with 44 additions and 12 deletions
|
|
@ -151,12 +151,15 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
|||
index,
|
||||
defaultPriority
|
||||
) ??
|
||||
renderTemplate('systems/daggerheart/templates/sheets/activeEffect/change.hbs', {
|
||||
change,
|
||||
index,
|
||||
defaultPriority,
|
||||
fields
|
||||
})
|
||||
foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/sheets/activeEffect/change.hbs',
|
||||
{
|
||||
change,
|
||||
index,
|
||||
defaultPriority,
|
||||
fields
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getIconVisibleActiveEffects } from '../../helpers/utils.mjs';
|
||||
import { RefreshType } from '../../systemRegistration/socket.mjs';
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
|
@ -72,7 +73,7 @@ export default class DhEffectsDisplay extends HandlebarsApplicationMixin(Applica
|
|||
? game.user.character
|
||||
: null
|
||||
: canvas.tokens.controlled[0].actor;
|
||||
return actor?.getActiveEffects() ?? [];
|
||||
return getIconVisibleActiveEffects(actor?.getActiveEffects() ?? []);
|
||||
};
|
||||
|
||||
toggleHidden(token, focused) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getIconVisibleActiveEffects } from '../../helpers/utils.mjs';
|
||||
import DhMeasuredTemplate from './measuredTemplate.mjs';
|
||||
|
||||
export default class DhTokenPlaceable extends foundry.canvas.placeables.Token {
|
||||
|
|
@ -20,7 +21,7 @@ export default class DhTokenPlaceable extends foundry.canvas.placeables.Token {
|
|||
this.effects.overlay = null;
|
||||
|
||||
// Categorize effects
|
||||
const activeEffects = this.actor?.getActiveEffects() ?? [];
|
||||
const activeEffects = getIconVisibleActiveEffects(Array.from(this.actor?.allApplicableEffects() ?? []));
|
||||
const overlayEffect = activeEffects.findLast(e => e.img && e.getFlag?.('core', 'overlay'));
|
||||
|
||||
// Draw effects
|
||||
|
|
|
|||
|
|
@ -500,3 +500,12 @@ export function htmlToText(html) {
|
|||
|
||||
return tempDivElement.textContent || tempDivElement.innerText || '';
|
||||
}
|
||||
|
||||
export function getIconVisibleActiveEffects(effects) {
|
||||
return effects.filter(effect => {
|
||||
const alwaysShown = effect.showIcon === CONST.ACTIVE_EFFECT_SHOW_ICON.ALWAYS;
|
||||
const conditionalShown = effect.showIcon === CONST.ACTIVE_EFFECT_SHOW_ICON.CONDITIONAL && !effect.transfer; // TODO: system specific logic
|
||||
|
||||
return !effect.disabled && (alwaysShown || conditionalShown);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue