-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopup.js
69 lines (61 loc) · 2.39 KB
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
function registerSettings() {
// Create the setting for disabling/re-enabling the popup.
game.settings.register("pf2e-mercenary-marketplace-demo", "popupVis", {
name: "One-Time Popup",
scope: "client",
config: false,
type: Boolean,
default: true
})
};
Hooks.once("init", () => {
//Wait until the game is initialized, then register the settings created previously.
registerSettings();
});
async function openIntroduction (){
const journals = await game.packs.get("pf2e-mercenary-marketplace-demo.mmDemo-journals").getDocuments();
const introduction = journals.filter(e => e.id == "1s34nyLF4vYUxsHX")[0]
introduction.sheet.render(true)
game.settings.set("pf2e-mercenary-marketplace-demo", "popupVis", false)
}
Hooks.once('ready', async function () {
if (game.user.isGM) {
if (game.settings.get("pf2e-mercenary-marketplace-demo", "popupVis") == true) {
let d = new Dialog({
title: "Mercenary Marketplace Demo Activated",
content: `
<p>
Thank you for picking up the Mercenary Marketplace Demo!
</p>
<p>This module would not have been possible without the feedback from Amanda, InfamousSky, and SkepticRobot.</p>
<p>
Please click the introduction button to discover what the demo has to offer.
</p>
`,
buttons: {
one: {
icon: '<i class="fas fa-clipboard-list"></i>',
label: "Introduction",
callback: () => openIntroduction()
},
two: {
icon: '<i class="fas fa-times-circle"></i>',
label: "Close",
callback: () => game.settings.set("pf2e-mercenary-marketplace-demo", "popupVis", false)
},
},
},{ width: 450});
d.render(true);
}
}
})
/* -------------------------------------------- */
/* Journal Entry Styling */
/* -------------------------------------------- */
Hooks.on("renderJournalSheet", (app, html, data) => {
if ( app.document.getFlag("pf2e-mercenary-marketplace-demo", "ismmDemo") === true ) {
html = html[0];
html.classList.remove("pf2e");
html.classList.add("pf2e-mmDemo");
}
});