diff --git a/changelog.md b/changelog.md index 01dbabf..971e364 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +## v2.2.1 + +- v12 compatibility. + ## v2.2.0 - Re-added "core.compendiumConfiguration" setting to exports to export Compendium Folder structure mappings. diff --git a/module.json b/module.json index 97d0b3b..46e780a 100644 --- a/module.json +++ b/module.json @@ -23,11 +23,11 @@ "allowBugReporter": true }, "minimumCoreVersion": "0.6.0", - "compatibleCoreVersion": "11", - "version": "2.2.0", + "compatibleCoreVersion": "12", + "version": "2.2.1", "compatibility": { "minimum": "0.6.0", - "verified": "11.306" + "verified": "12" }, "scripts": [], "esmodules": [ diff --git a/scripts/config.js b/scripts/config.js index 2cda1da..a119de3 100644 --- a/scripts/config.js +++ b/scripts/config.js @@ -6,7 +6,7 @@ export const templates = { export function isV10orNewer() { const gameVersion = game.version || game.data.version; - return gameVersion === '10.0' || isNewerVersion(gameVersion, '10'); + return gameVersion === '10.0' || foundry.utils.isNewerVersion(gameVersion, '10'); } export function log(force, ...args) { diff --git a/scripts/core.js b/scripts/core.js index 5293973..a7fdb40 100755 --- a/scripts/core.js +++ b/scripts/core.js @@ -93,7 +93,7 @@ export default class Core extends FormApplication { } static get defaultOptions() { - return mergeObject(super.defaultOptions, { + return foundry.utils.mergeObject(super.defaultOptions, { classes: ['copy-environment-settings'], height: 'auto', width: Math.ceil(window.innerWidth / 2), @@ -307,7 +307,7 @@ export default class Core extends FormApplication { return false; } - if (Object.keys(changes).length === 1 && (typeof isEmpty === 'function' ? isEmpty(changes.flags) : isObjectEmpty(changes.flags))) { + if (Object.keys(changes).length === 1 && (typeof foundry.utils.isEmpty === 'function' ? foundry.utils.isEmpty(changes.flags) : foundry.utils.isObjectEmpty(changes.flags))) { log(true, 'No changes selected for', targetUser?.name); return false; } @@ -447,7 +447,7 @@ export default class Core extends FormApplication { const value = game.settings.get(v.namespace, v.key); let sameValue = value === v.default; if (value && typeof value === 'object' && v.default && typeof v.default === 'object') { - sameValue = !Object.keys(diffObject(v.default, value)).length && !Object.keys(diffObject(value, v.default)).length; + sameValue = !Object.keys(foundry.utils.diffObject(v.default, value)).length && !Object.keys(foundry.utils.diffObject(value, v.default)).length; } return !sameValue && !excludeModules.some((e) => v.namespace === e); } catch (e) { @@ -526,7 +526,7 @@ export default class Core extends FormApplication { } async processSettings(settings) { - if (isNewerVersion((game.version || game.data.version), '0.7.9')) { + if (foundry.utils.isNewerVersion((game.version || game.data.version), '0.7.9')) { const updates = []; const creates = []; for (const data of settings) { @@ -593,6 +593,11 @@ export default class Core extends FormApplication { type: 'Setting', action: 'update', updates: updates, + operation: { + pack: null, + parent: null, + updates: updates, + } }); } if (creates.length) { @@ -601,6 +606,11 @@ export default class Core extends FormApplication { type: 'Setting', action: 'create', data: creates, + operation: { + pack: null, + parent: null, + data: creates, + } }); } return true; diff --git a/scripts/setting.js b/scripts/setting.js index 5b3a58e..283d293 100755 --- a/scripts/setting.js +++ b/scripts/setting.js @@ -95,8 +95,8 @@ export class WorldSetting { newValue = JSON.parse(newValue); } if (typeof existingSetting === 'object' && typeof newValue === 'object') { - let diff = diffObject(existingSetting, newValue); - if (typeof isEmpty === 'function' ? isEmpty(diff) : isObjectEmpty(diff)) { + let diff = foundry.utils.diffObject(existingSetting, newValue); + if (typeof foundry.utils.isEmpty === 'function' ? foundry.utils.isEmpty(diff) : foundry.utils.isObjectEmpty(diff)) { // No difference in the underlying object. return new Difference(this.key, null, null); } @@ -167,7 +167,7 @@ export class PlayerSetting { ); } - let flagDiff = diffObject(userData.flags, setting.flags); + let flagDiff = foundry.utils.diffObject(userData.flags, setting.flags); for (const prop in flagDiff) { if (!flagDiff.hasOwnProperty(prop)) { continue; @@ -198,13 +198,13 @@ export class PlayerSetting { * @returns boolean */ hasDataChanges() { - if (typeof isEmpty === 'function') { - return !isEmpty(this.playerDifferences) || !isEmpty(this.playerFlagDifferences); + if (typeof foundry.utils.isEmpty === 'function') { + return !foundry.utils.isEmpty(this.playerDifferences) || !foundry.utils.isEmpty(this.playerFlagDifferences); } return ( - !isObjectEmpty(this.playerDifferences) || - !isObjectEmpty(this.playerFlagDifferences) + !foundry.utils.isObjectEmpty(this.playerDifferences) || + !foundry.utils.isObjectEmpty(this.playerFlagDifferences) ); } }