From 14ea993319901286cec1bd9edd50b0f9dba5fb40 Mon Sep 17 00:00:00 2001 From: Peterlankton <61578137+Kapuzenjoe@users.noreply.github.com> Date: Sun, 22 Jun 2025 15:17:46 +0200 Subject: [PATCH 1/7] upgrade presetSelector to DialogV2 --- module.json | 4 +- src/activeLighting.js | 139 ++++++++++++++++++++---------------------- 2 files changed, 69 insertions(+), 74 deletions(-) diff --git a/module.json b/module.json index d6119bb..182e517 100644 --- a/module.json +++ b/module.json @@ -13,8 +13,8 @@ ], "version": "0.6.2", "compatibility": { - "minimum": 11, - "verified": 12 + "minimum": 13, + "verified": 13 }, "esmodules": ["src/activeLighting.js", "src/updateManager.js"], "packs": [ diff --git a/src/activeLighting.js b/src/activeLighting.js index 8c24ab0..1cfc08b 100644 --- a/src/activeLighting.js +++ b/src/activeLighting.js @@ -86,7 +86,7 @@ class ATL { default: "0.2.15", type: String, }); - + } @@ -98,7 +98,7 @@ class ATL { let effects; if (newTransferral) effects = actor.appliedEffects; else if (game.system.id === "wfrp4e") - effects = actor.actorEffects.filter((e) => !e.disabled && !e.isSuppressed); + effects = actor.actorEffects.filter((e) => !e.disabled && !e.isSuppressed); else effects = actor.effects.filter((e) => !e.disabled && !e.isSuppressed); // only return effects that have some ATL changes in them return effects.filter(e => e.changes.some(c => c.key.startsWith("ATL."))); @@ -203,68 +203,63 @@ class ATL { static async UpdatePresets() { let presets = await game.settings.get("ATL", "presets") - let content = `
` - let presetSelector = new Dialog({ - title: "Preset Selector", + let presetSelector = new foundry.applications.api.DialogV2({ + window: { + title: "Preset Selector" + }, content: ` -{{localize "TOKEN.AnchorHint"}}
+{{ localize 'TOKEN.VisionRangeHint' }}
-{{ localize 'TOKEN.VisionAngleHint' }}
-{{ localize 'TOKEN.VisionModeHint' }}
-{{ localize 'LIGHT.RadiusHint' }}
-{{ localize 'LIGHT.ColorHint' }}
-{{ localize "LIGHT.AnimationHint" }}
-{{ localize 'LIGHT.ColorationTechniqueHint' }}
-{{ localize 'LIGHT.LuminosityHint' }}
-{{ localize 'LIGHT.AttenuationHint' }}
-{{ localize 'LIGHT.SaturationHint' }}
-{{ localize 'LIGHT.ContrastHint' }}
-{{ localize 'LIGHT.ShadowsHint' }}
-{{localize "TOKEN.FIELDS.occludable.radius.hint"}}
+{{localize "AMBIENT_LIGHT.LABELS.radiusHint"}}
- - {{formGroup lightFields.angle value=source.light.angle classes="slim" units=(localize "Degrees") rootId=rootId}} - {{formGroup lightFields.color value=source.light.color rootId=rootId}} - {{formGroup lightFields.alpha value=source.light.alpha step=0.05 rootId=rootId}} - {{formGroup lightFields.priority value=source.light.priority rootId=rootId}} - {{formGroup lightFields.negative value=source.light.negative rootId=rootId}} +{{localize "LIGHT.FIELDS.angle.hint"}}
+{{localize "LIGHT.FIELDS.color.hint"}}
+{{ localize 'LIGHT.FIELDS.alpha.hint' }}
+{{localize "LIGHT.FIELDS.priority.hint"}}
+{{localize "LIGHT.FIELDS.negative.hint"}}
+{{localize "LIGHT.FIELDS.animation.speed.hint"}}
+{{localize "LIGHT.FIELDS.animation.intensity.hint"}}
+{{ localize 'LIGHT.FIELDS.coloration.hint' }}
+{{ localize 'LIGHT.FIELDS.luminosity.hint' }}
+{{ localize 'LIGHT.FIELDS.attenuation.hint' }}
+{{ localize 'LIGHT.FIELDS.saturation.hint' }}
+{{ localize 'LIGHT.FIELDS.contrast.hint' }}
+{{ localize 'LIGHT.FIELDS.shadows.hint' }}
+{{localize "TOKEN.FIELDS.sight.range.hint"}}
{{ localize 'TOKEN.FIELDS.sight.angle.hint' }}
+{{ localize 'TOKEN.FIELDS.sight.visionMode.hint' }}
+{{localize "TOKEN.FIELDS.shape.hint"}}
+{{localize "TOKEN.FIELDS.texture.fit.hint"}}
+{{localize "TOKEN.FIELDS.lockRotation.hint"}}
+{{localize "TOKEN.FIELDS.ring.colors.ring.hint"}}
+{{localize "TOKEN.FIELDS.ring.colors.background.hint"}}
+{{localize "TOKEN.FIELDS.ring.subject.texture.hint"}}
+{{localize "TOKEN.FIELDS.ring.subject.scale.hint"}}
+{{ localize 'LIGHT.FIELDS.alpha.hint' }}
From 5baa86e35defeb07c29321abf20b426437d1e712 Mon Sep 17 00:00:00 2001 From: Peterlankton <61578137+Kapuzenjoe@users.noreply.github.com> Date: Fri, 4 Jul 2025 18:04:59 +0200 Subject: [PATCH 6/7] remove new preset naming for DAE compatibility and introduce workaround for changing token names --- src/activeLighting.js | 84 +++++++++++++++++++++--------------------- src/preset-config.js | 8 ++-- templates/header.hbs | 2 +- templates/identity.hbs | 2 +- 4 files changed, 47 insertions(+), 49 deletions(-) diff --git a/src/activeLighting.js b/src/activeLighting.js index 6f627aa..0ddccd2 100644 --- a/src/activeLighting.js +++ b/src/activeLighting.js @@ -8,7 +8,7 @@ class ATL { static init() { let defaultPresets = [ { - label: "torch", + name: "torch", light: { dim: 40, bright: 20, @@ -23,7 +23,7 @@ class ATL { id: "ATLPresetTorch" }, { - label: "lantern", + name: "lantern", light: { dim: 60, bright: 30, @@ -39,7 +39,7 @@ class ATL { }, { - label: "candle", + name: "candle", light: { dim: 10, bright: 2, @@ -55,7 +55,7 @@ class ATL { }, { - label: "flashlight", + name: "flashlight", light: { dim: 60, bright: 30, @@ -91,15 +91,15 @@ class ATL { } static async ready() { - //Update Workaround for change name to label + //Update Workaround let presets = await game.settings.get("ATL", "presets") for (let preset of presets) { - if (!preset.label) { - preset.label = preset.name - delete preset.name + if (!preset.name) { + preset.name = preset.label + delete preset.label } } - + const newTransferral = game.release.generation >= 11 && !CONFIG.ActiveEffect.legacyTransferral; const getEffects = (actor) => { if (!actor) return []; @@ -215,11 +215,11 @@ class ATL { let presetSelector = new foundry.applications.api.DialogV2({ window: { title: "Preset Selector" - }, + }, content: `