mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
Fix broken TemplateEnricher - CONFIG.MeasuredTemplate.types has been … (#1246)
* Fix broken TemplateEnricher - CONFIG.MeasuredTemplate.types has been deprecated and the error was breaking the code * Fix for shortHand of ranges --------- Co-authored-by: Chris Ryan <chrisr@blackhole> Co-authored-by: WBHarry <williambjrklund@gmail.com>
This commit is contained in:
parent
a7d035bcdb
commit
a7bc8db55f
1 changed files with 10 additions and 7 deletions
|
|
@ -5,20 +5,22 @@ export default function DhTemplateEnricher(match, _options) {
|
|||
const { type, angle = CONFIG.MeasuredTemplate.defaults.angle, inline = false } = params;
|
||||
const direction = Number(params.direction) || 0;
|
||||
const range =
|
||||
params.range && Number.isNaN(params.range)
|
||||
params.range && Number.isNaN(Number(params.range))
|
||||
? Object.values(CONFIG.DH.GENERAL.templateRanges).find(
|
||||
x => x.id.toLowerCase() === split[1] || x.short === split[1]
|
||||
x => x.id.toLowerCase() === params.range || x.short === params.range
|
||||
)?.id
|
||||
: params.range;
|
||||
if (!(type in CONFIG.MeasuredTemplate.types) || !range) return match[0];
|
||||
|
||||
if (!Object.values(CONFIG.DH.GENERAL.templateTypes).find(x => x === type) || !range) return match[0];
|
||||
|
||||
const label = game.i18n.localize(`DAGGERHEART.CONFIG.TemplateTypes.${type}`);
|
||||
const rangeDisplay = Number.isNaN(Number(range)) ? game.i18n.localize(`DAGGERHEART.CONFIG.Range.${range}.name`) : range;
|
||||
const rangeDisplay = Number.isNaN(Number(range))
|
||||
? game.i18n.localize(`DAGGERHEART.CONFIG.Range.${range}.name`)
|
||||
: range;
|
||||
|
||||
let angleDisplay = '';
|
||||
if (angle != CONFIG.MeasuredTemplate.defaults.angle) {
|
||||
angleDisplay = 'angle:' + angle;
|
||||
|
||||
}
|
||||
let directionDisplay = '';
|
||||
if (direction != 0) {
|
||||
|
|
@ -64,8 +66,9 @@ export const renderMeasuredTemplate = async event => {
|
|||
|
||||
let baseDistance = range;
|
||||
if (Number.isNaN(Number(range))) {
|
||||
baseDistance =
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules).rangeMeasurement[range];
|
||||
baseDistance = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules).rangeMeasurement[
|
||||
range
|
||||
];
|
||||
}
|
||||
const distance = type === CONFIG.DH.GENERAL.templateTypes.EMANATION ? baseDistance + 2.5 : baseDistance;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue