From 58f039ce969d5b2c63919b3ff5dca16d785b6c83 Mon Sep 17 00:00:00 2001 From: Chris Ryan <73275196+chrisryan10@users.noreply.github.com> Date: Sun, 7 Sep 2025 09:27:46 +1000 Subject: [PATCH 1/5] Add extra features to the Temple Enricher and fix the mousewheel issues with the Template Manager (#1147) Co-authored-by: Chris Ryan --- module/documents/templateManager.mjs | 16 ++++--- module/enrichers/TemplateEnricher.mjs | 65 +++++++++++++++++++++------ 2 files changed, 63 insertions(+), 18 deletions(-) diff --git a/module/documents/templateManager.mjs b/module/documents/templateManager.mjs index c31b1baa..cf15c2e3 100644 --- a/module/documents/templateManager.mjs +++ b/module/documents/templateManager.mjs @@ -57,7 +57,10 @@ export default class DhTemplateManager { * @param {wheel Event} event */ #onMouseWheel(event) { - if (!event.shiftKey) return; + if (!this.#activePreview) { + return; + } + if (!event.shiftKey && !event.ctrlKey) return; event.stopPropagation(); event.preventDefault(); const { moveTime, object } = this.#activePreview; @@ -66,8 +69,10 @@ export default class DhTemplateManager { if (now - (moveTime || 0) <= 16) return; this.#activePreview.moveTime = now; + const multiplier = event.shiftKey ? 0.2 : 0.1; + object.document.updateSource({ - direction: object.document.direction + event.deltaY * 0.2 + direction: object.document.direction + event.deltaY * multiplier }); object.renderFlags.set({ refresh: true }); } @@ -77,12 +82,13 @@ export default class DhTemplateManager { * @param {contextmenu Event} event */ #cancelTemplate(event) { - const { mousemove, mousedown, contextmenu } = this.#activePreview.events; + const { mousemove, mousedown, contextmenu, wheel } = this.#activePreview.events; canvas.templates._onDragLeftCancel(event); canvas.stage.off('mousemove', mousemove); canvas.stage.off('mousedown', mousedown); canvas.app.view.removeEventListener('contextmenu', contextmenu); + canvas.app.view.removeEventListener('wheel', wheel); } /** @@ -91,9 +97,9 @@ export default class DhTemplateManager { */ #confirmTemplate(event) { event.stopPropagation(); + this.#cancelTemplate(event); canvas.scene.createEmbeddedDocuments('MeasuredTemplate', [this.#activePreview.document.toObject()]); - - this.#cancelTemplate(event); + this.#activePreview = undefined; } } diff --git a/module/enrichers/TemplateEnricher.mjs b/module/enrichers/TemplateEnricher.mjs index 35a3e231..15936b29 100644 --- a/module/enrichers/TemplateEnricher.mjs +++ b/module/enrichers/TemplateEnricher.mjs @@ -3,6 +3,8 @@ export default function DhTemplateEnricher(match, _options) { let type = null, range = null, + angle = CONFIG.MeasuredTemplate.defaults.angle, + direction = 0, inline = false; parts.forEach(part => { @@ -16,14 +18,24 @@ export default function DhTemplateEnricher(match, _options) { type = matchedType; break; case 'range': - const matchedRange = Object.values(CONFIG.DH.GENERAL.templateRanges).find( - x => x.id.toLowerCase() === split[1] || x.short === split[1] - ); - range = matchedRange?.id; + if (Number.isNaN(Number(split[1]))) { + const matchedRange = Object.values(CONFIG.DH.GENERAL.templateRanges).find( + x => x.id.toLowerCase() === split[1] || x.short === split[1] + ); + range = matchedRange?.id; + } else { + range = split[1]; + } break; case 'inline': inline = true; break; + case 'angle': + angle = split[1]; + break; + case 'direction': + direction = split[1]; + break; } } }); @@ -32,10 +44,32 @@ export default function DhTemplateEnricher(match, _options) { const label = game.i18n.localize(`DAGGERHEART.CONFIG.TemplateTypes.${type}`); + 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) { + directionDisplay = 'direction:' + direction; + } + + let extraDisplay = ''; + if (angleDisplay != '' && directionDisplay != '') { + extraDisplay = ' (' + angleDisplay + '|' + directionDisplay + ')'; + } else if (angleDisplay != '') { + extraDisplay = ' (' + angleDisplay + ')'; + } else if (directionDisplay != '') { + extraDisplay = ' (' + directionDisplay + ')'; + } + const templateElement = document.createElement('span'); templateElement.innerHTML = ` - `; @@ -45,21 +79,25 @@ export default function DhTemplateEnricher(match, _options) { export const renderMeasuredTemplate = async event => { const button = event.currentTarget, type = button.dataset.type, - range = button.dataset.range; + range = button.dataset.range, + angle = button.dataset.angle, + direction = button.dataset.direction; if (!type || !range || !game.canvas.scene) return; const usedType = type === 'inFront' ? 'cone' : type === 'emanation' ? 'circle' : type; - const angle = + const usedAngle = type === CONST.MEASURED_TEMPLATE_TYPES.CONE - ? CONFIG.MeasuredTemplate.defaults.angle + ? (angle ?? CONFIG.MeasuredTemplate.defaults.angle) : type === CONFIG.DH.GENERAL.templateTypes.INFRONT ? '180' : undefined; - const baseDistance = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.variantRules).rangeMeasurement[ - range - ]; + let baseDistance = range; + if (Number.isNaN(Number(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; const { width, height } = game.canvas.scene.dimensions; @@ -69,7 +107,8 @@ export const renderMeasuredTemplate = async event => { t: usedType, distance: distance, width: type === CONST.MEASURED_TEMPLATE_TYPES.RAY ? 5 : undefined, - angle: angle + angle: usedAngle, + direction: direction }; CONFIG.ux.TemplateManager.createPreview(data); From a57d154d45cba43775025896f6beb656845cb7d3 Mon Sep 17 00:00:00 2001 From: Carlos Fernandez Date: Tue, 9 Sep 2025 22:03:13 -0400 Subject: [PATCH 2/5] Add space between paragraphs (#1172) --- styles/less/global/elements.less | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/styles/less/global/elements.less b/styles/less/global/elements.less index 65e825a9..5d6e97d1 100755 --- a/styles/less/global/elements.less +++ b/styles/less/global/elements.less @@ -210,7 +210,13 @@ } p { - margin: 0; + &:first-child { + margin-top: 0; + } + + &:last-child { + margin-bottom: 0; + } } ul { From a477c9b8528eed10a085cf56b288933be0838b3d Mon Sep 17 00:00:00 2001 From: Chris Ryan <73275196+chrisryan10@users.noreply.github.com> Date: Fri, 19 Sep 2025 06:25:08 +1000 Subject: [PATCH 3/5] Fixed a merge? error in the itemBrowserConfig (#1174) Co-authored-by: Chris Ryan --- module/config/itemBrowserConfig.mjs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/module/config/itemBrowserConfig.mjs b/module/config/itemBrowserConfig.mjs index e870172f..2c3e1dfb 100644 --- a/module/config/itemBrowserConfig.mjs +++ b/module/config/itemBrowserConfig.mjs @@ -370,19 +370,6 @@ export const typeConfig = { label: 'DAGGERHEART.ITEMS.Subclass.spellcastingTrait' } ], - filters: [] - }, - beastforms: { - columns: [ - { - key: 'system.tier', - label: 'DAGGERHEART.GENERAL.Tiers.singular' - }, - { - key: 'system.mainTrait', - label: 'DAGGERHEART.GENERAL.Trait.single' - } - ], filters: [ { key: 'system.linkedClass.uuid', From 55586c93c837662124ebc95b8d4193215a9c0b1d Mon Sep 17 00:00:00 2001 From: Chris Ryan <73275196+chrisryan10@users.noreply.github.com> Date: Fri, 19 Sep 2025 06:27:04 +1000 Subject: [PATCH 4/5] Move Foundryborne menu location; fix localisation; fix deprecation (#1169) Co-authored-by: Chris Ryan --- lang/en.json | 1 + module/applications/sidebar/sidebar.mjs | 43 ++++++++++++++++++++- templates/sidebar/daggerheart-menu/main.hbs | 4 +- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/lang/en.json b/lang/en.json index 685f1266..e40b035c 100755 --- a/lang/en.json +++ b/lang/en.json @@ -2029,6 +2029,7 @@ "range": "Range", "reactionRoll": "Reaction Roll", "recovery": "Recovery", + "refresh": "Refresh", "reroll": "Reroll", "rerollThing": "Reroll {thing}", "resource": "Resource", diff --git a/module/applications/sidebar/sidebar.mjs b/module/applications/sidebar/sidebar.mjs index fad39ac5..ae28d56c 100644 --- a/module/applications/sidebar/sidebar.mjs +++ b/module/applications/sidebar/sidebar.mjs @@ -1,10 +1,49 @@ -export default class DhSidebar extends Sidebar { +export default class DhSidebar extends foundry.applications.sidebar.Sidebar { /** @override */ static TABS = { - ...super.TABS, + chat: { + documentName: 'ChatMessage' + }, + combat: { + documentName: 'Combat' + }, + scenes: { + documentName: 'Scene', + gmOnly: true + }, + actors: { + documentName: 'Actor' + }, + items: { + documentName: 'Item' + }, + journal: { + documentName: 'JournalEntry', + tooltip: 'SIDEBAR.TabJournal' + }, + tables: { + documentName: 'RollTable' + }, + cards: { + documentName: 'Cards' + }, + macros: { + documentName: 'Macro' + }, + playlists: { + documentName: 'Playlist' + }, + compendium: { + tooltip: 'SIDEBAR.TabCompendium', + icon: 'fa-solid fa-book-atlas' + }, daggerheartMenu: { tooltip: 'DAGGERHEART.UI.Sidebar.daggerheartMenu.title', img: 'systems/daggerheart/assets/logos/FoundryBorneLogoWhite.svg' + }, + settings: { + tooltip: 'SIDEBAR.TabSettings', + icon: 'fa-solid fa-gears' } }; diff --git a/templates/sidebar/daggerheart-menu/main.hbs b/templates/sidebar/daggerheart-menu/main.hbs index 6f31f165..b00001eb 100644 --- a/templates/sidebar/daggerheart-menu/main.hbs +++ b/templates/sidebar/daggerheart-menu/main.hbs @@ -16,7 +16,7 @@ {{/each}} - + - \ No newline at end of file + From f1b5c80a53c124845d3ee8a5d3e8c6a7ea45f414 Mon Sep 17 00:00:00 2001 From: Chris Ryan <73275196+chrisryan10@users.noreply.github.com> Date: Fri, 19 Sep 2025 06:28:25 +1000 Subject: [PATCH 5/5] Null check metadata (#1145) * Null check metadata * Fix d20RollDialog action find --------- Co-authored-by: Chris Ryan Co-authored-by: Dapoolp --- module/applications/dialogs/d20RollDialog.mjs | 2 +- module/data/fields/action/costField.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/applications/dialogs/d20RollDialog.mjs b/module/applications/dialogs/d20RollDialog.mjs index 6c227152..c57dda12 100644 --- a/module/applications/dialogs/d20RollDialog.mjs +++ b/module/applications/dialogs/d20RollDialog.mjs @@ -16,7 +16,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio this.action = config.data.attack?._id == config.source.action ? config.data.attack - : this.item.system.actions.get(config.source.action); + : this.item.system.actionsList?.find(a => a.id === config.source.action); } } diff --git a/module/data/fields/action/costField.mjs b/module/data/fields/action/costField.mjs index 2d2a38df..656edee3 100644 --- a/module/data/fields/action/costField.mjs +++ b/module/data/fields/action/costField.mjs @@ -103,7 +103,7 @@ export default class CostField extends fields.ArrayField { static calcCosts(costs) { const resources = CostField.getResources.call(this, costs); let filteredCosts = costs; - if (this.parent.metadata.isQuantifiable && this.parent.consumeOnUse === false) { + if (this.parent?.metadata.isQuantifiable && this.parent.consumeOnUse === false) { filteredCosts = filteredCosts.filter(c => c.key !== 'quantity'); }