saves dice config to localstorage #3
@ -29,7 +29,7 @@ final class DiceResource(@Context val sse: Sse) {
|
||||
if (!sseBroadcasters.containsKey(id)) {
|
||||
sseBroadcasters[id] = sse.newBroadcaster()
|
||||
}
|
||||
data.roll = data.command.split(" ").toTypedArray<String>()
|
||||
data.roll = data.command.split(" ", "&", "and").filter { it.isNotEmpty() }.map { it.trim() }.toTypedArray<String>()
|
||||
data.room = id.split(":")[0]
|
||||
data.user = id.split(":")[1]
|
||||
sseBroadcasters[id]?.broadcast(
|
||||
|
@ -67,7 +67,7 @@
|
||||
<br/>
|
||||
<color-picker value="#cd72fe" id="themeColor"></color-picker><br/>
|
||||
</div><br/>
|
||||
<p>Example Commands: "1d6", "2d8 1d100", "5d6+10"</p>
|
||||
<p>Example Commands: "1d6", "2d8 1d100", "1d4 and 1d6", "2d20 & 1d2, "5d6+10"</p>
|
||||
<label for="command">Command </label><input type="text" id="command" onkeyup="roll(event)"/>
|
||||
<button hidden id="roll" onclick="roll()">Roll</button>
|
||||
</div>
|
||||
|
@ -27,7 +27,7 @@
|
||||
result.rolls.forEach(roll => {
|
||||
values.push(roll.value);
|
||||
})
|
||||
resultText += ' (' + values.join(' + ') + (result.modifier > 0 ? ' <a style="text-decoration: underline">+' + result.modifier + '</a>': result.modifier < 0 ? ' <a style="text-decoration: underline">' + result.modifier + '</a>': '') + ' = <strong style="font-size: x-large">' + result.value + '</strong>) '
|
||||
resultText += '<br/>  D' + result.sides + ': [' + values.map(value => value === 1 ? '<strong style="color: red">' + value + '</strong>' : value === result.sides ? '<strong style="color: 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 style="font-size: x-large">' + result.value + '</strong> '
|
||||
})
|
||||
}
|
||||
node.innerHTML = '<strong>' + data.name + ':</strong> 🎲 ' + resultText
|
||||
|
Loading…
x
Reference in New Issue
Block a user