Fix for rounded vigilance (now ceil instead of floor)

Fix for symbol replaced once
Added 20Q 2nd die skill or tech/item...
This commit is contained in:
Vlyan
2021-01-03 18:12:54 +01:00
parent 791a98eb3c
commit bafa0fb995
12 changed files with 77 additions and 26 deletions

View File

@@ -149,11 +149,21 @@ export class HelpersL5r5e {
static convertSymbols(text, toSymbol) {
CONFIG.l5r5e.symbols.forEach((cfg, tag) => {
if (toSymbol) {
text = text.replace(tag, `<i class="${cfg.class}" title="${game.i18n.localize(cfg.label)}"></i>`);
text = text.replace(
new RegExp(HelpersL5r5e.escapeRegExp(tag), "gi"),
`<i class="${cfg.class}" title="${game.i18n.localize(cfg.label)}"></i>`
);
} else {
text = text.replace(new RegExp(`<i class="${cfg.class}" title="[^"]*"></i>`, "gi"), tag);
}
});
return text;
}
/**
* Escape Regx characters
*/
static escapeRegExp(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
}