saves dice config to localstorage #3

Merged
arindy merged 7 commits from update-styling into main 2025-02-10 01:20:52 +01:00
3 changed files with 3 additions and 3 deletions
Showing only changes of commit 001a35165a - Show all commits

View File

@ -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(

View File

@ -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>

View File

@ -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/>&ensp; 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> &#127922; ' + resultText