diff --git a/scripts/Utils.js b/scripts/Utils.js index 6d2465e..e85c129 100644 --- a/scripts/Utils.js +++ b/scripts/Utils.js @@ -20,4 +20,6 @@ const loading = (context) => { } } -export {loading} \ No newline at end of file +const capitalize = (text) => text.charAt(0).toUpperCase() + text.slice(1); + +export {loading, capitalize} \ No newline at end of file diff --git a/scripts/lib/CityImporter.js b/scripts/lib/CityImporter.js index c3b1664..1f01181 100644 --- a/scripts/lib/CityImporter.js +++ b/scripts/lib/CityImporter.js @@ -1,4 +1,4 @@ -import {loading} from "../Utils.js"; +import {loading, capitalize} from "../Utils.js"; const decodeHTML = (rawText) => { const txt = document.createElement("textarea"); @@ -47,8 +47,6 @@ const createActor = async (entityName, rawText, folder) => await Actor.create({ folder: folder }) -const capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1); - const createAndUpdateActor = (uidToActorIdMap, createdActorsArray) => async (actorData, NPCFolder) => { const newActor = await createActor(actorData.name, `
${actorData.output}
`, NPCFolder); uidToActorIdMap.set(actorData.key, newActor.data._id); @@ -117,7 +115,7 @@ const secondPassJournals = async (ids, loadingBar) => { loadingBar(); const journal = allJournals.get(id); const journalClone = JSON.parse(JSON.stringify(journal)); - journalClone.content = journalClone.content.replace(/@JournalEntry\[(\w+)\]/g, (_0, uid) => `@JournalEntry[${ids[0].get(uid)}]`); + journalClone.content = journalClone.content.replace(/@JournalEntry\[(\w+)\]/g, (_0, uid) => `@JournalEntry[${ids[0].get(uid) || ids[0].get(capitalize(uid))}]`); journalClone.content = journalClone.content.replace(/@JournalEntry\[(\w+-\w+-\w+-\w+-\w+)\]/g, (_0, uid) => `@JournalEntry[${ids[0].get(uid)}]`); journalClone.content = journalClone.content.replace(/@JournalEntry\[undefined\]{(.*?)}/g, (_0, name) => name); journalClone.content = journalClone.content.replace(/@JournalEntry\[link-internal\]{(.*?)}/g, (_0, name) => name);