dnd-rolltable/README.md

44 lines
1.6 KiB
Markdown
Raw Normal View History

2022-07-31 15:03:19 -07:00
# RollTables
RollTables is a python library for generating tables suitable for selecting random options using dice rolls.
## Quick Start
2022-07-31 15:07:39 -07:00
Clone the repo and install the virtual env:
2022-07-31 15:03:19 -07:00
```
2022-07-31 15:07:39 -07:00
% git clone https://github.com/evilchili/dnd-rolltable
% cd dnd-rolltable
% poetry install
2022-07-31 15:03:19 -07:00
```
2022-07-31 15:07:39 -07:00
Invoke the CLI:
2022-07-31 15:03:19 -07:00
```
% poetry run roll-table custom example.yaml
2022-07-31 15:03:19 -07:00
┏━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┓
┃ Roll ┃ Rarity ┃ Color ┃ Notes ┃
┡━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━┩
│ d1-d5 │ common │ red │ │
│ d6-d10 │ common │ yellow │ │
│ d11-d12 │ rare │ indigo │ │
│ d13 │ rare │ violet │ │
│ d14-d15 │ uncommon │ blue │ │
│ d16-d19 │ uncommon │ green │ │
│ d20 │ wondrous │ octarine │ the color of magic │
└─────────┴──────────┴──────────┴────────────────────┘
```
2022-07-31 15:11:39 -07:00
Run ```poetry run roll-table --help``` for details.
2022-07-31 15:03:19 -07:00
### Library Use
2022-07-30 14:20:26 -07:00
2022-07-31 15:03:19 -07:00
```
from rolltable import tables
sources = [
Path('spells.yaml').read_text(),
Path('weapons.yaml').read_text(),
Path('items.yaml').read_text()
]
rt = tables.RollTable(sources, die=100)
```