Cleanup Promise.all pour multi async
This commit is contained in:
parent
19dd3b540c
commit
042f5d0f69
@ -347,7 +347,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
const timestamp = game.system.rdd.calendrier.getTimestamp()
|
||||
const blessures = this.filterItems(it => it.system.gravite > 0, TYPES.blessure).sort(Misc.ascending(it => it.system.gravite))
|
||||
|
||||
await Promise.all(blessures.map(b => b.recuperationBlessure({
|
||||
await Promise.all(blessures.map(async b => b.recuperationBlessure({
|
||||
actor: this,
|
||||
timestamp,
|
||||
message,
|
||||
|
@ -71,17 +71,17 @@ class _10_0_16_MigrationSortsReserve extends Migration {
|
||||
get version() { return "10.0.16"; }
|
||||
|
||||
async migrate() {
|
||||
await game.actors
|
||||
.filter((actor) => actor.type == "personnage")
|
||||
.filter((actor) => actor.system.reve?.reserve?.list?.length ?? 0 > 0)
|
||||
.forEach(async (actor) => {
|
||||
const sortsReserve = actor.system.reve.reserve.list.map(this.conversionSortReserve);
|
||||
console.log(`${LOG_HEAD} Migration des sorts en réserve de ${actor.name}`, sortsReserve);
|
||||
await actor.createEmbeddedDocuments("Item", sortsReserve, {
|
||||
renderSheet: false,
|
||||
});
|
||||
await actor.update({ 'system.reve.reserve': undefined })
|
||||
});
|
||||
const actors = game.actors.filter((actor) => actor.type == "personnage" && (actor.system.reve?.reserve?.list?.length ?? 0 > 0))
|
||||
Promise.all(actors.map(async it => await this.convertirSortsReserveActeur(it)))
|
||||
}
|
||||
|
||||
async convertirSortsReserveActeur(actor) {
|
||||
const sortsReserve = actor.system.reve.reserve.list.map(this.conversionSortReserve);
|
||||
console.log(`${LOG_HEAD} Migration des sorts en réserve de ${actor.name}`, sortsReserve);
|
||||
await actor.createEmbeddedDocuments("Item", sortsReserve, {
|
||||
renderSheet: false,
|
||||
});
|
||||
await actor.update({ 'system.reve.reserve': undefined });
|
||||
}
|
||||
|
||||
conversionSortReserve(it) {
|
||||
@ -508,7 +508,8 @@ class _10_7_19_PossessionsEntiteVictime extends Migration {
|
||||
}
|
||||
|
||||
migratePossession(it) {
|
||||
return { _id: it.id,
|
||||
return {
|
||||
_id: it.id,
|
||||
'system.entite.actorid': it.system.possesseurid,
|
||||
'system.victime.actorid': it.system.possedeid
|
||||
}
|
||||
@ -573,7 +574,7 @@ export class Migrations {
|
||||
migrations.sort((a, b) => this.compareVersions(a, b));
|
||||
migrations.forEach(async (m) => {
|
||||
ui.notifications.info(
|
||||
`Executing migration ${m.code}: version ${currentVersion} is lower than ${m.version}`
|
||||
`${LOG_HEAD} Executing migration ${m.code}: version ${currentVersion} is lower than ${m.version}`
|
||||
);
|
||||
await m.migrate();
|
||||
});
|
||||
@ -581,9 +582,7 @@ export class Migrations {
|
||||
`Migrations done, version will change to ${game.system.version}`
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
LOG_HEAD +
|
||||
`No migration needeed, version will change to ${game.system.version}`
|
||||
console.log(`${LOG_HEAD} No migration needeed, version will change to ${game.system.version}`
|
||||
);
|
||||
}
|
||||
|
||||
@ -593,7 +592,7 @@ export class Migrations {
|
||||
game.system.version
|
||||
);
|
||||
} else {
|
||||
console.log(LOG_HEAD + `No system version changed`);
|
||||
console.log(`${LOG_HEAD} No system version changed`);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user