Total rework of the module battlemaps.

This commit is contained in:
stukerrigan 2022-05-12 14:51:53 +01:00
parent 5509a4f227
commit dd936548e6
27 changed files with 156 additions and 335 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
assets/maps/changer.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
assets/maps/chaosstar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 549 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 KiB

BIN
assets/maps/level2.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 964 KiB

205
init.js
View File

@ -11,7 +11,7 @@ Hooks.on("init", () => {
name: "WFRP4e Night of Blood Initialization",
label : "Initialize",
hint : "This will import content for the WFRP4e adventure Night of Blood Module",
type : WFRP4eNightOfBloodWrapper,
type : WFRP4eNightOfBloodInitialization,
restricted: true
})
})
@ -24,18 +24,9 @@ Hooks.on("ready", () => {
})
class WFRP4eNightOfBloodWrapper extends FormApplication {
class WFRP4eNightOfBloodInitialization extends FormApplication {
render() {
new WFRP4eNightOfBloodInitialization().render(true);
}
}
class WFRP4eNightOfBloodInitialization extends Dialog{
constructor()
{
super({
title: "WFRP4e Night of Blood Initialization",
content: `<p class="notes"><img src="modules/wfrp4e-night-of-blood/assets/icons/logo.png"
let html = `<p class="notes"><img src="modules/wfrp4e-night-of-blood/assets/icons/logo.png"
style="display: block; margin-left: auto; margin-right: auto;">
@ -48,7 +39,7 @@ class WFRP4eNightOfBloodInitialization extends Dialog{
Special thanks to: <b>Russell Thurman (Moo Man)</b><br/><br/>
Foundry Edition by <b>Stuart Kerrigan</b><br/>
You can email us at <a href="mailto:perilousrealmpodcast@gmail.com">perilousrealmpodcast@gmail.com</a>
You can email us at <a href="mailto:perilousrealmpodcast@gmail.com">perilousrealmpodcast@gmail.com</a>3
<p class="notes"><strong>Want to support us?</strong><br/><br/>
@ -56,191 +47,7 @@ class WFRP4eNightOfBloodInitialization extends Dialog{
<a href="https://paypal.me/perilousrealm?locale.x=en_GB"><img src="modules/wfrp4e-night-of-blood/paypal.png" style="display: block; margin-left: auto; margin-right: auto;" alt="paypal" /></a><br/><br/>
You can also listen to the <a href="https://anchor.fm/peril">Perilous Realm Podcast</a><br/><br/><a href="https://anchor.fm/peril"><img src="modules/wfrp4e-night-of-blood/peril.png" style="display: block; margin-left: auto; margin-right: auto;" alt="peril logo"></a> <br/><br/>Lastly do share with us at <a href="mailto:perilousrealmpodcast@gmail.com">perilousrealmpodcast@gmail.com</a> any streams or audio you have of your adventures in the Hooded Man Inn - if anyone is left to tell the tale.</p>
`,
buttons: {
initialize: {
label : "Initialize",
callback : async () => {
game.settings.set("wfrp4e-night-of-blood", "initialized", true)
await new WFRP4eNightOfBloodInitialization().initialize()
ui.notifications.notify("Initialization Complete")
}
},
no: {
label : "No",
callback : () => {
game.settings.set("wfrp4e-night-of-blood", "initialized", true)
ui.notifications.notify("Skipped Initialization.")
You can also listen to the <a href="https://anchor.fm/peril">Perilous Realm Podcast</a><br/><br/><a href="https://anchor.fm/peril"><img src="modules/wfrp4e-night-of-blood/peril.png" style="display: block; margin-left: auto; margin-right: auto;" alt="peril logo"></a> <br/><br/>Lastly do share with us at <a href="mailto:perilousrealmpodcast@gmail.com">perilousrealmpodcast@gmail.com</a> any streams or audio you have of your adventures in the Hooded Man Inn - if anyone is left to tell the tale.</p>`
new game.wfrp4e.apps.ModuleInitializer("wfrp4e-night-of-blood", "WFRP4e Night of Blood Initialization",html).render(true);
}
}
}
})
this.folders = {
"Scene" : {},
"Item" : {},
"Actor" : {},
"JournalEntry" : {}
}
this.SceneFolders = {};
this.ActorFolders = {};
this.ItemFolders = {};
this.JournalEntryFolders = {};
this.journals = {};
this.scenes = {};
this.moduleKey = "wfrp4e-night-of-blood"
}
async initialize() {
return new Promise((resolve) => {
fetch(`modules/${this.moduleKey}/initialization.json`).then(async r => r.json()).then(async json => {
let createdFolders = await Folder.create(json)
for (let folder of createdFolders)
this.folders[folder.data.type][folder.data.name] = folder;
for (let folderType in this.folders) {
for (let folder in this.folders[folderType]) {
let parent = this.folders[folderType][folder].getFlag(this.moduleKey, "initialization-parent")
if (parent) {
let parentId = this.folders[folderType][parent].data._id
await this.folders[folderType][folder].update({ parent: parentId })
}
}
}
await this.initializeEntities()
await this.initializeScenes()
resolve()
})
})
}
async initializeEntities() {
let packList= [ `${this.moduleKey}.NightOfBloodActors`,
`${this.moduleKey}.NightOfBloodScenes`,
`${this.moduleKey}.NightOfBloodJournal`]
for( let pack of packList)
{
console.log(pack);
let content = await game.packs.get(pack).getContent();
for (let entity of content)
{
let folder = entity.getFlag(this.moduleKey, "initialization-folder")
if (folder)
entity.data.folder = this.folders[entity.entity][folder].data._id;
}
switch(content[0].entity)
{
case "Actor":
ui.notifications.notify("Initializing Actors")
await Actor.create(content.map(c => c.data))
break;
case "Item":
ui.notifications.notify("Initializing Items")
await Item.create(content.map(c => c.data))
break;
case "JournalEntry" :
ui.notifications.notify("Initializing Journals")
let createdEntries = await JournalEntry.create(content.map(c => c.data))
if (!createdEntries.length)
break
for (let entry of createdEntries)
this.journals[entry.data.name] = entry
break;
}
}
}
async initializeScenes() {
ui.notifications.notify("Initializing Scenes")
let m = game.packs.get(`${this.moduleKey}.NightOfBloodScenes`)
let maps = await m.getContent()
for (let map of maps)
{
let folder = map.getFlag(this.moduleKey, "initialization-folder")
if (folder)
map.data.folder = this.folders["Scene"][folder].data._id;
let journalName = map.getFlag(this.moduleKey, "scene-note")
if (journalName)
map.data.journal = game.journal.getName(journalName).data._id;
map.data.notes.forEach(n => {
try {
n.entryId = this.journals[getProperty(n, `flags.${this.moduleKey}.initialization-entryName`)].data._id
}
catch (e) {
console.log("wfrp4e | INITIALIZATION ERROR: " + e)
}
})
}
await Scene.create(maps.map(m => m.data)).then(sceneArray => {
sceneArray.forEach(async s => {
let thumb = await s.createThumbnail();
s.update({"thumb" : thumb.thumb})
})
})
}
}
class WFRP4eNightOfBloodInitializationSetup {
static async setup()
{
WFRP4eNightOfBloodInitializationSetup.displayFolders()
WFRP4eNightOfBloodInitializationSetup.setFolderFlags()
WFRP4eNightOfBloodInitializationSetup.setEmbeddedEntities()
}
/** This gets every folder in the system */
static async displayFolders() {
let array = [];
game.folders.entities.forEach(async f => {
if (f.data.parent)
await f.setFlag("wfrp4e-night-of-blood", "initialization-parent", game.folders.get(f.data.parent).data.name)
})
game.folders.entities.forEach(f => {
array.push(f.data)
})
console.log(JSON.stringify(array))
}
static async setFolderFlags() {
for (let scene of game.scenes.entities)
await scene.setFlag("wfrp4e-night-of-blood", "initialization-folder", game.folders.get(scene.data.folder).data.name)
for (let actor of game.actors.entities)
await actor.setFlag("wfrp4e-night-of-blood", "initialization-folder", game.folders.get(actor.data.folder).data.name)
for (let item of game.items.entities)
await item.setFlag("wfrp4e-night-of-blood", "initialization-folder", game.folders.get(item.data.folder).data.name)
for (let journal of game.journal.entities)
await journal.setFlag("wfrp4e-night-of-blood", "initialization-folder", game.folders.get(journal.data.folder).data.name)
WFRP4eNightOfBloodInitializationSetup.setSceneNotes();
}
static async setSceneNotes() {
for (let scene of game.scenes.entities)
if (scene.data.journal)
await scene.setFlag("wfrp4e-night-of-blood", "scene-note", game.journal.get(scene.data.journal).data.name)
}
static async setEmbeddedEntities() {
for (let scene of game.scenes.entities)
{
let notes = duplicate(scene.data.notes)
for (let note of notes)
{
setProperty(note, "flags.wfrp4e-night-of-blood.initialization-entryName", game.journal.get(note.entryId).data.name)
}
await scene.update({notes : notes})
}
}
}

