updating rolltable interface

This commit is contained in:
evilchili 2024-01-06 12:23:05 -08:00
parent 734645f559
commit 280949c9e7
3 changed files with 5 additions and 10 deletions

View File

@ -6,7 +6,7 @@ from pathlib import Path
import click
import typer
from rolltable.tables import RollTable
from rolltable.types import RollTable
from typing_extensions import Annotated
from site_tools.content_manager import create

View File

@ -2,7 +2,7 @@ import random
import collections
from pathlib import Path
from rolltable.tables import RollTable
from rolltable.types import RollTable
from npc import random_npc
Crime = collections.namedtuple('Crime', ['name', 'min_bounty', 'max_bounty'])

View File

@ -3,8 +3,7 @@ from pathlib import Path
from prompt_toolkit.application import get_app
from prompt_toolkit.completion import WordCompleter
from prompt_toolkit.key_binding import KeyBindings
from rich.table import Table
from rolltable.tables import RollTable
from rolltable.types import RollTable
from site_tools.shell.base import BasePrompt, command
from site_tools import campaign
@ -115,15 +114,11 @@ class DMShell(BasePrompt):
return self.date()
def _rolltable(self, source, frequency='default', die=20):
rt = RollTable(
return RollTable(
[Path(f"{self.cache['table_sources_path']}/{source}").read_text()],
frequency=frequency,
die=die
)
table = Table(*rt.rows[0])
for row in rt.rows[1:]:
table.add_row(*row)
return table
).as_table()
@command(usage="""
[title]DATE[/title]