Implement @Lookup enricher (#1196)

This commit is contained in:
Carlos Fernandez 2025-10-04 07:10:39 -04:00 committed by GitHub
parent 952779000d
commit 86eeba0648
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 50 additions and 68 deletions

View file

@ -1,29 +1,8 @@
import { parseInlineParams } from './parser.mjs';
export default function DhDamageEnricher(match, _options) {
const parts = match[1].split('|').map(x => x.trim());
let value = null,
type = null,
inline = false;
parts.forEach(part => {
const split = part.split(':').map(x => x.toLowerCase().trim());
if (split.length === 2) {
switch (split[0]) {
case 'value':
value = split[1];
break;
case 'type':
type = split[1];
break;
case 'inline':
inline = true;
break;
}
}
});
if (!value || !value) return match[0];
const { value, type, inline } = parseInlineParams(match[1]);
if (!value || !type) return match[0];
return getDamageMessage(value, type, inline, match[0]);
}