View File

@ -1,9 +1,12 @@
[
{
"_id": "15vCMSPdiQ79lZVj",
"_id": "eD0dthg1vaqaQlbH",
"name": "Beginning In The Forest",
"type": "JournalEntry",
"parent": "jY6IpOz5yjaDoNm5",
"sorting": "a",
"sort": 3500000,
"color": null,
"flags": {
"wfrp4e-night-of-blood": {
"initialization-parent": "Night of Blood"
@ -11,33 +14,36 @@
"deprecated": {
"initialization-parent": "Night of Blood"
}
},
"parent": "qauzWDTxBDTer6oQ",
"sorting": "a",
"color": ""
}
},
{
"_id": "pnAQqGvoJN19iMxt",
"_id": "NYEfYRdiDtFaKkZT",
"name": "Chaos Hunters",
"type": "Actor",
"parent": "SX3XJlccdnlgn0iC",
"sorting": "a",
"sort": 1100000,
"color": null,
"flags": {
"wfrp4e-night-of-blood": {
"initialization-parent": "Night of Blood"
},
"deprecated": {
"initialization-parent": "Night of Blood"
},
"core": {
"sourceId": "Folder.NYEfYRdiDtFaKkZT"
}
}
},
"parent": "4EURm4BUTawgerv0",
"sorting": "a",
"color": ""
},
{
"_id": "iTRwG5gS9CBxRdBC",
"_id": "ABuZc9FnWV0JHpAY",
"name": "Hooded Man Exterior",
"type": "JournalEntry",
"parent": "jY6IpOz5yjaDoNm5",
"sorting": "a",
"sort": 3300000,
"color": null,
"flags": {
"wfrp4e-night-of-blood": {
"initialization-parent": "Night of Blood"
@ -45,16 +51,16 @@
"deprecated": {
"initialization-parent": "Night of Blood"
}
},
"parent": "qauzWDTxBDTer6oQ",
"sorting": "a",
"color": ""
}
},
{
"_id": "lcdcw69gWbKJ66au",
"_id": "xGE6hoQKNUXQ3DQb",
"name": "Hooded Man Interior",
"type": "JournalEntry",
"parent": "jY6IpOz5yjaDoNm5",
"sorting": "a",
"sort": 3200000,
"color": null,
"flags": {
"wfrp4e-night-of-blood": {
"initialization-parent": "Night of Blood"
@ -62,16 +68,16 @@
"deprecated": {
"initialization-parent": "Night of Blood"
}
},
"parent": "qauzWDTxBDTer6oQ",
"sorting": "a",
"color": ""
}
},
{
"_id": "I6Cro79fujYNXkqM",
"_id": "a9jVUkWTNbOM1oD4",
"name": "Inn Patrons",
"type": "Actor",
"parent": "SX3XJlccdnlgn0iC",
"sorting": "a",
"sort": 1000000,
"color": null,
"flags": {
"wfrp4e-night-of-blood": {
"initialization-parent": "Night of Blood"
@ -79,46 +85,46 @@
"deprecated": {
"initialization-parent": "Night of Blood"
}
},
"parent": "4EURm4BUTawgerv0",
"sorting": "a",
"color": ""
}
},
{
"_id": "4EURm4BUTawgerv0",
"name": "Night of Blood",
"type": "Actor",
"sort": 200000,
"flags": {},
"parent": null,
"sorting": "a",
"color": "#ff0d13"
},
{
"_id": "nEQnpf2p1xxgO02L",
"_id": "Hf6hvwTMqGu5vdp5",
"name": "Night of Blood",
"type": "Scene",
"sort": 300000,
"flags": {},
"parent": null,
"sorting": "a",
"color": "#ff0d13"
"sorting": "m",
"sort": 0,
"color": "#ff0000",
"flags": {}
},
{
"_id": "qauzWDTxBDTer6oQ",
"_id": "SX3XJlccdnlgn0iC",
"name": "Night of Blood",
"type": "Actor",
"parent": null,
"sorting": "a",
"sort": 200000,
"color": "#ff0d13",
"flags": {}
},
{
"_id": "jY6IpOz5yjaDoNm5",
"name": "Night of Blood",
"type": "JournalEntry",
"sort": 3100000,
"flags": {},
"parent": null,
"sorting": "a",
"color": "#ff0d13"
"sort": 3100000,
"color": "#ff0d13",
"flags": {}
},
{
"_id": "dWAWJ7KmbgQgoT0r",
"_id": "QANo7xlmoUJ7GI0G",
"name": "The Aftermath",
"type": "Actor",
"parent": "SX3XJlccdnlgn0iC",
"sorting": "a",
"sort": 1300000,
"color": null,
"flags": {
"wfrp4e-night-of-blood": {
"initialization-parent": "Night of Blood"
@ -126,16 +132,16 @@
"deprecated": {
"initialization-parent": "Night of Blood"
}
},
"parent": "4EURm4BUTawgerv0",
"sorting": "a",
"color": ""
}
},
{
"_id": "c5JXQqWCBiFev3YN",
"_id": "sOKZdwMAv9sAjliU",
"name": "The Horror",
"type": "Actor",
"parent": "SX3XJlccdnlgn0iC",
"sorting": "a",
"sort": 1200000,
"color": null,
"flags": {
"wfrp4e-night-of-blood": {
"initialization-parent": "Night of Blood"
@ -143,16 +149,16 @@
"deprecated": {
"initialization-parent": "Night of Blood"
}
},
"parent": "4EURm4BUTawgerv0",
"sorting": "a",
"color": ""
}
},
{
"_id": "QA64W3jfMWG0KbhW",
"_id": "BvJldSIZ7lVdNwC4",
"name": "What Lies Beneath the Inn",
"type": "JournalEntry",
"parent": "jY6IpOz5yjaDoNm5",
"sorting": "a",
"sort": 3400000,
"color": null,
"flags": {
"wfrp4e-night-of-blood": {
"initialization-parent": "Night of Blood"
@ -160,9 +166,6 @@
"deprecated": {
"initialization-parent": "Night of Blood"
}
},
"parent": "qauzWDTxBDTer6oQ",
"sorting": "a",
"color": ""
}
}
]

View File

@ -1,52 +1,73 @@
{
"name": "wfrp4e-night-of-blood",
"title": "Night of Blood (WFRP 4e)",
"description": "The classic Warhammer Fantasy Roleplay adventure, perfect for introducing new players",
"version": "1.2",
"author": "Stu",
"description": "The classic Warhammer Fantasy Roleplay adventure, perfect for introducing new players. Now updated to include multi-level scenes",
"version": "2.0",
"author": "Stuart Kerrigan",
"dependencies": [
{
"name": "lib-wrapper"
},
{
"name": "betterroofs"
},
{
"name": "wall-height"
},
{
"name": "levels"
},
{
"name": "token-attacher"
},
{
"name": "ambientdoors"
},
{
"name": "tokenmagic"
}
],
"esmodules": [
],
"scripts": [
"initialization.js"
],
"systems": ["wfrp4e"],
"styles": [
"./styles.css"
],
"scripts": [
"init.js"
],
"packs": [
{
"name": "NightOfBloodActors",
"label": "Night of Blood Actors",
"type": "Actor",
"name": "NightOfBloodActors",
"path": "packs/night-of-blood-actors.db",
"entity": "Actor",
"module": "wfrp4e-night-of-blood",
"system": "wfrp4e"
},
"package": "wfrp4e-night-of-blood" },
{
"name": "NightOfBloodScenes",
"label": "Night of Blood Scenes",
"type": "Scene",
"name": "NightOfBloodScenes",
"path": "packs/night-of-blood-scenes.db",
"entity": "Scene",
"module": "wfrp4e-night-of-blood",
"system": "wfrp4e"
},
"package": "wfrp4e-night-of-blood" },
{
"name": "NightOfBloodJournal",
"label": "Night of Blood Journal Entries",
"name": "NightOfBloodJournal",
"path": "packs/night-of-blood-journal.db",
"entity": "JournalEntry",
"module": "wfrp4e-night-of-blood",
"system": "wfrp4e"
},
"type": "JournalEntry",
"package": "wfrp4e-night-of-blood" },
{
"name": "NightOfBloodSFX",
"label": "Night of Blood SFX",
"path": "packs/night-of-blood-sfx.db",
"entity": "Playlist",
"module": "wfrp4e-night-of-blood",
"system": "wfrp4e"
}
"type": "Playlist",
"package": "wfrp4e-night-of-blood" }
],
"flags" : {
"initializationPacks" : [ ]
},
"languages": ["en"],
"minimumCoreVersion": "0.7.5",
"minimumCoreVersion": "0.9",
"manifest": "https://raw.githubusercontent.com/CStuartEKerrigan/WFRP-Night-of-Blood-4e-FVTT/master/module.json",
"download": "https://github.com/CStuartEKerrigan/WFRP-Night-of-Blood-4e-FVTT/archive/master.zip",
"url": "https://github.com/CStuartEKerrigan/WFRP-Night-of-Blood-4e-FVTT/"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long