Skip to content

Commit da6f131

Browse files
committed
fix(effects): handle DFreds Convenient Effects v4.y.z changes
This removed the handy API method we were using to grab effects data, in favour of a more standard Foundry document method (the effect interface now returns proper `ActiveEffect` documents, so no custom antics are needed).
1 parent 5b66f81 commit da6f131

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

module/js/DataManager.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,14 @@ export class DataManager {
6464
const convEffect = game.dfreds.effectInterface.findEffectByName(eff.convenientEffect);
6565
if (!convEffect) return eff;
6666

67-
const convEffectData = convEffect.convertToActiveEffectData({
68-
includeAte: game.modules.get("ATL")?.active,
69-
includeTokenMagic: game.modules.get("tokenmagic")?.active,
70-
});
67+
const convEffectData = convEffect.convertToActiveEffectData
68+
// DCE < v4.0.0
69+
? convEffect.convertToActiveEffectData({
70+
includeAte: game.modules.get("ATL")?.active,
71+
includeTokenMagic: game.modules.get("tokenmagic")?.active,
72+
})
73+
// DCE >= v4.0.0
74+
: convEffect.toObject(true);
7175

7276
delete eff.convenientEffect;
7377

@@ -80,9 +84,11 @@ export class DataManager {
8084
img: convEffectData.icon,
8185
// endregion
8286
...eff,
87+
8388
// Override CE's built-in IDs, as they are not valid (e.g. `"id": "Convenient Effect: Invisible"`),
8489
// which causes issues when creating temporary actors (e.g. when using Quick Insert to view a
8590
// creature).
91+
// (N.b.: No longer required as of CE v4.0.0)
8692
id: foundry.utils.randomID(),
8793
},
8894
);

0 commit comments

Comments
 (0)