// MACRO NAME: FORTUNE TABLE
// MACRO TYPE: script
// REQUIRED TABLES: Fortune, Ill-Fortune
// copy and paste from below this line:
let message;
async function printMessage(table) {
let roll = await table.roll()
let result = roll.results[0];
let chatData = {
content: `<div style="text-align:center">
<h2>Fortune / Ill-Fortune Table</h2>
<p>The result of your <i>${message}</i> is:</p>
<p style="color:#941b0c;font-size:18px;">${result.data.text}</p>
</div>`,
whisper: [game.user],
};
ChatMessage.create(chatData, {});
}
let dType = new Dialog({
title: "Favour",
content: `<div style="text-align:center"><h3>What special icon did you roll?<\h3><h2><\h2><\div>`,
buttons: {
button1: {
label: "Gandalf Rune",
callback: () => {
message = "Gandalf Rune";
printMessage(
game.tables.contents
.find((t) => t.name === "Fortune")
);
},
},
button2: {
label: "Eye of Sauron",
callback: () => {
message = "Eye of Sauron";
printMessage(
game.tables.contents
.find((t) => t.name === "Ill-Fortune")
);
},
},
},
}).render(true);