This module is set of tools for RPG games. It contains:
- A random table generator
- A dice roller generator
You can install it as a node module
$> npm install -S @rolodromo/rpgen
Or add it to your HTML directly from unpkg
CDN:
<script src="//unpkg.com/@rolodromo/rpgen"></script>
And then is accesible globally as rpgen
object.
const rpgen = require('@rolodromo/rpgen')
const myRoller = rpgen.roller.create('best 3 of 4d6+1')
console.log(myRoller()) // output: 16
const rpgen = require('@rolodromo/rpgen')
const myRoller = rpgen.roller.create('best 3 of 4d6+1', { repeat: 6 })
console.log(myRoller()) // output: [16, 13, 12, 14, 13, 15]
const myGenerator = rpgen.generator.create(`
;@tpl|main
- [lines]
- [roll]
;lines
line 1 is random
line 2 is awesome
line 3 is great
;roll
1d20 roll: [1d20]
`)
console.log(generator.generate())
// output:
// - line 2 is awesome
// - 1d20 roll: 14
- Add more complex table generator examples
- Allow combination of rolls (ex: 4d6 + 3d8)
- Improve dev workflow with a better webpack config
- Add filter to convert from number to words (ex: 12 => twelve, 100 => one hundred, etc)
- Maybe migrate to nearley grammar parser
This is the successor of my other unfinished projects: