-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
102 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { recurselist } from './utilities.js' | ||
import * as Settings from './miscellaneous-settings.js' | ||
|
||
|
||
export class Migration { | ||
|
||
static async migrateTo096() { | ||
ui.notifications.info("Please wait, migrating Actors to v0.9.6") | ||
console.log("Migrating Actors to v0.9.6") | ||
for ( let actor of game.actors.entities ) { | ||
let commit = { "data.migrationversion" : '0.9.6' } | ||
for (const attr in actor.data.data.attributes) { | ||
if (actor.data.data.attributes[attr].import == null) | ||
commit = { ...commit, ...{ ['data.attributes.' + attr + '.import']: actor.data.data.attributes[attr].value } } | ||
} | ||
recurselist(actor.data.data.skills, (e, k, d) => { | ||
if (e.import == null) commit = { ...commit, ...{ ['data.skills.' + k + '.import']: e.level || 1 } } | ||
}) | ||
recurselist(actor.data.data.spells, (e, k, d) => { | ||
if (e.import == null) commit = { ...commit, ...{ ['data.spells.' + k + '.import']: e.level | 1 } } | ||
}) | ||
recurselist(actor.data.data.melee, (e, k, d) => { | ||
if (e.import == null) commit = { ...commit, ...{ ['data.melee.' + k + '.import']: e.level | 1 } } | ||
}) | ||
recurselist(actor.data.data.ranged, (e, k, d) => { | ||
if (e.import == null) commit = { ...commit, ...{ ['data.ranged.' + k + '.import']: e.level | 1} } | ||
}) | ||
// We must delay the upgrade of older actor's 'import' keys, since upon startup, the actor may not know which collection it belongs to | ||
if (Object.keys(commit).length > 0) { | ||
console.log("Updating " + actor.name) | ||
console.log(GURPS.objToString(commit)) | ||
await actor.update(commit) | ||
} | ||
} | ||
ui.notifications.info("Migration to v0.9.6 complete!") | ||
game.settings.set(Settings.SYSTEM_NAME, Settings.SETTING_MIGRATION_VERSION, '0.9.6') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters