forked from public/foundryvtt-reve-de-dragon
Enchantement des gemmes et potions
This commit is contained in:
@ -589,6 +589,42 @@ class _12_0_32_MigrationRaces extends Migration {
|
||||
}
|
||||
}
|
||||
|
||||
class _12_0_37_MigrationAlchimieEtat extends Migration {
|
||||
get code() { return "migration-alchimie-etat" }
|
||||
get version() { return "12.0.37" }
|
||||
|
||||
async migrate() {
|
||||
await this.applyItemsUpdates(items => items
|
||||
.filter(it => [ITEM_TYPES.potion].includes(it.type))
|
||||
.map(it => this.migratePotion(it))
|
||||
)
|
||||
}
|
||||
|
||||
mappingCategorie(categorie) {
|
||||
switch (categorie) {
|
||||
case 'AlchimieEnchante': return 'Alchimie'
|
||||
case 'ReposEnchante': return 'Repos'
|
||||
case 'SoinEnchante': return 'Soin'
|
||||
case 'AutreEnchante': return 'Autre'
|
||||
}
|
||||
return categorie
|
||||
}
|
||||
|
||||
mappingEtat(categorie) {
|
||||
return ['Alchimie', 'Repos', 'Soin', 'Autre'].includes(categorie) ? 'Liquide' : 'Autre'
|
||||
}
|
||||
|
||||
async migratePotion(potion) {
|
||||
const newCategorie = this.mappingCategorie(potion.system.categorie)
|
||||
return {
|
||||
_id: potion.id,
|
||||
'system.etat': this.mappingEtat(potion.system.categorie),
|
||||
'system.magique': potion.system.pr > 0,
|
||||
'system.categorie': newCategorie
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class Migrations {
|
||||
static getMigrations() {
|
||||
return [
|
||||
@ -610,6 +646,7 @@ export class Migrations {
|
||||
new _11_2_20_MigrationAstrologie(),
|
||||
new _12_0_26_MigrationVoieSorts(),
|
||||
new _12_0_32_MigrationRaces(),
|
||||
new _12_0_37_MigrationAlchimieEtat(),
|
||||
];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user