Compare commits
3
Commits
v0.9.0
...
e27c2a220f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e27c2a220f | ||
|
|
914fe01a2c | ||
|
|
803b5d1c7f |
No files matched your search
@@ -11,7 +11,7 @@ function defineSchema() {
|
||||
beschreibung: new fields.HTMLField({ initial: "" })
|
||||
}),
|
||||
legende: new fields.HTMLField({ initial: "" }),
|
||||
schicksalsmünzen: new fields.NumberField({ initital: 3, min: 0, required: true }),
|
||||
schicksalsmünzen: new fields.NumberField({ initial: 3, min: 0, required: true }),
|
||||
grad: new fields.SchemaField({
|
||||
erfahrungspunkteFrei: new fields.NumberField({
|
||||
required: true,
|
||||
|
||||
@@ -9,7 +9,6 @@ export const loadSettings = async function () {
|
||||
requiresReload: true
|
||||
});
|
||||
|
||||
// Automatically collapse chat message descriptions
|
||||
game.settings.register("midgard6-lvd", "beschreibungChatActive", {
|
||||
name: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.name"),
|
||||
hint: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.hint"),
|
||||
@@ -18,4 +17,71 @@ export const loadSettings = async function () {
|
||||
default: false,
|
||||
type: Boolean
|
||||
});
|
||||
|
||||
game.settings.register("midgard6-lvd", "beschreibungChatActive", {
|
||||
name: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.name"),
|
||||
hint: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.hint"),
|
||||
scope: "client",
|
||||
config: true,
|
||||
default: false,
|
||||
type: Boolean
|
||||
});
|
||||
|
||||
game.settings.register("midgard6-lvd", "colorSuccessBg", {
|
||||
name: "Erfolg: Hintergrundfarbe",
|
||||
hint: "Farbe für kritische Erfolge.",
|
||||
scope: "client",
|
||||
config: true,
|
||||
type: String,
|
||||
default: "#5db68b",
|
||||
onChange: () => updateAllCssVariables()
|
||||
});
|
||||
|
||||
game.settings.register("midgard6-lvd", "colorFailBg", {
|
||||
name: "Fehlschlag: Hintergrundfarbe",
|
||||
hint: "Farbe für kritische Fehlschläge.",
|
||||
scope: "client",
|
||||
config: true,
|
||||
type: String,
|
||||
default: "#e3e4e5",
|
||||
onChange: () => updateAllCssVariables()
|
||||
});
|
||||
|
||||
game.settings.register("midgard6-lvd", "colorCritSuccessBg", {
|
||||
name: "Kritischer Erffolg: Hintergrundfarbe",
|
||||
hint: "Farbe für überdurchschnittliche Würfe.",
|
||||
scope: "client",
|
||||
config: true,
|
||||
type: String,
|
||||
default: "#9de0f0",
|
||||
onChange: () => updateAllCssVariables()
|
||||
});
|
||||
|
||||
game.settings.register("midgard6-lvd", "colorCritFailureBg", {
|
||||
name: "Kritischer Erffolg: Hintergrundfarbe",
|
||||
hint: "Farbe für überdurchschnittliche Würfe.",
|
||||
scope: "client",
|
||||
config: true,
|
||||
type: String,
|
||||
default: "#ea7699",
|
||||
onChange: () => updateAllCssVariables()
|
||||
});
|
||||
};
|
||||
|
||||
function updateAllCssVariables() {
|
||||
const root = document.documentElement;
|
||||
|
||||
const successColor = game.settings.get("midgard6-lvd", "colorSuccessBg");
|
||||
const failColor = game.settings.get("midgard6-lvd", "colorFailBg");
|
||||
const critSuccessColor = game.settings.get("midgard6-lvd", "colorCritSuccessBg");
|
||||
const critFailColor = game.settings.get("midgard6-lvd", "colorCritFailureBg");
|
||||
|
||||
root.style.setProperty("--M6-success-color", successColor);
|
||||
root.style.setProperty("--M6-failure-color", failColor);
|
||||
root.style.setProperty("--M6-crit-success-color", critSuccessColor);
|
||||
root.style.setProperty("--M6-crit-failure-color", critFailColor);
|
||||
}
|
||||
|
||||
Hooks.once("ready", () => {
|
||||
updateAllCssVariables();
|
||||
});
|
||||
@@ -1,3 +1,10 @@
|
||||
:root {
|
||||
--M6-crit-success-color: #9de0f0;
|
||||
--M6-success-color: #5db68b;
|
||||
--M6-failure-color: #e3e4e5;
|
||||
--M6-crit-failure-color: #ea7699;
|
||||
}
|
||||
|
||||
.chat-message {
|
||||
background: none;
|
||||
border-radius: 0;
|
||||
@@ -46,9 +53,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Add a background color to the button if it is clicked on (add the .active class with JS), and when you move the mouse over it (hover) */
|
||||
|
||||
/* Style the collapsible content. Note: hidden by default */
|
||||
.content {
|
||||
padding: 0 18px;
|
||||
display: none;
|
||||
@@ -93,4 +97,20 @@
|
||||
font-weight: 500;
|
||||
padding: 0.3em;
|
||||
}
|
||||
|
||||
.roll-crit-fail {
|
||||
background-color: var(--M6-crit-failure-color);
|
||||
}
|
||||
|
||||
.roll-crit-success {
|
||||
background-color: var(--M6-crit-success-color);
|
||||
}
|
||||
|
||||
.roll-success {
|
||||
background-color: var(--M6-success-color);
|
||||
}
|
||||
|
||||
.roll-failure {
|
||||
background-color: var(--M6-failure-color);
|
||||
}
|
||||
}
|
||||
@@ -116,4 +116,27 @@ Hooks.on("renderChatMessageHTML", (message, html, data) => {
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
const diceTotalElement = html.querySelector(".dice-total");
|
||||
if (!diceTotalElement) return;
|
||||
|
||||
if (!message.rolls || message.rolls.length === 0) return;
|
||||
|
||||
const mainRoll = message.rolls[0];
|
||||
const totalValue = mainRoll.total;
|
||||
|
||||
const firstDiceTerm = mainRoll.terms.find((t) => t instanceof foundry.dice.terms.DiceTerm);
|
||||
const activeResult = firstDiceTerm.results.find((x) => x.active).result;
|
||||
const maxPossible = firstDiceTerm.faces;
|
||||
diceTotalElement.classList.remove("roll-crit-fail", "roll-crit-success", "roll-high");
|
||||
|
||||
if (activeResult === 1) {
|
||||
diceTotalElement.classList.add("roll-crit-fail");
|
||||
} else if (activeResult === maxPossible || mainRoll.isCritical || totalValue >= 30) {
|
||||
diceTotalElement.classList.add("roll-crit-success");
|
||||
} else if (totalValue >= 20) {
|
||||
diceTotalElement.classList.add("roll-success");
|
||||
} else if (totalValue <= 20) {
|
||||
diceTotalElement.classList.add("roll-failure");
|
||||
}
|
||||
});
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
{
|
||||
"lang": "en",
|
||||
"name": "English",
|
||||
"path": "lang/en.json",
|
||||
"path": "lang/de.json",
|
||||
"flags": {}
|
||||
}
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user