Compare commits
1 Commits
2077bf7cbb
...
05f5f0d28e
Author | SHA1 | Date | |
---|---|---|---|
05f5f0d28e |
@ -24,7 +24,7 @@ class ChatOverlayResource {
|
|||||||
@QueryParam("cmd") cmd: String? = "roll",
|
@QueryParam("cmd") cmd: String? = "roll",
|
||||||
@QueryParam("theme") theme: String? = "default",
|
@QueryParam("theme") theme: String? = "default",
|
||||||
@QueryParam("faceColor") faceColor: String? = "#ff0202",
|
@QueryParam("faceColor") faceColor: String? = "#ff0202",
|
||||||
@QueryParam("numberColor") numberColor: String? = "#ffffff",
|
@QueryParam("faceColor") numberColor: String? = "#ffffff",
|
||||||
@QueryParam("clearAfter") clearAfter: Long? = -1,
|
@QueryParam("clearAfter") clearAfter: Long? = -1,
|
||||||
@QueryParam("timeout") timeout: Long? = -1
|
@QueryParam("timeout") timeout: Long? = -1
|
||||||
): TemplateInstance {
|
): TemplateInstance {
|
||||||
|
@ -219,3 +219,6 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||||||
configurePopover();
|
configurePopover();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!localStorage.getItem("userId")) {
|
||||||
|
localStorage.setItem("userId", self.crypto.randomUUID());
|
||||||
|
}
|
||||||
|
@ -12,20 +12,15 @@
|
|||||||
<div popover id="results" class="tooltip">
|
<div popover id="results" class="tooltip">
|
||||||
</div>
|
</div>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import DiceBox from "/vendor/dice-box/dice-box-threejs.es.js";
|
import DiceBox from "/vendor/dice-box/dice-box.es.js";
|
||||||
|
|
||||||
const diceBox = new DiceBox("#dice-box", {
|
const diceBox = new DiceBox("#dice-box", {
|
||||||
assetPath: "/vendor/dice-box/",
|
assetPath: "/vendor/assets/",
|
||||||
light_intensity: 2,
|
theme: '{theme}',
|
||||||
gravity_multiplier: 600,
|
faceColor: '{faceColor}',
|
||||||
baseScale: {scale} * 10,
|
scale: {scale}
|
||||||
strength: Math.floor(Math.random() * 4),
|
|
||||||
theme_customColorset: {
|
|
||||||
texture: '{theme}',
|
|
||||||
background: '{faceColor}',
|
|
||||||
foreground: '{numberColor}'
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
diceBox.initialize();
|
diceBox.init()
|
||||||
ComfyJS.Init('{channel}');
|
ComfyJS.Init('{channel}');
|
||||||
|
|
||||||
//maxDice
|
//maxDice
|
||||||
@ -38,16 +33,16 @@
|
|||||||
toggleWait(true);
|
toggleWait(true);
|
||||||
|
|
||||||
diceBox.onRollComplete = (rollResult) => {
|
diceBox.onRollComplete = (rollResult) => {
|
||||||
rollResult.sets.forEach(result => {
|
rollResult.forEach(result => {
|
||||||
let values = []
|
let values = []
|
||||||
result.rolls.forEach(roll => {
|
result.rolls.forEach(roll => {
|
||||||
values.push(roll.value);
|
values.push(roll.value);
|
||||||
})
|
})
|
||||||
document.getElementById('results').innerHTML = '<strong>' + user + '</strong> rolls <strong>' + message + '</strong>:<br/> [' + values.map(value => value === 1 ? '<strong style="text-shadow: 2px 2px 10px red">' + value + '</strong>' : value === result.sides ? '<strong style="text-shadow: 2px 2px 10px green">' + value + '</strong>' : value).join(' + ') + '] = <strong>' + result.total + '</strong> '
|
document.getElementById('results').innerHTML = '<strong>' + user + '</strong> rolls <strong>' + message + '</strong>:<br/> [' + values.map(value => value === 1 ? '<strong style="text-shadow: 2px 2px 10px red">' + value + '</strong>' : value === result.sides ? '<strong style="text-shadow: 2px 2px 10px green">' + value + '</strong>' : value).join(' + ') + (result.modifier > 0 ? ' <a style="text-decoration: underline">+' + result.modifier + '</a>' : result.modifier < 0 ? ' <a style="text-decoration: underline">' + result.modifier + '</a>' : '') + '] = <strong>' + result.value + '</strong> '
|
||||||
})
|
})
|
||||||
document.getElementById('results').showPopover()
|
document.getElementById('results').showPopover()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
diceBox.clearDice();
|
diceBox.clear();
|
||||||
document.getElementById('results').hidePopover()
|
document.getElementById('results').hidePopover()
|
||||||
}, {clearAfter} * 1000)
|
}, {clearAfter} * 1000)
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<div class="w3-panel w3-theme-l4 w3-card w3-display-container"
|
<div class="w3-panel w3-theme-l4 w3-card w3-display-container"
|
||||||
style="padding: 25px; text-align: center; margin-bottom: auto;">
|
style="padding: 25px; text-align: center; margin-bottom: auto;">
|
||||||
<label for="theme">Theme </label>
|
<label for="theme">Theme </label>
|
||||||
<select name="theme" id="theme" style="margin: 0 25px"></select>
|
<select name="theme" id="theme" style="margin: 25px"></select>
|
||||||
|
|
||||||
<div style="display: flex; flex-direction: row; justify-content: space-between; align-items: baseline">
|
<div style="display: flex; flex-direction: row; justify-content: space-between; align-items: baseline">
|
||||||
<div style="flex-grow: 1; padding: 0 10px">
|
<div style="flex-grow: 1; padding: 0 10px">
|
||||||
|
@ -29,11 +29,6 @@
|
|||||||
<meta property="twitter:domain" content="{http:request.authority}">
|
<meta property="twitter:domain" content="{http:request.authority}">
|
||||||
</head>
|
</head>
|
||||||
<body class="w3-theme-l1">
|
<body class="w3-theme-l1">
|
||||||
<script>
|
|
||||||
if (!localStorage.getItem("userId")) {
|
|
||||||
localStorage.setItem("userId", self.crypto.randomUUID());
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<div class="w3-container w3-content"
|
<div class="w3-container w3-content"
|
||||||
style="height: 95vh; display: flex; flex-direction: column; justify-content: space-between; padding: 25px">
|
style="height: 95vh; display: flex; flex-direction: column; justify-content: space-between; padding: 25px">
|
||||||
<h1 style="text-align: center"><i class="fa-solid fa-dice-d20"></i> Dice-Tower <i class="fa-solid fa-dice-d20"></i>
|
<h1 style="text-align: center"><i class="fa-solid fa-dice-d20"></i> Dice-Tower <i class="fa-solid fa-dice-d20"></i>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user