Skip to content

Commit

Permalink
v2.7.12
Browse files Browse the repository at this point in the history
- Marked compatibility with Foundry VTT version 12.
  - The only changes were relating to deprecated methods that are currently in compatibility mode.
  - There will continue to be a few deprecation warnings in the console due to supporting old versions of Foundry VTT.
- Moulinette Exporter changes:
  - Fixes the functionality added in v2.7.7 to actually remember the previously entered URL and Journal.
  • Loading branch information
sneat authored May 30, 2024
1 parent 6331510 commit 109d8ca
Show file tree
Hide file tree
Showing 25 changed files with 208 additions and 158 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## v2.7.12
- Marked compatibility with Foundry VTT version 12.
- The only changes were relating to deprecated methods that are currently in compatibility mode.
- There will continue to be a few deprecation warnings in the console due to supporting old versions of Foundry VTT.
- Moulinette Exporter changes:
- Fixes the functionality added in v2.7.7 to actually remember the previously entered URL and Journal.

## v2.7.11

- Fixed actor prototypeToken image not being referenced.
Expand Down
27 changes: 20 additions & 7 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"name": "scene-packer",
"title": "Library: Scene Packer",
"description": "A module to assist with Scene and Adventure packing and unpacking.",
"version": "2.7.11",
"version": "2.7.12",
"library": "true",
"manifestPlusVersion": "1.2.0",
"minimumCoreVersion": "0.8.6",
"compatibleCoreVersion": "11",
"compatibleCoreVersion": "12",
"compatibility": {
"minimum": "0.8.6",
"verified": "11"
"verified": "12"
},
"author": "Blair McMillan",
"authors": [
Expand Down Expand Up @@ -41,6 +41,11 @@
"url": "https://www.youtube.com/watch?v=XZjuE1j_7GQ",
"thumbnail": "https://img.youtube.com/vi/XZjuE1j_7GQ/0.jpg",
"caption": "Scene Packer and Moulinette Integration"
},
{
"type": "setup",
"url": "modules/scene-packer/assets/cover.png",
"thumbnail": "modules/scene-packer/assets/cover.png"
}
],
"packs": [
Expand All @@ -49,16 +54,24 @@
"label": "Library: Scene Packer",
"path": "/packs/journals.db",
"entity": "JournalEntry",
"type": "JournalEntry",
"private": false
"type": "JournalEntry"
},
{
"name": "macros",
"label": "Library: Scene Packer",
"path": "/packs/macros.db",
"entity": "Macro",
"type": "Macro",
"private": false
"type": "Macro"
}
],
"packFolders": [
{
"name": "Scene Packer",
"sorting": "a",
"packs": [
"journals",
"macros"
]
}
],
"esmodules": [
Expand Down
4 changes: 2 additions & 2 deletions packs/macros.db

Large diffs are not rendered by default.

40 changes: 22 additions & 18 deletions scripts/adventure-converter/adventure-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class AdventureConverter extends FormApplication {
super(document, options);

const gameVersion = game.version || game.data.version;
if (gameVersion !== '10.0' && !isNewerVersion(gameVersion, '10')) {
if (gameVersion !== '10.0' && !foundry.utils.isNewerVersion(gameVersion, '10')) {
throw new Error('Adventure Converter for Scene Packer only works with Foundry VTT v10 or newer.');
}
}
Expand Down Expand Up @@ -54,7 +54,7 @@ export default class AdventureConverter extends FormApplication {
`@UUID[${this.object.welcomeJournal.uuid}]{${this.object.welcomeJournal.name}}` :
'';

return mergeObject(super.getData(options),
return foundry.utils.mergeObject(super.getData(options),
{
instances,
hasInstances,
Expand Down Expand Up @@ -116,7 +116,7 @@ export default class AdventureConverter extends FormApplication {
data.description = game.modules.get(data.adventureModule)?.description;
}

mergeObject(this.object, data);
foundry.utils.mergeObject(this.object, data);

if (event.type === 'submit') {
const sourcePacks = Array.from(game.modules.get(this.object.adventureModule)
Expand Down Expand Up @@ -580,19 +580,23 @@ export default class AdventureConverter extends FormApplication {
continue;
}

let content = ResolvePath(path, documentData);
const rsp = await replaceContent(content, needsUpdate);
if (rsp.replaced) {
content = rsp.content;
replaced = true;
needsUpdate = true;
}
try {
let content = ResolvePath(path, documentData);
const rsp = await replaceContent(content, needsUpdate);
if (rsp.replaced) {
content = rsp.content;
replaced = true;
needsUpdate = true;
}

if (needsUpdate) {
console.log(`Updating ${document.collection.documentName} "${document.name}" ${path}`);
document.updateSource({
[path]: content,
});
if (needsUpdate) {
console.log(`Updating ${document.collection.documentName} "${document.name}" ${path}`);
document.updateSource({
[path]: content,
});
}
} catch (e) {
// Ignore errors, just continue to the next path.
}
}

Expand Down Expand Up @@ -778,13 +782,13 @@ export default class AdventureConverter extends FormApplication {

const manifest = Module.migrateData(module);

if (manifest.compatibility?.minimum && !isNewerVersion(manifest.compatibility.minimum, 10)) {
if (manifest.compatibility?.minimum && !foundry.utils.isNewerVersion(manifest.compatibility.minimum, 10)) {
manifest.updateSource({ 'compatibility.minimum': 10 });
}
if (manifest.compatibility?.verified && !isNewerVersion(manifest.compatibility.verified, 10)) {
if (manifest.compatibility?.verified && !foundry.utils.isNewerVersion(manifest.compatibility.verified, 10)) {
manifest.updateSource({ 'compatibility.verified': 10 });
}
if (manifest.compatibility?.maximum && !isNewerVersion(manifest.compatibility.maximum, 10)) {
if (manifest.compatibility?.maximum && !foundry.utils.isNewerVersion(manifest.compatibility.maximum, 10)) {
manifest.updateSource({ 'compatibility.maximum': 10 });
}

Expand Down
6 changes: 3 additions & 3 deletions scripts/asset-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export default class AssetReport extends FormApplication {

/** @inheritdoc */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
title: game.i18n.localize('SCENE-PACKER.asset-report.name'),
id: 'asset-report',
template: 'modules/scene-packer/templates/asset-report/report.html',
Expand Down Expand Up @@ -766,15 +766,15 @@ export default class AssetReport extends FormApplication {
this.CheckAsset(scene.id, AssetReport.Sources.Scene, img, AssetReport.Locations.SceneTileImage);
}

const activeTileActions = getProperty(tile, 'flags.monks-active-tiles.actions') || [];
const activeTileActions = foundry.utils.getProperty(tile, 'flags.monks-active-tiles.actions') || [];
for (const action of activeTileActions) {
const audioFile = action.data?.audiofile;
if (audioFile) {
this.CheckAsset(scene.id, AssetReport.Sources.Scene, audioFile, AssetReport.Locations.SceneTileActiveSound);
}
}

const activeTileImages = getProperty(tile, 'flags.monks-active-tiles.files') || [];
const activeTileImages = foundry.utils.getProperty(tile, 'flags.monks-active-tiles.files') || [];
for (const image of activeTileImages) {
const imagePath = image.name;
if (imagePath) {
Expand Down
6 changes: 3 additions & 3 deletions scripts/asset-report/module-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class ModuleSelect extends FormApplication {

/** @inheritdoc */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
title: `${game.i18n.localize('SCENE-PACKER.asset-report.name')} - ${game.i18n.localize('SCENE-PACKER.asset-report.module-select.title')}`,
id: 'asset-report-module-select',
template: 'modules/scene-packer/templates/asset-report/module-select.html',
Expand Down Expand Up @@ -184,7 +184,7 @@ export default class ModuleSelect extends FormApplication {

/** @inheritdoc */
_onSearchFilter(event, query, rgx, html) {
if (isNewerVersion('0.8.1', CONSTANTS.Version())) {
if (foundry.utils.isNewerVersion('0.8.1', CONSTANTS.Version())) {
// rgx and SearchFilter were added in 0.8.1, previously the arguments were
// event, query, html
html = rgx;
Expand All @@ -199,7 +199,7 @@ export default class ModuleSelect extends FormApplication {
const title = (li.querySelector('.package-title')?.textContent || '').trim();
const author = (li.querySelector('.author')?.textContent || '').trim();
let match = false;
if (!isNewerVersion('0.8.1', CONSTANTS.Version())) {
if (!foundry.utils.isNewerVersion('0.8.1', CONSTANTS.Version())) {
match = rgx.test(SearchFilter.cleanQuery(name)) ||
rgx.test(SearchFilter.cleanQuery(title)) ||
rgx.test(SearchFilter.cleanQuery(author));
Expand Down
6 changes: 3 additions & 3 deletions scripts/assets/journal.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export async function ExtractQuickEncounterAssets(journal) {
let quickEncounter = {};
const path = 'flags.quick-encounters.quickEncounter';
const journalData = CONSTANTS.IsV10orNewer() ? journal : journal.data;
const quickEncounterData = getProperty(journalData, path);
const quickEncounterData = foundry.utils.getProperty(journalData, path);
if (!quickEncounterData) {
return data;
}
Expand Down Expand Up @@ -155,7 +155,7 @@ export async function ExtractQuickEncounterAssets(journal) {
const actor = game.actors.find((a) => {
return (
(a.getFlag(CONSTANTS.MODULE_NAME, 'sourceId') === extractedActor.actorID ||
a.getFlag('core', 'sourceId') === extractedActor.actorID ||
(a._stats?.compendiumSource ?? a.getFlag('core', 'sourceId')) === extractedActor.actorID ||
a.id === extractedActor.actorID) &&
!a.getFlag(CONSTANTS.MODULE_NAME, 'deprecated')
);
Expand Down Expand Up @@ -214,7 +214,7 @@ export async function ExtractMonksEnhancedJournalAssets(journal) {
}

const journalData = CONSTANTS.IsV10orNewer() ? journal : journal.data;
const enhancedJournalData = getProperty(journalData, 'flags.monks-enhanced-journal');
const enhancedJournalData = foundry.utils.getProperty(journalData, 'flags.monks-enhanced-journal');
if (!enhancedJournalData) {
return data;
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/assets/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export async function ExtractSceneAssets(scene) {
});
}

const activeTileActions = getProperty(tileData, 'flags.monks-active-tiles.actions') || [];
const activeTileActions = foundry.utils.getProperty(tileData, 'flags.monks-active-tiles.actions') || [];
for (const action of activeTileActions) {
const audioFile = action.data?.audiofile;
if (audioFile) {
Expand All @@ -148,7 +148,7 @@ export async function ExtractSceneAssets(scene) {
}
}

const activeTileImages = getProperty(tileData, 'flags.monks-active-tiles.files') || [];
const activeTileImages = foundry.utils.getProperty(tileData, 'flags.monks-active-tiles.files') || [];
for (const image of activeTileImages) {
const imagePath = image.name;
if (imagePath) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/assets/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class ConvertAssetsToLowercase extends Application {

/** @inheritdoc */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
title: game.i18n.localize('SCENE-PACKER.assets-to-lowercase.title'),
id: 'scene-packer-assets-to-lowercase',
template: 'modules/scene-packer/templates/assets-to-lowercase.hbs',
Expand Down
29 changes: 19 additions & 10 deletions scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export const CONSTANTS = Object.freeze({
* @return {boolean}
*/
IsV7orNewer(version = this.Version()) {
return version === '0.7.0' || isNewerVersion(version, '0.7.0');
return version === '0.7.0' || foundry.utils.isNewerVersion(version, '0.7.0');
},

/**
Expand All @@ -246,7 +246,7 @@ export const CONSTANTS = Object.freeze({
* @return {boolean}
*/
IsV7(version = this.Version()) {
return this.IsV7orNewer(version) && isNewerVersion('0.8.0', version);
return this.IsV7orNewer(version) && foundry.utils.isNewerVersion('0.8.0', version);
},

/**
Expand All @@ -255,7 +255,7 @@ export const CONSTANTS = Object.freeze({
* @return {boolean}
*/
IsV8orNewer(version = this.Version()) {
return version === '0.8.0' || isNewerVersion(version, '0.8.0');
return version === '0.8.0' || foundry.utils.isNewerVersion(version, '0.8.0');
},

/**
Expand All @@ -264,7 +264,7 @@ export const CONSTANTS = Object.freeze({
* @return {boolean}
*/
IsV8(version = this.Version()) {
return this.IsV8orNewer(version) && isNewerVersion('9', version);
return this.IsV8orNewer(version) && foundry.utils.isNewerVersion('9', version);
},

/**
Expand All @@ -273,7 +273,7 @@ export const CONSTANTS = Object.freeze({
* @return {boolean}
*/
IsV9orNewer(version = this.Version()) {
return version === '9.0' || isNewerVersion(version, '9');
return version === '9.0' || foundry.utils.isNewerVersion(version, '9');
},

/**
Expand All @@ -282,7 +282,7 @@ export const CONSTANTS = Object.freeze({
* @return {boolean}
*/
IsV9(version = this.Version()) {
return this.IsV9orNewer(version) && isNewerVersion('10', version);
return this.IsV9orNewer(version) && foundry.utils.isNewerVersion('10', version);
},

/**
Expand All @@ -291,7 +291,7 @@ export const CONSTANTS = Object.freeze({
* @return {boolean}
*/
IsV10orNewer(version = this.Version()) {
return version === '10.0' || isNewerVersion(version, '10');
return version === '10.0' || foundry.utils.isNewerVersion(version, '10');
},

/**
Expand All @@ -300,7 +300,7 @@ export const CONSTANTS = Object.freeze({
* @return {boolean}
*/
IsV10(version = this.Version()) {
return this.IsV10orNewer(version) && isNewerVersion('11', version);
return this.IsV10orNewer(version) && foundry.utils.isNewerVersion('11', version);
},

/**
Expand All @@ -309,7 +309,7 @@ export const CONSTANTS = Object.freeze({
* @return {boolean}
*/
IsV11orNewer(version = this.Version()) {
return version === '11.0' || isNewerVersion(version, '11');
return version === '11.0' || foundry.utils.isNewerVersion(version, '11');
},

/**
Expand All @@ -318,7 +318,16 @@ export const CONSTANTS = Object.freeze({
* @return {boolean}
*/
IsV11(version = this.Version()) {
return this.IsV11orNewer(version) && isNewerVersion('11', version);
return this.IsV11orNewer(version) && foundry.utils.isNewerVersion('11', version);
},

/**
* Returns whether the version is at least V12
* @param {string} version - The version to test. Defaults to the current game instance version.
* @return {boolean}
*/
IsV12orNewer(version = this.Version()) {
return version === '12.0' || foundry.utils.isNewerVersion(version, '12');
},
});

Expand Down
4 changes: 2 additions & 2 deletions scripts/export-import/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export function ReplaceCompendiumReferences(context, documents, availableDocumen
let foundEntity;
for (const sourceType of sources) {
for (const source of sourceType.data) {
foundEntity = source.find(e => (getProperty(e, 'data.flags.core.sourceId') || getProperty(e, 'flags.core.sourceId')) === relation.uuid);
foundEntity = source.find(e => (foundry.utils.getProperty(e, '_stats.compendiumSource') || foundry.utils.getProperty(e, 'data.flags.core.sourceId') || foundry.utils.getProperty(e, 'flags.core.sourceId')) === relation.uuid);
if (foundEntity) {
if (!foundEntity.uuid || !foundEntity.documentName || !foundEntity.id) {
foundEntity.documentName = sourceType.type.documentName;
Expand All @@ -203,7 +203,7 @@ export function ReplaceCompendiumReferences(context, documents, availableDocumen
if (existingUpdate[path]) {
oldValue = existingUpdate[path];
} else {
oldValue = getProperty(datum, relation.path);
oldValue = foundry.utils.getProperty(datum, relation.path);
if (relation.embeddedId && oldValue) {
oldValue = oldValue.get(relation.embeddedId);
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/export-import/exporter-progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ export default class ExporterProgress extends FormApplication {

/** @inheritdoc */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
return foundry.utils.mergeObject(super.defaultOptions, {
title: game.i18n.localize('SCENE-PACKER.exporter.name'),
id: 'scene-packer-exporter-progress',
template:
Expand Down
Loading

0 comments on commit 109d8ca

Please sign in to comment.