mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-23 19:09:55 +02:00
Batch by item
This commit is contained in:
parent
babd18c9a4
commit
562e67f7bf
1 changed files with 10 additions and 8 deletions
|
|
@ -334,20 +334,22 @@ export async function runMigrations() {
|
||||||
|
|
||||||
const batch = [];
|
const batch = [];
|
||||||
for (const actor of game.actors) {
|
for (const actor of game.actors) {
|
||||||
|
const updates = [];
|
||||||
for (const item of actor.items) {
|
for (const item of actor.items) {
|
||||||
for (const effect of item.effects) {
|
for (const effect of item.effects) {
|
||||||
const changes = handler.updateEffect(effect.toObject(), effect.parent);
|
const changes = handler.updateEffect(effect.toObject(), effect.parent);
|
||||||
if (changes) {
|
if (changes) updates.push(changes);
|
||||||
|
}
|
||||||
|
if (updates.length) {
|
||||||
batch.push({
|
batch.push({
|
||||||
action: 'update',
|
action: 'update',
|
||||||
documentName: 'ActiveEffect',
|
documentName: 'ActiveEffect',
|
||||||
updates: [changes],
|
updates: [updates],
|
||||||
parent: item
|
parent: item
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
await foundry.documents.modifyBatch(batch);
|
await foundry.documents.modifyBatch(batch);
|
||||||
progress.advance({ by: 5 });
|
progress.advance({ by: 5 });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue