mirror of
https://github.com/RussellChamp/tpw-roller.git
synced 2026-10-28 00:22:36 +00:00
Add kingdom, place, and region rollers
This commit is contained in:
1 parent
749986c5c2
commit
08aa49d727
6 files changed
+113
-2
No files matched your search
@@ -0,0 +1,30 @@
|
||||
<script lang="ts">
|
||||
import { places } from "./data";
|
||||
import * as _ from "lodash";
|
||||
import { format as formatDate } from "date-fns";
|
||||
import { bodgeString } from "./utils";
|
||||
|
||||
export let rollResults: { value: string; timestamp: string }[] = [];
|
||||
|
||||
function addResult(result: string) {
|
||||
rollResults = [{ value: result, timestamp: formatDate(new Date(), "P kk:mm:ss") }, ...rollResults];
|
||||
}
|
||||
|
||||
function roll(event: Event) {
|
||||
let template = _.sample(places.templates);
|
||||
|
||||
addResult(bodgeString(template, places));
|
||||
}
|
||||
</script>
|
||||
|
||||
<main>
|
||||
<h1>Random Places</h1>
|
||||
<button type="button" class="btn btn-primary" on:click={roll}>Roll Region</button>
|
||||
|
||||
{#each rollResults as result}
|
||||
<h3>{result.timestamp}: {result.value}</h3>
|
||||
{/each}
|
||||
</main>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in new issue
Block a user