WFRP-Night-of-Blood-4e-FVTT/init.js

37 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-11-08 01:03:50 +01:00
Hooks.on("init", () => {
2024-02-21 20:40:39 +01:00
game.settings.register("wfrp4e-night-of-blood", "initialized", {
2020-11-08 01:03:50 +01:00
name: "Initialization",
scope: "world",
config: false,
default: false,
type: Boolean
2024-02-21 20:40:39 +01:00
});
2020-11-08 01:03:50 +01:00
2024-02-21 20:40:39 +01:00
game.settings.registerMenu("wfrp4e-night-of-blood", "init-dialog", {
name: "WFRP4e Night of Blood Initialization",
label: "Initialize",
hint: "This will import content for the WFRP4e adventure Night of Blood Module",
type: WFRP4eNightOfBloodInitialization,
restricted: true
})
2020-11-08 01:03:50 +01:00
})
Hooks.on("ready", () => {
2024-02-21 20:40:39 +01:00
if (!game.settings.get("wfrp4e-night-of-blood", "initialized") && game.user.isGM) {
new WFRP4eNightOfBloodInitialization().render(true)
}
2020-11-08 01:03:50 +01:00
})
2022-05-12 15:51:53 +02:00
class WFRP4eNightOfBloodInitialization extends FormApplication {
2024-02-21 20:40:39 +01:00
async render() {
let html = "";
try {
html = await (await fetch("https://www.stuartkerrigan.com/fvtt/nob/init.php")).text()
2022-05-12 20:51:53 +02:00
}
2024-02-21 20:40:39 +01:00
catch (err) {
html = `<p>Night of Blood is the classic Warhammer Fantasy Roleplay scenario, and an excellent introduction to the game. The scenario was written in 1987 by Jim Bambra and has been republished officially and unofficially for 1st Edition, 2nd Edition and 4th Edition.</p>`;
}
new game.wfrp4e.apps.ModuleInitializer("wfrp4e-night-of-blood", "WFRP4e Night of Blood", html).render(true);
}
2020-11-08 01:03:50 +01:00
}