This commit is contained in:
Vlyan
2020-12-11 23:38:54 +01:00
46 changed files with 791 additions and 374 deletions

View File

@@ -174,4 +174,56 @@ Hooks.once("diceSoNiceReady", (dice3d) => {
);
});
// Logo & Menu options
Hooks.once("ready", async function () {
// -- Function Open Edge-Studio Website
function openEdge() {
ui.notifications.info(game.i18n.localize("l5r5e.logo.edge-info"));
var windowObjectReference = window.open(game.i18n.localize("l5r5e.logo.edge-link"), "_blank");
}
// -- Open Function Edge's DriveThruRpg
function openDrive() {
ui.notifications.info(game.i18n.localize("l5r5e.logo.drive-info"));
var windowObjectReference = window.open(game.i18n.localize("l5r5e.logo.drive-link"), "_blank");
}
// -- Open Function Discord Link
function openDiscord() {
ui.notifications.info(game.i18n.localize("l5r5e.logo.discrod-info"));
var windowObjectReference = window.open(game.i18n.localize("l5r5e.logo.discrod-link"), "_blank");
}
//-- Logo Menu Link
let liensExt = new Dialog({
title: game.i18n.localize("l5r5e.logo.title"),
content: "<p>" + game.i18n.localize("l5r5e.logo.content") + "</p>",
buttons: {
one: {
icon: '<i class="fas fa-check"></i>',
label: game.i18n.localize("l5r5e.logo.edge"),
callback: () => openEdge(),
},
two: {
icon: '<i class="fas fa-check"></i>',
label: game.i18n.localize("l5r5e.logo.drive"),
callback: () => openDrive(),
},
three: {
icon: '<i class="fas fa-check"></i>',
label: game.i18n.localize("l5r5e.logo.discrod"),
callback: () => openDiscord(),
},
},
});
//-- Logo
var logo = document.getElementById("logo");
logo.setAttribute("src", game.i18n.localize("l5r5e.logo.src"));
//-- Open menu on Logo click
logo.setAttribute("title", game.i18n.localize("l5r5e.logo.alt"));
logo.addEventListener("click", function () {
liensExt.render(true);
});
});
// Add any additional hooks if necessary

View File

@@ -0,0 +1,139 @@
Hooks.on("init", () => {
// Register module settings.
game.settings.register("l5r5e", "icBgColor", {
name: game.i18n.localize("ic.bg.color"),
hint: game.i18n.localize("hexa.color"),
default: "#D3E5F5",
type: String,
scope: "client",
config: true,
});
game.settings.register("l5r5e", "icTextColor", {
name: game.i18n.localize("ic.text.color"),
hint: game.i18n.localize("hexa.color"),
default: "rgba(0,0,0,0.75)",
type: String,
scope: "client",
config: true,
});
game.settings.register("l5r5e", "emoteBgColor", {
name: game.i18n.localize("emote.bg.color"),
hint: game.i18n.localize("hexa.color"),
default: "#D1F5D1",
type: String,
scope: "client",
config: true,
});
game.settings.register("l5r5e", "emoteTextColor", {
name: game.i18n.localize("emote.text.color"),
hint: game.i18n.localize("hexa.color"),
default: "rgba(0,0,0,0.75)",
type: String,
scope: "client",
config: true,
});
game.settings.register("l5r5e", "rollBgColor", {
name: game.i18n.localize("roll.bg.color"),
hint: game.i18n.localize("hexa.color"),
default: "#E6BB81",
type: String,
scope: "client",
config: true,
});
game.settings.register("l5r5e", "rollTextColor", {
name: game.i18n.localize("roll.text.color"),
hint: game.i18n.localize("hexa.color"),
default: "rgba(0,0,0,0.75)",
type: String,
scope: "client",
config: true,
});
game.settings.register("l5r5e", "otherBgColor", {
name: game.i18n.localize("other.bg.color"),
hint: game.i18n.localize("hexa.color"),
default: "#DBD9CD",
type: String,
scope: "client",
config: true,
});
game.settings.register("l5r5e", "otherTextColor", {
name: game.i18n.localize("other.text.color"),
hint: game.i18n.localize("hexa.color"),
default: "rgba(0,0,0,0.75)",
type: String,
scope: "client",
config: true,
});
game.settings.register("l5r5e", "defaultChatPrefix", {
name: game.i18n.localize("def.chat.pref"),
hint: game.i18n.localize("spe.chat.pref"),
default: "",
type: String,
scope: "client",
config: true,
});
});
Hooks.on("renderChatLog", (log, html) => {
// Prepend inline CSS to the chatlog to style the chat messages.
const icBgColor = game.settings.get("l5r5e", "icBgColor");
const icTextColor = game.settings.get("l5r5e", "icTextColor");
const emoteBgColor = game.settings.get("l5r5e", "emoteBgColor");
const emoteTextColor = game.settings.get("l5r5e", "emoteTextColor");
const rollBgColor = game.settings.get("l5r5e", "rollBgColor");
const rollTextColor = game.settings.get("l5r5e", "rollTextColor");
const otherBgColor = game.settings.get("l5r5e", "otherBgColor");
const otherTextColor = game.settings.get("l5r5e", "otherTextColor");
$(
"<style type='text/css'> #chat-log .message.ic { background-color: " +
icBgColor +
"; color: " +
icTextColor +
" }\n #chat-log .message.ic .message-header { color: " +
icTextColor +
" }\n #chat-log .message.emote { background-color: " +
emoteBgColor +
"; color: " +
emoteTextColor +
" }\n #chat-log .message.emote .message-header { color: " +
emoteTextColor +
" }\n #chat-log .message.chatColorsRoll { background-color: " +
rollBgColor +
"; color: " +
rollTextColor +
" }\n #chat-log .message.chatColorsRoll .message-header { color: " +
rollTextColor +
" }\n #chat-log .message { background-color: " +
otherBgColor +
"; color: " +
otherTextColor +
" }\n #chat-log .message .message-header { color: " +
otherTextColor +
"; } </style>"
).prependTo(html);
});
Hooks.on("chatMessage", (chatLog, message, chatData) => {
if (game.settings.get("l5r5e", "defaultChatPrefix")) {
const prefix = game.settings.get("l5r5e", "defaultChatPrefix");
// Check if the message begins with any command.
let [command, match] = chatLog.constructor.parse(message);
if (command === "none") {
// If there is no command, insert the prefix and reprocess.
chatLog.processMessage(prefix + " " + message);
return false;
}
// Otherwise do nothing.
return true;
}
});
Hooks.on("renderChatMessage", (message, html, data) => {
// Add extra CSS classes to rolls so we can style them.
if (message.isRoll) {
html.addClass("chatColorsRoll");
}
});