Skip to content

Commit

Permalink
v2.2.1
Browse files Browse the repository at this point in the history
- v12 compatibility
  • Loading branch information
sneat authored Jul 4, 2024
2 parents cfeeeb1 + 525a7bd commit f4f26b0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion scripts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
18 changes: 14 additions & 4 deletions scripts/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions scripts/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
);
}
}
Expand Down

0 comments on commit f4f26b0

Please sign in to comment.