mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-15 05:01:08 +01:00
Fixed so enriched buttons are inline by default. Can be set to 'inline:true' to make them fit with the text better (#1068)
This commit is contained in:
parent
f76515eac1
commit
936c96a1be
5 changed files with 30 additions and 7 deletions
|
|
@ -2,7 +2,8 @@ export default function DhDamageEnricher(match, _options) {
|
|||
const parts = match[1].split('|').map(x => x.trim());
|
||||
|
||||
let value = null,
|
||||
type = null;
|
||||
type = null,
|
||||
inline = false;
|
||||
|
||||
parts.forEach(part => {
|
||||
const split = part.split(':').map(x => x.toLowerCase().trim());
|
||||
|
|
@ -14,16 +15,19 @@ export default function DhDamageEnricher(match, _options) {
|
|||
case 'type':
|
||||
type = split[1];
|
||||
break;
|
||||
case 'inline':
|
||||
inline = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!value || !value) return match[0];
|
||||
|
||||
return getDamageMessage(value, type, match[0]);
|
||||
return getDamageMessage(value, type, inline, match[0]);
|
||||
}
|
||||
|
||||
function getDamageMessage(damage, type, defaultElement) {
|
||||
function getDamageMessage(damage, type, inline, defaultElement) {
|
||||
const typeIcons = type
|
||||
.replace('[', '')
|
||||
.replace(']', '')
|
||||
|
|
@ -40,7 +44,7 @@ function getDamageMessage(damage, type, defaultElement) {
|
|||
|
||||
const dualityElement = document.createElement('span');
|
||||
dualityElement.innerHTML = `
|
||||
<button class="enriched-damage-button"
|
||||
<button class="enriched-damage-button${inline ? ' inline' : ''}"
|
||||
data-value="${damage}"
|
||||
data-type="${type}"
|
||||
data-tooltip="${game.i18n.localize('DAGGERHEART.GENERAL.damage')}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue