mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-22 07:23:37 +02:00
Added Homebrew setting migration
This commit is contained in:
parent
79b34acf09
commit
4809a68ae6
1 changed files with 18 additions and 0 deletions
|
|
@ -183,6 +183,24 @@ export default class DhHomebrew extends foundry.abstract.DataModel {
|
||||||
const initial = this.schema.fields.currency.fields[type].getInitialValue();
|
const initial = this.schema.fields.currency.fields[type].getInitialValue();
|
||||||
source.currency[type] = foundry.utils.mergeObject(initial, source.currency[type], { inplace: false });
|
source.currency[type] = foundry.utils.mergeObject(initial, source.currency[type], { inplace: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Migrate to v14 setup */
|
||||||
|
const migrateEffects = features => {
|
||||||
|
for (const featureKey of Object.keys(features)) {
|
||||||
|
const feature = features[featureKey];
|
||||||
|
for (const effect of feature.effects) {
|
||||||
|
if (effect.changes) effect.system.changes = effect.changes;
|
||||||
|
if (!effect.system.changes) effect.system.changes = [];
|
||||||
|
if (!effect.system.conditionals) effect.system.conditionals = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
migrateEffects(source.restMoves.longRest.moves);
|
||||||
|
migrateEffects(source.restMoves.shortRest.moves);
|
||||||
|
migrateEffects(source.itemFeatures.weaponFeatures);
|
||||||
|
migrateEffects(source.itemFeatures.armorFeatures);
|
||||||
|
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue