Skip to content

Commit 1faff23

Browse files
committed
v1.0.5
1 parent f400240 commit 1faff23

File tree

7 files changed

+346
-85
lines changed

7 files changed

+346
-85
lines changed

CHANGELOG.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## v1.0.5
4+
5+
- Added "How to use" style journals to the Scene Packer compendium.
6+
- Added options on how to initialise Scene Packer. See readme or compendium Journal for examples.
7+
- Added "dry run" mode to `await window['scene-packer'].relinkJournalEntries('module-name', {dryRun: true});` allowing
8+
you to see the changes that will be made to compendium journals without actually making the changes.
9+
- Added `await window['scene-packer'].promptRelinkJournalEntries();` as a way to prompt the module name and dry-run
10+
mode. Also added a macro version bundled in the compendium.
11+
- Added better handling of cases where data wasn't in a valid state for packing.
12+
- Added initial support for specifying Macro packs. Works similar to setting creature or journal
13+
packs. `packer.SetMacroPacks();`
14+
- Removed `packer.DisableImportPrompts();` as it wouldn't fire at the appropriate time. See new methods for initialising
15+
Scene Packer for replacement option.
16+
- Switched config option default so that Scene context menus (right clicking) no longer shows Scene Packer options by
17+
default (because most people are users, not developers).
18+
- Added Macro compendium to assist with usage.
19+
- Fixed minor typos and grammatical errors.
20+
321
## v1.0.4
422

523
- Added welcome prompt to import and unpack all scenes in the adventure.
@@ -8,19 +26,23 @@
826

927
## v1.0.3
1028

11-
- Added `packer.DisableImportPrompts();` as a way to prevent the popups from appearing when opening your module's compendiums.
29+
- Added `packer.DisableImportPrompts();` as a way to prevent the popups from appearing when opening your module's
30+
compendiums.
1231
- Added `Unpack Scene Data` option to Scene context menu.
1332
- Changed Scene context menu options to only show based on whether the Scene has Packed Data already.
1433
- Default to showing the context menu on scenes for GMs.
15-
- Changed the flag used to store whether the adventure module has been imported from a `boolean` to a `version` string to allow future support of "upgrades" to the module.
16-
- Exposed `HasPackedData(scene, moduleName, tokenFlag, journalFlag)` static method to allow checking whether a given Scene has data packed for the given module.
34+
- Changed the flag used to store whether the adventure module has been imported from a `boolean` to a `version` string
35+
to allow future support of "upgrades" to the module.
36+
- Exposed `HasPackedData(scene, moduleName, tokenFlag, journalFlag)` static method to allow checking whether a given
37+
Scene has data packed for the given module.
1738

1839
## v1.0.2
1940

2041
- Fixed bug that would occur if Journal entries weren't in a folder of the same name as the adventure.
2142
- Delay calling `scenePackerReady` hook until after the canvas is ready.
2243
- Added `await window['scene-packer'].relinkJournalEntries('module-name');` static method
23-
- Automatically goes through the Journals in the module's compendium packs and updates the references from the World version to the Compendium versions.
44+
- Automatically goes through the Journals in the module's compendium packs and updates the references from the World
45+
version to the Compendium versions.
2446

2547
## v1.0.1
2648

README.md

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ To use the Scene Packer as part of your module you will need to add it as a depe
2020
"dependencies": [
2121
{
2222
"name": "scene-packer",
23-
"manifest": "https://raw.githubusercontent.com/League-of-Foundry-Developers/scene-packer/master/module.json",
23+
"manifest": "https://raw.githubusercontent.com/League-of-Foundry-Developers/scene-packer/master/module.json"
2424
}
2525
]
2626
```
2727

2828
### Module code requirements
2929

30-
To unpack your scenes automatically when first viewed by a user, include the following in your module js script, updating the variable names where appropriate.
30+
To unpack your scenes automatically when first viewed by a user, include the following in your module javascript, updating the variable names where appropriate.
3131

3232
```javascript
3333
const adventureName = 'The Name of Your Adventure or Collection';
@@ -58,38 +58,39 @@ const creaturePacks = [`${moduleName}.actors`, 'dnd5e.monsters'];
5858
* Set to the following to disable:
5959
* const journalPacks = [];
6060
*/
61-
const journalPacks = [`${moduleName}.journals`];
61+
const journalPacks = [`${moduleName}.journals`];/**
62+
* macroPacks is a list of compendium packs to look in for Macros by name (in prioritised order).
63+
* The first entry here assumes that you have a Macro pack in your module with the "name" of "macros".
64+
* Set to the following to disable:
65+
* const macroPacks = [];
66+
*/
67+
const macroPacks = [`${moduleName}.macros`];
6268

6369
Hooks.once('scenePackerReady', ({ getInstance }) => {
6470
// Initialise the Scene Packer with your adventure name and module name
65-
let packer = getInstance(adventureName, moduleName);
66-
if (creaturePacks.length) {
67-
packer.SetCreaturePacks(creaturePacks);
68-
}
69-
if (journalPacks.length) {
70-
packer.SetJournalPacks(journalPacks);
71-
}
72-
if (welcomeJournal) {
73-
packer.SetWelcomeJournal(welcomeJournal);
74-
}
75-
if (additionalJournals.length) {
76-
packer.SetAdditionalJournalsToImport(additionalJournals);
77-
}
78-
// If you don't want the dialogs to appear when your users first open the compendiums, uncomment the following line.
79-
// packer.DisableImportPrompts();
71+
let packer = getInstance(adventureName, moduleName, {
72+
creaturePacks,
73+
journalPacks,
74+
macroPacks,
75+
welcomeJournal,
76+
additionalJournals,
77+
allowImportPrompts: true, // Set to false if you don't want the popup
78+
});
8079
});
8180
```
8281

8382
### Packing your Scenes
8483

8584
To pack your scene ready for distribution:
8685

87-
1. `Enable Scene Packer context menu` in Module Settings.
86+
1. Enable the `Scene Packer context menu` in Module Settings.
8887
2. Build your scene as normal, adding Actors and Journal Pins where you'd like.
89-
3. Export your Actors/Journals/Roll Tables to compendiums as normal.
90-
4. Right click on your Scene in the Scenes Directory and choose `Pack Scene Data`.
91-
5. Export your Scene to your compendium.
92-
6. Right click on your Scene in the Scenes Directory and choose `Clear Packed Scene Data`.
88+
3. Export your Actors/Journals/Roll Tables/Items/Macros to your compendiums as normal.
89+
4. Run the script to Update Journal links to fix up the journal compendium linking (see section below)
90+
5. Re-export your Journals to compendiums, be sure to select the "Merge By Name" option to prevent the IDs from changing (and therefore re-breaking the links)
91+
6. Right click on your Scene in the Scenes Directory and choose `Pack Scene Data`.
92+
7. Export your Scene to your compendium.
93+
8. Right click on your Scene in the Scenes Directory and choose `Clear Packed Scene Data`.
9394

9495
- You want to choose this otherwise next time you open your Scene locally it will run the Scene import scripts.
9596

@@ -100,13 +101,19 @@ To pack your scene ready for distribution:
100101
When you build an adventure module, it's a painful process updating all of your Journal references to link to the compendium versions. You can simplify this by running the following command in your browser console putting in your appropriate module name (as per your manifest json name):
101102

102103
```js
103-
`await window['scene-packer'].relinkJournalEntries('module-name');`
104+
await window['scene-packer'].relinkJournalEntries('module-name', {dryRun: false});
104105
```
105106

107+
Alternatively, you can run the macro `Relink compendium journal entries` that is included in the Scene Packer compendium, which will prompt you for your module name and whether you want to run in "dry run" mode (not saving changes).
108+
109+
This will automatically go through the Journal compendiums that belong to your module, and change the reference links to the compendium versions. For example, if you had a link to `@Actor[alvhCr52HIrWmoez]{Commoner}` it would change it to `@Compendium[your-module.actors.lOBiqShvkT83eGzY]{Commoner}` using your module and compendium names and ID references.
110+
106111
## TODO
107112

108113
- Provide example complete module
109114

110115
## Acknowledgements
111116

112-
A portion of the code is based on code created by <https://onepagemage.com/> and used with permission.
117+
A portion of the code is based on code created by [honeybadger](https://github.com/trioderegion) and used with permission.
118+
119+
Thanks to [Baileywiki](https://www.patreon.com/baileywiki) for their initial testing and feedback.

languages/en.json

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
},
1414
"welcome": {
1515
"title": "{title} Importer",
16-
"intro": "<p>Welcome to <strong>{adventure}</strong></p>",
17-
"brand-new": "<p>Would you like to import and unpack the Scenes from this adventure?</p>",
18-
"update-available": "<p>An update is available. You have <strong>{existing}</strong> installed, and <strong>{version}</strong> is available. Would you like to import and unpack the Scenes from this adventure?</p><p><strong>Note: If you choose to import all, you will end up with a second copy of the scene, the bottom one is the newer version.</strong></p>",
16+
"intro": "<h2>Welcome to <strong>{adventure}</strong>.</h2>",
17+
"brand-new": "<p>Would you like to import and unpack the Scenes from this module?</p>",
18+
"update-available": "<p>An update is available. You have <strong>{existing}</strong> installed, and <strong>{version}</strong> is available. Would you like to import and unpack the Scenes from this module?</p><p><strong>Note: If you choose to import all, you will end up with a second copy of the scenes, the bottom one is the newer version.</strong></p>",
1919
"yes-all": "Yes import all",
2020
"let-me-choose": "Let me choose",
2121
"no": "No",
@@ -25,11 +25,13 @@
2525
"first-launch": "First launch of this adventure! Unpacking scene...",
2626
"done": "All done!",
2727
"pack-scene": {
28-
"clear-reminder": "Don't forget to run ScenePacker.ClearPackedData() after exporting to prevent future duplicates.",
28+
"clear-reminder": "Don't forget to \"Clear Packed Scene Data\" after exporting to prevent future duplicates.",
2929
"writing-journals": "Writing {number} journals to scene: {name}",
3030
"no-journal-pins": "No journal pins detected on the scene.",
31-
"no-token-name-warning": "Cannot pack a token that has no name. Check console for details.",
31+
"no-token-name-warning": "Cannot pack a token that has no name. Check debug logs for details.",
3232
"no-token-name-log": "Trying to pack a token that has no name is not going to end well. Please ensure the Token and Actor have a name.",
33+
"no-journal-link-warning": "Cannot pack a journal pin that does not link to a valid journal entry. Journal pin is called: \"{pin}\". Check debug logs for details.",
34+
"no-journal-link-log": "Trying to pack a journal pin that does not link to a journal entry is not going to end well. Please ensure the pin \"{pin}\" is linked correctly.",
3335
"writing-tokens": "Writing {number} tokens to scene: {name}",
3436
"no-tokens": "No tokens detected on the scene."
3537
},
@@ -46,16 +48,16 @@
4648
}
4749
},
4850
"find-actor": {
49-
"missing-name": "Cannot find a token that has no name. Check console for details.",
51+
"missing-name": "Cannot find a token that has no name. Check debug logs for details.",
5052
"missing-name-details": "Trying to find a token that has no name is not going to end well. Please ensure the Token and Actor have a name prior to packing."
5153
},
5254
"link-tokens": {
53-
"missing": "Could not find {count} actors to link, they will remain unlinked. Check console for details.",
55+
"missing": "Could not find {count} actors to link, they will remain unlinked. Check debug logs for details.",
5456
"missing-details": "Could not find {count} actors to link. The following actor tokens were not found in the \"{adventureName}\" folder.",
5557
"linking": "Relinking {count} Tokens linked to actors."
5658
},
5759
"spawn-notes": {
58-
"missing": "Could not find {count} journals to link. Check console for details.",
60+
"missing": "Could not find {count} journals to link. Check debug logs for details.",
5961
"missing-details": "Could not find {count} notes to spawn. The following journals were not found.",
6062
"spawning": "Spawning {count} journal notes."
6163
},
@@ -64,7 +66,8 @@
6466
},
6567
"clear-data": {
6668
"done": "Finished clearing Packed Data."
67-
}
69+
},
70+
"deprecated": "Warning, {method} is deprecated and will be removed in the future."
6871
},
6972
"scene-context": {
7073
"pack": {
@@ -108,6 +111,11 @@
108111
"ui": "Invalid call to SetJournalPacks(). See console for details.",
109112
"details": "You must pass an array of strings to \"SetJournalPacks()\". They must be the names of Journal Packs. Received: {pack}",
110113
"missing": "SetJournalPacks() called with no value. This disables importing of Journals."
114+
},
115+
"macroPacks": {
116+
"ui": "Invalid call to SetMacroPacks(). See console for details.",
117+
"details": "You must pass an array of strings to \"SetMacroPacks()\". They must be the names of Macro Packs. Received: {pack}",
118+
"missing": "SetMacroPacks() called with no value. This disables importing of Macros."
111119
}
112120
},
113121
"world-conversion": {
@@ -116,18 +124,28 @@
116124
"lock": "Locking compendiums: {list}",
117125
"checking-and-updating": "Checking and updating {count} journal references from world links to compendium links.",
118126
"invalid-ref-type": "Found a journal reference that isn't handled: {type}. Skipping reference...",
119-
"invalid-no-name": "Found a journal reference but couldn't find its original name. Check console for details.",
127+
"invalid-no-name": "Found a journal reference but couldn't find its original name. Check debug logs for details.",
120128
"invalid-no-matching-name": "Could not find reference name in world data",
121-
"invalid-not-found": "Found a journal reference but couldn't find its compendium version by name. Check console for details.",
129+
"invalid-not-found": "Found a journal reference but couldn't find its compendium version by name. Check debug logs for details.",
122130
"invalid-not-found-console": "Could not find reference in compendium data. Skipping updating reference...",
123-
"invalid-too-many": "Found a journal reference but found more than one compendium version by name. Check console for details.",
131+
"invalid-too-many": "Found a journal reference but found more than one compendium version by name. Check debug logs for details.",
124132
"invalid-too-many-console": "Found more than one reference in compendium data. Skipping updating reference...",
125-
"updating-journal-references": "Changing {count} journal references in: {journal}",
133+
"updating-journal-references": "Changing {count} journal references in: \"{journal}\"",
126134
"updating-reference-console": "Changing {pack}[{journalEntryId}] {type} reference {oldRef} -> {newRefPack}.{newRef}",
127-
"updating-reference": "Updating {count} references in {journal}. See console for full details.",
128-
"completed-journal": "Completed journal {journal} {entryId}",
135+
"updating-reference": "Updating {count} references in \"{journal}\". See console for full details.",
136+
"completed-journal": "Completed journal \"{journal}\" {entryId}.",
137+
"no-references": "There were no references that needed updating in journal \"{journal}\" {entryId}.",
138+
"checking-journal": "Checking contents of journal \"{journal}\" {entryId}.",
129139
"completed": "Completed!"
130140
}
141+
},
142+
"relink-prompt": {
143+
"title": "Relink Journal Entries",
144+
"intro": "Select the module you are using Scene Packer with:",
145+
"make-changes": "Save changes?",
146+
"make-changes-info": "Leaving this unchecked will operate in a \"dry run\" mode, where changes are only output to the console.",
147+
"relink": "Relink",
148+
"cancel": "Cancel"
131149
}
132150
}
133151
}

module.json

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
"name": "scene-packer",
33
"title": "Library: Scene Packer",
44
"description": "A module to assist with Scene and Adventure packing and unpacking.",
5-
"version": "1.0.4",
5+
"version": "1.0.5",
66
"library": "true",
77
"manifestPlusVersion": "1.0.0",
88
"minimumCoreVersion": "0.7.9",
99
"compatibleCoreVersion": "0.7.9",
1010
"author": "The League of Extraordinary FVTT Developers",
11-
"authors": [{
11+
"authors": [
12+
{
1213
"name": "The League of Extraordinary FVTT Developers",
1314
"url": "https://github.com/League-of-Foundry-Developers"
1415
},
@@ -17,17 +18,33 @@
1718
"discord": "blair#9056"
1819
}
1920
],
21+
"packs": [
22+
{
23+
"name": "journals",
24+
"label": "Library: Scene Packer",
25+
"path": "/packs/journals.db",
26+
"entity": "JournalEntry"
27+
},
28+
{
29+
"name": "macros",
30+
"label": "Library: Scene Packer",
31+
"path": "/packs/macros.db",
32+
"entity": "Macro"
33+
}
34+
],
2035
"esmodules": [
2136
"/scripts/scene-packer.js"
2237
],
23-
"languages": [{
24-
"lang": "en",
25-
"name": "English",
26-
"path": "languages/en.json"
27-
}],
38+
"languages": [
39+
{
40+
"lang": "en",
41+
"name": "English",
42+
"path": "languages/en.json"
43+
}
44+
],
2845
"url": "https://github.com/League-of-Foundry-Developers/scene-packer",
2946
"manifest": "https://github.com/League-of-Foundry-Developers/scene-packer/releases/latest/download/module.json",
30-
"download": "https://github.com/League-of-Foundry-Developers/scene-packer/releases/download/1.0.4/module.zip",
47+
"download": "https://github.com/League-of-Foundry-Developers/scene-packer/releases/download/1.0.5/module.zip",
3148
"bugs": "https://github.com/League-of-Foundry-Developers/scene-packer/issues",
3249
"changelog": "https://github.com/League-of-Foundry-Developers/scene-packer/blob/master/changelog.md",
3350
"allowBugReporter": true

0 commit comments

Comments
 (0)