enhance chat messages styles

This commit is contained in:
moliloo 2025-08-29 20:18:17 -03:00
parent 30229407cd
commit e139cd4dae
6 changed files with 244 additions and 65 deletions

View file

@ -14,7 +14,8 @@ export default class RegisterHandlebarsHelpers {
getProperty: foundry.utils.getProperty,
setVar: this.setVar,
empty: this.empty,
pluralize: this.pluralize
pluralize: this.pluralize,
positive: this.positive
});
}
static add(a, b) {
@ -76,10 +77,10 @@ export default class RegisterHandlebarsHelpers {
/**
* Pluralize helper that returns the appropriate localized string based on count
* @param {number} count - The number to check for plurality
* @param {number} count - The number to check for plurality
* @param {string} baseKey - The base localization key (e.g., "DAGGERHEART.GENERAL.Target")
* @returns {string} The localized singular or plural string
*
*
* Usage: {{pluralize currentTargets.length "DAGGERHEART.GENERAL.Target"}}
* Returns: "Target" if count is exactly 1, "Targets" if count is 0, 2+, or invalid
*/
@ -89,4 +90,8 @@ export default class RegisterHandlebarsHelpers {
const key = isSingular ? `${baseKey}.single` : `${baseKey}.plural`;
return game.i18n.localize(key);
}
static positive(a) {
return Math.abs(Number(a));
}
}